diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-05-30 08:37:45 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-05-30 08:37:45 +0200 |
| commit | b086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch) | |
| tree | 8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/lifecycle/instance/predefined | |
| parent | 22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff) | |
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/lifecycle/instance/predefined')
24 files changed, 0 insertions, 1629 deletions
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java b/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java deleted file mode 100644 index b61187c..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************
- * AddC2KObject
- *
- * $Workfile$
- * $Revision: 1.31 $
- * $Date: 2004/10/21 08:02:19 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.entity.C2KLocalObject;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/21 08:02:19 $
- * @version $Revision: 1.31 $
- **************************************************************************/
-public class AddC2KObject extends PredefinedStep
-{
- /**************************************************************************
- * Constructor for Castror
- **************************************************************************/
- public AddC2KObject()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
-
- Logger.msg(1, "AddC2KObject::request() - Starting.");
-
- checkAccessRights(agent);
- EntityPath entityPath = getItemEntityPath();
-
- if (entityPath!=null)
- {
- try
- {
-
- Logger.msg(5, "AddC2KObject::request() - data:" + getDataList(requestData)[0]);
-
- C2KLocalObject obj = (C2KLocalObject)CastorXMLUtility.unmarshall(getDataList(requestData)[0]);
- Gateway.getStorage().put(entityPath.getSysKey(), obj, null );
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch( Exception ex )
- {
- Logger.error("AddC2KObject::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "AddC2KObject::request() - DONE.");
- }
- else
- throw new InvalidDataException("EntityPath is null.", "");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java b/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java deleted file mode 100644 index 2cf619e..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
-import com.c2kernel.lookup.LDAPLookup;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-public class AddDomainPath extends PredefinedStep
-{
- public AddDomainPath()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(8,"AddAlias::request()");
- LDAPLookup lookupManager = Gateway.getLDAPLookup();
-
- Logger.msg(1,"AddAlias::request() - Starting.");
-
- checkAccessRights(agent);
-
- try
- {
- EntityPath entityPath = getItemEntityPath();
- DomainPath domainPath = new DomainPath(getDataList(requestData)[0], entityPath);
- lookupManager.add(domainPath);
- Logger.msg(8,"AddDomainPath::request() - systemKey:" + entityPath.getSysKey() +
- ". Adding dompath. DONE.");
- }
- catch (InvalidEntityPathException ex)
- {
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
- catch( Exception ex )
- {
- Logger.error("AddDomainPath::request() - during anyHelper.extract.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java deleted file mode 100644 index f70c053..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/AddStepsFromDescription.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.c2kernel.lifecycle.instance.predefined;
-
-//Java
-import java.awt.Point;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class AddStepsFromDescription extends PredefinedStep
-{
- public AddStepsFromDescription()
- {
- super();
- }
-
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException, InvalidTransitionException, InvalidDataException
- {
- Workflow lifeCycle = getWf();
-
- Logger.msg(1, "AddStepsFromDescription::request() - Starting ");
-
- checkAccessRights(agent);
-
- try
- {
-
- Logger.msg(8, "AddStepsFromDescription::request() - data:" + getDataList(requestData)[0]);
- lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain"));
- CompositeActivityDef actDef = (CompositeActivityDef) CastorXMLUtility.unmarshall(getDataList(requestData)[0]);
- CompositeActivity domain = (CompositeActivity)actDef.instantiate();
- lifeCycle.initChild(domain, true, new Point(150, 100));
- domain.setName("domain");
- domain.setType(actDef.getName());
- lifeCycle.run(agent);
- Gateway.getStorage().put(getItemEntityPath().getSysKey(), lifeCycle, null);
- Logger.msg(1, "AddStepsFromDescription::request() - DONE.");
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch (Exception ex)
- {
- Logger.error("AddStepsFromDescription::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException("AddStepsFromDescription::request() - during unmarshall.", "");
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java b/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java deleted file mode 100644 index 0ad5adc..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************
- * AssignItemToSlot
- *
- * $Workfile$
- * $Revision: 1.8 $
- * $Date: 2004/10/21 08:02:19 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.CollectionMember;
-import com.c2kernel.collection.MembershipException;
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.ClusterStorageException;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/21 08:02:19 $
- * @version $Revision: 1.8 $
- **************************************************************************/
-public class AssignItemToSlot extends PredefinedStep
-{
- /**************************************************************************
- * Constructor for Castor
- **************************************************************************/
- public AssignItemToSlot()
- {
- super();
- }
-
-
- /**
- * Params:
- * 0 - collection name
- * 1 - slot number
- * 2 - target entity key
- */
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- EntityPath entityPath = getItemEntityPath();
- String collName;
- int slotNo;
- int entityKey;
- Collection<? extends CollectionMember> coll;
-
- Logger.msg(1, "AssignItemToSlot::request() - Starting.");
-
- checkAccessRights(agent);
-
- // extract parameters
- try {
- entityPath = getItemEntityPath();
- String[] params = getDataList(requestData);
- collName = params[0];
- slotNo = Integer.parseInt(params[1]);
- entityKey = Integer.parseInt(params[2]);
- } catch (Exception e) {
- throw new InvalidDataException("Invalid parameters", "");
- }
-
- // load collection
- try {
- coll = (Collection<? extends CollectionMember>)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null);
- } catch (Exception e) {
- Logger.error(e);
- throw new InvalidDataException("Error loading collection "+collName, "");
- }
-
- // find member and assign entity
- boolean stored = false;
- for (Object name : coll.getMembers().list) {
- CollectionMember member = (CollectionMember)name;
- if (member.getID() == slotNo) {
- if (member.getEntityKey() > -1)
- throw new InvalidDataException("Member slot not empty", "");
- try {
- member.assignEntity(entityKey);
- } catch (MembershipException e) {
- throw new InvalidDataException("Entity "+entityKey+" does not fit in this slot", "");
- }
- stored = true;
- break;
- }
- }
- if (!stored) {
- throw new InvalidDataException("Member slot "+slotNo+" not found.", "");
- }
-
-
- try {
- Gateway.getStorage().put(entityPath.getSysKey(), coll, null);
- } catch (ClusterStorageException e) {
- Logger.error(e);
- throw new InvalidDataException("Error storing collection", "");
- }
- sendEventStoreOutcome(transitionID, requestData, agent);
-
- Logger.msg(1, "AssignItemToSlot::request() - DONE.");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java deleted file mode 100644 index 8c55f3a..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************
- * CreateItemFromDescription
- *
- * $Workfile$
- * $Revision: 1.47 $
- * $Date: 2005/10/13 08:13:58 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.CollectionDescription;
-import com.c2kernel.collection.CollectionMember;
-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.entity.CorbaServer;
-import com.c2kernel.entity.TraceableEntity;
-import com.c2kernel.lifecycle.CompositeActivityDef;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.LDAPLookup;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.TransactionManager;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.Property;
-import com.c2kernel.property.PropertyArrayList;
-import com.c2kernel.property.PropertyDescriptionList;
-import com.c2kernel.property.PropertyUtility;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.LocalObjectLoader;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2005/10/13 08:13:58 $
- * @version $Revision: 1.47 $
- **************************************************************************/
-public class CreateItemFromDescription extends PredefinedStep
-{
- public CreateItemFromDescription()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException, InvalidTransitionException, InvalidDataException,ObjectAlreadyExistsException
- {
- String[] input = getDataList(requestData);
- String newName = input[0];
- String domPath = input[1];
- CompositeActivityDef wfDef;
- String wfDefName = null;
- if (input.length > 2) // override wf
- wfDefName = input[2];
-
- PropertyArrayList props = new PropertyArrayList();
- Logger.msg(1, "AddNewItem::request() - Starting.");
- TransactionManager storage = Gateway.getStorage();
- LDAPLookup lookup = Gateway.getLDAPLookup();
- EntityPath myPath = getItemEntityPath();
- checkAccessRights(agent);
-
- try {
- // check if the path is already taken
- DomainPath context = new DomainPath(new DomainPath(domPath), newName);
- Logger.debug(8,"context "+context.getSysKey()+" "+context.getPath()+" "+context.getString());
- if (context.getSysKey()!=-1)
- throw new ObjectAlreadyExistsException("The item name " +newName+ " exists already.");
-
- // get init objects
- String[] collNames = storage.getClusterContents(myPath.getSysKey(), ClusterStorage.COLLECTION);
- ArrayList<String> collections = new ArrayList<String>();
-
-
- // loop through collections to instantiate
- for (String collName : collNames) {
- Collection<? extends CollectionMember> thisCol = (Collection<? extends CollectionMember>)storage.get(myPath.getSysKey(), ClusterStorage.COLLECTION+"/"+collName, null);
- if (thisCol instanceof CollectionDescription) {
- CollectionDescription<? extends CollectionMember> thisDesc = (CollectionDescription<? extends CollectionMember>)thisCol;
- collections.add(CastorXMLUtility.marshall(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();
- }
- }
-
- // load workflow def
- if (wfDefName == null)
- throw new InvalidDataException("No workflow given or defined", "");
-
- try {
- wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, "last");
- } catch (ObjectNotFoundException ex) {
- throw new InvalidDataException("Workflow def '"+wfDefName+"' item not found", "");
- } catch (ClassCastException ex) {
- throw new InvalidDataException("Activity def '"+wfDefName+"' was not Composite", "");
- }
-
-
- // copy properties -- intend to create from propdesc
- PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(myPath.getSysKey());
- props = pdList.instanciate();
- // set Name prop or create if not present
- boolean foundName = false;
- for (Property prop : props.list) {
- if (prop.getName().equals("Name")) {
- foundName = true;
- prop.setValue(newName);
- }
- }
- if (!foundName) props.list.add(new Property("Name", newName));
- props.list.add( new Property("Creator", agent.getAgentName()));
-
- /* ITEM CREATION */
-
- // generate new entity key
- Logger.msg(6, "CreateItemFromDescription - Requesting new sysKey");
- EntityPath entityPath = lookup.getNextKeyManager().generateNextEntityKey();
-
- // resolve the item factory
- Logger.msg(6, "CreateItemFromDescription - Resolving item factory");
-
- // create the Item object
- Logger.msg(3, "CreateItemFromDescription - Creating Item");
- CorbaServer factory = Gateway.getCorbaServer();
- if (factory == null) throw new AccessRightsException("This process cannot create new Items", "");
- TraceableEntity newItem = (TraceableEntity)factory.createEntity(entityPath);
- Gateway.getLDAPLookup().add(entityPath);
-
-
- // initialise it with its properties and workflow
-
- Logger.msg(3, "CreateItemFromDescription - Initializing Item");
-
- newItem.initialise(
- agent.getSysKey(),
- CastorXMLUtility.marshall(props),
- CastorXMLUtility.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();
- newItem.requestAction(agent.getSysKey(), "workflow/predefined/AddC2KObject", Transitions.COMPLETE, PredefinedStep.bundleData(colls));
- }
- }
-
- // add its domain path
- Logger.msg(3, "CreateItemFromDescription - Creating "+context);
- context.setEntity(entityPath);
- Gateway.getLDAPLookup().add(context);
- } catch (ObjectAlreadyExistsException e) {
- Logger.error(e);
- throw e;
- } catch (AccessRightsException e) {
- Logger.error(e);
- throw e;
- } catch (Exception e) {
- Logger.error(e);
- throw new InvalidDataException(e.getMessage(), "");
- }
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/Erase.java b/source/com/c2kernel/lifecycle/instance/predefined/Erase.java deleted file mode 100644 index ffdb07c..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/Erase.java +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************
- * RemoveC2KObject
- *
- * $Workfile$
- * $Revision: 1.10 $
- * $Date: 2005/11/15 15:56:38 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-import java.util.Enumeration;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.Path;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.Property;
-import com.c2kernel.utils.Logger;
-
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2005/11/15 15:56:38 $
- * @version $Revision: 1.10 $
- **************************************************************************/
-public class Erase extends PredefinedStep
-{
- public Erase()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(1, "Erase::request() - Starting.");
-
- checkAccessRights(agent);
- try
- {
- EntityPath entityPath = getItemEntityPath();
-
- // find entity name
- Property name = (Property)Gateway.getStorage().get(entityPath.getSysKey(), ClusterStorage.PROPERTY+"/Name", null);
-
- // get all domain paths
- Enumeration<Path> domPaths = Gateway.getLDAPLookup().search(new DomainPath(), name.getValue());
- while (domPaths.hasMoreElements()) {
- DomainPath path = (DomainPath)domPaths.nextElement();
- // delete them
- if (path.getSysKey() == entityPath.getSysKey())
- Gateway.getLDAPLookup().delete(path);
- }
-
- //clear out all storages
- Gateway.getStorage().removeCluster(entityPath.getSysKey(), "", null);
-
- //remove domain path
- Gateway.getLDAPLookup().delete(entityPath);
- }
- catch( Exception ex )
- {
-
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "Erase::request() - DONE.");
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/Import.java b/source/com/c2kernel/lifecycle/instance/predefined/Import.java deleted file mode 100644 index 2f99937..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/Import.java +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * $Revision: 1.21 $
- * $Date: 2005/06/02 12:17:22 $
- *
- * Params: Schemaname_version:Viewpoint (optional), Outcome
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-public class Import extends PredefinedStep
-{
- public Import()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(8,"Import::request()");
-
- Logger.msg(1,"Import::request() - Starting.");
-
- checkAccessRights(agent);
-
- String[] params = getDataList(requestData);
-
-
- int split1 = params[0].indexOf('_');
- int split2 = params[0].indexOf(':');
-
- String schemaName = params[0].substring(0, split1);
- String viewpoint = "last";
- int schemaVersion;
- if (split2 > -1) {
- schemaVersion = Integer.parseInt(params[0].substring(split1+1, split2));
- viewpoint = params[0].substring(split2+1);
- }
- else
- schemaVersion = Integer.parseInt(params[0].substring(split1+1));
-
- // set type & ver
- getProperties().put("SchemaType", schemaName);
- getProperties().put("SchemaVersion", String.valueOf(schemaVersion));
- getProperties().put("Viewpoint", viewpoint);
-
- requestData = params[1];
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java deleted file mode 100644 index 8aec993..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStep.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.c2kernel.lifecycle.instance.predefined;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.xml.serialize.Method;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.InputSource;
-
-import com.c2kernel.lifecycle.instance.Activity;
-import com.c2kernel.utils.Logger;
-/***********************************************************************************************************************************************************************************************************************************************************************************************************
- * @author $Author: sgaspard $ $Date: 2004/09/21 10:32:17 $
- * @version $Revision: 1.14 $
- **********************************************************************************************************************************************************************************************************************************************************************************************************/
-public class PredefinedStep extends Activity
-{
- /*******************************************************************************************************************************************************************************************************************************************************************************************************
- * predefined Steps are always Active, and have only one transition subclasses could override this method (if necessary)
- ******************************************************************************************************************************************************************************************************************************************************************************************************/
- private boolean isPredefined = false;
- @Override
- public boolean getActive()
- {
- if (isPredefined)
- return true;
- else
- return super.getActive();
- }
- @Override
- public String getTransitions()
- {
- if (isPredefined)
- return "<PossibleTransitions>done</PossibleTransitions>";
- else
- return super.getTransitions();
- }
- @Override
- public String getErrors()
- {
- if (isPredefined)
- return getName();
- else
- return super.getErrors();
- }
- @Override
- public boolean verify()
- {
- if (isPredefined)
- return true;
- else
- return super.verify();
- }
- /**
- * Returns the isPredefined.
- *
- * @return boolean
- */
- public boolean getIsPredefined()
- {
- return isPredefined;
- }
- /**
- * Sets the isPredefined.
- *
- * @param isPredefined
- * The isPredefined to set
- */
- public void setIsPredefined(boolean isPredefined)
- {
- this.isPredefined = isPredefined;
- }
- @Override
- public String getType()
- {
- return getName();
- }
- // generic bundling of parameters
- static public String bundleData(String[] data)
- {
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document dom = builder.newDocument();
- Element root = dom.createElement("PredefinedStepOutcome");
- dom.appendChild(root);
- for (String element : data) {
- Element param = dom.createElement("param");
- Text t = dom.createTextNode(element);
- param.appendChild(t);
- root.appendChild(param);
- }
- // xalan method - use internal xerces one instead
-// TransformerFactory transFactory = TransformerFactory.newInstance();
-// Transformer transformer = transFactory.newTransformer();
-// StringWriter stringOut = new StringWriter();
-// transformer.transform(new DOMSource(dom), new StreamResult(stringOut));
-// return stringOut.toString();
-
- OutputFormat format = new OutputFormat(Method.XML, null, false);
- StringWriter stringOut = new StringWriter();
- XMLSerializer serial = new XMLSerializer(stringOut, format);
- serial.asDOMSerializer();
- serial.serialize(dom);
- return stringOut.toString();
- }
- catch (Exception e)
- {
- Logger.error(e);
- StringBuffer xmlData = new StringBuffer().append("<PredefinedStepOutcome>");
- for (String element : data)
- xmlData.append("<param><![CDATA[").append(element).append("]]></param>");
- xmlData.append("</PredefinedStepOutcome>");
- return xmlData.toString();
- }
- }
- // generic bundling of single parameter
- static public String bundleData(String data)
- {
- return "<PredefinedStepOutcome><param><![CDATA[" + data + "]]></param></PredefinedStepOutcome>";
- }
- static public String[] getDataList(String xmlData)
- {
- try
- {
- Document scriptDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xmlData)));
- NodeList nodeList = scriptDoc.getElementsByTagName("param");
- String[] result = new String[nodeList.getLength()];
- for (int i = 0; i < nodeList.getLength(); i++)
- {
- Node n = nodeList.item(i).getFirstChild();
- if (n instanceof CDATASection)
- result[i] = ((CDATASection) n).getData();
- else if (n instanceof Text)
- result[i] = ((Text) n).getData();
- }
- return result;
- }
- catch (Exception ex)
- {
- Logger.error("Exception::PredefinedStep::getDataList()");
- Logger.error(ex);
- }
- return null;
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java b/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java deleted file mode 100644 index d065afb..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/PredefinedStepContainer.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.c2kernel.lifecycle.instance.predefined;
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-public class PredefinedStepContainer extends CompositeActivity
-{
- protected int num = 0;
-
- public PredefinedStepContainer()
- {
- super();
- setName("predefined");
- getProperties().put("Description", "Contains all predefined Steps");
- createChildren();
- }
- public void createChildren()
- {
- predInit("CreateItemFromDescription", "Create a new item using this item as its description", new CreateItemFromDescription());
- predInit("AddDomainPath", "Adds a new path to this entity in the LDAP domain tree", new AddDomainPath());
- predInit("RemoveDomainPath", "Removes an existing path to this Entity from the LDAP domain tree", new RemoveDomainPath());
- predInit("AddStepsFromDescription", "Creates the domain-specific LifeCycle from a description", new AddStepsFromDescription());
- predInit("ReplaceDomainWorkflow", "Replaces the domain CA with the supplied one. Used by the GUI to save new Wf layout", new ReplaceDomainWorkflow());
- predInit("AddC2KObject", "Adds a new named C2Kernel object to this Item", new AddC2KObject());
- predInit("WriteProperty", "Writes a property to the Item", new WriteProperty());
- predInit("RemoveC2KObject", "Removes the named C2Kernel object from this Item.", new RemoveC2KObject());
- predInit("AssignItemToSlot", "Assigns the referenced entity to a pre-existing slot in a collection of this one", new AssignItemToSlot());
- predInit("Erase", "Deletes all objects and domain paths for this item.", new Erase());
- predInit("Import", "Imports an outcome into the Item, with a given schema and viewpoint", new Import());
- }
-
- public void predInit(String alias, String Description, PredefinedStep act)
- {
- act.setName(alias);
- act.setType(alias);
- act.getProperties().put("Description", Description);
- act.getProperties().put("SchemaType", "PredefinedStepOutcome");
- act.getProperties().put("SchemaVersion", "0");
- act.setCentrePoint(new GraphPoint());
- act.setIsPredefined(true);
- addChild(act, new GraphPoint(100, 75 * ++num));
- }
- @Override
- public boolean verify()
- {
- return true;
- }
- @Override
- public String getErrors()
- {
- return "predefined";
- }
- @Override
- public boolean getActive()
- {
- return true;
- }
- @Override
- public String getTransitions()
- {
- return "<PossibleTransitions></PossibleTransitions>";
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java b/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java deleted file mode 100644 index c9513a8..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************
- * RemoveC2KObject
- *
- * $Workfile$
- * $Revision: 1.28 $
- * $Date: 2005/11/15 15:56:38 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2005/11/15 15:56:38 $
- * @version $Revision: 1.28 $
- **************************************************************************/
-public class RemoveC2KObject extends PredefinedStep
-{
- public RemoveC2KObject()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request(AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(1, "RemoveC2KObject::request() - Starting.");
-
- checkAccessRights(agent);
- String path = null;
- try
- {
- path = getDataList(requestData)[0];
- EntityPath entityPath = getItemEntityPath();
-
- Logger.msg(5, "RemoveC2KObject::request() - path:"+path);
-
- Gateway.getStorage().remove( entityPath.getSysKey(), path, null );
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch( Exception ex )
- {
- Logger.error("RemoveC2KObject::request() - invalid data - path:"+path);
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "RemoveC2KObject::request() - DONE.");
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java b/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java deleted file mode 100644 index 19ff7c6..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************
- * AddDomainPath
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-
-
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.LDAPLookup;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.Logger;
-
-public class RemoveDomainPath extends PredefinedStep
-{
- public RemoveDomainPath()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
- Logger.msg(8,"RemoveDomainPath::request()");
- LDAPLookup lookupManager = Gateway.getLDAPLookup();
-
- Logger.msg(1,"RemoveDomainPath::request() - Starting.");
-
- checkAccessRights(agent);
-
- try
- {
- DomainPath domainPath = new DomainPath(getDataList(requestData)[0]);
- lookupManager.delete(domainPath);
- Logger.msg(8,"AddAlias::request() - context:" + domainPath.toString() + " DONE.");
-
- }
- catch( Exception ex )
- {
- Logger.error("AddAlias::request() - during anyHelper.extract.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java b/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java deleted file mode 100644 index ba3e6c6..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.c2kernel.lifecycle.instance.predefined;
-
-//Java
-import java.awt.Point;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lifecycle.instance.CompositeActivity;
-import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Logger;
-
-public class ReplaceDomainWorkflow extends PredefinedStep
-{
- public ReplaceDomainWorkflow()
- {
- super();
- }
-
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException, InvalidTransitionException, InvalidDataException
- {
- Workflow lifeCycle = getWf();
-
- Logger.msg(1, "ReplaceDomainWorkflow::request() - Starting ");
-
- checkAccessRights(agent);
-
- try
- {
-
- Logger.msg(8, "ReplaceDomainWorkflow::request() - data:" + getDataList(requestData)[0]);
- lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain"));
- CompositeActivity domain = (CompositeActivity) CastorXMLUtility.unmarshall(getDataList(requestData)[0]);
- lifeCycle.initChild(domain, true, new Point(150, 100));
- Gateway.getStorage().put(getItemEntityPath().getSysKey(), lifeCycle, null);
- Logger.msg(1, "ReplaceDomainWorkflow::request() - DONE.");
- sendEventStoreOutcome(transitionID, requestData, agent);
- // refresh jobs
- lifeCycle.refreshJobs();
- }
- catch (Exception ex)
- {
- Logger.error("ReplaceDomainWorkflow::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException("ReplaceDomainWorkflow::request() - during unmarshall.", null);
- }
- }
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java b/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java deleted file mode 100644 index 21eacda..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/ServerPredefinedStepContainer.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.graph.model.GraphPoint;
-import com.c2kernel.lifecycle.instance.predefined.entitycreation.CreateNewAgent;
-import com.c2kernel.lifecycle.instance.predefined.entitycreation.CreateNewItem;
-
-/**************************************************************************
- *
- * $Revision: 1.2 $
- * $Date: 2005/06/02 10:19:33 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-// public static final String codeRevision = "$Revision: 1.2 $ $Date: 2005/06/02 10:19:33 $ $Author: abranson $";
-public class ServerPredefinedStepContainer extends PredefinedStepContainer {
-
-
- @Override
- public void createChildren()
- {
- super.createChildren();
- serverPredInit("CreateNewItem", "Creates a new Item in this Server without description.", new CreateNewItem(), "NewItem");
- serverPredInit("CreateNewAgent", "Creates a new Item in this Server without description.", new CreateNewAgent(), "NewAgent");
- }
-
- public void serverPredInit(String alias, String Description, PredefinedStep act, String schema)
- {
- act.setName(alias);
- act.setType(alias);
- act.getProperties().put("Description", Description);
- act.getProperties().put("SchemaType", schema);
- act.getProperties().put("SchemaVersion", "0");
- act.getProperties().put("AgentRole", "Admin");
- act.setCentrePoint(new GraphPoint());
- act.setIsPredefined(true);
- addChild(act, new GraphPoint(100, 75 * ++num));
- }
-
-}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java b/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java deleted file mode 100644 index 77a0b43..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************
- * WriteProperty
- *
- * $Workfile$
- * $Revision: 1.3 $
- * $Date: 2004/10/21 08:02:19 $
- *
- * Copyright (C) 2001 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-package com.c2kernel.lifecycle.instance.predefined;
-
-import com.c2kernel.common.AccessRightsException;
-import com.c2kernel.common.InvalidDataException;
-import com.c2kernel.common.InvalidTransitionException;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.property.Property;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * @author $Author: abranson $ $Date: 2004/10/21 08:02:19 $
- * @version $Revision: 1.3 $
- **************************************************************************/
-public class WriteProperty extends PredefinedStep
-{
- /**************************************************************************
- * Constructor for Castror
- **************************************************************************/
- public WriteProperty()
- {
- super();
- }
-
- //requestdata is xmlstring
- @Override
- public void request( AgentPath agent, int transitionID, String requestData)
- throws AccessRightsException,
- InvalidTransitionException,
- InvalidDataException
- {
-
- Logger.msg(1, "WriteProperty::request() - Starting.");
-
- checkAccessRights(agent);
- EntityPath entityPath = getItemEntityPath();
-
- if (entityPath!=null)
- {
- String[] params = getDataList(requestData);
- if (params.length != 2)
- throw new InvalidDataException("WriteProperty::request() - need 2 params - name and value", "");
- try
- {
-
- Logger.msg(5, "WriteProperty::request() - name:" + params[0] +" val:"+params[1]);
-
- Property newProp = new Property(params[0], params[1]);
- Gateway.getStorage().put(entityPath.getSysKey(), newProp, null );
- sendEventStoreOutcome(transitionID, requestData, agent);
- }
- catch( Exception ex )
- {
- Logger.error("WriteProperty::request() - during unmarshall.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
- }
-
- Logger.msg(1, "WriteProperty::request() - DONE.");
- }
- else
- throw new InvalidDataException("EntityPath is null.", "");
- }
-}
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;
- }
-}
|
