diff options
Diffstat (limited to 'source/com/c2kernel/entity/agent/ActiveEntity.java')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/entity/agent/ActiveEntity.java | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/source/com/c2kernel/entity/agent/ActiveEntity.java b/source/com/c2kernel/entity/agent/ActiveEntity.java index cb77bbb..3d45e35 100755..100644 --- a/source/com/c2kernel/entity/agent/ActiveEntity.java +++ b/source/com/c2kernel/entity/agent/ActiveEntity.java @@ -12,7 +12,12 @@ package com.c2kernel.entity.agent; import java.util.Iterator;
-import com.c2kernel.common.*;
+import com.c2kernel.common.AccessRightsException;
+import com.c2kernel.common.CannotManageException;
+import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.PersistencyException;
import com.c2kernel.entity.AgentPOA;
import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.lookup.AgentPath;
@@ -21,6 +26,7 @@ import com.c2kernel.lookup.RolePath; import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.TransactionManager;
import com.c2kernel.process.Gateway;
+import com.c2kernel.property.Property;
import com.c2kernel.property.PropertyArrayList;
import com.c2kernel.utils.CastorXMLUtility;
import com.c2kernel.utils.Logger;
@@ -48,13 +54,13 @@ public class ActiveEntity extends AgentPOA * Connection to the persistency backeng
**************************************************************************/
private TransactionManager mDatabase = null;
-
+
/**************************************************************************
- * The agent's joblist
+ * The agent's joblist
**************************************************************************/
private JobList currentJobs;
/**
- *
+ *
* @param key
* @param poa
*/
@@ -73,7 +79,8 @@ public class ActiveEntity extends AgentPOA /**
* initialise cristal2 properties & collector
*/
- public void initialise( String agentProps )
+ @Override
+ public void initialise( String agentProps )
throws AccessRightsException,
InvalidDataException,
PersistencyException
@@ -99,7 +106,7 @@ public class ActiveEntity extends AgentPOA }
/**
- *
+ *
* @param propsString
* @return Properties
* @throws InvalidDataException Properties cannot be unmarshalled
@@ -112,7 +119,7 @@ public class ActiveEntity extends AgentPOA PropertyArrayList props = null;
// create properties
- if( !propsString.equals("") && propsString != null )
+ if( propsString != null && !propsString.equals("") )
{
try
{
@@ -126,10 +133,10 @@ public class ActiveEntity extends AgentPOA throw new InvalidDataException(ex.toString(), null);
}
- Iterator iter = props.list.iterator();
+ Iterator<Property> iter = props.list.iterator();
while( iter.hasNext() )
- mDatabase.put( mSystemKey, (C2KLocalObject)iter.next(), props );
+ mDatabase.put( mSystemKey, iter.next(), props );
}
else
{
@@ -138,12 +145,13 @@ public class ActiveEntity extends AgentPOA return props;
}
-
+
/**************************************************************************
*
*
**************************************************************************/
- public org.omg.PortableServer.POA _default_POA()
+ @Override
+ public org.omg.PortableServer.POA _default_POA()
{
if(mPOA != null)
return mPOA;
@@ -156,7 +164,8 @@ public class ActiveEntity extends AgentPOA *
*
**************************************************************************/
- public int getSystemKey()
+ @Override
+ public int getSystemKey()
{
return mSystemKey;
}
@@ -166,7 +175,8 @@ public class ActiveEntity extends AgentPOA *
*
**************************************************************************/
- public String queryData(String xpath)
+ @Override
+ public String queryData(String xpath)
throws AccessRightsException,
ObjectNotFoundException,
PersistencyException
@@ -203,7 +213,7 @@ public class ActiveEntity extends AgentPOA }
catch (ObjectNotFoundException ex) {
throw ex;
- }
+ }
catch(Throwable ex)
{
Logger.error("ActiveEntity::queryData("+mSystemKey+") - " +
@@ -218,37 +228,39 @@ public class ActiveEntity extends AgentPOA }
-
+
/**
* Called by an activity when it reckons we need to update our joblist for it
*/
-
- public synchronized void refreshJobList(int sysKey, String stepPath, String newJobs) {
+
+ @Override
+ public synchronized void refreshJobList(int sysKey, String stepPath, String newJobs) {
try {
JobArrayList newJobList = (JobArrayList)CastorXMLUtility.unmarshall(newJobs);
-
+
// get our joblist
if (currentJobs == null)
currentJobs = new JobList( mSystemKey, null);
-
+
// remove old jobs for this item
currentJobs.removeJobsForStep( sysKey, stepPath );
-
+
// merge new jobs in
- for (Iterator iter = newJobList.list.iterator(); iter.hasNext();) {
- Job newJob = (Job)iter.next();
+ for (Object name : newJobList.list) {
+ Job newJob = (Job)name;
Logger.msg(6, "Adding job for "+newJob.getItemSysKey()+"/"+newJob.getStepPath()+":"+newJob.getPossibleTransition());
currentJobs.addJob(newJob);
}
-
+
} catch (Throwable ex) {
Logger.error("Could not refresh job list.");
- Logger.error(ex);
+ Logger.error(ex);
}
-
+
}
-
- public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException {
+
+ @Override
+ public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException {
RolePath newRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(roleName);
try {
newRole.addAgent(new AgentPath(mSystemKey));
@@ -258,11 +270,12 @@ public class ActiveEntity extends AgentPOA throw new CannotManageException("Could not update role");
}
}
-
- public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException {
+
+ @Override
+ public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException {
RolePath rolePath = Gateway.getLDAPLookup().getRoleManager().getRolePath(roleName);
try {
- rolePath.removeAgent(new AgentPath(mSystemKey));
+ rolePath.removeAgent(new AgentPath(mSystemKey));
} catch (InvalidEntityPathException e) {
throw new CannotManageException("Invalid syskey for agent: "+mSystemKey, "");
} catch (ObjectCannotBeUpdated ex) {
@@ -272,7 +285,8 @@ public class ActiveEntity extends AgentPOA /**
*
*/
- protected void finalize() throws Throwable {
+ @Override
+ protected void finalize() throws Throwable {
Logger.msg(7, "Agent "+mSystemKey+" reaped");
Gateway.getStorage().clearCache(mSystemKey, null);
super.finalize();
|
