Package overit.geocall.da
Class DATask
java.lang.Object
overit.geocall.da.DATask
- All Implemented Interfaces:
Serializable,Runnable,Identified,Tool
- Direct Known Subclasses:
BoundedTask,overit.geocallapp.replicator.basic.base.DataSource.DATaskReplicator,DATBindNotificationsToOdl,DATCalculateNotificationsStatuses,DATCalculateNotificationStatus,DATChangeNotificationsStatus,DATCheckNotificationNotModified,DATCreateOdlInSapFromNotification,overit.geocallapp.wfm.schedulazione.odl.DATCreazioneOdlBase,overit.geocallapp.wfm.schedulazione.cristallizzazione.monitorattivita.pianogiornaliero.dat.DATElaboraOttimizzazione,DATFindNotificationProfiloCatalogo,DATLoadFailureDD,DATLoadFailureInvestigation,DATLoadMRelChartData,DATLoadNotification,DATLoadStruggleFailure,DATManageBatchNotificationsIntegration,DATManageNotificationSapIntegration,DATNewNotificationCode,DATSaveNotification,DATSaveProfile,DATSendMessage,DATTakeInChargeNotification,DATUnbindNotificationsFromOdl,DATUser,overit.geocallapp.replicator.basic.base.DataSource.DBViewTaskReplicator,ErrorNotifier,RRTask,StaticView.SVTask,XMLTask
Abstract class to extend when you want to create a task that perform a database access.
To use the class you must implement the
The class provides a series of automatisms (automatic rollback) that allow to don't worry about the correct release of the connections that are opened during the task itself.
To use the class you must implement the
body() method, that is the one called when the task starts. To start the specific task, after the
instantiation of the class, it's necessary to invoke the start() method (or the startInBackground()
if you want to run the task in background). The class provides a series of automatisms (automatic rollback) that allow to don't worry about the correct release of the connections that are opened during the task itself.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbody()Abstract method, that must be implemented, that represent the start point of the task.protected voidcommit(PooledConnection conn) Makes an explicit commit on the connection passed as parameterprotected voidprotected PooledConnectiongetConnection(String poolName, String activity) Retrieves a connection from the connection pool and the specific connection is stored in the list of the opened connections.protected DABaseCreates, through the factory mechanism, a specific DA used to do the queriesRetrieves anIdentityobject used to store the informations about the user currently logged in the application.protected PooledConnectiongetServiceConnection(String poolName, String activity) Retrieves a connection from the service connection pool and the specific connection is stored in the list of the opened connections.protected CourierholdFactoryCourier(String name) protected CourierholdUserCourier(String name) protected voidReleases a connection and reinsert it into the connection pool.protected voidrollback(PooledConnection conn) Makes an explicit rollback on the connection passed as parameterfinal voidrun()voidsetIdentity(Identity identity) Sets aIdentityobject used to store the informations about the user currently logged in the application.voidstart()Starts the task.voidStarts the task in background.static voidsynchronizeOn(PooledConnection pc, String table) Deprecated.this method should not be used anymore
-
Field Details
-
_usedConnections
-
_usedCouriers
-
-
Constructor Details
-
DATask
public DATask()
-
-
Method Details
-
getIdentity
Retrieves anIdentityobject used to store the informations about the user currently logged in the application.- Specified by:
getIdentityin interfaceIdentified- Returns:
- The object that contains the informations about the user currently logged in the application
-
setIdentity
Sets aIdentityobject used to store the informations about the user currently logged in the application.- Specified by:
setIdentityin interfaceIdentified- Parameters:
identity- The object to set
-
start
Starts the task.- Throws:
DAValidateException- If there are error in the data validation phase, a DAValidateException is thrownDAException- If there is a (blocking) data-access error, a DAException is thrown
-
getConnection
Retrieves a connection from the connection pool and the specific connection is stored in the list of the opened connections. All the connections stored in the list are released at the end of the run of the task.- Parameters:
poolName- The name of the pool from which extract the connectionactivity- Description of the activity to be carried out by using the connection- Returns:
- The requested connection
- Throws:
DAException- If there is a (blocking) data-access error, a DAException is thrown to the caller
-
getServiceConnection
protected PooledConnection getServiceConnection(String poolName, String activity) throws DAException Retrieves a connection from the service connection pool and the specific connection is stored in the list of the opened connections. All the connections stored in the list are released at the end of the run of the task.- Parameters:
poolName- The name of the pool from which extract the connectionactivity- Description of the activity to be carried out by using the connection- Returns:
- The requested connection
- Throws:
DAException- If there is a (blocking) data-access error, a DAException is thrown to the caller
-
holdUserCourier
- Throws:
DAException
-
holdFactoryCourier
- Throws:
DAException
-
releaseConnection
Releases a connection and reinsert it into the connection pool. This method allows to explicit release a connection when you don't want to use it anymore. All connections obtained with thegetConnection()method and not explicitly released by this method are automatically released anyway at the end of the run of the task.- Parameters:
c- The connection that you want to release- Throws:
DAException- If there is an error during the release, a DAException is raised to the caller
-
deliverCourier
-
rollback
Makes an explicit rollback on the connection passed as parameter- Parameters:
conn- The specific connection on which do the rollback- Throws:
DAException- If there is an error during the rollback, a DAException is raised to the caller
-
commit
Makes an explicit commit on the connection passed as parameter- Parameters:
conn- The specific connection on which do the commit- Throws:
DAException- If there is an error during the commit, a DAException is raised to the caller
-
getDA
Creates, through the factory mechanism, a specific DA used to do the queries- Parameters:
name- The name of the DA- Returns:
- The specific DA created by the factory
-
body
Abstract method, that must be implemented, that represent the start point of the task. The method contains the application logic of the specific task.- Throws:
DAException- If there is a (blocking) data-access error, a DAException is thrown to the callerDAValidateException- If there are error in the data validation phase, a DAValidateException is thrown
-
run
public final void run() -
startInBackground
public void startInBackground()Starts the task in background. -
synchronizeOn
Deprecated.this method should not be used anymoreSynchronizes the task over a specific table to prevent concurrent modification of the table itself- Parameters:
pc- The connection used by the takstable- The table on which we want to synchronize
-