summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/entity/TraceableEntity.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/entity/TraceableEntity.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/entity/TraceableEntity.java86
1 files changed, 46 insertions, 40 deletions
diff --git a/source/com/c2kernel/entity/TraceableEntity.java b/source/com/c2kernel/entity/TraceableEntity.java
index 49bbe47..c7aff82 100755..100644
--- a/source/com/c2kernel/entity/TraceableEntity.java
+++ b/source/com/c2kernel/entity/TraceableEntity.java
@@ -11,7 +11,6 @@
package com.c2kernel.entity;
-import java.util.Iterator;
import com.c2kernel.common.AccessRightsException;
import com.c2kernel.common.InvalidDataException;
@@ -87,7 +86,8 @@ public class TraceableEntity extends ItemPOA
/**************************************************************************
*
**************************************************************************/
- public org.omg.PortableServer.POA _default_POA()
+ @Override
+ public org.omg.PortableServer.POA _default_POA()
{
if(mPoa != null)
return mPoa;
@@ -99,7 +99,8 @@ public class TraceableEntity extends ItemPOA
/**************************************************************************
*
**************************************************************************/
- public int getSystemKey()
+ @Override
+ public int getSystemKey()
{
Logger.msg(8, "TraceableEntity::getSystemKey() - " + mSystemKey);
return mSystemKey;
@@ -108,7 +109,8 @@ public class TraceableEntity extends ItemPOA
/**************************************************************************
*
**************************************************************************/
- public void initialise( int agentId,
+ @Override
+ public void initialise( int agentId,
String propString,
String initWfString
)
@@ -120,22 +122,22 @@ public class TraceableEntity extends ItemPOA
synchronized (this) {
Workflow lc = null;
PropertyArrayList props = null;
-
+
AgentPath agentPath;
try {
agentPath = new AgentPath(agentId);
} catch (InvalidEntityPathException e) {
throw new AccessRightsException("Invalid Agent Id:" + agentId);
}
-
+
//unmarshalling checks the validity of the received strings
-
+
// create properties
if (!propString.equals("")) {
try {
props = (PropertyArrayList)CastorXMLUtility.unmarshall(propString);
- for (Iterator i = props.list.iterator(); i.hasNext();) {
- Property thisProp = (Property)i.next();
+ for (Object name : props.list) {
+ Property thisProp = (Property)name;
mStorage.put(mSystemKey, thisProp, props);
}
} catch (Throwable ex) {
@@ -145,10 +147,10 @@ public class TraceableEntity extends ItemPOA
}
mStorage.commit(props);
}
-
+
// create wf
try {
- if (initWfString == null || initWfString.equals(""))
+ if (initWfString == null || initWfString.equals(""))
lc = new Workflow(new CompositeActivity());
else
lc = new Workflow((CompositeActivity)CastorXMLUtility.unmarshall(initWfString));
@@ -158,14 +160,15 @@ public class TraceableEntity extends ItemPOA
Logger.msg(8, "TraceableEntity::initialise("+mSystemKey+") - Workflow was invalid: "+initWfString);
Logger.error(ex);
}
- }
+ }
}
/**************************************************************************
*
**************************************************************************/
//requestdata is xmlstring
- public void requestAction( int agentId,
+ @Override
+ public void requestAction( int agentId,
String stepPath,
int transitionID,
String requestData
@@ -180,31 +183,31 @@ public class TraceableEntity extends ItemPOA
synchronized (this) {
try {
- Logger.msg(1, "TraceableEntity::request("+mSystemKey+") - " +
+ Logger.msg(1, "TraceableEntity::request("+mSystemKey+") - " +
Transitions.getTransitionName(transitionID) + " "+stepPath + " by " +agentId );
- AgentPath agent = new AgentPath(agentId);
+ AgentPath agent = new AgentPath(agentId);
Workflow lifeCycle = (Workflow)mStorage.get(mSystemKey, ClusterStorage.LIFECYCLE+"/workflow", null);
-
+
lifeCycle.requestAction( agent,
stepPath,
transitionID,
requestData );
-
+
// store the workflow if we've changed the state of the domain wf
- if (!(stepPath.startsWith("workflow/predefined")))
+ if (!(stepPath.startsWith("workflow/predefined")))
mStorage.put(mSystemKey, lifeCycle, null);
-
+
// Normal operation exceptions
} catch (AccessRightsException ex) {
- Logger.msg("Propagating AccessRightsException back to the calling agent");
+ Logger.msg("Propagating AccessRightsException back to the calling agent");
throw ex;
} catch (InvalidTransitionException ex) {
- Logger.msg("Propagating InvalidTransitionException back to the calling agent");
+ Logger.msg("Propagating InvalidTransitionException back to the calling agent");
throw ex;
} catch (ObjectNotFoundException ex) {
- Logger.msg("Propagating ObjectNotFoundException back to the calling agent");
- throw ex;
+ Logger.msg("Propagating ObjectNotFoundException back to the calling agent");
+ throw ex;
// errors
} catch (ClusterStorageException ex) {
Logger.error(ex);
@@ -212,13 +215,13 @@ public class TraceableEntity extends ItemPOA
} catch (InvalidEntityPathException ex) {
Logger.error(ex);
throw new AccessRightsException("Invalid Agent Id: "+agentId, "");
- } catch (InvalidDataException ex) {
+ } catch (InvalidDataException ex) {
Logger.error(ex);
- Logger.msg("Propagating InvalidDataException back to the calling agent");
+ Logger.msg("Propagating InvalidDataException back to the calling agent");
throw ex;
- } catch (ObjectAlreadyExistsException ex) {
+ } catch (ObjectAlreadyExistsException ex) {
Logger.error(ex);
- Logger.msg("Propagating ObjectAlreadyExistsException back to the calling agent");
+ Logger.msg("Propagating ObjectAlreadyExistsException back to the calling agent");
throw ex;
// non-CORBA exception hasn't been caught!
} catch (Throwable ex) {
@@ -226,13 +229,14 @@ public class TraceableEntity extends ItemPOA
Logger.error(ex);
throw new InvalidDataException("Extraordinary Exception during execution:"+ex.getClass().getName()+" - "+ex.getMessage(), "");
}
- }
+ }
}
/**************************************************************************
*
**************************************************************************/
- public String queryLifeCycle( int agentId,
+ @Override
+ public String queryLifeCycle( int agentId,
boolean filter
)
throws AccessRightsException,
@@ -241,7 +245,7 @@ public class TraceableEntity extends ItemPOA
{
synchronized (this) {
Logger.msg(1, "TraceableEntity::queryLifeCycle("+mSystemKey+") - agent: " + agentId);
-
+
try
{
AgentPath agent = new AgentPath(agentId);
@@ -266,21 +270,22 @@ public class TraceableEntity extends ItemPOA
* @param path - the path to the object required
* the suffix 'all' retrieves a listing of all keys on that level
*
- * @return The result string in xml format
+ * @return The result string in xml format
* except 'all' which returns a comma sep list
*
* @exception ObjectNotFoundException
* ************************************************************************/
- public String queryData(String path)
+ @Override
+ public String queryData(String path)
throws AccessRightsException,
ObjectNotFoundException,
PersistencyException
{
synchronized (this) {
String result = "";
-
+
Logger.msg(1, "TraceableEntity::queryData("+mSystemKey+") - " + path );
-
+
try
{ // check for cluster contents query
@@ -289,11 +294,11 @@ public class TraceableEntity extends ItemPOA
int allPos = path.lastIndexOf("all");
String query = path.substring(0,allPos);
String[] ids = mStorage.getClusterContents( mSystemKey, query );
-
+
for( int i=0; i<ids.length; i++ )
{
result += ids[i];
-
+
if( i != ids.length-1 )
result += ",";
}
@@ -302,7 +307,7 @@ public class TraceableEntity extends ItemPOA
else
{ // retrieve the object instead
C2KLocalObject obj = mStorage.get( mSystemKey, path, null );
-
+
// marshall it, or in the case of an outcome get the data.
result = CastorXMLUtility.marshall(obj);
}
@@ -316,17 +321,18 @@ public class TraceableEntity extends ItemPOA
path + " Failed: "+ex.getClass().getName());
throw new PersistencyException("Server exception: "+ex.getClass().getName(), "");
}
-
+
if( Logger.doLog(9) )
Logger.msg(9, "TraceableEntity::queryData("+mSystemKey+") - result:" + result );
-
+
return result;
}
}
/**
*
*/
- protected void finalize() throws Throwable {
+ @Override
+ protected void finalize() throws Throwable {
Logger.msg(7, "Item "+mSystemKey+" reaped");
Gateway.getStorage().clearCache(mSystemKey, null);
super.finalize();