diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-02 00:38:31 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-02 00:38:31 +0000 |
commit | efa0cb0a3d5564bf3880ad2aa20f1c418d63aa7b (patch) | |
tree | 514b04eb9d94a53d58902a832053215d52a0c917 /java/sca/modules/core-spi/src/main | |
parent | 9d8f01864f34586fdaf5bf96bad30e2fe06226c1 (diff) |
Make CompositeActivator a stateless utility by using CompositeContext to hold the context from the Node including the endpointRegistry
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820854 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core-spi/src/main')
4 files changed, 9 insertions, 165 deletions
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java index 134f49e7b0..d956689af3 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java @@ -33,5 +33,5 @@ public interface ComponentContextFactory { * @param component The runtime component * @return An instance of ComponentContext for the component */ - ComponentContext createComponentContext(RuntimeComponent component); + ComponentContext createComponentContext(CompositeContext compositeContext, RuntimeComponent component); } diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java index 98a20d27d5..ee5482f07f 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java @@ -19,27 +19,17 @@ package org.apache.tuscany.sca.context; -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; import java.util.ArrayList; import java.util.List; -import javax.xml.stream.XMLStreamReader; - import org.apache.tuscany.sca.assembly.Component; -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.interfacedef.InvalidInterfaceException; 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; /** @@ -47,98 +37,6 @@ import org.oasisopen.sca.ServiceRuntimeException; */ public abstract class CompositeContext { /** - * Create a self-reference for a component service - * @param component - * @param service - * @throws CloneNotSupportedException - * @throws InvalidInterfaceException - */ - public abstract ComponentReference createSelfReference(Component component, - ComponentService service, - Class<?> businessInterface) - throws CloneNotSupportedException, InvalidInterfaceException; - - /** - * Bind a component reference to a component service - * @param <B> - * @param businessInterface - * @param reference - * @param service - * @return - * @throws CloneNotSupportedException - * @throws InvalidInterfaceException - */ - public abstract RuntimeComponentReference bindComponentReference(Class<?> businessInterface, - RuntimeComponentReference reference, - RuntimeComponent component, - RuntimeComponentService service) - throws CloneNotSupportedException, InvalidInterfaceException; - - /** - * @param component - * @param reference - * @param writer - * @throws IOException - */ - public abstract void write(Component component, ComponentReference reference, Writer writer) throws IOException; - - /** - * @param component - * @param reference - * @param service - * @param writer - * @throws IOException - */ - public abstract void write(Component component, - ComponentReference reference, - ComponentService service, - Writer writer) throws IOException; - - /** - * @param component - * @param reference - * @return - * @throws IOException - */ - public abstract String toXML(Component component, ComponentReference reference) throws IOException; - - /** - * @param component - * @param service - * @return - * @throws IOException - */ - public abstract String toXML(Component component, ComponentService service) throws IOException; - - /** - * @param reader - * @return - * @throws IOException - */ - public abstract RuntimeComponent read(Reader reader) throws IOException; - - /** - * @param streamReader - * @return - * @throws IOException - */ - public abstract RuntimeComponent read(XMLStreamReader streamReader) throws IOException; - - /** - * @param xml - * @return - * @throws IOException - */ - public abstract Component fromXML(String xml) throws IOException; - - /** - * @param streamReader - * @return - * @throws IOException - */ - public abstract Component fromXML(XMLStreamReader streamReader) throws IOException; - - /** * @return */ public static RuntimeComponent getCurrentComponent() { @@ -157,22 +55,11 @@ public abstract class CompositeContext { /** * @return */ - public static CompositeActivator getCurrentCompositeActivator() { + public static CompositeContext getCurrentCompositeContext() { RuntimeComponent component = getCurrentComponent(); if (component != null) { RuntimeComponentContext context = component.getComponentContext(); - return context.getCompositeActivator(); - } - return null; - } - - /** - * @return - */ - public static CompositeContext getCurrentCompositeContext() { - CompositeActivator activator = getCurrentCompositeActivator(); - if (activator != null) { - return activator.getCompositeContext(); + return context.getCompositeContext(); } return null; } @@ -204,6 +91,8 @@ public abstract class CompositeContext { return targetService; } + public abstract void configureComponentContext(RuntimeComponent runtimeComponent); + public abstract ExtensionPointRegistry getExtensionPointRegistry(); /** diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java index a80a14f7f2..3631684a54 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java @@ -80,48 +80,24 @@ public interface CompositeActivator { * Start a component * @param component */ - void start(Component component) throws ActivationException; + void start(CompositeContext compositeContext, Component component) throws ActivationException; /** * Stop a component * @param component */ - void stop(Component component) throws ActivationException; + void stop(CompositeContext compositeContext, Component component) throws ActivationException; /** * Start components in a composite * @param composite */ - void start(Composite composite) throws ActivationException; + void start(CompositeContext compositeContext, Composite composite) throws ActivationException; /** * Stop components in a composite * @param composite */ - void stop(Composite composite) throws ActivationException; - - /** - * Get the component context helper - * @return - */ - CompositeContext getCompositeContext(); - - /** - * Configure the runtime component with component context - * @param component - */ - void configureComponentContext(RuntimeComponent component); - - /** - * Set the domain composite - * @param domainComposite - */ - void setDomainComposite(Composite domainComposite); - - /** - * Get the domain composite - * @return - */ - Composite getDomainComposite(); + void stop(CompositeContext compositeContext, Composite composite) throws ActivationException; } 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 eadfccf064..5f9ff4fa7e 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 @@ -19,10 +19,6 @@ package org.apache.tuscany.sca.runtime; -import java.io.IOException; -import java.io.Reader; -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; @@ -41,22 +37,6 @@ public interface RuntimeComponentContext extends ComponentContext { void start(RuntimeComponentReference reference); /** - * Deserialize the component reference - * @param reader - * @return A component that contains the reference - * @throws IOException - */ - RuntimeComponent read(Reader reader) throws IOException; - - /** - * Serialize the component reference - * @param reference - * @param writer - * @throws IOException - */ - void write(RuntimeComponentReference reference, Writer writer) throws IOException; - - /** * Get the CallableReference for a given component reference * @param <B> * @param businessInterface The business interface @@ -103,6 +83,5 @@ public interface RuntimeComponentContext extends ComponentContext { <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service); ExtensionPointRegistry getExtensionPointRegistry(); - CompositeActivator getCompositeActivator(); CompositeContext getCompositeContext(); } |