diff options
6 files changed, 48 insertions, 22 deletions
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java index 670348ffce..58abc98d21 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java @@ -269,10 +269,14 @@ public class ContributionContentProcessor implements ExtendedURLArtifactProcesso if (packageName.equals(artifact.getURI().replace("/", "."))) available = true; } - if (!available) - throw new ContributionResolveException("[JCI100007] A Java package " + packageName - + " that is specified on an export " - + "element MUST be contained within the contribution containing the export element."); + if (!available) { + String message = context.getMonitor().getMessageString(ContributionContentProcessor.class.getName(), + "contribution-xml-validation-messages", + "ExportedPackageNotFound"); + message = message.replace("{0}", packageName); + + throw new ContributionResolveException(message); + } } } diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties b/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties index 6d6c0aa428..2afbaa2230 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties @@ -23,3 +23,4 @@ IOException = IOException occured due to : {0} AttributeCompositeMissing = Attribute ''composite'' is missing DuplicateJavaImports = [JCI10001] The value of the @package attribute on the <import.java/> element is not unique across all other <import.java/> elements within the contribution. DuplicateJavaExports = [JCI10004] The value of the @package attribute on the <export.java/> element is not unique across all other <export.java/> elements within the contribution. +ExportedPackageNotFound = [JCI100007] A Java package {0} that is specified on an export element MUST be contained within the contribution containing the export element. diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java index ebf905ec44..93120652ad 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java @@ -61,11 +61,9 @@ import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHe import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; import org.apache.tuscany.sca.monitor.Monitor; @@ -216,9 +214,14 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm javaImplementation.getServices().add(assemblyFactory.createService()); } } catch (Throwable e) { - throw new ContributionResolveException("Resolving Java implementation: " + javaImplementation.getName() - + ", " - + e.getMessage(), e); + + String message = context.getMonitor().getMessageString(JavaImplementationProcessor.class.getName(), + "impl-javaxml-validation-messages", + "ResolvingJavaImplementation"); + message = message.replace("{0}", javaImplementation.getName()); + message = message.replace("{1}", e.getMessage()); + + throw new ContributionResolveException(message, e); } // end try } // end method diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties b/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties index 4976bc0e9f..2358aaa43e 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties @@ -21,3 +21,4 @@ ClassNotFoundException = Class Not Found Exception: {0} ContributionResolveException = Contribution Resolve Exception occured due to: IllegalSCAAnnotation = [JCA9002] SCA annotations are not permitted on static members: {0}.{1} +ResolvingJavaImplementation = Resolving Java implementation: {0}, {1}
\ No newline at end of file diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index 3baed00daf..cab4c963a8 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -22,10 +22,8 @@ package org.apache.tuscany.sca.interfacedef.wsdl.xml; import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; import java.net.URI; -import java.util.List; import javax.wsdl.PortType; -import javax.wsdl.WSDLElement; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -291,8 +289,12 @@ public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements resolver.addModel(newWSDLInterface, context); wsdlInterface = newWSDLInterface; } catch (InvalidInterfaceException e) { - ContributionResolveException ce = new ContributionResolveException("Invalid interface when resolving " + - portType.toString(), e); + String message = context.getMonitor().getMessageString(WSDLInterfaceProcessor.class.getName(), + "interface-wsdlxml-validation-messages", + "InvalidInterface"); + message = message.replace("{0}", portType.toString()); + + ContributionResolveException ce = new ContributionResolveException(message, e); error(monitor, "ContributionResolveException", wsdlFactory, ce); //throw ce; } // end try @@ -302,8 +304,12 @@ public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements } // end if } else { // If we get here, the WSDLDefinition is unresolved... - ContributionResolveException ce = new ContributionResolveException("WSDLDefinition unresolved " + - wsdlInterface.getName() ); + String message = context.getMonitor().getMessageString(WSDLInterfaceProcessor.class.getName(), + "interface-wsdlxml-validation-messages", + "WSDLDefinitionUnresolved"); + message = message.replace("{0}", wsdlInterface.getName().toString()); + + ContributionResolveException ce = new ContributionResolveException(message); error(monitor, "ContributionResolveException", wsdlFactory, ce); } // end if } // end if @@ -343,8 +349,11 @@ public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements wsdlInterface.setWsdlDefinition(wsdlDefinition); resolver.addModel(wsdlInterface, context); } catch (InvalidInterfaceException e) { - ContributionResolveException ce = new ContributionResolveException("Invalid interface when resolving " + - portType.toString(), e); + String message = context.getMonitor().getMessageString(WSDLInterfaceProcessor.class.getName(), + "interface-wsdlxml-validation-messages", + "InvalidInterface"); + message = message.replace("{0}", portType.toString()); + ContributionResolveException ce = new ContributionResolveException(message, e); Monitor.error(monitor, WSDLInterfaceProcessor.class.getName(), "interface-wsdlxml-validation-messages", "ContributionResolveException", wsdlFactory.getClass().getName(), ce.getMessage()); @@ -358,8 +367,11 @@ public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements } // end if } else { // If we get here, the WSDLDefinition is unresolved... - ContributionResolveException ce = new ContributionResolveException("WSDLDefinition unresolved " + - wsdlInterface.getName() ); + String message = context.getMonitor().getMessageString(WSDLInterfaceProcessor.class.getName(), + "interface-wsdlxml-validation-messages", + "WSDLDefinitionUnresolved"); + message = message.replace("{0}", wsdlInterface.getName().toString()); + ContributionResolveException ce = new ContributionResolveException(message); Monitor.error(monitor, WSDLInterfaceProcessor.class.getName(), "interface-wsdlxml-validation-messages", "ContributionResolveException", wsdlFactory.getClass().getName(), ce.getMessage()); @@ -456,8 +468,11 @@ public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements newWSDLInterface.getPolicySets().addAll(wsdlInterface.getPolicySets()); wsdlInterface = newWSDLInterface; } catch (InvalidInterfaceException e) { - ContributionResolveException ce = new ContributionResolveException("Invalid interface when resolving " + - portType.toString(), e); + String message = context.getMonitor().getMessageString(WSDLInterfaceProcessor.class.getName(), + "interface-wsdlxml-validation-messages", + "InvalidInterface"); + message = message.replace("{0}", portType.toString()); + ContributionResolveException ce = new ContributionResolveException(message, e); error(monitor, "ContributionResolveException", wsdlFactory, ce); } diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties index 64c4a1b13e..beab450b36 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties @@ -24,4 +24,6 @@ InvalidWSDLInterfaceAttr = Invalid WSDL interface attribute: {0} WsdlInterfaceDoesNotMatch = The WSDL referenced by the interface.wsdl interface as ({0}) cannot be found in this contribution or in any imports that this contribution makes InvalidRemotableValue = The interface.wsdl interface {0} element can only have a remotable attribute with the value "true" as WSDL interface are assumed to be remotable by default. The value that was found is: {1}. IncompatibleCallbacks = The interface.wsdl element has a forward interface with a callback declared in the WSDL {0} and a callback interface also declared using the callbackInterface attribute {1} but the callback interfaces are not equal. -wsdliLocationException = Exception locating wsdli:location resource: {0}
\ No newline at end of file +wsdliLocationException = Exception locating wsdli:location resource: {0} +InvalidInterface = Invalid interface when resolving {0} +WSDLDefinitionUnresolved = WSDLDefinition unresolved {0}
\ No newline at end of file |