summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java11
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java22
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java16
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java2
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties7
5 files changed, 43 insertions, 15 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
index 966c0ac275..d9fe434795 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
@@ -304,8 +304,13 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
property.setXSDType(getQName(reader, TYPE));
// MJE added 14/05/2009 - check for both @element and @type being present - disallowed by OASIS Assembly spec
if( property.getXSDElement() != null && property.getXSDType() != null ) {
- ContributionReadException ce = new ContributionReadException("[ASM40010,ASM60040] Error: property has both @type and @element attribute values - " +
- property.getName());
+ // TUSCANY-4020 - should get rid of the exception but that would mean getting OASIS to change the
+ // expected strings again
+ ContributionReadException ce = new ContributionReadException(context.getMonitor().getMessageString(BaseAssemblyProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "BothTypeAndElementAttributeFound") +
+ " - " +
+ property.getName());
error(context.getMonitor(), "ContributionReadException", property, ce);
} // end if
@@ -512,7 +517,7 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor {
// A property <value/> subelement MUST NOT be used when the @value attribute is used
// to specify the value for that property.
if (valueAttr != null) {
- error(context.getMonitor(), "ASM50033: value attribute exists for the property element", name, name);
+ error(context.getMonitor(), "ValueAttributeForPropertyElement", element, nameAttr);
}
// Read <value>
if (VALUE_QNAME.equals(name)) {
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
index 5ba42a0dec..47f61ffe23 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
@@ -73,14 +73,20 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements
*/
public Composite read(URL contributionURL, URI uri, URL url, ProcessorContext context) throws ContributionReadException {
if( uri == null || url == null ) {
- throw new ContributionReadException("Request to read composite with uri or url NULL");
+ throw new ContributionReadException(context.getMonitor().getMessageString(CompositeDocumentProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "NullURL"));
} // end if
InputStream scdlStream = null;
try {
scdlStream = IOHelper.openStream(url);
} catch (IOException e) {
- ContributionReadException ce = new ContributionReadException("Exception reading " + uri, e);
+ ContributionReadException ce = new ContributionReadException(context.getMonitor().getMessageString(CompositeDocumentProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "ReadException") +
+ " " +
+ uri, e);
error(context.getMonitor(), "ContributionReadException", url, ce);
throw ce;
}
@@ -119,7 +125,11 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements
return composite;
} catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException("Exception reading " + uri, e);
+ ContributionReadException ce = new ContributionReadException(context.getMonitor().getMessageString(CompositeDocumentProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "ReadException") +
+ " " +
+ uri, e);
error(context.getMonitor(), "ContributionReadException", inputFactory, ce);
throw ce;
} finally {
@@ -169,7 +179,11 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements
extensionProcessor.resolve(composite, resolver, context);
} catch (Throwable e ) {
// Add information about which composite was being processed when the exception occurred
- String newMessage = "Processing composite " + composite.getName() + ": " + e.getMessage();
+ String newMessage = context.getMonitor().getMessageString(CompositeDocumentProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "ProcessingComposite") +
+ " " +
+ composite.getName() + ": " + e.getMessage();
throw new ContributionResolveException( newMessage, e );
} // end try
}
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
index 55e4cc53ae..e32171a0ee 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -1040,15 +1040,19 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
if ((composite.isLocal() && resolved.isLocal()) || (!composite.isLocal() && !resolved.isLocal())) {
composite.getIncludes().set(i, resolved);
} else {
- ContributionResolveException ce =
- new ContributionResolveException("[ASM60041] Error: Composite " + composite.getName()
- + " can only include another composite with the identical @local attribute value");
+ String message = context.getMonitor().getMessageString(CompositeProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "LocalAttibuteMissmatch");
+ message = message.replace("{0}", composite.getName().toString());
+ ContributionResolveException ce = new ContributionResolveException(message);
error(monitor, "ContributionResolveException", include, ce);
}
} else {
- ContributionResolveException ce =
- new ContributionResolveException("[ASM60042] Error: Composite " + include.getName()
- + " is not a valid composite within the domain");
+ String message = context.getMonitor().getMessageString(CompositeProcessor.class.getName(),
+ Messages.RESOURCE_BUNDLE,
+ "CompositeNotFound");
+ message = message.replace("{0}", include.getName().toString());
+ ContributionResolveException ce = new ContributionResolveException(message);
error(monitor, "ContributionResolveException", include, ce);
}
}
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
index 2498f3df67..fa56bf0503 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
@@ -73,6 +73,4 @@ public interface PolicyConstants {
QName POLICY_SET_REFERENCE_QNAME = new QName(SCA11_NS, POLICY_SET_REFERENCE);
QName INTENT_QUALIFIER_QNAME = new QName(SCA11_NS, INTENT_QUALIFIER);
QName EXTERNAL_ATTACHMENT_QNAME = new QName(SCA11_NS, EXTERNAL_ATTACHMENT);
- String QUALIFIED_INTENT_CONSTRAINS_ERROR = " - Qualified Intents must not specify 'constrains' attribute";
-
}
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties b/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
index ba0137c85c..a50e7d347f 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
@@ -30,3 +30,10 @@ ContributionWriteException = ContributionWriteException occured due to : {0}
XMLStreamException = XMLStreamException occured due to : {0}
DuplicateCompositeName = [ASM_6001] More than one composite with the same name {0} found in contribution {1}
PropertyTypeNotFound = The type {0} specified on property {1} of {2} can''t be found in any loaded contribution (makes sure the .xsd file is in a contribution, that the contribution is being loaded and that contribution imports and exports are correct)
+BothTypeAndElementAttributeFound = [ASM40010,ASM60040] Error: property has both @type and @element attribute values
+ValueAttributeForPropertyElement = ASM50033: value attribute exists for the property element {0}
+NullURL = Request to read composite with uri or url NULL
+ReadException = Exception reading
+ProcessingComposite = Processing composite
+LocalAttibuteMissmatch = [ASM60041] Error: Composite {0} can only include another composite with the identical @local attribute value
+CompositeNotFound = [ASM60042] Error: Composite {0} is not a valid composite within the domain