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. --- .../java/com/c2kernel/collection/Aggregation.java | 16 ++-- .../collection/AggregationDescription.java | 8 +- .../c2kernel/collection/AggregationInstance.java | 10 +-- .../com/c2kernel/collection/AggregationMember.java | 6 +- .../java/com/c2kernel/collection/Collection.java | 14 ++-- .../c2kernel/collection/CollectionDescription.java | 6 +- .../com/c2kernel/collection/CollectionMember.java | 6 +- .../java/com/c2kernel/collection/Dependency.java | 16 ++-- .../c2kernel/collection/DependencyDescription.java | 10 +-- .../com/c2kernel/collection/DependencyMember.java | 4 +- src/main/java/com/c2kernel/entity/CorbaServer.java | 30 +++---- .../com/c2kernel/entity/ItemImplementation.java | 40 ++++----- .../java/com/c2kernel/entity/TraceableEntity.java | 24 +++--- .../java/com/c2kernel/entity/TraceableLocator.java | 4 +- .../com/c2kernel/entity/agent/ActiveEntity.java | 26 +++--- .../com/c2kernel/entity/agent/ActiveLocator.java | 4 +- .../c2kernel/entity/agent/AgentImplementation.java | 12 +-- src/main/java/com/c2kernel/entity/agent/Job.java | 40 ++++----- .../com/c2kernel/entity/imports/ImportAgent.java | 16 ++-- .../c2kernel/entity/imports/ImportAggregation.java | 6 +- .../c2kernel/entity/imports/ImportDependency.java | 8 +- .../com/c2kernel/entity/imports/ImportItem.java | 28 +++---- .../com/c2kernel/entity/imports/ImportOutcome.java | 4 +- .../com/c2kernel/entity/imports/ImportRole.java | 10 +-- .../java/com/c2kernel/entity/proxy/AgentProxy.java | 94 +++++++++++----------- .../java/com/c2kernel/entity/proxy/ItemProxy.java | 66 +++++++-------- .../c2kernel/entity/proxy/MemberSubscription.java | 6 +- .../entity/proxy/ProxyClientConnection.java | 6 +- .../com/c2kernel/entity/proxy/ProxyManager.java | 14 ++-- .../com/c2kernel/entity/proxy/ProxyMessage.java | 10 +-- .../entity/proxy/ProxyServerConnection.java | 4 +- .../com/c2kernel/entity/transfer/TransferItem.java | 6 +- src/main/java/com/c2kernel/events/Event.java | 6 +- src/main/java/com/c2kernel/events/History.java | 6 +- .../com/c2kernel/graph/model/GraphableVertex.java | 6 +- .../java/com/c2kernel/lifecycle/ActivityDef.java | 8 +- .../com/c2kernel/lifecycle/ActivitySlotDef.java | 10 +-- .../c2kernel/lifecycle/CompositeActivityDef.java | 8 +- .../java/com/c2kernel/lifecycle/WfVertexDef.java | 6 +- .../com/c2kernel/lifecycle/instance/Activity.java | 92 ++++++++++----------- .../lifecycle/instance/AdvancementCalculator.java | 6 +- .../com/c2kernel/lifecycle/instance/AndSplit.java | 4 +- .../lifecycle/instance/CompositeActivity.java | 36 ++++----- .../java/com/c2kernel/lifecycle/instance/Join.java | 34 ++++---- .../java/com/c2kernel/lifecycle/instance/Loop.java | 8 +- .../com/c2kernel/lifecycle/instance/OrSplit.java | 8 +- .../com/c2kernel/lifecycle/instance/Split.java | 32 ++++---- .../com/c2kernel/lifecycle/instance/WfVertex.java | 48 +++++------ .../com/c2kernel/lifecycle/instance/Workflow.java | 42 +++++----- .../com/c2kernel/lifecycle/instance/XOrSplit.java | 10 +-- .../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 +-- .../instance/stateMachine/StateMachine.java | 12 +-- .../instance/stateMachine/Transition.java | 14 ++-- .../routingHelpers/ViewpointDataHelper.java | 4 +- src/main/java/com/c2kernel/lookup/AgentPath.java | 16 ++-- src/main/java/com/c2kernel/lookup/DomainPath.java | 8 +- src/main/java/com/c2kernel/lookup/ItemPath.java | 4 +- src/main/java/com/c2kernel/lookup/Lookup.java | 30 +++---- .../java/com/c2kernel/lookup/LookupManager.java | 32 ++++---- src/main/java/com/c2kernel/lookup/Path.java | 6 +- src/main/java/com/c2kernel/lookup/RolePath.java | 12 +-- .../persistency/ClusterStorageManager.java | 6 +- .../java/com/c2kernel/persistency/ProxyLoader.java | 4 +- .../java/com/c2kernel/persistency/RemoteMap.java | 4 +- .../c2kernel/persistency/TransactionManager.java | 4 +- .../com/c2kernel/persistency/outcome/Outcome.java | 28 +++---- .../persistency/outcome/OutcomeInitiator.java | 4 +- .../persistency/outcome/OutcomeValidator.java | 12 +-- .../c2kernel/persistency/outcome/Viewpoint.java | 12 +-- src/main/java/com/c2kernel/process/Bootstrap.java | 16 ++-- src/main/java/com/c2kernel/process/Gateway.java | 42 +++++----- .../java/com/c2kernel/process/UserCodeProcess.java | 4 +- .../com/c2kernel/process/auth/Authenticator.java | 20 ++--- .../java/com/c2kernel/process/module/Module.java | 6 +- .../com/c2kernel/process/module/ModuleImport.java | 10 +-- .../com/c2kernel/process/module/ModuleManager.java | 8 +- .../c2kernel/process/module/ModuleResource.java | 12 +-- .../com/c2kernel/process/resource/Resource.java | 20 ++--- .../c2kernel/process/resource/ResourceLoader.java | 8 +- .../c2kernel/property/PropertyDescriptionList.java | 6 +- .../com/c2kernel/property/PropertyUtility.java | 6 +- src/main/java/com/c2kernel/scripting/Script.java | 4 +- src/main/java/com/c2kernel/utils/ActDefCache.java | 10 +-- .../java/com/c2kernel/utils/CastorXMLUtility.java | 14 ++-- .../com/c2kernel/utils/DescriptionObjectCache.java | 8 +- .../java/com/c2kernel/utils/LocalObjectLoader.java | 24 +++--- .../java/com/c2kernel/utils/StateMachineCache.java | 10 +-- 112 files changed, 867 insertions(+), 867 deletions(-) (limited to 'src/main/java/com/c2kernel') diff --git a/src/main/java/com/c2kernel/collection/Aggregation.java b/src/main/java/com/c2kernel/collection/Aggregation.java index b4d1b6b..ea1c182 100644 --- a/src/main/java/com/c2kernel/collection/Aggregation.java +++ b/src/main/java/com/c2kernel/collection/Aggregation.java @@ -21,8 +21,8 @@ package com.c2kernel.collection; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphModel; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.graph.model.TypeNameAndConstructionInfo; @@ -117,7 +117,7 @@ abstract public class Aggregation extends Collection } public AggregationMember addMember(ItemPath itemPath, CastorHashMap props, String classProps, GraphPoint location, int w, int h) - throws InvalidCollectionModification, ObjectAlreadyExists + throws InvalidCollectionModification, ObjectAlreadyExistsException { AggregationMember aggMem = addSlot(props, classProps, location, w, h); if (itemPath != null) { // some clients use this method when not setting a member @@ -130,7 +130,7 @@ abstract public class Aggregation extends Collection @Override - public AggregationMember addMember(ItemPath itemPath, CastorHashMap props, String classProps) throws InvalidCollectionModification, ObjectAlreadyExists + public AggregationMember addMember(ItemPath itemPath, CastorHashMap props, String classProps) throws InvalidCollectionModification, ObjectAlreadyExistsException { return addMember(itemPath, props, classProps, null, -1, -1); } @@ -139,7 +139,7 @@ abstract public class Aggregation extends Collection public AggregationMember addMember(CastorHashMap props, String classProps, GraphPoint location, int w, int h) throws InvalidCollectionModification { try { return addMember(null, props, classProps, location, w, h); - } catch (ObjectAlreadyExists e) { // not assigning an item so this won't happen + } catch (ObjectAlreadyExistsException e) { // not assigning an item so this won't happen return null; } } @@ -150,7 +150,7 @@ abstract public class Aggregation extends Collection } @Override - public void removeMember(int memberId) throws ObjectNotFound { + public void removeMember(int memberId) throws ObjectNotFoundException { for (AggregationMember element : mMembers.list) { if (element.getID() == memberId) { element.clearItem(); @@ -158,7 +158,7 @@ abstract public class Aggregation extends Collection return; } } - throw new ObjectNotFound("Member "+memberId+" not found"); + throw new ObjectNotFoundException("Member "+memberId+" not found"); } static public boolean getIsComposite(ItemPath itemPath, String name) @@ -167,7 +167,7 @@ abstract public class Aggregation extends Collection try { for(String collName: Gateway.getProxyManager().getProxy(itemPath).getContents(ClusterStorage.COLLECTION) ) if (name == null || name.equals(collName)) return true; - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { return false; } return false; diff --git a/src/main/java/com/c2kernel/collection/AggregationDescription.java b/src/main/java/com/c2kernel/collection/AggregationDescription.java index 400a91d..a1f979d 100644 --- a/src/main/java/com/c2kernel/collection/AggregationDescription.java +++ b/src/main/java/com/c2kernel/collection/AggregationDescription.java @@ -27,8 +27,8 @@ package com.c2kernel.collection; */ import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.Vertex; import com.c2kernel.property.PropertyDescriptionList; import com.c2kernel.property.PropertyUtility; @@ -48,7 +48,7 @@ public class AggregationDescription extends Aggregation implements CollectionDes } @Override - public Aggregation newInstance() throws ObjectNotFound + public Aggregation newInstance() throws ObjectNotFoundException { AggregationInstance newInstance = new AggregationInstance(getName()); //for each desc member @@ -65,7 +65,7 @@ public class AggregationDescription extends Aggregation implements CollectionDes Vertex v = getLayout().getVertexById(mem.getID()); newInstance.addMember(null, PropertyUtility.createProperty(pdList), pdList.getClassProps(),v.getCentrePoint(),v.getWidth(),v.getHeight()); } catch (InvalidCollectionModification e) { - } catch (ObjectAlreadyExists e) { } + } catch (ObjectAlreadyExistsException e) { } } else { diff --git a/src/main/java/com/c2kernel/collection/AggregationInstance.java b/src/main/java/com/c2kernel/collection/AggregationInstance.java index 2de6b7f..d2dbf7f 100644 --- a/src/main/java/com/c2kernel/collection/AggregationInstance.java +++ b/src/main/java/com/c2kernel/collection/AggregationInstance.java @@ -26,7 +26,7 @@ package com.c2kernel.collection; */ import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.lookup.ItemPath; import com.c2kernel.utils.CastorHashMap; @@ -47,20 +47,20 @@ public class AggregationInstance extends Aggregation @Override public AggregationMember addMember(ItemPath itemPath, CastorHashMap props, String classProps) - throws InvalidCollectionModification, ObjectAlreadyExists + throws InvalidCollectionModification, ObjectAlreadyExistsException { if( itemPath != null && exists(itemPath)) - throw new ObjectAlreadyExists(itemPath+" already exists in this collection."); + throw new ObjectAlreadyExistsException(itemPath+" already exists in this collection."); else return super.addMember(itemPath, props, classProps); } @Override public AggregationMember addMember(ItemPath itemPath, CastorHashMap props, String classProps, GraphPoint location, int w, int h) - throws InvalidCollectionModification, ObjectAlreadyExists + throws InvalidCollectionModification, ObjectAlreadyExistsException { if( itemPath != null && exists(itemPath)) - throw new ObjectAlreadyExists(itemPath+" already exists in this collection."); + throw new ObjectAlreadyExistsException(itemPath+" already exists in this collection."); else return super.addMember(itemPath, props, classProps, location, w, h); } diff --git a/src/main/java/com/c2kernel/collection/AggregationMember.java b/src/main/java/com/c2kernel/collection/AggregationMember.java index 4a5b8db..903914c 100644 --- a/src/main/java/com/c2kernel/collection/AggregationMember.java +++ b/src/main/java/com/c2kernel/collection/AggregationMember.java @@ -23,7 +23,7 @@ package com.c2kernel.collection; import java.util.StringTokenizer; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.graph.model.GraphableVertex; import com.c2kernel.lookup.InvalidItemPathException; @@ -129,7 +129,7 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb } @Override - public ItemProxy resolveItem() throws ObjectNotFound { + public ItemProxy resolveItem() throws ObjectNotFoundException { if (mItem == null && mItemPath != null) { mItem = Gateway.getProxyManager().getProxy(mItemPath); } @@ -142,7 +142,7 @@ public class AggregationMember extends GraphableVertex implements CollectionMemb if (mItemPath != null) { try { mItemName = resolveItem().getName(); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.error(ex); mItemName = "Error ("+mItemPath+")"; } diff --git a/src/main/java/com/c2kernel/collection/Collection.java b/src/main/java/com/c2kernel/collection/Collection.java index fa0230b..7ab9fb2 100644 --- a/src/main/java/com/c2kernel/collection/Collection.java +++ b/src/main/java/com/c2kernel/collection/Collection.java @@ -23,8 +23,8 @@ package com.c2kernel.collection; import java.util.Iterator; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.graph.model.GraphModel; import com.c2kernel.lookup.ItemPath; @@ -155,12 +155,12 @@ abstract public class Collection implements C2KLocal return true; } - public E getMember(int memberId) throws ObjectNotFound { + public E getMember(int memberId) throws ObjectNotFoundException { for (E element : mMembers.list) { if (element.getID() == memberId) return element; } - throw new ObjectNotFound("Member "+memberId+" not found in "+mName); + throw new ObjectNotFoundException("Member "+memberId+" not found in "+mName); } public CollectionMemberList getMembers() @@ -168,9 +168,9 @@ abstract public class Collection implements C2KLocal return mMembers; } - public abstract E addMember(ItemPath itemPath, CastorHashMap props, String classProps) throws InvalidCollectionModification, ObjectAlreadyExists; + public abstract E addMember(ItemPath itemPath, CastorHashMap props, String classProps) throws InvalidCollectionModification, ObjectAlreadyExistsException; - public abstract void removeMember(int memberId) throws ObjectNotFound; + public abstract void removeMember(int memberId) throws ObjectNotFoundException; @Override public boolean equals(Object other) { @@ -183,7 +183,7 @@ abstract public class Collection implements C2KLocal E thisMem = i.next(); CollectionMember otherMem = otherColl.getMember(thisMem.getID()); if (!thisMem.equals(otherMem)) return false; - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { return false; } } diff --git a/src/main/java/com/c2kernel/collection/CollectionDescription.java b/src/main/java/com/c2kernel/collection/CollectionDescription.java index 0c72b67..6f64abf 100644 --- a/src/main/java/com/c2kernel/collection/CollectionDescription.java +++ b/src/main/java/com/c2kernel/collection/CollectionDescription.java @@ -20,7 +20,7 @@ */ package com.c2kernel.collection; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; /** @@ -33,8 +33,8 @@ public interface CollectionDescription extends C2KLo /** * Create a new instance of this collection. * @return a new collection instance - * @throws ObjectNotFound When an essential piece of description + * @throws ObjectNotFoundException When an essential piece of description * data, such as a child Item PropertyDescription outcome, doesn't exist. */ - public Collection newInstance() throws ObjectNotFound; + public Collection newInstance() throws ObjectNotFoundException; } diff --git a/src/main/java/com/c2kernel/collection/CollectionMember.java b/src/main/java/com/c2kernel/collection/CollectionMember.java index b7b9f31..3925435 100644 --- a/src/main/java/com/c2kernel/collection/CollectionMember.java +++ b/src/main/java/com/c2kernel/collection/CollectionMember.java @@ -21,7 +21,7 @@ package com.c2kernel.collection; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.lookup.ItemPath; import com.c2kernel.utils.CastorHashMap; @@ -70,9 +70,9 @@ public interface CollectionMember { /** * Resolve the Item currently assigned * @return the ItemProxy of the assigned Item - * @throws ObjectNotFound When empty + * @throws ObjectNotFoundException When empty */ - public ItemProxy resolveItem() throws ObjectNotFound; + public ItemProxy resolveItem() throws ObjectNotFoundException; /** * Get the integer slot ID, as generated by the parent Collection diff --git a/src/main/java/com/c2kernel/collection/Dependency.java b/src/main/java/com/c2kernel/collection/Dependency.java index cfcb4f7..1dd777c 100644 --- a/src/main/java/com/c2kernel/collection/Dependency.java +++ b/src/main/java/com/c2kernel/collection/Dependency.java @@ -22,8 +22,8 @@ package com.c2kernel.collection; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.utils.CastorHashMap; import com.c2kernel.utils.KeyValuePair; @@ -84,8 +84,8 @@ public class Dependency extends Collection return mClassProps; } - public DependencyMember addMember(ItemPath itemPath) throws InvalidCollectionModification, ObjectAlreadyExists { - if (contains(itemPath)) throw new ObjectAlreadyExists("Item "+itemPath+" already exists in Dependency "+getName()); + public DependencyMember addMember(ItemPath itemPath) throws InvalidCollectionModification, ObjectAlreadyExistsException { + if (contains(itemPath)) throw new ObjectAlreadyExistsException("Item "+itemPath+" already exists in Dependency "+getName()); // create member object DependencyMember depMember = new DependencyMember(); depMember.setID(getCounter()); @@ -101,9 +101,9 @@ public class Dependency extends Collection @Override public DependencyMember addMember(ItemPath itemPath, CastorHashMap props, String classProps) - throws InvalidCollectionModification, ObjectAlreadyExists + throws InvalidCollectionModification, ObjectAlreadyExistsException { - if (contains(itemPath)) throw new ObjectAlreadyExists("Item "+itemPath+" already exists in Dependency "+getName()); + if (contains(itemPath)) throw new ObjectAlreadyExistsException("Item "+itemPath+" already exists in Dependency "+getName()); if (classProps != null && !classProps.equals(mClassProps)) throw new InvalidCollectionModification("Cannot change classProps in dependency member"); DependencyMember depMember = new DependencyMember(); @@ -133,14 +133,14 @@ public class Dependency extends Collection } @Override - public void removeMember(int memberId) throws ObjectNotFound { + public void removeMember(int memberId) throws ObjectNotFoundException { for (DependencyMember element : mMembers.list) { if (element.getID() == memberId) { mMembers.list.remove(element); return; } } - throw new ObjectNotFound("Member "+memberId+" not found"); + throw new ObjectNotFoundException("Member "+memberId+" not found"); } } diff --git a/src/main/java/com/c2kernel/collection/DependencyDescription.java b/src/main/java/com/c2kernel/collection/DependencyDescription.java index aff2aca..d49b505 100644 --- a/src/main/java/com/c2kernel/collection/DependencyDescription.java +++ b/src/main/java/com/c2kernel/collection/DependencyDescription.java @@ -21,8 +21,8 @@ package com.c2kernel.collection; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.property.PropertyDescriptionList; import com.c2kernel.property.PropertyUtility; @@ -41,7 +41,7 @@ public class DependencyDescription extends Dependency implements CollectionDescr } @Override - public Collection newInstance() throws ObjectNotFound{ + public Collection newInstance() throws ObjectNotFoundException{ String depName = getName().replaceFirst("\'$", ""); // HACK: Knock the special 'prime' off the end for the case of descriptions of descriptions Dependency newDep = new Dependency(depName); if (mMembers.list.size() == 1) { // constrain the members based on the property description @@ -58,14 +58,14 @@ public class DependencyDescription extends Dependency implements CollectionDescr @Override - public DependencyMember addMember(ItemPath itemPath) throws InvalidCollectionModification, ObjectAlreadyExists { + public DependencyMember addMember(ItemPath itemPath) throws InvalidCollectionModification, ObjectAlreadyExistsException { checkMembership(); return super.addMember(itemPath); } @Override public DependencyMember addMember(ItemPath itemPath, CastorHashMap props, String classProps) - throws InvalidCollectionModification, ObjectAlreadyExists { + throws InvalidCollectionModification, ObjectAlreadyExistsException { checkMembership(); return super.addMember(itemPath, props, classProps); } diff --git a/src/main/java/com/c2kernel/collection/DependencyMember.java b/src/main/java/com/c2kernel/collection/DependencyMember.java index 502894f..dbb79e3 100644 --- a/src/main/java/com/c2kernel/collection/DependencyMember.java +++ b/src/main/java/com/c2kernel/collection/DependencyMember.java @@ -23,7 +23,7 @@ package com.c2kernel.collection; import java.util.StringTokenizer; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; @@ -144,7 +144,7 @@ public class DependencyMember implements CollectionMember } @Override - public ItemProxy resolveItem() throws ObjectNotFound { + public ItemProxy resolveItem() throws ObjectNotFoundException { if (mItem == null && mItemPath != null) mItem = Gateway.getProxyManager().getProxy(mItemPath); return mItem; diff --git a/src/main/java/com/c2kernel/entity/CorbaServer.java b/src/main/java/com/c2kernel/entity/CorbaServer.java index 76637c6..22b8e13 100644 --- a/src/main/java/com/c2kernel/entity/CorbaServer.java +++ b/src/main/java/com/c2kernel/entity/CorbaServer.java @@ -27,10 +27,10 @@ import org.omg.PortableServer.POAManager; import org.omg.PortableServer.Servant; import org.omg.PortableServer.POAManagerPackage.AdapterInactive; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.agent.ActiveEntity; import com.c2kernel.entity.agent.ActiveLocator; import com.c2kernel.lookup.AgentPath; @@ -57,7 +57,7 @@ public class CorbaServer { private POA mAgentPOA; private POAManager mPOAManager; - public CorbaServer() throws InvalidData { + public CorbaServer() throws InvalidDataException { mItemCache = new SoftCache(50); // init POA @@ -66,7 +66,7 @@ public class CorbaServer { mPOAManager.activate(); } catch (Exception ex) { Logger.error(ex); - throw new InvalidData("Error initialising POA"); + throw new InvalidDataException("Error initialising POA"); } new Thread(new Runnable() { @@ -136,11 +136,11 @@ public class CorbaServer { /************************************************************************** * Returns a CORBA servant for a pre-existing entity - * @throws ObjectNotFound + * @throws ObjectNotFoundException **************************************************************************/ - public TraceableEntity getItem(ItemPath itemPath) throws ObjectNotFound { + public TraceableEntity getItem(ItemPath itemPath) throws ObjectNotFoundException { Servant item = null; - if (!itemPath.exists()) throw new ObjectNotFound(itemPath+" does not exist"); + if (!itemPath.exists()) throw new ObjectNotFoundException(itemPath+" does not exist"); synchronized (mItemCache) { item = mItemCache.get(itemPath); if (item == null) { @@ -155,9 +155,9 @@ public class CorbaServer { /************************************************************************** * Returns a CORBA servant for a pre-existing entity **************************************************************************/ - public ActiveEntity getAgent(AgentPath agentPath) throws InvalidAgentPathException, ObjectNotFound { + public ActiveEntity getAgent(AgentPath agentPath) throws InvalidAgentPathException, ObjectNotFoundException { Servant agent = null; - if (!agentPath.exists()) throw new ObjectNotFound(agentPath+" does not exist"); + if (!agentPath.exists()) throw new ObjectNotFoundException(agentPath+" does not exist"); synchronized (mItemCache) { agent = mItemCache.get(agentPath); if (agent == null) { @@ -175,9 +175,9 @@ public class CorbaServer { * @param itemPath * @return */ - public TraceableEntity createItem(ItemPath itemPath) throws CannotManage, ObjectAlreadyExists { + public TraceableEntity createItem(ItemPath itemPath) throws CannotManageException, ObjectAlreadyExistsException { - if (itemPath.exists()) throw new ObjectAlreadyExists(); + if (itemPath.exists()) throw new ObjectAlreadyExistsException(); org.omg.CORBA.Object obj = mItemPOA.create_reference_with_id(itemPath.getOID(), ItemHelper.id()); itemPath.setIOR(obj); TraceableEntity item = new TraceableEntity(itemPath, mItemPOA); @@ -187,8 +187,8 @@ public class CorbaServer { return item; } - public ActiveEntity createAgent(AgentPath agentPath) throws CannotManage, ObjectAlreadyExists { - if (agentPath.exists()) throw new ObjectAlreadyExists(); + public ActiveEntity createAgent(AgentPath agentPath) throws CannotManageException, ObjectAlreadyExistsException { + if (agentPath.exists()) throw new ObjectAlreadyExistsException(); org.omg.CORBA.Object obj = mAgentPOA.create_reference_with_id(agentPath.getOID(), AgentHelper.id()); agentPath.setIOR(obj); ActiveEntity agent; diff --git a/src/main/java/com/c2kernel/entity/ItemImplementation.java b/src/main/java/com/c2kernel/entity/ItemImplementation.java index a33607b..9098e2a 100644 --- a/src/main/java/com/c2kernel/entity/ItemImplementation.java +++ b/src/main/java/com/c2kernel/entity/ItemImplementation.java @@ -26,10 +26,10 @@ import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionArrayList; import com.c2kernel.common.AccessRightsException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.common.SystemKey; import com.c2kernel.entity.agent.JobArrayList; @@ -74,7 +74,7 @@ public class ItemImplementation implements ItemOperations { @Override public void initialise(SystemKey agentId, String propString, String initWfString, String initCollsString) throws AccessRightsException, - InvalidData, PersistencyException + InvalidDataException, PersistencyException { Logger.msg(5, "Item::initialise("+mItemPath+") - agent:"+agentId); Object locker = new Object(); @@ -88,7 +88,7 @@ public class ItemImplementation implements ItemOperations { // must supply properties if (propString == null || propString.length() == 0) { - throw new InvalidData("No properties supplied"); + throw new InvalidDataException("No properties supplied"); } // store properties @@ -102,7 +102,7 @@ public class ItemImplementation implements ItemOperations { + ") - Properties were invalid: " + propString); Logger.error(ex); mStorage.abort(locker); - throw new InvalidData("Properties were invalid"); + throw new InvalidDataException("Properties were invalid"); } // Store an event and the initial properties @@ -138,7 +138,7 @@ public class ItemImplementation implements ItemOperations { + ") - Workflow was invalid: " + initWfString); Logger.error(ex); mStorage.abort(locker); - throw new InvalidData("Workflow was invalid"); + throw new InvalidDataException("Workflow was invalid"); } // init collections @@ -155,7 +155,7 @@ public class ItemImplementation implements ItemOperations { + initCollsString); Logger.error(ex); mStorage.abort(locker); - throw new InvalidData("Collections were invalid"); + throw new InvalidDataException("Collections were invalid"); } } @@ -173,9 +173,9 @@ public class ItemImplementation implements ItemOperations { @Override public String requestAction(SystemKey agentId, String stepPath, int transitionID, String requestData) throws AccessRightsException, - InvalidTransition, ObjectNotFound, - InvalidData, PersistencyException, - ObjectAlreadyExists, InvalidCollectionModification { + InvalidTransitionException, ObjectNotFoundException, + InvalidDataException, PersistencyException, + ObjectAlreadyExistsException, InvalidCollectionModification { try { @@ -200,21 +200,21 @@ public class ItemImplementation implements ItemOperations { } catch (AccessRightsException ex) { Logger.msg("Propagating AccessRightsException back to the calling agent"); throw ex; - } catch (InvalidTransition ex) { + } catch (InvalidTransitionException ex) { Logger.msg("Propagating InvalidTransitionException back to the calling agent"); throw ex; - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.msg("Propagating ObjectNotFoundException back to the calling agent"); throw ex; // errors } catch (InvalidItemPathException ex) { Logger.error(ex); throw new AccessRightsException("Invalid Agent Id: " + agentId); - } catch (InvalidData ex) { + } catch (InvalidDataException ex) { Logger.error(ex); Logger.msg("Propagating InvalidDataException back to the calling agent"); throw ex; - } catch (ObjectAlreadyExists ex) { + } catch (ObjectAlreadyExistsException ex) { Logger.error(ex); Logger.msg("Propagating ObjectAlreadyExistsException back to the calling agent"); throw ex; @@ -226,7 +226,7 @@ public class ItemImplementation implements ItemOperations { Logger.error("Unknown Error: requestAction on " + mItemPath + " by " + agentId + " executing " + stepPath); Logger.error(ex); - throw new InvalidData( + throw new InvalidDataException( "Extraordinary Exception during execution:" + ex.getClass().getName() + " - " + ex.getMessage()); @@ -235,7 +235,7 @@ public class ItemImplementation implements ItemOperations { @Override public String queryLifeCycle(SystemKey agentId, boolean filter) - throws AccessRightsException, ObjectNotFound, + throws AccessRightsException, ObjectNotFoundException, PersistencyException { Logger.msg(1, "TraceableEntity::queryLifeCycle(" + mItemPath + ") - agent: " + agentId); @@ -275,7 +275,7 @@ public class ItemImplementation implements ItemOperations { @Override public String queryData(String path) throws AccessRightsException, - ObjectNotFound, PersistencyException { + ObjectNotFoundException, PersistencyException { String result = ""; @@ -303,7 +303,7 @@ public class ItemImplementation implements ItemOperations { // marshall it, or in the case of an outcome get the data. result = Gateway.getMarshaller().marshall(obj); } - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { throw ex; } catch (Throwable ex) { Logger.warning("TraceableEntity::queryData(" + mItemPath diff --git a/src/main/java/com/c2kernel/entity/TraceableEntity.java b/src/main/java/com/c2kernel/entity/TraceableEntity.java index 18bb987..7d5df52 100644 --- a/src/main/java/com/c2kernel/entity/TraceableEntity.java +++ b/src/main/java/com/c2kernel/entity/TraceableEntity.java @@ -23,10 +23,10 @@ package com.c2kernel.entity; import com.c2kernel.common.AccessRightsException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.common.SystemKey; import com.c2kernel.lookup.ItemPath; @@ -110,7 +110,7 @@ public class TraceableEntity extends ItemPOA String initCollsString ) throws AccessRightsException, - InvalidData, + InvalidDataException, PersistencyException { synchronized (this) { @@ -130,11 +130,11 @@ public class TraceableEntity extends ItemPOA String requestData ) throws AccessRightsException, - InvalidTransition, - ObjectNotFound, - InvalidData, + InvalidTransitionException, + ObjectNotFoundException, + InvalidDataException, PersistencyException, - ObjectAlreadyExists, InvalidCollectionModification + ObjectAlreadyExistsException, InvalidCollectionModification { synchronized (this) { return mItemImpl.requestAction(agentId, stepPath, transitionID, requestData); @@ -149,7 +149,7 @@ public class TraceableEntity extends ItemPOA boolean filter ) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { synchronized (this) { @@ -166,12 +166,12 @@ public class TraceableEntity extends ItemPOA * @return The result string in xml format * except 'all' which returns a comma sep list * - * @exception ObjectNotFound + * @exception ObjectNotFoundException * ************************************************************************/ @Override public String queryData(String path) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { synchronized (this) { diff --git a/src/main/java/com/c2kernel/entity/TraceableLocator.java b/src/main/java/com/c2kernel/entity/TraceableLocator.java index 4fc695e..faad884 100644 --- a/src/main/java/com/c2kernel/entity/TraceableLocator.java +++ b/src/main/java/com/c2kernel/entity/TraceableLocator.java @@ -24,7 +24,7 @@ package com.c2kernel.entity; import java.nio.ByteBuffer; import java.sql.Timestamp; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.SystemKey; import com.c2kernel.lookup.ItemPath; import com.c2kernel.process.Gateway; @@ -68,7 +68,7 @@ public class TraceableLocator extends org.omg.PortableServer.ServantLocatorPOA try { return Gateway.getCorbaServer().getItem(syskey); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.error("ObjectNotFoundException::TraceableLocator::preinvoke() " + ex.toString()); throw new org.omg.CORBA.OBJECT_NOT_EXIST(); } diff --git a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java index 4f3f622..feb8880 100644 --- a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java +++ b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java @@ -21,12 +21,12 @@ package com.c2kernel.entity.agent; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.common.SystemKey; import com.c2kernel.entity.AgentPOA; @@ -86,7 +86,7 @@ public class ActiveEntity extends AgentPOA @Override public String queryData(String path) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { synchronized (this) { @@ -108,14 +108,14 @@ public class ActiveEntity extends AgentPOA } @Override - public void addRole(String roleName) throws CannotManage, ObjectNotFound { + public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException { synchronized (this) { mAgentImpl.addRole(roleName); } } @Override - public void removeRole(String roleName) throws CannotManage, ObjectNotFound { + public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException { synchronized (this) { mAgentImpl.removeRole(roleName); } @@ -124,7 +124,7 @@ public class ActiveEntity extends AgentPOA @Override public void initialise(SystemKey agentId, String propString, String initWfString, String initCollsString) throws AccessRightsException, - InvalidData, PersistencyException, ObjectNotFound { + InvalidDataException, PersistencyException, ObjectNotFoundException { synchronized (this) { mAgentImpl.initialise(agentId, propString, initWfString, initCollsString); } @@ -134,9 +134,9 @@ public class ActiveEntity extends AgentPOA @Override public String requestAction(SystemKey agentID, String stepPath, int transitionID, String requestData) throws AccessRightsException, - InvalidTransition, ObjectNotFound, - InvalidData, PersistencyException, - ObjectAlreadyExists, InvalidCollectionModification { + InvalidTransitionException, ObjectNotFoundException, + InvalidDataException, PersistencyException, + ObjectAlreadyExistsException, InvalidCollectionModification { synchronized (this) { return mAgentImpl.requestAction(agentID, stepPath, transitionID, requestData); @@ -146,7 +146,7 @@ public class ActiveEntity extends AgentPOA @Override public String queryLifeCycle(SystemKey agentId, boolean filter) - throws AccessRightsException, ObjectNotFound, + throws AccessRightsException, ObjectNotFoundException, PersistencyException { synchronized (this) { return mAgentImpl.queryLifeCycle(agentId, filter); diff --git a/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java b/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java index 4b389ec..ecc9d42 100644 --- a/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java +++ b/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java @@ -24,7 +24,7 @@ package com.c2kernel.entity.agent; import java.nio.ByteBuffer; import java.sql.Timestamp; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.SystemKey; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.InvalidItemPathException; @@ -73,7 +73,7 @@ public class ActiveLocator extends org.omg.PortableServer.ServantLocatorPOA return Gateway.getCorbaServer().getAgent(syskey); } - catch (ObjectNotFound ex) + catch (ObjectNotFoundException ex) { Logger.error("ObjectNotFoundException::ActiveLocator::preinvoke() "+ex.toString()); throw new org.omg.CORBA.OBJECT_NOT_EXIST(); diff --git a/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java b/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java index 97f5ae4..c9eee73 100644 --- a/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java +++ b/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java @@ -20,9 +20,9 @@ */ package com.c2kernel.entity.agent; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.SystemKey; import com.c2kernel.entity.AgentOperations; import com.c2kernel.entity.ItemImplementation; @@ -77,22 +77,22 @@ public class AgentImplementation extends ItemImplementation implements } @Override - public void addRole(String roleName) throws CannotManage, ObjectNotFound { + public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException { RolePath newRole = Gateway.getLookup().getRolePath(roleName); try { Gateway.getLookupManager().addRole(mAgentPath, newRole); } catch (ObjectCannotBeUpdated ex) { - throw new CannotManage("Could not update role"); + throw new CannotManageException("Could not update role"); } } @Override - public void removeRole(String roleName) throws CannotManage, ObjectNotFound { + public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException { RolePath rolePath = Gateway.getLookup().getRolePath(roleName); try { Gateway.getLookupManager().removeRole(mAgentPath, rolePath); } catch (ObjectCannotBeUpdated ex) { - throw new CannotManage("Could not update role"); + throw new CannotManageException("Could not update role"); } } diff --git a/src/main/java/com/c2kernel/entity/agent/Job.java b/src/main/java/com/c2kernel/entity/agent/Job.java index 7172bbb..72c46eb 100644 --- a/src/main/java/com/c2kernel/entity/agent/Job.java +++ b/src/main/java/com/c2kernel/entity/agent/Job.java @@ -22,8 +22,8 @@ package com.c2kernel.entity.agent; import java.util.HashMap; -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.entity.proxy.ItemProxy; @@ -100,7 +100,7 @@ public class Job implements C2KLocalObject { } - public Job(Activity act, ItemPath itemPath, Transition transition, AgentPath agent, String role) throws InvalidData, ObjectNotFound, InvalidAgentPathException { + public Job(Activity act, ItemPath itemPath, Transition transition, AgentPath agent, String role) throws InvalidDataException, ObjectNotFoundException, InvalidAgentPathException { setItemPath(itemPath); setStepPath(act.getPath()); @@ -192,7 +192,7 @@ public class Job implements C2KLocalObject this.transition = transition; } - public AgentPath getAgentPath() throws ObjectNotFound { + public AgentPath getAgentPath() throws ObjectNotFoundException { if (agentPath == null && getAgentName() != null) { agentPath = Gateway.getLookup().getAgentPath(getAgentName()); } @@ -218,7 +218,7 @@ public class Job implements C2KLocalObject try { if (getAgentPath() != null) return getAgentPath().getUUID().toString(); - } catch (ObjectNotFound e) { } + } catch (ObjectNotFoundException e) { } return null; } @@ -229,7 +229,7 @@ public class Job implements C2KLocalObject return agentName; } - public void setAgentName(String agentName) throws ObjectNotFound + public void setAgentName(String agentName) throws ObjectNotFoundException { this.agentName = agentName; agentPath = Gateway.getLookup().getAgentPath(agentName); @@ -243,7 +243,7 @@ public class Job implements C2KLocalObject agentRole = role; } - public String getSchemaName() throws InvalidData, ObjectNotFound { + public String getSchemaName() throws InvalidDataException, ObjectNotFoundException { if (transition.hasOutcome(actProps)) { Schema schema = transition.getSchema(actProps); return schema.docType; @@ -251,7 +251,7 @@ public class Job implements C2KLocalObject return null; } - public int getSchemaVersion() throws InvalidData, ObjectNotFound { + public int getSchemaVersion() throws InvalidDataException, ObjectNotFoundException { if (transition.hasOutcome(actProps)) { Schema schema = transition.getSchema(actProps); return schema.docVersion; @@ -271,7 +271,7 @@ public class Job implements C2KLocalObject return null; } - public int getScriptVersion() throws InvalidData { + public int getScriptVersion() throws InvalidDataException { if (transition.hasScript(actProps)) { return transition.getScriptVersion(actProps); } @@ -303,7 +303,7 @@ public class Job implements C2KLocalObject } } - public ItemProxy getItemProxy() throws ObjectNotFound, InvalidItemPathException { + public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidItemPathException { if (item == null) item = Gateway.getProxyManager().getProxy(itemPath); return item; @@ -333,26 +333,26 @@ public class Job implements C2KLocalObject } } - public String getLastView() throws InvalidData { + public String getLastView() throws InvalidDataException { String viewName = (String) getActProp("Viewpoint"); if (viewName.length() > 0) { // find schema String schemaName; try { schemaName = getSchemaName(); - } catch (ObjectNotFound e1) { - throw new InvalidData("Schema "+getActProp("SchemaType")+" v"+getActProp("SchemaVersion")+" not found"); + } catch (ObjectNotFoundException e1) { + throw new InvalidDataException("Schema "+getActProp("SchemaType")+" v"+getActProp("SchemaVersion")+" not found"); } try { Viewpoint view = (Viewpoint) Gateway.getStorage().get(itemPath, ClusterStorage.VIEWPOINT + "/" + schemaName + "/" + viewName, null); return view.getOutcome().getData(); - } catch (ObjectNotFound ex) { // viewpoint doesn't exist yet + } catch (ObjectNotFoundException ex) { // viewpoint doesn't exist yet return null; } catch (PersistencyException e) { Logger.error(e); - throw new InvalidData("ViewpointOutcomeInitiator: PersistencyException loading viewpoint " + throw new InvalidDataException("ViewpointOutcomeInitiator: PersistencyException loading viewpoint " + ClusterStorage.VIEWPOINT + "/" + schemaName + "/" + viewName+" in item "+itemPath.getUUID()); } } @@ -360,7 +360,7 @@ public class Job implements C2KLocalObject return null; } - public OutcomeInitiator getOutcomeInitiator() throws InvalidData { + public OutcomeInitiator getOutcomeInitiator() throws InvalidDataException { String ocInitName = (String) getActProp("OutcomeInit"); OutcomeInitiator ocInit; if (ocInitName.length() > 0) { @@ -370,13 +370,13 @@ public class Job implements C2KLocalObject if (ocInit == null) { Object ocInitObj; if (!Gateway.getProperties().containsKey(ocPropName)) { - throw new InvalidData("Outcome instantiator "+ocPropName+" isn't defined"); + throw new InvalidDataException("Outcome instantiator "+ocPropName+" isn't defined"); } try { ocInitObj = Gateway.getProperties().getInstance(ocPropName); } catch (Exception e) { Logger.error(e); - throw new InvalidData("Outcome instantiator "+ocPropName+" couldn't be instantiated"); + throw new InvalidDataException("Outcome instantiator "+ocPropName+" couldn't be instantiated"); } ocInit = (OutcomeInitiator)ocInitObj; // throw runtime class cast if it isn't one ocInitCache.put(ocPropName, ocInit); @@ -388,7 +388,7 @@ public class Job implements C2KLocalObject return null; } - public String getOutcomeString() throws InvalidData + public String getOutcomeString() throws InvalidDataException { if (outcomeData == null && transition.hasOutcome(actProps)) { outcomeData = getLastView(); @@ -402,7 +402,7 @@ public class Job implements C2KLocalObject return outcomeData; } - public Outcome getOutcome() throws InvalidData, ObjectNotFound + public Outcome getOutcome() throws InvalidDataException, ObjectNotFoundException { return new Outcome(-1, getOutcomeString(), getSchemaName(), getSchemaVersion()); } diff --git a/src/main/java/com/c2kernel/entity/imports/ImportAgent.java b/src/main/java/com/c2kernel/entity/imports/ImportAgent.java index 33619fa..70a5d91 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportAgent.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportAgent.java @@ -22,10 +22,10 @@ package com.c2kernel.entity.imports; import java.util.ArrayList; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.agent.ActiveEntity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -51,7 +51,7 @@ public class ImportAgent extends ModuleImport { } @Override - public void create(AgentPath agentPath, boolean reset) throws ObjectNotFound, ObjectCannotBeUpdated, CannotManage, ObjectAlreadyExists { + public void create(AgentPath agentPath, boolean reset) throws ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, ObjectAlreadyExistsException { AgentPath newAgent = new AgentPath(getItemPath(), name); newAgent.setPassword(password); ActiveEntity newAgentEnt = Gateway.getCorbaServer().createAgent(newAgent); @@ -63,14 +63,14 @@ public class ImportAgent extends ModuleImport { newAgentEnt.initialise(agentPath.getSystemKey(), Gateway.getMarshaller().marshall(new PropertyArrayList(properties)), null, null); } catch (Exception ex) { Logger.error(ex); - throw new CannotManage("Error initialising new agent"); + throw new CannotManageException("Error initialising new agent"); } for (String role : roles) { RolePath thisRole; try { thisRole = Gateway.getLookup().getRolePath(role); - } catch (ObjectNotFound ex) { - throw new ObjectNotFound("Role "+role+" does not exist."); + } catch (ObjectNotFoundException ex) { + throw new ObjectNotFoundException("Role "+role+" does not exist."); } Gateway.getLookupManager().addRole(newAgent, thisRole); } @@ -83,7 +83,7 @@ public class ImportAgent extends ModuleImport { try { AgentPath existAgent = Gateway.getLookup().getAgentPath(name); itemPath = existAgent; - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { itemPath = new AgentPath(new ItemPath(), name); } } diff --git a/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java b/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java index 5d2c350..cd114ed 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java @@ -26,8 +26,8 @@ import com.c2kernel.collection.Aggregation; import com.c2kernel.collection.AggregationDescription; import com.c2kernel.collection.AggregationInstance; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.InvalidItemPathException; @@ -53,7 +53,7 @@ public class ImportAggregation { this.isDescription = isDescription; } - public com.c2kernel.collection.Aggregation create() throws InvalidCollectionModification, ObjectNotFound, ObjectAlreadyExists { + public com.c2kernel.collection.Aggregation create() throws InvalidCollectionModification, ObjectNotFoundException, ObjectAlreadyExistsException { Aggregation newAgg = isDescription?new AggregationDescription(name):new AggregationInstance(name); if (version!= null) newAgg.setVersion(version); for (ImportAggregationMember thisMem : aggregationMemberList) { diff --git a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java index 7373bdb..01900d3 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java @@ -25,8 +25,8 @@ import java.util.ArrayList; import com.c2kernel.collection.Dependency; import com.c2kernel.collection.DependencyDescription; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; @@ -65,9 +65,9 @@ public class ImportDependency { /** * @return - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException */ - public com.c2kernel.collection.Dependency create() throws InvalidCollectionModification, ObjectNotFound, ObjectAlreadyExists { + public com.c2kernel.collection.Dependency create() throws InvalidCollectionModification, ObjectNotFoundException, ObjectAlreadyExistsException { Dependency newDep = isDescription?new DependencyDescription(name):new Dependency(name); if (version!= null) newDep.setVersion(version); if (itemDescriptionPath != null && itemDescriptionPath.length()>0) { diff --git a/src/main/java/com/c2kernel/entity/imports/ImportItem.java b/src/main/java/com/c2kernel/entity/imports/ImportItem.java index 74362d5..0e067f8 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportItem.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportItem.java @@ -29,12 +29,12 @@ import org.custommonkey.xmlunit.XMLUnit; import com.c2kernel.collection.Aggregation; import com.c2kernel.collection.CollectionArrayList; import com.c2kernel.collection.Dependency; -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.common.PersistencyException; import com.c2kernel.entity.TraceableEntity; import com.c2kernel.events.Event; @@ -90,7 +90,7 @@ public class ImportItem extends ModuleImport { if (existingItem.exists()) { try { itemPath = existingItem.getItemPath(); - } catch (ObjectNotFound ex) { } + } catch (ObjectNotFoundException ex) { } } } if (itemPath == null) itemPath = new ItemPath(); @@ -109,12 +109,12 @@ public class ImportItem extends ModuleImport { } @Override - public void create(AgentPath agentPath, boolean reset) throws ObjectCannotBeUpdated, ObjectNotFound, CannotManage, ObjectAlreadyExists, InvalidCollectionModification { + public void create(AgentPath agentPath, boolean reset) throws ObjectCannotBeUpdated, ObjectNotFoundException, CannotManageException, ObjectAlreadyExistsException, InvalidCollectionModification { DomainPath domPath = new DomainPath(new DomainPath(initialPath), name); if (domPath.exists()) { ItemPath domItem = domPath.getItemPath(); if (!getItemPath().equals(domItem)) - throw new CannotManage("Item "+domPath+" was found with the wrong itemPath ("+domPath.getItemPath()+" vs "+getItemPath()+")"); + throw new CannotManageException("Item "+domPath+" was found with the wrong itemPath ("+domPath.getItemPath()+" vs "+getItemPath()+")"); } TraceableEntity newItem; @@ -139,10 +139,10 @@ public class ImportItem extends ModuleImport { else usedWfVer = workflowVer.intValue(); try { compact = (CompositeActivityDef)LocalObjectLoader.getActDef(workflow, usedWfVer); - } catch (ObjectNotFound ex) { - throw new CannotManage("Could not find workflow "+workflow+"v"+usedWfVer+" for item "+domPath); - } catch (InvalidData e) { - throw new CannotManage("Workflow def "+workflow+" v"+usedWfVer+" for item "+domPath+" was not valid"); + } catch (ObjectNotFoundException ex) { + throw new CannotManageException("Could not find workflow "+workflow+"v"+usedWfVer+" for item "+domPath); + } catch (InvalidDataException e) { + throw new CannotManageException("Workflow def "+workflow+" v"+usedWfVer+" for item "+domPath+" was not valid"); } // create collections @@ -167,7 +167,7 @@ public class ImportItem extends ModuleImport { } catch (Exception ex) { Logger.error("Error initialising new item "+name ); Logger.error(ex); - throw new CannotManage("Problem initialising new item. See server log."); + throw new CannotManageException("Problem initialising new item. See server log."); } // import outcomes @@ -192,12 +192,12 @@ public class ImportItem extends ModuleImport { continue; } } - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.msg(3, "View "+thisOutcome.schema+"/"+thisOutcome.viewname+" not found in "+name+". Creating."); impView = new Viewpoint(getItemPath(), thisOutcome.schema, thisOutcome.viewname, thisOutcome.version, -1); } catch (PersistencyException e) { throw new ObjectCannotBeUpdated("Could not check data for view "+thisOutcome.schema+"/"+thisOutcome.viewname+" in "+name); - } catch (InvalidData e) { + } catch (InvalidDataException e) { throw new ObjectCannotBeUpdated("Could not check previous event for view "+thisOutcome.schema+"/"+thisOutcome.viewname+" in "+name); } diff --git a/src/main/java/com/c2kernel/entity/imports/ImportOutcome.java b/src/main/java/com/c2kernel/entity/imports/ImportOutcome.java index 915f52d..60279dc 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportOutcome.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportOutcome.java @@ -20,7 +20,7 @@ */ package com.c2kernel.entity.imports; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.process.Gateway; public class ImportOutcome { @@ -38,7 +38,7 @@ public class ImportOutcome { this.path = path; } - public String getData(String ns) throws ObjectNotFound { + public String getData(String ns) throws ObjectNotFoundException { if (data == null) data = Gateway.getResource().getTextResource(ns, path); return data; diff --git a/src/main/java/com/c2kernel/entity/imports/ImportRole.java b/src/main/java/com/c2kernel/entity/imports/ImportRole.java index 2c24887..3583b0b 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportRole.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportRole.java @@ -22,10 +22,10 @@ package com.c2kernel.entity.imports; import java.util.Iterator; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.Path; import com.c2kernel.lookup.RolePath; @@ -40,7 +40,7 @@ public class ImportRole extends ModuleImport { } @Override - public void create(AgentPath agentPath, boolean reset) throws ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, ObjectNotFound { + public void create(AgentPath agentPath, boolean reset) throws ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, ObjectNotFoundException { RolePath parent = new RolePath(); if (name.indexOf('/') > -1) { String[] roleComp = name.split("/"); @@ -55,7 +55,7 @@ public class ImportRole extends ModuleImport { break; } } - if (!found) throw new ObjectNotFound("Parent role "+roleComp[i]+" was not found"); + if (!found) throw new ObjectNotFoundException("Parent role "+roleComp[i]+" was not found"); } name = roleComp[roleComp.length-1]; } diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index 7e6b3e4..df26ab5 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -25,10 +25,10 @@ import java.util.Iterator; import com.c2kernel.common.AccessRightsException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.Agent; import com.c2kernel.entity.AgentHelper; @@ -69,7 +69,7 @@ public class AgentProxy extends ItemProxy **************************************************************************/ protected AgentProxy( org.omg.CORBA.Object ior, AgentPath agentPath) - throws ObjectNotFound + throws ObjectNotFoundException { super(ior, agentPath); mAgentPath = agentPath; @@ -84,12 +84,12 @@ public class AgentProxy extends ItemProxy } @Override - public Agent narrow() throws ObjectNotFound + public Agent narrow() throws ObjectNotFoundException { try { return AgentHelper.narrow(mIOR); } catch (org.omg.CORBA.BAD_PARAM ex) { } - throw new ObjectNotFound("CORBA Object was not an Agent, or the server is down."); + throw new ObjectNotFoundException("CORBA Object was not an Agent, or the server is down."); } /** @@ -98,21 +98,21 @@ public class AgentProxy extends ItemProxy * * @param job * @throws AccessRightsException - * @throws InvalidData - * @throws InvalidTransition - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws InvalidTransitionException + * @throws ObjectNotFoundException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ScriptErrorException * @throws InvalidCollectionModification */ public String execute(Job job) throws AccessRightsException, - InvalidData, - InvalidTransition, - ObjectNotFound, + InvalidDataException, + InvalidTransitionException, + ObjectNotFoundException, PersistencyException, - ObjectAlreadyExists, + ObjectAlreadyExistsException, ScriptErrorException, InvalidCollectionModification { ItemProxy item = Gateway.getProxyManager().getProxy(job.getItemPath()); @@ -130,12 +130,12 @@ public class AgentProxy extends ItemProxy Schema schema = LocalObjectLoader.getSchema(schemaName, schemaVersion); if (schema == null) - throw new InvalidData("Job references outcome type "+schemaName+" version "+schemaVersion+" that does not exist in this centre."); + throw new InvalidDataException("Job references outcome type "+schemaName+" version "+schemaVersion+" that does not exist in this centre."); try { validator = OutcomeValidator.getValidator(schema); } catch (Exception e) { - throw new InvalidData("Could not create validator: "+e.getMessage()); + throw new InvalidDataException("Could not create validator: "+e.getMessage()); } } @@ -149,7 +149,7 @@ public class AgentProxy extends ItemProxy String error = validator.validate(job.getOutcomeString()); if (error.length() > 0) { Logger.error("Outcome not valid: \n " + error); - throw new InvalidData(error); + throw new InvalidDataException(error); } } @@ -164,7 +164,7 @@ public class AgentProxy extends ItemProxy Logger.warning("Script errors: "+errorString); } catch (ScriptingEngineException ex) { Logger.error(ex); - throw new InvalidData(ex.getMessage()); + throw new InvalidDataException(ex.getMessage()); } } @@ -172,7 +172,7 @@ public class AgentProxy extends ItemProxy Logger.msg(3, "AgentProxy - validating outcome"); String error = validator.validate(job.getOutcomeString()); if (error.length() > 0) - throw new InvalidData(error); + throw new InvalidDataException(error); } job.setAgentPath(mAgentPath); @@ -194,18 +194,18 @@ public class AgentProxy extends ItemProxy public String execute(ItemProxy item, String predefStep, C2KLocalObject obj) throws AccessRightsException, - InvalidData, - InvalidTransition, - ObjectNotFound, + InvalidDataException, + InvalidTransitionException, + ObjectNotFoundException, PersistencyException, - ObjectAlreadyExists, InvalidCollectionModification + ObjectAlreadyExistsException, InvalidCollectionModification { String param; try { param = marshall(obj); } catch (Exception ex) { Logger.error(ex); - throw new InvalidData("Error on marshall"); + throw new InvalidDataException("Error on marshall"); } return execute(item, predefStep, param); } @@ -222,20 +222,20 @@ public class AgentProxy extends ItemProxy * @return The outcome after processing. May have been altered by the step. * * @throws AccessRightsException The agent was not allowed to execute this step - * @throws InvalidData The parameters supplied were incorrect - * @throws InvalidTransition The step wasn't available - * @throws ObjectNotFound Thrown by some steps that try to locate additional objects + * @throws InvalidDataException The parameters supplied were incorrect + * @throws InvalidTransitionException The step wasn't available + * @throws ObjectNotFoundException Thrown by some steps that try to locate additional objects * @throws PersistencyException Problem writing or reading the database - * @throws ObjectAlreadyExists Thrown by steps that create additional object + * @throws ObjectAlreadyExistsException Thrown by steps that create additional object * @throws InvalidCollectionModification */ public String execute(ItemProxy item, String predefStep, String[] params) throws AccessRightsException, - InvalidData, - InvalidTransition, - ObjectNotFound, + InvalidDataException, + InvalidTransitionException, + ObjectNotFoundException, PersistencyException, - ObjectAlreadyExists, InvalidCollectionModification + ObjectAlreadyExistsException, InvalidCollectionModification { String schemaName = PredefinedStep.getPredefStepSchemaName(predefStep); String param; @@ -257,21 +257,21 @@ public class AgentProxy extends ItemProxy * @param param * @return * @throws AccessRightsException - * @throws InvalidData - * @throws InvalidTransition - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws InvalidTransitionException + * @throws ObjectNotFoundException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws InvalidCollectionModification */ public String execute(ItemProxy item, String predefStep, String param) throws AccessRightsException, - InvalidData, - InvalidTransition, - ObjectNotFound, + InvalidDataException, + InvalidTransitionException, + ObjectNotFoundException, PersistencyException, - ObjectAlreadyExists, InvalidCollectionModification + ObjectAlreadyExistsException, InvalidCollectionModification { return execute(item, predefStep, new String[] {param }); } @@ -286,24 +286,24 @@ public class AgentProxy extends ItemProxy } /** Let scripts resolve items */ - public ItemProxy searchItem(String name) throws ObjectNotFound { + public ItemProxy searchItem(String name) throws ObjectNotFoundException { Iterator results = Gateway.getLookup().search(new DomainPath(""),name); Path returnPath = null; if (!results.hasNext()) - throw new ObjectNotFound(name); + throw new ObjectNotFoundException(name); while(results.hasNext()) { Path nextMatch = results.next(); if (returnPath != null && nextMatch.getUUID() != null && !returnPath.getUUID().equals(nextMatch.getUUID())) - throw new ObjectNotFound("Too many items with that name"); + throw new ObjectNotFoundException("Too many items with that name"); returnPath = nextMatch; } return Gateway.getProxyManager().getProxy(returnPath); } - public ItemProxy getItem(String itemPath) throws ObjectNotFound { + public ItemProxy getItem(String itemPath) throws ObjectNotFoundException { return (getItem(new DomainPath(itemPath))); } @@ -312,11 +312,11 @@ public class AgentProxy extends ItemProxy return mAgentPath; } - public ItemProxy getItem(Path itemPath) throws ObjectNotFound { + public ItemProxy getItem(Path itemPath) throws ObjectNotFoundException { return Gateway.getProxyManager().getProxy(itemPath); } - public ItemProxy getItemByUUID(String uuid) throws ObjectNotFound, InvalidItemPathException { + public ItemProxy getItemByUUID(String uuid) throws ObjectNotFoundException, InvalidItemPathException { return Gateway.getProxyManager().getProxy(new ItemPath(uuid)); } } diff --git a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java index f5b0be7..7a2d930 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java @@ -33,10 +33,10 @@ import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionArrayList; import com.c2kernel.common.AccessRightsException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectAlreadyExistsException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.Item; @@ -89,18 +89,18 @@ public class ItemProxy return mItemPath; } - protected Item getItem() throws ObjectNotFound { + protected Item getItem() throws ObjectNotFoundException { if (mItem == null) mItem = narrow(); return mItem; } - public Item narrow() throws ObjectNotFound + public Item narrow() throws ObjectNotFoundException { try { return ItemHelper.narrow(mIOR); } catch (org.omg.CORBA.BAD_PARAM ex) { } - throw new ObjectNotFound("CORBA Object was not an Item, or the server is down."); + throw new ObjectNotFoundException("CORBA Object was not an Item, or the server is down."); } public void initialise( AgentPath agentId, @@ -108,11 +108,11 @@ public class ItemProxy CompositeActivity workflow, CollectionArrayList colls ) - throws AccessRightsException, InvalidData, PersistencyException, ObjectNotFound, MarshalException, ValidationException, IOException, MappingException, InvalidCollectionModification + throws AccessRightsException, InvalidDataException, PersistencyException, ObjectNotFoundException, MarshalException, ValidationException, IOException, MappingException, InvalidCollectionModification { Logger.msg(7, "ItemProxy::initialise - started"); CastorXMLUtility xml = Gateway.getMarshaller(); - if (itemProps == null) throw new InvalidData("No initial properties supplied"); + if (itemProps == null) throw new InvalidDataException("No initial properties supplied"); String propString = xml.marshall(itemProps); String wfString = ""; if (workflow != null) wfString = xml.marshall(workflow); @@ -124,7 +124,7 @@ public class ItemProxy public void setProperty(AgentProxy agent, String name, String value) throws AccessRightsException, - PersistencyException, InvalidData + PersistencyException, InvalidDataException { String[] params = new String[2]; params[0] = name; @@ -135,7 +135,7 @@ public class ItemProxy throw (e); } catch (PersistencyException e) { throw (e); - } catch (InvalidData e) { + } catch (InvalidDataException e) { throw (e); } catch (Exception e) { Logger.error(e); @@ -149,23 +149,23 @@ public class ItemProxy **************************************************************************/ public String requestAction( Job thisJob ) throws AccessRightsException, - InvalidTransition, - ObjectNotFound, - InvalidData, + InvalidTransitionException, + ObjectNotFoundException, + InvalidDataException, PersistencyException, - ObjectAlreadyExists, + ObjectAlreadyExistsException, InvalidCollectionModification { String outcome = thisJob.getOutcomeString(); // check fields that should have been filled in if (outcome==null) if (thisJob.isOutcomeRequired()) - throw new InvalidData("Outcome is required."); + throw new InvalidDataException("Outcome is required."); else outcome=""; if (thisJob.getAgentPath() == null) - throw new InvalidData("No Agent specified."); + throw new InvalidDataException("No Agent specified."); Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName()); return getItem().requestAction (thisJob.getAgentPath().getSystemKey(), thisJob.getStepPath(), @@ -177,7 +177,7 @@ public class ItemProxy **************************************************************************/ private ArrayList getJobList(AgentPath agentPath, boolean filter) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { JobArrayList thisJobList; @@ -194,7 +194,7 @@ public class ItemProxy public ArrayList getJobList(AgentProxy agent) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { return getJobList(agent.getPath(), true); @@ -202,7 +202,7 @@ public class ItemProxy private Job getJobByName(String actName, AgentPath agent) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { ArrayList jobList = getJobList(agent, true); @@ -214,21 +214,21 @@ public class ItemProxy } - public Collection getCollection(String collName) throws ObjectNotFound { + public Collection getCollection(String collName) throws ObjectNotFoundException { return (Collection)getObject(ClusterStorage.COLLECTION+"/"+collName+"/last"); } - public Workflow getWorkflow() throws ObjectNotFound { + public Workflow getWorkflow() throws ObjectNotFoundException { return (Workflow)getObject(ClusterStorage.LIFECYCLE+"/workflow"); } - public Viewpoint getViewpoint(String schemaName, String viewName) throws ObjectNotFound { + public Viewpoint getViewpoint(String schemaName, String viewName) throws ObjectNotFoundException { return (Viewpoint)getObject(ClusterStorage.VIEWPOINT+"/"+schemaName+"/"+viewName); } public Job getJobByName(String actName, AgentProxy agent) throws AccessRightsException, - ObjectNotFound, + ObjectNotFoundException, PersistencyException { return getJobByName(actName, agent.getPath()); } @@ -248,7 +248,7 @@ public class ItemProxy * **************************************************************************/ public String queryData( String path ) - throws ObjectNotFound + throws ObjectNotFoundException { try { @@ -266,7 +266,7 @@ public class ItemProxy } C2KLocalObject target = Gateway.getStorage().get(mItemPath, path, null); return Gateway.getMarshaller().marshall(target); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { throw e; } catch (Exception e) { Logger.error(e); @@ -274,11 +274,11 @@ public class ItemProxy } } - public String[] getContents( String path ) throws ObjectNotFound { + public String[] getContents( String path ) throws ObjectNotFoundException { try { return Gateway.getStorage().getClusterContents(mItemPath, path.substring(0, path.length())); } catch (PersistencyException e) { - throw new ObjectNotFound(e.toString()); + throw new ObjectNotFoundException(e.toString()); } } @@ -287,7 +287,7 @@ public class ItemProxy * **************************************************************************/ public C2KLocalObject getObject( String xpath ) - throws ObjectNotFound + throws ObjectNotFoundException { // load from storage, falling back to proxy loader if not found in others try @@ -297,14 +297,14 @@ public class ItemProxy catch( PersistencyException ex ) { Logger.msg(4, "Exception loading object :"+mItemPath+"/"+xpath); - throw new ObjectNotFound( ex.toString() ); + throw new ObjectNotFoundException( ex.toString() ); } } public String getProperty( String name ) - throws ObjectNotFound + throws ObjectNotFoundException { Logger.msg(5, "Get property "+name+" from item "+mItemPath); Property prop = (Property)getObject("Property/"+name); @@ -314,7 +314,7 @@ public class ItemProxy } catch (NullPointerException ex) { - throw new ObjectNotFound(); + throw new ObjectNotFoundException(); } } @@ -322,7 +322,7 @@ public class ItemProxy { try { return getProperty("Name"); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { return null; } } diff --git a/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java b/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java index 5e063ed..60e5233 100644 --- a/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java +++ b/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java @@ -23,7 +23,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.utils.Logger; @@ -70,7 +70,7 @@ public class MemberSubscription implements Runnable { newMember = (C)subject.getObject(interest+"/"+newChild); contents.remove(newChild); observer.add(newMember); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { observer.control(ERROR, "Listed member "+newChild+" was not found."); } catch (ClassCastException ex) { Logger.error(ex); @@ -117,7 +117,7 @@ public class MemberSubscription implements Runnable { Logger.msg(4, "Adding "+path); contents.add(name); observer.add(newMember); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { Logger.error("Member Subscription: could not load "+path); Logger.error(e); } diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java b/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java index 02dc665..4aff44b 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java @@ -30,7 +30,7 @@ import java.net.SocketException; import java.util.ArrayList; import java.util.Iterator; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.process.Gateway; import com.c2kernel.utils.Logger; @@ -110,7 +110,7 @@ public class ProxyClientConnection implements SocketHandler { thisMessage = new ProxyMessage(input); processMessage(thisMessage); } catch (InterruptedIOException ex) { //timeout - } catch (InvalidData ex) { // invalid proxy message + } catch (InvalidDataException ex) { // invalid proxy message Logger.error("ProxyClientConnection "+thisClientId+" - Invalid proxy message: "+input); } @@ -123,7 +123,7 @@ public class ProxyClientConnection implements SocketHandler { Logger.msg(1, "ProxyClientConnection "+thisClientId+" closed."); } - private void processMessage(ProxyMessage message) throws InvalidData { + private void processMessage(ProxyMessage message) throws InvalidDataException { // proxy disconnection if (message.getPath().equals(ProxyMessage.BYEPATH)) { diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java b/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java index 8824951..aa38ea8 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java @@ -25,8 +25,8 @@ import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.Iterator; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.ItemPath; @@ -103,7 +103,7 @@ public class ProxyManager } } - protected void processMessage(ProxyMessage thisMessage) throws InvalidData { + protected void processMessage(ProxyMessage thisMessage) throws InvalidDataException { if (Logger.doLog(9)) Logger.msg(9, thisMessage.toString()); if (thisMessage.getPath().equals(ProxyMessage.PINGPATH)) // ping response @@ -166,7 +166,7 @@ public class ProxyManager **************************************************************************/ private ItemProxy createProxy( org.omg.CORBA.Object ior, ItemPath itemPath) - throws ObjectNotFound + throws ObjectNotFoundException { ItemProxy newProxy = null; @@ -201,7 +201,7 @@ public class ProxyManager **************************************************************************/ private ItemProxy getProxy( org.omg.CORBA.Object ior, ItemPath itemPath) - throws ObjectNotFound + throws ObjectNotFoundException { synchronized(proxyPool) { @@ -224,7 +224,7 @@ public class ProxyManager * Proxy from Alias **************************************************************************/ public ItemProxy getProxy( Path path ) - throws ObjectNotFound + throws ObjectNotFoundException { ItemPath itemPath; if (path instanceof ItemPath) itemPath = (ItemPath)path; @@ -236,7 +236,7 @@ public class ProxyManager } public AgentProxy getAgentProxy( AgentPath path ) - throws ObjectNotFound + throws ObjectNotFoundException { return (AgentProxy) getProxy(path); } diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java b/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java index fc69992..354ec32 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java @@ -23,7 +23,7 @@ package com.c2kernel.entity.proxy; import java.io.IOException; import java.net.DatagramPacket; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; @@ -65,17 +65,17 @@ public class ProxyMessage { setState(state); } - public ProxyMessage(String line) throws InvalidData, IOException { + public ProxyMessage(String line) throws InvalidDataException, IOException { if (line == null) throw new IOException("Null proxy message"); String[] tok = line.split(":"); if (tok.length != 2) - throw new InvalidData("String '"+line+"' does not constitute a valid proxy message."); + throw new InvalidDataException("String '"+line+"' does not constitute a valid proxy message."); if (tok[0].length() > 0 && !tok[0].equals("tree")) { try { itemPath = new ItemPath(tok[0]); } catch (InvalidItemPathException e) { - throw new InvalidData("Item in proxy message "+line+" was not valid"); + throw new InvalidDataException("Item in proxy message "+line+" was not valid"); } } path = tok[1]; @@ -85,7 +85,7 @@ public class ProxyMessage { } } - public ProxyMessage(DatagramPacket packet) throws InvalidData, IOException { + public ProxyMessage(DatagramPacket packet) throws InvalidDataException, IOException { this(new String(packet.getData())); } diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java b/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java index edcbd44..25a7216 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java @@ -27,7 +27,7 @@ import java.io.InterruptedIOException; import java.io.PrintWriter; import java.net.Socket; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.utils.Logger; @@ -76,7 +76,7 @@ public class ProxyServerConnection extends Thread manager.processMessage(thisMessage); } catch (InterruptedIOException ex) { // timeout - send a ping sendMessage(ProxyMessage.pingMessage); - } catch (InvalidData ex) { // invalid proxy message + } catch (InvalidDataException ex) { // invalid proxy message if (input != null) Logger.error("EntityProxyManager - Invalid proxy message: "+input); } diff --git a/src/main/java/com/c2kernel/entity/transfer/TransferItem.java b/src/main/java/com/c2kernel/entity/transfer/TransferItem.java index 34c3ce3..0e8123b 100644 --- a/src/main/java/com/c2kernel/entity/transfer/TransferItem.java +++ b/src/main/java/com/c2kernel/entity/transfer/TransferItem.java @@ -26,7 +26,7 @@ import java.util.Iterator; import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionArrayList; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.TraceableEntity; import com.c2kernel.lifecycle.instance.Workflow; @@ -51,7 +51,7 @@ public class TransferItem { public TransferItem() throws Exception { try { importAgentId = Gateway.getLookup().getAgentPath("system"); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { Logger.error("TransferItem - System user not found!"); throw e; } @@ -99,7 +99,7 @@ public class TransferItem { File dumpPath = new File(dir.getCanonicalPath() + ".xml"); FileStringUtility.string2File(dumpPath, Gateway.getMarshaller().marshall(obj)); return; - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { } // not an object } } diff --git a/src/main/java/com/c2kernel/events/Event.java b/src/main/java/com/c2kernel/events/Event.java index fd5bb33..87afdf4 100644 --- a/src/main/java/com/c2kernel/events/Event.java +++ b/src/main/java/com/c2kernel/events/Event.java @@ -23,7 +23,7 @@ package com.c2kernel.events; import java.util.Calendar; import com.c2kernel.common.GTimeStamp; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.InvalidItemPathException; @@ -289,7 +289,7 @@ public class Event implements C2KLocalObject return time.toString(); } - public void setTimeString(String time) throws InvalidData + public void setTimeString(String time) throws InvalidDataException { if (time.length() == 19) mTimeStamp = new GTimeStamp( @@ -310,7 +310,7 @@ public class Event implements C2KLocalObject Integer.parseInt(time.substring(12,14)), Calendar.getInstance().get(Calendar.ZONE_OFFSET)); else - throw new InvalidData("Unknown time format: "+time); + throw new InvalidDataException("Unknown time format: "+time); } diff --git a/src/main/java/com/c2kernel/events/History.java b/src/main/java/com/c2kernel/events/History.java index 2010e81..a197f65 100644 --- a/src/main/java/com/c2kernel/events/History.java +++ b/src/main/java/com/c2kernel/events/History.java @@ -21,7 +21,7 @@ package com.c2kernel.events; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.lifecycle.instance.stateMachine.Transition; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -93,7 +93,7 @@ public class History extends RemoteMap { String stateMachineName, Integer stateMachineVersion, Transition transition, - String timeString) throws InvalidData { + String timeString) throws InvalidDataException { return addEvent(agentPath, agentRole, stepName, stepPath, stepType, null, null, stateMachineName, stateMachineVersion, transition, null, timeString); } @@ -107,7 +107,7 @@ public class History extends RemoteMap { Integer stateMachineVersion, Transition transition, String viewName, - String timeString) throws InvalidData { + String timeString) throws InvalidDataException { Logger.msg(7, "History.addEvent() - creating new event for "+transition.getName()+" on "+stepName+" in "+mItemPath); Event newEvent = new Event(); newEvent.setItemPath(mItemPath); diff --git a/src/main/java/com/c2kernel/graph/model/GraphableVertex.java b/src/main/java/com/c2kernel/graph/model/GraphableVertex.java index f8db540..4bc73fd 100644 --- a/src/main/java/com/c2kernel/graph/model/GraphableVertex.java +++ b/src/main/java/com/c2kernel/graph/model/GraphableVertex.java @@ -25,7 +25,7 @@ package com.c2kernel.graph.model; */ -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.utils.CastorHashMap; import com.c2kernel.utils.KeyValuePair; public abstract class GraphableVertex extends Vertex @@ -46,13 +46,13 @@ public abstract class GraphableVertex extends Vertex { return mProperties; } - protected Integer getVersionNumberProperty(String propName) throws InvalidData { + protected Integer getVersionNumberProperty(String propName) throws InvalidDataException { Object val = getProperties().get(propName); if (val == null || val.equals("") || val.toString().equals("-1")) return null; try { return new Integer(val.toString()); } catch (NumberFormatException ex) { - throw new InvalidData("Invalid version number for property '"+propName+"': "+val.toString()); + throw new InvalidDataException("Invalid version number for property '"+propName+"': "+val.toString()); } } public KeyValuePair[] getKeyValuePairs() diff --git a/src/main/java/com/c2kernel/lifecycle/ActivityDef.java b/src/main/java/com/c2kernel/lifecycle/ActivityDef.java index 562c2b6..d783534 100644 --- a/src/main/java/com/c2kernel/lifecycle/ActivityDef.java +++ b/src/main/java/com/c2kernel/lifecycle/ActivityDef.java @@ -21,8 +21,8 @@ package com.c2kernel.lifecycle; import java.util.Vector; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lifecycle.instance.Activity; import com.c2kernel.lifecycle.instance.WfVertex; @@ -148,10 +148,10 @@ public class ActivityDef extends WfVertexDef implements C2KLocalObject, Descript } @Override - public WfVertex instantiate() throws ObjectNotFound, InvalidData{ + public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException{ return instantiate(getName()); } - public WfVertex instantiate(String name) throws ObjectNotFound, InvalidData + public WfVertex instantiate(String name) throws ObjectNotFoundException, InvalidDataException { Activity act = new Activity(); configureInstance(act); diff --git a/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java b/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java index 5c8c90b..07a2867 100644 --- a/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java +++ b/src/main/java/com/c2kernel/lifecycle/ActivitySlotDef.java @@ -19,8 +19,8 @@ * http://www.fsf.org/licensing/licenses/lgpl.html */ package com.c2kernel.lifecycle; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; import com.c2kernel.lifecycle.instance.Activity; @@ -62,7 +62,7 @@ public class ActivitySlotDef extends WfVertexDef getProperties().put("Version", 0); } - public ActivityDef getTheActivityDef() throws ObjectNotFound, InvalidData + public ActivityDef getTheActivityDef() throws ObjectNotFoundException, InvalidDataException { ActivityDef actDef = LocalObjectLoader.getActDef(getActivityDef(), getVersionNumberProperty("Version")); if (actDef instanceof CompositeActivityDef) @@ -189,11 +189,11 @@ public class ActivitySlotDef extends WfVertexDef } @Override - public WfVertex instantiate() throws ObjectNotFound, InvalidData { + public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException { Activity newActivity = (Activity)getTheActivityDef().instantiate(); configureInstance(newActivity); if (newActivity.getProperties().getAbstract().size() > 0) { - throw new InvalidData("Abstract properties not overridden: "+newActivity.getProperties().getAbstract().toString()); + throw new InvalidDataException("Abstract properties not overridden: "+newActivity.getProperties().getAbstract().toString()); } return newActivity; } diff --git a/src/main/java/com/c2kernel/lifecycle/CompositeActivityDef.java b/src/main/java/com/c2kernel/lifecycle/CompositeActivityDef.java index e015404..c48595f 100644 --- a/src/main/java/com/c2kernel/lifecycle/CompositeActivityDef.java +++ b/src/main/java/com/c2kernel/lifecycle/CompositeActivityDef.java @@ -19,8 +19,8 @@ * http://www.fsf.org/licensing/licenses/lgpl.html */ package com.c2kernel.lifecycle; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphModel; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.graph.model.GraphableVertex; @@ -170,12 +170,12 @@ public class CompositeActivityDef extends ActivityDef * @return CompositeActivity */ @Override - public WfVertex instantiate() throws ObjectNotFound, InvalidData { + public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException { return instantiate(getName()); } @Override - public WfVertex instantiate(String name) throws ObjectNotFound, InvalidData + public WfVertex instantiate(String name) throws ObjectNotFoundException, InvalidDataException { CompositeActivity cAct = new CompositeActivity(); configureInstance(cAct); diff --git a/src/main/java/com/c2kernel/lifecycle/WfVertexDef.java b/src/main/java/com/c2kernel/lifecycle/WfVertexDef.java index 27bf00a..08e6451 100644 --- a/src/main/java/com/c2kernel/lifecycle/WfVertexDef.java +++ b/src/main/java/com/c2kernel/lifecycle/WfVertexDef.java @@ -22,8 +22,8 @@ package com.c2kernel.lifecycle; import java.util.Vector; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphableVertex; import com.c2kernel.lifecycle.instance.WfVertex; import com.c2kernel.utils.KeyValuePair; @@ -48,7 +48,7 @@ public abstract class WfVertexDef extends GraphableVertex setIsLayoutable(true); } - public abstract WfVertex instantiate() throws ObjectNotFound, InvalidData; + public abstract WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException; public void configureInstance(WfVertex newVertex) { KeyValuePair[] k = getProperties().getKeyValuePairs(); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java index 70b991d..4dfe6ca 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java @@ -26,14 +26,14 @@ import java.util.Map; import java.util.Vector; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.GTimeStamp; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.agent.Job; import com.c2kernel.events.Event; @@ -103,13 +103,13 @@ public class Activity extends WfVertex return new Next(this, vertex); } - public StateMachine getStateMachine() throws InvalidData { + public StateMachine getStateMachine() throws InvalidDataException { if (machine == null) { String name = (String)getProperties().get("StateMachineName"); int version = getVersionNumberProperty("StateMachineVersion"); try { machine = LocalObjectLoader.getStateMachine(name, version); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { if (name.equals(getDefaultSMName()) && version == 0) { // default state machine not imported yet. Fake it. try { String marshalledSM = Gateway.getResource().getTextResource(null, "boot/SM/"+getDefaultSMName()+".xml"); @@ -119,24 +119,24 @@ public class Activity extends WfVertex return bootstrap; } catch (Exception ex2) { Logger.error(ex2); - throw new InvalidData("Could not bootstrap default state machine from resources."); + throw new InvalidDataException("Could not bootstrap default state machine from resources."); } } Logger.error(ex); - throw new InvalidData("Error loading state machine '"+name+"' v"+version); + throw new InvalidDataException("Error loading state machine '"+name+"' v"+version); } } return machine; } /** return the current State of the State machine (Used in Serialisation) */ - public int getState() throws InvalidData + public int getState() throws InvalidDataException { if (state == -1) state = getStateMachine().getInitialStateCode(); return state; } - public String getStateName() throws InvalidData + public String getStateName() throws InvalidDataException { return getStateMachine().getState(getState()).getName(); } @@ -147,19 +147,19 @@ public class Activity extends WfVertex this.state = state; } - public boolean isFinished() throws InvalidData { + public boolean isFinished() throws InvalidDataException { return getStateMachine().getState(getState()).isFinished(); } /** cf Item request - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated - * @throws CannotManage + * @throws CannotManageException * @throws InvalidCollectionModification */ - public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransition, InvalidData, ObjectNotFound, PersistencyException, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification + public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification { // Find requested transition @@ -178,7 +178,7 @@ public class Activity extends WfVertex if (requestData != null && requestData.length()>0) storeOutcome = true; else if (transition.getOutcome().isRequired()) - throw new InvalidData("Transition requires outcome data, but none was given"); + throw new InvalidDataException("Transition requires outcome data, but none was given"); } // Get new state @@ -237,7 +237,7 @@ public class Activity extends WfVertex try { RolePath myRole = Gateway.getLookup().getRolePath(agentRole); pushJobsToAgents(itemPath, myRole); - } catch (ObjectNotFound ex) { // non-existent role + } catch (ObjectNotFoundException ex) { // non-existent role Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found."); } } @@ -248,13 +248,13 @@ public class Activity extends WfVertex protected String runActivityLogic(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws - InvalidData, + InvalidDataException, InvalidCollectionModification, - ObjectAlreadyExists, + ObjectAlreadyExistsException, ObjectCannotBeUpdated, - ObjectNotFound, + ObjectNotFoundException, PersistencyException, - CannotManage + CannotManageException { // Overriden in predefined steps return requestData; @@ -323,14 +323,14 @@ public class Activity extends WfVertex return loop2; } /** sets the next activity available if possible - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { setActive(false); try @@ -368,7 +368,7 @@ public class Activity extends WfVertex } } } - catch (InvalidData s) + catch (InvalidDataException s) { setActive(true); throw s; @@ -383,10 +383,10 @@ public class Activity extends WfVertex return null; } /** reinitialises the Activity and propagate (for Loop) - * @throws InvalidData - * @throws ObjectNotFound */ + * @throws InvalidDataException + * @throws ObjectNotFoundException */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Vertex[] outVertices = getOutGraphables(); setState(getStateMachine().getInitialState().getId()); @@ -406,16 +406,16 @@ public class Activity extends WfVertex } /** * called by precedent Activity runNext() for setting the activity able to be executed - * @throws InvalidData - * @throws ObjectAlreadyExists + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException * @throws AccessRightsException - * @throws InvalidTransition - * @throws ObjectNotFound + * @throws InvalidTransitionException + * @throws ObjectNotFoundException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ @Override - public void run(AgentPath agent, ItemPath itemPath) throws InvalidData + public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException { Logger.debug(8, getPath() + " run " + getState()); @@ -433,16 +433,16 @@ public class Activity extends WfVertex } /** * sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the (sub)process - * @throws InvalidData - * @throws ObjectAlreadyExists - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ @Override - public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidDataException { Logger.debug(8, getPath() + " runfirst"); run(agent, itemPath); @@ -475,19 +475,19 @@ public class Activity extends WfVertex /** * returns the lists of jobs for the activity and children (cf com.c2kernel.entity.Job) - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws InvalidAgentPathException */ - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { return calculateJobsBase(agent, itemPath, false); } // - public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { return calculateJobsBase(agent, itemPath, true); } - private ArrayList calculateJobsBase(AgentPath agent, ItemPath itemPath, boolean includeInactive) throws ObjectNotFound, InvalidData, InvalidAgentPathException + private ArrayList calculateJobsBase(AgentPath agent, ItemPath itemPath, boolean includeInactive) throws ObjectNotFoundException, InvalidDataException, InvalidAgentPathException { Logger.msg(7, "calculateJobs - " + getPath()); ArrayList jobs = new ArrayList(); @@ -510,7 +510,7 @@ public class Activity extends WfVertex try { RolePath myRole = Gateway.getLookup().getRolePath(agentRole); pushJobsToAgents(itemPath, myRole); - } catch (ObjectNotFound ex) { // non-existent role + } catch (ObjectNotFoundException ex) { // non-existent role Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found."); } } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java b/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java index 6f5da3a..6f2c9ce 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/AdvancementCalculator.java @@ -22,7 +22,7 @@ package com.c2kernel.lifecycle.instance; import java.util.Hashtable; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.Vertex; //import com.c2kernel.utils.Logger; /** @author XSeb74 */ @@ -47,7 +47,7 @@ public class AdvancementCalculator HasNextMarked = new Hashtable(); hasprevActive = new Hashtable(); } - public void calculate(CompositeActivity act) throws InvalidData + public void calculate(CompositeActivity act) throws InvalidDataException { // Logger.debug(0, act.getName()+" >>>>>>>>>"); if (act instanceof Workflow) @@ -77,7 +77,7 @@ public class AdvancementCalculator j++; if (j != 0 && j==nexts.length) current.HasNextMarked.put(v, nexts[0]); } - private void calc(Vertex v, AdvancementCalculator current) throws InvalidData + private void calc(Vertex v, AdvancementCalculator current) throws InvalidDataException { if (current.isMarked.get(v) != null && !(v instanceof Join)) return; diff --git a/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java index c888d7a..5e08e3d 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/AndSplit.java @@ -19,7 +19,7 @@ * http://www.fsf.org/licensing/licenses/lgpl.html */ package com.c2kernel.lifecycle.instance; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.Vertex; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -37,7 +37,7 @@ public class AndSplit extends Split super(); } @Override - public void runNext(AgentPath agent, ItemPath item) throws InvalidData + public void runNext(AgentPath agent, ItemPath item) throws InvalidDataException { AdvancementCalculator adv = new AdvancementCalculator(); adv.calculate((CompositeActivity) getParent()); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java index 8e08f99..9bb5c84 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/CompositeActivity.java @@ -23,13 +23,13 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.agent.Job; import com.c2kernel.graph.model.GraphModel; @@ -306,17 +306,17 @@ public class CompositeActivity extends Activity } /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ @Override - public void run(AgentPath agent, ItemPath itemPath) throws InvalidData + public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException { super.run(agent, itemPath); if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished()) @@ -327,7 +327,7 @@ public class CompositeActivity extends Activity } @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { if (!getStateMachine().getState(state).isFinished()) try { @@ -342,13 +342,13 @@ public class CompositeActivity extends Activity /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws InvalidAgentPathException * @see com.c2kernel.lifecycle.instance.Activity#calculateJobs() */ @Override - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { ArrayList jobs = new ArrayList(); boolean childActive = false; @@ -366,7 +366,7 @@ public class CompositeActivity extends Activity } @Override - public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateAllJobs(AgentPath agent, ItemPath itemPath, boolean recurse) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { ArrayList jobs = new ArrayList(); if (recurse) @@ -436,11 +436,11 @@ public class CompositeActivity extends Activity } /** - * @throws InvalidData + * @throws InvalidDataException * */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { super.reinit(idLoop); if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished()) @@ -448,7 +448,7 @@ public class CompositeActivity extends Activity } @Override - public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransition, InvalidData, ObjectNotFound, PersistencyException, ObjectAlreadyExists, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification + public String request(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectNotFoundException, PersistencyException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification { if (getChildrenGraphModel().getStartVertex() != null && !getStateMachine().getState(state).isFinished() && transitionID == CompositeActivity.START) ((WfVertex) getChildrenGraphModel().getStartVertex()).run(agent, itemPath); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Join.java b/src/main/java/com/c2kernel/lifecycle/instance/Join.java index 2482f49..1a415d7 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Join.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Join.java @@ -22,11 +22,11 @@ package com.c2kernel.lifecycle.instance; import java.util.Vector; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; @@ -51,17 +51,17 @@ public class Join extends WfVertex public int counter = 0; /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#runNext() */ @Override - public void runNext(AgentPath agent, ItemPath item) throws InvalidData + public void runNext(AgentPath agent, ItemPath item) throws InvalidDataException { AdvancementCalculator adv = new AdvancementCalculator(); adv.calculate((CompositeActivity) getParent()); @@ -87,11 +87,11 @@ public class Join extends WfVertex new Next(this, (WfVertex) getParent().search(idNext)); } /** - * @throws InvalidData + * @throws InvalidDataException * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int) */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Vertex[] outVertices = getOutGraphables(); if (outVertices.length == 1) @@ -174,17 +174,17 @@ public class Join extends WfVertex return mErrors.elementAt(0); } /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ @Override - public void run(AgentPath agent, ItemPath item) throws InvalidData + public void run(AgentPath agent, ItemPath item) throws InvalidDataException { runNext(agent, item); } @@ -215,7 +215,7 @@ public class Join extends WfVertex return loop2; } @Override - public void runFirst(AgentPath agent, ItemPath item) throws InvalidData + public void runFirst(AgentPath agent, ItemPath item) throws InvalidDataException { runNext(agent, item); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Loop.java b/src/main/java/com/c2kernel/lifecycle/instance/Loop.java index 30e1bb7..1553fdf 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Loop.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Loop.java @@ -19,7 +19,7 @@ * http://www.fsf.org/licensing/licenses/lgpl.html */ package com.c2kernel.lifecycle.instance; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; import com.c2kernel.lookup.AgentPath; @@ -47,7 +47,7 @@ public class Loop extends XOrSplit return true; } @Override - public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidData + public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidDataException { WfVertex v = activeNext.getTerminusVertex(); if (!isInPrev(v)) @@ -59,11 +59,11 @@ public class Loop extends XOrSplit } } /** - * @throws InvalidData + * @throws InvalidDataException * @see com.c2kernel.lifecycle.instance.WfVertex#reinit(int) */ @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Logger.msg(8, "Loop.reinit"); if (idLoop == getID()) diff --git a/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java index eabf46a..349000d 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/OrSplit.java @@ -21,7 +21,7 @@ package com.c2kernel.lifecycle.instance; import java.util.StringTokenizer; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.DirectedEdge; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -41,7 +41,7 @@ public class OrSplit extends Split super(); } @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { String nexts; String scriptName = (String) getProperties().get("RoutingScriptName"); @@ -50,7 +50,7 @@ public class OrSplit extends Split nexts = this.evaluateScript(scriptName, scriptVersion, itemPath).toString(); } catch (ScriptingEngineException e) { Logger.error(e); - throw new InvalidData("Error running routing script "+scriptName+" v"+scriptVersion); + throw new InvalidDataException("Error running routing script "+scriptName+" v"+scriptVersion); } StringTokenizer tok = new StringTokenizer(nexts, ","); Logger.msg(7, tok.countTokens() + " nexts to activate:" + nexts); @@ -82,7 +82,7 @@ public class OrSplit extends Split Logger.error(e); } if (active == 0) - throw new InvalidData("No nexts were activated!"); + throw new InvalidDataException("No nexts were activated!"); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Split.java b/src/main/java/com/c2kernel/lifecycle/instance/Split.java index e4bbb09..d4fb0fd 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Split.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Split.java @@ -23,11 +23,11 @@ package com.c2kernel.lifecycle.instance; import java.util.Vector; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.graph.model.Vertex; import com.c2kernel.graph.traversal.GraphTraversal; @@ -55,17 +55,17 @@ public abstract class Split extends WfVertex private boolean loopTested; /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#runNext() */ @Override - public abstract void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData; + public abstract void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException; /** * Method addNext. @@ -97,7 +97,7 @@ public abstract class Split extends WfVertex } @Override - public void reinit(int idLoop) throws InvalidData + public void reinit(int idLoop) throws InvalidDataException { Vertex[] outVertices = getOutGraphables(); for (Vertex outVertice : outVertices) @@ -171,17 +171,17 @@ public abstract class Split extends WfVertex } /** - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated * @see com.c2kernel.lifecycle.instance.WfVertex#run() */ @Override - public void run(AgentPath agent, ItemPath itemPath) throws InvalidData + public void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException { runNext(agent, itemPath); } @@ -230,7 +230,7 @@ public abstract class Split extends WfVertex } @Override - public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidDataException { runNext(agent, itemPath); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java index 7eb61a6..9bf0fd4 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/WfVertex.java @@ -25,11 +25,11 @@ package com.c2kernel.lifecycle.instance; import java.util.HashMap; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.graph.model.GraphableVertex; import com.c2kernel.lifecycle.routingHelpers.ViewpointDataHelper; @@ -50,14 +50,14 @@ public abstract class WfVertex extends GraphableVertex { /**sets the activity available to be executed on start of Workflow or composite activity (when it is the first one of the * (sub)process - * @throws InvalidData - * @throws ObjectAlreadyExists - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ - public abstract void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidData; + public abstract void runFirst(AgentPath agent, ItemPath itemPath) throws InvalidDataException; /** * @see java.lang.Object#Object() @@ -71,15 +71,15 @@ public abstract class WfVertex extends GraphableVertex /** * Method runNext. - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { try { @@ -95,10 +95,10 @@ public abstract class WfVertex extends GraphableVertex /** * Method reinit. * @param idLoop - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException */ - public abstract void reinit( int idLoop ) throws InvalidData; + public abstract void reinit( int idLoop ) throws InvalidDataException; /** * Method verify. @@ -114,15 +114,15 @@ public abstract class WfVertex extends GraphableVertex /** * Method run. - * @throws InvalidData - * @throws ObjectAlreadyExists - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectAlreadyExistsException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition + * @throws InvalidTransitionException * @throws PersistencyException * @throws ObjectCannotBeUpdated */ - public abstract void run(AgentPath agent, ItemPath itemPath) throws InvalidData; + public abstract void run(AgentPath agent, ItemPath itemPath) throws InvalidDataException; /** * Method loop. @@ -159,7 +159,7 @@ public abstract class WfVertex extends GraphableVertex try { inputParam = ViewpointDataHelper.get(value)[0]; } catch (ArrayIndexOutOfBoundsException ex) { - throw new InvalidData("Could not retrieve data from viewpoint: "+value); + throw new InvalidDataException("Could not retrieve data from viewpoint: "+value); } } if (value.startsWith("property//")) @@ -167,7 +167,7 @@ public abstract class WfVertex extends GraphableVertex value = value.substring(10); try { inputParam = Gateway.getStorage().get(itemPath, ClusterStorage.PROPERTY+"/"+value, null); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { inputParam = null; } } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java index f1719f6..f152adc 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java @@ -22,13 +22,13 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +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.C2KLocalObject; import com.c2kernel.entity.agent.Job; @@ -81,10 +81,10 @@ public class Workflow extends CompositeActivity implements C2KLocalObject addChild(predef, new GraphPoint(300, 100)); } - public History getHistory() throws InvalidData { + public History getHistory() throws InvalidDataException { if (history == null) { if (itemPath == null) - throw new InvalidData("Workflow not initialized."); + throw new InvalidDataException("Workflow not initialized."); history = new History(itemPath, this); } return history; @@ -117,24 +117,24 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @param stepPath * @param transitionID * @param reguestData - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition - * @throws InvalidData + * @throws InvalidTransitionException + * @throws InvalidDataException * @throws PersistencyException * @throws ObjectCannotBeUpdated - * @throws CannotManage + * @throws CannotManageException * @throws InvalidCollectionModification */ //requestData is xmlstring public String requestAction(AgentPath agent, String stepPath, ItemPath itemPath, int transitionID, String requestData) - throws ObjectNotFound, AccessRightsException, InvalidTransition, InvalidData, ObjectAlreadyExists, PersistencyException, ObjectCannotBeUpdated, CannotManage, InvalidCollectionModification + throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification { Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent); if (search(stepPath) != null) return ((Activity) search(stepPath)).request(agent, itemPath, transitionID, requestData); else - throw new ObjectNotFound(stepPath + " not found"); + throw new ObjectNotFoundException(stepPath + " not found"); } /** @@ -196,14 +196,14 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * Method initialise. * * @param systemKey - * @throws InvalidData - * @throws ObjectNotFound + * @throws InvalidDataException + * @throws ObjectNotFoundException * @throws AccessRightsException - * @throws InvalidTransition - * @throws ObjectAlreadyExists + * @throws InvalidTransitionException + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ - public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidData + public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidDataException { setItemPath(itemPath); runFirst(agent, itemPath); @@ -232,11 +232,11 @@ public class Workflow extends CompositeActivity implements C2KLocalObject * @param itemSysKey * @param type * @return - * @throws ObjectNotFound - * @throws InvalidData + * @throws ObjectNotFoundException + * @throws InvalidDataException * @throws InvalidAgentPathException */ - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws InvalidAgentPathException, ObjectNotFound, InvalidData + public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException { ArrayList jobs = new ArrayList(); if (type != 1) diff --git a/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java b/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java index e5b91d3..7b47fd5 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/XOrSplit.java @@ -23,7 +23,7 @@ package com.c2kernel.lifecycle.instance; import java.util.ArrayList; import java.util.StringTokenizer; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.graph.model.DirectedEdge; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; @@ -45,7 +45,7 @@ public class XOrSplit extends Split } @Override - public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidData + public void runNext(AgentPath agent, ItemPath itemPath) throws InvalidDataException { ArrayList nextsToFollow = new ArrayList(); String nexts; @@ -55,7 +55,7 @@ public class XOrSplit extends Split nexts = this.evaluateScript(scriptName, scriptVersion, itemPath).toString(); } catch (ScriptingEngineException e) { Logger.error(e); - throw new InvalidData("Error running routing script "+scriptName+" v"+scriptVersion); + throw new InvalidDataException("Error running routing script "+scriptName+" v"+scriptVersion); } StringTokenizer tok = new StringTokenizer(nexts,","); @@ -70,13 +70,13 @@ public class XOrSplit extends Split } // Logger.debug(0, getID()+" following "+nexts); if (nextsToFollow.size() != 1) - throw new InvalidData("not good number of active next"); + throw new InvalidDataException("not good number of active next"); followNext((Next)nextsToFollow.get(0), agent, itemPath); } - public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidData { + public void followNext(Next activeNext, AgentPath agent, ItemPath itemPath) throws InvalidDataException { activeNext.getTerminusVertex().run(agent, itemPath); } 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(); diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java index 54a7267..cd61713 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/StateMachine.java @@ -25,9 +25,9 @@ import java.util.HashMap; import java.util.Map; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.InvalidTransition; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidTransitionException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lifecycle.instance.Activity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.utils.DescriptionObject; @@ -142,7 +142,7 @@ public class StateMachine implements DescriptionObject return stateCodes.get(stateID); } - public Map getPossibleTransitions(Activity act, AgentPath agent) throws ObjectNotFound, InvalidData { + public Map getPossibleTransitions(Activity act, AgentPath agent) throws ObjectNotFoundException, InvalidDataException { HashMap returnList = new HashMap(); State currentState = getState(act.getState()); for (Integer transCode : currentState.getPossibleTransitionIds()) { @@ -158,14 +158,14 @@ public class StateMachine implements DescriptionObject return returnList; } - public State traverse(Activity act, Transition transition, AgentPath agent) throws InvalidTransition, AccessRightsException, ObjectNotFound, InvalidData { + public State traverse(Activity act, Transition transition, AgentPath agent) throws InvalidTransitionException, AccessRightsException, ObjectNotFoundException, InvalidDataException { State currentState = getState(act.getState()); if (transition.originState.equals(currentState)) { transition.getPerformingRole(act, agent); return transition.targetState; } else - throw new InvalidTransition("Transition '"+transition.getName()+"' not valid from state '"+currentState.getName()); + throw new InvalidTransitionException("Transition '"+transition.getName()+"' not valid from state '"+currentState.getName()); } diff --git a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java index 78786da..76ae602 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/stateMachine/Transition.java @@ -25,8 +25,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.c2kernel.common.AccessRightsException; -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.Activity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.RolePath; @@ -188,7 +188,7 @@ public class Transition { this.targetStateId = targetStateId; } - public String getPerformingRole(Activity act, AgentPath agent) throws ObjectNotFound, AccessRightsException { + public String getPerformingRole(Activity act, AgentPath agent) throws ObjectNotFoundException, AccessRightsException { // check available if (!isEnabled(act.getProperties())) @@ -284,13 +284,13 @@ public class Transition { return true; } - public Schema getSchema(CastorHashMap actProps) throws InvalidData, ObjectNotFound { + public Schema getSchema(CastorHashMap actProps) throws InvalidDataException, ObjectNotFoundException { if (hasOutcome(actProps)) try { return LocalObjectLoader.getSchema(resolveValue(outcome.schemaName, actProps), Integer.parseInt(resolveValue(outcome.schemaVersion, actProps))); } catch (NumberFormatException ex) { - throw new InvalidData("Bad schema version number: "+outcome.schemaVersion+" ("+resolveValue(outcome.schemaVersion, actProps)+")"); + throw new InvalidDataException("Bad schema version number: "+outcome.schemaVersion+" ("+resolveValue(outcome.schemaVersion, actProps)+")"); } else return null; @@ -300,11 +300,11 @@ public class Transition { return resolveValue(script.scriptName, actProps); } - public int getScriptVersion(CastorHashMap actProps) throws InvalidData { + public int getScriptVersion(CastorHashMap actProps) throws InvalidDataException { try { return Integer.parseInt(resolveValue(script.scriptVersion, actProps)); } catch (NumberFormatException ex) { - throw new InvalidData("Bad Script version number: "+script.scriptVersion+" ("+resolveValue(script.scriptVersion, actProps)+")"); + throw new InvalidDataException("Bad Script version number: "+script.scriptVersion+" ("+resolveValue(script.scriptVersion, actProps)+")"); } } diff --git a/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java b/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java index db441da..ae86c2a 100644 --- a/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java +++ b/src/main/java/com/c2kernel/lifecycle/routingHelpers/ViewpointDataHelper.java @@ -20,7 +20,7 @@ */ package com.c2kernel.lifecycle.routingHelpers; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.lookup.ItemPath; import com.c2kernel.persistency.ClusterStorage; @@ -78,7 +78,7 @@ public class ViewpointDataHelper retArr = XmlElementParser.parse(outcome.getData(), xpath); return retArr; - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { return errArr; } } diff --git a/src/main/java/com/c2kernel/lookup/AgentPath.java b/src/main/java/com/c2kernel/lookup/AgentPath.java index 06be6d4..d2a6c7f 100644 --- a/src/main/java/com/c2kernel/lookup/AgentPath.java +++ b/src/main/java/com/c2kernel/lookup/AgentPath.java @@ -26,7 +26,7 @@ import java.util.UUID; import org.apache.xerces.impl.dv.util.Base64; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.SystemKey; import com.c2kernel.process.Gateway; @@ -47,7 +47,7 @@ public class AgentPath extends ItemPath super(syskey); try { findAgentName(); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { throw new InvalidAgentPathException(); } } @@ -55,7 +55,7 @@ public class AgentPath extends ItemPath super(uuid); try { findAgentName(); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { throw new InvalidAgentPathException(); } } @@ -64,7 +64,7 @@ public class AgentPath extends ItemPath super(itemPath.mUUID); try { findAgentName(); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { throw new InvalidAgentPathException(); } } @@ -78,7 +78,7 @@ public class AgentPath extends ItemPath super(path); try { findAgentName(); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { throw new InvalidAgentPathException(); } } @@ -93,13 +93,13 @@ public class AgentPath extends ItemPath if (mAgentName==null) try { findAgentName(); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { return null; } return mAgentName; } - private void findAgentName() throws ObjectNotFound { + private void findAgentName() throws ObjectNotFoundException { mAgentName = Gateway.getLookup().getAgentName(this); } @@ -115,7 +115,7 @@ public class AgentPath extends ItemPath public boolean hasRole(String role) { try { return hasRole(Gateway.getLookup().getRolePath(role)); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { return false; } } diff --git a/src/main/java/com/c2kernel/lookup/DomainPath.java b/src/main/java/com/c2kernel/lookup/DomainPath.java index 1a86b57..a4128fe 100644 --- a/src/main/java/com/c2kernel/lookup/DomainPath.java +++ b/src/main/java/com/c2kernel/lookup/DomainPath.java @@ -20,7 +20,7 @@ */ package com.c2kernel.lookup; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.process.Gateway; @@ -95,13 +95,13 @@ public class DomainPath extends Path } @Override - public ItemPath getItemPath() throws ObjectNotFound { + public ItemPath getItemPath() throws ObjectNotFoundException { if (mType == UNKNOWN) { // must decide checkType(); } if (target == null) - throw new ObjectNotFound("Path "+toString()+" does not resolve to an Item"); + throw new ObjectNotFoundException("Path "+toString()+" does not resolve to an Item"); return target; } @@ -118,7 +118,7 @@ public class DomainPath extends Path setItemPath(Gateway.getLookup().resolvePath(this)); } catch (InvalidItemPathException ex) { mType = CONTEXT; - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { mType = CONTEXT; } diff --git a/src/main/java/com/c2kernel/lookup/ItemPath.java b/src/main/java/com/c2kernel/lookup/ItemPath.java index ad13854..855a5dd 100644 --- a/src/main/java/com/c2kernel/lookup/ItemPath.java +++ b/src/main/java/com/c2kernel/lookup/ItemPath.java @@ -24,7 +24,7 @@ import java.nio.ByteBuffer; import java.util.Arrays; import java.util.UUID; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.SystemKey; @@ -86,7 +86,7 @@ public class ItemPath extends Path } @Override - public ItemPath getItemPath() throws ObjectNotFound { + public ItemPath getItemPath() throws ObjectNotFoundException { return this; } diff --git a/src/main/java/com/c2kernel/lookup/Lookup.java b/src/main/java/com/c2kernel/lookup/Lookup.java index f7e4f59..924057a 100644 --- a/src/main/java/com/c2kernel/lookup/Lookup.java +++ b/src/main/java/com/c2kernel/lookup/Lookup.java @@ -22,7 +22,7 @@ package com.c2kernel.lookup; import java.util.Iterator; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.process.auth.Authenticator; import com.c2kernel.property.Property; import com.c2kernel.property.PropertyDescriptionList; @@ -53,9 +53,9 @@ public interface Lookup { * @param sysKey The system key of the Item * @return an ItemPath or AgentPath * @throws InvalidItemPathException When the system key is invalid/out-of-range - * @throws ObjectNotFound When the Item does not exist in the directory. + * @throws ObjectNotFoundException When the Item does not exist in the directory. */ - public ItemPath getItemPath(String sysKey) throws InvalidItemPathException, ObjectNotFound; + public ItemPath getItemPath(String sysKey) throws InvalidItemPathException, ObjectNotFoundException; /** * Find the ItemPath for which a DomainPath is an alias. @@ -63,18 +63,18 @@ public interface Lookup { * @param domainPath The path to resolve * @return The ItemPath it points to (should be an AgentPath if the path references an Agent) * @throws InvalidItemPathException - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public ItemPath resolvePath(DomainPath domainPath) throws InvalidItemPathException, ObjectNotFound; + public ItemPath resolvePath(DomainPath domainPath) throws InvalidItemPathException, ObjectNotFoundException; /** * Resolve a path to a CORBA Object Item or Agent * * @param path The path to be resolved * @return The CORBA Object - * @throws ObjectNotFound When the Path doesn't exist, or doesn't have an IOR associated with it + * @throws ObjectNotFoundException When the Path doesn't exist, or doesn't have an IOR associated with it */ - public org.omg.CORBA.Object resolve(Path path) throws ObjectNotFound; + public org.omg.CORBA.Object resolve(Path path) throws ObjectNotFoundException; // Path finding and searching @@ -131,23 +131,23 @@ public interface Lookup { /** * @param agentName * @return - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public AgentPath getAgentPath(String agentName) throws ObjectNotFound; + public AgentPath getAgentPath(String agentName) throws ObjectNotFoundException; /** * @param roleName * @return - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public RolePath getRolePath(String roleName) throws ObjectNotFound; + public RolePath getRolePath(String roleName) throws ObjectNotFoundException; /** * @param rolePath * @return - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public AgentPath[] getAgents(RolePath rolePath) throws ObjectNotFound; + public AgentPath[] getAgents(RolePath rolePath) throws ObjectNotFoundException; /** * @param agentPath @@ -167,8 +167,8 @@ public interface Lookup { /** * @param agentPath * @return - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public String getAgentName(AgentPath agentPath) throws ObjectNotFound; + public String getAgentName(AgentPath agentPath) throws ObjectNotFoundException; } diff --git a/src/main/java/com/c2kernel/lookup/LookupManager.java b/src/main/java/com/c2kernel/lookup/LookupManager.java index 620c522..b05a4a4 100644 --- a/src/main/java/com/c2kernel/lookup/LookupManager.java +++ b/src/main/java/com/c2kernel/lookup/LookupManager.java @@ -22,9 +22,9 @@ package com.c2kernel.lookup; import java.security.NoSuchAlgorithmException; -import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; /** * @author abranson @@ -35,9 +35,9 @@ public interface LookupManager extends Lookup { /** * Called when a server starts up. The Lookup implementation should ensure that the initial structure of its directory is valid, and create it on first boot. * - * @throws ObjectNotFound When initialization data is not found + * @throws ObjectNotFoundException When initialization data is not found */ - public void initializeDirectory() throws ObjectNotFound; + public void initializeDirectory() throws ObjectNotFoundException; // Path management @@ -46,9 +46,9 @@ public interface LookupManager extends Lookup { * * @param newPath The path to add * @throws ObjectCannotBeUpdated When there is an error writing to the directory - * @throws ObjectAlreadyExists When the Path has already been registered + * @throws ObjectAlreadyExistsException When the Path has already been registered */ - public void add(Path newPath) throws ObjectCannotBeUpdated, ObjectAlreadyExists; + public void add(Path newPath) throws ObjectCannotBeUpdated, ObjectAlreadyExistsException; /** * Remove a Path from the directory @@ -65,10 +65,10 @@ public interface LookupManager extends Lookup { * @param role * @param hasJobList * @return - * @throws ObjectAlreadyExists + * @throws ObjectAlreadyExistsException * @throws ObjectCannotBeUpdated */ - public RolePath createRole(RolePath role) throws ObjectAlreadyExists, ObjectCannotBeUpdated; + public RolePath createRole(RolePath role) throws ObjectAlreadyExistsException, ObjectCannotBeUpdated; /** * Adds the given Agent to the given Role, if they both exist. @@ -76,9 +76,9 @@ public interface LookupManager extends Lookup { * @param agent - the * @param rolePath * @throws ObjectCannotBeUpdated - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public void addRole(AgentPath agent, RolePath rolePath) throws ObjectCannotBeUpdated, ObjectNotFound; + public void addRole(AgentPath agent, RolePath rolePath) throws ObjectCannotBeUpdated, ObjectNotFoundException; /** * Removes the given Agent from the given Role. Does not delete the Role. @@ -86,26 +86,26 @@ public interface LookupManager extends Lookup { * @param agent * @param role * @throws ObjectCannotBeUpdated - * @throws ObjectNotFound + * @throws ObjectNotFoundException */ - public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFound; + public void removeRole(AgentPath agent, RolePath role) throws ObjectCannotBeUpdated, ObjectNotFoundException; /** * @param agent * @param newPassword - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws ObjectCannotBeUpdated * @throws NoSuchAlgorithmException */ - public void setAgentPassword(AgentPath agent, String newPassword) throws ObjectNotFound, ObjectCannotBeUpdated, NoSuchAlgorithmException; + public void setAgentPassword(AgentPath agent, String newPassword) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException; /** * @param role * @param hasJobList - * @throws ObjectNotFound + * @throws ObjectNotFoundException * @throws ObjectCannotBeUpdated */ - public void setHasJobList(RolePath role, boolean hasJobList) throws ObjectNotFound, ObjectCannotBeUpdated; + public void setHasJobList(RolePath role, boolean hasJobList) throws ObjectNotFoundException, ObjectCannotBeUpdated; } diff --git a/src/main/java/com/c2kernel/lookup/Path.java b/src/main/java/com/c2kernel/lookup/Path.java index 7085a36..3ccdb35 100644 --- a/src/main/java/com/c2kernel/lookup/Path.java +++ b/src/main/java/com/c2kernel/lookup/Path.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.StringTokenizer; import java.util.UUID; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.SystemKey; import com.c2kernel.process.Gateway; @@ -194,7 +194,7 @@ public abstract class Path Lookup myLookup = Gateway.getLookup(); try { newIOR = myLookup.resolve(this); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { } setIOR(newIOR); } @@ -218,7 +218,7 @@ public abstract class Path return mUUID; } - public abstract ItemPath getItemPath() throws ObjectNotFound; + public abstract ItemPath getItemPath() throws ObjectNotFoundException; @Override public boolean equals( Object path ) diff --git a/src/main/java/com/c2kernel/lookup/RolePath.java b/src/main/java/com/c2kernel/lookup/RolePath.java index 97682ab..7432171 100644 --- a/src/main/java/com/c2kernel/lookup/RolePath.java +++ b/src/main/java/com/c2kernel/lookup/RolePath.java @@ -22,9 +22,9 @@ package com.c2kernel.lookup; import java.util.Iterator; -import com.c2kernel.common.CannotManage; +import com.c2kernel.common.CannotManageException; import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.process.Gateway; @@ -50,7 +50,7 @@ public class RolePath extends DomainPath try { if (mPath.length > 2) return Gateway.getLookup().getRolePath(mPath[mPath.length-2]); - } catch (ObjectNotFound ex) { } + } catch (ObjectNotFoundException ex) { } return null; } @@ -77,10 +77,10 @@ public class RolePath extends DomainPath /** * @param hasJobList The hasJobList to set. * @throws ObjectCannotBeUpdated - * @throws ObjectNotFound - * @throws CannotManage + * @throws ObjectNotFoundException + * @throws CannotManageException */ - public void setHasJobList(boolean hasJobList) throws ObjectNotFound, ObjectCannotBeUpdated, CannotManage { + public void setHasJobList(boolean hasJobList) throws ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException { this.hasJobList = hasJobList; } diff --git a/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java b/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java index baabb19..cc64d5a 100644 --- a/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java +++ b/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java @@ -27,7 +27,7 @@ import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.agent.JobList; @@ -207,7 +207,7 @@ public class ClusterStorageManager { } /** Internal get method. Retrieves clusters from ClusterStorages & maintains the memory cache */ - public C2KLocalObject get(ItemPath itemPath, String path) throws PersistencyException, ObjectNotFound { + public C2KLocalObject get(ItemPath itemPath, String path) throws PersistencyException, ObjectNotFoundException { C2KLocalObject result = null; // check cache first Map sysKeyMemCache = null; @@ -277,7 +277,7 @@ public class ClusterStorageManager { "/" + path + ": " + e.getMessage()); } } - throw new ObjectNotFound("ClusterStorageManager.get() - Path " + path + " not found in " + itemPath); + throw new ObjectNotFoundException("ClusterStorageManager.get() - Path " + path + " not found in " + itemPath); } /** Internal put method. Creates or overwrites a cluster in all writers. Used when committing transactions. */ diff --git a/src/main/java/com/c2kernel/persistency/ProxyLoader.java b/src/main/java/com/c2kernel/persistency/ProxyLoader.java index f8704e3..88b6f03 100644 --- a/src/main/java/com/c2kernel/persistency/ProxyLoader.java +++ b/src/main/java/com/c2kernel/persistency/ProxyLoader.java @@ -22,7 +22,7 @@ package com.c2kernel.persistency; import java.util.HashMap; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.AgentHelper; import com.c2kernel.entity.C2KLocalObject; @@ -84,7 +84,7 @@ public class ProxyLoader extends ClusterStorage { else return (C2KLocalObject)Gateway.getMarshaller().unmarshall(queryData); } - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { return null; } catch (Exception e) { Logger.error(e); diff --git a/src/main/java/com/c2kernel/persistency/RemoteMap.java b/src/main/java/com/c2kernel/persistency/RemoteMap.java index b1a1e51..d23551a 100644 --- a/src/main/java/com/c2kernel/persistency/RemoteMap.java +++ b/src/main/java/com/c2kernel/persistency/RemoteMap.java @@ -27,7 +27,7 @@ import java.util.Iterator; import java.util.Set; import java.util.TreeMap; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.proxy.ItemProxy; @@ -225,7 +225,7 @@ public class RemoteMap extends TreeMap impl return value; } catch (PersistencyException e) { Logger.error(e); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { Logger.error(e); } } diff --git a/src/main/java/com/c2kernel/persistency/TransactionManager.java b/src/main/java/com/c2kernel/persistency/TransactionManager.java index 792709a..4fc3f8c 100644 --- a/src/main/java/com/c2kernel/persistency/TransactionManager.java +++ b/src/main/java/com/c2kernel/persistency/TransactionManager.java @@ -23,7 +23,7 @@ package com.c2kernel.persistency; import java.util.ArrayList; import java.util.HashMap; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.agent.JobList; @@ -73,7 +73,7 @@ public class TransactionManager { */ public C2KLocalObject get(ItemPath itemPath, String path, Object locker) throws PersistencyException, - ObjectNotFound { + ObjectNotFoundException { if (path.startsWith("/") && path.length() > 1) path = path.substring(1); // deal out top level remote maps, if transactions aren't needed diff --git a/src/main/java/com/c2kernel/persistency/outcome/Outcome.java b/src/main/java/com/c2kernel/persistency/outcome/Outcome.java index ac2d970..e039476 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/Outcome.java +++ b/src/main/java/com/c2kernel/persistency/outcome/Outcome.java @@ -40,8 +40,8 @@ import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; import org.xml.sax.InputSource; -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.persistency.ClusterStorage; @@ -144,10 +144,10 @@ public class Outcome implements C2KLocalObject { mData = null; } - public String getFieldByXPath(String xpath) throws XPathExpressionException, InvalidData { + public String getFieldByXPath(String xpath) throws XPathExpressionException, InvalidDataException { Node field = getNodeByXPath(xpath); if (field == null) - throw new InvalidData(xpath); + throw new InvalidDataException(xpath); else if (field.getNodeType()==Node.TEXT_NODE || field.getNodeType()==Node.CDATA_SECTION_NODE) return field.getNodeValue(); @@ -155,28 +155,28 @@ public class Outcome implements C2KLocalObject { else if (field.getNodeType()==Node.ELEMENT_NODE) { NodeList fieldChildren = field.getChildNodes(); if (fieldChildren.getLength() == 0) - throw new InvalidData("No child node for element"); + throw new InvalidDataException("No child node for element"); else if (fieldChildren.getLength() == 1) { Node child = fieldChildren.item(0); if (child.getNodeType()==Node.TEXT_NODE || child.getNodeType()==Node.CDATA_SECTION_NODE) return child.getNodeValue(); else - throw new InvalidData("Can't get data from child node of type "+child.getNodeName()); + throw new InvalidDataException("Can't get data from child node of type "+child.getNodeName()); } else - throw new InvalidData("Element "+xpath+" has too many children"); + throw new InvalidDataException("Element "+xpath+" has too many children"); } else if (field.getNodeType()==Node.ATTRIBUTE_NODE) return field.getNodeValue(); else - throw new InvalidData("Don't know what to do with node "+field.getNodeName()); + throw new InvalidDataException("Don't know what to do with node "+field.getNodeName()); } - public void setFieldByXPath(String xpath, String data) throws XPathExpressionException, InvalidData { + public void setFieldByXPath(String xpath, String data) throws XPathExpressionException, InvalidDataException { Node field = getNodeByXPath(xpath); if (field == null) - throw new InvalidData(xpath); + throw new InvalidDataException(xpath); else if (field.getNodeType()==Node.ELEMENT_NODE) { NodeList fieldChildren = field.getChildNodes(); @@ -191,16 +191,16 @@ public class Outcome implements C2KLocalObject { child.setNodeValue(data); break; default: - throw new InvalidData("Can't set child node of type "+child.getNodeName()); + throw new InvalidDataException("Can't set child node of type "+child.getNodeName()); } } else - throw new InvalidData("Element "+xpath+" has too many children"); + throw new InvalidDataException("Element "+xpath+" has too many children"); } else if (field.getNodeType()==Node.ATTRIBUTE_NODE) field.setNodeValue(data); else - throw new InvalidData("Don't know what to do with node "+field.getNodeName()); + throw new InvalidDataException("Don't know what to do with node "+field.getNodeName()); } @@ -211,7 +211,7 @@ public class Outcome implements C2KLocalObject { return mData; } - public Schema getSchema() throws ObjectNotFound { + public Schema getSchema() throws ObjectNotFoundException { return LocalObjectLoader.getSchema(mSchemaType, mSchemaVersion); } diff --git a/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java b/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java index 2c4427e..e152df9 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java +++ b/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java @@ -20,11 +20,11 @@ */ package com.c2kernel.persistency.outcome; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.entity.agent.Job; public interface OutcomeInitiator { - public String initOutcome(Job job) throws InvalidData; + public String initOutcome(Job job) throws InvalidDataException; } diff --git a/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java b/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java index d89f7e7..80af535 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java +++ b/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java @@ -38,7 +38,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.utils.Logger; /************************************************************************** @@ -69,7 +69,7 @@ public class OutcomeValidator implements ErrorHandler, XMLErrorHandler { XMLGrammarPoolImpl schemaGrammarPool = new XMLGrammarPoolImpl(1); SymbolTable sym = new SymbolTable(); - public static OutcomeValidator getValidator(Schema schema) throws InvalidData { + public static OutcomeValidator getValidator(Schema schema) throws InvalidDataException { if (schema.docType.equals("Schema") && schema.docVersion==0) @@ -82,11 +82,11 @@ public class OutcomeValidator implements ErrorHandler, XMLErrorHandler { errors = new StringBuffer(); } - public OutcomeValidator(Schema schema) throws InvalidData { + public OutcomeValidator(Schema schema) throws InvalidDataException { this.schema = schema; if (schema.docType.equals("Schema")) - throw new InvalidData("Use SchemaValidator to validate schema"); + throw new InvalidDataException("Use SchemaValidator to validate schema"); errors = new StringBuffer(); Logger.msg(5, "Parsing "+schema.docType+" version "+schema.docVersion+". "+schema.schema.length()+" chars"); @@ -103,11 +103,11 @@ public class OutcomeValidator implements ErrorHandler, XMLErrorHandler { try { preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, new XMLInputSource(null, null, null, new StringReader(schema.schema), null)); } catch (IOException ex) { - throw new InvalidData("Error parsing schema: "+ex.getMessage()); + throw new InvalidDataException("Error parsing schema: "+ex.getMessage()); } if (errors.length() > 0) { - throw new InvalidData("Schema error: \n"+errors.toString()); + throw new InvalidDataException("Schema error: \n"+errors.toString()); } } diff --git a/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java b/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java index 151bf65..4ef0109 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java +++ b/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java @@ -20,8 +20,8 @@ */ package com.c2kernel.persistency.outcome; -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.events.Event; @@ -70,8 +70,8 @@ public class Viewpoint implements C2KLocalObject { this.eventId = eventId; } - public Outcome getOutcome() throws ObjectNotFound, PersistencyException { - if (eventId == NONE) throw new ObjectNotFound("No last eventId defined"); + public Outcome getOutcome() throws ObjectNotFoundException, PersistencyException { + if (eventId == NONE) throw new ObjectNotFoundException("No last eventId defined"); Outcome retVal = (Outcome)Gateway.getStorage().get(itemPath, ClusterStorage.OUTCOME+"/"+schemaName+"/"+schemaVersion+"/"+eventId, null); return retVal; } @@ -194,10 +194,10 @@ public class Viewpoint implements C2KLocalObject { * @return GDataRecord */ public Event getEvent() - throws InvalidData, PersistencyException, ObjectNotFound + throws InvalidDataException, PersistencyException, ObjectNotFoundException { if (eventId == NONE) - throw new InvalidData("No last eventId defined"); + throw new InvalidDataException("No last eventId defined"); return (Event)Gateway.getStorage().get(itemPath, ClusterStorage.HISTORY+"/"+eventId, null); } diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index eebdc47..6a82363 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -30,8 +30,8 @@ import java.util.UUID; import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.proxy.AgentProxy; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.events.Event; @@ -176,7 +176,7 @@ public class Bootstrap Logger.error("Bootstrap.verifyResource() - Module clash! Resource '"+itemName+"' included in module "+moduleName+" but is assigned to '"+itemModule+"'. Not overwriting."); return path; } - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { itemModule = ""; } @@ -214,7 +214,7 @@ public class Bootstrap } } - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.msg("Bootstrap.verifyResource() - Item "+itemName+" exists but version "+version+" not found! Attempting to insert new."); } @@ -225,7 +225,7 @@ public class Bootstrap String error = validator.validate(newOutcome.getData()); if (error.length() > 0) { Logger.error("Outcome not valid: \n " + error); - throw new InvalidData(error); + throw new InvalidDataException(error); } } @@ -287,7 +287,7 @@ public class Bootstrap if (ns!=null && Gateway.getProperties().getBoolean("Module.debug", false)) try { ca = (CompositeActivity) ((CompositeActivityDef)LocalObjectLoader.getActDef(impHandler.getWorkflowName(), 0)).instantiate(); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.error("Module resource workflow "+impHandler.getWorkflowName()+" not found. Using empty."); } @@ -313,7 +313,7 @@ public class Bootstrap systemAgents.put(name, Gateway.getProxyManager().getAgentProxy(lookup.getAgentPath(name))); Logger.msg(3, "Bootstrap.checkAgent() - User '"+name+"' found."); return; - } catch (ObjectNotFound ex) { } + } catch (ObjectNotFoundException ex) { } Logger.msg("Bootstrap.checkAgent() - User '"+name+"' not found. Creating."); @@ -365,7 +365,7 @@ public class Bootstrap ItemPath serverEntity; try { serverEntity = thisServerPath.getItemPath(); - } catch (ObjectNotFound ex) { + } catch (ObjectNotFoundException ex) { Logger.msg("Creating server item "+thisServerPath); serverEntity = new ItemPath(); Gateway.getCorbaServer().createItem(serverEntity); diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index 25f5d9a..5dde6e6 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -29,9 +29,9 @@ import java.net.MalformedURLException; import java.util.Enumeration; import java.util.Properties; -import com.c2kernel.common.CannotManage; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.CannotManageException; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.CorbaServer; import com.c2kernel.entity.proxy.AgentProxy; @@ -97,9 +97,9 @@ public class Gateway * * @param props - java.util.Properties containing all application properties. * If null, the java system properties are used - * @throws InvalidData - invalid properties caused a failure in initialisation + * @throws InvalidDataException - invalid properties caused a failure in initialisation */ - static public void init(Properties props) throws InvalidData { + static public void init(Properties props) throws InvalidDataException { init(props, null); } @@ -111,9 +111,9 @@ public class Gateway * If null, the java system properties are used * @param res - ResourceLoader for the kernel to use to resolve all class resource requests * such as for bootstrap descriptions and version information - * @throws InvalidData - invalid properties caused a failure in initialisation + * @throws InvalidDataException - invalid properties caused a failure in initialisation */ - static public void init(Properties props, ResourceLoader res) throws InvalidData { + static public void init(Properties props, ResourceLoader res) throws InvalidDataException { // Init properties & resources mC2KProps.clear(); @@ -130,7 +130,7 @@ public class Gateway try { mMarshaller = new CastorXMLUtility(mResource, props, mResource.getKernelResourceURL("mapFiles/")); } catch (MalformedURLException e1) { - throw new InvalidData("Invalid Resource Location"); + throw new InvalidDataException("Invalid Resource Location"); } @@ -139,7 +139,7 @@ public class Gateway mModules = new ModuleManager(mResource.getModuleDefURLs(), AbstractMain.isServer); } catch (Exception e) { Logger.error(e); - throw new InvalidData("Could not load module definitions."); + throw new InvalidDataException("Could not load module definitions."); } // merge in module props @@ -168,9 +168,9 @@ public class Gateway * bootstrap to create the root LDAP contexts, initialises the CORBA server and * time-out manager. * - * @throws InvalidData - error initialising + * @throws InvalidDataException - error initialising */ - static public void startServer(Authenticator auth) throws InvalidData, CannotManage { + static public void startServer(Authenticator auth) throws InvalidDataException, CannotManageException { try { // check top level directory contexts if (mLookup instanceof LookupManager) { @@ -178,7 +178,7 @@ public class Gateway mLookupManager.initializeDirectory(); } else { - throw new CannotManage("Lookup implementation is not a LookupManager. Cannot write to directory"); + throw new CannotManageException("Lookup implementation is not a LookupManager. Cannot write to directory"); } // start entity proxy server @@ -222,11 +222,11 @@ public class Gateway * Connects to the LDAP server in an administrative context - using the admin username and * password given in the LDAP.user and LDAP.password props of the kernel properties. * - * @throws InvalidData - bad params + * @throws InvalidDataException - bad params * @throws PersistencyException - error starting storages */ static public Authenticator connect() - throws InvalidData, + throws InvalidDataException, PersistencyException { try { @@ -242,7 +242,7 @@ public class Gateway return auth; } catch (Exception ex) { Logger.error(ex); - throw new InvalidData("Cannot connect server process. Please check config."); + throw new InvalidDataException("Cannot connect server process. Please check config."); } @@ -254,18 +254,18 @@ public class Gateway * @param agentName - username * @param agentPassword - password * @return an AgentProxy on the requested user - * @throws InvalidData + * @throws InvalidDataException * @throws PersistencyException * @throws ClassNotFoundException * @throws IllegalAccessException * @throws InstantiationException */ static public AgentProxy connect(String agentName, String agentPassword, String resource) - throws InvalidData, ObjectNotFound, PersistencyException, InstantiationException, IllegalAccessException, ClassNotFoundException + throws InvalidDataException, ObjectNotFoundException, PersistencyException, InstantiationException, IllegalAccessException, ClassNotFoundException { Authenticator auth = (Authenticator)mC2KProps.getInstance("Authenticator"); if (!auth.authenticate(agentName, agentPassword, resource)) - throw new InvalidData("Login failed"); + throw new InvalidDataException("Login failed"); mLookup = (Lookup)mC2KProps.getInstance("Lookup"); mLookup.open(auth); @@ -286,7 +286,7 @@ public class Gateway } static public AgentProxy connect(String agentName, String agentPassword) - throws InvalidData, ObjectNotFound, PersistencyException, InstantiationException, IllegalAccessException, ClassNotFoundException + throws InvalidDataException, ObjectNotFoundException, PersistencyException, InstantiationException, IllegalAccessException, ClassNotFoundException { return connect(agentName, agentPassword, null); } @@ -358,10 +358,10 @@ public class Gateway return mLookup; } - static public LookupManager getLookupManager() throws CannotManage + static public LookupManager getLookupManager() throws CannotManageException { if (mLookupManager == null) - throw new CannotManage("No Lookup Manager created. Not a server process."); + throw new CannotManageException("No Lookup Manager created. Not a server process."); else return mLookupManager; } diff --git a/src/main/java/com/c2kernel/process/UserCodeProcess.java b/src/main/java/com/c2kernel/process/UserCodeProcess.java index 4a4d7f4..bc7e23e 100644 --- a/src/main/java/com/c2kernel/process/UserCodeProcess.java +++ b/src/main/java/com/c2kernel/process/UserCodeProcess.java @@ -25,7 +25,7 @@ import java.net.UnknownHostException; import java.util.ArrayList; import java.util.HashMap; -import com.c2kernel.common.InvalidTransition; +import com.c2kernel.common.InvalidTransitionException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.agent.Job; import com.c2kernel.entity.proxy.AgentProxy; @@ -139,7 +139,7 @@ public class UserCodeProcess extends StandardClient implements ProxyObserver moduleBaseURLs = new HashMap(); private final HashMap allBaseURLs = new HashMap(); - public Resource() throws InvalidData { + public Resource() throws InvalidDataException { baseURL = getURLorResURL("com/c2kernel/utils/resources/"); allBaseURLs.put(null, baseURL); } @@ -89,7 +89,7 @@ public class Resource implements ResourceLoader { * @see com.c2kernel.utils.ResourceLoader#addModuleBaseURL(java.lang.String, java.lang.String) */ @Override - public void addModuleBaseURL(String ns, String newBaseURL) throws InvalidData { + public void addModuleBaseURL(String ns, String newBaseURL) throws InvalidDataException { addModuleBaseURL(ns, getURLorResURL(newBaseURL)); } @@ -113,7 +113,7 @@ public class Resource implements ResourceLoader { return new URL(moduleBaseURLs.get(ns), resName); } - static private URL getURLorResURL(String newURL) throws InvalidData { + static private URL getURLorResURL(String newURL) throws InvalidDataException { URL result; try { result = new URL(newURL); @@ -124,7 +124,7 @@ public class Resource implements ResourceLoader { } if (result == null) { Logger.error("URL "+newURL+" could not be found"); - throw new InvalidData(); + throw new InvalidDataException(); } return result; } @@ -137,7 +137,7 @@ public class Resource implements ResourceLoader { for (String ns : getAllBaseURLs().keySet()) { try { return getTextResource(ns, resName); - } catch (ObjectNotFound ex) { } + } catch (ObjectNotFoundException ex) { } } Logger.warning("Text resource '"+resName+"' not found."); return null; @@ -152,7 +152,7 @@ public class Resource implements ResourceLoader { for (String ns : getAllBaseURLs().keySet()) { try { results.put(ns, getTextResource(ns, resName)); - } catch (ObjectNotFound ex) { } + } catch (ObjectNotFoundException ex) { } } return results; } @@ -161,7 +161,7 @@ public class Resource implements ResourceLoader { * @see com.c2kernel.utils.ResourceLoader#getTextResource(java.lang.String, java.lang.String) */ @Override - public String getTextResource(String ns, String resName) throws ObjectNotFound + public String getTextResource(String ns, String resName) throws ObjectNotFoundException // throws IOException { Logger.msg(8, "Resource::getTextResource() - Getting resource from "+ns+": " + resName); @@ -184,7 +184,7 @@ public class Resource implements ResourceLoader { txtCache.put(ns+'/'+resName, newRes); return newRes; } catch (Exception e) { - throw new ObjectNotFound(e.getMessage()); + throw new ObjectNotFoundException(e.getMessage()); } } diff --git a/src/main/java/com/c2kernel/process/resource/ResourceLoader.java b/src/main/java/com/c2kernel/process/resource/ResourceLoader.java index ff5b489..d05831a 100644 --- a/src/main/java/com/c2kernel/process/resource/ResourceLoader.java +++ b/src/main/java/com/c2kernel/process/resource/ResourceLoader.java @@ -25,8 +25,8 @@ import java.net.URL; import java.util.Enumeration; import java.util.HashMap; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; public interface ResourceLoader { @@ -38,7 +38,7 @@ public interface ResourceLoader { public void addModuleBaseURL(String ns, URL newBaseURL); public void addModuleBaseURL(String ns, String newBaseURL) - throws InvalidData; + throws InvalidDataException; public HashMap getModuleBaseURLs(); @@ -54,7 +54,7 @@ public interface ResourceLoader { public HashMap getAllTextResources(String resName); public String getTextResource(String ns, String resName) - throws ObjectNotFound; + throws ObjectNotFoundException; public Class getClassForName(String name) throws ClassNotFoundException; diff --git a/src/main/java/com/c2kernel/property/PropertyDescriptionList.java b/src/main/java/com/c2kernel/property/PropertyDescriptionList.java index a4e226d..d06fb3d 100644 --- a/src/main/java/com/c2kernel/property/PropertyDescriptionList.java +++ b/src/main/java/com/c2kernel/property/PropertyDescriptionList.java @@ -23,7 +23,7 @@ package com.c2kernel.property; import java.util.ArrayList; import java.util.HashMap; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.utils.CastorArrayList; public class PropertyDescriptionList extends CastorArrayList @@ -68,12 +68,12 @@ public class PropertyDescriptionList extends CastorArrayList validatedInitProps = new HashMap(); for (Property initProp : initProps.list) { if (!definesProperty(initProp.getName())) - throw new InvalidData("Property "+initProp.getName()+" has not been declared in the property descriptions"); + throw new InvalidDataException("Property "+initProp.getName()+" has not been declared in the property descriptions"); else validatedInitProps.put(initProp.getName(), initProp.getValue()); } diff --git a/src/main/java/com/c2kernel/property/PropertyUtility.java b/src/main/java/com/c2kernel/property/PropertyUtility.java index b345962..787c645 100644 --- a/src/main/java/com/c2kernel/property/PropertyUtility.java +++ b/src/main/java/com/c2kernel/property/PropertyUtility.java @@ -23,7 +23,7 @@ package com.c2kernel.property; import java.util.ArrayList; import java.util.Iterator; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.persistency.ClusterStorage; import com.c2kernel.persistency.outcome.Outcome; @@ -66,7 +66,7 @@ public class PropertyUtility } - static public PropertyDescriptionList getPropertyDescriptionOutcome(ItemPath itemPath, String descVer) throws ObjectNotFound + static public PropertyDescriptionList getPropertyDescriptionOutcome(ItemPath itemPath, String descVer) throws ObjectNotFoundException { try { @@ -76,7 +76,7 @@ public class PropertyUtility catch (Exception ex) { Logger.error(ex); - throw new ObjectNotFound("Could not fetch PropertyDescription from "+itemPath); + throw new ObjectNotFoundException("Could not fetch PropertyDescription from "+itemPath); } } diff --git a/src/main/java/com/c2kernel/scripting/Script.java b/src/main/java/com/c2kernel/scripting/Script.java index f9acd55..6ca1b9c 100644 --- a/src/main/java/com/c2kernel/scripting/Script.java +++ b/src/main/java/com/c2kernel/scripting/Script.java @@ -44,7 +44,7 @@ import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.InputSource; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.agent.Job; import com.c2kernel.entity.proxy.AgentProxy; import com.c2kernel.entity.proxy.ItemProxy; @@ -222,7 +222,7 @@ public class Script mVersion = scriptVersion; parseScriptXML(LocalObjectLoader.getScript(scriptName, scriptVersion)); } - catch (ObjectNotFound e) + catch (ObjectNotFoundException e) { throw new ScriptingEngineException("Script '"+scriptName+"' not found"); } diff --git a/src/main/java/com/c2kernel/utils/ActDefCache.java b/src/main/java/com/c2kernel/utils/ActDefCache.java index da171da..785a50d 100644 --- a/src/main/java/com/c2kernel/utils/ActDefCache.java +++ b/src/main/java/com/c2kernel/utils/ActDefCache.java @@ -23,8 +23,8 @@ */ package com.c2kernel.utils; -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.proxy.ItemProxy; import com.c2kernel.lifecycle.ActivityDef; @@ -41,7 +41,7 @@ public class ActDefCache extends DescriptionObjectCache { } @Override - public ActivityDef loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFound, InvalidData { + public ActivityDef loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFoundException, InvalidDataException { ActivityDef thisActDef; String actType = proxy.getProperty("Complexity"); Viewpoint actView = (Viewpoint)proxy.getObject(ClusterStorage.VIEWPOINT + "/" + actType + "ActivityDef/" + version); @@ -50,14 +50,14 @@ public class ActDefCache extends DescriptionObjectCache { marshalledAct = actView.getOutcome().getData(); } catch (PersistencyException ex) { Logger.error(ex); - throw new ObjectNotFound("Problem loading "+name+" v"+version+": "+ex.getMessage()); + throw new ObjectNotFoundException("Problem loading "+name+" v"+version+": "+ex.getMessage()); } try { thisActDef = (ActivityDef)Gateway.getMarshaller().unmarshall(marshalledAct); thisActDef.getProperties().put("Version", version); } catch (Exception ex) { Logger.error(ex); - throw new InvalidData("Could not unmarshall '"+name+"' v"+version+": "+ex.getMessage()); + throw new InvalidDataException("Could not unmarshall '"+name+"' v"+version+": "+ex.getMessage()); } thisActDef.setName(name); thisActDef.setVersion(version); diff --git a/src/main/java/com/c2kernel/utils/CastorXMLUtility.java b/src/main/java/com/c2kernel/utils/CastorXMLUtility.java index 81a8e64..a084ea9 100644 --- a/src/main/java/com/c2kernel/utils/CastorXMLUtility.java +++ b/src/main/java/com/c2kernel/utils/CastorXMLUtility.java @@ -38,7 +38,7 @@ import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.ValidationException; import org.exolab.castor.xml.XMLContext; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.persistency.outcome.Outcome; import com.c2kernel.process.resource.ResourceLoader; @@ -66,11 +66,11 @@ public class CastorXMLUtility * configuration * @param mapURL * the root URL for the mapfiles - * @throws InvalidData + * @throws InvalidDataException */ public CastorXMLUtility(final ResourceLoader aResourceLoader, final Properties aAppProperties, final URL mapURL) - throws InvalidData { + throws InvalidDataException { // load index @@ -79,7 +79,7 @@ public class CastorXMLUtility try { index = FileStringUtility.url2String( new URL(mapURL, "index") ); } catch (Exception e) { - throw new InvalidData(String.format("Could not load map index from [%s]",mapURL)); + throw new InvalidDataException(String.format("Could not load map index from [%s]",mapURL)); } // retrieve the class loader of the class "CastorXMLUtility" @@ -135,13 +135,13 @@ public class CastorXMLUtility mappingContext.addMapping(thisMapping); } catch (MappingException ex) { Logger.error(ex); - throw new InvalidData("XML Mapping files are not valid: "+ex.getMessage()); + throw new InvalidDataException("XML Mapping files are not valid: "+ex.getMessage()); } catch (MalformedURLException ex) { Logger.error(ex); - throw new InvalidData("Mapping file location invalid: "+ex.getMessage()); + throw new InvalidDataException("Mapping file location invalid: "+ex.getMessage()); } catch (IOException ex) { Logger.error(ex); - throw new InvalidData("Could not read XML mapping files: "+ex.getMessage()); + throw new InvalidDataException("Could not read XML mapping files: "+ex.getMessage()); } Logger.msg(1, String.format("Loaded [%d] maps from [%s]", loadedMapURLs.size(), mapURL)); diff --git a/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java b/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java index 88a060d..d3eb5ec 100644 --- a/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java +++ b/src/main/java/com/c2kernel/utils/DescriptionObjectCache.java @@ -23,8 +23,8 @@ */ package com.c2kernel.utils; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.proxy.ProxyObserver; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.entity.proxy.MemberSubscription; @@ -35,7 +35,7 @@ public abstract class DescriptionObjectCache { SoftCache> cache = new SoftCache>(); - public D get(String name, int version) throws ObjectNotFound, InvalidData { + public D get(String name, int version) throws ObjectNotFoundException, InvalidDataException { D thisDef; synchronized(cache) { CacheEntry thisDefEntry = cache.get(name+"_"+version); @@ -55,7 +55,7 @@ public abstract class DescriptionObjectCache { public abstract String getDefRoot(); - public abstract D loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFound, InvalidData; + public abstract D loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFoundException, InvalidDataException; public void removeObject(String id) { synchronized(cache) { diff --git a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java index 434c24d..186b599 100644 --- a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java +++ b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java @@ -22,8 +22,8 @@ package com.c2kernel.utils; import java.util.Iterator; -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.proxy.ItemProxy; import com.c2kernel.lifecycle.ActivityDef; @@ -40,22 +40,22 @@ public class LocalObjectLoader { private static StateMachineCache smCache = new StateMachineCache(); static public ItemProxy loadLocalObjectDef(String root, String name) - throws ObjectNotFound + throws ObjectNotFoundException { DomainPath defRoot = new DomainPath(root); Iterator e = Gateway.getLookup().search(defRoot, name); if (e.hasNext()) { DomainPath defPath = (DomainPath)e.next(); - if (e.hasNext()) throw new ObjectNotFound("Too many matches for "+name+" in "+root); + if (e.hasNext()) throw new ObjectNotFoundException("Too many matches for "+name+" in "+root); return Gateway.getProxyManager().getProxy(defPath); } else { - throw new ObjectNotFound("No match for "+name+" in "+root); + throw new ObjectNotFoundException("No match for "+name+" in "+root); } } - static public String getScript(String scriptName, int scriptVersion) throws ObjectNotFound { + static public String getScript(String scriptName, int scriptVersion) throws ObjectNotFoundException { Logger.msg(5, "Loading script "+scriptName+" v"+scriptVersion); try { ItemProxy script = loadLocalObjectDef("/desc/Script/", scriptName); @@ -63,12 +63,12 @@ public class LocalObjectLoader { return scriptView.getOutcome().getData(); } catch (PersistencyException ex) { Logger.error(ex); - throw new ObjectNotFound("Error loading script " + scriptName + " version " + scriptVersion); + throw new ObjectNotFoundException("Error loading script " + scriptName + " version " + scriptVersion); } } - static public Schema getSchema(String schemaName, int schemaVersion) throws ObjectNotFound { + static public Schema getSchema(String schemaName, int schemaVersion) throws ObjectNotFoundException { Logger.msg(5, "Loading schema "+schemaName+" v"+schemaVersion); String docType = schemaName; @@ -85,7 +85,7 @@ public class LocalObjectLoader { schemaData = schemaView.getOutcome().getData(); } catch (PersistencyException ex) { Logger.error(ex); - throw new ObjectNotFound("Problem loading schema "+schemaName+" v"+schemaVersion+": "+ex.getMessage()); + throw new ObjectNotFoundException("Problem loading schema "+schemaName+" v"+schemaVersion+": "+ex.getMessage()); } return new Schema(docType, docVersion, schemaData); } @@ -96,14 +96,14 @@ public class LocalObjectLoader { * @param actName - activity name * @param version - named version (String) * @return ActivityDef - * @throws ObjectNotFound - When activity or version does not exist + * @throws ObjectNotFoundException - When activity or version does not exist */ - static public ActivityDef getActDef(String actName, int actVersion) throws ObjectNotFound, InvalidData { + static public ActivityDef getActDef(String actName, int actVersion) throws ObjectNotFoundException, InvalidDataException { Logger.msg(5, "Loading activity def "+actName+" v"+actVersion); return actCache.get(actName, actVersion); } - static public StateMachine getStateMachine(String smName, int smVersion) throws ObjectNotFound, InvalidData { + static public StateMachine getStateMachine(String smName, int smVersion) throws ObjectNotFoundException, InvalidDataException { Logger.msg(5, "Loading activity def "+smName+" v"+smVersion); return smCache.get(smName, smVersion); } diff --git a/src/main/java/com/c2kernel/utils/StateMachineCache.java b/src/main/java/com/c2kernel/utils/StateMachineCache.java index 9b9e464..02eb881 100644 --- a/src/main/java/com/c2kernel/utils/StateMachineCache.java +++ b/src/main/java/com/c2kernel/utils/StateMachineCache.java @@ -23,8 +23,8 @@ */ package com.c2kernel.utils; -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.proxy.ItemProxy; import com.c2kernel.lifecycle.instance.stateMachine.StateMachine; @@ -41,7 +41,7 @@ public class StateMachineCache extends DescriptionObjectCache { } @Override - public StateMachine loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFound, InvalidData { + public StateMachine loadObject(String name, int version, ItemProxy proxy) throws ObjectNotFoundException, InvalidDataException { StateMachine thisStateMachine; Viewpoint smView = (Viewpoint)proxy.getObject(ClusterStorage.VIEWPOINT + "/StateMachine/" + version); String marshalledSM; @@ -49,14 +49,14 @@ public class StateMachineCache extends DescriptionObjectCache { marshalledSM = smView.getOutcome().getData(); } catch (PersistencyException ex) { Logger.error(ex); - throw new ObjectNotFound("Problem loading State Machine "+name+" v"+version+": "+ex.getMessage()); + throw new ObjectNotFoundException("Problem loading State Machine "+name+" v"+version+": "+ex.getMessage()); } try { thisStateMachine = (StateMachine)Gateway.getMarshaller().unmarshall(marshalledSM); thisStateMachine.validate(); } catch (Exception ex) { Logger.error(ex); - throw new InvalidData("Could not unmarshall State Machine '"+name+"' v"+version+": "+ex.getMessage()); + throw new InvalidDataException("Could not unmarshall State Machine '"+name+"' v"+version+": "+ex.getMessage()); } thisStateMachine.setName(name); thisStateMachine.setVersion(version); -- cgit v1.2.3