From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/invocation/DataExchangeSemantics.java | 34 ++++++ .../apache/tuscany/sca/invocation/Interceptor.java | 40 +++++++ .../tuscany/sca/invocation/InvocationChain.java | 112 ++++++++++++++++++++ .../org/apache/tuscany/sca/invocation/Invoker.java | 36 +++++++ .../org/apache/tuscany/sca/invocation/Message.java | 117 +++++++++++++++++++++ .../tuscany/sca/invocation/MessageFactory.java | 36 +++++++ .../org/apache/tuscany/sca/invocation/Phase.java | 59 +++++++++++ 7 files changed, 434 insertions(+) create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java create mode 100644 sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java (limited to 'sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation') diff --git a/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java new file mode 100644 index 0000000000..957a15ce8a --- /dev/null +++ b/sandbox/sebastien/java/sca-node/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/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java new file mode 100644 index 0000000000..a5f221fc11 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.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; + +/** + * Synchronous mediation associated with a client- or target- side wire. + * + * @version $Rev$ $Date$ + */ +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/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java new file mode 100644 index 0000000000..75719bb0cc --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java @@ -0,0 +1,112 @@ +/* + * 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$ + */ +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(); + + /** + * Adds an interceptor to 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); + + /** + * Adds an invoker to 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(); + + /** + * @deprecated This method is not used + * Returns the last invoker in the chain. + * + * @return The last invoker in the chain + */ + @Deprecated + Invoker getTailInvoker(); + + /** + * @deprecated Please use void addInterceptor(String phase, Interceptor interceptor); + * Adds an interceptor at the given position in the interceptor stack + * + * @param index The position in the interceptor stack to add the interceptor + * @param interceptor The interceptor to add + */ + @Deprecated + void addInterceptor(int index, Interceptor interceptor); + + /** + * Add an interceptor to the given phase + * @param phase + * @param interceptor + */ + void addInterceptor(String phase, Interceptor interceptor); + + /** + * 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); +} diff --git a/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java new file mode 100644 index 0000000000..2748bbed9a --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java @@ -0,0 +1,36 @@ +/* + * 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$ + */ +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/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java new file mode 100644 index 0000000000..4c27c8b06f --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.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.invocation; + +import java.util.Map; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.runtime.EndpointReference; + +/** + * Represents a request, response, or exception flowing through a wire + * + * @version $Rev $Date$ + */ +public interface Message { + String QOS_CTX_SECURITY_PRINCIPAL = "PRINCIPAL"; + + /** + * 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 + */ + EndpointReference getTo(); + + /** + * Set the end point reference of target service + * @param to The end point reference of the service that the message targets + */ + void setTo(EndpointReference 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 map of objects that represents the QoS context that wraps this message such as + * invoking authenticated principal and so on. + * + * @return + */ + Map getQoSContext(); +} diff --git a/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java new file mode 100644 index 0000000000..38c900e36a --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java @@ -0,0 +1,36 @@ +/* + * 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$ + */ +public interface MessageFactory { + + /** + * Creates a new message. + * + * @return The new message + */ + Message createMessage(); + +} diff --git a/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java new file mode 100644 index 0000000000..2deb273f84 --- /dev/null +++ b/sandbox/sebastien/java/sca-node/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java @@ -0,0 +1,59 @@ +/* + * 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 + * + * @version $Rev$ $Date$ + */ +public interface Phase { + // The first phase for outgoing invocations via a reference + String REFERENCE = "component.reference"; + + // data transformation and validation + String REFERENCE_INTERFACE = "reference.interface"; + + // reference policy handling + String REFERENCE_POLICY = "reference.policy"; + + // reference binding invoker + String REFERENCE_BINDING = "reference.binding"; + + // The first phase for incoming invocations via a service + String SERVICE_BINDING = "service.binding"; + + // service policy handling + String SERVICE_POLICY = "service.policy"; + + // data validation and transformation + String SERVICE_INTERFACE = "service.interface"; + + // TODO: not sure if we need to have this face + String SERVICE = "component.service"; + + // implementation policy handling + String IMPLEMENTATION_POLICY = "implementation.policy"; + + // implementation invoker + String IMPLEMENTATION = "component.implementation"; + + // String getName(); +} -- cgit v1.2.3