summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core-databinding
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-07 22:27:05 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-07 22:27:05 +0000
commit40b24744b3ec1e222687d76d134132ee1caedf8d (patch)
tree3181a13a9b505962234a028925ebd59c903c0340 /java/sca/modules/core-databinding
parentf472cf3c044c3301dba9806df96671fb6a373b25 (diff)
Turn the set of built-in transformers into declared extensions
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@822946 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core-databinding')
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java38
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java14
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java18
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java17
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java14
-rw-r--r--java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java5
-rw-r--r--java/sca/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer29
7 files changed, 63 insertions, 72 deletions
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
index fd41a7f113..efaf241aec 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
@@ -22,19 +22,11 @@ package org.apache.tuscany.sca.core.databinding.module;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
import org.apache.tuscany.sca.core.databinding.processor.WrapperJavaInterfaceProcessor;
-import org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer;
import org.apache.tuscany.sca.core.databinding.wire.DataBindingRuntimeWireProcessor;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
import org.apache.tuscany.sca.interfacedef.java.jaxws.WebServiceInterfaceProcessor;
@@ -49,28 +41,22 @@ public class DataBindingModuleActivator implements ModuleActivator {
DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
- FaultExceptionMapper faultExceptionMapper = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(FaultExceptionMapper.class);
-
- Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
+ /*
+ Input2InputTransformer input2InputTransformer = new Input2InputTransformer(registry);
+ transformers.addTransformer(input2InputTransformer, false);
- Input2InputTransformer input2InputTransformer = new Input2InputTransformer();
- input2InputTransformer.setMediator(mediator);
- transformers.addTransformer(input2InputTransformer, true);
+ Output2OutputTransformer output2OutputTransformer = new Output2OutputTransformer(registry);
+ transformers.addTransformer(output2OutputTransformer, false);
- Output2OutputTransformer output2OutputTransformer = new Output2OutputTransformer();
- output2OutputTransformer.setMediator(mediator);
- transformers.addTransformer(output2OutputTransformer, true);
-
- Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer(mediator, faultExceptionMapper);
+ Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer(registry);
transformers.addTransformer(exception2ExceptionTransformer, false);
- Array2ArrayTransformer array2ArrayTransformer = new Array2ArrayTransformer();
- array2ArrayTransformer.setMediator(mediator);
- transformers.addTransformer(array2ArrayTransformer, true);
+ Array2ArrayTransformer array2ArrayTransformer = new Array2ArrayTransformer(registry);
+ transformers.addTransformer(array2ArrayTransformer, false);
- Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer();
- group2GroupTransformer.setMediator(mediator);
- transformers.addTransformer(group2GroupTransformer, true);
+ Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer(registry);
+ transformers.addTransformer(group2GroupTransformer, false);
+ */
// dataBindings.addDataBinding(new CallableReferenceDataBinding());
// transformers.addTransformer(new CallableReference2XMLStreamReader(), true);
@@ -87,7 +73,7 @@ public class DataBindingModuleActivator implements ModuleActivator {
RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
if (wireProcessorExtensionPoint != null) {
- wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(mediator));
+ wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(registry));
}
}
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java
index 427e0b254a..7146f0fa36 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java
@@ -20,13 +20,14 @@ package org.apache.tuscany.sca.core.databinding.transformers;
import java.lang.reflect.Array;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
import org.apache.tuscany.sca.databinding.TransformationException;
import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
import org.apache.tuscany.sca.interfacedef.DataType;
-import org.oasisopen.sca.annotation.Reference;
/**
* This is a special transformer to transform the output from one IDL to the
@@ -38,16 +39,9 @@ public class Array2ArrayTransformer extends BaseTransformer<Object, Object> impl
protected Mediator mediator;
- public Array2ArrayTransformer() {
+ public Array2ArrayTransformer(ExtensionPointRegistry registry) {
super();
- }
-
- /**
- * @param mediator the mediator to set
- */
- @Reference
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
+ this.mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
@Override
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java
index 6e2e714bdb..18746d0fc8 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.core.databinding.transformers;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.DataBinding;
import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.databinding.PullTransformer;
@@ -39,7 +41,14 @@ public class Exception2ExceptionTransformer extends BaseTransformer<Throwable, T
protected Mediator mediator;
protected FaultExceptionMapper faultExceptionMapper;
- public Exception2ExceptionTransformer(Mediator mediator, FaultExceptionMapper faultExceptionMapper) {
+ public Exception2ExceptionTransformer(ExtensionPointRegistry registry) {
+ super();
+ UtilityExtensionPoint utilityExtensionPoint = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ this.mediator = utilityExtensionPoint.getUtility(Mediator.class);
+ this.faultExceptionMapper = utilityExtensionPoint.getUtility(FaultExceptionMapper.class);
+ }
+
+ protected Exception2ExceptionTransformer(Mediator mediator, FaultExceptionMapper faultExceptionMapper) {
super();
this.mediator = mediator;
this.faultExceptionMapper = faultExceptionMapper;
@@ -60,13 +69,6 @@ public class Exception2ExceptionTransformer extends BaseTransformer<Throwable, T
}
/**
- * @param mediator the mediator to set
- */
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- /**
* @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
*/
@Override
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
index b05f0cc238..3422713bb3 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
@@ -20,8 +20,9 @@
package org.apache.tuscany.sca.core.databinding.transformers;
import java.util.List;
-import java.util.logging.Logger;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.DataBinding;
import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.databinding.PullTransformer;
@@ -34,7 +35,6 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.oasisopen.sca.annotation.Reference;
/**
* This is a special transformer to transform the input from one IDL to the
@@ -44,12 +44,11 @@ import org.oasisopen.sca.annotation.Reference;
*/
public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> implements
PullTransformer<Object[], Object[]> {
- private static final Logger logger = Logger.getLogger(Input2InputTransformer.class.getName());
-
protected Mediator mediator;
- public Input2InputTransformer() {
+ public Input2InputTransformer(ExtensionPointRegistry registry) {
super();
+ this.mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
@Override
@@ -63,14 +62,6 @@ public class Input2InputTransformer extends BaseTransformer<Object[], Object[]>
}
/**
- * @param mediator the mediator to set
- */
- @Reference
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- /**
* @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
*/
@Override
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
index d5ba528475..08442134b9 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
@@ -20,6 +20,8 @@ package org.apache.tuscany.sca.core.databinding.transformers;
import java.util.List;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.DataBinding;
import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.databinding.PullTransformer;
@@ -32,7 +34,6 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.oasisopen.sca.annotation.Reference;
/**
* This is a special transformer to transform the output from one IDL to the
@@ -48,16 +49,9 @@ public class Output2OutputTransformer extends BaseTransformer<Object, Object> im
/**
* @param wrapperHandler
*/
- public Output2OutputTransformer() {
+ public Output2OutputTransformer(ExtensionPointRegistry registry) {
super();
- }
-
- /**
- * @param mediator the mediator to set
- */
- @Reference
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
+ this.mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
@Override
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
index 4b64b29e7b..446651c918 100644
--- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
+++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
@@ -42,11 +42,6 @@ import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
*/
public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
private Mediator mediator;
-
- public DataBindingRuntimeWireProcessor(Mediator mediator) {
- super();
- this.mediator = mediator;
- }
public DataBindingRuntimeWireProcessor(ExtensionPointRegistry registry) {
super();
diff --git a/java/sca/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/java/sca/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..f1510ad46c
--- /dev/null
+++ b/java/sca/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation classes for special transformers
+#
+# Java array --> Java array
+org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer;source=java:array,target=java:array,weight=10,public=false
+# Java exception --> Java exception
+org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer;source=idl:fault,target=idl:fault,weight=10,public=false
+# Input to Input
+org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer;source=idl:input,target=idl:input,weight=10,public=false
+# Output to Output
+org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer;source=idl:output,target=idl:output,weight=10,public=false
+# Group to Group
+org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;source=databinding:group,target=databinding:group,weight=10,public=false