From 7f669616265736234e24b8ffd834d047e9d5e0fa Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 1 May 2009 18:20:45 +0000 Subject: Merge the Mediator changes from 1.x git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@770781 13f79535-47bb-0310-9956-ffa450edef68 --- .../injection/JavaPropertyValueObjectFactory.java | 8 +++---- .../invocation/JavaComponentContextProvider.java | 15 +++++++------ .../invocation/JavaImplementationProvider.java | 26 +++++++++++----------- .../JavaImplementationProviderFactory.java | 22 +++++++++--------- .../java/module/JavaRuntimeModuleActivator.java | 21 ++++++++--------- ...apache.tuscany.sca.context.PropertyValueFactory | 17 ++++++++++++++ 6 files changed, 62 insertions(+), 47 deletions(-) create mode 100644 java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory (limited to 'java/sca/modules/implementation-java-runtime') diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java index 885004b09b..57d6d199ea 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.implementation.java.injection; @@ -260,7 +260,7 @@ public class JavaPropertyValueObjectFactory implements PropertyValueFactory { */ /** - * + * * @param property * @return */ diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java index 0044c0f196..141d991d27 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.implementation.java.invocation; @@ -37,6 +37,7 @@ import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.context.ComponentContextFactory; +import org.apache.tuscany.sca.context.PropertyValueFactory; import org.apache.tuscany.sca.context.RequestContextFactory; import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.factory.ObjectCreationException; @@ -67,7 +68,7 @@ import org.oasisopen.sca.annotation.ConversationID; /** * The runtime instantiation of Java component implementations - * + * * @version $Rev$ $Date$ */ public class JavaComponentContextProvider { @@ -79,7 +80,7 @@ public class JavaComponentContextProvider { public JavaComponentContextProvider(RuntimeComponent component, JavaInstanceFactoryProvider configuration, DataBindingExtensionPoint dataBindingExtensionPoint, - JavaPropertyValueObjectFactory propertyValueObjectFactory, + PropertyValueFactory propertyValueObjectFactory, ComponentContextFactory componentContextFactory, RequestContextFactory requestContextFactory) { super(); @@ -91,7 +92,7 @@ public class JavaComponentContextProvider { // this.componentContext = new ComponentContextImpl(this, requestContextFactory, this.proxyService); // } this.component = component; - this.propertyValueFactory = propertyValueObjectFactory; + this.propertyValueFactory = (JavaPropertyValueObjectFactory) propertyValueObjectFactory; } InstanceWrapper createInstanceWrapper() throws ObjectCreationException { @@ -129,7 +130,7 @@ public class JavaComponentContextProvider { ObjectFactory propertyObjectFactory = createPropertyValueFactory(configuredProperty, configuredProperty.getValue(), element); instanceFactoryProvider.setObjectFactory(element, propertyObjectFactory); - + JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor(); for(JavaElementImpl p: constructor.getParameters()){ if(element.getName().equals(p.getName())) { diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java index 0b560e8c88..9f716c8059 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.implementation.java.invocation; @@ -23,6 +23,7 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.context.ComponentContextFactory; +import org.apache.tuscany.sca.context.PropertyValueFactory; import org.apache.tuscany.sca.context.RequestContextFactory; import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.factory.ObjectFactory; @@ -32,7 +33,6 @@ import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; -import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.RequestContextObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.ResourceHost; import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory; @@ -53,27 +53,27 @@ public class JavaImplementationProvider implements ScopedImplementationProvider private JavaImplementation implementation; private JavaComponentContextProvider componentContextProvider; private RequestContextFactory requestContextFactory; - + public JavaImplementationProvider(RuntimeComponent component, JavaImplementation implementation, ProxyFactory proxyService, DataBindingExtensionPoint dataBindingRegistry, - JavaPropertyValueObjectFactory propertyValueObjectFactory, + PropertyValueFactory propertyValueObjectFactory, ComponentContextFactory componentContextFactory, RequestContextFactory requestContextFactory) { super(); this.implementation = implementation; this.requestContextFactory = requestContextFactory; - + try { JavaInstanceFactoryProvider configuration = new JavaInstanceFactoryProvider(implementation); configuration.setProxyFactory(proxyService); componentContextProvider = - new JavaComponentContextProvider(component, - configuration, + new JavaComponentContextProvider(component, + configuration, dataBindingRegistry, propertyValueObjectFactory, - componentContextFactory, + componentContextFactory, requestContextFactory); Scope scope = getScope(); @@ -106,9 +106,9 @@ public class JavaImplementationProvider implements ScopedImplementationProvider } catch (Exception e) { throw new IllegalStateException(e); } - + } - + private void handleResources(JavaImplementation componentType, ProxyFactory proxyService) { for (JavaResourceImpl resource : componentType.getResources().values()) { String name = resource.getName(); @@ -165,7 +165,7 @@ public class JavaImplementationProvider implements ScopedImplementationProvider } } } - + public boolean supportsOneWayInvocation() { return false; } diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java index 77e0e44065..326ab28bc9 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java @@ -6,25 +6,25 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.implementation.java.invocation; import org.apache.tuscany.sca.context.ComponentContextFactory; +import org.apache.tuscany.sca.context.PropertyValueFactory; import org.apache.tuscany.sca.context.RequestContextFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.provider.ImplementationProviderFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -33,7 +33,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponent; * @version $Rev$ $Date$ */ public class JavaImplementationProviderFactory implements ImplementationProviderFactory { - private JavaPropertyValueObjectFactory propertyValueObjectFactory; + private PropertyValueFactory propertyValueObjectFactory; private DataBindingExtensionPoint dataBindingRegistry; private ProxyFactory proxyService; private ComponentContextFactory componentContextFactory; @@ -41,7 +41,7 @@ public class JavaImplementationProviderFactory implements ImplementationProvider public JavaImplementationProviderFactory(ProxyFactory proxyService, DataBindingExtensionPoint dataBindingRegistry, - JavaPropertyValueObjectFactory propertyValueObjectFactory, + PropertyValueFactory propertyValueObjectFactory, ComponentContextFactory componentContextFactory, RequestContextFactory requestContextFactory) { super(); @@ -54,12 +54,12 @@ public class JavaImplementationProviderFactory implements ImplementationProvider public ImplementationProvider createImplementationProvider(RuntimeComponent component, JavaImplementation implementation) { - return new JavaImplementationProvider(component, - implementation, - proxyService, + return new JavaImplementationProvider(component, + implementation, + proxyService, dataBindingRegistry, - propertyValueObjectFactory, - componentContextFactory, + propertyValueObjectFactory, + componentContextFactory, requestContextFactory); } diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java index b3a3210285..e1e8b05ab8 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.implementation.java.module; @@ -23,6 +23,7 @@ import java.util.logging.Logger; import org.apache.tuscany.sca.context.ComponentContextFactory; import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint; +import org.apache.tuscany.sca.context.PropertyValueFactory; import org.apache.tuscany.sca.context.RequestContextFactory; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; @@ -33,9 +34,7 @@ import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; -import org.apache.tuscany.sca.databinding.TransformerExtensionPoint; -import org.apache.tuscany.sca.databinding.impl.MediatorImpl; -import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory; +import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.implementation.java.invocation.JavaCallbackRuntimeWireProcessor; import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; @@ -58,7 +57,7 @@ public class JavaRuntimeModuleActivator implements ModuleActivator { FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class); MessageFactory messageFactory = factories.getFactory(MessageFactory.class); - + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); InterfaceContractMapper interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); @@ -72,10 +71,8 @@ public class JavaRuntimeModuleActivator implements ModuleActivator { JavaInterfaceFactory javaFactory = factories.getFactory(JavaInterfaceFactory.class); DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class); - TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class); - MediatorImpl mediator = new MediatorImpl(dataBindings, transformers); - utilities.addUtility(mediator); - JavaPropertyValueObjectFactory factory = new JavaPropertyValueObjectFactory(mediator); + Mediator mediator = utilities.getUtility(Mediator.class); + PropertyValueFactory factory = utilities.getUtility(PropertyValueFactory.class); factories.addFactory(factory); ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class); @@ -83,7 +80,7 @@ public class JavaRuntimeModuleActivator implements ModuleActivator { RequestContextFactory requestContextFactory = contextFactories.getFactory(RequestContextFactory.class); ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactories); - + JavaImplementationProviderFactory javaImplementationProviderFactory = new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory, requestContextFactory); diff --git a/java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory b/java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory new file mode 100644 index 0000000000..f2feb6156a --- /dev/null +++ b/java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory @@ -0,0 +1,17 @@ +# 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. +org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory \ No newline at end of file -- cgit v1.2.3