diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-25 21:08:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-25 21:08:37 +0000 |
commit | cfb7e9a18f0cfdc2ca01874902e95adb61b4c6b8 (patch) | |
tree | decd5b28667e04d467af0a2cabefee310dc1708f /java/sca | |
parent | d64d402c3cf248b93abdc01c3187ca5227512952 (diff) |
Refactor CompositeActivator, ComponentContext and other related interfaces into core-spi module
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@819009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
37 files changed, 124 insertions, 216 deletions
diff --git a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java index 2e06c845f2..c2ce5f87f2 100644 --- a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java +++ b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java @@ -25,7 +25,6 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.node.Contribution; @@ -33,6 +32,7 @@ import org.apache.tuscany.sca.node.ContributionLocationHelper; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; import org.apache.tuscany.sca.node.impl.NodeImpl; +import org.apache.tuscany.sca.runtime.CompositeActivator; public class CustomCompositeBuilder { diff --git a/java/sca/itest/properties/pom.xml b/java/sca/itest/properties/pom.xml index 958c1b1a55..ec04cdba99 100644 --- a/java/sca/itest/properties/pom.xml +++ b/java/sca/itest/properties/pom.xml @@ -66,41 +66,9 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding-sdo</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-databinding-jaxb</artifactId> <version>2.0-SNAPSHOT</version> <scope>compile</scope> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.tuscany.sdo</groupId> - <artifactId>tuscany-sdo-plugin</artifactId> - <version>1.1.1</version> - <executions> - <execution> - <id>generate-customer-sdo</id> - <phase>generate-sources</phase> - <configuration> - <schemaFile>${basedir}/src/main/resources/customer.xsd</schemaFile> - <javaPackage>com.example.customer.sdo</javaPackage> - <noNotification>true</noNotification> - <noContainer>true</noContainer> - <noUnsettable>true</noUnsettable> - </configuration> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> </project> diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java index 6b2f16732d..64a55f1b44 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java @@ -30,6 +30,10 @@ import org.apache.tuscany.sca.policy.PolicySubject; * @version $Rev$ $Date$ */ public interface Composite extends Implementation, Extensible, Cloneable, PolicySubject { + /** + * Special name for the domain composite + */ + QName DOMAIN_COMPOSITE = new QName(SCA11_NS, ""); QName TYPE = new QName(SCA11_NS, "implementation.composite"); /** diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java index 4e8159b70c..cb74572fa9 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java @@ -107,7 +107,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { * @param message * @param model */ - protected void warning(Monitor monitor, String message, Object model, String... messageParameters) { + protected void warning(Monitor monitor, String message, Object model, Object... messageParameters) { if (monitor != null) { Problem problem = monitor.createProblem(this.getClass().getName(), @@ -115,7 +115,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Severity.WARNING, model, message, - (Object[])messageParameters); + messageParameters); monitor.problem(problem); } } @@ -128,7 +128,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { * @param message * @param model */ - protected void error(Monitor monitor, String message, Object model, String... messageParameters) { + protected void error(Monitor monitor, String message, Object model, Object... messageParameters) { if (monitor != null) { Problem problem = monitor.createProblem(this.getClass().getName(), @@ -136,7 +136,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Severity.ERROR, model, message, - (Object[])messageParameters); + messageParameters); monitor.problem(problem); } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java index 808ecf1993..57a87a7a0f 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java @@ -42,7 +42,22 @@ public class CompositeCloneBuilderImpl implements CompositeBuilder { public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException { - // Clone the includes + + if (Composite.DOMAIN_COMPOSITE.equals(composite.getName())) { + // Try to avoid clone for top-level composites that are added to the domain composite + for (Composite included : composite.getIncludes()) { + cloneIncludes(included); + } + } else { + // Clone the includes + cloneIncludes(composite); + } + + cloneCompositeImplementations(composite); + return composite; + } + + private void cloneIncludes(Composite composite) { List<Composite> includes = new ArrayList<Composite>(); for (Composite included : composite.getIncludes()) { try { @@ -53,9 +68,6 @@ public class CompositeCloneBuilderImpl implements CompositeBuilder { } composite.getIncludes().clear(); composite.getIncludes().addAll(includes); - - cloneCompositeImplementations(composite); - return composite; } public String getID() { diff --git a/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties b/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties index 4ef4101c37..05b36005a6 100644 --- a/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties +++ b/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties @@ -49,7 +49,6 @@ NoSCABindingAvailableForUnresolvedService = A local service cannot be found for NoMatchingBinding = Component reference {0} does not have a binding which matches the bindings of service {1} NoMatchingCallbackBinding = Component reference {0} does not have a callback binding which matches the callback bindings of service {1} ReferenceEndPointMixWithTarget = Composite {0} Component {1} Reference {2} must not specify endpoints using both target attribute and with binding uri attribute -PolicyRelatedException = Policy Related Exception occured due to : {0} CompositeAlreadyIncluded = Composite {0} has already been included. ComponentReferenceMoreWire = Component reference {0} has more than one wires WireTargetNotFound = Wire target not found : {0} @@ -66,4 +65,7 @@ IllegalCompositeIncusion = Local Composite {0} cannot include a non-local compos PropertySourceNotFound = The property source {0} for property {1} in component {2} cannot be resolved to a composite property PropertySourceValueInvalid = The property source {0} for property {1} in component {2} has an invalid value. It should start with $ followed by the name of a composite property PropertySourceXPathInvalid = The property source {0} for property {1} in component {2} has an invalid XPath expression. The following error was returned while processing the XPath expression: {3} -PropertySourceXPathInvalid = The property file {0} for property {1} in component {2} is an invalid value. The following error was returned while processing the file name: {3}
\ No newline at end of file +PropertySourceXPathInvalid = The property file {0} for property {1} in component {2} is an invalid value. The following error was returned while processing the file name: {3} +PolicyRelatedException = Policy Related Exception occured due to : {0} +IntentNotFound = Intent {0} is not defined in SCA definitions +MutuallyExclusiveIntents = Intent {0} and {1} are mutually exclusive [POL40009]
\ No newline at end of file diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java index 46643f643b..98a20d27d5 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.context; +package org.apache.tuscany.sca.context; import java.io.IOException; import java.io.Reader; @@ -32,13 +32,12 @@ import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.CompositeActivator; +import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentContext; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.oasisopen.sca.ServiceRuntimeException; @@ -161,7 +160,7 @@ public abstract class CompositeContext { public static CompositeActivator getCurrentCompositeActivator() { RuntimeComponent component = getCurrentComponent(); if (component != null) { - ComponentContextExt context = (ComponentContextExt)component.getComponentContext(); + RuntimeComponentContext context = component.getComponentContext(); return context.getCompositeActivator(); } return null; @@ -208,15 +207,9 @@ public abstract class CompositeContext { public abstract ExtensionPointRegistry getExtensionPointRegistry(); /** - * Get the java interface factory + * Get the EndpointRegistry * @return */ - public abstract JavaInterfaceFactory getJavaInterfaceFactory(); - - /** - * Get the proxy factory - * @return - */ - public abstract ProxyFactory getProxyFactory(); + public abstract EndpointRegistry getEndpointRegistry(); } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ThreadMessageContext.java index 13ce6510ae..d6237b7ce3 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ThreadMessageContext.java @@ -16,9 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.context; -import org.apache.tuscany.sca.core.invocation.impl.MessageImpl; import org.apache.tuscany.sca.invocation.Message; /** @@ -28,34 +27,11 @@ import org.apache.tuscany.sca.invocation.Message; */ public final class ThreadMessageContext { - private static final ThreadLocal<Message> CONTEXT = new ThreadLocal<Message>() { - @Override - protected synchronized Message initialValue() { - //Message msg = new MessageImpl(); - // TODO - EPR - What to set as default? - //msg.setFrom(new EndpointReferenceImpl("/")); - return null;//msg; - } - }; + private static final ThreadLocal<Message> CONTEXT = new ThreadLocal<Message>(); private ThreadMessageContext() { } - /** - * Set the WorkContext for the current thread. - * The current work context is returned and must be restored after the invocation is complete. - * Typical usage would be: - * <pre> - * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext); - * try { - * ... invoke user code ... - * } finally { - * PojoWorkContextTunnel.setThreadWorkContext(old); - * } - * </pre> - * @param context - * @return the current work context for the thread; this must be restored after the invocation is made - */ public static Message setMessageContext(Message context) { Message old = CONTEXT.get(); CONTEXT.set(context); @@ -70,12 +46,12 @@ public final class ThreadMessageContext { public static Message getMessageContext() { return CONTEXT.get(); } - + /** * Removes and state from the current thread to ensure that * any associated classloaders can be GCd */ public static void removeMessageContext() { CONTEXT.remove(); - } + } } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ActivationException.java index c86c876075..b015891e93 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ActivationException.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.runtime; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java index c8518650fb..a80a14f7f2 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java @@ -17,14 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.runtime; import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.core.context.CompositeContext; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.apache.tuscany.sca.context.CompositeContext; /** * Start/stop a composite diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java index b9c9c7032b..c56869170a 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointSerializer.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.runtime; import java.io.IOException; diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java index 236a143fb3..eadfccf064 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java @@ -25,6 +25,7 @@ import java.io.Writer; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.context.CompositeContext; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.oasisopen.sca.ComponentContext; import org.oasisopen.sca.ServiceReference; @@ -102,4 +103,6 @@ public interface RuntimeComponentContext extends ComponentContext { <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service); ExtensionPointRegistry getExtensionPointRegistry(); + CompositeActivator getCompositeActivator(); + CompositeContext getCompositeContext(); } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java index 50db444c2a..fd0302829d 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java @@ -37,24 +37,18 @@ import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.context.ComponentContextFactory; +import org.apache.tuscany.sca.context.CompositeContext; 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; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.ActivationException; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; -import org.apache.tuscany.sca.core.context.CompositeContext; import org.apache.tuscany.sca.core.context.impl.CompositeContextImpl; import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopeRegistry; import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.ImplementationProvider; @@ -64,6 +58,8 @@ import org.apache.tuscany.sca.provider.PolicyProviderFactory; import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.ActivationException; +import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentContext; @@ -90,10 +86,6 @@ public class CompositeActivatorImpl implements CompositeActivator { private final ProviderFactoryExtensionPoint providerFactories; private final ComponentContextFactory componentContextFactory; - private final RequestContextFactory requestContextFactory; - private final ProxyFactory proxyFactory; - private final JavaInterfaceFactory javaInterfaceFactory; - private final PropertyValueFactory propertyValueFactory; private final EndpointRegistry endpointRegistry; private final CompositeContext compositeContext; @@ -102,23 +94,19 @@ public class CompositeActivatorImpl implements CompositeActivator { public CompositeActivatorImpl(ExtensionPointRegistry extensionPoints) { this.extensionPoints = extensionPoints; - this.compositeContext = new CompositeContextImpl(extensionPoints); + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + this.endpointRegistry = utilities.getUtility(EndpointRegistry.class); + this.compositeContext = new CompositeContextImpl(extensionPoints, endpointRegistry); FactoryExtensionPoint factories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); this.assemblyFactory = factories.getFactory(AssemblyFactory.class); this.messageFactory = factories.getFactory(MessageFactory.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); this.scopeRegistry = utilities.getUtility(ScopeRegistry.class); this.workScheduler = utilities.getUtility(WorkScheduler.class); this.wireProcessor = new ExtensibleWireProcessor(extensionPoints.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class)); this.providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class); - this.javaInterfaceFactory = compositeContext.getJavaInterfaceFactory(); - this.propertyValueFactory = factories.getFactory(PropertyValueFactory.class); ContextFactoryExtensionPoint contextFactories = extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class); this.componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class); - this.requestContextFactory = contextFactories.getFactory(RequestContextFactory.class); - proxyFactory = compositeContext.getProxyFactory(); - this.endpointRegistry = utilities.getUtility(EndpointRegistry.class); } //========================================================================= diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java index f4cc957f26..c2fa113d5f 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java @@ -34,7 +34,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.assembly.EndpointSerializer; +import org.apache.tuscany.sca.runtime.EndpointSerializer; public class EndpointSerializerImpl implements EndpointSerializer { private XMLInputFactory inputFactory; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 3876776846..357d19091b 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -27,7 +27,7 @@ import java.io.ObjectOutput; import org.apache.tuscany.sca.assembly.impl.EndpointImpl; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.EndpointSerializer; +import org.apache.tuscany.sca.runtime.EndpointSerializer; /** * Runtime model for Endpoint that supports java serialization diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index 5543ec1225..2b1c85b95a 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -27,7 +27,7 @@ import java.io.ObjectOutput; import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.EndpointSerializer; +import org.apache.tuscany.sca.runtime.EndpointSerializer; /** * Runtime model for Endpoint that supports java serialization diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java deleted file mode 100644 index 6db3af213d..0000000000 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -package org.apache.tuscany.sca.core.context; - -import org.apache.tuscany.sca.core.assembly.CompositeActivator; -import org.apache.tuscany.sca.runtime.RuntimeComponentContext; - -/** - * Extended ComponentContext - */ -public interface ComponentContextExt extends RuntimeComponentContext { - CompositeActivator getCompositeActivator(); - CompositeContext getCompositeContext(); -} diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java index d590e0118c..9b60415132 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java @@ -20,14 +20,10 @@ package org.apache.tuscany.sca.core.context; import java.io.Externalizable; -import java.io.IOException; -import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; import org.apache.tuscany.sca.runtime.RuntimeWire; import org.oasisopen.sca.ServiceReference; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java index 86c3d2e199..d6a029cd55 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java @@ -42,22 +42,24 @@ import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.BindingBuilder; import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; +import org.apache.tuscany.sca.context.CompositeContext; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory; import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl; -import org.apache.tuscany.sca.core.context.ComponentContextExt; -import org.apache.tuscany.sca.core.context.CompositeContext; import org.apache.tuscany.sca.core.context.ServiceReferenceExt; import org.apache.tuscany.sca.core.factory.ObjectCreationException; +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.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.ReferenceParameters; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; @@ -200,7 +202,7 @@ public class CallableReferenceImpl<B> implements ServiceReferenceExt<B> { this.component = (RuntimeComponent)wire.getEndpointReference().getComponent(); this.reference = (RuntimeComponentReference)wire.getEndpointReference().getReference(); this.endpointReference = wire.getEndpointReference(); - this.compositeActivator = ((ComponentContextExt)component.getComponentContext()).getCompositeActivator(); + this.compositeActivator = component.getComponentContext().getCompositeActivator(); initCallbackID(); } } @@ -415,9 +417,11 @@ public class CallableReferenceImpl<B> implements ServiceReferenceExt<B> { return Thread.currentThread().getContextClassLoader(); } }); + javaInterface.setJavaClass(classLoader.loadClass(javaInterface.getName())); - compositeActivator.getCompositeContext().getJavaInterfaceFactory() - .createJavaInterface(javaInterface, javaInterface.getJavaClass()); + JavaInterfaceFactory javaInterfaceFactory = getJavaInterfaceFactory(compositeActivator); + + javaInterfaceFactory.createJavaInterface(javaInterface, javaInterface.getJavaClass()); //FIXME: If the interface needs XSDs to be loaded (e.g., for static SDO), // this needs to be done here. We usually search for XSDs in the current // contribution at resolve time. Is it possible to locate the current @@ -434,14 +438,27 @@ public class CallableReferenceImpl<B> implements ServiceReferenceExt<B> { } } - this.proxyFactory = compositeActivator.getCompositeContext().getProxyFactory(); + this.proxyFactory = getProxyFactory(this.compositeActivator); } else if (compositeActivator == null) { this.compositeActivator = CompositeContext.getCurrentCompositeActivator(); if (this.compositeActivator != null) { - this.proxyFactory = this.compositeActivator.getCompositeContext().getProxyFactory(); + this.proxyFactory = getProxyFactory(this.compositeActivator); } } } + + private JavaInterfaceFactory getJavaInterfaceFactory(CompositeActivator activator) { + ExtensionPointRegistry extensionPointRegistry = activator.getCompositeContext().getExtensionPointRegistry(); + FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class); + JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); + return javaInterfaceFactory; + } + + private ProxyFactory getProxyFactory(CompositeActivator activator) { + ExtensionPointRegistry extensionPointRegistry = activator.getCompositeContext().getExtensionPointRegistry(); + ProxyFactoryExtensionPoint proxyFactories = extensionPointRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class); + return new ExtensibleProxyFactory(proxyFactories); + } // ================================================================================== diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java index 31db699063..5218a7fd01 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java @@ -24,9 +24,9 @@ import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl; import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeWire; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java index 21f907608c..fa8c1a4dfa 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java @@ -37,15 +37,13 @@ import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.EndpointReferenceBuilder; +import org.apache.tuscany.sca.context.CompositeContext; 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; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; -import org.apache.tuscany.sca.core.context.ComponentContextExt; -import org.apache.tuscany.sca.core.context.CompositeContext; import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; @@ -57,7 +55,9 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentContext; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.oasisopen.sca.RequestContext; @@ -70,7 +70,7 @@ import org.oasisopen.sca.ServiceRuntimeException; * * @version $Rev$ $Date$ */ -public class ComponentContextImpl implements ComponentContextExt { +public class ComponentContextImpl implements RuntimeComponentContext { private final RuntimeComponent component; private final CompositeActivator compositeActivator; @@ -87,8 +87,11 @@ public class ComponentContextImpl implements ComponentContextExt { FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class); this.assemblyFactory = factories.getFactory(AssemblyFactory.class); this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); + + // FIXME: We need to have node-specific compositeActivator UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); this.compositeActivator = utilities.getUtility(CompositeActivator.class); + this.requestContextFactory = registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class); this.proxyFactory = new ExtensibleProxyFactory(registry.getExtensionPoint(ProxyFactoryExtensionPoint.class)); diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java index 1fa976cfb7..b26861aa79 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java @@ -44,23 +44,23 @@ import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.context.CompositeContext; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; -import org.apache.tuscany.sca.core.context.CompositeContext; 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.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.runtime.CompositeActivator; +import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -71,25 +71,27 @@ import org.oasisopen.sca.ServiceRuntimeException; */ public class CompositeContextImpl extends CompositeContext { private final ExtensionPointRegistry extensionPointRegistry; - private final UtilityExtensionPoint utilityExtensionPoint; + private final EndpointRegistry endpointRegistry; private final AssemblyFactory assemblyFactory; private final JavaInterfaceFactory javaInterfaceFactory; private final StAXArtifactProcessorExtensionPoint staxProcessors; private final XMLInputFactory xmlInputFactory; private final XMLOutputFactory xmlOutputFactory; - private final ProxyFactory proxyFactory; - public CompositeContextImpl(ExtensionPointRegistry registry) { + public CompositeContextImpl(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) { this.extensionPointRegistry = registry; - this.utilityExtensionPoint = extensionPointRegistry.getExtensionPoint(UtilityExtensionPoint.class); + this.endpointRegistry = endpointRegistry; FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class); this.xmlInputFactory = factories.getFactory(XMLInputFactory.class); this.xmlOutputFactory = factories.getFactory(XMLOutputFactory.class); this.assemblyFactory = factories.getFactory(AssemblyFactory.class); this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); this.staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + } + + private ProxyFactory getProxyFactory() { ProxyFactoryExtensionPoint proxyFactories = extensionPointRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class); - this.proxyFactory = new ExtensibleProxyFactory(proxyFactories); + return new ExtensibleProxyFactory(proxyFactories); } /** @@ -331,20 +333,8 @@ public class CompositeContextImpl extends CompositeContext { return extensionPointRegistry; } - /** - * Get the java interface factory - * @return - */ - public JavaInterfaceFactory getJavaInterfaceFactory() { - return javaInterfaceFactory; - } - - /** - * Get the proxy factory - * @return - */ - public ProxyFactory getProxyFactory() { - return proxyFactory; + public EndpointRegistry getEndpointRegistry() { + return endpointRegistry; } } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java index a4ea709fa1..e8a1254dc9 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java @@ -23,11 +23,11 @@ import java.util.List; import javax.security.auth.Subject; import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.core.ExtensionPointRegistry; 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.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.RuntimeComponent; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java index edd11aacc5..20b607ce74 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java @@ -21,8 +21,8 @@ package org.apache.tuscany.sca.core.context.impl; import javax.xml.stream.XMLStreamReader; import org.apache.tuscany.sca.assembly.EndpointReference; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; import org.apache.tuscany.sca.core.invocation.ProxyFactory; +import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeWire; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java index b08ded18c4..ec2f0a0664 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java @@ -26,6 +26,7 @@ import java.util.logging.Logger; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java index 7901a7fa55..0b50cbb2d3 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.core.invocation; import java.lang.reflect.InvocationTargetException; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java index 5e36d724f5..148749922e 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java @@ -29,9 +29,9 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.core.context.ServiceReferenceExt; import org.apache.tuscany.sca.core.factory.InstanceWrapper; -import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.core.scope.TargetResolutionException; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager deleted file mode 100644 index 67cec934b4..0000000000 --- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager +++ /dev/null @@ -1,18 +0,0 @@ -# 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.core.conversation.impl.ConversationManagerImpl
diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.CompositeActivator index d5e13292d2..d5e13292d2 100644 --- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.CompositeActivator diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.EndpointSerializer b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointSerializer index cc3306b325..cc3306b325 100644 --- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.EndpointSerializer +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointSerializer diff --git a/java/sca/modules/endpoint-wrapper/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java b/java/sca/modules/endpoint-wrapper/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java index 79fd678922..51c02d544f 100644 --- a/java/sca/modules/endpoint-wrapper/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java +++ b/java/sca/modules/endpoint-wrapper/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java @@ -45,10 +45,10 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.runtime.CompositeActivator;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
diff --git a/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java b/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java index 58285d3e03..8fb02d40a3 100644 --- a/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java +++ b/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java @@ -33,8 +33,6 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.runtime.EndpointRegistry; /** @@ -223,9 +221,15 @@ public class EndpointReferenceBuilderImpl implements EndpointReferenceBuilder { return problem; } - + + // FIXME: [rfeng] This implementation is wrong. It is the responsibility of the policy language + // to compare the reference and service side setting to determine if they are compatible. Some of + // policies apply to the reference side only, some of the policies apply to the service side only, + // while others apply to both sides. Even for those policies that apply to both side, they can be + // independent or related. private boolean haveMatchingPolicy(EndpointReference endpointReference, Endpoint endpoint){ + /* // if no policy sets or intents are present then they match if ((endpointReference.getRequiredIntents().size() == 0) && (endpoint.getRequiredIntents().size() == 0) && @@ -290,6 +294,7 @@ public class EndpointReferenceBuilderImpl implements EndpointReferenceBuilder { return false; } } + */ return true; } diff --git a/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java b/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java index 7faefefc24..12a915c5db 100644 --- a/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java +++ b/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java @@ -29,8 +29,8 @@ import javax.xml.stream.XMLOutputFactory; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; @@ -45,10 +45,10 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.runtime.CompositeActivator; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Ignore; diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java index 4bf55e3a72..956225b9e6 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java @@ -18,8 +18,8 @@ */ package org.apache.tuscany.sca.implementation.java.injection; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.core.factory.ObjectFactory; -import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; /** * Object Factory that is used to retrieve the ConversationID from the diff --git a/java/sca/modules/node-impl/META-INF/MANIFEST.MF b/java/sca/modules/node-impl/META-INF/MANIFEST.MF index 11f988243c..4ec6d5c84d 100644 --- a/java/sca/modules/node-impl/META-INF/MANIFEST.MF +++ b/java/sca/modules/node-impl/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Import-Package: javax.management, org.apache.tuscany.sca.assembly.xml;version="2.0.0",
org.apache.tuscany.sca.common.java.io;version="2.0.0",
org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
+ org.apache.tuscany.sca.context;version="2.0.0",
org.apache.tuscany.sca.contribution;version="2.0.0",
org.apache.tuscany.sca.contribution.processor;version="2.0.0",
org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java index 54277a5fc6..7978f9c256 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java @@ -541,7 +541,7 @@ public class NodeFactoryImpl extends NodeFactory { // Create a top level composite to host our composite // This is temporary to make the activator happy Composite domainComposite = assemblyFactory.createComposite(); - domainComposite.setName(new QName(Base.SCA11_NS, "")); + domainComposite.setName(Composite.DOMAIN_COMPOSITE); domainComposite.setURI(Base.SCA11_NS); for (Contribution contribution : contributions) { diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index fa9c2dcc1f..cd279f9fcd 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -37,20 +37,20 @@ import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.common.java.io.IOHelper; +import org.apache.tuscany.sca.context.ThreadMessageContext; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.core.assembly.ActivationException; -import org.apache.tuscany.sca.core.assembly.CompositeActivator; import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.node.Client; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFinder; import org.apache.tuscany.sca.node.configuration.NodeConfiguration; import org.apache.tuscany.sca.node.management.NodeManager; +import org.apache.tuscany.sca.runtime.ActivationException; +import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentContext; import org.apache.tuscany.sca.runtime.RuntimeComponentService; |