LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.peer.file
Class LyFileConnection

java.lang.Object
  extended by leon.peer.LyConnection
      extended by leon.peer.file.LyFileConnection
Direct Known Subclasses:
LyFileInfoConnection, LyImportFileConnection

public class LyFileConnection
extends LyConnection

This class is used as a connection for local files.

See Also:
LyConnection

Field Summary
static java.lang.String __VERSION
           
static boolean TEST_CHARSET
          When reading file lines, check that default charset is correct.
 
Constructor Summary
LyFileConnection(LyApplication application, java.lang.String baseDirectory)
          Constructor.
 
Method Summary
 void closeFile(LyClass peerClass, java.io.PrintWriter pw)
          Close the PrintWriter and write the end of file.
 java.lang.String getConnectionCharset()
          Gets the connection charset.
 int getStartLine()
          Return the start line.
 java.io.PrintWriter openFile(LyClass peerClass)
          Open the file of peerClass and write the begining of file.
 java.util.Vector<java.lang.String> readFile(LyClass peerClass)
          Return the lines describing the objects of the class.
 boolean writeFile(LyClass peerClass, java.util.Vector<java.lang.String> lines)
          Write lines in the file containing objects data.
 void writeLine(java.lang.String line, java.io.PrintWriter pw)
          Write lines in the file containing objects data.
 
Methods inherited from class leon.peer.LyConnection
addValue, autoCommit, close, commit, dump, getError, getUID, getValue, isClosed, isReserved, prepareCommit, released, reserved, rollback, setDataProvider, setError, setUID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

TEST_CHARSET

public static boolean TEST_CHARSET
When reading file lines, check that default charset is correct.

Constructor Detail

LyFileConnection

public LyFileConnection(LyApplication application,
                        java.lang.String baseDirectory)
Constructor.

Parameters:
classInfo - ClassInfo used by the request encoder.
Method Detail

readFile

public java.util.Vector<java.lang.String> readFile(LyClass peerClass)
Return the lines describing the objects of the class. The first line contains information about the structure of the file.

Returns:
a list of Strings.

writeFile

public boolean writeFile(LyClass peerClass,
                         java.util.Vector<java.lang.String> lines)
Write lines in the file containing objects data.

Returns:
true if the operation was successful.

openFile

public java.io.PrintWriter openFile(LyClass peerClass)
Open the file of peerClass and write the begining of file.

Returns:
the PrintWriter of file of peerClass.

writeLine

public void writeLine(java.lang.String line,
                      java.io.PrintWriter pw)
Write lines in the file containing objects data.


closeFile

public void closeFile(LyClass peerClass,
                      java.io.PrintWriter pw)
Close the PrintWriter and write the end of file.


getConnectionCharset

public java.lang.String getConnectionCharset()
Gets the connection charset.

Returns:
the charset if any, null otherwise

getStartLine

public int getStartLine()
Return the start line.

Returns:
the index of the first line of the imported file containing real data.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com