diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-30 21:27:36 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-30 21:27:36 +0000 |
commit | 1ae56f2f860eef8a199cba88d236bf131389ba29 (patch) | |
tree | 4f9d731b78ef3ef179bb8aa228a2bd648277b712 /java/sca | |
parent | 09e93bd9cbaa43810711ea51b6cece62354920bd (diff) |
Relax the Monitor/Problem interfaces to take Throwable and Obbject...
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820459 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
9 files changed, 26 insertions, 31 deletions
diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java index a85b47f6f5..04763a3c4b 100644 --- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java +++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java @@ -72,11 +72,11 @@ public class BindingWSDLGenerator { * @param problem */ private static void logWarning(Problem problem) { - Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName()); + Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getResourceBundleName()); if (problemLogger != null){ problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null, problem.getMessageId(), problem.getMessageParams()); } else { - logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName()); + logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getResourceBundleName()); } } diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java index 548a14793f..7509f2ab57 100644 --- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java +++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java @@ -125,11 +125,11 @@ public class Interface2WSDLGenerator { * @param problem */ private static void logWarning(Problem problem) { - Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName()); + Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getResourceBundleName()); if (problemLogger != null){ problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null, problem.getMessageId(), problem.getMessageParams()); } else { - logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName()); + logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getResourceBundleName()); } } diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java index c573f5f62e..bfd95bd292 100644 --- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java +++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java @@ -83,11 +83,11 @@ public class WSDLServiceGenerator { * @param problem */ private static void logWarning(Problem problem) { - Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName()); + Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getResourceBundleName()); if (problemLogger != null){ problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null, problem.getMessageId(), problem.getMessageParams()); } else { - logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName()); + logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getResourceBundleName()); } } diff --git a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java index 87f115df7f..5129410e54 100644 --- a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java +++ b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java @@ -66,7 +66,7 @@ public abstract class Monitor { Severity severity, Object problemObject, String messageId, - Exception cause); + Throwable cause); /** * Create a new problem. @@ -134,7 +134,7 @@ public abstract class Monitor { Object reportingObject, String messageBundle, String messageId, - String... messageParameters){ + Object... messageParameters){ if (monitor != null) { Problem problem = monitor.createProblem(reportingObject.getClass().getName(), @@ -142,7 +142,7 @@ public abstract class Monitor { Severity.WARNING, null, messageId, - (Object[])messageParameters); + messageParameters); monitor.problem(problem); } else { System.out.println("Attempt to report warning with id " + @@ -167,7 +167,7 @@ public abstract class Monitor { Object reportingObject, String messageBundle, String messageId, - String... messageParameters){ + Object... messageParameters){ if (monitor != null) { Problem problem = monitor.createProblem(reportingObject.getClass().getName(), @@ -175,7 +175,7 @@ public abstract class Monitor { Severity.ERROR, null, messageId, - (Object[])messageParameters); + messageParameters); monitor.problem(problem); } else { System.out.println("Attempt to report error with id " + @@ -200,7 +200,7 @@ public abstract class Monitor { Object reportingObject, String messageBundle, String messageId, - Exception cause){ + Throwable cause){ if (monitor != null) { Problem problem = monitor.createProblem(reportingObject.getClass().getName(), diff --git a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java index 61a90333ab..3c8fa80fc3 100644 --- a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java +++ b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java @@ -32,7 +32,7 @@ public interface Problem { String getSourceClassName(); - String getBundleName(); + String getResourceBundleName(); Severity getSeverity(); @@ -42,7 +42,7 @@ public interface Problem { String getMessageId(); - Exception getCause(); + Throwable getCause(); Object[] getMessageParams(); } diff --git a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java index 48aeda3a55..74022c62db 100644 --- a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java +++ b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java @@ -48,12 +48,12 @@ public class MonitorImpl extends Monitor { public void problem(Problem problem) { - Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName()); + Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getResourceBundleName()); if (problemLogger == null) { logger.severe("Can't get logger " + problem.getSourceClassName() + " with bundle " - + problem.getBundleName()); + + problem.getResourceBundleName()); } if (problem.getSeverity() == Severity.INFO) { @@ -68,7 +68,7 @@ public class MonitorImpl extends Monitor { if (problem.getCause() != null) { problemCache.add(problem); problemLogger.logp(Level.SEVERE, problem.getSourceClassName(), problem.getContext(), problem.getMessageId(), problem - .getCause().toString()); + .getCause()); } else { problemCache.add(problem); @@ -94,7 +94,7 @@ public class MonitorImpl extends Monitor { Severity severity, Object problemObject, String messageId, - Exception cause) { + Throwable cause) { return new ProblemImpl(sourceClassName, bundleName, severity, contextStack.toString(), problemObject, messageId, cause); } diff --git a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java index de6ee2c525..e1847e7b5f 100644 --- a/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java +++ b/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java @@ -41,7 +41,7 @@ public class ProblemImpl implements Problem { private Object problemObject; private String messageId; private Object[] messageParams; - private Exception cause; + private Throwable cause; /** * Construct a new problem @@ -87,7 +87,7 @@ public class ProblemImpl implements Problem { String context, Object problemObject, String messageId, - Exception cause) { + Throwable cause) { this.sourceClassName = sourceClassName; this.bundleName = bundleName; this.severity = severity; @@ -101,7 +101,7 @@ public class ProblemImpl implements Problem { return sourceClassName; } - public String getBundleName() { + public String getResourceBundleName() { return bundleName; } @@ -125,7 +125,7 @@ public class ProblemImpl implements Problem { return messageParams; } - public Exception getCause() { + public Throwable getCause() { return cause; } diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java index e5be18e5b9..052f15b2dc 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java @@ -24,13 +24,10 @@ import static org.apache.tuscany.sca.common.java.io.IOHelper.createURI; import static org.apache.tuscany.sca.common.java.io.IOHelper.openStream; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.security.AccessController; @@ -279,7 +276,7 @@ public class NodeFactoryImpl extends NodeFactory { * * @throws Exception */ - private void analyzeProblems() throws Exception { + private void analyzeProblems() throws Throwable { for (Problem problem : monitor.getProblems()) { if ((problem.getSeverity() == Severity.ERROR)) { if (problem.getCause() != null) { @@ -478,7 +475,7 @@ public class NodeFactoryImpl extends NodeFactory { } protected Composite configureNode(NodeConfiguration configuration, List<Contribution> contributions) - throws Exception { + throws Throwable { if (contributions == null) { // Load contributions contributions = loadContributions(configuration); @@ -569,8 +566,7 @@ public class NodeFactoryImpl extends NodeFactory { return domainComposite; } - private List<Contribution> loadContributions(NodeConfiguration configuration) throws MalformedURLException, - ContributionReadException, XMLStreamException, IOException, UnsupportedEncodingException, Exception { + private List<Contribution> loadContributions(NodeConfiguration configuration) throws Throwable { List<Contribution> contributions = new ArrayList<Contribution>(); // Load the specified contributions diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index cd279f9fcd..82a5b01726 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -34,7 +34,6 @@ import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.common.java.io.IOHelper; import org.apache.tuscany.sca.context.ThreadMessageContext; @@ -145,7 +144,7 @@ public class NodeImpl implements Node, Client { return this; - } catch (Exception e) { + } catch (Throwable e) { throw new IllegalStateException(e); } |