From 68b75835263a6f8bebb74f0aa2731fb4c6ae4044 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 8 Dec 2010 05:47:27 +0000 Subject: Fixing minor issue when running regular resolution path (side effect of previous change) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1043311 13f79535-47bb-0310-9956-ffa450edef68 --- .../widget/WidgetImplementationProcessor.java | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'sca-java-2.x/trunk/modules/implementation-widget/src') diff --git a/sca-java-2.x/trunk/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/sca-java-2.x/trunk/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java index 39e6ae0606..b5b374baad 100644 --- a/sca-java-2.x/trunk/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java @@ -105,12 +105,12 @@ public class WidgetImplementationProcessor extends BaseStAXArtifactProcessor imp public void resolve(WidgetImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { - if (implementation != null) { - // Resolve the resource directory location + if (implementation != null) { + // Resolve the resource directory location Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(implementation.getLocation()); Artifact resolved = resolver.resolveModel(Artifact.class, artifact, context); - + if(resolved.getLocation() == null) { URL resource = null; URI uri = URI.create(implementation.getLocation()); @@ -134,24 +134,34 @@ public class WidgetImplementationProcessor extends BaseStAXArtifactProcessor imp implementation.setLocationURL(resource); - //introspect implementation - WidgetImplementationIntrospector widgetIntrospector = - new WidgetImplementationIntrospector(registry, implementation); - widgetIntrospector.introspectImplementation(); - - implementation.setUnresolved(false); } catch (MalformedURLException e) { ContributionResolveException ce = new ContributionResolveException(e); error(context.getMonitor(), "ContributionResolveException", resolver, ce); } } + } else { + try { + implementation.setLocationURL(new URL(resolved.getLocation())); + } catch (MalformedURLException e) { + ContributionResolveException ce = new ContributionResolveException(e); + error(context.getMonitor(), "ContributionResolveException", resolver, ce); + } } - + + //introspect implementation + WidgetImplementationIntrospector widgetIntrospector = + new WidgetImplementationIntrospector(registry, implementation); + widgetIntrospector.introspectImplementation(); + + implementation.setUnresolved(false); + + + if (implementation.isUnresolved()) { error(context.getMonitor(), "CouldNotResolveLocation", resolver, implementation.getLocation()); //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation()); } - } + } } public void write(WidgetImplementation implementation, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { -- cgit v1.2.3