summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules
diff options
context:
space:
mode:
authorramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2009-06-29 07:07:33 +0000
committerramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2009-06-29 07:07:33 +0000
commit8d7bfe07035515556840fa330504f07c38b86267 (patch)
treeae1f0f8ccb7468fddce54a69de2ebbd1df99a035 /branches/sca-java-1.x/modules
parent31065243a33e6027752b858666ff23c24b3465af (diff)
Modified fixes for TUSCANY-3096
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@789238 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules')
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java9
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java (renamed from branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/AnnotationProcessorExtensionPoint.java)4
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultAnnotationProcessorExtensionPoint.java15
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java27
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java12
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java5
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java15
-rw-r--r--branches/sca-java-1.x/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint (renamed from branches/sca-java-1.x/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.AnnotationProcessorExtensionPoint)2
8 files changed, 56 insertions, 33 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
index bf7d133d01..9e56eac6cd 100644
--- a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
+++ b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
@@ -56,12 +56,15 @@ public class SpringContextTie {
private AbstractApplicationContext springContext;
private SpringImplementationStub implementation;
private boolean isAnnotationSupported;
+ private String versionSupported;
- public SpringContextTie(SpringImplementationStub implementation, URL resource, boolean annotationSupport) throws Exception {
+ public SpringContextTie(SpringImplementationStub implementation, URL resource, boolean annotationSupport, String versionSupported) throws Exception {
this.implementation = implementation;
this.isAnnotationSupported = annotationSupport;
- if ((SpringVersion.getVersion()!= null) && (! SpringVersion.getVersion().equals("2.5.5"))) {
- throw new RuntimeException("Unsupported version: Use only Spring Framework Version 2.5.5");
+ this.versionSupported = versionSupported;
+ if (! this.versionSupported.equals("ANY")) {
+ if ((SpringVersion.getVersion()!= null) && (! SpringVersion.getVersion().equals(versionSupported)))
+ throw new RuntimeException("Unsupported version: Use only Spring Framework Version " + versionSupported);
}
SCAParentApplicationContext scaParentContext = new SCAParentApplicationContext(implementation);
springContext = createApplicationContext(scaParentContext, resource);
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/AnnotationProcessorExtensionPoint.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java
index c91f7faaea..0464355565 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/AnnotationProcessorExtensionPoint.java
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java
@@ -1,7 +1,9 @@
package org.apache.tuscany.sca.implementation.spring.invocation;
-public interface AnnotationProcessorExtensionPoint {
+public interface ConfigurationPropertiesExtensionPoint {
boolean isAnnotationSupported();
+
+ String getSupportedVersion();
}
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultAnnotationProcessorExtensionPoint.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultAnnotationProcessorExtensionPoint.java
deleted file mode 100644
index 509e1f9f49..0000000000
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultAnnotationProcessorExtensionPoint.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-public class DefaultAnnotationProcessorExtensionPoint implements AnnotationProcessorExtensionPoint {
-
- // Contructor
- public DefaultAnnotationProcessorExtensionPoint() {
-
- }
-
- // By default SCA annotations for implementation.spring
- // will be supproted.
- public boolean isAnnotationSupported() {
- return true;
- }
-}
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java
new file mode 100644
index 0000000000..a0e7186eab
--- /dev/null
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sca.implementation.spring.invocation;
+
+public class DefaultConfigurationPropertiesExtensionPoint implements ConfigurationPropertiesExtensionPoint {
+
+ // Contructor
+ public DefaultConfigurationPropertiesExtensionPoint() {
+
+ }
+
+ // By default SCA annotations for implementation.spring
+ // will be supproted.
+ public boolean isAnnotationSupported() {
+ return true;
+ }
+
+ // By defauly all the Spring version are supported for
+ // Tuscany.
+ public String getSupportedVersion() {
+
+ // Customize the code here for a limited version
+ // support
+ /*
+ return "2.5.5";
+ */
+ return "ANY";
+ }
+}
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
index a49f9d05ad..e8b398bd3a 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
@@ -46,16 +46,18 @@ public class SpringContextStub {
SpringImplementation implementation,
ProxyFactory proxyService,
JavaPropertyValueObjectFactory propertyValueObjectFactory,
- boolean annotationSupport) {
+ boolean annotationSupport,
+ String versionSupported) {
- initTie(component, implementation, propertyValueObjectFactory, annotationSupport);
+ initTie(component, implementation, propertyValueObjectFactory, annotationSupport, versionSupported);
}
private void initTie(RuntimeComponent component,
SpringImplementation implementation,
JavaPropertyValueObjectFactory propertyValueObjectFactory,
- boolean annotationSupport) {
+ boolean annotationSupport,
+ String versionSupported) {
// TODO: what class loader to use?
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -67,8 +69,8 @@ public class SpringContextStub {
Object stub = stubConstructor.newInstance(new SpringImplementationTie(implementation, component, propertyValueObjectFactory));
Class<?> tieClass = Class.forName("org.apache.tuscany.sca.implementation.spring.runtime.context.SpringContextTie", true, cl);
- Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass, URL.class, boolean.class});
- this.tie = tieConstructor.newInstance(stub, implementation.getResource(), annotationSupport);
+ Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass, URL.class, boolean.class, String.class});
+ this.tie = tieConstructor.newInstance(stub, implementation.getResource(), annotationSupport, versionSupported);
this.startMethod = tieClass.getMethod("start");
this.closeMethod = tieClass.getMethod("close");
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
index e78dbe19b3..1fc01b2627 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
@@ -51,13 +51,14 @@ public class SpringImplementationProvider implements ImplementationProvider {
SpringImplementation implementation,
ProxyFactory proxyService,
JavaPropertyValueObjectFactory propertyValueObjectFactory,
- boolean annotationSupport) {
+ boolean annotationSupport,
+ String versionSupported) {
super();
this.implementation = implementation;
this.component = component;
this.propertyValueObjectFactory = propertyValueObjectFactory;
- springContext = new SpringContextStub(component, implementation, proxyService, propertyValueObjectFactory, annotationSupport);
+ springContext = new SpringContextStub(component, implementation, proxyService, propertyValueObjectFactory, annotationSupport, versionSupported);
} // end constructor
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
index 5a487436c9..4796aa0de9 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
@@ -38,8 +38,9 @@ public class SpringImplementationProviderFactory implements ImplementationProvid
private ProxyFactory proxyFactory;
private JavaPropertyValueObjectFactory propertyFactory;
- private AnnotationProcessorExtensionPoint annotationProcessor;
+ private ConfigurationPropertiesExtensionPoint configProperties;
private boolean annotationSupport;
+ private String versionSupported;
/**
* Simple constructor
@@ -51,11 +52,12 @@ public class SpringImplementationProviderFactory implements ImplementationProvid
ProxyFactoryExtensionPoint proxyFactories = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
proxyFactory = new ExtensibleProxyFactory(proxyFactories);
- annotationProcessor = extensionPoints.getExtensionPoint(AnnotationProcessorExtensionPoint.class);
- if (annotationProcessor == null) {
- annotationProcessor = new DefaultAnnotationProcessorExtensionPoint();
+ configProperties = extensionPoints.getExtensionPoint(ConfigurationPropertiesExtensionPoint.class);
+ if (configProperties == null) {
+ configProperties = new DefaultConfigurationPropertiesExtensionPoint();
}
- annotationSupport = annotationProcessor.isAnnotationSupported();
+ annotationSupport = configProperties.isAnnotationSupported();
+ versionSupported = configProperties.getSupportedVersion();
// TODO: could the runtime have a default PropertyValueObjectFactory?
propertyFactory = new JavaPropertyValueObjectFactory(new MediatorImpl(extensionPoints));
@@ -74,7 +76,8 @@ public class SpringImplementationProviderFactory implements ImplementationProvid
implementation,
proxyFactory,
propertyFactory,
- annotationSupport);
+ annotationSupport,
+ versionSupported);
}
/**
diff --git a/branches/sca-java-1.x/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.AnnotationProcessorExtensionPoint b/branches/sca-java-1.x/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint
index 0d46795e88..efa3d5ed7c 100644
--- a/branches/sca-java-1.x/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.AnnotationProcessorExtensionPoint
+++ b/branches/sca-java-1.x/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.implementation.spring.invocation.DefaultAnnotationProcessorExtensionPoint
+org.apache.tuscany.sca.implementation.spring.invocation.DefaultConfigurationPropertiesExtensionPoint