From b68ea0f2b12c4c5189c5fc7c182a1b242dc63579 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 23:18:47 +0200 Subject: Rolled back the renaming of existing exceptions. --- .../instance/predefined/AddC2KObject.java | 8 ++--- .../instance/predefined/AddDomainPath.java | 10 +++--- .../instance/predefined/AddMemberToCollection.java | 16 ++++----- .../predefined/AddNewCollectionDescription.java | 16 ++++----- .../lifecycle/instance/predefined/AddNewSlot.java | 14 ++++---- .../instance/predefined/AssignItemToSlot.java | 14 ++++---- .../lifecycle/instance/predefined/ClearSlot.java | 12 +++---- .../lifecycle/instance/predefined/Import.java | 6 ++-- .../instance/predefined/RemoveC2KObject.java | 6 ++-- .../instance/predefined/RemoveDomainPath.java | 18 +++++----- .../predefined/RemoveSlotFromCollection.java | 16 ++++----- .../instance/predefined/ReplaceDomainWorkflow.java | 8 ++--- .../instance/predefined/WriteProperty.java | 12 +++---- .../instance/predefined/WriteViewpoint.java | 10 +++--- .../agent/CreateAgentFromDescription.java | 28 ++++++++-------- .../instance/predefined/agent/RemoveAgent.java | 24 +++++++------- .../predefined/agent/SetAgentPassword.java | 14 ++++---- .../instance/predefined/agent/SetAgentRoles.java | 16 ++++----- .../predefined/item/CreateItemFromDescription.java | 38 +++++++++++----------- .../lifecycle/instance/predefined/item/Erase.java | 8 ++--- .../predefined/server/AddDomainContext.java | 12 +++---- .../instance/predefined/server/CreateNewAgent.java | 14 ++++---- .../instance/predefined/server/CreateNewItem.java | 12 +++---- .../instance/predefined/server/CreateNewRole.java | 12 +++---- .../predefined/server/RemoveDomainContext.java | 16 ++++----- .../instance/predefined/server/RemoveRole.java | 10 +++--- 26 files changed, 185 insertions(+), 185 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java index 8c078aa..a39e815 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddC2KObject.java @@ -22,7 +22,7 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -49,16 +49,16 @@ public class AddC2KObject extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddC2KObject: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddC2KObject: Invalid parameters "+Arrays.toString(params)); C2KLocalObject obj; try { obj = (C2KLocalObject)Gateway.getMarshaller().unmarshall(params[0]); } catch (Exception e) { - throw new InvalidData("AddC2KObject: Could not unmarshall new object: "+params[0]); + throw new InvalidDataException("AddC2KObject: Could not unmarshall new object: "+params[0]); } Gateway.getStorage().put(item, obj, null ); return requestData; 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 1067911..8723d3b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddDomainPath.java @@ -25,9 +25,9 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; @@ -46,11 +46,11 @@ public class AddDomainPath extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectAlreadyExists, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectAlreadyExistsException, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddDomainPath: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddDomainPath: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddDomainPath: Invalid parameters "+Arrays.toString(params)); LookupManager lookupManager = Gateway.getLookupManager(); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java index 43316b2..90db8e1 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddMemberToCollection.java @@ -25,9 +25,9 @@ import java.util.Arrays; import com.c2kernel.collection.Dependency; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -59,14 +59,14 @@ public class AddMemberToCollection extends PredefinedStep * Params: * 0 - collection name * 1 - target entity key - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws PersistencyException - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws InvalidCollectionModification */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectAlreadyExists, PersistencyException, ObjectNotFound, InvalidCollectionModification { + int transitionID, String requestData) throws InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectNotFoundException, InvalidCollectionModification { String collName; ItemPath newChild; @@ -83,13 +83,13 @@ public class AddMemberToCollection extends PredefinedStep props = (CastorHashMap)Gateway.getMarshaller().unmarshall(params[2]); } catch (Exception e) { - throw new InvalidData("AddMemberToCollection: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AddMemberToCollection: Invalid parameters "+Arrays.toString(params)); } // load collection C2KLocalObject collObj; collObj = Gateway.getStorage().get(item, ClusterStorage.COLLECTION+"/"+collName+"/last", null); - if (!(collObj instanceof Dependency)) throw new InvalidData("AddMemberToCollection: AddMemberToCollection operates on Dependency collections only."); + if (!(collObj instanceof Dependency)) throw new InvalidDataException("AddMemberToCollection: AddMemberToCollection operates on Dependency collections only."); dep = (Dependency)collObj; // find member and assign entity diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java index 6eb69f3..99fd666 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewCollectionDescription.java @@ -26,9 +26,9 @@ import java.util.Arrays; import com.c2kernel.collection.AggregationDescription; import com.c2kernel.collection.CollectionDescription; import com.c2kernel.collection.DependencyDescription; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -63,7 +63,7 @@ public class AddNewCollectionDescription extends PredefinedStep */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectAlreadyExists, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectAlreadyExistsException, PersistencyException { String collName; String collType; @@ -72,7 +72,7 @@ public class AddNewCollectionDescription extends PredefinedStep String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddNewCollectionDescription: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length != 2) - throw new InvalidData("AddNewCollectionDescription: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AddNewCollectionDescription: Invalid parameters "+Arrays.toString(params)); collName = params[0]; collType = params[1]; @@ -80,8 +80,8 @@ public class AddNewCollectionDescription extends PredefinedStep // check if collection already exists try { Gateway.getStorage().get(item, ClusterStorage.COLLECTION+"/"+collName+"/last", null); - throw new ObjectAlreadyExists("Collection '"+collName+"' already exists"); - } catch (ObjectNotFound ex) { + throw new ObjectAlreadyExistsException("Collection '"+collName+"' already exists"); + } catch (ObjectNotFoundException ex) { // collection doesn't exist } catch (PersistencyException ex) { Logger.error(ex); @@ -96,7 +96,7 @@ public class AddNewCollectionDescription extends PredefinedStep if (collType.equals("Dependency")) newCollDesc = new DependencyDescription(collName); else - throw new InvalidData("AddNewCollectionDescription: Invalid collection type specified: '"+collType+"'. Must be Aggregation or Dependency."); + throw new InvalidDataException("AddNewCollectionDescription: Invalid collection type specified: '"+collType+"'. Must be Aggregation or Dependency."); // store it try { diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java index 19ef2ae..3d9e5d3 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AddNewSlot.java @@ -24,8 +24,8 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; import com.c2kernel.collection.Aggregation; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -63,13 +63,13 @@ public class AddNewSlot extends PredefinedStep *
  • Item Description version (optional)
  • * * - * @throws InvalidData Then the parameters were incorrect + * @throws InvalidDataException Then the parameters were incorrect * @throws PersistencyException There was a problem loading or saving the collection from persistency - * @throws ObjectNotFound A required object, such as the collection or a PropertyDescription outcome, wasn't found + * @throws ObjectNotFoundException A required object, such as the collection or a PropertyDescription outcome, wasn't found */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException, ObjectNotFound { + int transitionID, String requestData) throws InvalidDataException, PersistencyException, ObjectNotFoundException { String collName; ItemPath descKey = null; @@ -86,7 +86,7 @@ public class AddNewSlot extends PredefinedStep if (params.length > 1 && params[1].length() > 0) descKey = new ItemPath(params[1]); if (params.length > 2 && params[2].length() > 0) descVer = params[2]; } catch (Exception e) { - throw new InvalidData("AddNewSlot: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AddNewSlot: Invalid parameters "+Arrays.toString(params)); } // load collection @@ -97,7 +97,7 @@ public class AddNewSlot extends PredefinedStep Logger.error(ex); throw new PersistencyException("AddNewSlot: Error loading collection '\"+collName+\"': "+ex.getMessage()); } - if (!(collObj instanceof Aggregation)) throw new InvalidData("AddNewSlot: AddNewSlot operates on Aggregation collections only."); + if (!(collObj instanceof Aggregation)) throw new InvalidDataException("AddNewSlot: AddNewSlot operates on Aggregation collections only."); agg = (Aggregation)collObj; // get props 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 fdf852f..04d6770 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/AssignItemToSlot.java @@ -26,9 +26,9 @@ import java.util.Arrays; import com.c2kernel.collection.Aggregation; import com.c2kernel.collection.AggregationMember; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; @@ -58,14 +58,14 @@ public class AssignItemToSlot extends PredefinedStep * 0 - collection name * 1 - slot number * 2 - target entity key - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException * @throws ObjectCannotBeUpdated * @throws InvalidCollectionModification */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException, ObjectCannotBeUpdated, InvalidCollectionModification { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectCannotBeUpdated, InvalidCollectionModification { String collName; int slotNo; @@ -81,7 +81,7 @@ public class AssignItemToSlot extends PredefinedStep slotNo = Integer.parseInt(params[1]); childItem = new ItemPath(params[2]); } catch (Exception e) { - throw new InvalidData("AssignItemToSlot: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("AssignItemToSlot: Invalid parameters "+Arrays.toString(params)); } // load collection @@ -92,7 +92,7 @@ public class AssignItemToSlot extends PredefinedStep Logger.error(ex); throw new PersistencyException("AssignItemToSlot: Error loading collection '\"+collName+\"': "+ex.getMessage()); } - if (!(collObj instanceof Aggregation)) throw new InvalidData("AssignItemToSlot: AssignItemToSlot operates on Aggregation collections only."); + if (!(collObj instanceof Aggregation)) throw new InvalidDataException("AssignItemToSlot: AssignItemToSlot operates on Aggregation collections only."); agg = (Aggregation)collObj; // find member and assign entity @@ -107,7 +107,7 @@ public class AssignItemToSlot extends PredefinedStep } } if (!stored) { - throw new ObjectNotFound("AssignItemToSlot: Member slot "+slotNo+" not found."); + throw new ObjectNotFoundException("AssignItemToSlot: Member slot "+slotNo+" not found."); } try { 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 a15b98f..1bfb8d0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ClearSlot.java @@ -25,9 +25,9 @@ import java.util.Arrays; import com.c2kernel.collection.Aggregation; import com.c2kernel.collection.AggregationMember; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -55,13 +55,13 @@ public class ClearSlot extends PredefinedStep * Params: * 0 - collection name * 1 - slot number - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException, ObjectCannotBeUpdated { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectCannotBeUpdated { String collName; int slotNo; @@ -75,7 +75,7 @@ public class ClearSlot extends PredefinedStep collName = params[0]; slotNo = Integer.parseInt(params[1]); } catch (Exception e) { - throw new InvalidData("ClearSlot: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("ClearSlot: Invalid parameters "+Arrays.toString(params)); } // load collection @@ -98,7 +98,7 @@ public class ClearSlot extends PredefinedStep } } if (!stored) { - throw new ObjectNotFound("ClearSlot: Member slot "+slotNo+" not found."); + throw new ObjectNotFoundException("ClearSlot: Member slot "+slotNo+" not found."); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java index e17919d..12cb488 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/Import.java @@ -22,7 +22,7 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.events.Event; import com.c2kernel.events.History; @@ -54,7 +54,7 @@ public class Import extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "Import: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); @@ -63,7 +63,7 @@ public class Import extends PredefinedStep int split2 = params[0].indexOf(':'); if (split1 == -1) - throw new InvalidData("Import: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("Import: Invalid parameters "+Arrays.toString(params)); requestData = params[1]; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java index a88e000..ef7d16b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveC2KObject.java @@ -24,7 +24,7 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -48,12 +48,12 @@ public class RemoveC2KObject extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "RemoveC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length != 1) - throw new InvalidData("RemoveC2KObject: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("RemoveC2KObject: Invalid parameters "+Arrays.toString(params)); String path = params[0]; try diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java index 0248650..3308003 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java @@ -25,10 +25,10 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.ItemPath; @@ -46,23 +46,23 @@ public class RemoveDomainPath extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "RemoveDomainPath: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("RemoveDomainPath: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("RemoveDomainPath: Invalid parameters "+Arrays.toString(params)); DomainPath domainPath = new DomainPath(params[0]); if (!domainPath.exists()) - throw new ObjectNotFound("RemoveDomainPath: Domain path "+domainPath.toString()+" does not exist."); + throw new ObjectNotFoundException("RemoveDomainPath: Domain path "+domainPath.toString()+" does not exist."); if (domainPath.getType()!=DomainPath.ENTITY) try { if (!domainPath.getItemPath().equals(item)) - throw new InvalidData("RemoveDomainPath: Domain path "+domainPath.toString()+" is not an alias of the current Item "+item); - } catch (ObjectNotFound ex) { - throw new InvalidData("RemoveDomainPath: Domain path "+domainPath.toString()+" is a context."); + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" is not an alias of the current Item "+item); + } catch (ObjectNotFoundException ex) { + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" is a context."); } LookupManager lookupManager = Gateway.getLookupManager(); 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 061202d..7bd921b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveSlotFromCollection.java @@ -25,8 +25,8 @@ import java.util.Arrays; import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionMember; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -55,12 +55,12 @@ public class RemoveSlotFromCollection extends PredefinedStep * 0 - collection name * 1 - slot number OR if null: * 2 - target entity key - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException { String collName; int slotNo = -1; @@ -76,11 +76,11 @@ public class RemoveSlotFromCollection extends PredefinedStep if (params.length>1 && params[1].length()>0) slotNo = Integer.parseInt(params[1]); if (params.length>2 && params[2].length()>0) currentChild = new ItemPath(params[2]); } catch (Exception e) { - throw new InvalidData("RemoveSlotFromCollection: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("RemoveSlotFromCollection: Invalid parameters "+Arrays.toString(params)); } if (slotNo == -1 && currentChild == null) - throw new InvalidData("RemoveSlotFromCollection: Must give either slot number or entity key"); + throw new InvalidDataException("RemoveSlotFromCollection: Must give either slot number or entity key"); // load collection try { @@ -98,7 +98,7 @@ public class RemoveSlotFromCollection extends PredefinedStep // if both parameters are supplied, check the given item is actually in that slot if (slot != null && currentChild != null && !slot.getItemPath().equals(currentChild)) { - throw new ObjectNotFound("RemoveSlotFromCollection: Item "+currentChild+" was not in slot "+slotNo); + throw new ObjectNotFoundException("RemoveSlotFromCollection: Item "+currentChild+" was not in slot "+slotNo); } if (slotNo == -1) { // find slot from entity key @@ -110,7 +110,7 @@ public class RemoveSlotFromCollection extends PredefinedStep } } if (slotNo == -1) { - throw new ObjectNotFound("Could not find "+currentChild+" in collection "+coll.getName()); + throw new ObjectNotFoundException("Could not find "+currentChild+" in collection "+coll.getName()); } // Remove the slot diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java index ddb89ba..f2d34c4 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/ReplaceDomainWorkflow.java @@ -23,7 +23,7 @@ package com.c2kernel.lifecycle.instance.predefined; //Java import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.PersistencyException; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.lifecycle.instance.CompositeActivity; @@ -43,13 +43,13 @@ public class ReplaceDomainWorkflow extends PredefinedStep @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, PersistencyException { Workflow lifeCycle = getWf(); String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddC2KObject: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddC2KObject: Invalid parameters "+Arrays.toString(params)); lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain")); CompositeActivity domain; @@ -57,7 +57,7 @@ public class ReplaceDomainWorkflow extends PredefinedStep domain = (CompositeActivity) Gateway.getMarshaller().unmarshall(params[0]); } catch (Exception e) { Logger.error(e); - throw new InvalidData("ReplaceDomainWorkflow: Could not unmarshall new workflow: "+e.getMessage()); + throw new InvalidDataException("ReplaceDomainWorkflow: Could not unmarshall new workflow: "+e.getMessage()); } domain.setName("domain"); lifeCycle.initChild(domain, true, new GraphPoint(150, 100)); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java index e41411b..2813f43 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteProperty.java @@ -22,9 +22,9 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -51,13 +51,13 @@ public class WriteProperty extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectNotFound, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectNotFoundException, PersistencyException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "WriteProperty: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length != 2) - throw new InvalidData("WriteProperty: invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("WriteProperty: invalid parameters "+Arrays.toString(params)); String name = params[0]; String newValue = params[1]; @@ -70,8 +70,8 @@ public class WriteProperty extends PredefinedStep throw new ObjectCannotBeUpdated("WriteProperty: Property '"+name+"' is not mutable."); prop.setValue(newValue); Gateway.getStorage().put(item, prop, null); - } catch (ObjectNotFound e) { - throw new ObjectNotFound("WriteProperty: Property '"+name+"' not found."); + } catch (ObjectNotFoundException e) { + throw new ObjectNotFoundException("WriteProperty: Property '"+name+"' not found."); } return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java index efe6a5f..a8a17ce 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/WriteViewpoint.java @@ -22,8 +22,8 @@ package com.c2kernel.lifecycle.instance.predefined; import java.util.Arrays; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.events.Event; import com.c2kernel.lookup.AgentPath; @@ -41,7 +41,7 @@ public class WriteViewpoint extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, PersistencyException { String schemaName; String viewName; @@ -52,7 +52,7 @@ public class WriteViewpoint extends PredefinedStep { // outcometype, name and evId. Event and Outcome should be checked so schema version should be discovered. if (params.length != 3) - throw new InvalidData("WriteViewpoint: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("WriteViewpoint: Invalid parameters "+Arrays.toString(params)); schemaName = params[0]; viewName = params[1]; @@ -60,7 +60,7 @@ public class WriteViewpoint extends PredefinedStep { try { evId = Integer.parseInt(params[2]); } catch (NumberFormatException ex) { - throw new InvalidData("WriteViewpoint: Parameter 3 (EventId) must be an integer"); + throw new InvalidDataException("WriteViewpoint: Parameter 3 (EventId) must be an integer"); } // Find event diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java index 564c5db..a2dfeae 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java @@ -22,11 +22,11 @@ package com.c2kernel.lifecycle.instance.predefined.agent; import java.util.Arrays; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.CorbaServer; import com.c2kernel.entity.agent.ActiveEntity; @@ -57,21 +57,21 @@ public class CreateAgentFromDescription extends CreateItemFromDescription *
  • Comma-delimited Role names to assign to the agent. Must already exist.
  • *
  • Initial properties to set in the new Agent
  • * - * @throws ObjectNotFound - * @throws InvalidData The input parameters were incorrect - * @throws ObjectAlreadyExists The Agent already exists - * @throws CannotManage The Agent could not be created + * @throws ObjectNotFoundException + * @throws InvalidDataException The input parameters were incorrect + * @throws ObjectAlreadyExistsException The Agent already exists + * @throws CannotManageException The Agent could not be created * @throws ObjectCannotBeUpdated The addition of the new entries into the LookupManager failed * @see com.c2kernel.lifecycle.instance.predefined.item.CreateItemFromDescription#runActivityLogic(com.c2kernel.lookup.AgentPath, int, int, java.lang.String) */ @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws ObjectNotFound, InvalidData, ObjectAlreadyExists, CannotManage, ObjectCannotBeUpdated { + int transitionID, String requestData) throws ObjectNotFoundException, InvalidDataException, ObjectAlreadyExistsException, CannotManageException, ObjectCannotBeUpdated { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "CreateAgentFromDescription: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); if (params.length < 3 || params.length > 4) - throw new InvalidData("CreateAgentFromDescription: Invalid parameters "+Arrays.toString(params)); + throw new InvalidDataException("CreateAgentFromDescription: Invalid parameters "+Arrays.toString(params)); String newName = params[0]; String descVer = params[1]; @@ -90,8 +90,8 @@ public class CreateAgentFromDescription extends CreateItemFromDescription // check if the path is already taken try { Gateway.getLookup().getAgentPath(newName); - throw new ObjectAlreadyExists("The agent name " +newName+ " exists already."); - } catch (ObjectNotFound ex) { } + throw new ObjectAlreadyExistsException("The agent name " +newName+ " exists already."); + } catch (ObjectNotFoundException ex) { } // generate new entity key Logger.msg(6, "CreateItemFromDescription - Requesting new agent path"); @@ -103,7 +103,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription // create the Item object Logger.msg(3, "CreateItemFromDescription - Creating Item"); CorbaServer factory = Gateway.getCorbaServer(); - if (factory == null) throw new CannotManage("This process cannot create new Items"); + if (factory == null) throw new CannotManageException("This process cannot create new Items"); ActiveEntity newAgent = factory.createAgent(newAgentPath); Gateway.getLookupManager().add(newAgentPath); @@ -122,7 +122,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { - throw new InvalidData("CreateAgentFromDescription: Problem initializing new Agent. See log: "+e.getMessage()); + throw new InvalidDataException("CreateAgentFromDescription: Problem initializing new Agent. See log: "+e.getMessage()); } // add roles if given diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java index 65608c7..41fc7ba 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/RemoveAgent.java @@ -20,10 +20,10 @@ */ package com.c2kernel.lifecycle.instance.predefined.agent; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -41,7 +41,7 @@ public class RemoveAgent extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath itemPath, - int transitionID, String requestData) throws InvalidData { + int transitionID, String requestData) throws InvalidDataException { Logger.msg(1, "RemoveAgent::request() - Starting."); @@ -49,7 +49,7 @@ public class RemoveAgent extends PredefinedStep { try { targetAgent = new AgentPath(itemPath); } catch (InvalidAgentPathException ex) { - throw new InvalidData("Could not resolve "+itemPath+" as an Agent."); + throw new InvalidDataException("Could not resolve "+itemPath+" as an Agent."); } String agentName = targetAgent.getAgentName(); @@ -59,12 +59,12 @@ public class RemoveAgent extends PredefinedStep { Gateway.getLookupManager().removeRole(targetAgent, role); } catch (ObjectCannotBeUpdated e) { Logger.error(e); - throw new InvalidData("Error removing "+agentName+" from Role "+role.getName()); - } catch (ObjectNotFound e) { + throw new InvalidDataException("Error removing "+agentName+" from Role "+role.getName()); + } catch (ObjectNotFoundException e) { Logger.error(e); - throw new InvalidData("Tried to remove "+agentName+" from Role "+role.getName()+" that doesn't exist."); - } catch (CannotManage e) { - throw new InvalidData("Tried to alter roles in a non-server process."); + throw new InvalidDataException("Tried to remove "+agentName+" from Role "+role.getName()+" that doesn't exist."); + } catch (CannotManageException e) { + throw new InvalidDataException("Tried to alter roles in a non-server process."); } } @@ -73,14 +73,14 @@ public class RemoveAgent extends PredefinedStep { Gateway.getStorage().removeCluster(targetAgent, "", null); } catch (PersistencyException e) { Logger.error(e); - throw new InvalidData("Error deleting storage for "+agentName); + throw new InvalidDataException("Error deleting storage for "+agentName); } //remove entity path try { Gateway.getLookupManager().delete(targetAgent); } catch (Exception e) { - throw new InvalidData("Error deleting AgentPath for "+agentName); + throw new InvalidDataException("Error deleting AgentPath for "+agentName); } return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java index 5285662..f54e2a8 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentPassword.java @@ -23,10 +23,10 @@ package com.c2kernel.lifecycle.instance.predefined.agent; import java.security.NoSuchAlgorithmException; import java.util.Arrays; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.InvalidItemPathException; @@ -42,17 +42,17 @@ public class SetAgentPassword extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "SetAgentPassword: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("SetAgentPassword: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("SetAgentPassword: Invalid parameters "+Arrays.toString(params)); AgentPath targetAgent; try { targetAgent = new AgentPath(item); } catch (InvalidItemPathException ex) { - throw new InvalidData("Can only set password on an Agent. "+item+" is an Item."); + throw new InvalidDataException("Can only set password on an Agent. "+item+" is an Item."); } String agentName = targetAgent.getAgentName(); @@ -60,7 +60,7 @@ public class SetAgentPassword extends PredefinedStep { Gateway.getLookupManager().setAgentPassword(targetAgent, params[0]); } catch (NoSuchAlgorithmException e) { Logger.error(e); - throw new InvalidData("Cryptographic libraries for password hashing not found."); + throw new InvalidDataException("Cryptographic libraries for password hashing not found."); } params[1] = "REDACTED"; // censor user's password from outcome diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java index 02cc49e..d326d05 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/SetAgentRoles.java @@ -22,8 +22,8 @@ package com.c2kernel.lifecycle.instance.predefined.agent; import java.util.ArrayList; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.InvalidItemPathException; @@ -40,7 +40,7 @@ public class SetAgentRoles extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData { + int transitionID, String requestData) throws InvalidDataException { Logger.msg(1, "SetAgentRoles::request() - Starting."); @@ -49,7 +49,7 @@ public class SetAgentRoles extends PredefinedStep { try { targetAgent = new AgentPath(item); } catch (InvalidItemPathException ex) { - throw new InvalidData("Could not resolve syskey "+item+" as an Agent."); + throw new InvalidDataException("Could not resolve syskey "+item+" as an Agent."); } RolePath[] currentRoles = targetAgent.getRoles(); @@ -57,8 +57,8 @@ public class SetAgentRoles extends PredefinedStep { for (int i=0; i rolesToRemove = new ArrayList(); @@ -75,7 +75,7 @@ public class SetAgentRoles extends PredefinedStep { Gateway.getLookupManager().removeRole(targetAgent, roleToRemove); } catch (Exception e) { Logger.error(e); - throw new InvalidData("Error removing role "+roleToRemove.getName()); + throw new InvalidDataException("Error removing role "+roleToRemove.getName()); } // add requested roles we don't already have @@ -84,7 +84,7 @@ public class SetAgentRoles extends PredefinedStep { Gateway.getLookupManager().addRole(targetAgent, roleToAdd); } catch (Exception e) { Logger.error(e); - throw new InvalidData("Error adding role "+roleToAdd.getName()); + throw new InvalidDataException("Error adding role "+roleToAdd.getName()); } return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java index 02ea642..140f68c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/CreateItemFromDescription.java @@ -24,11 +24,11 @@ import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionArrayList; import com.c2kernel.collection.CollectionDescription; import com.c2kernel.collection.CollectionMember; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.CorbaServer; import com.c2kernel.entity.TraceableEntity; @@ -62,7 +62,7 @@ public class CreateItemFromDescription extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath itemPath, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectAlreadyExists, CannotManage, ObjectCannotBeUpdated, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectAlreadyExistsException, CannotManageException, ObjectCannotBeUpdated, PersistencyException { String[] input = getDataList(requestData); String newName = input[0]; @@ -77,7 +77,7 @@ public class CreateItemFromDescription extends PredefinedStep DomainPath context = new DomainPath(new DomainPath(domPath), newName); //Logger.debug(8,"context "+context.getItemPath()+" "+context.getPath()+" "+context.getString()); if (context.exists()) - throw new ObjectAlreadyExists("The path " +context+ " exists already."); + throw new ObjectAlreadyExistsException("The path " +context+ " exists already."); // get init objects @@ -93,7 +93,7 @@ public class CreateItemFromDescription extends PredefinedStep // create the Item object Logger.msg(3, "CreateItemFromDescription - Creating Item"); CorbaServer factory = Gateway.getCorbaServer(); - if (factory == null) throw new CannotManage("This process cannot create new Items"); + if (factory == null) throw new CannotManageException("This process cannot create new Items"); TraceableEntity newItem = factory.createItem(newItemPath); Gateway.getLookupManager().add(newItemPath); @@ -112,7 +112,7 @@ public class CreateItemFromDescription extends PredefinedStep } catch (PersistencyException e) { throw e; } catch (Exception e) { - throw new InvalidData("CreateAgentFromDescription: Problem initializing new Agent. See log: "+e.getMessage()); + throw new InvalidDataException("CreateAgentFromDescription: Problem initializing new Agent. See log: "+e.getMessage()); } // add its domain path Logger.msg(3, "CreateItemFromDescription - Creating "+context); @@ -121,16 +121,16 @@ public class CreateItemFromDescription extends PredefinedStep return requestData; } - protected PropertyArrayList getInitProperties(String input) throws InvalidData { + protected PropertyArrayList getInitProperties(String input) throws InvalidDataException { try { return (PropertyArrayList)Gateway.getMarshaller().unmarshall(input); } catch (Exception e) { Logger.error(e); - throw new InvalidData("Initial property parameter was not a marshalled PropertyArrayList: "+input); + throw new InvalidDataException("Initial property parameter was not a marshalled PropertyArrayList: "+input); } } - protected PropertyArrayList getNewProperties(ItemPath itemPath, String descVer, PropertyArrayList initProps, String newName, AgentPath agent) throws ObjectNotFound, InvalidData { + protected PropertyArrayList getNewProperties(ItemPath itemPath, String descVer, PropertyArrayList initProps, String newName, AgentPath agent) throws ObjectNotFoundException, InvalidDataException { // copy properties -- intend to create from propdesc PropertyDescriptionList pdList = PropertyUtility.getPropertyDescriptionOutcome(itemPath, descVer); PropertyArrayList props = pdList.instantiate(initProps); @@ -147,7 +147,7 @@ public class CreateItemFromDescription extends PredefinedStep return props; } - protected CompositeActivity getNewWorkflow(ItemPath itemPath, String descVer) throws ObjectNotFound, InvalidData, PersistencyException { + protected CompositeActivity getNewWorkflow(ItemPath itemPath, String descVer) throws ObjectNotFoundException, InvalidDataException, PersistencyException { // find the workflow def for the given description version String wfDefName = null; Integer wfDefVer = null; @@ -159,26 +159,26 @@ public class CreateItemFromDescription extends PredefinedStep try { wfDefVer = Integer.parseInt(wfVerObj.toString()); } catch (NumberFormatException ex) { - throw new InvalidData("Invalid workflow version number: "+wfVerObj.toString()); + throw new InvalidDataException("Invalid workflow version number: "+wfVerObj.toString()); } // load workflow def if (wfDefName == null) - throw new InvalidData("No workflow given or defined"); + throw new InvalidDataException("No workflow given or defined"); if (wfDefVer == null) - throw new InvalidData("No workflow def version given"); + throw new InvalidDataException("No workflow def version given"); try { CompositeActivityDef wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, wfDefVer); return (CompositeActivity)wfDef.instantiate(); - } catch (ObjectNotFound ex) { - throw new InvalidData("Workflow def '"+wfDefName+"'v"+wfDefVer+" not found"); + } catch (ObjectNotFoundException ex) { + throw new InvalidDataException("Workflow def '"+wfDefName+"'v"+wfDefVer+" not found"); } catch (ClassCastException ex) { - throw new InvalidData("Activity def '"+wfDefName+"' was not Composite"); + throw new InvalidDataException("Activity def '"+wfDefName+"' was not Composite"); } } - protected CollectionArrayList getNewCollections(ItemPath itemPath, String descVer) throws ObjectNotFound, PersistencyException { + protected CollectionArrayList getNewCollections(ItemPath itemPath, String descVer) throws ObjectNotFoundException, PersistencyException { // loop through collections, collecting instantiated descriptions and finding the default workflow def CollectionArrayList colls = new CollectionArrayList(); String[] collNames = Gateway.getStorage().getClusterContents(itemPath, ClusterStorage.COLLECTION); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java index f96bc08..a34b202 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/item/Erase.java @@ -24,10 +24,10 @@ package com.c2kernel.lifecycle.instance.predefined.item; import java.util.Iterator; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -54,7 +54,7 @@ public class Erase extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage, PersistencyException { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, PersistencyException { Logger.msg(1, "Erase::request() - Starting."); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java index 57de2a1..e6bfba9 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/AddDomainContext.java @@ -23,9 +23,9 @@ package com.c2kernel.lifecycle.instance.predefined.server; import java.util.Arrays; import java.util.Stack; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -42,15 +42,15 @@ public class AddDomainContext extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectAlreadyExists, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectAlreadyExistsException, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "AddDomainContext: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("AddDomainContext: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("AddDomainContext: Invalid parameters "+Arrays.toString(params)); DomainPath pathToAdd = new DomainPath(params); if (pathToAdd.exists()) - throw new ObjectAlreadyExists("Context "+pathToAdd+" already exists"); + throw new ObjectAlreadyExistsException("Context "+pathToAdd+" already exists"); // collect parent paths if they don't exist Stack pathsToAdd = new Stack(); while(pathToAdd!= null && !pathToAdd.exists()) { diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java index ffe8950..92f4357 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewAgent.java @@ -20,11 +20,11 @@ */ package com.c2kernel.lifecycle.instance.predefined.server; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.imports.ImportAgent; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -43,7 +43,7 @@ public class CreateNewAgent extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage, ObjectAlreadyExists { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, ObjectAlreadyExistsException { String redactedRequestData; @@ -52,7 +52,7 @@ public class CreateNewAgent extends PredefinedStep newAgent = (ImportAgent)Gateway.getMarshaller().unmarshall(requestData); } catch (Exception e1) { Logger.error(e1); - throw new InvalidData("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); + throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); } newAgent.create(agent, true); newAgent.setPassword("REDACTED"); @@ -60,7 +60,7 @@ public class CreateNewAgent extends PredefinedStep redactedRequestData = Gateway.getMarshaller().marshall(newAgent); } catch (Exception e) { Logger.error(e); - throw new InvalidData("CreateNewAgent: Couldn't marshall new Agent for outcome: "+newAgent); + throw new InvalidDataException("CreateNewAgent: Couldn't marshall new Agent for outcome: "+newAgent); } return redactedRequestData; } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java index 5e0505e..fde9f82 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewItem.java @@ -23,12 +23,12 @@ package com.c2kernel.lifecycle.instance.predefined.server; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.imports.ImportItem; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -47,14 +47,14 @@ public class CreateNewItem extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectCannotBeUpdated, ObjectNotFound, CannotManage, ObjectAlreadyExists, InvalidCollectionModification { + int transitionID, String requestData) throws InvalidDataException, ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException, InvalidCollectionModification { ImportItem newItem; try { newItem = (ImportItem)Gateway.getMarshaller().unmarshall(requestData); } catch (Exception e) { Logger.error(e); - throw new InvalidData("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); + throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); } newItem.create(agent, false); return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java index de05dec..f99e54c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/CreateNewRole.java @@ -20,11 +20,11 @@ */ package com.c2kernel.lifecycle.instance.predefined.server; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.imports.ImportRole; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; @@ -43,7 +43,7 @@ public class CreateNewRole extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, ObjectNotFound { + int transitionID, String requestData) throws InvalidDataException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, ObjectNotFoundException { ImportRole newRole; @@ -51,7 +51,7 @@ public class CreateNewRole extends PredefinedStep newRole = (ImportRole)Gateway.getMarshaller().unmarshall(requestData); } catch (Exception e) { Logger.error(e); - throw new InvalidData("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); + throw new InvalidDataException("CreateNewAgent: Couldn't unmarshall new Agent: "+requestData); } newRole.create(agent, true); return requestData; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java index 2d78e69..a4520aa 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveDomainContext.java @@ -22,10 +22,10 @@ package com.c2kernel.lifecycle.instance.predefined.server; import java.util.Arrays; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; @@ -40,20 +40,20 @@ public class RemoveDomainContext extends PredefinedStep { @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, ObjectNotFound, ObjectCannotBeUpdated, CannotManage { + int transitionID, String requestData) throws InvalidDataException, ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "RemoveDomainContext: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("RemoveDomainContext: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("RemoveDomainContext: Invalid parameters "+Arrays.toString(params)); DomainPath pathToDelete = new DomainPath(params[0]); if (!pathToDelete.exists()) - throw new ObjectNotFound("Context "+pathToDelete+" does not exist"); + throw new ObjectNotFoundException("Context "+pathToDelete+" does not exist"); try { pathToDelete.getItemPath(); - throw new InvalidData("Path "+pathToDelete+" is an Entity. Use its own Erase step instead, or RemoveAgent."); - } catch (ObjectNotFound ex) { } + throw new InvalidDataException("Path "+pathToDelete+" is an Entity. Use its own Erase step instead, or RemoveAgent."); + } catch (ObjectNotFoundException ex) { } if (Gateway.getLookup().getChildren(pathToDelete).hasNext()) throw new ObjectCannotBeUpdated("Context "+pathToDelete+" is not empty. Cannot delete."); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java index 7aeda55..a75b98c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/server/RemoveRole.java @@ -22,10 +22,10 @@ package com.c2kernel.lifecycle.instance.predefined.server; import java.util.Arrays; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lifecycle.instance.predefined.PredefinedStep; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -44,11 +44,11 @@ public class RemoveRole extends PredefinedStep //requestdata is xmlstring @Override protected String runActivityLogic(AgentPath agent, ItemPath item, - int transitionID, String requestData) throws InvalidData, CannotManage, ObjectNotFound, ObjectCannotBeUpdated { + int transitionID, String requestData) throws InvalidDataException, CannotManageException, ObjectNotFoundException, ObjectCannotBeUpdated { String[] params = getDataList(requestData); if (Logger.doLog(3)) Logger.msg(3, "RemoveRole: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - if (params.length != 1) throw new InvalidData("RemoveRole: Invalid parameters "+Arrays.toString(params)); + if (params.length != 1) throw new InvalidDataException("RemoveRole: Invalid parameters "+Arrays.toString(params)); LookupManager lookup = Gateway.getLookupManager(); -- cgit v1.2.3