summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/instance/predefined/entitycreation
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/lifecycle/instance/predefined/entitycreation')
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java25
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java21
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java49
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java46
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java44
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java18
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java29
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java63
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java141
-rw-r--r--source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java26
10 files changed, 0 insertions, 462 deletions
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java
deleted file mode 100644
index 2de12e0..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.util.ArrayList;
-
-public class Aggregation implements java.io.Serializable {
-
- public boolean isDescription;
- public ArrayList<AggregationMember> aggregationMemberList;
- public String name;
-
- public Aggregation() {
- super();
- aggregationMemberList = new ArrayList<AggregationMember>();
- }
-
- public Aggregation(String name, boolean isDescription) {
- this();
- this.name = name;
- this.isDescription = isDescription;
- }
-
- public com.c2kernel.collection.Aggregation create() {
- return new com.c2kernel.collection.AggregationInstance();
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java
deleted file mode 100644
index 29d3cf9..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-public class AggregationMember implements java.io.Serializable {
-
- public int slotNo;
- public String itemDescriptionPath;
- public String itemPath;
- public Geometry geometry;
-
-
- public AggregationMember() {
- super();
- }
-
- public AggregationMember(int slotNo, String itemDescPath, String itemPath, Geometry geometry) {
- this.slotNo = slotNo;
- this.itemDescriptionPath = itemDescPath;
- this.itemPath = itemPath;
- this.geometry = geometry;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java
deleted file mode 100644
index aa30677..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewAgent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class CreateNewAgent extends PredefinedStep
-{
- public CreateNewAgent()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- checkAccessRights(agent);
- String redactedRequestData;
- try {
- NewAgent newAgent = (NewAgent)CastorXMLUtility.unmarshall(requestData);
- newAgent.create(agent.getSysKey());
- newAgent.password = "REDACTED";
- redactedRequestData = CastorXMLUtility.marshall(newAgent);
- } catch (Exception ex) {
- Logger.error(ex);
- throw new InvalidDataException("Error creating agent", "");
- }
-
- sendEventStoreOutcome(transitionID, redactedRequestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java
deleted file mode 100644
index a66b062..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/CreateNewItem.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
- * CreateNewItem
- *
- * Copyright (C) 2005 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class CreateNewItem extends PredefinedStep
-{
- public CreateNewItem()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- checkAccessRights(agent);
-
- try {
- NewItem item = (NewItem)CastorXMLUtility.unmarshall(requestData);
- item.create(agent.getSysKey());
- } catch (Exception ex) {
- Logger.error(ex);
- throw new InvalidDataException("Error creating item", "");
- }
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java
deleted file mode 100644
index 1124ede..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Dependency.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.util.ArrayList;
-
-import com.c2kernel.collection.MembershipException;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.property.PropertyUtility;
-
-public class Dependency implements java.io.Serializable {
-
- public String name;
- public boolean isDescription;
- public String itemDescriptionPath;
- public ArrayList<DependencyMember> dependencyMemberList;
-
- public Dependency() {
- super();
- dependencyMemberList = new ArrayList<DependencyMember>();
- }
-
- public Dependency(String itemDesc) {
- this();
- this.itemDescriptionPath = itemDesc;
- }
-
- /**
- * @return
- */
- public com.c2kernel.collection.Dependency create() throws MembershipException{
- com.c2kernel.collection.Dependency newDep = isDescription?new com.c2kernel.collection.DependencyDescription(name):new com.c2kernel.collection.Dependency(name);
- if (itemDescriptionPath != null && itemDescriptionPath.length()>0) {
- PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(itemDescriptionPath).getSysKey());
- //TODO: set props and class identifiers
- }
- for (DependencyMember thisMem : dependencyMemberList) {
- int syskey = new DomainPath(thisMem.itemPath).getSysKey();
- if (syskey == -1)
- throw new MembershipException("Cannot find "+thisMem.itemPath+" specified for collection.");
- newDep.addMember(syskey);
- }
- return newDep;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java
deleted file mode 100644
index b70619f..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/DependencyMember.java
+++ /dev/null
@@ -1,18 +0,0 @@
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-public class DependencyMember implements java.io.Serializable {
-
-
- public String itemPath;
-
- public DependencyMember() {
- super();
- }
-
- public DependencyMember(String itemPath) {
- this.itemPath = itemPath;
-
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java
deleted file mode 100644
index f18b6d4..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Geometry.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-
-public class Geometry implements java.io.Serializable {
-
-
- public int x;
-
- public int y;
-
- public int width;
-
- public int height;
-
- public Geometry() {
- super();
- }
-
- public Geometry(int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java
deleted file mode 100644
index 540a6fc..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-
-import com.c2kernel.common.CannotManageException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.agent.ActiveEntity;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.RolePath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.PropertyArrayList;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class NewAgent implements java.io.Serializable {
-
- public String name;
-
- public String password;
-
- public ArrayList<String> roles;
-
- public NewAgent() {
- super();
- roles = new ArrayList<String>();
- }
-
- public NewAgent(String name, String password) {
- this.name = name;
- this.password = password;
- }
-
- protected void create(int agentId) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException, CannotManageException, ObjectAlreadyExistsException {
- AgentPath newAgent = Gateway.getLDAPLookup().getNextKeyManager().generateNextAgentKey();
- newAgent.setAgentName(name);
- newAgent.setPassword(password);
- ActiveEntity newAgentEnt = (ActiveEntity)Gateway.getCorbaServer().createEntity(newAgent);
- Gateway.getLDAPLookup().add(newAgent);
- // assemble properties
- PropertyArrayList propList = new PropertyArrayList();
- propList.list.add(new com.c2kernel.property.Property("Name", name));
- propList.list.add(new com.c2kernel.property.Property("Type", "Agent"));
- try {
- newAgentEnt.initialise(CastorXMLUtility.marshall(propList));
- } catch (Exception ex) {
- Logger.error(ex);
- throw new CannotManageException("Error initialising new agent");
- }
- for (String role : roles) {
- RolePath thisRole;
- try {
- thisRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(role);
- } catch (ObjectNotFoundException ex) {
- thisRole = Gateway.getLDAPLookup().getRoleManager().createRole(role, false);
- }
- thisRole.addAgent(newAgent);
- }
-
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
deleted file mode 100644
index f155ced..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-
-import java.util.ArrayList;
-
-import com.c2kernel.collection.MembershipException;
-import com.c2kernel.common.CannotManageException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.TraceableEntity;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.persistency.ClusterStorageException;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.PropertyArrayList;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.LocalObjectLoader;
-import com.c2kernel.utils.Logger;
-
-/**
- * Complete Structure for new item
- *
- * @version $Revision: 1.8 $ $Date: 2006/03/03 13:52:21 $
- */
-
-public class NewItem {
-
- public String name;
-
- /**
- * The initial Domain Path to be created for this Item.
- */
- public String initialPath;
-
- /**
- * The name of the Composite Activity Definition to be
- * instantiated for the workflow of this Item
- */
- public String workflow;
-
- /**
- * New Properties for the item
- */
- public ArrayList<Property> propertyList;
-
- /**
- * Field _aggregationList
- */
- public ArrayList<Aggregation> aggregationList;
-
- /**
- * Field _dependencyList
- */
- public ArrayList<Dependency> dependencyList;
-
-
- public NewItem() {
- super();
- propertyList = new ArrayList<Property>();
- aggregationList = new ArrayList<Aggregation>();
- dependencyList = new ArrayList<Dependency>();
- }
-
- public NewItem(String name, String initialPath, String wf) {
- this();
- this.name = name;
- this.initialPath = initialPath;
- this.workflow = wf;
- }
-
- public void setProperty(String name, String value) {
- for (Property prop : propertyList) {
- if (prop.name.equals(name)) {
- prop.value = value;
- return;
- }
- }
- propertyList.add(new Property(name, value));
- }
-
- protected void create(int agentId) throws ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException {
- DomainPath domPath = new DomainPath(new DomainPath(initialPath), name);
- if (domPath.exists())
- throw new ObjectAlreadyExistsException(domPath+" already exists!", "");
-
- // create item
- EntityPath entPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey();
- TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entPath);
- Gateway.getLDAPLookup().add(entPath);
-
- // assemble properties
- PropertyArrayList propList = new PropertyArrayList();
- propList.list.add(new com.c2kernel.property.Property("Name", name));
- for (Property element : propertyList) {
- propList.list.add(new com.c2kernel.property.Property(element.name, element.value));
- }
- // init the new item
- try {
-
- // find workflow def
- CompositeActivityDef compact = (CompositeActivityDef)LocalObjectLoader.getActDef(workflow, "last");
-
- newItem.initialise(
- agentId,
- CastorXMLUtility.marshall(propList),
- CastorXMLUtility.marshall(compact.instantiate()));
- } catch (Exception ex) {
- Logger.error("Error initialising new item");
- Logger.error(ex);
- throw new CannotManageException("Problem initialising new item. See server log.", "");
- }
-
- // create collections
-
- for (Dependency element: dependencyList) {
- try {
- 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 {
- Gateway.getStorage().put(entPath.getSysKey(), element.create(), null);
- } catch (ClusterStorageException ex) {
- Logger.error(ex);
- throw new CannotManageException("Could not create Aggregation "+element.name, "");
- }
- }
- // register domain path
- domPath.setEntity(entPath);
- Gateway.getLDAPLookup().add(domPath);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java
deleted file mode 100644
index e2d214c..0000000
--- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Property.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-/**
- * New Properties for the item
- *
- * @version $Revision: 1.1 $ $Date: 2005/04/28 13:48:26 $
- */
-public class Property implements java.io.Serializable {
-
- public String name;
- public String value;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Property() {
- super();
- }
-
- public Property(String name, String value) {
- super();
- this.name = name;
- this.value = value;
- }
-}