|
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.LyDataProvider
public abstract class LyDataProvider
This class is used by DataSources to transmit their requests to an instance of RequestEncoder.
The LyDataProvider class implements the connector. Every instance of LyDataSource is associated to an instance of LyDataProvider.
The services of the LyDataProvider classes are :
- Manage instances of the LyConnection (connection to the information system : RDBMS, files,
application server, corba connection ...).
- Create the description of physical data in memory and make the link with the logical layer.
- Create instances of LyRequestEncoder, associated to the LyDataSource instances : the encoder
implements the communication between the dataSource and the connection. (Request encoding,
connection service calls ...)
- Accessors to valid LyConnection instances for the LyRequestEncoder instances.
LyDataProvider implements a connection pool to manage multiple connections as a connection stack. The number of connection in the pool is a parameter (default is 1 single connection).
Remark : current implementation only uses a number of connection pool for SQL data providers, or programmatically in the code of a specific data provider.
LyRequestEncoder
,
LyConnection
Field Summary | |
---|---|
static java.lang.String |
__VERSION
|
Constructor Summary | |
---|---|
LyDataProvider(LyApplication application,
LyLocation location)
Constructs a data provider. |
|
LyDataProvider(LyApplication application,
java.lang.String id)
Deprecated. should use LyDataProvider(LyApplication application, LyLocation location) instead of this constructor. |
Method Summary | |
---|---|
boolean |
canBeFullyLoaded(LyClass aClass)
Indicates if this data provider can be fully loaded. |
boolean |
close()
Closes all connections from the connection pool. |
void |
dumpConnections()
|
LyApplication |
getApplication()
Accessor to the application instance. |
LyConnection |
getConnection()
Accessor to a connection instance from the connection pool. |
LyEnvironment |
getEnvironment()
Accessor to the environment instance. |
LyEventNotifier |
getEventNotifier()
Accessor to the notification service added to this data-provider. |
java.lang.String |
getId()
Accessor to the id of the provider. |
LyLocation |
getLocation()
Accessor to the location of the provider. |
int |
getNbAvailableConnection()
Accessor to the number of connections available in the connection pool. |
int |
getNbConnection()
Accessor to the max number of connections available in the connection pool. |
abstract LyRequestEncoder |
getRequestEncoder(LyDataSource dataSource)
Create a specific request encoder for the specified dataSource. |
boolean |
hasLostConnection()
Tests if the connection with the physical layer has been lost or not. |
boolean |
isConnectionReady()
Tests if the data connection is ready or not. |
boolean |
isModified()
Checks if this provider was modified. |
boolean |
isModified(LyClass modifiedClass)
Checks if the given class was modified for this provider. |
boolean |
isNotifierReady()
Tests if the notifier is ready or not. |
boolean |
isXASupported()
Tests if this data provider supports the XA protocol or not. |
void |
releaseConnection(LyConnection connection)
Return a connection instance to the connection pool. |
boolean |
save()
To save data managed by this provider. |
void |
setEventNotifier(LyEventNotifier notifier)
Modifier of the notification service added to this data-provider. |
void |
setLocation(LyLocation location)
Sets location on provider. |
void |
setModified(boolean modified,
LyClass modifiedClass,
java.lang.Object object)
Sets the given class as modified on this provider. |
void |
setNbConnection(int nbConnection)
Sets the number of connection available in the connection pool. |
void |
sleep()
This method is called when the application is going on sleeping mode. |
boolean |
validate()
This method is used to build all the class peers for all the classInfo. |
boolean |
validate(LyInfoList<LyClassInfo> classInfos)
This method is used to build all the class peers for all the classInfo. |
boolean |
validateNotifier(LyInfoList<LyClassInfo> classInfos)
Validate the associated event notifier if exists. |
boolean |
wakeUp()
This method is called when the application is going out of sleeping mode Default implementation call create the connection pool and wakes up the notifier. |
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
Constructor Detail |
---|
public LyDataProvider(LyApplication application, LyLocation location)
application
- Current application instancelocation
- This value is obtained from the location parameter in the meta model.public LyDataProvider(LyApplication application, java.lang.String id)
application
- Current application instanceid
- Identifier of this dataProvider. This value is obtained from the
location parameter in the meta model.Method Detail |
---|
public boolean isConnectionReady()
public boolean isNotifierReady()
public boolean hasLostConnection()
public void setLocation(LyLocation location)
location
- New location for the provider.public final LyApplication getApplication()
public final LyLocation getLocation()
public final java.lang.String getId()
public final LyEnvironment getEnvironment()
public final LyEventNotifier getEventNotifier()
public final int getNbConnection()
public void setNbConnection(int nbConnection)
nbConnection
- number of connection available. If <= 1 , one connection is used.public final int getNbAvailableConnection()
public void setEventNotifier(LyEventNotifier notifier)
notifier
- the notification service to associate with this data provider.public boolean validate()
public boolean validate(LyInfoList<LyClassInfo> classInfos)
classInfos
- Classes to validate.
public boolean validateNotifier(LyInfoList<LyClassInfo> classInfos)
classInfos
- Classes to validate.
public void sleep()
Application will restart after calling wakeUp()
close()
,
wakeUp()
public boolean wakeUp()
sleep()
public boolean close()
createConnections(int)
public final boolean save()
public final LyConnection getConnection()
If no connection is available currently, this method will block until a connection is released and available.
Important ! The connection MUST be released after usage so it's available for the connection pool. Invoke releaseConnection when the connection is no longer needed.
releaseConnection(leon.peer.LyConnection)
public final void releaseConnection(LyConnection connection)
The connection reference was obtained by getConnection()
Important ! The connection MUST be released after usage so it's available for the connection pool. Invoke releaseConnection when the connection is no longer needed.
connection
- a connection instance from the connection pool.releaseConnection(leon.peer.LyConnection)
public abstract LyRequestEncoder getRequestEncoder(LyDataSource dataSource)
This method is used internally, but subclasses should override this method and create an instance of their own (specific) request encoder.
Default returns a LyRequestEncoder instance.
dataSource
- reference to the dataSource associated to this request encoder.
public boolean isXASupported()
public boolean canBeFullyLoaded(LyClass aClass)
public void dumpConnections()
public void setModified(boolean modified, LyClass modifiedClass, java.lang.Object object)
modified
- True if modified, false otherwise.modifiedClass
- Class that was modified.object
- Modified instance(s) (may be null).public boolean isModified()
public boolean isModified(LyClass modifiedClass)
modifiedClass
- Class that is checked.
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |