From 1ee87f0f4c14a106c7b37eef7aa218ed95a337b1 Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 2 Dec 2011 18:55:36 +0000 Subject: Add ablity to specify endpoint descriptions in node.xml for local domain registry git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1209634 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultArtifactProcessorExtensionPoint.java | 21 +++++++++++++++++---- .../DefaultStAXArtifactProcessorExtensionPoint.java | 3 +-- ...DefaultStAXAttributeProcessorExtensionPoint.java | 3 +-- .../DefaultURLArtifactProcessorExtensionPoint.java | 3 +-- 4 files changed, 20 insertions(+), 10 deletions(-) (limited to 'sca-java-2.x/trunk/modules/contribution/src') diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java index c871e4c868..774971b8be 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java @@ -19,8 +19,12 @@ package org.apache.tuscany.sca.contribution.processor; import java.util.HashMap; +import java.util.List; import java.util.Map; +import org.apache.tuscany.sca.common.java.reflection.JavaIntrospectionHelper; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; + /** * The default implementation of an artifact processor extension point. * @@ -30,10 +34,15 @@ abstract class DefaultArtifactProcessorExtensionPoint

processorsByArtifactType = new HashMap(); protected final Map, P> processorsByModelType = new HashMap, P>(); + protected ExtensionPointRegistry registry; + private JavaIntrospectionHelper introspectionHelper; + /** * Constructs a new loader registry. */ - DefaultArtifactProcessorExtensionPoint() { + DefaultArtifactProcessorExtensionPoint(ExtensionPointRegistry registry) { + this.registry = registry; + this.introspectionHelper = JavaIntrospectionHelper.getInstance(registry); } /** @@ -53,14 +62,18 @@ abstract class DefaultArtifactProcessorExtensionPoint

P getProcessor(Class modelType) { - Class[] classes = modelType.getInterfaces(); + P processor = processorsByModelType.get(modelType); + if (processor != null) { + return processor; + } + List> classes = introspectionHelper.getAllInterfaces(modelType); for (Class c : classes) { - P processor = processorsByModelType.get(c); + processor = processorsByModelType.get(c); if (processor != null) { return processor; } } - return processorsByModelType.get(modelType); + return null; } } diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java index 151edeae0b..814c8c63ef 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java @@ -47,7 +47,6 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; public class DefaultStAXArtifactProcessorExtensionPoint extends DefaultArtifactProcessorExtensionPoint> implements StAXArtifactProcessorExtensionPoint { - private ExtensionPointRegistry registry; private FactoryExtensionPoint modelFactories; private boolean loaded; private StAXArtifactProcessor extensibleStAXProcessor; @@ -57,7 +56,7 @@ public class DefaultStAXArtifactProcessorExtensionPoint extends * Constructs a new extension point. */ public DefaultStAXArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) { - this.registry = extensionPoints; + super(extensionPoints); this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java index e76d6cb299..36dec73898 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java @@ -49,7 +49,6 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; public class DefaultStAXAttributeProcessorExtensionPoint extends DefaultArtifactProcessorExtensionPoint> implements StAXAttributeProcessorExtensionPoint { - private ExtensionPointRegistry registry; private FactoryExtensionPoint modelFactories; private StAXAttributeProcessor extensibleStAXAttributeProcessor; private boolean loaded; @@ -59,7 +58,7 @@ public class DefaultStAXAttributeProcessorExtensionPoint extends * Constructs a new extension point. */ public DefaultStAXAttributeProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) { - this.registry = extensionPoints; + super(extensionPoints); this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java index e22d7762fa..812695575d 100644 --- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java @@ -45,7 +45,6 @@ import org.apache.tuscany.sca.extensibility.ServiceDeclaration; public class DefaultURLArtifactProcessorExtensionPoint extends DefaultArtifactProcessorExtensionPoint> implements URLArtifactProcessorExtensionPoint { - private ExtensionPointRegistry registry; private StAXArtifactProcessor staxProcessor; private boolean loaded; @@ -53,7 +52,7 @@ public class DefaultURLArtifactProcessorExtensionPoint extends * Constructs a new extension point. */ public DefaultURLArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) { - this.registry = extensionPoints; + super(extensionPoints); FactoryExtensionPoint modelFactories = this.registry.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); -- cgit v1.2.3