diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-05-07 17:33:13 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-05-08 16:37:39 +0200 |
| commit | a1f0ecbb6a2bea6aa214322c412af2f3c5ce124b (patch) | |
| tree | 4d74229b6dd9cfd7ce054e06bf740b9a63a578d6 | |
| parent | 6dfa1bbe05a712174e937af89d5223e98d9d7d06 (diff) | |
Agent now extends Item, so they can have workflows. All traces of the
old 'Entity' superclasses should be removed, including proxies and
paths. Very large change, breaks API compatibility with CRISTAL 2.x.
Fixes #135
58 files changed, 1099 insertions, 1208 deletions
diff --git a/src/main/idl/Entity.idl b/src/main/idl/Entity.idl index f94bdf4..2aa9188 100644 --- a/src/main/idl/Entity.idl +++ b/src/main/idl/Entity.idl @@ -21,7 +21,7 @@ module entity * in a tree structure.
**/
- abstract interface ManageableEntity
+ interface Item
{
/**
@@ -29,7 +29,24 @@ module entity **/
unsigned long getSystemKey();
-
+ /** Initialises a new Item. Initial properties and the lifecycle are supplied. They should come from the Item's description.
+ *
+ * @param agentId the Agent doing the initialisation
+ * @param itemProps The XML marshalled {@link com.c2kernel.Property.PropertyArrayList PropertyArrayList} containing the initial
+ * Property objects of the Item
+ * @param workflow The XML marshalled new lifecycle of the Item
+ * @param collection The XML marshalled CollectionArrayList of the initial state of the Item's collections
+ * @exception ObjectNotFoundException
+ **/
+ void initialise( in unsigned long agentId,
+ in string itemProps,
+ in string workflow,
+ in string collections )
+ raises( common::AccessRightsException,
+ common::InvalidDataException,
+ common::PersistencyException,
+ common::ObjectNotFoundException );
+
/**
* Returns a chunk of XML which may be a serialized C2KLocalObject, or in the case of Outcomes is merely a fragment of XML.
*
@@ -54,77 +71,6 @@ module entity raises( common::AccessRightsException,
common::ObjectNotFoundException,
common::PersistencyException );
- };
-
-
- /**************************************************************************
- * Agent is a ManageableEntity that represents an Activity executor in the
- * system. It holds a job list, which are persistent requests for execution
- * from waiting activities assigned to a role that has such Job pushing enabled.
- **************************************************************************/
- interface Agent : ManageableEntity
- {
- /** Initialises a new Agent. Should not be done by client processes - they
- * should use an Agent factory such as a Server item.
- * @param agentProps - XML marshalled {@link com.c2kernel.Property.PropertyArrayList PropertyArrayList} containing the initial
- * Property objects of the Agent
- * @throws AccessRightsException not yet implemented, reserved for future access control
- * @throws InvalidDataException when the data supplied couldn't be unmarshalled
- * @throws PersistencyException when there was a problem communicating with storage
- **/
- void initialise( in string agentProps )
- raises( common::AccessRightsException,
- common::InvalidDataException,
- common::PersistencyException );
-
- /** Supplies the new set of jobs for the given item and activity. The Agent should replace all existing jobs for that activity
- * with the given set. This method should generally only be called by a workflow while performing an execution.
- *
- * @param sysKey the item which generated the jobs
- * @param stepPath the activity within the lifecycle of the item which the jobs relate to
- * @param newJobs an XML marshalled {@link com.c2kernel.entity.agent.JobArrayList JobArrayList} containing the new Jobs
- **/
- void refreshJobList( in unsigned long sysKey, in string stepPath, in string newJobs );
-
- /** Add this Agent to the given role
- * @param roleName the new role to add
- * @throws ObjectNotFoundException when the role doesn't exist
- * @throws CannotManageException when an error occurs writing the data to LDAP
- **/
- void addRole( in string roleName )
- raises( common::ObjectNotFoundException,
- common::CannotManageException );
-
- /** Remove this Agent from the given role
- * @param the role name to remove
- * @throws CannotManageException when an error occurs writing the data to LDAP
- **/
- void removeRole( in string roleName )
- raises( common::ObjectNotFoundException,
- common::CannotManageException );
- };
-
-
- /**************************************************************************
- * Item is an ManageableEntity which has a lifecycle, and as a consequence
- * generates Events, Outcomes and Viewpoints.
- **************************************************************************/
- interface Item : ManageableEntity
- {
- /** Initialises a new Item. Initial properties and the lifecycle are supplied. They should come from the Item's description.
- *
- * @param agentId the Agent doing the initialisation
- * @param itemProps The XML marshalled {@link com.c2kernel.Property.PropertyArrayList PropertyArrayList} containing the initial
- * Property objects of the Agent
- * @param workflow The XML marshalled new lifecycle of the Item
- * @exception ObjectNotFoundException
- **/
- void initialise( in unsigned long agentId,
- in string itemProps,
- in string workflow )
- raises( common::AccessRightsException,
- common::InvalidDataException,
- common::PersistencyException );
/**
* Requests a transition of an Activity in this Item's workflow. If possible and permitted, an Event is
@@ -158,7 +104,7 @@ module entity void requestAction( in unsigned long agentID,
in string stepPath,
in unsigned long transitionID,
- in string requestData
+ in string requestData
)
raises( common::AccessRightsException,
common::InvalidTransitionException,
@@ -184,10 +130,44 @@ module entity in boolean filter )
raises( common::AccessRightsException,
common::ObjectNotFoundException,
- common::PersistencyException );
+ common::PersistencyException );
+ };
+
+ /**************************************************************************
+ * Agent is a ManageableEntity that represents an Activity executor in the
+ * system. It holds a job list, which are persistent requests for execution
+ * from waiting activities assigned to a role that has such Job pushing enabled.
+ **************************************************************************/
+ interface Agent : Item
+ {
+
+ /** Supplies the new set of jobs for the given item and activity. The Agent should replace all existing jobs for that activity
+ * with the given set. This method should generally only be called by a workflow while performing an execution.
+ *
+ * @param sysKey the item which generated the jobs
+ * @param stepPath the activity within the lifecycle of the item which the jobs relate to
+ * @param newJobs an XML marshalled {@link com.c2kernel.entity.agent.JobArrayList JobArrayList} containing the new Jobs
+ **/
+ void refreshJobList( in unsigned long sysKey, in string stepPath, in string newJobs );
+
+ /** Add this Agent to the given role
+ * @param roleName the new role to add
+ * @throws ObjectNotFoundException when the role doesn't exist
+ * @throws CannotManageException when an error occurs writing the data to LDAP
+ **/
+ void addRole( in string roleName )
+ raises( common::ObjectNotFoundException,
+ common::CannotManageException );
- }; //end of Item
+ /** Remove this Agent from the given role
+ * @param the role name to remove
+ * @throws CannotManageException when an error occurs writing the data to LDAP
+ **/
+ void removeRole( in string roleName )
+ raises( common::ObjectNotFoundException,
+ common::CannotManageException );
+ };
}; //end of module entity
diff --git a/src/main/java/com/c2kernel/collection/Aggregation.java b/src/main/java/com/c2kernel/collection/Aggregation.java index 063eb77..f2ef710 100644 --- a/src/main/java/com/c2kernel/collection/Aggregation.java +++ b/src/main/java/com/c2kernel/collection/Aggregation.java @@ -6,8 +6,8 @@ import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphModel;
import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.CastorHashMap;
@@ -50,12 +50,12 @@ abstract public class Aggregation extends Parent2ChildCollection<AggregationMemb return mVertexTypeNameAndConstructionInfo;
}
- public boolean exists(int entityKey)
+ public boolean exists(int sysKey)
{
for (int i=0; i<size(); i++)
{
AggregationMember element = mMembers.list.get(i);
- if (element.getEntityKey() == entityKey)
+ if (element.getSystemKey() == sysKey)
return true;
}
return false;
@@ -96,15 +96,15 @@ abstract public class Aggregation extends Parent2ChildCollection<AggregationMemb Logger.msg(8, "AggregationDescription::addSlot new slot linked to vertexid " + vertex.getID());
return aggMem;
}
- public AggregationMember addMember(int entityKey, CastorHashMap props, String classProps, GraphPoint location, int w, int h)
+ public AggregationMember addMember(int sysKey, CastorHashMap props, String classProps, GraphPoint location, int w, int h)
throws MembershipException
{
AggregationMember aggMem = addSlot(props, classProps, location, w, h);
- if (entityKey > -1) { // some clients use this method when not setting a member
- aggMem.assignEntity(entityKey);
- aggMem.setIsComposite( getIsComposite(entityKey, getName()) );
+ if (sysKey > -1) { // some clients use this method when not setting a member
+ aggMem.assignItem(sysKey);
+ aggMem.setIsComposite( getIsComposite(sysKey, getName()) );
}
- Logger.msg(8, "AggregationDescription::addMember(" + entityKey + ") assigned to new slot " + aggMem.getID());
+ Logger.msg(8, "AggregationDescription::addMember(" + sysKey + ") assigned to new slot " + aggMem.getID());
return aggMem;
}
@@ -130,7 +130,7 @@ abstract public class Aggregation extends Parent2ChildCollection<AggregationMemb public void removeMember(int memberId) throws MembershipException {
for (AggregationMember element : mMembers.list) {
if (element.getID() == memberId) {
- element.clearEntity();
+ element.clearItem();
mLayout.removeVertex(getLayout().getVertexById(memberId));
return;
}
@@ -142,11 +142,11 @@ abstract public class Aggregation extends Parent2ChildCollection<AggregationMemb {
if (entityKey == -1) return false;
try {
- for(String collName: Gateway.getProxyManager().getProxy(new EntityPath(entityKey)).getContents(ClusterStorage.COLLECTION) )
+ for(String collName: Gateway.getProxyManager().getProxy(new ItemPath(entityKey)).getContents(ClusterStorage.COLLECTION) )
if (name == null || name.equals(collName)) return true;
} catch (ObjectNotFoundException e) {
return false;
- } catch (InvalidEntityPathException e) {
+ } catch (InvalidItemPathException e) {
return false;
}
return false;
diff --git a/src/main/java/com/c2kernel/collection/AggregationDescription.java b/src/main/java/com/c2kernel/collection/AggregationDescription.java index 6021ed6..0587491 100644 --- a/src/main/java/com/c2kernel/collection/AggregationDescription.java +++ b/src/main/java/com/c2kernel/collection/AggregationDescription.java @@ -35,7 +35,7 @@ public class AggregationDescription extends Aggregation implements CollectionDes {
AggregationMember mem = mMembers.list.get(i);
//get the propdesc of the member item
- PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(mem.getEntityKey());
+ PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(mem.getSystemKey());
if (pdList!=null)
{
//create the new props of the member object
@@ -48,7 +48,7 @@ public class AggregationDescription extends Aggregation implements CollectionDes }
else
{
- Logger.error("AggregationDescription::newInstance() There is no PropertyDescription. Cannot instantiate. " + mem.getEntityKey());
+ Logger.error("AggregationDescription::newInstance() There is no PropertyDescription. Cannot instantiate. " + mem.getSystemKey());
return null;
}
diff --git a/src/main/java/com/c2kernel/collection/AggregationMember.java b/src/main/java/com/c2kernel/collection/AggregationMember.java index 49b9ab7..67e92ad 100644 --- a/src/main/java/com/c2kernel/collection/AggregationMember.java +++ b/src/main/java/com/c2kernel/collection/AggregationMember.java @@ -3,10 +3,10 @@ package com.c2kernel.collection; import java.util.StringTokenizer;
import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.proxy.EntityProxy;
+import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.graph.model.GraphableVertex;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.process.Gateway;
import com.c2kernel.property.Property;
@@ -24,11 +24,11 @@ import com.c2kernel.utils.Logger; public class AggregationMember extends GraphableVertex implements CollectionMember
{
- private int mEntityKey = -1;
- private EntityProxy mEntity = null;
+ private int mSystemKey = -1;
+ private ItemProxy mItem = null;
private Aggregation mCollection = null;
private String mClassProps = null;
- String entityName;
+ String ItemName;
/**************************************************************************
@@ -37,14 +37,14 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb public AggregationMember()
{
super();
- mEntityKey = -1;
+ mSystemKey = -1;
mCollection = null;
}
@Override
- public void setEntityKey(int entityKey) {
- mEntityKey = entityKey;
- entityName = null;
+ public void setSystemKey(int sysKey) {
+ mSystemKey = sysKey;
+ ItemName = null;
}
public void setCollection(Aggregation aggregation)
@@ -59,9 +59,9 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb }
@Override
- public int getEntityKey()
+ public int getSystemKey()
{
- return mEntityKey;
+ return mSystemKey;
}
public Aggregation getCollection()
@@ -76,9 +76,9 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb }
@Override
- public void assignEntity(int entityKey) throws MembershipException
+ public void assignItem(int sysKey) throws MembershipException
{
- if (entityKey > -1) {
+ if (sysKey > -1) {
if (mClassProps == null || getProperties() == null)
throw new MembershipException("ClassProps not yet set. Cannot check membership validity.");
@@ -89,11 +89,11 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb String aClassProp = sub.nextToken();
try {
String memberValue = (String)getProperties().get(aClassProp);
- Property entityProperty = (Property)Gateway.getStorage().get(entityKey, ClusterStorage.PROPERTY+"/"+aClassProp, null);
- if (entityProperty == null)
- throw new MembershipException("Property "+aClassProp+ " does not exist for entityKey=" + entityKey );
- if (entityProperty.getValue() == null || !entityProperty.getValue().equalsIgnoreCase(memberValue))
- throw new MembershipException("Value of mandatory prop "+aClassProp+" does not match: " + entityProperty.getValue()+"!="+memberValue);
+ Property ItemProperty = (Property)Gateway.getStorage().get(sysKey, ClusterStorage.PROPERTY+"/"+aClassProp, null);
+ if (ItemProperty == null)
+ throw new MembershipException("Property "+aClassProp+ " does not exist for sysKey=" + sysKey );
+ if (ItemProperty.getValue() == null || !ItemProperty.getValue().equalsIgnoreCase(memberValue))
+ throw new MembershipException("Value of mandatory prop "+aClassProp+" does not match: " + ItemProperty.getValue()+"!="+memberValue);
}
catch (MembershipException ex) {
throw ex;
@@ -106,46 +106,46 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb }
}
- mEntityKey = entityKey;
- mEntity = null;
- entityName = null;
+ mSystemKey = sysKey;
+ mItem = null;
+ ItemName = null;
}
@Override
- public void clearEntity() {
- mEntityKey = -1;
- mEntity = null;
+ public void clearItem() {
+ mSystemKey = -1;
+ mItem = null;
}
@Override
- public EntityProxy resolveEntity() throws ObjectNotFoundException {
- if (mEntity == null) {
+ public ItemProxy resolveItem() throws ObjectNotFoundException {
+ if (mItem == null) {
try {
- EntityPath path = new EntityPath(mEntityKey);
- mEntity = Gateway.getProxyManager().getProxy(path);
- } catch (InvalidEntityPathException ex) {
+ ItemPath path = new ItemPath(mSystemKey);
+ mItem = Gateway.getProxyManager().getProxy(path);
+ } catch (InvalidItemPathException ex) {
throw new ObjectNotFoundException("No member defined", "");
}
}
- return mEntity;
+ return mItem;
}
- public String getEntityName() {
- if (entityName == null) {
- if (mEntityKey > -1) {
+ public String getItemName() {
+ if (ItemName == null) {
+ if (mSystemKey > -1) {
try {
- entityName = resolveEntity().getName();
+ ItemName = resolveItem().getName();
} catch (ObjectNotFoundException ex) {
Logger.error(ex);
- entityName = "Error ("+mEntityKey+")";
+ ItemName = "Error ("+mSystemKey+")";
}
}
else
- entityName = "Empty";
+ ItemName = "Empty";
}
- return entityName;
+ return ItemName;
}
}
diff --git a/src/main/java/com/c2kernel/collection/CollectionArrayList.java b/src/main/java/com/c2kernel/collection/CollectionArrayList.java index 586f99f..d91ec20 100644 --- a/src/main/java/com/c2kernel/collection/CollectionArrayList.java +++ b/src/main/java/com/c2kernel/collection/CollectionArrayList.java @@ -4,23 +4,23 @@ import java.util.ArrayList; import com.c2kernel.utils.CastorArrayList;
-public class CollectionArrayList extends CastorArrayList<Collection<CollectionMember>> {
+public class CollectionArrayList extends CastorArrayList<Collection<? extends CollectionMember>> {
public CollectionArrayList()
{
super();
}
- public CollectionArrayList(ArrayList<Collection<CollectionMember>> aList)
+ public CollectionArrayList(ArrayList<Collection<? extends CollectionMember>> aList)
{
super();
- for (Collection<CollectionMember> coll : aList) {
+ for (Collection<? extends CollectionMember> coll : aList) {
put(coll);
}
}
/** Overwrite */
- public void put(Collection<CollectionMember> c) {
- for (Collection<CollectionMember> thisColl : list) {
+ public void put(Collection<? extends CollectionMember> c) {
+ for (Collection<? extends CollectionMember> thisColl : list) {
if (thisColl.getName().equals(c.getName())) {
list.remove(thisColl);
break;
diff --git a/src/main/java/com/c2kernel/collection/CollectionMember.java b/src/main/java/com/c2kernel/collection/CollectionMember.java index 0b21e30..ff5d1cd 100644 --- a/src/main/java/com/c2kernel/collection/CollectionMember.java +++ b/src/main/java/com/c2kernel/collection/CollectionMember.java @@ -3,7 +3,7 @@ package com.c2kernel.collection; import java.io.Serializable;
import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.proxy.EntityProxy;
+import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.utils.CastorHashMap;
/**************************************************************************
@@ -20,12 +20,12 @@ import com.c2kernel.utils.CastorHashMap; public interface CollectionMember extends Serializable {
- public void setEntityKey(int entityKey) throws MembershipException;
- public int getEntityKey();
+ public void setSystemKey(int sysKey) throws MembershipException;
+ public int getSystemKey();
- public void assignEntity(int entityKey) throws MembershipException;
- public void clearEntity();
- public EntityProxy resolveEntity() throws ObjectNotFoundException;
+ public void assignItem(int ItemKey) throws MembershipException;
+ public void clearItem();
+ public ItemProxy resolveItem() throws ObjectNotFoundException;
public void setID(int Id);
public int getID();
diff --git a/src/main/java/com/c2kernel/collection/Dependency.java b/src/main/java/com/c2kernel/collection/Dependency.java index cbbf28c..c90fa9d 100644 --- a/src/main/java/com/c2kernel/collection/Dependency.java +++ b/src/main/java/com/c2kernel/collection/Dependency.java @@ -57,7 +57,7 @@ public class Dependency extends Parent2ChildCollection<DependencyMember> }
@Override
- public DependencyMember addMember(int entityKey) throws MembershipException {
+ public DependencyMember addMember(int sysKey) throws MembershipException {
// create member object
DependencyMember depMember = new DependencyMember();
depMember.setID(getCounter());
@@ -65,14 +65,14 @@ public class Dependency extends Parent2ChildCollection<DependencyMember> depMember.setClassProps(mClassProps);
// assign entity
- depMember.assignEntity(entityKey);
+ depMember.assignItem(sysKey);
mMembers.list.add(depMember);
- Logger.msg(8, "Dependency::addMember(" + entityKey + ") added to children.");
+ Logger.msg(8, "Dependency::addMember(" + sysKey + ") added to children.");
return depMember;
}
@Override
- public DependencyMember addMember(int entityKey, CastorHashMap props, String classProps)
+ public DependencyMember addMember(int sysKey, CastorHashMap props, String classProps)
throws MembershipException
{
if (classProps != null && !classProps.equals(mClassProps))
@@ -97,9 +97,9 @@ public class Dependency extends Parent2ChildCollection<DependencyMember> depMember.setClassProps(mClassProps);
// assign entity
- depMember.assignEntity(entityKey);
+ depMember.assignItem(sysKey);
mMembers.list.add(depMember);
- Logger.msg(8, "Dependency::addMember(" + entityKey + ") added to children.");
+ Logger.msg(8, "Dependency::addMember(" + sysKey + ") added to children.");
return depMember;
}
diff --git a/src/main/java/com/c2kernel/collection/DependencyDescription.java b/src/main/java/com/c2kernel/collection/DependencyDescription.java index 681e98b..79b4880 100644 --- a/src/main/java/com/c2kernel/collection/DependencyDescription.java +++ b/src/main/java/com/c2kernel/collection/DependencyDescription.java @@ -23,7 +23,7 @@ public class DependencyDescription extends Dependency implements CollectionDescr Dependency newDep = new Dependency(depName);
if (mMembers.list.size() == 1) { // constrain the members based on the property description
DependencyMember mem = mMembers.list.get(0);
- PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(mem.getEntityKey());
+ PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(mem.getSystemKey());
if (pdList!=null) {
newDep.setProperties(PropertyUtility.createProperty(pdList));
newDep.setClassProps(pdList.getClassProps());
diff --git a/src/main/java/com/c2kernel/collection/DependencyMember.java b/src/main/java/com/c2kernel/collection/DependencyMember.java index 4ca2090..169f9ea 100644 --- a/src/main/java/com/c2kernel/collection/DependencyMember.java +++ b/src/main/java/com/c2kernel/collection/DependencyMember.java @@ -3,9 +3,9 @@ package com.c2kernel.collection; import java.util.StringTokenizer;
import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.proxy.EntityProxy;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.entity.proxy.ItemProxy;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.process.Gateway;
import com.c2kernel.property.Property;
@@ -23,8 +23,8 @@ import com.c2kernel.utils.Logger; public class DependencyMember implements CollectionMember
{
- private int mEntityKey = -1;
- private EntityProxy mEntity = null;
+ private int mSystemKey = -1;
+ private ItemProxy mItem = null;
private int mId = -1;
private CastorHashMap mProperties = null;
private String mClassProps;
@@ -35,22 +35,22 @@ public class DependencyMember implements CollectionMember **************************************************************************/
public DependencyMember()
{
- mEntityKey = -1;
+ mSystemKey = -1;
mProperties = new CastorHashMap();
}
@Override
- public void setEntityKey(int entityKey)
+ public void setSystemKey(int sysKey)
{
- mEntityKey = entityKey;
- mEntity = null;
+ mSystemKey = sysKey;
+ mItem = null;
}
@Override
- public int getEntityKey()
+ public int getSystemKey()
{
- return mEntityKey;
+ return mSystemKey;
}
@Override
@@ -97,9 +97,9 @@ public class DependencyMember implements CollectionMember }
@Override
- public void assignEntity(int entityKey) throws MembershipException
+ public void assignItem(int ItemKey) throws MembershipException
{
- if (entityKey > -1) {
+ if (ItemKey > -1) {
if (mClassProps == null || getProperties() == null)
throw new MembershipException("ClassProps not yet set. Cannot check membership validity.");
@@ -110,11 +110,11 @@ public class DependencyMember implements CollectionMember String aClassProp = sub.nextToken();
try {
String memberValue = (String)getProperties().get(aClassProp);
- Property entityProperty = (Property)Gateway.getStorage().get(entityKey, ClusterStorage.PROPERTY+"/"+aClassProp, null);
- if (entityProperty == null)
- throw new MembershipException("Property "+aClassProp+ " does not exist for entityKey=" + entityKey );
- if (!entityProperty.getValue().equalsIgnoreCase(memberValue))
- throw new MembershipException("DependencyMember::checkProperty() Values of mandatory prop "+aClassProp+" do not match " + entityProperty.getValue()+"!="+memberValue);
+ Property ItemProperty = (Property)Gateway.getStorage().get(ItemKey, ClusterStorage.PROPERTY+"/"+aClassProp, null);
+ if (ItemProperty == null)
+ throw new MembershipException("Property "+aClassProp+ " does not exist for ItemKey=" + ItemKey );
+ if (!ItemProperty.getValue().equalsIgnoreCase(memberValue))
+ throw new MembershipException("DependencyMember::checkProperty() Values of mandatory prop "+aClassProp+" do not match " + ItemProperty.getValue()+"!="+memberValue);
}
catch (Exception ex)
{
@@ -124,27 +124,27 @@ public class DependencyMember implements CollectionMember }
}
- mEntityKey = entityKey;
- mEntity = null;
+ mSystemKey = ItemKey;
+ mItem = null;
}
@Override
- public void clearEntity() {
- mEntityKey = -1;
- mEntity = null;
+ public void clearItem() {
+ mSystemKey = -1;
+ mItem = null;
}
@Override
- public EntityProxy resolveEntity() throws ObjectNotFoundException {
- if (mEntity == null) {
+ public ItemProxy resolveItem() throws ObjectNotFoundException {
+ if (mItem == null) {
try {
- EntityPath path = new EntityPath(mEntityKey);
- mEntity = Gateway.getProxyManager().getProxy(path);
- } catch (InvalidEntityPathException ex) {
+ ItemPath path = new ItemPath(mSystemKey);
+ mItem = Gateway.getProxyManager().getProxy(path);
+ } catch (InvalidItemPathException ex) {
throw new ObjectNotFoundException("No member defined", "");
}
}
- return mEntity;
+ return mItem;
}
diff --git a/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java b/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java index d59b613..814cca8 100644 --- a/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java +++ b/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java @@ -88,10 +88,10 @@ abstract public class Parent2ChildCollection<E extends CollectionMember> impleme mMembers = newMembers;
}
- public boolean contains(int entityKey) {
+ public boolean contains(int sysKey) {
for (Object name : mMembers.list) {
CollectionMember element = (CollectionMember)name;
- if (element.getEntityKey() == entityKey)
+ if (element.getSystemKey() == sysKey)
return true;
}
return false;
@@ -102,7 +102,7 @@ abstract public class Parent2ChildCollection<E extends CollectionMember> impleme for (int i=0; i<size(); i++)
{
CollectionMember element = mMembers.list.get(i);
- if (element.getEntityKey() == -1)
+ if (element.getSystemKey() == -1)
return false;
}
return true;
diff --git a/src/main/java/com/c2kernel/entity/AgentImplementation.java b/src/main/java/com/c2kernel/entity/AgentImplementation.java new file mode 100644 index 0000000..d31b94a --- /dev/null +++ b/src/main/java/com/c2kernel/entity/AgentImplementation.java @@ -0,0 +1,78 @@ +package com.c2kernel.entity;
+
+import com.c2kernel.common.CannotManageException;
+import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.entity.agent.Job;
+import com.c2kernel.entity.agent.JobArrayList;
+import com.c2kernel.entity.agent.JobList;
+import com.c2kernel.lookup.AgentPath;
+import com.c2kernel.lookup.InvalidItemPathException;
+import com.c2kernel.lookup.RolePath;
+import com.c2kernel.process.Gateway;
+import com.c2kernel.utils.Logger;
+
+public class AgentImplementation extends ItemImplementation implements
+ AgentOperations {
+
+ private JobList currentJobs;
+
+ public AgentImplementation(int systemKey) {
+ super(systemKey);
+ }
+
+ /**
+ * Called by an activity when it reckons we need to update our joblist for it
+ */
+
+ @Override
+ public synchronized void refreshJobList(int sysKey, String stepPath, String newJobs) {
+ try {
+ JobArrayList newJobList = (JobArrayList)Gateway.getMarshaller().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 (Object name : newJobList.list) {
+ Job newJob = (Job)name;
+ Logger.msg(6, "Adding job for "+newJob.getItemSysKey()+"/"+newJob.getStepPath()+":"+newJob.getTransition().getId());
+ currentJobs.addJob(newJob);
+ }
+
+ } catch (Throwable ex) {
+ Logger.error("Could not refresh job list.");
+ Logger.error(ex);
+ }
+
+ }
+
+ @Override
+ public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException {
+ RolePath newRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(roleName);
+ try {
+ newRole.addAgent(new AgentPath(mSystemKey));
+ } catch (InvalidItemPathException ex) {
+ throw new CannotManageException("Invalid syskey for agent: "+mSystemKey, "");
+ } catch (ObjectCannotBeUpdated ex) {
+ throw new CannotManageException("Could not update role");
+ }
+ }
+
+ @Override
+ public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException {
+ RolePath rolePath = Gateway.getLDAPLookup().getRoleManager().getRolePath(roleName);
+ try {
+ rolePath.removeAgent(new AgentPath(mSystemKey));
+ } catch (InvalidItemPathException e) {
+ throw new CannotManageException("Invalid syskey for agent: "+mSystemKey, "");
+ } catch (ObjectCannotBeUpdated ex) {
+ throw new CannotManageException("Could not update role");
+ }
+ }
+
+}
diff --git a/src/main/java/com/c2kernel/entity/CorbaServer.java b/src/main/java/com/c2kernel/entity/CorbaServer.java index 3d7c79b..4a129ae 100644 --- a/src/main/java/com/c2kernel/entity/CorbaServer.java +++ b/src/main/java/com/c2kernel/entity/CorbaServer.java @@ -14,8 +14,8 @@ import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.agent.ActiveEntity;
import com.c2kernel.entity.agent.ActiveLocator;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
import com.c2kernel.utils.SoftCache;
@@ -31,14 +31,14 @@ import com.c2kernel.utils.SoftCache; public class CorbaServer {
- private final Map<EntityPath, Servant> mEntityCache;
+ private final Map<ItemPath, Servant> mEntityCache;
private POA mRootPOA;
private POA mItemPOA;
private POA mAgentPOA;
private POAManager mPOAManager;
public CorbaServer() throws InvalidDataException {
- mEntityCache = new SoftCache<EntityPath, Servant>(50);
+ mEntityCache = new SoftCache<ItemPath, Servant>(50);
// init POA
try {
@@ -119,7 +119,7 @@ public class CorbaServer { **************************************************************************/
private Servant getEntity(int sysKey, org.omg.PortableServer.POA poa) throws ObjectNotFoundException {
try {
- EntityPath entityPath = new EntityPath(sysKey);
+ ItemPath entityPath = new ItemPath(sysKey);
Servant entity = null;
synchronized (mEntityCache) {
entity = mEntityCache.get(entityPath);
@@ -141,7 +141,7 @@ public class CorbaServer { }
return entity;
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectNotFoundException("Invalid Entity Key", "");
}
}
@@ -164,7 +164,7 @@ public class CorbaServer { * @param entityPath
* @return
*/
- public Servant createEntity(EntityPath entityPath) throws CannotManageException, ObjectAlreadyExistsException {
+ public Servant createEntity(ItemPath entityPath) throws CannotManageException, ObjectAlreadyExistsException {
try {
if (entityPath == null)
entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey();
diff --git a/src/main/java/com/c2kernel/entity/ItemImplementation.java b/src/main/java/com/c2kernel/entity/ItemImplementation.java new file mode 100644 index 0000000..e0d107a --- /dev/null +++ b/src/main/java/com/c2kernel/entity/ItemImplementation.java @@ -0,0 +1,281 @@ +package com.c2kernel.entity;
+
+import com.c2kernel.collection.Collection;
+import com.c2kernel.collection.CollectionArrayList;
+import com.c2kernel.common.AccessRightsException;
+import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.InvalidTransitionException;
+import com.c2kernel.common.ObjectAlreadyExistsException;
+import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.common.PersistencyException;
+import com.c2kernel.entity.agent.JobArrayList;
+import com.c2kernel.lifecycle.instance.CompositeActivity;
+import com.c2kernel.lifecycle.instance.Workflow;
+import com.c2kernel.lookup.AgentPath;
+import com.c2kernel.lookup.InvalidItemPathException;
+import com.c2kernel.persistency.ClusterStorage;
+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.Logger;
+
+public class ItemImplementation implements ItemOperations {
+
+ protected final TransactionManager mStorage;
+ protected final int mSystemKey;
+
+ protected ItemImplementation(int systemKey) {
+ this.mStorage = Gateway.getStorage();
+ this.mSystemKey = systemKey;
+ }
+
+ @Override
+ public int getSystemKey() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void initialise(int agentId, String propString, String initWfString,
+ String initCollsString) throws AccessRightsException,
+ InvalidDataException, PersistencyException
+ {
+ Logger.msg(5, "Item::initialise("+mSystemKey+") - agent:"+agentId);
+ Object locker = new Object();
+
+ AgentPath agentPath;
+ try {
+ agentPath = new AgentPath(agentId);
+ } catch (InvalidItemPathException e) {
+ throw new AccessRightsException("Invalid Agent Id:" + agentId);
+ }
+
+ // must supply properties
+ if (propString == null || propString.length() == 0) {
+ throw new InvalidDataException("No properties supplied", "");
+ }
+
+ // store properties
+ try {
+ PropertyArrayList props = (PropertyArrayList) Gateway
+ .getMarshaller().unmarshall(propString);
+ for (Property thisProp : props.list)
+ mStorage.put(mSystemKey, thisProp, locker);
+ } catch (Throwable ex) {
+ Logger.msg(8, "TraceableEntity::initialise(" + mSystemKey
+ + ") - Properties were invalid: " + propString);
+ Logger.error(ex);
+ mStorage.abort(locker);
+ throw new InvalidDataException("Properties were invalid", "");
+ }
+
+ // create wf
+ try {
+ Workflow lc = null;
+ if (initWfString == null || initWfString.length() == 0)
+ lc = new Workflow(new CompositeActivity());
+ else
+ lc = new Workflow((CompositeActivity) Gateway
+ .getMarshaller().unmarshall(initWfString));
+ lc.initialise(mSystemKey, agentPath);
+ mStorage.put(mSystemKey, lc, locker);
+ } catch (Throwable ex) {
+ Logger.msg(8, "TraceableEntity::initialise(" + mSystemKey
+ + ") - Workflow was invalid: " + initWfString);
+ Logger.error(ex);
+ mStorage.abort(locker);
+ throw new InvalidDataException("Workflow was invalid", "");
+ }
+
+ // init collections
+ if (initCollsString != null && initCollsString.length() > 0) {
+ try {
+ CollectionArrayList colls = (CollectionArrayList) Gateway
+ .getMarshaller().unmarshall(initCollsString);
+ for (Collection<?> thisColl : colls.list) {
+ mStorage.put(mSystemKey, thisColl, locker);
+ }
+ } catch (Throwable ex) {
+ Logger.msg(8, "TraceableEntity::initialise(" + mSystemKey
+ + ") - Collections were invalid: "
+ + initCollsString);
+ Logger.error(ex);
+ mStorage.abort(locker);
+ throw new InvalidDataException("Collections were invalid");
+ }
+ }
+ mStorage.commit(locker);
+ Logger.msg(3, "Initialisation of item " + mSystemKey
+ + " was successful");
+ }
+
+
+ @Override
+ public void requestAction(int agentId, String stepPath, int transitionID,
+ String requestData) throws AccessRightsException,
+ InvalidTransitionException, ObjectNotFoundException,
+ InvalidDataException, PersistencyException,
+ ObjectAlreadyExistsException {
+
+ try {
+
+ Logger.msg(1, "TraceableEntity::request(" + mSystemKey + ") - "
+ + transitionID + " " + stepPath + " by " + agentId);
+
+ AgentPath agent = new AgentPath(agentId);
+ Workflow lifeCycle = (Workflow) mStorage.get(mSystemKey,
+ ClusterStorage.LIFECYCLE + "/workflow", null);
+
+ lifeCycle.requestAction(agent, stepPath, mSystemKey,
+ transitionID, requestData);
+
+ // store the workflow if we've changed the state of the domain
+ // wf
+ 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");
+ throw ex;
+ } catch (InvalidTransitionException ex) {
+ 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;
+ // errors
+ } catch (ClusterStorageException ex) {
+ Logger.error(ex);
+ throw new PersistencyException("Error on storage: "
+ + ex.getMessage(), "");
+ } catch (InvalidItemPathException ex) {
+ Logger.error(ex);
+ throw new AccessRightsException("Invalid Agent Id: " + agentId,
+ "");
+ } catch (InvalidDataException ex) {
+ Logger.error(ex);
+ Logger.msg("Propagating InvalidDataException back to the calling agent");
+ throw ex;
+ } catch (ObjectAlreadyExistsException ex) {
+ Logger.error(ex);
+ Logger.msg("Propagating ObjectAlreadyExistsException back to the calling agent");
+ throw ex;
+ // non-CORBA exception hasn't been caught!
+ } catch (Throwable ex) {
+ Logger.error("Unknown Error: requestAction on " + mSystemKey
+ + " by " + agentId + " executing " + stepPath);
+ Logger.error(ex);
+ throw new InvalidDataException(
+ "Extraordinary Exception during execution:"
+ + ex.getClass().getName() + " - "
+ + ex.getMessage(), "");
+ }
+ }
+
+ @Override
+ public String queryLifeCycle(int agentId, boolean filter)
+ throws AccessRightsException, ObjectNotFoundException,
+ PersistencyException {
+ Logger.msg(1, "TraceableEntity::queryLifeCycle(" + mSystemKey
+ + ") - agent: " + agentId);
+ try {
+ AgentPath agent;
+ try {
+ agent = new AgentPath(agentId);
+ } catch (InvalidItemPathException e) {
+ throw new AccessRightsException("Agent " + agentId
+ + " doesn't exist");
+ }
+ Workflow wf;
+ try {
+ wf = (Workflow) mStorage.get(mSystemKey,
+ ClusterStorage.LIFECYCLE + "/workflow", null);
+ } catch (ClusterStorageException e) {
+ Logger.error("TraceableEntity::queryLifeCycle("
+ + mSystemKey + ") - Error loading workflow");
+ Logger.error(e);
+ throw new PersistencyException("Error loading workflow");
+ }
+ JobArrayList jobBag = new JobArrayList();
+ CompositeActivity domainWf = (CompositeActivity) wf
+ .search("workflow/domain");
+ jobBag.list = filter ? domainWf.calculateJobs(agent,
+ mSystemKey, true) : domainWf.calculateAllJobs(agent,
+ mSystemKey, true);
+ Logger.msg(1, "TraceableEntity::queryLifeCycle(" + mSystemKey
+ + ") - Returning " + jobBag.list.size() + " jobs.");
+ try {
+ return Gateway.getMarshaller().marshall(jobBag);
+ } catch (Exception e) {
+ Logger.error(e);
+ throw new PersistencyException("Error marshalling job bag");
+ }
+ } catch (Throwable ex) {
+ Logger.error("TraceableEntity::queryLifeCycle(" + mSystemKey
+ + ") - Unknown error");
+ Logger.error(ex);
+ throw new PersistencyException(
+ "Unknown error querying jobs. Please see server log.");
+ }
+ }
+
+ @Override
+ public String queryData(String path) throws AccessRightsException,
+ ObjectNotFoundException, PersistencyException {
+
+ String result = "";
+
+ Logger.msg(1, "TraceableEntity::queryData(" + mSystemKey + ") - "
+ + path);
+
+ try { // check for cluster contents query
+
+ if (path.endsWith("/all")) {
+ 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 += ",";
+ }
+ }
+ // ****************************************************************
+ 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 = Gateway.getMarshaller().marshall(obj);
+ }
+ } catch (ObjectNotFoundException ex) {
+ throw ex;
+ } catch (Throwable ex) {
+ Logger.warning("TraceableEntity::queryData(" + mSystemKey
+ + ") - " + 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;
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected void finalize() throws Throwable {
+ Logger.msg(7, "Item "+mSystemKey+" reaped");
+ Gateway.getStorage().clearCache(mSystemKey, null);
+ super.finalize();
+ }
+}
diff --git a/src/main/java/com/c2kernel/entity/TraceableEntity.java b/src/main/java/com/c2kernel/entity/TraceableEntity.java index b6ccd8c..ffd5859 100644 --- a/src/main/java/com/c2kernel/entity/TraceableEntity.java +++ b/src/main/java/com/c2kernel/entity/TraceableEntity.java @@ -18,17 +18,6 @@ import com.c2kernel.common.InvalidTransitionException; import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.common.PersistencyException;
-import com.c2kernel.entity.agent.JobArrayList;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
-import com.c2kernel.persistency.ClusterStorage;
-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.Logger;
/**************************************************************************
@@ -62,10 +51,8 @@ import com.c2kernel.utils.Logger; public class TraceableEntity extends ItemPOA
{
- private final int mSystemKey;
private final org.omg.PortableServer.POA mPoa;
- private final TransactionManager mStorage;
-
+ private final ItemImplementation mItemImpl;
/**************************************************************************
* Constructor used by the Locator only
@@ -74,10 +61,8 @@ public class TraceableEntity extends ItemPOA org.omg.PortableServer.POA poa )
{
Logger.msg(5,"TraceableEntity::constructor() - SystemKey:" + key );
-
- mSystemKey = key;
- mPoa = poa;
- mStorage = Gateway.getStorage();
+ mPoa = poa;
+ mItemImpl = new ItemImplementation(key);
}
@@ -100,8 +85,7 @@ public class TraceableEntity extends ItemPOA @Override
public int getSystemKey()
{
- Logger.msg(8, "TraceableEntity::getSystemKey() - " + mSystemKey);
- return mSystemKey;
+ return mItemImpl.getSystemKey();
}
/**************************************************************************
@@ -110,54 +94,15 @@ public class TraceableEntity extends ItemPOA @Override
public void initialise( int agentId,
String propString,
- String initWfString
+ String initWfString,
+ String initCollsString
)
throws AccessRightsException,
InvalidDataException,
PersistencyException
{
- Logger.msg(5, "TraceableEntity::initialise("+mSystemKey+") - agent:"+agentId);
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)Gateway.getMarshaller().unmarshall(propString);
- for (Object name : props.list) {
- Property thisProp = (Property)name;
- mStorage.put(mSystemKey, thisProp, props);
- }
- } catch (Throwable ex) {
- Logger.msg(8, "TraceableEntity::initialise("+mSystemKey+ ") - Properties were invalid: "+propString);
- Logger.error(ex);
- mStorage.abort(props);
- }
- mStorage.commit(props);
- }
-
- // create wf
- try {
- if (initWfString == null || initWfString.equals(""))
- lc = new Workflow(new CompositeActivity());
- else
- lc = new Workflow((CompositeActivity)Gateway.getMarshaller().unmarshall(initWfString));
- lc.initialise(mSystemKey, agentPath);
- mStorage.put(mSystemKey, lc, null);
- } catch (Throwable ex) {
- Logger.msg(8, "TraceableEntity::initialise("+mSystemKey+") - Workflow was invalid: "+initWfString);
- Logger.error(ex);
- }
+ mItemImpl.initialise(agentId, propString, initWfString, initCollsString);
}
}
@@ -179,55 +124,7 @@ public class TraceableEntity extends ItemPOA ObjectAlreadyExistsException
{
synchronized (this) {
- try {
-
- Logger.msg(1, "TraceableEntity::request("+mSystemKey+") - " +
- transitionID + " "+stepPath + " by " +agentId );
-
- AgentPath agent = new AgentPath(agentId);
- Workflow lifeCycle = (Workflow)mStorage.get(mSystemKey, ClusterStorage.LIFECYCLE+"/workflow", null);
-
- lifeCycle.requestAction( agent,
- stepPath,
- mSystemKey,
- transitionID,
- requestData );
-
- // store the workflow if we've changed the state of the domain wf
- 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");
- throw ex;
- } catch (InvalidTransitionException ex) {
- 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;
- // errors
- } catch (ClusterStorageException ex) {
- Logger.error(ex);
- throw new PersistencyException("Error on storage: "+ex.getMessage(), "");
- } catch (InvalidEntityPathException ex) {
- Logger.error(ex);
- throw new AccessRightsException("Invalid Agent Id: "+agentId, "");
- } catch (InvalidDataException ex) {
- Logger.error(ex);
- Logger.msg("Propagating InvalidDataException back to the calling agent");
- throw ex;
- } catch (ObjectAlreadyExistsException ex) {
- Logger.error(ex);
- Logger.msg("Propagating ObjectAlreadyExistsException back to the calling agent");
- throw ex;
- // non-CORBA exception hasn't been caught!
- } catch (Throwable ex) {
- Logger.error("Unknown Error: requestAction on "+mSystemKey+" by "+agentId+" executing "+stepPath);
- Logger.error(ex);
- throw new InvalidDataException("Extraordinary Exception during execution:"+ex.getClass().getName()+" - "+ex.getMessage(), "");
- }
+ mItemImpl.requestAction(agentId, stepPath, transitionID, requestData);
}
}
@@ -243,38 +140,7 @@ public class TraceableEntity extends ItemPOA PersistencyException
{
synchronized (this) {
- Logger.msg(1, "TraceableEntity::queryLifeCycle("+mSystemKey+") - agent: " + agentId);
- try {
- AgentPath agent;
- try {
- agent = new AgentPath(agentId);
- } catch (InvalidEntityPathException e) {
- throw new AccessRightsException("Agent "+agentId+" doesn't exist");
- }
- Workflow wf;
- try {
- wf = (Workflow)mStorage.get(mSystemKey, ClusterStorage.LIFECYCLE+"/workflow", null);
- } catch (ClusterStorageException e) {
- Logger.error("TraceableEntity::queryLifeCycle("+mSystemKey+") - Error loading workflow");
- Logger.error(e);
- throw new PersistencyException("Error loading workflow");
- }
- JobArrayList jobBag = new JobArrayList();
- CompositeActivity domainWf = (CompositeActivity)wf.search("workflow/domain");
- jobBag.list = filter?domainWf.calculateJobs(agent, mSystemKey, true):domainWf.calculateAllJobs(agent, mSystemKey, true);
- Logger.msg(1, "TraceableEntity::queryLifeCycle("+mSystemKey+") - Returning "+jobBag.list.size()+" jobs.");
- try {
- return Gateway.getMarshaller().marshall( jobBag );
- } catch (Exception e) {
- Logger.error(e);
- throw new PersistencyException("Error marshalling job bag");
- }
- }
- catch ( Throwable ex ) {
- Logger.error("TraceableEntity::queryLifeCycle("+mSystemKey+") - Unknown error");
- Logger.error(ex);
- throw new PersistencyException("Unknown error querying jobs. Please see server log.");
- }
+ return mItemImpl.queryLifeCycle(agentId, filter);
}
}
@@ -296,60 +162,7 @@ public class TraceableEntity extends ItemPOA PersistencyException
{
synchronized (this) {
- String result = "";
-
- Logger.msg(1, "TraceableEntity::queryData("+mSystemKey+") - " + path );
-
- try
- { // check for cluster contents query
-
- if (path.endsWith("/all"))
- {
- 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 += ",";
- }
- }
- //****************************************************************
- 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 = Gateway.getMarshaller().marshall(obj);
- }
- }
- catch (ObjectNotFoundException ex) {
- throw ex;
- }
- catch(Throwable ex)
- {
- Logger.warning("TraceableEntity::queryData("+mSystemKey+") - "+
- 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;
+ return mItemImpl.queryData(path);
}
}
- /**
- *
- */
- @Override
- protected void finalize() throws Throwable {
- Logger.msg(7, "Item "+mSystemKey+" reaped");
- Gateway.getStorage().clearCache(mSystemKey, null);
- super.finalize();
- }
-
}
diff --git a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java index 8d4dbfd..c59b0fe 100644 --- a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java +++ b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java @@ -10,24 +10,15 @@ package com.c2kernel.entity.agent;
-import java.util.Iterator;
-
import com.c2kernel.common.AccessRightsException;
import com.c2kernel.common.CannotManageException;
import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.InvalidTransitionException;
+import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.common.PersistencyException;
+import com.c2kernel.entity.AgentImplementation;
import com.c2kernel.entity.AgentPOA;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
-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.Logger;
/**************************************************************************
@@ -39,111 +30,17 @@ import com.c2kernel.utils.Logger; public class ActiveEntity extends AgentPOA
{
- /**************************************************************************
- * The CORBA Portable Object Adapter which holds the Agent
- **************************************************************************/
- private org.omg.PortableServer.POA mPOA = null;
-
- /**************************************************************************
- * The C2Kernel system key of the Agent
- **************************************************************************/
- private int mSystemKey = -1;
-
- /**************************************************************************
- * Connection to the persistency backeng
- **************************************************************************/
- private TransactionManager mDatabase = null;
-
- /**************************************************************************
- * The agent's joblist
- **************************************************************************/
- private JobList currentJobs;
- /**
- *
- * @param key
- * @param poa
- */
+ private final org.omg.PortableServer.POA mPoa;
+ private final AgentImplementation mAgentImpl;
+
public ActiveEntity( int key,
org.omg.PortableServer.POA poa )
{
Logger.msg(5, "ActiveEntity::constructor() - SystemKey:" + key );
-
- mSystemKey = key;
- mPOA = poa;
- mDatabase = Gateway.getStorage();
-
- Logger.msg(5, "ActiveEntity::constructor - completed.");
+ mPoa = poa;
+ mAgentImpl = new AgentImplementation(key);
}
- /**
- * initialise cristal2 properties & collector
- */
- @Override
- public void initialise( String agentProps )
- throws AccessRightsException,
- InvalidDataException,
- PersistencyException
- {
- PropertyArrayList props = null;
- Logger.msg(1, "ActiveEntity::initialise("+mSystemKey+")");
- //initialise cristal2 properties & collector
- try
- {
- props = initProps( agentProps );
- mDatabase.commit( props );
- }
- catch( ClusterStorageException ex )
- {
- Logger.error("ActiveEntity::init() - Failed to init props/collector, aborting!");
- Logger.error(ex);
-
- mDatabase.abort( props );
- throw new PersistencyException("Failed to init props => transaction aborted!");
- }
-
- Logger.msg(5, "ActiveEntity::init() - completed.");
- }
-
- /**
- *
- * @param propsString
- * @return Properties
- * @throws InvalidDataException Properties cannot be unmarshalled
- * @throws ClusterStorageException
- */
- private PropertyArrayList initProps( String propsString )
- throws InvalidDataException,
- ClusterStorageException
- {
- PropertyArrayList props = null;
-
- // create properties
- if( propsString != null && !propsString.equals("") )
- {
- try
- {
- props = (PropertyArrayList)Gateway.getMarshaller().unmarshall(propsString);
- }
- catch( Exception ex )
- {
- //any exception during unmarshall indicates that data was
- //incorrect or the castor mapping was not set up
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), null);
- }
-
- Iterator<Property> iter = props.list.iterator();
-
- while( iter.hasNext() )
- mDatabase.put( mSystemKey, iter.next(), props );
- }
- else
- {
- Logger.warning("ActiveEntity::initProps() - NO Properties!");
- }
-
- return props;
- }
/**************************************************************************
*
@@ -152,8 +49,8 @@ public class ActiveEntity extends AgentPOA @Override
public org.omg.PortableServer.POA _default_POA()
{
- if(mPOA != null)
- return mPOA;
+ if(mPoa != null)
+ return mPoa;
else
return super._default_POA();
}
@@ -166,7 +63,7 @@ public class ActiveEntity extends AgentPOA @Override
public int getSystemKey()
{
- return mSystemKey;
+ return mAgentImpl.getSystemKey();
}
@@ -175,55 +72,14 @@ public class ActiveEntity extends AgentPOA *
**************************************************************************/
@Override
- public String queryData(String xpath)
+ public String queryData(String path)
throws AccessRightsException,
ObjectNotFoundException,
PersistencyException
{
- String result = "";
- int allPos = -1;
-
- Logger.msg(1, "ActiveEntity::queryData("+mSystemKey+") - " + xpath );
-
- try
- {
- if( (allPos=xpath.indexOf("all")) != -1 )
- {
- String query = xpath.substring(0,allPos);
- String[] ids = mDatabase.getClusterContents( mSystemKey, query );
-
- for( int i=0; i<ids.length; i++ )
- {
-
- result += ids[i];
-
- if( i != ids.length-1 )
- result += ",";
- }
- }
- //****************************************************************
- else
- {
- C2KLocalObject obj = mDatabase.get( mSystemKey, xpath, null );
-
- result = Gateway.getMarshaller().marshall(obj);
- }
-
- }
- catch (ObjectNotFoundException ex) {
- throw ex;
- }
- catch(Throwable ex)
- {
- Logger.error("ActiveEntity::queryData("+mSystemKey+") - " +
- xpath + " FAILED");
- Logger.error(ex);
- result = "<ERROR/>";
- }
-
- Logger.msg(7, "ActiveEntity::queryData("+mSystemKey+") - result:" + result );
-
- return result;
+ synchronized (this) {
+ return mAgentImpl.queryData(path);
+ }
}
@@ -233,62 +89,55 @@ public class ActiveEntity extends AgentPOA */
@Override
- public synchronized void refreshJobList(int sysKey, String stepPath, String newJobs) {
- try {
- JobArrayList newJobList = (JobArrayList)Gateway.getMarshaller().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 (Object name : newJobList.list) {
- Job newJob = (Job)name;
- Logger.msg(6, "Adding job for "+newJob.getItemSysKey()+"/"+newJob.getStepPath()+":"+newJob.getTransition().getId());
- currentJobs.addJob(newJob);
- }
-
- } catch (Throwable ex) {
- Logger.error("Could not refresh job list.");
- Logger.error(ex);
- }
-
+ public void refreshJobList(int sysKey, String stepPath, String newJobs) {
+ synchronized (this) {
+ mAgentImpl.refreshJobList(sysKey, stepPath, newJobs);
+ }
}
@Override
public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException {
- RolePath newRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(roleName);
- try {
- newRole.addAgent(new AgentPath(mSystemKey));
- } catch (InvalidEntityPathException ex) {
- throw new CannotManageException("Invalid syskey for agent: "+mSystemKey, "");
- } catch (ObjectCannotBeUpdated ex) {
- throw new CannotManageException("Could not update role");
- }
+ synchronized (this) {
+ mAgentImpl.addRole(roleName);
+ }
}
@Override
public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException {
- RolePath rolePath = Gateway.getLDAPLookup().getRoleManager().getRolePath(roleName);
- try {
- rolePath.removeAgent(new AgentPath(mSystemKey));
- } catch (InvalidEntityPathException e) {
- throw new CannotManageException("Invalid syskey for agent: "+mSystemKey, "");
- } catch (ObjectCannotBeUpdated ex) {
- throw new CannotManageException("Could not update role");
- }
- }
- /**
- *
- */
- @Override
- protected void finalize() throws Throwable {
- Logger.msg(7, "Agent "+mSystemKey+" reaped");
- Gateway.getStorage().clearCache(mSystemKey, null);
- super.finalize();
+ synchronized (this) {
+ mAgentImpl.removeRole(roleName);
+ }
}
+
+ @Override
+ public void initialise(int agentId, String propString, String initWfString,
+ String initCollsString) throws AccessRightsException,
+ InvalidDataException, PersistencyException, ObjectNotFoundException {
+ synchronized (this) {
+ mAgentImpl.initialise(agentId, propString, initWfString, initCollsString);
+ }
+
+ }
+
+ @Override
+ public void requestAction(int agentID, String stepPath, int transitionID,
+ String requestData) throws AccessRightsException,
+ InvalidTransitionException, ObjectNotFoundException,
+ InvalidDataException, PersistencyException,
+ ObjectAlreadyExistsException {
+
+ synchronized (this) {
+ mAgentImpl.requestAction(agentID, stepPath, transitionID, requestData);
+ }
+
+ }
+ @Override
+ public String queryLifeCycle(int agentId, boolean filter)
+ throws AccessRightsException, ObjectNotFoundException,
+ PersistencyException {
+ synchronized (this) {
+ return mAgentImpl.queryLifeCycle(agentId, filter);
+ }
+ }
}
diff --git a/src/main/java/com/c2kernel/entity/agent/Job.java b/src/main/java/com/c2kernel/entity/agent/Job.java index e3f58e5..fa2bcd6 100644 --- a/src/main/java/com/c2kernel/entity/agent/Job.java +++ b/src/main/java/com/c2kernel/entity/agent/Job.java @@ -9,8 +9,8 @@ import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.lifecycle.instance.Activity;
import com.c2kernel.lifecycle.instance.stateMachine.Transition;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.outcome.Outcome;
@@ -252,9 +252,9 @@ public class Job implements C2KLocalObject }
}
- public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidEntityPathException {
+ public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidItemPathException {
if (item == null)
- item = (ItemProxy) Gateway.getProxyManager().getProxy(new EntityPath(itemSysKey));
+ item = (ItemProxy) Gateway.getProxyManager().getProxy(new ItemPath(itemSysKey));
return item;
}
diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index f76af10..29550d4 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -22,13 +22,12 @@ import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.Agent;
import com.c2kernel.entity.AgentHelper;
import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.entity.ManageableEntity;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.InvalidItemPathException;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.Path;
import com.c2kernel.persistency.outcome.OutcomeValidator;
import com.c2kernel.persistency.outcome.Schema;
@@ -47,51 +46,34 @@ import com.c2kernel.utils.Logger; * @version $Revision: 1.37 $ $Date: 2005/10/05 07:39:36 $
* @author $Author: abranson $
******************************************************************************/
-public class AgentProxy extends EntityProxy
+public class AgentProxy extends ItemProxy
{
- AgentPath path;
+ AgentPath agentPath;
/**************************************************************************
* Creates an AgentProxy without cache and change notification
**************************************************************************/
- public AgentProxy( org.omg.CORBA.Object ior,
+ protected AgentProxy( org.omg.CORBA.Object ior,
int systemKey)
throws ObjectNotFoundException
{
- super(ior, systemKey);
- try {
- path = new AgentPath(systemKey);
- } catch (InvalidEntityPathException e) {
+ super(ior, systemKey);
+ try {
+ agentPath = new AgentPath(systemKey);
+ mPath = agentPath;
+ } catch (InvalidItemPathException e) {
throw new ObjectNotFoundException();
}
}
@Override
- public ManageableEntity narrow() throws ObjectNotFoundException
+ public Agent narrow() throws ObjectNotFoundException
{
try {
return AgentHelper.narrow(mIOR);
} catch (org.omg.CORBA.BAD_PARAM ex) { }
throw new ObjectNotFoundException("CORBA Object was not an Agent, or the server is down.");
}
- /**************************************************************************
- *
- *
- **************************************************************************/
- public void initialise( String agentProps, String collector )
- throws AccessRightsException,
- InvalidDataException,
- PersistencyException,
- ObjectNotFoundException
- {
- Logger.msg(7, "AgentProxy::initialise - started");
-
- ((Agent)getEntity()).initialise( agentProps );
- }
-
- public AgentPath getPath() {
- return path;
- }
/**
* Executes a job on the given item using this agent.
@@ -111,7 +93,7 @@ public class AgentProxy extends EntityProxy {
OutcomeValidator validator = null;
Date startTime = new Date();
- Logger.msg(3, "AgentProxy - executing "+job.getStepPath()+" for "+path.getAgentName());
+ Logger.msg(3, "AgentProxy - executing "+job.getStepPath()+" for "+agentPath.getAgentName());
// get the outcome validator if present
if (job.hasOutcome())
{
@@ -206,9 +188,9 @@ public class AgentProxy extends EntityProxy ScriptErrorException
{
try {
- ItemProxy targetItem = (ItemProxy)Gateway.getProxyManager().getProxy(new EntityPath(job.getItemSysKey()));
+ ItemProxy targetItem = Gateway.getProxyManager().getProxy(new ItemPath(job.getItemSysKey()));
execute(targetItem, job);
- } catch (InvalidEntityPathException e) {
+ } catch (InvalidItemPathException e) {
throw new ObjectNotFoundException("Job contained invalid item sysKey: "+job.getItemSysKey(), "");
}
}
@@ -239,7 +221,7 @@ public class AgentProxy extends EntityProxy PersistencyException,
ObjectAlreadyExistsException
{
- item.requestAction(getSystemKey(), "workflow/predefined/"+predefStep, PredefinedStep.DONE, PredefinedStep.bundleData(params));
+ item.getItem().requestAction(getSystemKey(), "workflow/predefined/"+predefStep, PredefinedStep.DONE, PredefinedStep.bundleData(params));
}
/** Wrappers for scripts */
@@ -266,18 +248,23 @@ public class AgentProxy extends EntityProxy returnPath = nextMatch;
}
- return (ItemProxy)Gateway.getProxyManager().getProxy(returnPath);
+ return Gateway.getProxyManager().getProxy(returnPath);
}
public ItemProxy getItem(String itemPath) throws ObjectNotFoundException {
return (getItem(new DomainPath(itemPath)));
}
- public ItemProxy getItem(Path itemPath) throws ObjectNotFoundException {
- return (ItemProxy)Gateway.getProxyManager().getProxy(itemPath);
+ @Override
+ public AgentPath getPath() {
+ return agentPath;
+ }
+
+ public ItemProxy getItem(Path itemPath) throws ObjectNotFoundException {
+ return Gateway.getProxyManager().getProxy(itemPath);
}
- public ItemProxy getItemBySysKey(int sysKey) throws ObjectNotFoundException, InvalidEntityPathException {
- return (ItemProxy)Gateway.getProxyManager().getProxy(new EntityPath(sysKey));
+ public ItemProxy getItemBySysKey(int sysKey) throws ObjectNotFoundException, InvalidItemPathException {
+ return Gateway.getProxyManager().getProxy(new ItemPath(sysKey));
}
}
diff --git a/src/main/java/com/c2kernel/entity/proxy/EntityProxy.java b/src/main/java/com/c2kernel/entity/proxy/EntityProxy.java deleted file mode 100644 index cb76a19..0000000 --- a/src/main/java/com/c2kernel/entity/proxy/EntityProxy.java +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************
- * EntityProxy.java
- *
- * $Revision: 1.35 $
- * $Date: 2005/05/10 11:40:09 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.entity.proxy;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.entity.ManageableEntity;
-import com.c2kernel.persistency.ClusterStorageException;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.Property;
-import com.c2kernel.utils.Logger;
-
-
-/******************************************************************************
-* It is a wrapper for the connection and communication with Entities.
-* It can cache data loaded from the Entity to reduce communication with it.
-* This cache is syncronised with corresponding Entity through an event mechanism.
-*
-* @version $Revision: 1.35 $ $Date: 2005/05/10 11:40:09 $
-* @author $Author: abranson $
-******************************************************************************/
-
-abstract public class EntityProxy implements ManageableEntity
-{
-
- protected ManageableEntity mEntity = null;
- protected org.omg.CORBA.Object mIOR;
- protected int mSystemKey;
- private HashMap<MemberSubscription<?>, EntityProxyObserver<?>> mSubscriptions;
-
- /**************************************************************************
- *
- **************************************************************************/
- protected EntityProxy( org.omg.CORBA.Object ior,
- int systemKey)
- throws ObjectNotFoundException
- {
- Logger.msg(8,"EntityProxy::EntityProxy() - Initialising '" +systemKey+ "' entity");
-
- initialise( ior, systemKey);
- }
-
- /**************************************************************************
- *
- **************************************************************************/
- private void initialise( org.omg.CORBA.Object ior,
- int systemKey)
- throws ObjectNotFoundException
- {
- Logger.msg(8, "EntityProxy::initialise() - Initialising '" +systemKey+ "' entity");
-
- mIOR = ior;
- mSystemKey = systemKey;
- mSubscriptions = new HashMap<MemberSubscription<?>, EntityProxyObserver<?>>();
- }
-
-
- /**************************************************************************
- *
- **************************************************************************/
- public ManageableEntity getEntity() throws ObjectNotFoundException
- {
- if (mEntity == null) {
- mEntity = narrow();
- }
- return mEntity;
- }
-
- abstract public ManageableEntity narrow() throws ObjectNotFoundException;
-
- /**************************************************************************
- *
- **************************************************************************/
- //check who is using.. and if toString() is sufficient
- @Override
- public int getSystemKey()
- {
- return mSystemKey;
- }
-
-
- /**************************************************************************
- *
- **************************************************************************/
- @Override
- public String queryData( String path )
- throws ObjectNotFoundException
- {
-
- try {
- Logger.msg(7, "EntityProxy.queryData() - "+mSystemKey+"/"+path);
- if (path.endsWith("all")) {
- Logger.msg(7, "EntityProxy.queryData() - listing contents");
- String[] result = Gateway.getStorage().getClusterContents(mSystemKey, path.substring(0, path.length()-3));
- StringBuffer retString = new StringBuffer();
- for (int i = 0; i < result.length; i++) {
- retString.append(result[i]);
- if (i<result.length-1) retString.append(",");
- }
- Logger.msg(7, "EntityProxy.queryData() - "+retString.toString());
- return retString.toString();
- }
- C2KLocalObject target = Gateway.getStorage().get(mSystemKey, path, null);
- return Gateway.getMarshaller().marshall(target);
- } catch (ObjectNotFoundException e) {
- throw e;
- } catch (Exception e) {
- Logger.error(e);
- return "<ERROR>"+e.getMessage()+"</ERROR>";
- }
- }
-
- public String[] getContents( String path ) throws ObjectNotFoundException {
- try {
- return Gateway.getStorage().getClusterContents(mSystemKey, path.substring(0, path.length()));
- } catch (ClusterStorageException e) {
- throw new ObjectNotFoundException(e.toString());
- }
- }
-
-
- /**************************************************************************
- *
- **************************************************************************/
- public C2KLocalObject getObject( String xpath )
- throws ObjectNotFoundException
- {
- // load from storage, falling back to proxy loader if not found in others
- try
- {
- return Gateway.getStorage().get( mSystemKey, xpath , null);
- }
- catch( ClusterStorageException ex )
- {
- Logger.msg(4, "Exception loading object :"+mSystemKey+"/"+xpath);
- throw new ObjectNotFoundException( ex.toString() );
- }
- }
-
-
-
- public String getProperty( String name )
- throws ObjectNotFoundException
- {
- Logger.msg(5, "Get property "+name+" from syskey/"+mSystemKey);
- Property prop = (Property)getObject("Property/"+name);
- try
- {
- return prop.getValue();
- }
- catch (NullPointerException ex)
- {
- throw new ObjectNotFoundException();
- }
- }
-
- public String getName()
- {
- try {
- return getProperty("Name");
- } catch (ObjectNotFoundException ex) {
- return null;
- }
- }
-
-
- /**************************************************************************
- * Subscription methods
- **************************************************************************/
-
- public void subscribe (MemberSubscription<?> newSub) {
-
- newSub.setSubject(this);
- synchronized (this){
- mSubscriptions.put( newSub, newSub.getObserver() );
- }
- new Thread(newSub).start();
- Logger.msg(7, "Subscribed "+newSub.getObserver().getClass().getName()+" for "+newSub.interest);
- }
-
- public void unsubscribe(EntityProxyObserver<?> observer)
- {
- synchronized (this){
- for (Iterator<MemberSubscription<?>> e = mSubscriptions.keySet().iterator(); e.hasNext();) {
- MemberSubscription<?> thisSub = e.next();
- if (mSubscriptions.get( thisSub ) == observer) {
- e.remove();
- Logger.msg(7, "Unsubscribed "+observer.getClass().getName());
- }
- }
- }
- }
-
- public void dumpSubscriptions(int logLevel) {
- if (mSubscriptions.size() == 0) return;
- Logger.msg(logLevel, "Subscriptions to proxy "+mSystemKey+":");
- synchronized(this) {
- for (MemberSubscription<?> element : mSubscriptions.keySet()) {
- EntityProxyObserver<?> obs = element.getObserver();
- if (obs != null)
- Logger.msg(logLevel, " "+element.getObserver().getClass().getName()+" subscribed to "+element.interest);
- else
- Logger.msg(logLevel, " Phantom subscription to "+element.interest);
- }
- }
- }
-
- public void notify(ProxyMessage message) {
- Logger.msg(4, "EntityProxy.notify() - Received change notification for "+message.getPath()+" on "+mSystemKey);
- synchronized (this){
- if (!message.getServer().equals(EntityProxyManager.serverName))
- Gateway.getStorage().clearCache(mSystemKey, message.getPath());
- for (Iterator<MemberSubscription<?>> e = mSubscriptions.keySet().iterator(); e.hasNext();) {
- MemberSubscription<?> newSub = e.next();
- if (newSub.getObserver() == null) { // phantom
- Logger.msg(4, "Removing phantom subscription to "+newSub.interest);
- e.remove();
- }
- else
- newSub.update(message.getPath(), message.getState());
- }
- }
- }
-
- /**
- * If this is reaped, clear out the cache for it too.
- */
- @Override
- protected void finalize() throws Throwable {
- Logger.msg(7, "Proxy "+mSystemKey+" reaped");
- Gateway.getStorage().clearCache(mSystemKey, null);
- Gateway.getProxyManager().removeProxy(mSystemKey);
- super.finalize();
- }
-
-}
diff --git a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java index 0e6859d..355acd8 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java @@ -10,25 +10,40 @@ package com.c2kernel.entity.proxy;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.exolab.castor.mapping.MappingException;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.ValidationException;
import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.CollectionMember;
+import com.c2kernel.collection.CollectionArrayList;
import com.c2kernel.common.AccessRightsException;
import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.InvalidTransitionException;
import com.c2kernel.common.ObjectAlreadyExistsException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.common.PersistencyException;
+import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.entity.Item;
import com.c2kernel.entity.ItemHelper;
-import com.c2kernel.entity.ManageableEntity;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.entity.agent.JobArrayList;
+import com.c2kernel.lifecycle.instance.CompositeActivity;
import com.c2kernel.lifecycle.instance.Workflow;
+import com.c2kernel.lookup.InvalidItemPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.Path;
import com.c2kernel.persistency.ClusterStorage;
+import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.outcome.Viewpoint;
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;
/******************************************************************************
@@ -38,43 +53,86 @@ import com.c2kernel.utils.Logger; * @version $Revision: 1.25 $ $Date: 2005/05/10 11:40:09 $
* @author $Author: abranson $
******************************************************************************/
-public class ItemProxy extends EntityProxy
+public class ItemProxy
{
+ protected Item mItem = null;
+ protected org.omg.CORBA.Object mIOR;
+ protected int mSystemKey;
+ protected Path mPath;
+ private final HashMap<MemberSubscription<?>, ProxyObserver<?>>
+ mSubscriptions;
+
/**************************************************************************
- *
+ *
**************************************************************************/
protected ItemProxy( org.omg.CORBA.Object ior,
int systemKey)
throws ObjectNotFoundException
{
- super(ior, systemKey);
+ Logger.msg(8, "ItemProxy::initialise() - Initialising entity " +systemKey);
+
+ mIOR = ior;
+ mSystemKey = systemKey;
+ mSubscriptions = new HashMap<MemberSubscription<?>, ProxyObserver<?>>();
+ try {
+ mPath = new ItemPath(systemKey);
+ } catch (InvalidItemPathException e) {
+ throw new ObjectNotFoundException();
+ }
}
+
+ public int getSystemKey()
+ {
+ return mSystemKey;
+ }
+
+ public Path getPath() {
+ return mPath;
+ }
+
+ protected Item getItem() throws ObjectNotFoundException {
+ if (mItem == null)
+ mItem = narrow();
+ return mItem;
+ }
- @Override
- public ManageableEntity narrow() throws ObjectNotFoundException
+ public Item narrow() throws ObjectNotFoundException
{
try {
return ItemHelper.narrow(mIOR);
} catch (org.omg.CORBA.BAD_PARAM ex) { }
throw new ObjectNotFoundException("CORBA Object was not an Item, or the server is down.");
}
- /**************************************************************************
+ /**
+ * @throws MappingException
+ * @throws IOException
+ * @throws ValidationException
+ * @throws MarshalException ************************************************************************
*
*
**************************************************************************/
- public void initialise( int agentId,
- String itemProps,
- String workflow )
+ public void initialise( int agentId,
+ PropertyArrayList itemProps,
+ CompositeActivity workflow,
+ CollectionArrayList colls
+ )
throws AccessRightsException,
InvalidDataException,
PersistencyException,
- ObjectNotFoundException
+ ObjectNotFoundException, MarshalException, ValidationException, IOException, MappingException
{
Logger.msg(7, "ItemProxy::initialise - started");
-
- ((Item)getEntity()).initialise( agentId, itemProps, workflow );
+ CastorXMLUtility xml = Gateway.getMarshaller();
+ if (itemProps == null) throw new InvalidDataException("No initial properties supplied");
+ String propString = xml.marshall(itemProps);
+ String wfString = "";
+ if (workflow != null) wfString = xml.marshall(workflow);
+ String collString = "";
+ if (colls != null) collString = xml.marshall(colls);
+
+ getItem().initialise( agentId, propString, wfString, collString);
}
public void setProperty(AgentProxy agent, String name, String value)
@@ -100,7 +158,7 @@ public class ItemProxy extends EntityProxy /**************************************************************************
*
**************************************************************************/
- protected void requestAction( Job thisJob )
+ public void requestAction( Job thisJob )
throws AccessRightsException,
InvalidTransitionException,
ObjectNotFoundException,
@@ -120,44 +178,10 @@ public class ItemProxy extends EntityProxy throw new InvalidDataException("No Agent specified.", "");
Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName());
- requestAction (thisJob.getAgentId(), thisJob.getStepPath(),
+ getItem().requestAction (thisJob.getAgentId(), thisJob.getStepPath(),
thisJob.getTransition().getId(), outcome);
}
- //requestData is xmlString
- public void requestAction( int agentId,
- String stepPath,
- int transitionID,
- String requestData
- )
- throws AccessRightsException,
- InvalidTransitionException,
- ObjectNotFoundException,
- InvalidDataException,
- PersistencyException,
- ObjectAlreadyExistsException
- {
- ((Item)getEntity()).requestAction( agentId,
- stepPath,
- transitionID,
- requestData );
- }
-
- /**************************************************************************
- *
- **************************************************************************/
- public String queryLifeCycle( int agentId,
- boolean filter
- )
- throws AccessRightsException,
- ObjectNotFoundException,
- PersistencyException
- {
- return ((Item)getEntity()).queryLifeCycle( agentId,
- filter );
- }
-
-
/**************************************************************************
*
**************************************************************************/
@@ -168,7 +192,7 @@ public class ItemProxy extends EntityProxy {
JobArrayList thisJobList;
try {
- String jobs = queryLifeCycle(agentId, filter);
+ String jobs = getItem().queryLifeCycle(agentId, filter);
thisJobList = (JobArrayList)Gateway.getMarshaller().unmarshall(jobs);
}
catch (Exception e) {
@@ -208,8 +232,8 @@ public class ItemProxy extends EntityProxy }
- public Collection<? extends CollectionMember> getCollection(String collName) throws ObjectNotFoundException {
- return (Collection<? extends CollectionMember>)getObject(ClusterStorage.COLLECTION+"/"+collName);
+ public Collection<?> getCollection(String collName) throws ObjectNotFoundException {
+ return (Collection<?>)getObject(ClusterStorage.COLLECTION+"/"+collName);
}
public Workflow getWorkflow() throws ObjectNotFoundException {
@@ -226,4 +250,159 @@ public class ItemProxy extends EntityProxy PersistencyException {
return getJobByName(actName, agent.getSystemKey());
}
+
+ /**
+ * If this is reaped, clear out the cache for it too.
+ */
+ @Override
+ protected void finalize() throws Throwable {
+ Logger.msg(7, "Proxy "+mSystemKey+" reaped");
+ Gateway.getStorage().clearCache(mSystemKey, null);
+ Gateway.getProxyManager().removeProxy(mSystemKey);
+ super.finalize();
+ }
+
+ /**************************************************************************
+ *
+ **************************************************************************/
+ public String queryData( String path )
+ throws ObjectNotFoundException
+ {
+
+ try {
+ Logger.msg(7, "EntityProxy.queryData() - "+mSystemKey+"/"+path);
+ if (path.endsWith("all")) {
+ Logger.msg(7, "EntityProxy.queryData() - listing contents");
+ String[] result = Gateway.getStorage().getClusterContents(mSystemKey, path.substring(0, path.length()-3));
+ StringBuffer retString = new StringBuffer();
+ for (int i = 0; i < result.length; i++) {
+ retString.append(result[i]);
+ if (i<result.length-1) retString.append(",");
+ }
+ Logger.msg(7, "EntityProxy.queryData() - "+retString.toString());
+ return retString.toString();
+ }
+ C2KLocalObject target = Gateway.getStorage().get(mSystemKey, path, null);
+ return Gateway.getMarshaller().marshall(target);
+ } catch (ObjectNotFoundException e) {
+ throw e;
+ } catch (Exception e) {
+ Logger.error(e);
+ return "<ERROR>"+e.getMessage()+"</ERROR>";
+ }
+ }
+
+ public String[] getContents( String path ) throws ObjectNotFoundException {
+ try {
+ return Gateway.getStorage().getClusterContents(mSystemKey, path.substring(0, path.length()));
+ } catch (ClusterStorageException e) {
+ throw new ObjectNotFoundException(e.toString());
+ }
+ }
+
+
+ /**************************************************************************
+ *
+ **************************************************************************/
+ public C2KLocalObject getObject( String xpath )
+ throws ObjectNotFoundException
+ {
+ // load from storage, falling back to proxy loader if not found in others
+ try
+ {
+ return Gateway.getStorage().get( mSystemKey, xpath , null);
+ }
+ catch( ClusterStorageException ex )
+ {
+ Logger.msg(4, "Exception loading object :"+mSystemKey+"/"+xpath);
+ throw new ObjectNotFoundException( ex.toString() );
+ }
+ }
+
+
+
+ public String getProperty( String name )
+ throws ObjectNotFoundException
+ {
+ Logger.msg(5, "Get property "+name+" from syskey/"+mSystemKey);
+ Property prop = (Property)getObject("Property/"+name);
+ try
+ {
+ return prop.getValue();
+ }
+ catch (NullPointerException ex)
+ {
+ throw new ObjectNotFoundException();
+ }
+ }
+
+ public String getName()
+ {
+ try {
+ return getProperty("Name");
+ } catch (ObjectNotFoundException ex) {
+ return null;
+ }
+ }
+
+
+
+
+ /**************************************************************************
+ * Subscription methods
+ **************************************************************************/
+
+ public void subscribe(MemberSubscription<?> newSub) {
+
+ newSub.setSubject(this);
+ synchronized (this){
+ mSubscriptions.put( newSub, newSub.getObserver() );
+ }
+ new Thread(newSub).start();
+ Logger.msg(7, "Subscribed "+newSub.getObserver().getClass().getName()+" for "+newSub.interest);
+ }
+
+ public void unsubscribe(ProxyObserver<?> observer)
+ {
+ synchronized (this){
+ for (Iterator<MemberSubscription<?>> e = mSubscriptions.keySet().iterator(); e.hasNext();) {
+ MemberSubscription<?> thisSub = e.next();
+ if (mSubscriptions.get( thisSub ) == observer) {
+ e.remove();
+ Logger.msg(7, "Unsubscribed "+observer.getClass().getName());
+ }
+ }
+ }
+ }
+
+ public void dumpSubscriptions(int logLevel) {
+ if (mSubscriptions.size() == 0) return;
+ Logger.msg(logLevel, "Subscriptions to proxy "+mSystemKey+":");
+ synchronized(this) {
+ for (MemberSubscription<?> element : mSubscriptions.keySet()) {
+ ProxyObserver<?> obs = element.getObserver();
+ if (obs != null)
+ Logger.msg(logLevel, " "+element.getObserver().getClass().getName()+" subscribed to "+element.interest);
+ else
+ Logger.msg(logLevel, " Phantom subscription to "+element.interest);
+ }
+ }
+ }
+
+ public void notify(ProxyMessage message) {
+ Logger.msg(4, "EntityProxy.notify() - Received change notification for "+message.getPath()+" on "+mSystemKey);
+ synchronized (this){
+ if (!message.getServer().equals(ProxyManager.serverName))
+ Gateway.getStorage().clearCache(mSystemKey, message.getPath());
+ for (Iterator<MemberSubscription<?>> e = mSubscriptions.keySet().iterator(); e.hasNext();) {
+ MemberSubscription<?> newSub = e.next();
+ if (newSub.getObserver() == null) { // phantom
+ Logger.msg(4, "Removing phantom subscription to "+newSub.interest);
+ e.remove();
+ }
+ else
+ newSub.update(message.getPath(), message.getState());
+ }
+ }
+ }
}
diff --git a/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java b/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java index 1de18f8..01994e4 100644 --- a/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java +++ b/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java @@ -12,14 +12,14 @@ public class MemberSubscription<C extends C2KLocalObject> implements Runnable { public static final String ERROR = "Error";
public static final String END = "theEND";
- EntityProxy subject;
+ ItemProxy subject;
String interest;
// keep the subscriber by weak reference, so it is not kept from the garbage collector if no longer used
- WeakReference<EntityProxyObserver<C>> observerReference;
+ WeakReference<ProxyObserver<C>> observerReference;
ArrayList<String> contents = new ArrayList<String>();
boolean preLoad;
- public MemberSubscription(EntityProxyObserver<C> observer, String interest, boolean preLoad) {
+ public MemberSubscription(ProxyObserver<C> observer, String interest, boolean preLoad) {
setObserver(observer);
this.interest = interest;
this.preLoad = preLoad;
@@ -33,7 +33,7 @@ public class MemberSubscription<C extends C2KLocalObject> implements Runnable { private void loadChildren() {
C newMember;
- EntityProxyObserver<C> observer = getObserver();
+ ProxyObserver<C> observer = getObserver();
if (observer == null) return; //reaped
try {
// fetch contents of path
@@ -77,7 +77,7 @@ public class MemberSubscription<C extends C2KLocalObject> implements Runnable { }
public void update(String path, boolean deleted) {
- EntityProxyObserver<C> observer = getObserver();
+ ProxyObserver<C> observer = getObserver();
if (observer == null) return; //reaped
Logger.msg(7, "Processing proxy message path "+path +" for "+observer+". Interest: "+interest+" Was Deleted:"+deleted);
if (!path.startsWith(interest)) // doesn't concern us
@@ -106,15 +106,15 @@ public class MemberSubscription<C extends C2KLocalObject> implements Runnable { }
}
- public void setObserver(EntityProxyObserver<C> observer) {
- observerReference = new WeakReference<EntityProxyObserver<C>>(observer);
+ public void setObserver(ProxyObserver<C> observer) {
+ observerReference = new WeakReference<ProxyObserver<C>>(observer);
}
- public void setSubject(EntityProxy subject) {
+ public void setSubject(ItemProxy subject) {
this.subject = subject;
}
- public EntityProxyObserver<C> getObserver() {
+ public ProxyObserver<C> getObserver() {
return observerReference.get();
}
}
diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java b/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java index 9687f22..5abdb16 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java @@ -36,7 +36,7 @@ public class ProxyClientConnection implements SocketHandler { public ProxyClientConnection() {
super();
thisClientId = ++clientId;
- EntityProxyManager.registerProxyClient(this);
+ ProxyManager.registerProxyClient(this);
Logger.msg(1, "Proxy Client Connection Handler "+thisClientId+" ready.");
}
diff --git a/src/main/java/com/c2kernel/entity/proxy/EntityProxyManager.java b/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java index c49e7f5..d19e38f 100644 --- a/src/main/java/com/c2kernel/entity/proxy/EntityProxyManager.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java @@ -1,5 +1,5 @@ /**************************************************************************
- * EntityProxyFactory.java
+ * ProxyManager.java
*
* $Revision: 1.45 $
* $Date: 2005/05/10 11:40:09 $
@@ -29,9 +29,9 @@ import com.c2kernel.utils.SoftCache; import com.c2kernel.utils.server.SimpleTCPIPServer;
-public class EntityProxyManager
+public class ProxyManager
{
- SoftCache<Integer, EntityProxy> proxyPool = new SoftCache<Integer, EntityProxy>(50);
+ SoftCache<Integer, ItemProxy> proxyPool = new SoftCache<Integer, ItemProxy>(50);
HashMap<DomainPathSubscriber, DomainPath> treeSubscribers = new HashMap<DomainPathSubscriber, DomainPath>();
HashMap<String, ProxyServerConnection> connections = new HashMap<String, ProxyServerConnection>();
@@ -41,11 +41,11 @@ public class EntityProxyManager static String serverName = null;
/**
- * Create an entity proxy manager to listen for proxy events and reap unused proxies
+ * Create a proxy manager to listen for proxy events and reap unused proxies
*/
- public EntityProxyManager()
+ public ProxyManager()
{
- Logger.msg(5, "EntityProxyManager - Starting.....");
+ Logger.msg(5, "ProxyManager - Starting.....");
Enumeration<Path> servers = Gateway.getLDAPLookup().searchEntities(new DomainPath("/servers"));
while(servers.hasMoreElements()) {
@@ -76,7 +76,7 @@ public class EntityProxyManager synchronized (proxyPool) {
for (Integer key : proxyPool.keySet()) {
ProxyMessage sub = new ProxyMessage(key.intValue(), ProxyMessage.ADDPATH, false);
- Logger.msg(5, "Subscribing to entity "+key);
+ Logger.msg(5, "Subscribing to item "+key);
conn.sendMessage(sub);
}
}
@@ -93,7 +93,7 @@ public class EntityProxyManager }
public void shutdown() {
- Logger.msg("EntityProxyManager.shutdown() - flagging shutdown of server connections");
+ Logger.msg("ProxyManager.shutdown() - flagging shutdown of server connections");
for (ProxyServerConnection element : connections.values()) {
element.shutdown();
}
@@ -111,7 +111,7 @@ public class EntityProxyManager // proper proxy message
Logger.msg(5, "Received proxy message: "+thisMessage.toString());
Integer key = new Integer(thisMessage.getSysKey());
- EntityProxy relevant = proxyPool.get(key);
+ ItemProxy relevant = proxyPool.get(key);
if (relevant == null)
Logger.warning("Received proxy message for sysKey "+thisMessage.getSysKey()+" which we don't have a proxy for.");
else
@@ -161,15 +161,15 @@ public class EntityProxyManager /**************************************************************************
*
**************************************************************************/
- private EntityProxy createProxy( org.omg.CORBA.Object ior,
+ private ItemProxy createProxy( org.omg.CORBA.Object ior,
int systemKey,
boolean isItem )
throws ObjectNotFoundException
{
- EntityProxy newProxy = null;
+ ItemProxy newProxy = null;
- Logger.msg(5, "EntityProxyFactory::creating proxy on entity " + systemKey);
+ Logger.msg(5, "ProxyManager::creating proxy on Item " + systemKey);
if( isItem )
{
@@ -190,18 +190,16 @@ public class EntityProxyManager protected void removeProxy( int systemKey )
{
ProxyMessage sub = new ProxyMessage(systemKey, ProxyMessage.DELPATH, true);
- Logger.msg(5,"EntityProxyManager.removeProxy() - Unsubscribing to proxy informer for "+systemKey);
+ Logger.msg(5,"ProxyManager.removeProxy() - Unsubscribing to proxy informer for "+systemKey);
sendMessage(sub);
}
/**************************************************************************
- * EntityProxy getProxy( ManageableEntity, SystemKey)
- *
* Called by the other GetProxy methods. Fills in either the ior or the
* SystemKey
**************************************************************************/
- private EntityProxy getProxy( org.omg.CORBA.Object ior,
+ private ItemProxy getProxy( org.omg.CORBA.Object ior,
int systemKey,
boolean isItem )
throws ObjectNotFoundException
@@ -209,7 +207,7 @@ public class EntityProxyManager Integer key = new Integer(systemKey);
synchronized(proxyPool) {
- EntityProxy newProxy;
+ ItemProxy newProxy;
// return it if it exists
newProxy = proxyPool.get(key);
if (newProxy == null) {
@@ -223,16 +221,16 @@ public class EntityProxyManager }
/**************************************************************************
- * EntityProxy getProxy( String )
+ * ItemProxy getProxy( String )
*
* Proxy from Alias
**************************************************************************/
- public EntityProxy getProxy( Path path )
+ public ItemProxy getProxy( Path path )
throws ObjectNotFoundException
{
//convert namePath to dn format
- Logger.msg(8,"EntityProxyFactory::getProxy(" + path.toString() + ")");
+ Logger.msg(8,"ProxyManager::getProxy(" + path.toString() + ")");
boolean isItem = !(path.getEntity() instanceof AgentPath);
return getProxy( Gateway.getLDAPLookup().getIOR(path),
path.getSysKey(),
@@ -256,7 +254,7 @@ public class EntityProxyManager for( int count=0; i.hasNext(); count++ )
{
Integer nextProxy = i.next();
- EntityProxy thisProxy = proxyPool.get(nextProxy);
+ ItemProxy thisProxy = proxyPool.get(nextProxy);
if (thisProxy != null)
Logger.msg(logLevel,
"" + count + ": "
@@ -280,21 +278,21 @@ public class EntityProxyManager */
public static void initServer()
{
- Logger.msg(5, "EntityProxyFactory::initServer - Starting.....");
+ Logger.msg(5, "ProxyManager::initServer - Starting.....");
int port = Gateway.getProperties().getInt("ItemServer.Proxy.port", 0);
serverName = Gateway.getProperties().getProperty("ItemServer.name");
if (port == 0) {
- Logger.error("ItemServer.Proxy.port not defined in connect file. Remote proxies will not be informed of entity changes.");
+ Logger.error("ItemServer.Proxy.port not defined in connect file. Remote proxies will not be informed of changes.");
return;
}
// set up the proxy server
try {
- Logger.msg(5, "EntityProxyFactory::initServer - Initialising proxy informer on port "+port);
+ Logger.msg(5, "ProxyManager::initServer - Initialising proxy informer on port "+port);
proxyServer = new SimpleTCPIPServer(port, ProxyClientConnection.class, 200);
proxyServer.startListening();
} catch (Exception ex) {
- Logger.error("Error setting up Proxy Server. Remote proxies will not be informed of entity changes.");
+ Logger.error("Error setting up Proxy Server. Remote proxies will not be informed of changes.");
Logger.error(ex);
}
}
@@ -319,7 +317,7 @@ public class EntityProxyManager public static void shutdownServer() {
if (proxyServer != null) {
- Logger.msg(1, "EntityProxyManager: Closing Server.");
+ Logger.msg(1, "ProxyManager: Closing Server.");
proxyServer.stopListening();
}
}
diff --git a/src/main/java/com/c2kernel/entity/proxy/EntityProxyObserver.java b/src/main/java/com/c2kernel/entity/proxy/ProxyObserver.java index 3ddb99c..b15a972 100644 --- a/src/main/java/com/c2kernel/entity/proxy/EntityProxyObserver.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyObserver.java @@ -4,7 +4,7 @@ import com.c2kernel.entity.C2KLocalObject; -public interface EntityProxyObserver<V extends C2KLocalObject>
+public interface ProxyObserver<V extends C2KLocalObject>
{
/**************************************************************************
* Subscribed items are broken apart and fed one by one to these methods.
diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java b/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java index 6807953..54ca787 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java @@ -29,7 +29,7 @@ public class ProxyServerConnection extends Thread String serverName;
int serverPort;
Socket serverConnection;
- EntityProxyManager manager;
+ ProxyManager manager;
// for talking to the proxy server
PrintWriter serverStream;
boolean listening = false;
@@ -38,7 +38,7 @@ public class ProxyServerConnection extends Thread /**
* Create an entity proxy manager to listen for proxy events and reap unused proxies
*/
- public ProxyServerConnection(String host, int port, EntityProxyManager manager)
+ public ProxyServerConnection(String host, int port, ProxyManager manager)
{
Logger.msg(5, "ProxyServerConnection - Initialising connection to "+host+":"+port);
serverName = host;
diff --git a/src/main/java/com/c2kernel/entity/transfer/TransferItem.java b/src/main/java/com/c2kernel/entity/transfer/TransferItem.java index 520063a..df81721 100644 --- a/src/main/java/com/c2kernel/entity/transfer/TransferItem.java +++ b/src/main/java/com/c2kernel/entity/transfer/TransferItem.java @@ -9,7 +9,7 @@ import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.TraceableEntity;
import com.c2kernel.lifecycle.instance.Workflow;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.Path;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.outcome.Outcome;
@@ -89,7 +89,7 @@ public class TransferItem { }
// create item
- EntityPath entityPath = new EntityPath(sysKey);
+ ItemPath entityPath = new ItemPath(sysKey);
TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entityPath);
Gateway.getLDAPLookup().add(entityPath);
@@ -107,7 +107,10 @@ public class TransferItem { throw new Exception("No workflow found in import for "+sysKey);
// init item
- newItem.initialise(importAgentId, Gateway.getMarshaller().marshall(props), Gateway.getMarshaller().marshall(wf.search("workflow/domain")));
+ newItem.initialise(importAgentId,
+ Gateway.getMarshaller().marshall(props),
+ Gateway.getMarshaller().marshall(wf.search("workflow/domain")),
+ null);
// store objects
importByType(ClusterStorage.COLLECTION, objects);
diff --git a/src/main/java/com/c2kernel/entity/transfer/TransferSet.java b/src/main/java/com/c2kernel/entity/transfer/TransferSet.java index 7a3ba2e..a7d81b6 100644 --- a/src/main/java/com/c2kernel/entity/transfer/TransferSet.java +++ b/src/main/java/com/c2kernel/entity/transfer/TransferSet.java @@ -3,7 +3,7 @@ package com.c2kernel.entity.transfer; import java.io.File;
import java.util.ArrayList;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.NextKeyManager;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.FileStringUtility;
@@ -85,7 +85,7 @@ public class TransferSet { try
{ // find the current last key
NextKeyManager nextKeyMan = Gateway.getLDAPLookup().getNextKeyManager();
- EntityPath lastKey = nextKeyMan.getLastEntityPath();
+ ItemPath lastKey = nextKeyMan.getLastEntityPath();
Logger.msg(1, "Last key imported was "+packageLastKey+". LDAP lastkey was "+lastKey.getSysKey());
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java index a6e39ae..0fc9bf9 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java @@ -13,7 +13,7 @@ import com.c2kernel.common.PersistencyException; import com.c2kernel.graph.model.GraphableVertex;
import com.c2kernel.lifecycle.routingHelpers.ViewpointDataHelper;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.process.Gateway;
import com.c2kernel.scripting.Script;
@@ -154,7 +154,7 @@ public abstract class WfVertex extends GraphableVertex //TODO: is this right?
if (requiredInput.containsKey("item")) {
- script.setInputParamValue("item", Gateway.getProxyManager().getProxy(new EntityPath(itemSysKey)));
+ script.setInputParamValue("item", Gateway.getProxyManager().getProxy(new ItemPath(itemSysKey)));
}
if (requiredInput.containsKey("agent")) {
AgentPath systemAgent = Gateway.getLDAPLookup().getRoleManager().getAgentPath("system");
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java index d28fe3c..9eb15f2 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java @@ -13,8 +13,8 @@ package com.c2kernel.lifecycle.instance.predefined; import com.c2kernel.common.InvalidDataException;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.lookup.LDAPLookup;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
@@ -39,13 +39,13 @@ public class AddDomainPath extends PredefinedStep try
{
- DomainPath domainPath = new DomainPath(getDataList(requestData)[0], new EntityPath(itemSysKey));
+ DomainPath domainPath = new DomainPath(getDataList(requestData)[0], new ItemPath(itemSysKey));
lookupManager.add(domainPath);
Logger.msg(8,"AddDomainPath::request() - systemKey:" + itemSysKey +
". Adding dompath. DONE.");
return requestData;
}
- catch (InvalidEntityPathException ex)
+ catch (InvalidItemPathException ex)
{
Logger.error(ex);
throw new InvalidDataException(ex.toString(), "");
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java index 7d36f35..78d4087 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java @@ -52,7 +52,7 @@ public class AssignItemToSlot extends PredefinedStep String collName;
int slotNo;
- int entityKey;
+ int sysKey;
Aggregation agg;
Logger.msg(1, "AssignItemToSlot::request() - Starting.");
@@ -63,7 +63,7 @@ public class AssignItemToSlot extends PredefinedStep String[] params = getDataList(requestData);
collName = params[0];
slotNo = Integer.parseInt(params[1]);
- entityKey = Integer.parseInt(params[2]);
+ sysKey = Integer.parseInt(params[2]);
} catch (Exception e) {
throw new InvalidDataException("Invalid parameters", "");
}
@@ -85,12 +85,12 @@ public class AssignItemToSlot extends PredefinedStep boolean stored = false;
for (AggregationMember member : agg.getMembers().list) {
if (member.getID() == slotNo) {
- if (member.getEntityKey() > -1)
+ if (member.getSystemKey() > -1)
throw new InvalidDataException("Member slot not empty", "");
try {
- member.assignEntity(entityKey);
+ member.assignItem(sysKey);
} catch (MembershipException e) {
- throw new InvalidDataException("Entity "+entityKey+" does not fit in this slot", "");
+ throw new InvalidDataException("Entity "+sysKey+" does not fit in this slot", "");
}
stored = true;
break;
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java index 60e63f1..772f62e 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java @@ -76,9 +76,9 @@ public class ClearSlot extends PredefinedStep boolean stored = false;
for (AggregationMember member : agg.getMembers().list) {
if (member.getID() == slotNo) {
- if (member.getEntityKey() > -1)
+ if (member.getSystemKey() > -1)
throw new InvalidDataException("Member slot already empty", "");
- member.clearEntity();
+ member.clearItem();
stored = true;
break;
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java index 3197ce5..e6da64a 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java @@ -12,9 +12,9 @@ package com.c2kernel.lifecycle.instance.predefined;
import java.util.ArrayList;
-import java.util.Iterator;
import com.c2kernel.collection.Collection;
+import com.c2kernel.collection.CollectionArrayList;
import com.c2kernel.collection.CollectionDescription;
import com.c2kernel.collection.CollectionMember;
import com.c2kernel.common.AccessRightsException;
@@ -26,7 +26,7 @@ import com.c2kernel.entity.TraceableEntity; import com.c2kernel.lifecycle.CompositeActivityDef;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.LDAPLookup;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.TransactionManager;
@@ -77,22 +77,21 @@ public class CreateItemFromDescription extends PredefinedStep throw new ObjectAlreadyExistsException("The item name " +newName+ " exists already.", "");
// get init objects
- String[] collNames = storage.getClusterContents(itemSysKey, ClusterStorage.COLLECTION);
- ArrayList<String> collections = new ArrayList<String>();
-
- // loop through collections to instantiate
+ // loop through collections, collecting instantiated descriptions and finding the default workflow def
+ CollectionArrayList colls = new CollectionArrayList();
+ String[] collNames = storage.getClusterContents(itemSysKey, ClusterStorage.COLLECTION);
for (String collName : collNames) {
Collection<? extends CollectionMember> thisCol = (Collection<? extends CollectionMember>)storage.get(itemSysKey, ClusterStorage.COLLECTION+"/"+collName, null);
if (thisCol instanceof CollectionDescription) {
CollectionDescription<? extends CollectionMember> thisDesc = (CollectionDescription<? extends CollectionMember>)thisCol;
- collections.add(Gateway.getMarshaller().marshall(thisDesc.newInstance()));
+ colls.put(thisDesc.newInstance());
}
else if (thisCol.getName().equalsIgnoreCase("workflow") && wfDefName == null) {
ArrayList<? extends CollectionMember> members = thisCol.getMembers().list;
// get the first member from the wf collection
CollectionMember wfMember = members.get(0);
- wfDefName = wfMember.resolveEntity().getName();
+ wfDefName = wfMember.resolveItem().getName();
Object wfVerObj = wfMember.getProperties().get("Version");
try {
wfDefVer = Integer.parseInt(wfVerObj.toString());
@@ -135,7 +134,7 @@ public class CreateItemFromDescription extends PredefinedStep // generate new entity key
Logger.msg(6, "CreateItemFromDescription - Requesting new sysKey");
- EntityPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
+ ItemPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
// resolve the item factory
Logger.msg(6, "CreateItemFromDescription - Resolving item factory");
@@ -155,18 +154,9 @@ public class CreateItemFromDescription extends PredefinedStep newItem.initialise(
agent.getSysKey(),
Gateway.getMarshaller().marshall(props),
- Gateway.getMarshaller().marshall(wfDef.instantiate()));
-
- // add collections
- if (collections.size() > 0) {
- Logger.msg(6, "CreateItemFromDescription - Adding Collections");
- String[] colls = new String[1];
- for (Iterator<String> iter = collections.iterator(); iter.hasNext();) {
- colls[0] = iter.next();
- // TODO: initialize
- newItem.requestAction(agent.getSysKey(), "workflow/predefined/AddC2KObject", PredefinedStep.DONE, PredefinedStep.bundleData(colls));
- }
- }
+ Gateway.getMarshaller().marshall(wfDef.instantiate()),
+ Gateway.getMarshaller().marshall(colls)
+ );
// add its domain path
Logger.msg(3, "CreateItemFromDescription - Creating "+context);
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java index 0f3a246..412fe52 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Erase.java @@ -18,7 +18,7 @@ import java.util.Enumeration; import com.c2kernel.common.InvalidDataException;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.Path;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
@@ -47,7 +47,7 @@ public class Erase extends PredefinedStep try
{
// get all domain paths
- Enumeration<Path> domPaths = Gateway.getLDAPLookup().searchAliases(new EntityPath(itemSysKey));
+ Enumeration<Path> domPaths = Gateway.getLDAPLookup().searchAliases(new ItemPath(itemSysKey));
while (domPaths.hasMoreElements()) {
DomainPath path = (DomainPath)domPaths.nextElement();
// delete them
@@ -59,7 +59,7 @@ public class Erase extends PredefinedStep Gateway.getStorage().removeCluster(itemSysKey, "", null);
//remove entity path
- Gateway.getLDAPLookup().delete(new EntityPath(itemSysKey));
+ Gateway.getLDAPLookup().delete(new ItemPath(itemSysKey));
}
catch( Exception ex )
{
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java index 3cc9f7c..38638cd 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java @@ -51,7 +51,7 @@ public class RemoveSlotFromCollection extends PredefinedStep String collName;
int slotNo;
- int entityKey = -1;
+ int sysKey = -1;
Collection<? extends CollectionMember> coll;
Logger.msg(1, "RemoveSlotFromCollection::request() - Starting.");
@@ -61,12 +61,12 @@ public class RemoveSlotFromCollection extends PredefinedStep String[] params = getDataList(requestData);
collName = params[0];
slotNo = params[1].length()>0?Integer.parseInt(params[1]):-1;
- if (params.length>2) entityKey = params[2].length()>0?Integer.parseInt(params[2]):-1;
+ if (params.length>2) sysKey = params[2].length()>0?Integer.parseInt(params[2]):-1;
} catch (Exception e) {
throw new InvalidDataException("Invalid parameters", "");
}
- if (slotNo == -1 && entityKey == -1)
+ if (slotNo == -1 && sysKey == -1)
throw new InvalidDataException("Must give either slot number or entity key", "");
// load collection
@@ -81,7 +81,7 @@ public class RemoveSlotFromCollection extends PredefinedStep if (slotNo == -1) { // find slot from entity key
for (CollectionMember member : coll.getMembers().list) {
- if (member.getEntityKey() == entityKey) {
+ if (member.getSystemKey() == sysKey) {
slotNo = member.getID();
break;
}
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java index 2c025d2..baea8dd 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java @@ -41,7 +41,7 @@ public class NewAgent extends ModuleImport implements java.io.Serializable { properties.add(new com.c2kernel.property.Property("Name", name, true));
properties.add(new com.c2kernel.property.Property("Type", "Agent", false));
try {
- newAgentEnt.initialise(Gateway.getMarshaller().marshall(new PropertyArrayList(properties)));
+ newAgentEnt.initialise(agentId, Gateway.getMarshaller().marshall(new PropertyArrayList(properties)), null, null);
} catch (Exception ex) {
Logger.error(ex);
throw new CannotManageException("Error initialising new agent");
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java index 588b2fc..52a214e 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
+import com.c2kernel.collection.CollectionArrayList;
import com.c2kernel.collection.MembershipException;
import com.c2kernel.common.CannotManageException;
import com.c2kernel.common.InvalidDataException;
@@ -18,7 +19,7 @@ import com.c2kernel.events.History; import com.c2kernel.lifecycle.CompositeActivityDef;
import com.c2kernel.lifecycle.instance.stateMachine.Transition;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.outcome.Viewpoint;
@@ -69,7 +70,7 @@ public class NewItem extends ModuleImport { public void create(int agentId, boolean reset) throws ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException {
DomainPath domPath = new DomainPath(new DomainPath(initialPath), name);
- EntityPath entPath; TraceableEntity newItem;
+ ItemPath entPath; TraceableEntity newItem;
if (domPath.exists()) {
entPath = domPath.getEntity();
newItem = Gateway.getCorbaServer().getItem(entPath.getSysKey());
@@ -98,12 +99,35 @@ public class NewItem extends ModuleImport { throw new CannotManageException("Workflow def "+workflow+" v"+usedWfVer+" for item "+domPath+" was not valid", "");
}
+ // create collections
+ CollectionArrayList colls = new CollectionArrayList();
+ for (Dependency element: dependencyList) {
+ try {
+ com.c2kernel.collection.Dependency newDep = element.create();
+ colls.put(newDep);
+ } catch (MembershipException ex) {
+ Logger.error(ex);
+ throw new CannotManageException("A specified member is not of the correct type in "+element.name, "");
+ }
+ }
+
+ for (Aggregation element : aggregationList) {
+ try {
+ com.c2kernel.collection.Aggregation newAgg = element.create();
+ colls.put(newAgg);
+ } catch (MembershipException ex) {
+ Logger.error(ex);
+ throw new CannotManageException("A specified member is not of the correct type in "+element.name, "");
+ }
+ }
+
+ // (re)initialise the new item with properties, workflow and collections
try {
- // initialise the new item with workflow and properties
newItem.initialise(
agentId,
Gateway.getMarshaller().marshall(new PropertyArrayList(properties)),
- Gateway.getMarshaller().marshall(compact.instantiate()));
+ Gateway.getMarshaller().marshall(compact.instantiate()),
+ Gateway.getMarshaller().marshall(colls));
} catch (Exception ex) {
Logger.error("Error initialising new item "+name );
Logger.error(ex);
@@ -159,46 +183,5 @@ public class NewItem extends ModuleImport { domPath.setEntity(entPath);
Gateway.getLDAPLookup().add(domPath);
}
-
- // create collections
- for (Dependency element: dependencyList) {
- try {
- com.c2kernel.collection.Dependency newDep = element.create();
- if (!reset) {
- try {
- Gateway.getStorage().get(entPath.getSysKey(), ClusterStorage.COLLECTION+"/"+newDep.getName(), null);
- Logger.msg("Not overwriting dependency "+newDep.getName());
- continue; // TODO: a proper compare here
- } catch (ObjectNotFoundException ex) { } // doesn't exist, ok to create
- }
- Gateway.getStorage().put(entPath.getSysKey(), element.create(), null);
- } catch (ClusterStorageException ex) {
- Logger.error(ex);
- throw new CannotManageException("Could not create Dependency "+element.name, "");
- } catch (MembershipException ex) {
- Logger.error(ex);
- throw new CannotManageException("A specified member is not of the correct type in "+element.name, "");
- }
- }
-
- for (Aggregation element : aggregationList) {
- try {
- com.c2kernel.collection.Aggregation newAgg = element.create();
- if (!reset) {
- try {
- Gateway.getStorage().get(entPath.getSysKey(), ClusterStorage.COLLECTION+"/"+newAgg.getName(), null);
- Logger.msg("Not overwriting aggregation "+newAgg.getName());
- continue; // TODO: a proper compare here
- } catch (ObjectNotFoundException ex) { } // doesn't exist, ok to create
- }
- Gateway.getStorage().put(entPath.getSysKey(), newAgg, null);
- } catch (ClusterStorageException ex) {
- Logger.error(ex);
- throw new CannotManageException("Could not create Aggregation "+element.name, "");
- } catch (MembershipException ex) {
- Logger.error(ex);
- throw new CannotManageException("A specified member is not of the correct type in "+element.name, "");
- }
- }
}
}
diff --git a/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java b/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java index 0258347..5b70dd0 100644 --- a/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java +++ b/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java @@ -2,7 +2,7 @@ package com.c2kernel.lifecycle.routingHelpers; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.proxy.ItemProxy;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.outcome.Outcome;
import com.c2kernel.persistency.outcome.Viewpoint;
@@ -51,12 +51,12 @@ public class ViewpointDataHelper else return errArr;
// find entity
- EntityPath sourcePath;
+ ItemPath sourcePath;
try
{
- sourcePath = new EntityPath(Integer.parseInt(entityPath));
+ sourcePath = new ItemPath(Integer.parseInt(entityPath));
} catch (Exception e) {
- sourcePath = new EntityPath(entityPath);
+ sourcePath = new ItemPath(entityPath);
}
try {
diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java index 5ff6988..a560795 100644 --- a/src/main/java/com/c2kernel/lookup/AgentPath.java +++ b/src/main/java/com/c2kernel/lookup/AgentPath.java @@ -29,14 +29,14 @@ import com.novell.ldap.LDAPEntry; * @version $Revision: 1.12 $ $Date: 2005/10/13 08:15:00 $
* @author $Author: abranson $
**/
-public class AgentPath extends EntityPath
+public class AgentPath extends ItemPath
{
private String mAgentName=null;
private String mPassword=null;
public AgentPath(int syskey, String agentName)
- throws InvalidAgentPathException,InvalidEntityPathException
+ throws InvalidAgentPathException,InvalidItemPathException
{
super(syskey);
if (agentName!=null && agentName.length()>0)
@@ -46,16 +46,16 @@ public class AgentPath extends EntityPath }
public AgentPath(int syskey)
- throws InvalidEntityPathException
+ throws InvalidItemPathException
{
super(syskey);
}
- public AgentPath(EntityPath entity) {
+ public AgentPath(ItemPath entity) {
super();
try {
setSysKey(entity.getSysKey());
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
//won't happen as the entity path was valid
}
}
diff --git a/src/main/java/com/c2kernel/lookup/DomainPath.java b/src/main/java/com/c2kernel/lookup/DomainPath.java index ce849ce..b0784f9 100644 --- a/src/main/java/com/c2kernel/lookup/DomainPath.java +++ b/src/main/java/com/c2kernel/lookup/DomainPath.java @@ -23,7 +23,7 @@ import com.novell.ldap.LDAPAttributeSet; **/
public class DomainPath extends Path
{
- private EntityPath target = null;
+ private ItemPath target = null;
protected static String mTypeRoot;
/* Very simple extension to Path. Only copies constructors and defines root */
@@ -49,7 +49,7 @@ public class DomainPath extends Path super(path, Path.UNKNOWN);
}
- public DomainPath(String path, EntityPath entity) throws InvalidEntityPathException
+ public DomainPath(String path, ItemPath entity) throws InvalidItemPathException
{
super(path, Path.UNKNOWN);
setEntity(entity);
@@ -76,7 +76,7 @@ public class DomainPath extends Path return new DomainPath(parentPath);
}
- public void setEntity(EntityPath newTarget) {
+ public void setEntity(ItemPath newTarget) {
if (newTarget == null) { // clear
target = null;
mType = Path.CONTEXT;
@@ -88,7 +88,7 @@ public class DomainPath extends Path }
@Override
- public EntityPath getEntity() throws ObjectNotFoundException {
+ public ItemPath getEntity() throws ObjectNotFoundException {
if (mType == UNKNOWN) { // must decide
checkType();
}
@@ -109,7 +109,7 @@ public class DomainPath extends Path public void checkType() {
try {
setEntity(Gateway.getLDAPLookup().resolvePath(this));
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
Logger.error(ex);
mType = CONTEXT;
} catch (ObjectNotFoundException ex) {
diff --git a/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java b/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java index be4d952..a74e1ee 100644 --- a/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java +++ b/src/main/java/com/c2kernel/lookup/InvalidAgentPathException.java @@ -1,6 +1,6 @@ package com.c2kernel.lookup;
-public class InvalidAgentPathException extends InvalidEntityPathException {
+public class InvalidAgentPathException extends InvalidItemPathException {
public InvalidAgentPathException() {
super();
diff --git a/src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java b/src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java deleted file mode 100644 index 27c754d..0000000 --- a/src/main/java/com/c2kernel/lookup/InvalidEntityPathException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.c2kernel.lookup;
-
-public class InvalidEntityPathException extends Exception {
-
- public InvalidEntityPathException() {
- super();
- }
-
- public InvalidEntityPathException(String msg) {
- super(msg);
- }
-
-}
diff --git a/src/main/java/com/c2kernel/lookup/InvalidItemPathException.java b/src/main/java/com/c2kernel/lookup/InvalidItemPathException.java new file mode 100644 index 0000000..5b37cd7 --- /dev/null +++ b/src/main/java/com/c2kernel/lookup/InvalidItemPathException.java @@ -0,0 +1,13 @@ +package com.c2kernel.lookup;
+
+public class InvalidItemPathException extends Exception {
+
+ public InvalidItemPathException() {
+ super();
+ }
+
+ public InvalidItemPathException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/src/main/java/com/c2kernel/lookup/EntityPath.java b/src/main/java/com/c2kernel/lookup/ItemPath.java index 4f9b771..89fe5ee 100644 --- a/src/main/java/com/c2kernel/lookup/EntityPath.java +++ b/src/main/java/com/c2kernel/lookup/ItemPath.java @@ -25,7 +25,7 @@ import com.novell.ldap.LDAPAttributeSet; * @version $Revision: 1.14 $ $Date: 2006/03/03 13:52:21 $
* @author $Author: abranson $
**/
-public class EntityPath extends Path
+public class ItemPath extends Path
{
// no of components in a syskey
public static final int elementNo = 3;
@@ -40,14 +40,14 @@ public class EntityPath extends Path * The object decides that for itself from the number of components
*/
- public EntityPath(int syskey) throws InvalidEntityPathException {
+ public ItemPath(int syskey) throws InvalidItemPathException {
super();
setSysKey(syskey);
}
/*
*/
- public EntityPath()
+ public ItemPath()
{
super();
}
@@ -55,7 +55,7 @@ public class EntityPath extends Path /*
*/
- public EntityPath(String[] path) throws InvalidEntityPathException
+ public ItemPath(String[] path) throws InvalidItemPathException
{
super(path, Path.CONTEXT); // dummy - it will get replaced in checkSysPath()
checkSysPath();
@@ -63,7 +63,7 @@ public class EntityPath extends Path /*
*/
- public EntityPath(String path) throws InvalidEntityPathException
+ public ItemPath(String path) throws InvalidItemPathException
{
super(path, Path.CONTEXT);
checkSysPath();
@@ -71,7 +71,7 @@ public class EntityPath extends Path /*
*/
- public EntityPath(EntityPath parent, String child) throws InvalidEntityPathException {
+ public ItemPath(ItemPath parent, String child) throws InvalidItemPathException {
super(parent, child);
checkSysPath();
}
@@ -83,7 +83,7 @@ public class EntityPath extends Path }
@Override
- public EntityPath getEntity() throws ObjectNotFoundException {
+ public ItemPath getEntity() throws ObjectNotFoundException {
return this;
}
@@ -101,22 +101,22 @@ public class EntityPath extends Path if (mSysKey == Path.INVALID && mType == Path.ENTITY)
try {
if (mPath.length != elementNo)
- throw new InvalidEntityPathException("Incorrect number of components for a system key");
+ throw new InvalidItemPathException("Incorrect number of components for a system key");
mSysKey = 0;
for (String keypart : mPath) {
if (keypart.length()!=elementLen+1)
- throw new InvalidEntityPathException("Component '"+keypart+"' is not the correct size for a system key");
+ throw new InvalidItemPathException("Component '"+keypart+"' is not the correct size for a system key");
for(int j=1; j<elementLen+1; j++) // skip the 'd' prefix
{
char c = keypart.charAt(j);
if((c >= '0') && (c <='9'))
mSysKey = mSysKey*10 + c - '0';
else
- throw new InvalidEntityPathException("Component '"+keypart+"' contained a non-numeric char (excluding first char 'd').");
+ throw new InvalidItemPathException("Component '"+keypart+"' contained a non-numeric char (excluding first char 'd').");
}
}
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
mSysKey = Path.INVALID;
}
return mSysKey;
@@ -124,10 +124,10 @@ public class EntityPath extends Path /** Sets path from int syskey
*/
- public void setSysKey(int sysKey) throws InvalidEntityPathException
+ public void setSysKey(int sysKey) throws InvalidItemPathException
{
if (sysKey < 0 || sysKey > maxSysKey)
- throw new InvalidEntityPathException("System key "+sysKey+" out of range");
+ throw new InvalidItemPathException("System key "+sysKey+" out of range");
String stringPath = Integer.toString(sysKey);
ArrayList<String> newKey = new ArrayList<String>();
for (int i=0; i<elementNo; i++) {
@@ -152,9 +152,9 @@ public class EntityPath extends Path checkSysPath();
}
- public void checkSysPath() throws InvalidEntityPathException {
+ public void checkSysPath() throws InvalidItemPathException {
if (mPath.length > elementNo)
- throw new InvalidEntityPathException("EntityPath cannot have more than "+elementNo+" components: "+toString());
+ throw new InvalidItemPathException("EntityPath cannot have more than "+elementNo+" components: "+toString());
if (mPath.length == elementNo)
mType = Path.ENTITY;
else
diff --git a/src/main/java/com/c2kernel/lookup/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/LDAPLookup.java index 4ea6e68..116362e 100644 --- a/src/main/java/com/c2kernel/lookup/LDAPLookup.java +++ b/src/main/java/com/c2kernel/lookup/LDAPLookup.java @@ -12,7 +12,7 @@ import com.c2kernel.common.ObjectCannotBeUpdated; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.TraceableEntity;
import com.c2kernel.entity.agent.ActiveEntity;
-import com.c2kernel.entity.proxy.EntityProxyManager;
+import com.c2kernel.entity.proxy.ProxyManager;
import com.c2kernel.entity.proxy.ProxyMessage;
import com.c2kernel.process.Gateway;
import com.c2kernel.property.PropertyDescription;
@@ -67,13 +67,13 @@ public class LDAPLookup Path.mRootPath=props.mRootPath;
Path.mLocalPath=props.mLocalPath;
- EntityPath.mTypeRoot = "cn=entity,"+props.mLocalPath;
+ ItemPath.mTypeRoot = "cn=entity,"+props.mLocalPath;
DomainPath.mTypeRoot = "cn=domain,"+props.mLocalPath;
- mNextKeyManager = new NextKeyManager(this, "cn=last,"+EntityPath.mTypeRoot);
+ mNextKeyManager = new NextKeyManager(this, "cn=last,"+ItemPath.mTypeRoot);
Logger.msg(7, "LDAP.useOldProps="+Gateway.getProperties().getBoolean("LDAP.useOldProps", false));
mPropManager = new LDAPPropertyManager(this);
- mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.mTypeRoot, EntityPath.mTypeRoot);
+ mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.mTypeRoot, ItemPath.mTypeRoot);
}
@@ -199,12 +199,12 @@ public class LDAPLookup *
* @param domPath
* @return
- * @throws InvalidEntityPathException
+ * @throws InvalidItemPathException
* @throws ObjectNotFoundException
*/
- protected EntityPath resolvePath(DomainPath domPath)
- throws InvalidEntityPathException, ObjectNotFoundException {
- EntityPath referencedPath = null;
+ protected ItemPath resolvePath(DomainPath domPath)
+ throws InvalidItemPathException, ObjectNotFoundException {
+ ItemPath referencedPath = null;
LDAPEntry domEntry = LDAPLookupUtils.getEntry(getConnection(), domPath
.getFullDN(), LDAPSearchConstraints.DEREF_ALWAYS);
String entityKey = LDAPLookupUtils.getFirstAttributeValue(domEntry,
@@ -216,7 +216,7 @@ public class LDAPLookup if (objClass.equals("cristalagent"))
referencedPath = new AgentPath(Integer.parseInt(entityKey));
else
- referencedPath = new EntityPath(Integer.parseInt(entityKey));
+ referencedPath = new ItemPath(Integer.parseInt(entityKey));
return referencedPath;
}
@@ -231,7 +231,7 @@ public class LDAPLookup LDAPEntry newEntry = new LDAPEntry(path.getFullDN(),attrSet);
LDAPLookupUtils.addEntry(getConnection(),newEntry);
if (path instanceof DomainPath)
- EntityProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.ADDED));
+ ProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.ADDED));
return newEntry;
} catch (LDAPException ex) {
if (ex.getResultCode() == LDAPException.ENTRY_ALREADY_EXISTS)
@@ -251,7 +251,7 @@ public class LDAPLookup throw new ObjectCannotBeUpdated(ex.getLDAPErrorMessage(), "");
}
if (path instanceof DomainPath) {
- EntityProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.DELETED));
+ ProxyManager.sendProxyEvent(new ProxyMessage(ProxyMessage.NA, path.toString(), ProxyMessage.DELETED));
}
}
@@ -393,7 +393,7 @@ public class LDAPLookup return search(start.getFullDN(), LDAPConnection.SCOPE_SUB, "objectClass=aliasObject", searchCons);
}
- public LDAPPathSet searchAliases(EntityPath entity) {
+ public LDAPPathSet searchAliases(ItemPath entity) {
LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
searchCons.setBatchSize(0);
searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER);
@@ -431,7 +431,7 @@ public class LDAPLookup * @throws ObjectNotFoundException
* @throws ObjectNotFoundException
*/
- protected Path nodeToPath(LDAPEntry entry) throws InvalidEntityPathException, ObjectNotFoundException
+ protected Path nodeToPath(LDAPEntry entry) throws InvalidItemPathException, ObjectNotFoundException
{
String dn = entry.getDN();
@@ -470,14 +470,14 @@ public class LDAPLookup thisPath = domainPath;
}
else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalentity") ||
- (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(EntityPath.mTypeRoot)))
+ (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(ItemPath.mTypeRoot)))
{
- if(dn.endsWith(EntityPath.mTypeRoot)) {
- EntityPath entityPath;
+ if(dn.endsWith(ItemPath.mTypeRoot)) {
+ ItemPath entityPath;
if (entityKey != -1)
- entityPath = new EntityPath(entityKey);
+ entityPath = new ItemPath(entityKey);
else {
- entityPath = new EntityPath();
+ entityPath = new ItemPath();
entityPath.setDN(dn);
}
thisPath = entityPath;
diff --git a/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java b/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java index fcf1ef8..51b9ded 100644 --- a/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java +++ b/src/main/java/com/c2kernel/lookup/LDAPPropertyManager.java @@ -35,7 +35,7 @@ public class LDAPPropertyManager { * @return
* @throws ObjectNotFoundException
*/
- public boolean hasProperties(EntityPath thisEntity) throws ObjectNotFoundException {
+ public boolean hasProperties(ItemPath thisEntity) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
return entityEntry.getAttribute("cristalprop") != null;
}
@@ -45,7 +45,7 @@ public class LDAPPropertyManager { * @return array of Property
* @throws ObjectNotFoundException
*/
- public String[] getPropertyNames(EntityPath thisEntity) throws ObjectNotFoundException {
+ public String[] getPropertyNames(ItemPath thisEntity) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
ArrayList<String> propbag = new ArrayList<String>();
LDAPAttribute props = entityEntry.getAttribute("cristalprop");
@@ -66,7 +66,7 @@ public class LDAPPropertyManager { * @return The Property object
* @throws ObjectNotFoundException
*/
- public Property getProperty(EntityPath thisEntity, String name) throws ObjectNotFoundException {
+ public Property getProperty(ItemPath thisEntity, String name) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
return getProperty(entityEntry, name);
}
@@ -77,7 +77,7 @@ public class LDAPPropertyManager { * @throws ObjectNotFoundException
* @throws ObjectCannotBeUpdated
*/
- public void deleteProperty(EntityPath thisEntity, String name) throws ObjectNotFoundException, ObjectCannotBeUpdated {
+ public void deleteProperty(ItemPath thisEntity, String name) throws ObjectNotFoundException, ObjectCannotBeUpdated {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
Property prop = getProperty(entityEntry, name);
Logger.msg(6, "LDAPLookupUtils.deleteProperty("+name+") - Deleting property");
@@ -94,7 +94,7 @@ public class LDAPPropertyManager { * @throws ObjectNotFoundException
* @throws ObjectCannotBeUpdated
*/
- public void setProperty(EntityPath thisEntity, Property prop) throws ObjectNotFoundException, ObjectCannotBeUpdated {
+ public void setProperty(ItemPath thisEntity, Property prop) throws ObjectNotFoundException, ObjectCannotBeUpdated {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
try {
Property oldProp = getProperty(entityEntry, prop.getName());
diff --git a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java index f40cd53..091f6d7 100644 --- a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java +++ b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java @@ -124,7 +124,7 @@ public class LDAPRoleManager { agents.add(path);
} catch (ObjectNotFoundException ex) {
Logger.error("Agent "+userDN+" does not exist");
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
Logger.error("Agent "+userDN+" is not a valid entity");
}
}
diff --git a/src/main/java/com/c2kernel/lookup/NextKeyManager.java b/src/main/java/com/c2kernel/lookup/NextKeyManager.java index a4ead4b..9aea50d 100644 --- a/src/main/java/com/c2kernel/lookup/NextKeyManager.java +++ b/src/main/java/com/c2kernel/lookup/NextKeyManager.java @@ -28,14 +28,14 @@ public class NextKeyManager { this.lastKeyPath = lastKeyPath;
}
- public synchronized EntityPath generateNextEntityKey()
+ public synchronized ItemPath generateNextEntityKey()
throws ObjectCannotBeUpdated, ObjectNotFoundException
{
- EntityPath lastKey = getLastEntityPath();
+ ItemPath lastKey = getLastEntityPath();
try {
lastKey.setSysKey(lastKey.getSysKey()+1);
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectCannotBeUpdated("Invalid syskey "+(lastKey.getSysKey()+1)+". Maybe centre is full.");
}
//test that storage is empty for that key
@@ -56,7 +56,7 @@ public class NextKeyManager { public synchronized AgentPath generateNextAgentKey()
throws ObjectCannotBeUpdated, ObjectNotFoundException {
- EntityPath newEntity = generateNextEntityKey();
+ ItemPath newEntity = generateNextEntityKey();
return new AgentPath(newEntity);
}
@@ -65,15 +65,15 @@ public class NextKeyManager { LDAPLookupUtils.setAttributeValue(ldap.getConnection(), lastKeyEntry,"intsyskey",Integer.toString(sysKey));
}
- public EntityPath getLastEntityPath() throws ObjectNotFoundException
+ public ItemPath getLastEntityPath() throws ObjectNotFoundException
{
LDAPEntry lastKeyEntry = LDAPLookupUtils.getEntry(ldap.getConnection(),lastKeyPath);
String lastKey = LDAPLookupUtils.getFirstAttributeValue(lastKeyEntry,"intsyskey");
try {
int sysKey = Integer.parseInt(lastKey);
- EntityPath sysPath = new EntityPath(sysKey);
+ ItemPath sysPath = new ItemPath(sysKey);
return sysPath;
- } catch (InvalidEntityPathException ex) {
+ } catch (InvalidItemPathException ex) {
throw new ObjectNotFoundException("Invalid syskey. Maybe centre is full.");
} catch (NumberFormatException ex) {
throw new ObjectNotFoundException("Invalid syskey in lastkey.");
diff --git a/src/main/java/com/c2kernel/lookup/Path.java b/src/main/java/com/c2kernel/lookup/Path.java index 4bec43a..16f3e5d 100644 --- a/src/main/java/com/c2kernel/lookup/Path.java +++ b/src/main/java/com/c2kernel/lookup/Path.java @@ -279,7 +279,7 @@ public abstract class Path implements Serializable throw new ObjectNotFoundException("No match for "+name, "");
}
- public abstract EntityPath getEntity() throws ObjectNotFoundException;
+ public abstract ItemPath getEntity() throws ObjectNotFoundException;
public abstract LDAPAttributeSet createAttributeSet() throws ObjectCannotBeUpdated;
diff --git a/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java b/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java index 0546bab..d0c3f77 100644 --- a/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java +++ b/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java @@ -10,7 +10,7 @@ import java.util.StringTokenizer; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.entity.agent.JobList;
-import com.c2kernel.entity.proxy.EntityProxyManager;
+import com.c2kernel.entity.proxy.ProxyManager;
import com.c2kernel.entity.proxy.ProxyMessage;
import com.c2kernel.events.History;
import com.c2kernel.persistency.outcome.Outcome;
@@ -291,7 +291,7 @@ public class ClusterStorageManager { if (Logger.doLog(9)) dumpCacheContents(9);
// transmit proxy event
- EntityProxyManager.sendProxyEvent( new ProxyMessage(sysKeyIntObj.intValue(), path, ProxyMessage.ADDED));
+ ProxyManager.sendProxyEvent( new ProxyMessage(sysKeyIntObj.intValue(), path, ProxyMessage.ADDED));
}
/** Deletes a cluster from all writers */
@@ -317,7 +317,7 @@ public class ClusterStorageManager { // transmit proxy event
- EntityProxyManager.sendProxyEvent( new ProxyMessage(sysKeyIntObj.intValue(), path, ProxyMessage.DELETED));
+ ProxyManager.sendProxyEvent( new ProxyMessage(sysKeyIntObj.intValue(), path, ProxyMessage.DELETED));
}
public void clearCache(Integer sysKeyIntObj, String path) {
diff --git a/src/main/java/com/c2kernel/persistency/LDAPClusterStorage.java b/src/main/java/com/c2kernel/persistency/LDAPClusterStorage.java index 5a305f9..2c10bbf 100644 --- a/src/main/java/com/c2kernel/persistency/LDAPClusterStorage.java +++ b/src/main/java/com/c2kernel/persistency/LDAPClusterStorage.java @@ -4,8 +4,8 @@ import java.util.StringTokenizer; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.lookup.LDAPPropertyManager;
import com.c2kernel.process.Gateway;
import com.c2kernel.property.Property;
@@ -53,10 +53,10 @@ public class LDAPClusterStorage extends ClusterStorage { throw new ClusterStorageException("Path length was invalid: "+path);
String type = tok.nextToken();
- EntityPath thisEntity;
+ ItemPath thisEntity;
try {
- thisEntity = new EntityPath(sysKey.intValue());
- } catch (InvalidEntityPathException e) {
+ thisEntity = new ItemPath(sysKey.intValue());
+ } catch (InvalidItemPathException e) {
throw new ClusterStorageException("Invalid Syskey:"+sysKey);
}
@@ -84,10 +84,10 @@ public class LDAPClusterStorage extends ClusterStorage { String type = obj.getClusterType();
- EntityPath thisEntity;
+ ItemPath thisEntity;
try {
- thisEntity = new EntityPath(sysKey.intValue());
- } catch (InvalidEntityPathException e) {
+ thisEntity = new ItemPath(sysKey.intValue());
+ } catch (InvalidItemPathException e) {
throw new ClusterStorageException("Invalid Syskey:"+sysKey);
}
@@ -112,10 +112,10 @@ public class LDAPClusterStorage extends ClusterStorage { throw new ClusterStorageException("Path length was invalid: "+path);
String type = tok.nextToken();
- EntityPath thisEntity;
+ ItemPath thisEntity;
try {
- thisEntity = new EntityPath(sysKey.intValue());
- } catch (InvalidEntityPathException e) {
+ thisEntity = new ItemPath(sysKey.intValue());
+ } catch (InvalidItemPathException e) {
throw new ClusterStorageException("Invalid Syskey:"+sysKey);
}
@@ -146,7 +146,7 @@ public class LDAPClusterStorage extends ClusterStorage { String type = getClusterType(path);
try
{
- EntityPath thisEntity = new EntityPath(sysKey.intValue());
+ ItemPath thisEntity = new ItemPath(sysKey.intValue());
if (type.equals(PROPERTY))
return ldapStore.getPropertyNames(thisEntity);
else
@@ -160,7 +160,7 @@ public class LDAPClusterStorage extends ClusterStorage { }
else
throw new ClusterStorageException("Cluster type "+type+" not supported.");
- } catch (InvalidEntityPathException e) {
+ } catch (InvalidItemPathException e) {
throw new ClusterStorageException("Invalid Syskey:"+sysKey);
} catch (ObjectNotFoundException e) {
throw new ClusterStorageException("Entity "+sysKey+" does not exist");
diff --git a/src/main/java/com/c2kernel/persistency/ProxyLoader.java b/src/main/java/com/c2kernel/persistency/ProxyLoader.java index 4324e94..9c14df5 100644 --- a/src/main/java/com/c2kernel/persistency/ProxyLoader.java +++ b/src/main/java/com/c2kernel/persistency/ProxyLoader.java @@ -5,9 +5,9 @@ import java.util.StringTokenizer; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.AgentHelper;
import com.c2kernel.entity.C2KLocalObject;
+import com.c2kernel.entity.Item;
import com.c2kernel.entity.ItemHelper;
-import com.c2kernel.entity.ManageableEntity;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.LDAPLookup;
import com.c2kernel.persistency.outcome.Outcome;
import com.c2kernel.process.Gateway;
@@ -18,7 +18,7 @@ import com.c2kernel.utils.Logger; */
public class ProxyLoader extends ClusterStorage {
- HashMap<Integer, ManageableEntity> entities = new HashMap<Integer, ManageableEntity>();
+ HashMap<Integer, Item> entities = new HashMap<Integer, Item>();
LDAPLookup lookup;
@Override
@@ -49,7 +49,7 @@ public class ProxyLoader extends ClusterStorage { @Override
public C2KLocalObject get(Integer sysKey, String path) throws ClusterStorageException {
try {
- ManageableEntity thisEntity = getIOR(sysKey);
+ Item thisEntity = getIOR(sysKey);
String type = getClusterType(path);
// fetch the xml from the item
@@ -90,7 +90,7 @@ public class ProxyLoader extends ClusterStorage { @Override
public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
try {
- ManageableEntity thisEntity = getIOR(sysKey);
+ Item thisEntity = getIOR(sysKey);
String contents = thisEntity.queryData(path+"/all");
StringTokenizer tok = new StringTokenizer(contents, ",");
String[] result = new String[tok.countTokens()];
@@ -104,7 +104,7 @@ public class ProxyLoader extends ClusterStorage { }
}
- private ManageableEntity getIOR(Integer sysKey) throws ClusterStorageException {
+ private Item getIOR(Integer sysKey) throws ClusterStorageException {
if (entities.containsKey(sysKey)) {
// check the cache
Logger.msg(7, "ProxyLoader.getIOR() - "+sysKey+" cached.");
@@ -113,22 +113,22 @@ public class ProxyLoader extends ClusterStorage { try {
Logger.msg(7, "ProxyLoader.getIOR() - Resolving "+sysKey+".");
- org.omg.CORBA.Object ior = lookup.getIOR(new EntityPath(sysKey.intValue()));
+ org.omg.CORBA.Object ior = lookup.getIOR(new ItemPath(sysKey.intValue()));
- ManageableEntity thisEntity = null;
+ Item thisItem = null;
try {
- thisEntity = ItemHelper.narrow(ior);
+ thisItem = ItemHelper.narrow(ior);
} catch (org.omg.CORBA.BAD_PARAM ex) {
try {
- thisEntity = AgentHelper.narrow(ior);
+ thisItem = AgentHelper.narrow(ior);
} catch (org.omg.CORBA.BAD_PARAM ex2) {
throw new ClusterStorageException ("Could not narrow "+sysKey+" as a known Entity type");
}
}
Logger.msg(7, "ProxyLoader.getIOR() - Found "+sysKey+".");
- entities.put(sysKey, thisEntity);
- return thisEntity;
+ entities.put(sysKey, thisItem);
+ return thisItem;
} catch (Exception e) {
throw new ClusterStorageException("Error narrowing "+sysKey+": "+e.getMessage());
}
diff --git a/src/main/java/com/c2kernel/persistency/RemoteMap.java b/src/main/java/com/c2kernel/persistency/RemoteMap.java index b36648f..9f1d8a3 100644 --- a/src/main/java/com/c2kernel/persistency/RemoteMap.java +++ b/src/main/java/com/c2kernel/persistency/RemoteMap.java @@ -9,10 +9,10 @@ import java.util.TreeMap; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.entity.proxy.EntityProxy;
-import com.c2kernel.entity.proxy.EntityProxyObserver;
+import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.entity.proxy.MemberSubscription;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.entity.proxy.ProxyObserver;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
@@ -34,9 +34,9 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl private String mPath = "";
Object keyLock = null;
TransactionManager storage;
- EntityProxyObserver<V> listener;
+ ProxyObserver<V> listener;
Comparator<String> comp;
- EntityProxy source;
+ ItemProxy source;
Object mLocker; // if this remote map will participate in a transaction
public RemoteMap(int sysKey, String path, Object locker) {
@@ -68,7 +68,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl } catch (NumberFormatException e) {}
storage = Gateway.getStorage();
- listener = new EntityProxyObserver<V>() {
+ listener = new ProxyObserver<V>() {
@Override
public void add(V obj) {
synchronized (this) {
@@ -88,7 +88,7 @@ public class RemoteMap<V extends C2KLocalObject> extends TreeMap<String, V> impl };
try {
- source = Gateway.getProxyManager().getProxy(new EntityPath(sysKey));
+ source = Gateway.getProxyManager().getProxy(new ItemPath(sysKey));
source.subscribe(new MemberSubscription<V>(listener, path, false));
} catch (Exception ex) {
Logger.error("Error subscribing to remote map. Changes will not be received");
diff --git a/src/main/java/com/c2kernel/persistency/XMLClusterStorage.java b/src/main/java/com/c2kernel/persistency/XMLClusterStorage.java index f63dac6..50c76f0 100644 --- a/src/main/java/com/c2kernel/persistency/XMLClusterStorage.java +++ b/src/main/java/com/c2kernel/persistency/XMLClusterStorage.java @@ -3,8 +3,8 @@ import java.io.File; import java.util.ArrayList;
import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
+import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.persistency.outcome.Outcome;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.FileStringUtility;
@@ -145,8 +145,8 @@ public class XMLClusterStorage extends ClusterStorage { }
}
- protected String getFilePath(Integer sysKey, String path) throws InvalidEntityPathException {
- EntityPath thisEntity = new EntityPath(sysKey.intValue());
+ protected String getFilePath(Integer sysKey, String path) throws InvalidItemPathException {
+ ItemPath thisEntity = new ItemPath(sysKey.intValue());
if (path.length() == 0 || path.charAt(0) != '/') path = "/"+path;
String filePath = rootDir+thisEntity.toString()+path;
Logger.msg(8, "XMLClusterStorage.getFilePath() - "+filePath);
diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index 601db31..e2ad24e 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -10,7 +10,6 @@ import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit;
import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.TraceableEntity;
import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.events.Event;
import com.c2kernel.events.History;
@@ -22,7 +21,7 @@ import com.c2kernel.lifecycle.instance.predefined.ServerPredefinedStepContainer; import com.c2kernel.lifecycle.instance.stateMachine.Transition;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.LDAPLookup;
import com.c2kernel.lookup.Path;
import com.c2kernel.lookup.RolePath;
@@ -128,7 +127,7 @@ public class Bootstrap }
else {
DomainPath path = (DomainPath)en.nextElement();
- thisProxy = (ItemProxy)Gateway.getProxyManager().getProxy(path);
+ thisProxy = Gateway.getProxyManager().getProxy(path);
// Verify module property and location
@@ -150,7 +149,7 @@ public class Bootstrap if (!modDomPath.equals(path)) { // move item to module subtree
Logger.msg("Module item "+itemName+" found with path "+path.toString()+". Moving to "+modDomPath.toString());
- modDomPath.setEntity(new EntityPath(thisProxy.getSystemKey()));
+ modDomPath.setEntity(new ItemPath(thisProxy.getSystemKey()));
if (!modDomPath.exists())
Gateway.getLDAPLookup().add(modDomPath);
Gateway.getLDAPLookup().delete(path);
@@ -247,17 +246,15 @@ public class Bootstrap }
- EntityPath entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey();
- TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entityPath);
+ ItemPath entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey();
+ Gateway.getCorbaServer().createEntity(entityPath);
Gateway.getLDAPLookup().add(entityPath);
- newItem.initialise(
- 1,
- Gateway.getMarshaller().marshall(props),
- Gateway.getMarshaller().marshall(ca));
DomainPath newDomPath = impHandler.getPath(itemName, ns);
newDomPath.setEntity(entityPath);
Gateway.getLDAPLookup().add(newDomPath);
- return (ItemProxy)Gateway.getProxyManager().getProxy(entityPath);
+ ItemProxy newItemProxy = Gateway.getProxyManager().getProxy(entityPath);
+ newItemProxy.initialise( 1, props, ca, null);
+ return newItemProxy;
}
/**************************************************************************
@@ -281,7 +278,7 @@ public class Bootstrap }
try {
- EntityPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
+ ItemPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
AgentPath agentPath = new AgentPath(entityPath.getSysKey(), name);
agentPath.setPassword(pass);
Gateway.getCorbaServer().createEntity(agentPath);
@@ -318,7 +315,7 @@ public class Bootstrap public static void createServerItem() throws Exception {
String serverName = Gateway.getProperties().getProperty("ItemServer.name");
thisServerPath = new DomainPath("/servers/"+serverName);
- EntityPath serverEntity;
+ ItemPath serverEntity;
try {
serverEntity = thisServerPath.getEntity();
} catch (ObjectNotFoundException ex) {
diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index ea49ded..6c7b68d 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -13,7 +13,7 @@ import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.CorbaServer;
import com.c2kernel.entity.proxy.AgentProxy;
-import com.c2kernel.entity.proxy.EntityProxyManager;
+import com.c2kernel.entity.proxy.ProxyManager;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.LDAPLookup;
import com.c2kernel.lookup.LDAPProperties;
@@ -57,7 +57,7 @@ public class Gateway static private boolean orbDestroyed = false;
static private LDAPLookup mLDAPLookup;
static private TransactionManager mStorage;
- static private EntityProxyManager mProxyManager;
+ static private ProxyManager mProxyManager;
static private CorbaServer mCorbaServer;
static private CastorXMLUtility mMarshaller;
static private AgentProxy mCurrentUser = null;
@@ -151,7 +151,7 @@ public class Gateway mLDAPLookup.install();
// start entity proxy server
- EntityProxyManager.initServer();
+ ProxyManager.initServer();
// Init ORB - set various config
String serverName = getProperty("ItemServer.name");
@@ -329,7 +329,7 @@ public class Gateway // Init storages
mStorage = new TransactionManager();
- mProxyManager = new EntityProxyManager();
+ mProxyManager = new ProxyManager();
}
@@ -360,7 +360,7 @@ public class Gateway if (mProxyManager != null)
mProxyManager.shutdown();
mProxyManager = null;
- EntityProxyManager.shutdownServer();
+ ProxyManager.shutdownServer();
// close log consoles
Logger.closeConsole();
@@ -405,7 +405,7 @@ public class Gateway return mResource;
}
- static public EntityProxyManager getProxyManager()
+ static public ProxyManager getProxyManager()
{
return mProxyManager;
}
diff --git a/src/main/java/com/c2kernel/process/UserCodeProcess.java b/src/main/java/com/c2kernel/process/UserCodeProcess.java index f7bbe74..47742aa 100644 --- a/src/main/java/com/c2kernel/process/UserCodeProcess.java +++ b/src/main/java/com/c2kernel/process/UserCodeProcess.java @@ -9,7 +9,7 @@ import com.c2kernel.common.InvalidTransitionException; import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.entity.proxy.AgentProxy;
-import com.c2kernel.entity.proxy.EntityProxyObserver;
+import com.c2kernel.entity.proxy.ProxyObserver;
import com.c2kernel.entity.proxy.MemberSubscription;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.scripting.ErrorInfo;
@@ -24,7 +24,7 @@ import com.c2kernel.utils.Logger; * Copyright (C) 2003 CERN - European Organization for Nuclear Research
* All rights reserved.
**************************************************************************/
-public class UserCodeProcess extends StandardClient implements EntityProxyObserver<Job>, Runnable {
+public class UserCodeProcess extends StandardClient implements ProxyObserver<Job>, Runnable {
// Default state machine transitions
private static final int START = 1;
diff --git a/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java b/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java index d5382da..4322ef4 100644 --- a/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java +++ b/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java @@ -5,7 +5,7 @@ package com.c2kernel.utils; import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.proxy.EntityProxyObserver;
+import com.c2kernel.entity.proxy.ProxyObserver;
import com.c2kernel.entity.proxy.ItemProxy;
import com.c2kernel.entity.proxy.MemberSubscription;
import com.c2kernel.persistency.ClusterStorage;
@@ -46,7 +46,7 @@ public abstract class DescriptionObjectCache<D extends DescriptionObject> { }
}
- public class CacheEntry<E extends DescriptionObject> implements EntityProxyObserver<Viewpoint> {
+ public class CacheEntry<E extends DescriptionObject> implements ProxyObserver<Viewpoint> {
public String id;
public ItemProxy proxy;
public E def;
diff --git a/src/main/resources/mapFiles/CollectionMap.xml b/src/main/resources/mapFiles/CollectionMap.xml index 804022b..ff6a61b 100644 --- a/src/main/resources/mapFiles/CollectionMap.xml +++ b/src/main/resources/mapFiles/CollectionMap.xml @@ -15,12 +15,12 @@ <field name="ID" type="integer" direct="false">
<bind-xml name="ID" node="attribute"/>
</field>
- <field name="mEntityKey"
+ <field name="mSystemKey"
type="integer"
direct="false"
- get-method="getEntityKey"
- set-method="setEntityKey">
- <bind-xml name="EntityKey" node="attribute"/>
+ get-method="getSystemKey"
+ set-method="setSystemKey">
+ <bind-xml name="SystemKey" node="attribute"/>
</field>
<field name="mProperties"
type="com.c2kernel.utils.KeyValuePair"
@@ -36,12 +36,12 @@ <class name="com.c2kernel.collection.AggregationMember"
extends="com.c2kernel.graph.model.GraphableVertex">
<map-to xml="AggregationMember"/>
- <field name="mEntityKey"
+ <field name="mSystemKey"
type="integer"
direct="false"
- get-method="getEntityKey"
- set-method="setEntityKey">
- <bind-xml name="EntityKey" node="attribute"/>
+ get-method="getSystemKey"
+ set-method="setSystemKey">
+ <bind-xml name="SystemKey" node="attribute"/>
</field>
<field name="mClassProps"
type="string"
diff --git a/src/test/java/LauncherTest.java b/src/test/java/LauncherTest.java index a3217b1..4c772d1 100644 --- a/src/test/java/LauncherTest.java +++ b/src/test/java/LauncherTest.java @@ -18,7 +18,7 @@ public class LauncherTest { args[0] = "-logLevel";
args[1] = "0";
args[2] = "-logFile";
- args[3] = "log.txt";
+ args[3] = "target/testlog.txt";
args[4] = "-config";
args[5] = LauncherTest.class.getResource("server.conf").getPath();
args[6] = "-connect";
|
