LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.peer
Class LyRequestEncoder

java.lang.Object
  extended by leon.peer.LyRequestEncoder
Direct Known Subclasses:
LyBlobRequestEncoder, LyExtendRequestEncoder, LyFileRequestEncoder, LyInfoRequestEncoder, LyJavaRequestEncoder, LyLocalRequestEncoder, LyUnionRequestEncoder, W4BpmRequestEncoder

public abstract class LyRequestEncoder
extends java.lang.Object

This class is used to encode a request made on a data source and decode results to give a response. This class is abstract and must be overriden to provide specific encoding and decoding.

The task of the request encoder is to process requests from a data source and to send 'requests' using a connection instance. The request encoder class converts a data source demand into a 'language' which is understood by the connection instance : the specific 'language' of the underlying connection, like SQL, XML, method invocation on a Corba service.

Additionally, the request encoder instance must 'decode' or interpret responses from the specific connection to a 'language' understood by Leonardi. Basically, this class implements the mapping between the chosen physical layer and the data representation in the specific connection.

See Also:
LyDataSource, LyResponse

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LyRequestEncoder(LyDataProvider provider, LyDataSource dataSource)
          Constructs a request encoder.
 
Method Summary
abstract  boolean createObject(java.lang.Object object)
          Create a new object.
abstract  boolean deleteObject(java.lang.Object object)
          Delete an object.
 boolean deleteObjects(java.util.Vector<java.lang.Object> objects)
          To delete a list of objects.
 LyClassBinding getClassBinding()
          Gets the binding between logical class and physical class.
 LyClass getDataClass()
          Accessor to the physical data class of the request encoder.
abstract  boolean getObject(LyObjectId objectId, java.util.Vector<LyField> fields)
          Load an object from an object id.
abstract  boolean getObjects(java.util.Vector<LyField> fields, LySort sort, LyFilter filter, int n)
          Load a number of objects matching a given filter and sorted by a specified sort.
 LyDataProvider getProvider()
          Gets the provider that created this request encoder.
 LyResponse getResponse()
          Get the response in which results are returned.
abstract  boolean getSize(LyFilter filter)
          Get the number of objects that match a given filter.
 boolean isSynchronous()
          Check if the request encoder is synchronous.
 boolean loadObject(LyObjectId objectId, java.util.Vector<LyField> fields)
          Load an object from an object id.
 void setClassBinding(LyClassBinding classBinding)
          Sets the binding between logical class and physical class.
 void setDataClass(LyClass c)
          Sets the physical data class of the request encoder.
abstract  boolean setObject(java.lang.Object object)
          To set an object.
 boolean setObjects(java.util.Vector<java.lang.Object> objects)
          To set a list of objects.
 void setResponse(LyResponse response)
          Set the request encoder response.
static java.lang.String toString(java.lang.Object object)
          Converts an Object to a string.
static java.lang.String toString(java.lang.Object[] array)
          Converts an Array to a string.
static java.lang.String toString(java.util.Vector<?> vector)
          Converts a Vector to a string.
 
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
Constructor Detail

LyRequestEncoder

public LyRequestEncoder(LyDataProvider provider,
                        LyDataSource dataSource)
Constructs a request encoder. Initialization is done with the init method.

Parameters:
provider - Provider that creates this request encoder.
dataSource - Data source client of the request.
Method Detail

toString

public static java.lang.String toString(java.lang.Object object)
Converts an Object to a string.

Parameters:
object - The object that must be converted.
Returns:
The string that represents the object or null if the object is null.

toString

public static java.lang.String toString(java.lang.Object[] array)
Converts an Array to a string.

Parameters:
array - The Array that must be converted.
Returns:
The string that represents the array.

toString

public static java.lang.String toString(java.util.Vector<?> vector)
Converts a Vector to a string.

Parameters:
vector - The vector that must be converted.
Returns:
The string that represents the vector.

getProvider

public final LyDataProvider getProvider()
Gets the provider that created this request encoder.

Returns:
Provider of this request encoder.

isSynchronous

public final boolean isSynchronous()
Check if the request encoder is synchronous.

Returns:
True if the request is synchronous, false otherwise.

getResponse

public final LyResponse getResponse()
Get the response in which results are returned.

Returns:
Response of the request encode by this request encoder.

getClassBinding

public final LyClassBinding getClassBinding()
Gets the binding between logical class and physical class. Warning ! Trasmitting the binding is a workaround to retrieve information on class filter and may be suppressed in further version.

Returns:
Binding between logical class and physical class

setResponse

public void setResponse(LyResponse response)
Set the request encoder response.

Parameters:
response - Response in which results are returned.
Throws:
java.lang.IllegalArgumentException - If the given response is null.
java.lang.IllegalStateException - If this request encoder has already a response.

setClassBinding

public final void setClassBinding(LyClassBinding classBinding)
Sets the binding between logical class and physical class. Warning ! Trasmitting this binding is a workaround to retrieve information on class filter and may be suppressed in further version.

Parameters:
classBinding - Binding between logical class and physical class

loadObject

public boolean loadObject(LyObjectId objectId,
                          java.util.Vector<LyField> fields)
Load an object from an object id. This method forces the request to be sent to external data provider. Default implementation of this method is to call getObject(LyObjectId, Vector).

Parameters:
objectId - Object identifier.
fields - Fields to load (if null, load all fields).
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

getObject

public abstract boolean getObject(LyObjectId objectId,
                                  java.util.Vector<LyField> fields)
Load an object from an object id. If the object is already in memory, returns this object and doesn't sent the request to the external data provider.

Parameters:
objectId - Object identifier.
fields - Fields to load (if null, load all fields).
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

getObjects

public abstract boolean getObjects(java.util.Vector<LyField> fields,
                                   LySort sort,
                                   LyFilter filter,
                                   int n)
Load a number of objects matching a given filter and sorted by a specified sort.

Parameters:
fields - Fields to load (if null, load all fields).
sort - Gives sorting criterion, or null if default sort is used.
filter - Specifies filtering criterion, or null if there is no filter.
n - Maximum number of objects to get (-1 means no limit).
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

getSize

public abstract boolean getSize(LyFilter filter)
Get the number of objects that match a given filter.

Parameters:
filter - Specifies filtering criterion, or null if there is no filter.
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

deleteObject

public abstract boolean deleteObject(java.lang.Object object)
Delete an object.

Parameters:
object - Object to delete.
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

deleteObjects

public boolean deleteObjects(java.util.Vector<java.lang.Object> objects)
To delete a list of objects.

Parameters:
objects - Objects to delete.
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

createObject

public abstract boolean createObject(java.lang.Object object)
Create a new object.

Parameters:
object - New object to create.
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

setObject

public abstract boolean setObject(java.lang.Object object)
To set an object.

Parameters:
object - Object to set.
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

setObjects

public boolean setObjects(java.util.Vector<java.lang.Object> objects)
To set a list of objects.

Parameters:
objects - List of objects to set.
Returns:
True if the request was correctly sent to the external data provider, false otherwise.

setDataClass

public final void setDataClass(LyClass c)
Sets the physical data class of the request encoder. Warning ! Internal use only.

Parameters:
classBinding - Binding between logical class and physical class

getDataClass

public final LyClass getDataClass()
Accessor to the physical data class of the request encoder.

Returns:
c physical class

(c) January 2013 - W4 S.A.

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