|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.danet.an.workflow.tools.util.SimpleApplicationDirectoryEJB
This EJB provides a directory for simple applications. Applications are considered simple in this context if their state can efficiently be represented (and stored) using a single serializable object.
This directory maps a unique id to the activity unique key information of the executing activity and an associated state (and vice versa). Optionally, the assignment time and an assigned resource may be saved in this directory as well.
de.danet.an.workflow.util
,
Serialized FormConstructor Summary | |
SimpleApplicationDirectoryEJB()
Creates an instance of SimpleApplicationDirectoryEJB
with all attributes initialized to default values. |
Method Summary | |
void |
ejbActivate()
Not called for stateless session beans. |
void |
ejbCreate()
Create a new EJB. |
void |
ejbPassivate()
Not called for stateless session beans. |
void |
ejbRemove()
Remove this EJB. |
SimpleApplicationInfo |
infoByActivity(ActivityUniqueKey auk)
Return the information associated with the activity. |
java.util.Collection |
infosByApplication(java.lang.String applName)
Return infos associated with a given application. |
java.util.Collection |
infosByKey(java.lang.String applName,
java.lang.String applInstKey)
Return the infos associated with the given application name and key. |
java.util.Collection |
infosByResource(java.lang.String applName,
java.lang.String resourceKey)
Return infos associated with a given application and resource. |
SimpleApplicationInfo |
instanceInfo(long instId)
Return the information associated with the application instance. |
long |
registerInstance(java.lang.String applName,
Activity activity,
java.lang.Object state,
boolean saveAssignment)
Register a new application instance. |
long |
registerInstance(java.lang.String applName,
java.lang.String applInstKey,
Activity activity,
java.lang.Object state,
boolean saveAssignment)
Register a new application instance. |
void |
removeInstance(long instId)
Remove an application instance. |
void |
setSessionContext(javax.ejb.SessionContext context)
Save the session context asigned by the container. |
void |
updateInvokingActivity(long instId,
ActivityUniqueKey auk)
Update the activity associated with the given application instance. |
void |
updateState(long instId,
java.lang.Object state)
Update the state information associated with the given application instance id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleApplicationDirectoryEJB()
SimpleApplicationDirectoryEJB
with all attributes initialized to default values.
Method Detail |
public void setSessionContext(javax.ejb.SessionContext context)
setSessionContext
in interface javax.ejb.SessionBean
context
- the contextpublic void ejbCreate() throws javax.ejb.CreateException
javax.ejb.CreateException
- if creation failspublic void ejbRemove()
ejbRemove
in interface javax.ejb.SessionBean
public void ejbActivate() throws javax.ejb.EJBException
ejbActivate
in interface javax.ejb.SessionBean
javax.ejb.EJBException
SessionBean
public void ejbPassivate() throws javax.ejb.EJBException
ejbPassivate
in interface javax.ejb.SessionBean
javax.ejb.EJBException
SessionBean
public long registerInstance(java.lang.String applName, Activity activity, java.lang.Object state, boolean saveAssignment)
retrieve
,
update
and
removeInstance(long)
remove the instance information.
applName
- the application nameactivity
- the invoking activitystate
- the application statesaveAssignment
- if true
the assigned
resource will be saved to allow searching application instances
with a particular assignee
public long registerInstance(java.lang.String applName, java.lang.String applInstKey, Activity activity, java.lang.Object state, boolean saveAssignment)
applName
- the application nameapplInstKey
- an arbitrary key for this instance, up to 1000
characters longactivity
- the invoking activitystate
- the application statesaveAssignment
- if true
the assigned
resource will be saved to allow searching application instances
with a particular assignee
public void removeInstance(long instId)
instId
- the application instance id previously assigned
by registerInstance
public SimpleApplicationInfo instanceInfo(long instId) throws InvalidKeyException
instId
- the application instance id previously assigned
by registerInstance
InvalidKeyException
- if there is no data available for
the given idpublic SimpleApplicationInfo infoByActivity(ActivityUniqueKey auk) throws InvalidKeyException
auk
- the unique key of the activity an application
instance is expected to be registered for.
InvalidKeyException
- if there is no data available for
the given activitypublic java.util.Collection infosByApplication(java.lang.String applName)
applName
- the application name
public java.util.Collection infosByKey(java.lang.String applName, java.lang.String applInstKey) throws InvalidKeyException
applName
- the application nameapplInstKey
- the key associated with the instance
InvalidKeyException
public java.util.Collection infosByResource(java.lang.String applName, java.lang.String resourceKey)
applName
- the application nameresourceKey
- the resource's key
public void updateState(long instId, java.lang.Object state) throws InvalidKeyException
instId
- the application instance id previously assigned
by registerInstance
state
- the new state
InvalidKeyException
- if there is no application instance
with the given idpublic void updateInvokingActivity(long instId, ActivityUniqueKey auk) throws InvalidKeyException
Be careful to ensure the eventual termination of the application. If the creating activity has completed, the terminate method of the tool agent that started the application will not be called on abnormal process completion. So, if a process is terminated abnormally and the starting activity is closed and the stopping activity has not yet been started (and associated with the application) the application will not be stopped. This should normally not be a problem for simple applications.
As a convenience, any application information that is still registered after a process completion will automatically be deleted.
The new activity must belong to the same process as the activity that initially created the application instance.
instId
- the application instance id previously assigned
by registerInstance
auk
- the new activity's unique key. May be
null
if the application instance is temporarily
not associated with an activity.
InvalidKeyException
- if there is no application instance
with the given id
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |