From 3a569a2f00bf172cddfd567149774ee808a2a242 Mon Sep 17 00:00:00 2001 From: nash Date: Wed, 30 Mar 2011 19:50:51 +0000 Subject: Create branch for 1.6.2 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1087059 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultWireProcessorExtensionPoint.java | 63 ++++++++++ .../tuscany/sca/runtime/EndpointReference.java | 93 ++++++++++++++ .../tuscany/sca/runtime/ReferenceParameters.java | 69 +++++++++++ .../tuscany/sca/runtime/RuntimeComponent.java | 83 +++++++++++++ .../sca/runtime/RuntimeComponentContext.java | 105 ++++++++++++++++ .../sca/runtime/RuntimeComponentReference.java | 119 ++++++++++++++++++ .../sca/runtime/RuntimeComponentService.java | 138 +++++++++++++++++++++ .../apache/tuscany/sca/runtime/RuntimeWire.java | 117 +++++++++++++++++ .../tuscany/sca/runtime/RuntimeWireProcessor.java | 35 ++++++ .../RuntimeWireProcessorExtensionPoint.java | 53 ++++++++ 10 files changed, 875 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java create mode 100644 sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java (limited to 'sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime') diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java new file mode 100644 index 0000000000..851afee3c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java @@ -0,0 +1,63 @@ +/* + * 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.runtime; + +import java.util.ArrayList; +import java.util.List; + + +/** + * The default implementation of a WireProcessorExtensionPoint + * + * @version $Rev$ $Date$ + */ +public class DefaultWireProcessorExtensionPoint implements RuntimeWireProcessorExtensionPoint { + + /** + * The list of WireProcessors available to the runtime + */ + private final List processors = new ArrayList(); + + /** + * Registers a wire-processor in the runtime + * + * @param processor The processor to register + */ + public void addWireProcessor(RuntimeWireProcessor processor) { + processors.add(processor); + } + + /** + * De-registers a wire-processor in the runtime + * + * @param processor The processor to de-register + */ + public void removeWireProcessor(RuntimeWireProcessor processor) { + processors.remove(processor); + } + + /** + * Returns a list of registered wire-processors. + * + * @return The list of wire processors + */ + public List getWireProcessors() { + return processors; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java new file mode 100644 index 0000000000..b6fafa5fb6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java @@ -0,0 +1,93 @@ +/* + * 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.runtime; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Contract; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; + +/** + * The endpoint reference for a component service or reference + * + * @version $Rev$ $Date$ + */ +public interface EndpointReference extends Cloneable { + /** + * Get the component for the endpoint + * @return The component, null of the EPR is for a non-SCA service + */ + RuntimeComponent getComponent(); + + /** + * Get the component service or reference for the endpoint + * @return The component service or reference, null if the EPR is for a non-SCA service + */ + Contract getContract(); + + /** + * Get the binding for the endpoint + * @return The binding + */ + Binding getBinding(); + + /** + * Get the interface contract for the endpoint + * @return The interface contract + */ + InterfaceContract getInterfaceContract(); + + /** + * Update the interface contract for the endpoint + * @param interfaceContract The updated interface contract + */ + void setInterfaceContract(InterfaceContract interfaceContract); + + /** + * Get the URI for this endpoint + * @return The URI of the endpoint + */ + String getURI(); + + /** + * Set the URI for this endpoint + * @param uri The new URI of the endpoint + */ + void setURI(String uri); + + /** + * Get the callback endpoint for this endpoint + * @return The callback endpoint for this endpoint + */ + EndpointReference getCallbackEndpoint(); + + /** + * Set the callback endpoint for this endpoint + * @param callbackEndpoint The new callback endpoint for this endpoint + */ + void setCallbackEndpoint(EndpointReference callbackEndpoint); + + Object clone() throws CloneNotSupportedException; + + void setReferenceParameters(ReferenceParameters parameters); + ReferenceParameters getReferenceParameters(); + + void mergeEndpoint(EndpointReference epr); + +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java new file mode 100644 index 0000000000..0e19538aff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java @@ -0,0 +1,69 @@ +/* + * 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.runtime; + +/** + * Parameters for the EndPointReference + * + * @version $Rev$ $Date$ + */ +public interface ReferenceParameters extends Cloneable { + /** + * Get the callback ID + * @return the callbackID + */ + Object getCallbackID(); + + /** + * Set the callback ID + * @param callbackID the callbackID to set + */ + void setCallbackID(Object callbackID); + + /** + * Get the conversation ID + * @return the conversationID + */ + Object getConversationID(); + + /** + * Set the conversation ID + * @param conversationID the conversationID to set + */ + void setConversationID(Object conversationID); + + /** + * Get the ID for the non-ServiceReference callback object + * @return + */ + Object getCallbackObjectID(); + + /** + * Set the ID for the non-ServiceReference callback object + * @param callbackObjectID + */ + void setCallbackObjectID(Object callbackObjectID); + + EndpointReference getCallbackReference(); + + void setCallbackReference(EndpointReference callback); + + Object clone() throws CloneNotSupportedException; +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java new file mode 100644 index 0000000000..30bba78a40 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java @@ -0,0 +1,83 @@ +/* + * 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.runtime; + +import java.util.List; + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.PolicyProvider; + +/** + * The runtime component interface. Provides the bridge between the + * assembly model representation of a component and its runtime + * realization. + * + * @version $Rev$ $Date$ + */ +public interface RuntimeComponent extends Component { + /** + * Set the implementation-specific configuration for this component + * @param implementationProvider The object that manages the component implementation + */ + void setImplementationProvider(ImplementationProvider implementationProvider); + + /** + * Get the implementation-specific configuration for this component + * @return The implementation provider for this component + */ + ImplementationProvider getImplementationProvider(); + + /** + * Get the associated component context + * @return + */ + RuntimeComponentContext getComponentContext(); + + /** + * Set the associated component context + * @param context + */ + void setComponentContext(RuntimeComponentContext context); + + /** + * Tests if the RuntimeComponent is started + * @return true if the RuntimeComponent is started otherwise false + */ + boolean isStarted(); + + /** + * Sets the RuntimeComponent started state + * @param started the state to set + */ + void setStarted(boolean started); + + /** + * Add a policy provider to the component + * @param policyProvider + */ + void addPolicyProvider(PolicyProvider policyProvider); + + /** + * Get a list of policy providers configured for this component + * @return + */ + List getPolicyProviders(); +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java new file mode 100644 index 0000000000..f61bff9735 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java @@ -0,0 +1,105 @@ +/* + * 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.runtime; + +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; + +import org.apache.tuscany.sca.api.ComponentContextExtension; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.osoa.sca.CallableReference; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; + +/** + * @version $Rev$ $Date$ + */ +public interface RuntimeComponentContext extends ComponentContextExtension { + /** + * Activate the reference (creating runtime wires) + * @param reference + */ + 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 + * @param businessInterface The business interface + * @param reference The reference to be wired + * @param binding The binding to be used, if it's null, either binding.sca or the 1st binding + * will be selected + * @return A service reference representing the wire + */ + ServiceReference getServiceReference(Class businessInterface, + RuntimeComponentReference reference, + Binding binding); + + /** + * Bind the reference to a target component/componentService + * @param + * @param businessInterface The business interface + * @param reference The reference to be wired + * @param component The target component + * @param service The target component service + * @return A service reference representing the wire + */ + ServiceReference getServiceReference(Class businessInterface, + RuntimeComponentReference reference, + RuntimeComponent component, + RuntimeComponentService service); + + /** + * Create a CallableReference for the given component service + * @param + * @param businessInterface + * @param component + * @param service + * @return + */ + CallableReference getCallableReference(Class businessInterface, + RuntimeComponent component, + RuntimeComponentService service); + + /** + * @param + * @param businessInterface + * @param service + * @return + */ + ServiceReference createSelfReference(Class businessInterface, ComponentService service); +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java new file mode 100644 index 0000000000..44ae7f552a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java @@ -0,0 +1,119 @@ +/* + * 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.runtime; + +import java.util.List; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.endpointresolver.EndpointResolver; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; + +/** + * The runtime component reference. Provides the bridge between the + * assembly model representation of a component reference and its runtime + * realization + * + * @version $Rev$ $Date$ + */ +public interface RuntimeComponentReference extends ComponentReference { + + /** + * Get a list of runtime wires to the reference + * + * @return The list of wires + */ + List getRuntimeWires(); + + /** + * Get the runtime wire for the given binding + * @param binding The assembly model binding + * @return The runtime wire + */ + RuntimeWire getRuntimeWire(Binding binding); + + /** + * Returns the reference binding provider associated with this + * component reference and the given binding. + * + * @param binding The assembly model binding + * @return The runtime reference binding provider + */ + ReferenceBindingProvider getBindingProvider(Binding binding); + + /** + * Sets the reference binding provider associated with this + * component reference and the given binding. + * + * @param binding The assembly model binding + * @param bindingProvider The runtime reference binding provider + */ + void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider); + + /** + * Returns the endpoint resolver associated with this + * component reference and the given endpoint. + * + * @param endpont The assembly model endpoint + * @return The enpoint resolver + */ + EndpointResolver getEndpointResolver(Endpoint endpoint); + + /** + * Sets the endpoint resolver associated with this + * component reference and the given endpoint. + * + * @param binding The assembly model binding + * @param bindingProvider The runtime reference binding provider + */ + void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver); + + /** + * Add a policy provider for the given binding to the reference + * @param binding The assembly model binding + * @param policyProvider The policy handler + */ + void addPolicyProvider(Binding binding, PolicyProvider policyProvider); + + /** + * Get a list of policy providers for the given binding + * @param binding The assembly model binding + * @return A list of policy providers for the given binding + */ + List getPolicyProviders(Binding binding); + + /** + * Get the invoker for the given binding and operation + * @param binding The assembly model binding + * @param operation The assembly model operation + * @return The runtime Invoker + */ + Invoker getInvoker(Binding binding, Operation operation); + + /** + * Set the owning component + * @param component + */ + void setComponent(RuntimeComponent component); +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java new file mode 100644 index 0000000000..982724d798 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java @@ -0,0 +1,138 @@ +/* + * 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.runtime; + +import java.util.List; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; + +/** + * The runtime component service. Provides the bridge between the + * assembly model representation of a component service and its runtime + * realization + * + * @version $Rev$ $Date$ + */ +public interface RuntimeComponentService extends ComponentService { + + /** + * Get a list of runtime wires to the service + * + * @return The list of wires + */ + List getRuntimeWires(); + /** + * Get the runtime wire for the given binding + * @param binding The assembly model binding + * @return The runtime wire + */ + RuntimeWire getRuntimeWire(Binding binding); + + /** + * Get the callback wires associated with this service + * + * @return The list of runtime callback wires + */ + List getCallbackWires(); + + /** + * Returns the service binding provider associated with this + * component service and the given binding. + * + * @param binding The assembly model binding + * @return The runtime service binding provider + */ + ServiceBindingProvider getBindingProvider(Binding binding); + + /** + * Returns the service binding provider associated with this + * component service and the given binding. + * + * @param binding + * @param interfaceContract + * @return + */ + RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract); + + /** + * Sets the service binding provider associated with this + * component service and the given binding. + * + * @param binding The assembly model binding + * @param bindingProvider The runtime service binding provider + */ + void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider); + + /** + * Get the invoker for the given binding and operation + * @param binding The assembly model binding + * @param operation The assembly model operation + * @return The runtime invoker + */ + Invoker getInvoker(Binding binding, Operation operation); + + /** + * Get the invoker for the given binding and operation + * @param binding The assembly model binding + * @param interfaceContract the client interface contract + * @param operation The assembly model operation + * @return The runtime invoker + */ + Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation); + + /** + * Get the invocation chain for the given binding and operation + * @param binding The assembly model binding + * @param operation The assembly model operation + * @return The runtime invocation chain + */ + InvocationChain getInvocationChain(Binding binding, Operation operation); + + /** + * Get the invocation chain for the given binding and operation + * @param binding The assembly model binding + * @param operation The assembly model operation + * @param interfaceContract the client interface contract + * @return The runtime invocation chain + */ + InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation); + + /** + * Add a policy provider for the given binding to the service + * @param binding The assembly model binding + * @param policyProvider The policy handler + */ + void addPolicyProvider(Binding binding, PolicyProvider policyProvider); + + /** + * Get a list of policy providers for the given binding + * @param binding The assembly model binding + * @return A list of policy providers for the given binding + */ + List getPolicyProviders(Binding binding); + +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java new file mode 100644 index 0000000000..a2e7152202 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java @@ -0,0 +1,117 @@ +/* + * 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.runtime; + +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.Message; + +/** + * The runtime wire interface that connects a component reference to a + * component service (or an external service) over the selected binding + * + * @version $Rev$ $Date$ + */ +public interface RuntimeWire extends Cloneable { + + /** + * Get the source of the wire + * + * @return The end point reference of the source + */ + EndpointReference getSource(); + + /** + * Get the target of the wire + * + * @return The end point reference of the target + */ + EndpointReference getTarget(); + + /** + * Rebind the runtime wire with the given target + * @param target The target endpoint reference + */ + void setTarget(EndpointReference target); + + /** + * Force the invocation chains to be rebuilt + */ + void rebuild(); + + /** + * Returns the invocation chains for service operations associated with the + * wire + * + * @return the invocation chains for service operations associated with the + * wire + */ + List getInvocationChains(); + + /** + * Lookup the invocation chain by operation + * @param operation The operation + * @return The invocation chain for the given operation + */ + InvocationChain getInvocationChain(Operation operation); + + /** + * Get the invocation chain for the binding-specific handling + * @return + */ + InvocationChain getBindingInvocationChain(); + + /** + * This invoke method assumes that the binding invocation chain is in force + * and that there will be an operation selector element there to + * determine which operation to call + * @param msg The message + * @return The result + * @throws InvocationTargetException + */ + Object invoke(Message msg) throws InvocationTargetException; + + /** + * Invoke an operation with given arguments + * @param operation The operation + * @param args The arguments + * @return The result + * @throws InvocationTargetException + */ + Object invoke(Operation operation, Object[] args) throws InvocationTargetException; + + /** + * Invoke an operation with a context message + * @param operation The operation + * @param msg The message + * @return The result + * @throws InvocationTargetException + */ + Object invoke(Operation operation, Message msg) throws InvocationTargetException; + + /** + * @return a clone of the runtime wire + * @throws CloneNotSupportedException + */ + Object clone() throws CloneNotSupportedException; +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java new file mode 100644 index 0000000000..fbb7aae467 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java @@ -0,0 +1,35 @@ +/* + * 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.runtime; + +/** + * Implementations are called after wires are decorated with policy and before they are connected. + * + * @version $Rev$ $Date$ + */ +public interface RuntimeWireProcessor { + + /** + * Process the runtime wire to add interceptors + * + * @param wire + */ + void process(RuntimeWire wire); + +} diff --git a/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java new file mode 100644 index 0000000000..4b2c71b397 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.6.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java @@ -0,0 +1,53 @@ +/* + * 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.runtime; + +import java.util.List; + +/** + * Acts as a delegating WireProcessorExtensionPoint, delegating + * processing of wires after policies have been applied and source and targets + * have been connected. + * + * @version $Rev$ $Date$ + */ +public interface RuntimeWireProcessorExtensionPoint { + + /** + * Registers a wire-processor in the runtime + * + * @param processor The processor to register + */ + void addWireProcessor(RuntimeWireProcessor processor); + + /** + * De-registers a wire-processor in the runtime + * + * @param processor The processor to de-register + */ + void removeWireProcessor(RuntimeWireProcessor processor); + + /** + * Returns a list of registered wire-processors. + * + * @return The list of wire processors + */ + List getWireProcessors(); + +} -- cgit v1.2.3