diff options
Diffstat (limited to 'tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation')
23 files changed, 0 insertions, 1535 deletions
diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/Interceptor.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/Interceptor.java deleted file mode 100644 index 40137f9b10..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/Interceptor.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import org.apache.tuscany.core.message.Message; - -/** - * Synchronous, around-style mediation associated with a client- or target- side invocation. - * - * @version $Rev$ $Date$ - */ -public interface Interceptor { - - /** - * Process a synchronous invocation. - * - * @param msg the request Message for the invocation - * @return the response Message from the invocation - */ - Message invoke(Message msg); - - /** - * Sets the next interceptor. - * - * @param next - */ - void setNext(Interceptor next); -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java deleted file mode 100644 index 2c5e61a8a1..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationConfiguration.java +++ /dev/null @@ -1,279 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.invocation.impl.MessageChannelImpl; -import org.apache.tuscany.core.invocation.impl.MessageDispatcher; -import org.apache.tuscany.core.invocation.impl.RequestResponseInterceptor; - -/** - * Contains a source- or target-side invocation pipeline for a service operation. Source and target invocation pipelines - * are "bridged" together by a set of wire builders with the source-side holding references to the target. - * <p> - * A set of invocation configurations are used by a {@link org.apache.tuscany.core.invocation.spi.ProxyFactory} to - * create service proxies. - * <p> - * Invocation configurations must contain at least one interceptor and may have 0 to N handlers. Handlers process an - * invocation request or response in a one-way fashion. A typical invocation sequence where interceptors and handlers - * are configured for both the source and target-side will proceed as follows: - * <ol> - * <li>The first source interceptor will be called with a message, which will in turn invoke the next interceptor in - * the chain - * <li>The last source interceptor, which must be of type - * {@link org.apache.tuscany.core.invocation.impl.RequestResponseInterceptor} if there are handlers present, will be - * invoked. The RR interceptor will in turn pass the message to a - * {@link org.apache.tuscany.core.invocation.MessageChannel} which will invoke all source-side request handlers. - * <li> The RR interceptor will then invoke the target-side request <tt>MessageChannel</tt>. - * <li> The last source-side handler, an instance of - * {@link org.apache.tuscany.core.invocation.impl.MessageDispatcher}, will invoke the first source-side - * interceptor, which in turn will pass the message down the target-side interceptor chain. - * <li> If the target is a component instance the last target-side interceptor, an instance of - * {@link org.apache.tuscany.core.invocation.impl.InvokerInterceptor} will retrieve the - * {@link org.apache.tuscany.core.invocation.TargetInvoker} from the message and call it to invoke the operation on a - * target instance. <tt>TargetInvoker</tt>s are help by the source proxy to enable optimizations such as caching of - * target instances. - * <li> The response is returned up the invocation stack until it reaches the source-side - * <tt>RequestResponseInterceptor</tt>, which invokes the target and source-side response channels respectively. - * <li> The response is then passed back up the rest of the invocation stack. - * </ol> - * <p> - * The source-to-target bridge may be constructed in any of the following ways: - * <ul> - * <li>Source handler-to-target handler - * <li>Source handler-to-target interceptor - * <li>Source interceptor-to-target handler - * <li>Source interceptor-to-target interceptor - * </ul> - * <p> - * In some scenarios, a service proxy may only contain target-side invocaton chains, for example, when a service is - * resolved through a locate operation by a non-component client. In this case, there will be no source-side invocation - * chains and the target invoker will be held by the target-side and passed down the pipeline. - * - * @see org.apache.tuscany.core.builder.WireBuilder - * @see org.apache.tuscany.core.invocation.spi.ProxyFactory - * @see org.apache.tuscany.core.invocation.TargetInvoker - * @see org.apache.tuscany.core.invocation.impl.MessageDispatcher - * - * @version $Rev$ $Date$ - */ -public class InvocationConfiguration { - - // the operation on the target that will utlimately be invoked - private Method operation; - - // responsible for invoking a target instance - private TargetInvoker targetInvoker; - - private Interceptor sourceInterceptorChainHead; - - private Interceptor sourceInterceptorChainTail; - - private Interceptor targetInterceptorChainHead; - - private Interceptor targetInterceptorChainTail; - - private List<MessageHandler> requestHandlers; - - private List<MessageHandler> responseHandlers; - - // a source-side pointer to target request handlers, if the exist - private MessageChannel targetRequestChannel; - - // a source-side pointer to target response handlers, if the exist - private MessageChannel targetResponseChannel; - - /** - * Creates an new invocation configuration for the given target operation - */ - public InvocationConfiguration(Method operation) { - assert (operation != null) : "No operation type specified"; - this.operation = operation; - } - - /** - * Returns the target operation for the invocation configuration - */ - public Method getMethod() { - return operation; - } - - /** - * Used by source-side configurations, sets a pointer to the target-side request channel. This may be null when no - * target request handlers exist. - */ - public void setTargetRequestChannel(MessageChannel channel) { - targetRequestChannel = channel; - } - - /** - * Used by source-side configurations, sets a pointer to the target-side response channel. This may be null when no - * target response handlers exist. - */ - public void setTargetResponseChannel(MessageChannel channel) { - targetResponseChannel = channel; - } - - /** - * Adds an interceptor to the invocation chain for source-side configurations - */ - public void addSourceInterceptor(Interceptor interceptor) { - if (sourceInterceptorChainHead == null) { - sourceInterceptorChainHead = interceptor; - } else { - sourceInterceptorChainTail.setNext(interceptor); - } - sourceInterceptorChainTail = interceptor; - } - - /** - * Adds an interceptor to the invocation chain for target-side configurations - */ - public void addTargetInterceptor(Interceptor interceptor) { - if (targetInterceptorChainHead == null) { - targetInterceptorChainHead = interceptor; - } else { - targetInterceptorChainTail.setNext(interceptor); - } - targetInterceptorChainTail = interceptor; - } - - /** - * Adds an request handler to the invocation chain for either a source- or target-side configuration - */ - public void addRequestHandler(MessageHandler handler) { - if (requestHandlers == null) { - requestHandlers = new ArrayList<MessageHandler>(); - } - requestHandlers.add(handler); - } - - /** - * Adds an response handler to the invocation chain for either a source- or target-side configuration - */ - public void addResponseHandler(MessageHandler handler) { - if (responseHandlers == null) { - responseHandlers = new ArrayList<MessageHandler>(); - } - responseHandlers.add(handler); - } - - /** - * Returns the request handler chain for either a source- or target-side configuration - */ - public List<MessageHandler> getRequestHandlers() { - return requestHandlers; - } - - /** - * Returns the response handler chain for either a source- or target-side configuration - */ - public List<MessageHandler> getResponseHandlers() { - return responseHandlers; - } - - /** - * Returns the head source-side interceptor. This will be null for target-side configurations - */ - public Interceptor getSourceInterceptor() { - return sourceInterceptorChainHead; - } - - /** - * Returns the head target-side interceptor. On source-side configurations, this will be the head interceptor of the - * "bridged" target configuration. - */ - public Interceptor getTargetInterceptor() { - return targetInterceptorChainHead; - } - - - public Interceptor getLastTargetInterceptor() { - return targetInterceptorChainTail; - } - - /** - * Sets the target invoker to pass down the invocation pipeline. When a service proxy represents a wire, - * the target invoker is set on the source-side. - */ - public void setTargetInvoker(TargetInvoker invoker) { - this.targetInvoker = invoker; - } - - /** - * Returns the target invoker that is passed down the invocation pipeline. When a service proxy represents a wire, - * the target invoker is cached on the source-side. - */ - public TargetInvoker getTargetInvoker() { - return targetInvoker; - } - - /** - * Prepares the configuration by linking interceptors and handlers - */ - public void build() { - - if (requestHandlers != null && targetInterceptorChainHead != null) { - // on target-side, connect existing handlers and interceptors - MessageHandler messageDispatcher = new MessageDispatcher(targetInterceptorChainHead); - requestHandlers.add(messageDispatcher); - } - - if (requestHandlers != null) { - MessageChannel requestChannel = new MessageChannelImpl(requestHandlers); - MessageChannel responseChannel = new MessageChannelImpl(responseHandlers); - Interceptor channelInterceptor = new RequestResponseInterceptor(requestChannel, targetRequestChannel, - responseChannel, targetResponseChannel); - - if (sourceInterceptorChainHead != null) { - sourceInterceptorChainTail.setNext(channelInterceptor); - } else { - sourceInterceptorChainHead = channelInterceptor; - } - - } else { - // no request handlers - if (sourceInterceptorChainHead != null) { - if (targetInterceptorChainHead != null) { - // Connect source interceptor chain directly to target interceptor chain - sourceInterceptorChainTail.setNext(targetInterceptorChainHead); - // sourceInterceptorChainTail = targetInterceptorChainHead; - } else { - // Connect source interceptor chain to the target request channel - Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null, - targetResponseChannel); - sourceInterceptorChainTail.setNext(channelInterceptor); - } - } else { - // no source interceptor chain or source handlers, conntect to target interceptor chain or channel - if (targetInterceptorChainHead != null) { - sourceInterceptorChainHead = targetInterceptorChainHead; - sourceInterceptorChainTail = targetInterceptorChainHead; - } else { - Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null, - targetResponseChannel); - sourceInterceptorChainHead = channelInterceptor; - sourceInterceptorChainTail = channelInterceptor; - } - } - } - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationException.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationException.java deleted file mode 100644 index d089b45d76..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.apache.tuscany.core.invocation; - -import org.apache.tuscany.common.TuscanyException; - -/** - * The root checked exception for the invocation framework - * - * @version $Rev$ $Date$ - */ -public abstract class InvocationException extends TuscanyException { - - public InvocationException() { - super(); - } - - public InvocationException(String message) { - super(message); - } - - public InvocationException(String message, Throwable cause) { - super(message, cause); - } - - public InvocationException(Throwable cause) { - super(cause); - } - -} - diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationRuntimeException.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationRuntimeException.java deleted file mode 100644 index ddb7b5f74b..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/InvocationRuntimeException.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import org.osoa.sca.ServiceRuntimeException; - -/** - * Denotes an exception thrown during invocation processing - * - * @version $Rev$ $Date$ - */ -public class InvocationRuntimeException extends ServiceRuntimeException { - - public InvocationRuntimeException() { - super(); - } - - public InvocationRuntimeException(String message) { - super(message); - } - - public InvocationRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public InvocationRuntimeException(Throwable cause) { - super(cause); - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MessageChannel.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MessageChannel.java deleted file mode 100644 index 4a5e8a1f87..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MessageChannel.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import org.apache.tuscany.core.message.Message; - -/** - * Represents a one-way pipeline through which messages are sent during an invocation - * - * @see org.apache.tuscany.core.message.Message - */ -public interface MessageChannel { - - /** - * Sends a message - */ - void send(Message message); - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MessageHandler.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MessageHandler.java deleted file mode 100644 index 4719fbae81..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MessageHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import org.apache.tuscany.core.message.Message; - - -/** - * Performs a uni-directional mediation on a message - * - * @see org.apache.tuscany.core.message.Message - */ -public interface MessageHandler { - - /** - * Process a message. - */ - boolean processMessage(Message message); - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MethodHashMap.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MethodHashMap.java deleted file mode 100644 index 183cb5ecbb..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/MethodHashMap.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import java.lang.reflect.Method; -import java.util.HashMap; - -import org.apache.tuscany.core.config.JavaIntrospectionHelper; - -/** - * A HashMap keyed by method - */ -public class MethodHashMap extends HashMap { - - /** - * Constructs a new MethodHashMap. - */ - public MethodHashMap() { - super(); - } - - /** - * Constructs a new MethodHashMap. - */ - public MethodHashMap(int size) { - super(size); - } - - /** - * @see java.util.HashMap#get(java.lang.Object) - */ - public Object get(Object key) { - Method method=(Method)key; - //FIXME find a more efficient way to find a matching method - Method closestMethod=JavaIntrospectionHelper.findClosestMatchingMethod(method.getName(), method.getParameterTypes(), super.keySet()); - return super.get(closestMethod); - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/ProxyConfiguration.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/ProxyConfiguration.java deleted file mode 100644 index 11fc4768f3..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/ProxyConfiguration.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.message.MessageFactory; - -/** - * Represents configuration information for creating a service proxy. When a client component implementation is injected - * with a service proxy representing a wire, source- and target-side proxy configurations are "bridged" together. This - * concatenated configuration may then be used to generate a proxy implemented a particular business interface required - * by the client. - * - * @version $Rev$ $Date$ - */ -public class ProxyConfiguration { - - private Map<Method, InvocationConfiguration> configurations; - - private ClassLoader proxyClassLoader; - - private MessageFactory messageFactory; - - private QualifiedName serviceName; - - // ---------------------------------- - // Constructors - // ---------------------------------- - - /** - * Creates a configuration used to generate proxies representing a service. - * - * @param serviceName the qualified name of the service represented by this configuration - * @param invocationConfigs a collection of operation-to-invocation configuration mappings for the service - * @param proxyClassLoader the classloader to use when creating a proxy - * @param messageFactory the factory used to create invocation messages - */ - public ProxyConfiguration(QualifiedName serviceName, Map<Method, InvocationConfiguration> invocationConfigs, - ClassLoader proxyClassLoader, MessageFactory messageFactory) { - assert (invocationConfigs != null) : "No invocation configuration map specified"; - this.serviceName = serviceName; - configurations = invocationConfigs; - this.messageFactory = messageFactory; - if (proxyClassLoader == null) { - this.proxyClassLoader = Thread.currentThread().getContextClassLoader(); - } else { - this.proxyClassLoader = proxyClassLoader; - } - } - - // ---------------------------------- - // Methods - // ---------------------------------- - - /** - * Returns the qualified service name the configuration is associated with - */ - public QualifiedName getTargetName() { - return serviceName; - } - - /** - * Returns a collection of operation types to {@link InvocationConfiguration} mappings that represent the specific - * proxy configuration information for particular operations - */ - public Map<Method, InvocationConfiguration> getInvocationConfigurations() { - return configurations; - } - - /** - * Returns the classloader to use in creating proxies - */ - public ClassLoader getProxyClassLoader() { - return proxyClassLoader; - } - - /** - * Returns the factory used to create invocation messages - */ - public MessageFactory getMessageFactory() { - return messageFactory; - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java deleted file mode 100644 index e0a85d0b6e..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/TargetInvoker.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation; - -import java.lang.reflect.InvocationTargetException; - -/** - * Implementations are responsible for resolving a target and performing the actual invocation on it, for example, a - * service component implementation instance or an external service client. - * - * @version $Rev$ $Date$ - */ -public interface TargetInvoker extends Interceptor, Cloneable{ - - /** - * Responsible for invoking an operation on a target with the given payload - * - * @param payload the parameters of the target operation or null - * @throws InvocationTargetException if the target operation itself throws an exception. The root cause will be set - * to that exception - */ - public Object invokeTarget(Object payload) throws InvocationTargetException; - - /** - * Determines whether the proxy can be cached on the client/source side - */ - public boolean isCacheable(); - - public Object clone(); -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/InvokerInterceptor.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/InvokerInterceptor.java deleted file mode 100644 index 7b9dc1c86f..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/InvokerInterceptor.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.impl; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.InvocationRuntimeException; -import org.apache.tuscany.core.invocation.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -/** - * Serves as a tail interceptor on a target invocation chain. This implementation dispatches to the target invoker - * passed inside the invocation message. Target invokers are passed from the source in order to allow for caching of - * target instances. - * - * @see org.apache.tuscany.core.invocation.TargetInvoker - * @version $Rev$ $Date$ - */ -public class InvokerInterceptor implements Interceptor { - - public InvokerInterceptor() { - } - - public Message invoke(Message msg) throws InvocationRuntimeException { - TargetInvoker invoker = msg.getTargetInvoker(); - if (invoker == null) { - throw new InvocationRuntimeException("No target invoker specified on message"); - } - return invoker.invoke(msg); - } - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last one in an target interceptor chain"); - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/MessageChannelImpl.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/MessageChannelImpl.java deleted file mode 100644 index 6c0b15a823..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/MessageChannelImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.impl; - -import java.util.List; - -import org.apache.tuscany.core.invocation.MessageChannel; -import org.apache.tuscany.core.invocation.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * A channel comprising an ordered collection of message handlers. - * - *@see org.apache.tuscany.core.message.Message - * @version $Rev$ $Date$ - */ -public class MessageChannelImpl implements MessageChannel { - - private final List<MessageHandler> pipeline; - - //---------------------------------- - // Constructors - //---------------------------------- - - /** - * Construct a new channel comprising the supplied list of handlers. - * - * @param pipeline the Handlers in the channel - */ - public MessageChannelImpl(List<MessageHandler> pipeline) { - this.pipeline = pipeline; - } - - //---------------------------------- - // Methods - //---------------------------------- - - /** - * Send a message down the channel. The message will be processed by all handlers - * in order until one returns false to indicate processing is complete or all - * handlers have been called. - * - * @param msg a Message to send down the channel - */ - public void send(Message msg) { - if (pipeline!=null) { - for (MessageHandler handler : pipeline) { - if (!handler.processMessage(msg)) { - break; - } - } - } - } -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/MessageDispatcher.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/MessageDispatcher.java deleted file mode 100644 index a162962717..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/MessageDispatcher.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.impl; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * A message handler that dispatches the message through an interceptor stack and the uses the response channel to - * return the invocation result. - * - * @version $Rev$ $Date$ - */ -public class MessageDispatcher implements MessageHandler { - private final Interceptor head; - - /** - * Construct a handler that dispatches messages to an Interceptor stack. - * - * @param head the interceptor at the head of the stack - */ - public MessageDispatcher(Interceptor head) { - this.head = head; - } - - public boolean processMessage(Message msg) { - Message resp = head.invoke(msg); - msg.getCallbackChannel().send(resp); - return false; - } -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/NullProxyFactory.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/NullProxyFactory.java deleted file mode 100644 index fa4297ef00..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/NullProxyFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.apache.tuscany.core.invocation.impl; - -import org.apache.tuscany.core.context.AggregateContext; -import org.apache.tuscany.core.invocation.ProxyConfiguration; -import org.apache.tuscany.core.invocation.spi.ProxyCreationException; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.invocation.spi.ProxyInitializationException; - -/** - * Returns an actual implementation instance as opposed to a proxy. Used in cases where proxying may be optimized away. - * - * @version $Rev: 379957 $ $Date: 2006-02-22 14:58:24 -0800 (Wed, 22 Feb 2006) $ - */ -public class NullProxyFactory implements ProxyFactory { - - private AggregateContext parentContext; - - private String targetName; - - public NullProxyFactory(String componentName, AggregateContext parentContext) { - assert (parentContext != null) : "Parent context was null"; - this.targetName = componentName; - this.parentContext = parentContext; - } - - public void initialize(Class businessInterface, ProxyConfiguration config) throws ProxyInitializationException { - } - - public Object createProxy() throws ProxyCreationException { - return parentContext.getContext(targetName); - } - - public void initialize() throws ProxyInitializationException { - } - - public ProxyConfiguration getProxyConfiguration() { - return null; - } - - public void setProxyConfiguration(ProxyConfiguration config) { - } - - public void setBusinessInterface(Class interfaze) { - } - - public Class getBusinessInterface() { - return null; - } - - public void addInterface(Class claz) { - } - - public Class[] getImplementatedInterfaces() { - return null; - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/OneWayInterceptor.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/OneWayInterceptor.java deleted file mode 100644 index 71d324e032..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/OneWayInterceptor.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.impl; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.MessageChannel; -import org.apache.tuscany.core.message.Message; - -/** - * An interceptor that sends the invocation Message down its request channel and does not expect a response. - * - * @version $Rev$ $Date$ - */ -public class OneWayInterceptor implements Interceptor { - private MessageChannel requestChannel; - - /** - * Construct an interceptor that sends messages down the supplied channel. - * - * @param requestChannel the channel to send messages down - */ - public OneWayInterceptor(MessageChannel requestChannel) { - this.requestChannel = requestChannel; - } - - public Message invoke(Message message) { - requestChannel.send(message); - return null; - } - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last one in an interceptor chain"); - } -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/RequestResponseInterceptor.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/RequestResponseInterceptor.java deleted file mode 100644 index 03122f0992..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/impl/RequestResponseInterceptor.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.impl; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.MessageChannel; -import org.apache.tuscany.core.message.Message; - -/** - * An interceptor that first sends the invocation Message down its request channel then extracts the response from the - * message and sends it down the response channel before returning it up the interceptor stack. - * - * @version $Rev$ $Date$ - */ -public class RequestResponseInterceptor implements Interceptor { - - private MessageChannel sourceRequestChannel; - - private MessageChannel sourceResponseChannel; - - private MessageChannel targetRequestChannel; - - private MessageChannel targetResponseChannel; - - /** - * Construct an interceptor that sends messages down the supplied channels. - * - * @param targetRequestChannel the channel to send request messages down - * @param targetResponseChannel the channel to sent response messages down - */ - public RequestResponseInterceptor(MessageChannel sourceRequestChannel, MessageChannel targetRequestChannel, - MessageChannel sourceResponseChannel, MessageChannel targetResponseChannel) { - this.sourceRequestChannel = sourceRequestChannel; - this.sourceResponseChannel = sourceResponseChannel; - this.targetRequestChannel = targetRequestChannel; - this.targetResponseChannel = targetResponseChannel; - } - - public Message invoke(Message requestMessage) { - if (sourceRequestChannel != null) { - sourceRequestChannel.send(requestMessage); - } - if (targetRequestChannel != null) { - targetRequestChannel.send(requestMessage); - } - Message responseMessage = requestMessage.getRelatedCallbackMessage(); - if (targetResponseChannel != null) { - targetResponseChannel.send(responseMessage); - } - if (sourceResponseChannel != null) { - sourceResponseChannel.send(responseMessage); - } - return responseMessage; - } - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last one in an interceptor chain"); - } -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java deleted file mode 100644 index 2f27698d6b..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKInvocationHandler.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.jdk; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.TargetInvoker; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; - -/** - * Receives a request from a JDK proxy and dispatches it to a target invoker or source interceptor stack - * - * @version $Rev$ $Date$ - */ -public class JDKInvocationHandler implements InvocationHandler { - - private MessageFactory messageFactory; - - /* - * an association of an operation to configuration holder. The holder contains the master invocation configuration - * and a locale clone of the master TargetInvoker. TargetInvokers will be cloned by the handler and placed in the - * holder if they are cacheable. This allows optimizations such as avoiding target resolution when a source refers - * to a target of greater scope since the target reference can be maintained by the invoker. When a target invoker - * is not cacheable, the master associated with the invocation configuration will be used. - */ - private Map<Method, ConfigHolder> configuration; - - // ---------------------------------- - // Constructors - // ---------------------------------- - - public JDKInvocationHandler(MessageFactory messageFactory, Map<Method, InvocationConfiguration> configuration) { - assert (configuration != null) : "Configuration not specified"; - this.configuration = new HashMap(configuration.size()); - for (Map.Entry<Method, InvocationConfiguration> entry : configuration.entrySet()) { - this.configuration.put(entry.getKey(), new ConfigHolder(entry.getValue())); - } - // this.configuration = configuration; - this.messageFactory = messageFactory; - } - - // ---------------------------------- - // Methods - // ---------------------------------- - - /** - * Dispatches a client request made on a proxy - */ - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Interceptor headInterceptor = null; - ConfigHolder holder = configuration.get(method); - if (holder == null) { - TargetException e = new TargetException("Operation not configured"); - e.setIdentifier(method.getName()); - throw e; - } - InvocationConfiguration config = holder.config; - if (config != null) { - headInterceptor = config.getSourceInterceptor(); - } - - TargetInvoker invoker = null; - - if (holder.cachedInvoker == null) { - if(config.getTargetInvoker() == null){ - TargetException e= new TargetException("No target invoker configured for operation"); - e.setIdentifier(config.getMethod().getName()); - throw e; - } - if (config.getTargetInvoker().isCacheable()) { - // clone and store the invoker locally - holder.cachedInvoker = (TargetInvoker) config.getTargetInvoker().clone(); - invoker = holder.cachedInvoker; - } else { - invoker = config.getTargetInvoker(); - } - } else { - invoker = config.getTargetInvoker(); - } - if (headInterceptor == null) { - try { - // short-circuit the dispatch and invoke the target directly - if (config.getTargetInvoker() == null) { - throw new AssertionError("No target invoker [" + method.getName() + "]"); - } - return config.getTargetInvoker().invokeTarget(args); - } catch (InvocationTargetException e) { - // the cause was thrown by the target so throw it - throw e.getCause(); - } - } else { - Message msg = messageFactory.createMessage(); - msg.setTargetInvoker(invoker);// config.getTargetInvoker()); - msg.setBody(args); - // dispatch the invocation down the chain and get the response - Message resp = headInterceptor.invoke(msg); - - Object body = resp.getBody(); - if (body instanceof Throwable) { - throw (Throwable) body; - } - return body; - } - } - - /** - * A holder used to associate an invocation configuration with a local copy of a target invoker that was previously - * cloned from the configuration master - */ - private class ConfigHolder { - - public ConfigHolder(InvocationConfiguration config) { - this.config = config; - } - - InvocationConfiguration config; - - TargetInvoker cachedInvoker; - } - -}
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKProxyFactory.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKProxyFactory.java deleted file mode 100644 index 75137ffa36..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKProxyFactory.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.jdk; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Map; - -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.MethodHashMap; -import org.apache.tuscany.core.invocation.ProxyConfiguration; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.invocation.spi.ProxyInitializationException; - -/** - * Creates proxies for handling invocations using JDK dynamic proxies - * - * @version $Rev$ $Date$ - */ -public class JDKProxyFactory implements ProxyFactory { - - private static final int UNINITIALIZED = 0; - - private static final int INITIALIZED = 1; - - private static final int ERROR = -1; - - private int state = UNINITIALIZED; - - private Class[] businessInterfaceArray; - - private Map<Method, InvocationConfiguration> methodToInvocationConfig; - - private ProxyConfiguration configuration; - - public void initialize() throws ProxyInitializationException { - if (state != UNINITIALIZED) { - throw new IllegalStateException("Proxy factory in wrong state [" + state + "]"); - } - Map<Method, InvocationConfiguration> invocationConfigs = configuration.getInvocationConfigurations(); - methodToInvocationConfig = new MethodHashMap(invocationConfigs.size()); - for (Map.Entry entry : invocationConfigs.entrySet()) { - Method method = (Method) entry.getKey(); - methodToInvocationConfig.put(method, (InvocationConfiguration) entry.getValue()); - } - state = INITIALIZED; - } - - public Object createProxy() { - if (state != INITIALIZED) { - throw new IllegalStateException("Proxy factory not INITIALIZED [" + state + "]"); - } - InvocationHandler handler = new JDKInvocationHandler(configuration.getMessageFactory(), methodToInvocationConfig); - return Proxy.newProxyInstance(configuration.getProxyClassLoader(), businessInterfaceArray, handler); - } - - public ProxyConfiguration getProxyConfiguration() { - return configuration; - } - - public void setProxyConfiguration(ProxyConfiguration config) { - configuration = config; - } - - public void setBusinessInterface(Class interfaze) { - businessInterfaceArray = new Class[] { interfaze }; - } - - public Class getBusinessInterface() { - return businessInterfaceArray[0]; - } - - public void addInterface(Class claz) { - throw new UnsupportedOperationException("Additional proxy interfaces not yet supported"); - } - - public Class[] getImplementatedInterfaces() { - return businessInterfaceArray; - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKProxyFactoryFactory.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKProxyFactoryFactory.java deleted file mode 100644 index 81458e4178..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/jdk/JDKProxyFactoryFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.jdk; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Proxy; - -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory; - -/** - * Creates JDK Dynamic Proxy-based proxy factories - * - * @version $Rev$ $Date$ - */ -public class JDKProxyFactoryFactory implements ProxyFactoryFactory { - - public JDKProxyFactoryFactory() { - } - - public ProxyFactory createProxyFactory() { - return new JDKProxyFactory(); - } - - public boolean isProxy(Object object) { - if (object == null) { - return false; - } else { - return Proxy.isProxyClass(object.getClass()); - } - } - - public InvocationHandler getHandler(Object proxy) { - if (proxy == null) { - return null; - } else { - return Proxy.getInvocationHandler(proxy); - } - } - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyCreationException.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyCreationException.java deleted file mode 100644 index 2a97975bf9..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyCreationException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.spi; - -/** - * Denotes an error creating a proxy instance - * - * @version $Rev$ $Date$ - */ -public class ProxyCreationException extends ProxyException { - - public ProxyCreationException() { - super(); - } - - public ProxyCreationException(String message, Throwable cause) { - super(message, cause); - } - - public ProxyCreationException(String message) { - super(message); - } - - public ProxyCreationException(Throwable cause) { - super(cause); - } - -} - diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyException.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyException.java deleted file mode 100644 index 843a90d341..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyException.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.spi; - -import org.apache.tuscany.core.invocation.InvocationException; - -public class ProxyException extends InvocationException { - - public ProxyException() { - super(); - } - - public ProxyException(String message) { - super(message); - } - - public ProxyException(String message, Throwable cause) { - super(message, cause); - } - - public ProxyException(Throwable cause) { - super(cause); - } - -} - diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyFactory.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyFactory.java deleted file mode 100644 index aef98a0b4c..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyFactory.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.spi; - -import org.apache.tuscany.core.invocation.ProxyConfiguration; - -/** - * Implementations are responsible for creating service proxies using a particular proxy strategy. Service proxies may - * represent a wire between two components or a reference to a service resolved through a locate operation. When - * representing a wire, a proxy is injected on reference in a component implementation. In this case the proxy will - * implement the interface required by the reference and pass invocation messages down source- and target-side - * invocation chains for processing. These source- and target-side invocation chains will be derived from metadata - * decorating the source reference and target service definition and implementation respectively. - * <p> - * The second type of proxy will be generated when non-component client code (such as a JSP) locates a service. In this - * case, the proxy will implement the requested service interface but will only contain a target-side invocation chain. - * - * @version $Rev$ $Date$ - */ -public interface ProxyFactory<T> { - - /** - * Prepares the factory for generating the proxy of a particular reference type. This will typically be called when - * construction of the proxy configuration is complete, including linking of source and target invocation chains. - * - * @throws ProxyInitializationException if an error is encountered during initialization - */ - public void initialize() throws ProxyInitializationException; - - /** - * Returns a proxy for a service reference - */ - public T createProxy() throws ProxyCreationException; - - /** - * Returns the configuration information used to create a proxy - */ - public ProxyConfiguration getProxyConfiguration(); - - /** - * Sets the configuration information used to create a proxy - */ - public void setProxyConfiguration(ProxyConfiguration config); - - /** - * Sets the primary interface type generated proxies should implement - */ - public void setBusinessInterface(Class interfaze); - - /** - * Returns the primary interface type implemented by generated proxies - */ - public Class getBusinessInterface(); - - /** - * Adds an interface type generated proxies should implement - */ - public void addInterface(Class claz); - - /** - * Returns an array of all interfaces implemented by generated proxies - */ - public Class[] getImplementatedInterfaces(); - -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyFactoryFactory.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyFactoryFactory.java deleted file mode 100644 index 8e4c2ee589..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyFactoryFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.spi; - -import java.lang.reflect.InvocationHandler; - -/** - * Creates proxy factories which may be subsequently configured to generate proxies - * - * @version $Rev$ $Date$ - */ -public interface ProxyFactoryFactory { - - /** - * Returns a new proxy factory - */ - public ProxyFactory createProxyFactory(); - - /** - * Determines whether the given object is a proxy - */ - public boolean isProxy(Object object); - - /** - * Returns an invocation handler fronting the invocation chains used by the proxy. Note that should SCA define a - * DII, this could return such an interface. - * - * @throws IllegalArgumentException if the class is not a proxy - */ - public InvocationHandler getHandler(Object proxy) throws IllegalArgumentException; -} diff --git a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyInitializationException.java b/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyInitializationException.java deleted file mode 100644 index d8c8e64614..0000000000 --- a/tags/java-stable-20060304/sca/core/src/main/java/org/apache/tuscany/core/invocation/spi/ProxyInitializationException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.spi; - -/** - * Denotes an error initializing a proxy factory - * - * @version $Rev$ $Date$ - */ -public class ProxyInitializationException extends ProxyException { - - public ProxyInitializationException() { - super(); - } - - public ProxyInitializationException(String message) { - super(message); - } - - public ProxyInitializationException(String message, Throwable cause) { - super(message, cause); - } - - public ProxyInitializationException(Throwable cause) { - super(cause); - } - -} - |