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/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 ++--- 10 files changed, 73 insertions(+), 73 deletions(-) (limited to 'src/main/java/com/c2kernel/process') 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; -- cgit v1.2.3