You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2012/03/01 14:58:18 UTC
svn commit: r1295564 - in /tuscany/sca-java-2.x/trunk/modules:
contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/
contribution/src/main/resources/
implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/...
Author: slaws
Date: Thu Mar 1 13:58:17 2012
New Revision: 1295564
URL: http://svn.apache.org/viewvc?rev=1295564&view=rev
Log:
TUSCANY-4020 - move a few more hardcoded message strings into properties files
Modified:
tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java
tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties
tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties
tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties
Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java?rev=1295564&r1=1295563&r2=1295564&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/ContributionContentProcessor.java Thu Mar 1 13:58:17 2012
@@ -269,10 +269,14 @@ public class ContributionContentProcesso
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);
+ }
}
}
Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties?rev=1295564&r1=1295563&r2=1295564&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties (original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/contribution-xml-validation-messages.properties Thu Mar 1 13:58:17 2012
@@ -23,3 +23,4 @@ IOException = IOException occured due to
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.
Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java?rev=1295564&r1=1295563&r2=1295564&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java Thu Mar 1 13:58:17 2012
@@ -61,11 +61,9 @@ import org.apache.tuscany.sca.implementa
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
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
Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties?rev=1295564&r1=1295563&r2=1295564&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties Thu Mar 1 13:58:17 2012
@@ -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
Modified: tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java?rev=1295564&r1=1295563&r2=1295564&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java Thu Mar 1 13:58:17 2012
@@ -22,10 +22,8 @@ package org.apache.tuscany.sca.interface
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 exte
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 exte
} // 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 exte
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 exte
} // 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 exte
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);
}
Modified: tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties?rev=1295564&r1=1295563&r2=1295564&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/resources/interface-wsdlxml-validation-messages.properties Thu Mar 1 13:58:17 2012
@@ -24,4 +24,6 @@ InvalidWSDLInterfaceAttr = Invalid WSDL
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