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. --- 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 +- 22 files changed, 229 insertions(+), 229 deletions(-) (limited to 'src/main/java/com/c2kernel/entity') 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 } } -- cgit v1.2.3