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/entity/proxy/AgentProxy.java | 94 +++++++++++----------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/proxy/AgentProxy.java') 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)); } } -- cgit v1.2.3