From f0527e13c01fe1fecbd195a70192b6caa9e5f7d0 Mon Sep 17 00:00:00 2001 From: fmoga Date: Sat, 12 Feb 2011 09:19:33 +0000 Subject: Create the 2.0-Beta2-RC3 tag. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1070049 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/invocation/DataExchangeSemantics.java | 34 +++++ .../apache/tuscany/sca/invocation/Interceptor.java | 41 ++++++ .../tuscany/sca/invocation/InterceptorAsync.java | 82 ++++++++++++ .../tuscany/sca/invocation/InvocationChain.java | 140 +++++++++++++++++++++ .../org/apache/tuscany/sca/invocation/Invoker.java | 37 ++++++ .../sca/invocation/InvokerAsyncRequest.java | 40 ++++++ .../sca/invocation/InvokerAsyncResponse.java | 39 ++++++ .../org/apache/tuscany/sca/invocation/Message.java | 129 +++++++++++++++++++ .../tuscany/sca/invocation/MessageFactory.java | 37 ++++++ .../org/apache/tuscany/sca/invocation/Phase.java | 60 +++++++++ .../tuscany/sca/invocation/PhasedInterceptor.java | 32 +++++ 11 files changed, 671 insertions(+) create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java create mode 100644 sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/PhasedInterceptor.java (limited to 'sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation') diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java new file mode 100644 index 0000000000..957a15ce8a --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java @@ -0,0 +1,34 @@ +/* + * 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.invocation; + +/** + * An invoker or interceptor can optionally implement this interface to indicate if they can + * enforce the pass-by-value semantics for an operation on remotable interfaces. + * + * @version $Rev$ $Date$ + */ +public interface DataExchangeSemantics { + /** + * Indicate if the data can be passed in by reference as they won't be mutated. + * @return true if pass-by-reference is allowed + */ + boolean allowsPassByReference(); +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java new file mode 100644 index 0000000000..42954555b1 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java @@ -0,0 +1,41 @@ +/* + * 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.invocation; + +/** + * Synchronous mediation associated with a client- or target- side wire. + * + * @version $Rev$ $Date$ + * @tuscany.spi.extension.inheritfrom + */ +public interface Interceptor extends Invoker { + + /** + * Sets the next invoker + * @param next The next invoker + */ + void setNext(Invoker next); + + /** + * Returns the next invoker or null + * @return The next Invoker + */ + Invoker getNext(); + +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java new file mode 100644 index 0000000000..f29dfddf6a --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InterceptorAsync.java @@ -0,0 +1,82 @@ +/* + * 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.invocation; + +/** + * Allows asynchronous wires to be navigated in reverse in order for the + * response to be processed. + * + */ +public interface InterceptorAsync extends Interceptor, InvokerAsyncRequest, InvokerAsyncResponse { + + /** + * Sets the previous invoker + * @param next The previous invoker + */ + void setPrevious(InvokerAsyncResponse previous); + + /** + * Returns the previous invoker or null + * @return The previous Invoker + */ + InvokerAsyncResponse getPrevious(); + + /** + * Process a request message. Provided so that the synchronous + * and asynchronous patterns can re-use the request message + * processing + * + * @param msg The request Message + * @return the processed message + * + */ + Message processRequest(Message msg); + + /** + * Post processing for a request message. Intended to be called after + * the invocation of the request chain returns, to permit cleanup/error handling + * if required + * @param msg The request Message + * @return the processed message + */ + Message postProcessRequest(Message msg); + + /** + * Post processing for a request message where an exception was thrown. + * Intended to be called after the invocation of the request chain returns, + * to permit cleanup/error handling if required + * @param msg The request Message + * @param e a Thowable which is some form of exception thrown during the processing + * of the request message by the invocation chain + * @return the processed message + */ + Message postProcessRequest(Message msg, Throwable e) throws Throwable; + + /** + * Process a response message. Provided so that the synchronous + * and asynchronous patterns can re-use the response message + * processing + * + * @param msg The response Message + * @return the processed message + * + */ + Message processResponse(Message msg); + +} // end interface InterceptorAsync diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java new file mode 100644 index 0000000000..b7e26d68eb --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java @@ -0,0 +1,140 @@ +/* + * 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.invocation; + +import org.apache.tuscany.sca.interfacedef.Operation; + +/** + * A wire consists of 1..n invocation chains associated with the operations of its source service contract. + *

+ * Invocation chains may contain Interceptors that process invocations. + *

+ * A Message is used to pass data associated with an invocation through the chain. + * + * @version $Rev$ $Date$ + * @tuscany.spi.extension.asclient + */ +public interface InvocationChain { + /** + * Returns the target operation for this invocation chain. + * + * @return The target operation for this invocation chain + */ + Operation getTargetOperation(); + + /** + * Updates the target operation for this invocation chain. + * + * @param operation The new target operation for this invocation chain + */ + void setTargetOperation(Operation operation); + + /** + * Returns the source operation for this invocation chain. + * + * @return The source operation for this invocation chain + */ + Operation getSourceOperation(); + + /** + * Updates the source operation for this invocation chain. + * + * @param operation The new source operation for this invocation chain + */ + void setSourceOperation(Operation operation); + + /** + * Adds an interceptor to the end of the chain. For reference side, it will be added to + * Phase.REFERENCE. For service side, it will be added to Phase.SERVICE + * + * @param interceptor The interceptor to add + */ + void addInterceptor(Interceptor interceptor); + + /** + * Add an interceptor to the end of the given phase + * @param phase - the phase + * @param interceptor - the interceptor + */ + void addInterceptor(String phase, Interceptor interceptor); + + /** + * Adds an interceptor to the head of the chain + * @param interceptor - the interceptor + */ + void addHeadInterceptor(Interceptor interceptor); + + /** + * Adds an interceptor to the head of the given phase + * @param phase - the phase + * @param interceptor - the interceptor + */ + void addHeadInterceptor(String phase, Interceptor interceptor); + + /** + * Adds an invoker to the end of the chain + * + * @param invoker The invoker to add + */ + void addInvoker(Invoker invoker); + + /** + * Returns the first invoker in the chain. + * + * @return The first invoker in the chain + */ + Invoker getHeadInvoker(); + + /** + * Returns the last invoker in the chain. + * + * @return The last invoker in the chain + */ + Invoker getTailInvoker(); + + /** + * Get the first invoker that is on the same or later phase + * @param phase + * @return The first invoker that is on the same or later phase + */ + Invoker getHeadInvoker(String phase); + + /** + * Indicate if the data can be passed in by reference as they won't be mutated. + * @return true if pass-by-reference is allowed + */ + boolean allowsPassByReference(); + /** + * Force the invocation to allow pass-by-reference + * @param allowsPBR + */ + void setAllowsPassByReference(boolean allowsPBR); + + /** + * Returns true if this chain must be able to support async + * invocation. This will be as a consequence of the EPR/EP + * detecting the asyncInvocation intent. The flag is set on + * construction and used as an internal guard against non + * async interceptors being added to a chain that expect to + * be able to handle async calls + * + * @return true is the chain supports async invocation. + */ + boolean isAsyncInvocation(); +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java new file mode 100644 index 0000000000..69309f6dd0 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java @@ -0,0 +1,37 @@ +/* + * 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.invocation; + +/** + * Synchronous mediation associated with a client- or target- side wire. + * + * @version $Rev$ $Date$ + * @tuscany.spi.extension.inheritfrom + */ +public interface Invoker { + + /** + * Process a synchronous wire + * + * @param msg The request Message for the wire + * @return The response Message from the wire + */ + Message invoke(Message msg); + +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java new file mode 100644 index 0000000000..025010a076 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncRequest.java @@ -0,0 +1,40 @@ +/* + * 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.invocation; + +/** + * TUSCANY-3786 + * + * The request side of an Interface to describe an invocation where + * the request processing can be performed independently of the + * response processing. + */ +public interface InvokerAsyncRequest { + + /** + * Process the request message and pass it down the chain + * + * @param msg The request Message + * @return the processed message + * @throws Throwable + * + */ + void invokeAsyncRequest(Message msg) throws Throwable; + +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java new file mode 100644 index 0000000000..7eeabb760e --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvokerAsyncResponse.java @@ -0,0 +1,39 @@ +/* + * 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.invocation; + +/** + * TUSCANY-3786 + * + * The response side of an Interface to describe an invocation where + * the request processing can be performed independently of the + * response processing. + */ +public interface InvokerAsyncResponse { + + /** + * Process the response message and pass it down the chain + * + * @param msg The request Message + * @return the processed message + * + */ + void invokeAsyncResponse(Message msg); + +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java new file mode 100644 index 0000000000..2bafdb64b8 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java @@ -0,0 +1,129 @@ +/* + * 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.invocation; + +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.interfacedef.Operation; + +/** + * Represents a request, response, or exception flowing through a wire + * + * @version $Rev $Date$ + * @tuscany.spi.extension.asclient + */ +public interface Message { + + /** + * Returns the body of the message, which will be the payload or parameters associated with the wire + * @return The body of the message + */ + T getBody(); + + /** + * Sets the body of the message. + * @param body The body of the message + */ + void setBody(T body); + + /** + * Get the end point reference of the source reference + * @return The end point reference of the reference originating the message + */ + EndpointReference getFrom(); + + /** + * Set the end point reference of the reference originating the message + * @param from The end point reference of the reference originating the message + */ + void setFrom(EndpointReference from); + + /** + * Get the end point reference of target service + * @return The end point reference of the service that the message targets + */ + Endpoint getTo(); + + /** + * Set the end point reference of target service + * @param to The end point reference of the service that the message targets + */ + void setTo(Endpoint to); + + /** + * Returns the id of the message + * @return The message Id + */ + Object getMessageID(); + + /** + * Sets the id of the message + * @param messageId The message ID + */ + void setMessageID(Object messageId); + + /** + * Determines if the message represents a fault/exception + * + * @return true If the message body is a fault object, false if the body is a normal payload + */ + boolean isFault(); + + /** + * Set the message body with a fault object. After this method is called, isFault() returns true. + * + * @param fault The fault object represents an exception + */ + void setFaultBody(T fault); + + /** + * Returns the operation that created the message. + * + * @return The operation that created the message + */ + Operation getOperation(); + + /** + * Sets the operation that created the message. + * + * @param op The operation that created the message + */ + void setOperation(Operation op); + + /** + * Returns a list of objects that are contained in the message header + * + * @return + */ + Map getHeaders(); + + /** + * Returns the binding context in force for this message + */ + T getBindingContext(); + + /** + * Set the binding context that is in force for this message + * @param bindingContext + */ + void setBindingContext(T bindingContext); +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java new file mode 100644 index 0000000000..711c09728b --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java @@ -0,0 +1,37 @@ +/* + * 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.invocation; + + +/** + * A factory for messages + * + * @version $Rev $Date$ + * @tuscany.spi.extension.asclient + */ +public interface MessageFactory { + + /** + * Creates a new message. + * + * @return The new message + */ + Message createMessage(); + +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java new file mode 100644 index 0000000000..4f81b763c7 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java @@ -0,0 +1,60 @@ +/* + * 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.invocation; + +/** + * Tuscany built-in phases for the invocation chain. The phases are organized + * here such that a message passing from reference component implementation to + * service component implementation passes through the phases from top to bottom + * + * @version $Rev$ $Date$ + * @tuscany.spi.extension.asclient + */ +public interface Phase { + + // Reference operation chains + + String REFERENCE = "component.reference"; // The first phase for outgoing invocations via a reference + String REFERENCE_INTERFACE = "reference.interface"; // data transformation and validation + String REFERENCE_POLICY = "reference.policy"; // reference policy handling + String REFERENCE_BINDING = "reference.binding"; // reference binding invoker + + // Reference binding chain + + String REFERENCE_BINDING_WIREFORMAT = "reference.binding.wireformat"; + String REFERENCE_BINDING_POLICY = "reference.binding.policy"; + String REFERENCE_BINDING_TRANSPORT = "reference.binding.transport"; + + // Service binding chain + + String SERVICE_BINDING_TRANSPORT = "service.binding.transport"; + String SERVICE_BINDING_OPERATION_SELECTOR = "service.binding.operationselector"; + String SERVICE_BINDING_WIREFORMAT = "service.binding.wireformat"; + String SERVICE_BINDING_POLICY = "service.binding.policy"; + + // Service operation chains + + String SERVICE_BINDING = "service.binding"; // The first phase for incoming invocations via a service + String SERVICE_INTERFACE = "service.interface"; // data validation and transformation + String SERVICE_POLICY = "service.policy"; // service policy handling + String SERVICE = "component.service"; // TODO: not sure if we need to have this phase + String IMPLEMENTATION_POLICY = "implementation.policy"; // implementation policy handling + String IMPLEMENTATION = "component.implementation"; // implementation invoker +} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/PhasedInterceptor.java b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/PhasedInterceptor.java new file mode 100644 index 0000000000..f77a662779 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta2-RC3/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/PhasedInterceptor.java @@ -0,0 +1,32 @@ +/* + * 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.invocation; + +/** + * An interceptor that is designated to be a given phase + * @tuscany.spi.extension.inheritfrom + */ +public interface PhasedInterceptor extends Interceptor { + /** + * Get the name of the phase that this interceptor is positioned + * @return + */ + String getPhase(); +} -- cgit v1.2.3