diff options
Diffstat (limited to 'branches/sca-java-M2/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java')
-rw-r--r-- | branches/sca-java-M2/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/branches/sca-java-M2/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java b/branches/sca-java-M2/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java deleted file mode 100644 index 6177810b0f..0000000000 --- a/branches/sca-java-M2/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.spi.wire; - -import java.lang.reflect.InvocationTargetException; - - -/** - * Base class for dispatching an invocation through an {@link InboundInvocationChain} - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractInboundInvocationHandler { - - /** - * Dispatches a client request made on a proxy - */ - public Object invoke(InboundInvocationChain chain, TargetInvoker invoker, Object[] args) throws Throwable { - Interceptor headInterceptor = chain.getHeadInterceptor(); - if (headInterceptor == null) { - try { - // short-circuit the dispatch and invoke the target directly - if (chain.getTargetInvoker() == null) { - throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]"); - } - return chain.getTargetInvoker().invokeTarget(args); - } catch (InvocationTargetException e) { - // the cause was thrown by the target so throw it - throw e.getCause(); - } - } else { - Message msg = new MessageImpl(); - msg.setTargetInvoker(invoker); - Object messageId = getMessageId(); - if (messageId == null) { - messageId = new MessageId(); - } - msg.setMessageId(messageId); - Object corrId = getCorrelationId(); - msg.setCorrelationId(corrId); - msg.setBody(args); - Message resp; - // dispatch the wire down the chain and get the response - resp = headInterceptor.invoke(msg); - Object body = resp.getBody(); - if (resp.isFault()) { - throw (Throwable) body; - } - return body; - } - } - - protected abstract Object getMessageId(); - - protected abstract Object getCorrelationId(); -} |