summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/contribution/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2011-12-02 18:55:36 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2011-12-02 18:55:36 +0000
commit1ee87f0f4c14a106c7b37eef7aa218ed95a337b1 (patch)
tree99e02ee701e18738bcfe6eea759b96c56a5d502c /sca-java-2.x/trunk/modules/contribution/src
parentf37a2fbbdc9a296727c533194a7f6fb90904d367 (diff)
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
Diffstat (limited to 'sca-java-2.x/trunk/modules/contribution/src')
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java21
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java3
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java3
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java3
4 files changed, 20 insertions, 10 deletions
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<P extends ArtifactProcesso
protected final Map<Object, P> processorsByArtifactType = new HashMap<Object, P>();
protected final Map<Class<?>, P> processorsByModelType = new HashMap<Class<?>, 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 extends ArtifactProcesso
* @return The processor associated with the given model type
*/
public <T> P getProcessor(Class<T> modelType) {
- Class<?>[] classes = modelType.getInterfaces();
+ P processor = processorsByModelType.get(modelType);
+ if (processor != null) {
+ return processor;
+ }
+ List<Class<?>> 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<StAXArtifactProcessor<?>> implements StAXArtifactProcessorExtensionPoint {
- private ExtensionPointRegistry registry;
private FactoryExtensionPoint modelFactories;
private boolean loaded;
private StAXArtifactProcessor<Object> 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<StAXAttributeProcessor<?>> implements StAXAttributeProcessorExtensionPoint {
- private ExtensionPointRegistry registry;
private FactoryExtensionPoint modelFactories;
private StAXAttributeProcessor<Object> 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<URLArtifactProcessor<?>> 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);