You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2008/05/28 19:15:16 UTC
svn commit: r661021 - in
/incubator/tuscany/java/sca/modules/implementation-resource/src/main:
java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
resources/impl-resource-validation-messages.properties
Author: lresende
Date: Wed May 28 10:15:16 2008
New Revision: 661021
URL: http://svn.apache.org/viewvc?rev=661021&view=rev
Log:
TUSCANY-2345 - Applying Ram's patch
Modified:
incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
incubator/tuscany/java/sca/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties
Modified: incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java?rev=661021&r1=661020&r2=661021&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java Wed May 28 10:15:16 2008
@@ -52,6 +52,7 @@
*/
public class ResourceImplementationProcessor implements StAXArtifactProcessor<ResourceImplementation> {
private static final QName IMPLEMENTATION_RESOURCE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.resource");
+ //private static final String MSG_LOCATION_MISSING = "Reading implementation.resource - location attribute missing";
private ContributionFactory contributionFactory;
private ResourceImplementationFactory implementationFactory;
@@ -77,6 +78,20 @@
}
}
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-resource-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
public QName getArtifactType() {
// Returns the QName of the XML element processed by this processor
return IMPLEMENTATION_RESOURCE;
@@ -90,16 +105,22 @@
public ResourceImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
// Read an <implementation.resource> element
+
+ // Create and initialize the resource implementation model
+ ResourceImplementation implementation = null;
- // Read the location attribute specifying the location of the
- // resources
+ // Read the location attribute specifying the location of the resources
String location = reader.getAttributeValue(null, "location");
- // Create an initialize the resource implementation model
- ResourceImplementation implementation = implementationFactory.createResourceImplementation();
- implementation.setLocation(location);
- implementation.setUnresolved(true);
-
+ if (location != null) {
+ implementation = implementationFactory.createResourceImplementation();
+ implementation.setLocation(location);
+ implementation.setUnresolved(true);
+ } else {
+ error("LocationAttributeMissing", reader);
+ //throw new ContributionReadException(MSG_LOCATION_MISSING);
+ }
+
// Skip to end element
while (reader.hasNext()) {
if (reader.next() == END_ELEMENT && IMPLEMENTATION_RESOURCE.equals(reader.getName())) {
@@ -123,7 +144,7 @@
} catch (IOException e) {
ContributionResolveException ce = new ContributionResolveException(e);
error("ContributionResolveException", resolver, ce);
- throw ce;
+ //throw ce;
}
}
}
Modified: incubator/tuscany/java/sca/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties?rev=661021&r1=661020&r2=661021&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties (original)
+++ incubator/tuscany/java/sca/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties Wed May 28 10:15:16 2008
@@ -18,4 +18,6 @@
# under the License.
#
#
-ContributionResolveException = ContributionResolveException occured due to:
\ No newline at end of file
+ContributionResolveException = ContributionResolveException occured due to:
+LocationAttributeMissing = Reading implementation.resource - location attribute missing
+CouldNotResolveLocation = Could not resolve implementation.resource location: {0}