|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.peer.LyRequestEncoder
leon.peer.file.LyFileRequestEncoder
public class LyFileRequestEncoder
This class is used for local files as data provider. Methods for creation, deletion and modification are not overriden since they don't have to write anything in the corresponding files. The specific method saveObjects must be called in order to make the objects persistent in a file.
LyRequestEncoder
Field Summary | |
---|---|
static java.lang.String |
__VERSION
|
LyEnvironment |
_environment
Current environment if any, otherwise use dataprovider environment. |
java.lang.String |
_fieldSep
Separator used between fields. |
java.lang.String |
_valueSep
Separator used between values. |
static java.lang.String |
EMPTY_CHARSET
Empty char set. |
static int |
EXPORT_ENCODING
Value for export encoding (used in encodeValue). |
static int |
RAW_ENCODING
Value for raw encoding (used in encodeValue). |
static int |
SPREADSHEET_ENCODING
Value for spreadsheet encoding (used in encodeValue). |
static int |
TEXT_ENCODING
Value for text encoding (used in encodeValue). |
static int |
XML_EXPORT_ENCODING
Value for xml encoding (used in encodeValue). |
Constructor Summary | |
---|---|
LyFileRequestEncoder(LyDataProvider provider,
LyDataSource dataSource,
java.lang.String fieldSep,
java.lang.String valueSep)
Constructor. |
Method Summary | |
---|---|
java.lang.String |
asciiEncode(java.lang.String str)
Encode String in a quoted printable like manner Avoid conflicts in file. |
boolean |
createObject(java.lang.Object object)
To create a new object. |
java.util.Vector<LyField> |
decodeHeader(java.lang.String line)
Read a line and return a set of FieldInfos. |
LyValueSet |
decodeValue(java.lang.String line,
java.util.Vector<LyField> fields,
int l,
boolean spreadSheetDecoding)
Read a line and return a set of values. |
java.util.Vector<java.lang.Object> |
decodeValues(java.util.Vector<java.lang.String> lines,
java.util.Vector<LyField> fields)
Read a set of lines and return a set of objects. |
java.util.Vector<java.lang.Object> |
decodeValues(java.util.Vector<java.lang.String> lines,
java.util.Vector<LyField> fields,
boolean checkObject)
Read a set of lines and return a set of objects. |
boolean |
deleteObject(java.lang.Object object)
To delete an object. |
java.lang.String |
encodeHeader(java.util.Vector<?> fields,
int type)
Return a line describing the FieldInfos. |
java.lang.String |
encodeValue(java.lang.Object object,
java.util.Vector<?> fields,
int type)
Return a line describing the ValueSet. |
java.util.Vector<java.lang.String> |
encodeValues(java.util.Vector<java.lang.Object> objects,
java.util.Vector<LyField> fields,
int type)
Read a set of lines and return a set of objects. |
java.lang.Object |
fromString(LyField field,
java.lang.String str)
|
java.lang.Object |
fromString(LyField field,
java.lang.String str,
boolean spreadSheetDecoding)
|
LyEnvironment |
getEnvironment()
Utility method to get current environment. |
java.lang.String |
getFieldSeparator()
Gets the fields separator. |
boolean |
getObject(LyObjectId objectId,
java.util.Vector<LyField> fields)
Get an object. |
boolean |
getObjects(java.util.Vector<LyField> fields,
LySort sort,
LyFilter filter,
int n)
Get a set of objects. |
boolean |
getSize()
Return the number of objects from the file. |
boolean |
getSize(LyFilter filter)
Return the number of objects from the file . |
java.lang.String |
getValueSeparator()
Gets the values separator. |
void |
init()
Initialisation of the data of the instance. |
java.util.Vector<java.lang.String> |
readFromConnection()
Sends a request to the file connection for reading data. |
boolean |
saveObjects(java.util.Vector<java.lang.Object> objects,
java.util.Vector<LyField> fields,
int type)
Method used to saved all the objects contained in the corresponding data source cache. |
void |
setEnvironment(LyEnvironment env)
Utility method to set current environment. |
void |
setHeaderMark(java.lang.String headerMark)
Sets the header mark. |
boolean |
setObject(java.lang.Object object)
To set an object. |
boolean |
setObjects(java.util.Vector<java.lang.Object> objects)
To set a set of objects. |
void |
setResponse(LyResponse response)
Set the request encoder response. |
boolean |
writeToConnection(java.util.Vector<java.lang.Object> objects,
java.util.Vector<LyField> fields,
int type)
Sends a request to the file connection for writing data. |
boolean |
writeToConnection(java.util.Vector<java.lang.String> lines)
Sends a request to the file connection for writing data. |
Methods inherited from class leon.peer.LyRequestEncoder |
---|
deleteObjects, getClassBinding, getDataClass, getProvider, getResponse, isSynchronous, loadObject, setClassBinding, setDataClass, toString, toString, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String __VERSION
public static final int RAW_ENCODING
public static final int TEXT_ENCODING
public static final int SPREADSHEET_ENCODING
public static final int EXPORT_ENCODING
public static final int XML_EXPORT_ENCODING
public static final java.lang.String EMPTY_CHARSET
public java.lang.String _fieldSep
public java.lang.String _valueSep
public LyEnvironment _environment
Constructor Detail |
---|
public LyFileRequestEncoder(LyDataProvider provider, LyDataSource dataSource, java.lang.String fieldSep, java.lang.String valueSep)
classInfo
- ClassInfo used by the request encoder.fieldSep
- separator used between fields.valuedSep
- separator used between values.Method Detail |
---|
public void setHeaderMark(java.lang.String headerMark)
headerMark
- new header mark.public java.lang.String getFieldSeparator()
public java.lang.String getValueSeparator()
public void init()
public void setResponse(LyResponse response)
setResponse
in class LyRequestEncoder
the
- responsepublic boolean getObject(LyObjectId objectId, java.util.Vector<LyField> fields)
getObject
in class LyRequestEncoder
objectId
- object identifierfields
- the fields to load (if null, load all)
public boolean getObjects(java.util.Vector<LyField> fields, LySort sort, LyFilter filter, int n)
getObjects
in class LyRequestEncoder
fields
- the fields to load (if null, load all)sort
- indicates sorting criterion, or null if default sort is used.filter
- indicates filtering criterion, or null if there is no filter.n
- maximum number of objects to get.
public boolean getSize()
public boolean getSize(LyFilter filter)
getSize
in class LyRequestEncoder
filter
- indicates filtering criterion, or null if there is no filter.
public boolean createObject(java.lang.Object object)
createObject
in class LyRequestEncoder
object
- the new object to create
public boolean setObject(java.lang.Object object)
setObject
in class LyRequestEncoder
object
- the object to set
public boolean setObjects(java.util.Vector<java.lang.Object> objects)
setObjects
in class LyRequestEncoder
objects
- the objects to set
public boolean deleteObject(java.lang.Object object)
deleteObject
in class LyRequestEncoder
object
- the object to delete
public boolean saveObjects(java.util.Vector<java.lang.Object> objects, java.util.Vector<LyField> fields, int type)
fields
- fields to save (if null save all).type
- indicates the file format
public java.util.Vector<java.lang.String> readFromConnection()
public boolean writeToConnection(java.util.Vector<java.lang.String> lines)
lines
- lines to write on the file.
public boolean writeToConnection(java.util.Vector<java.lang.Object> objects, java.util.Vector<LyField> fields, int type)
objects
- the set of objects to encode.fields
- FieldInfos to save (if null save all).type
- indicates the file format.
public java.util.Vector<java.lang.Object> decodeValues(java.util.Vector<java.lang.String> lines, java.util.Vector<LyField> fields)
lines
- lines to read.fields
- the fields to load (if null, load all)
public java.util.Vector<java.lang.Object> decodeValues(java.util.Vector<java.lang.String> lines, java.util.Vector<LyField> fields, boolean checkObject)
lines
- lines to read.fields
- the fields to load (if null, load all)checkObject
- indicates if we must check if object is already in data source
public java.util.Vector<LyField> decodeHeader(java.lang.String line)
line
- line to read.
public LyValueSet decodeValue(java.lang.String line, java.util.Vector<LyField> fields, int l, boolean spreadSheetDecoding)
line
- line to read.fields
- the list of FieldInfos.l
- position of line in the file.spreadSheetDecoding
- indicates if spreadsheet decoding mode is set
public java.lang.Object fromString(LyField field, java.lang.String str)
public java.lang.Object fromString(LyField field, java.lang.String str, boolean spreadSheetDecoding)
public java.util.Vector<java.lang.String> encodeValues(java.util.Vector<java.lang.Object> objects, java.util.Vector<LyField> fields, int type)
objects
- the set of objects to encode.fields
- FieldInfos to save (if null save all).type
- indicates the file format.
public java.lang.String encodeHeader(java.util.Vector<?> fields, int type)
fields
- the FieldInfos to encode.type
- indicates the file format.
public java.lang.String encodeValue(java.lang.Object object, java.util.Vector<?> fields, int type)
values
- the ValueSet to encode.fields
- the FieldInfos to encode.type
- indicates the file format.
public java.lang.String asciiEncode(java.lang.String str)
public LyEnvironment getEnvironment()
public void setEnvironment(LyEnvironment env)
env
- Current environment.
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |