summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire')
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java42
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java181
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java44
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java33
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java34
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java55
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java43
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java131
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java34
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java49
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java47
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java33
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java92
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java43
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java76
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java47
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java43
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java68
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java48
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java46
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java68
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java46
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java71
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java48
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java73
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java137
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java92
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java95
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java66
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java157
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java51
31 files changed, 0 insertions, 2093 deletions
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java
deleted file mode 100644
index 1e87e45616..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire;
-
-import org.apache.tuscany.core.message.Message;
-
-/**
- * Synchronous, around-style mediation associated with a client- or target- side wire.
- *
- * @version $Rev$ $Date$
- */
-public interface Interceptor {
-
- /**
- * Process a synchronous wire.
- *
- * @param msg the request Message for the wire
- * @return the response Message from the wire
- */
- Message invoke(Message msg);
-
- /**
- * Sets the next interceptor.
- *
- * @param next
- */
- void setNext(Interceptor next);
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java
deleted file mode 100644
index 94e8d91ba5..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java
+++ /dev/null
@@ -1,181 +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.wire;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Contains a source- or target-side invocation pipeline for a service operation. The runtime framework creates invocation chains
- * on a per-operation, per-service basis. Further, invocation chains are further distinguished by being part of the source or
- * target sides of a wire. Chains are "bridged" together by the runtime by a set of {@link
- * org.apache.tuscany.core.builder.WireBuilder}s with the source-side holding references to the target.
- * <p/>
- * <code>InvocationChain</code>s are managed by {@link WireConfiguration}s, which are used by {@link
- * org.apache.tuscany.core.wire.WireFactory}s to buildSource wires and proxies.
- * <p/>
- * Invocation configurations must contain at least one interceptor and may have 0 to N handlers. Handlers process a wire request
- * or response in a one-way fashion. A typical wire sequence where interceptors and handlers are configured for both the source
- * and target-side will proceed as follows:
- * <pre>
- * <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.wire.impl.RequestResponseInterceptor} if there are handlers present, will be invoked. The RR
- * interceptor will in turn pass the message to a {@link MessageChannel} which will invoke all source-side request handlers.
- * <li>The RR interceptor will then invoke the target-side request <code>MessageChannel</code>.
- * <li>The last source-side handler, an instance of {@link org.apache.tuscany.core.wire.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.wire.impl.InvokerInterceptor} will retrieve the {@link 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 wire
- * 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 wire stack. </ol>
- * </pre>
- * <p/>
- * The source-to-target bridge may be constructed in any of the following ways:
- * <pre>
- * <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>
- * </pre>
- * <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 wire chains and the target
- * invoker will be held by the target-side and passed down the pipeline.
- *
- * @version $Rev$ $Date$
- * @see org.apache.tuscany.core.builder.WireBuilder
- * @see WireFactory
- * @see TargetInvoker
- * @see org.apache.tuscany.core.wire.impl.MessageDispatcher
- */
-public abstract class InvocationConfiguration {
-
- // the operation on the target that will utlimately be invoked
- protected Method operation;
-
- // responsible for invoking a target instance
- protected TargetInvoker targetInvoker;
-
- protected Interceptor interceptorChainHead;
-
- protected Interceptor interceptorChainTail;
-
- protected List<MessageHandler> requestHandlers;
-
- protected List<MessageHandler> responseHandlers;
-
- public InvocationConfiguration(Method operation) {
- assert (operation != null) : "No operation type specified";
- this.operation = operation;
- }
-
- /**
- * Returns the target operation for this invocation chain
- */
- public Method getMethod() {
- return operation;
- }
-
- /**
- * Adds an request handler to the invocation chain
- */
- public void addRequestHandler(MessageHandler handler) {
- if (requestHandlers == null) {
- requestHandlers = new ArrayList<MessageHandler>();
- }
- requestHandlers.add(handler);
- }
-
- /**
- * Adds an response handler to the invocation chain
- */
- public void addResponseHandler(MessageHandler handler) {
- if (responseHandlers == null) {
- responseHandlers = new ArrayList<MessageHandler>();
- }
- responseHandlers.add(handler);
- }
-
- /**
- * Returns the request handler chain
- */
- public List<MessageHandler> getRequestHandlers() {
- return requestHandlers;
- }
-
- /**
- * Returns the response handler chain
- */
- public List<MessageHandler> getResponseHandlers() {
- return responseHandlers;
- }
-
- /**
- * Sets the target invoker to pass down the chain
- */
- public void setTargetInvoker(TargetInvoker invoker) {
- this.targetInvoker = invoker;
- }
-
- /**
- * Returns the target invoker that is passed down the chain
- */
- public TargetInvoker getTargetInvoker() {
- return targetInvoker;
- }
-
- /**
- * Adds an interceptor to the chain
- */
- public void addInterceptor(Interceptor interceptor) {
- if (interceptorChainHead == null) {
- interceptorChainHead = interceptor;
- } else {
- interceptorChainTail.setNext(interceptor);
- }
- interceptorChainTail = interceptor;
- }
-
- /**
- * Returns the last interceptor in the chain
- */
- public Interceptor getTailInterceptor() {
- return interceptorChainTail;
- }
-
- /**
- * Returns the first interceptor in the chain
- */
- public Interceptor getHeadInterceptor() {
- return interceptorChainHead;
- }
-
- /**
- * Signals to the chain that its configuration is complete. Implementations may use this callback to prepare there invocation
- * chains.
- */
- public abstract void build();
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java
deleted file mode 100644
index 5e3dbaa204..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire;
-
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Denotes a runtime exception thrown during an invocation over a wire
- *
- * @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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java
deleted file mode 100644
index 07a7594849..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire;
-
-import org.apache.tuscany.core.message.Message;
-
-/**
- * Represents a one-way pipeline through which messages are sent during an invocation over a wire
- *
- * @see org.apache.tuscany.core.message.Message
- */
-public interface MessageChannel {
-
- /**
- * Sends a message
- */
- void send(Message message);
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java
deleted file mode 100644
index 19442f3663..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire;
-
-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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java
deleted file mode 100644
index c0e40e0644..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java
+++ /dev/null
@@ -1,55 +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.wire;
-
-import org.apache.tuscany.core.config.JavaIntrospectionHelper;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-/**
- * A <code>Map</code> implementation that performs a lookup on a collection of methods by method name. This implementation is used
- * to map methods on one interface to compatible methods on another interface, for example, when flowing an invocation from a
- * proxy injected on a source reference to a target service instance.
- *
- * @version $Rev$ $Date$
- */
-public class MethodHashMap<T extends InvocationConfiguration> extends HashMap<Method, T> {
-
- public MethodHashMap() {
- super();
- }
-
- public MethodHashMap(int size) {
- super(size);
- }
-
- /**
- * @see java.util.HashMap#get(java.lang.Object)
- */
- public T get(Object key) {
- if (key instanceof Method) {
- Method m = (Method) key;
- //FIXME find a more efficient way to find a matching method
- Method closestMethod = JavaIntrospectionHelper.findClosestMatchingMethod(m.getName(), m.getParameterTypes(), super.keySet());
- return super.get(closestMethod);
- } else {
- throw new IllegalArgumentException("Key must be a method");
- }
- }
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java
deleted file mode 100644
index 2caa613b8f..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire;
-
-/**
- * Denotes an error creating a proxy representing for a wire
- *
- * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $
- */
-public class ProxyCreationException extends WireException {
-
- 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java
deleted file mode 100644
index 80e1450a0d..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java
+++ /dev/null
@@ -1,131 +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.wire;
-
-import org.apache.tuscany.core.wire.impl.MessageChannelImpl;
-import org.apache.tuscany.core.wire.impl.MessageDispatcher;
-import org.apache.tuscany.core.wire.impl.RequestResponseInterceptor;
-
-import java.lang.reflect.Method;
-
-/**
- * Contains a source-side invocation pipeline for a service operation.
- *
- * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $
- */
-public class SourceInvocationConfiguration extends InvocationConfiguration {
-
- // the pointer to the bridged target head interceptor or null if the target has no interceptors
- private Interceptor targetInterceptorChainHead;
-
- // the pointer to bridged target request channel, or null if the target has an interceptor
- private MessageChannel targetRequestChannel;
-
- // the pointer to bridged target response channel, or null if the target has an interceptor
- private MessageChannel targetResponseChannel;
-
- /**
- * Creates an new wire configuration for the given service reference operation
- *
- * @param operation the method on the interface representing specified by the reference, where the method corresponds to the
- * service operation
- */
- public SourceInvocationConfiguration(Method operation) {
- super(operation);
- }
-
- /**
- * Sets the head interceptor of the target-side configuration for the wire. Used when the runtime bridges source and target
- * chains.
- *
- * @param interceptor
- */
- public void setTargetInterceptor(Interceptor interceptor) {
- targetInterceptorChainHead = interceptor;
- }
-
- /**
- * Returns the head target-side interceptor. This will be the head interceptor of the "bridged" target configuration.
- */
- public Interceptor getTargetInterceptor() {
- return targetInterceptorChainHead;
- }
-
- /**
- * Sets the target-side request channel. Used when the runtime bridges source and target chains.
- */
- public void setTargetRequestChannel(MessageChannel channel) {
- targetRequestChannel = channel;
- }
-
- /**
- * Sets the target-side response channel. Used when the runtime bridges source and target chains.
- */
- public void setTargetResponseChannel(MessageChannel channel) {
- targetResponseChannel = channel;
- }
-
- /**
- * Prepares the configuration by linking interceptors and handlers
- */
- @Override
- 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 (interceptorChainHead != null) {
- interceptorChainTail.setNext(channelInterceptor);
- } else {
- interceptorChainHead = channelInterceptor;
- }
-
- } else {
- // no request handlers
- if (interceptorChainHead != null) {
- if (targetInterceptorChainHead != null) {
- // Connect source interceptor chain directly to target interceptor chain
- interceptorChainTail.setNext(targetInterceptorChainHead);
- // interceptorChainTail = targetInterceptorChainHead;
- } else {
- // Connect source interceptor chain to the target request channel
- Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null,
- targetResponseChannel);
- interceptorChainTail.setNext(channelInterceptor);
- }
- } else {
- // no source interceptor chain or source handlers, conntect to target interceptor chain or channel
- if (targetInterceptorChainHead != null) {
- interceptorChainHead = targetInterceptorChainHead;
- interceptorChainTail = targetInterceptorChainHead;
- } else {
- Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null,
- targetResponseChannel);
- interceptorChainHead = channelInterceptor;
- interceptorChainTail = channelInterceptor;
- }
- }
- }
- }
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java
deleted file mode 100644
index c460c71bd5..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.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.wire;
-
-/**
- * Implementations are responsible for managing the source side of a wire.
- *
- * @version $$Rev$$ $$Date$$
- */
-public interface SourceWireFactory<T> extends WireFactory<T>{
-
- /**
- * Returns the configuration information used to create the source-side of a wire, including invocation chains
- */
- public WireSourceConfiguration getConfiguration();
-
- /**
- * Sets the configuration information used to create the source-side of a wire, including invocation chains
- */
- public void setConfiguration(WireSourceConfiguration config);
-
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java
deleted file mode 100644
index fc7810763d..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java
+++ /dev/null
@@ -1,49 +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.wire;
-
-import org.apache.tuscany.core.wire.impl.MessageDispatcher;
-
-import java.lang.reflect.Method;
-
-/**
- * Contains a target-side invocation pipeline for a service operation.
- *
- * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $
- */
-public class TargetInvocationConfiguration extends InvocationConfiguration {
-
- /**
- * Creates an new target-side pipeline for the given operation
- *
- * @param operation the method on the interface representing target service, where the method corresponds to the service
- * operation
- */
- public TargetInvocationConfiguration(Method operation) {
- super(operation);
- }
-
- /**
- * Prepares the configuration by linking interceptors and handlers
- */
- @Override
- public void build() {
- if (requestHandlers != null && interceptorChainHead != null) {
- // on target-side, connect existing handlers and interceptors
- MessageHandler messageDispatcher = new MessageDispatcher(interceptorChainHead);
- requestHandlers.add(messageDispatcher);
- }
- }
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java
deleted file mode 100644
index 387da1bca3..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java
+++ /dev/null
@@ -1,47 +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.wire;
-
-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();
-
- /**
- * Implementations must support deep cloning
- */
- public Object clone() throws CloneNotSupportedException;
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java
deleted file mode 100644
index f46754b975..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.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.wire;
-
-/**
- * Implementations are responsible for managing the target side of a wire
- *
- * @version $$Rev$$ $$Date$$
- */
-public interface TargetWireFactory<T> extends WireFactory<T> {
-
- /**
- * Returns the configuration information used to create the target-side of a wire, including invocation chains
- */
- public WireTargetConfiguration getConfiguration();
-
- /**
- * Sets the configuration information used to create the target-side of a wire, including invocation chains
- */
- public void setConfiguration(WireTargetConfiguration config);
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java
deleted file mode 100644
index 78ab6ee3c7..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java
+++ /dev/null
@@ -1,92 +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.wire;
-
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.message.MessageFactory;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-
-/**
- * Contains configuration for a wire, including its invocation chains. Invocation chains are accessed from the collection of
- * {@link InvocationConfiguration}s keyed by operation on the service specified by the source reference or target service.
- * <code>WireConfiguration</code> subtypes distinguish between source and target sides of a wire and hence return corresponding
- * <code>InvocationChain</code> subtypes. Operations are represented using JDK reflection, i.e. as a <code>Method</code>
- * corresponding to the Java interface representing the service.
- * <p/>
- * Wire configurations are created from an assembly model by the runtime during the buildSource phase.
- *
- * @version $Rev$ $Date$
- */
-public abstract class WireConfiguration<T extends InvocationConfiguration> {
-
- protected Map<Method, T> configurations;
-
- protected ClassLoader proxyClassLoader;
-
- protected MessageFactory messageFactory;
-
- protected QualifiedName targetName;
-
- /**
- * Creates the configuration
- *
- * @param targetName the qualified name of the target service specified by the wire
- * @param proxyClassLoader the classloader to use when creating a proxy
- * @param messageFactory the factory used to create wire messages
- */
- public WireConfiguration(QualifiedName targetName, ClassLoader proxyClassLoader, MessageFactory messageFactory) {
- this.targetName = targetName;
- this.messageFactory = messageFactory;
- if (proxyClassLoader == null) {
- this.proxyClassLoader = Thread.currentThread().getContextClassLoader();
- } else {
- this.proxyClassLoader = proxyClassLoader;
- }
- }
-
- /**
- * Returns the qualified name of the target service specified by the wire
- */
- public QualifiedName getTargetName() {
- return targetName;
- }
-
- /**
- * Returns the classloader used for creating proxies
- */
- public ClassLoader getProxyClassLoader() {
- return proxyClassLoader;
- }
-
- /**
- * Returns the factory used to create invocation messages
- */
- public MessageFactory getMessageFactory() {
- return messageFactory;
- }
-
- /**
- * Returns the invocation configuration for each operation on a service specified by a reference or a target service.
- */
- public Map<Method, T> getInvocationConfigurations() {
- return configurations;
- }
-
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java
deleted file mode 100644
index 0bada0bbfc..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.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.wire;
-
-import org.apache.tuscany.common.TuscanyException;
-
-/**
- * Denotes a top-level exception dealing with a wire
- */
-public abstract class WireException extends TuscanyException {
-
- public WireException() {
- super();
- }
-
- public WireException(String message) {
- super(message);
- }
-
- public WireException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public WireException(Throwable cause) {
- super(cause);
- }
-
-}
-
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java
deleted file mode 100644
index 55cab31adf..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java
+++ /dev/null
@@ -1,76 +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.wire;
-
-/**
- * Implementations are responsible for managing source or target sides of a wire, including creation of service proxies.
- * Source-side wires are injected on references and may contain policy interceptors and/or handlers specified by them. Target-side
- * wires may contain policy interceptors and/or handlers specified by the service the wire is targeted to or one of its
- * operations. Source- and target-side <code>WireFactory</code>s are held in the {@link org.apache.tuscany.core.builder.ContextFactory}
- * associated with the source reference or target service.
- * <p/>
- * When an assembly is built by the runtime, source-side and target-side wires are "bridged" on the source side (i.e. a reference
- * to the target-side is stored in the source-side). This bridging process is done by a series of {@link
- * org.apache.tuscany.core.builder.WireBuilder}s configured in the runtime. When a new component implementation instance is
- * created, it will be injected with a proxy for each reference containing the bridged source- and target-side wires.
- * <p/>
- * Unmanaged code, i.e. clients that are not components, that perform a locate operation are handled differently. In this case, a
- * target-side proxy will be returned by the locate operation created by the <code>WireFactory</code> associated with the target
- * service. This target-side proxy will only contain the target-side wire and its handlers/interceptors.Ê
- * <p/>
- * Wires are structured by operation; that is, they contain an invocation chain per operation on a service. Note that the service
- * specified by a reference may differ in type from the target service specified by the wire. In this case, a mediation may be
- * performed by the runtime. Hence, source-to-target bridging is done on a per operation basis. Source- and target-side Invocation
- * chains are accessible through the subtypes of <code>WireFactory</code>.
- *
- * @version $Rev$ $Date$
- */
-public interface WireFactory<T> {
-
- /**
- * Prepares the factory. This will typically be called at buildSource time, after bridging source- and target-side invocation chains.
- *
- * @throws WireFactoryInitException if an error is encountered during initialization
- */
- public void initialize() throws WireFactoryInitException;
-
- /**
- * Returns a proxy for a service specified by a reference or target
- */
- public T createProxy() throws ProxyCreationException;
-
- /**
- * Sets the primary interface type generated proxies implement
- */
- public void setBusinessInterface(Class interfaze);
-
- /**
- * Returns the primary interface type implemented by generated proxies
- */
- public Class getBusinessInterface();
-
- /**
- * Adds an interface type generated proxies implement
- */
- public void addInterface(Class claz);
-
- /**
- * Returns an array of all interfaces implemented by generated proxies
- */
- public Class[] getImplementatedInterfaces();
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java
deleted file mode 100644
index f055ecd427..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java
+++ /dev/null
@@ -1,47 +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.wire;
-
-import java.lang.reflect.InvocationHandler;
-
-/**
- * Implementations provide a runtime system service that creates {@link WireFactory}s
- *
- * @version $Rev$ $Date$
- */
-public interface WireFactoryFactory {
-
- /**
- * Creates a target-side wire factory
- */
- public TargetWireFactory createTargetWireFactory();
-
- /**
- * Creates a source-side wire factory
- */
- public SourceWireFactory createSourceWireFactory();
-
- /**
- * Determines whether the given object is a proxy
- */
- public boolean isProxy(Object object);
-
- /**
- * Returns an wire handler fronting the wire 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java
deleted file mode 100644
index caf535ee00..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.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.wire;
-
-/**
- * Denotes an error initializing a wire factory
- *
- * @version $Rev$ $Date$
- */
-public class WireFactoryInitException extends WireException {
-
- public WireFactoryInitException() {
- super();
- }
-
- public WireFactoryInitException(String message) {
- super(message);
- }
-
- public WireFactoryInitException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public WireFactoryInitException(Throwable cause) {
- super(cause);
- }
-
-}
-
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java
deleted file mode 100644
index d9408b2fb0..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.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.wire;
-
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.message.MessageFactory;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-
-/**
- * Contains configuration for the source side of a wire
- *
- * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $
- */
-public class WireSourceConfiguration extends WireConfiguration<SourceInvocationConfiguration> {
-
- private String referenceName;
-
- /**
- * Creates the source side of a wire
- *
- * @param referenceName the name of the reference the wire is associated with
- * @param targetName the qualified name of the target service specified by the wire
- * @param invocationConfigs a collection of service operation-to-invocation chain mappings
- * @param proxyClassLoader the classloader to use when creating a proxy
- * @param messageFactory the factory used to create wire messages
- */
- public WireSourceConfiguration(String referenceName, QualifiedName targetName,
- Map<Method, SourceInvocationConfiguration> invocationConfigs, ClassLoader proxyClassLoader, MessageFactory messageFactory) {
- super(targetName, proxyClassLoader, messageFactory);
- this.referenceName = referenceName;
- this.configurations = invocationConfigs;
- }
-
- /**
- * Creates the source side of a wire where the reference is "anonymous", i.e. on an entry point
- *
- * @param targetName the qualified name of the target service specified by the wire
- * @param invocationConfigs a collection of service operation-to-invocation chain mappings
- * @param proxyClassLoader the classloader to use when creating a proxy
- * @param messageFactory the factory used to create wire messages
- */
- public WireSourceConfiguration(QualifiedName targetName,
- Map<Method, SourceInvocationConfiguration> invocationConfigs, ClassLoader proxyClassLoader, MessageFactory messageFactory) {
- this(null, targetName, invocationConfigs, proxyClassLoader, messageFactory);
- }
-
-
- /**
- * Returns the name of the source reference
- */
- public String getReferenceName() {
- return referenceName;
- }
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java
deleted file mode 100644
index ce6ebade0c..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.wire;
-
-import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.core.context.QualifiedName;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-
-/**
- * Contains configuration for the target side of a wire
- *
- * @version $$Rev$$ $$Date$$
- */
-public class WireTargetConfiguration extends WireConfiguration<TargetInvocationConfiguration> {
-
- /**
- * Creates the source side of a wire
- *
- * @param targetName the qualified name of the target service specified by the wire
- * @param invocationConfigs a collection of target service operation-to-invocation chain mappings
- * @param proxyClassLoader the classloader to use when creating a proxy
- * @param messageFactory the factory used to create wire messages
- */
- public WireTargetConfiguration(QualifiedName targetName, Map<Method, TargetInvocationConfiguration> invocationConfigs,
- ClassLoader proxyClassLoader, MessageFactory messageFactory) {
- super(targetName, proxyClassLoader, messageFactory);
- assert (invocationConfigs != null) : "No wire configuration map specified";
- configurations = invocationConfigs;
-
- }
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java
deleted file mode 100644
index 9c114c013e..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire.impl;
-
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.InvocationRuntimeException;
-import org.apache.tuscany.core.wire.TargetInvoker;
-import org.apache.tuscany.core.message.Message;
-
-/**
- * Serves as a tail interceptor on a target wire chain. This implementation dispatches to the target invoker
- * passed inside the wire message. Target invokers are passed from the source in order to allow for caching of
- * target instances.
- *
- * @see org.apache.tuscany.core.wire.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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java
deleted file mode 100644
index 8b9d484313..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire.impl;
-
-import org.apache.tuscany.core.wire.MessageChannel;
-import org.apache.tuscany.core.wire.MessageHandler;
-import org.apache.tuscany.core.message.Message;
-
-import java.util.List;
-
-/**
- * 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java
deleted file mode 100644
index ada01b7f91..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire.impl;
-
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.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 wire 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java
deleted file mode 100644
index e46ed26184..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.wire.impl;
-
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.wire.WireConfiguration;
-import org.apache.tuscany.core.wire.ProxyCreationException;
-import org.apache.tuscany.core.wire.WireFactory;
-import org.apache.tuscany.core.wire.WireFactoryInitException;
-
-/**
- * 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 NullWireFactory implements WireFactory {
-
- private CompositeContext parentContext;
-
- private String targetName;
-
- private Class businessInterface;
-
- public NullWireFactory(String componentName, CompositeContext parentContext) {
- assert (parentContext != null) : "Parent context was null";
- this.targetName = componentName;
- this.parentContext = parentContext;
- }
-
- public void initialize(Class businessInterface, WireConfiguration config) throws WireFactoryInitException {
- this.businessInterface = businessInterface;
- }
-
- public Object createProxy() throws ProxyCreationException {
- return parentContext.getContext(targetName);
- }
-
- public void initialize() throws WireFactoryInitException {
- }
-
- public void setBusinessInterface(Class interfaze) {
- businessInterface = interfaze;
- }
-
- public Class getBusinessInterface() {
- return businessInterface;
- }
-
- public void addInterface(Class claz) {
- throw new UnsupportedOperationException();
- }
-
- public Class[] getImplementatedInterfaces() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java
deleted file mode 100644
index 4e3bb460aa..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire.impl;
-
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.MessageChannel;
-import org.apache.tuscany.core.message.Message;
-
-/**
- * An interceptor that sends the wire 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java
deleted file mode 100644
index ae1c69fc12..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/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.wire.impl;
-
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.MessageChannel;
-import org.apache.tuscany.core.message.Message;
-
-/**
- * An interceptor that first sends a 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java
deleted file mode 100644
index 2cef096a5e..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java
+++ /dev/null
@@ -1,137 +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.wire.jdk;
-
-import org.apache.tuscany.core.context.TargetException;
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.InvocationConfiguration;
-import org.apache.tuscany.core.wire.TargetInvoker;
-import org.apache.tuscany.core.message.Message;
-import org.apache.tuscany.core.message.MessageFactory;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 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 wire 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 wire configuration will be used.
- */
- private Map<Method, ConfigHolder> configuration;
-
- public JDKInvocationHandler(MessageFactory messageFactory, Map<Method, ? extends InvocationConfiguration> configuration) {
- assert (messageFactory != null) : "Message factory was null";
- assert (configuration != null) : "Configuration not specified";
- this.configuration = new HashMap<Method, ConfigHolder>(configuration.size());
- for (Map.Entry<Method, ? extends InvocationConfiguration> entry : configuration.entrySet()) {
- this.configuration.put(entry.getKey(), new ConfigHolder(entry.getValue()));
- }
- this.messageFactory = messageFactory;
- }
-
- /**
- * 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.getHeadInterceptor();
- }
-
- TargetInvoker invoker;
-
- if (holder.cachedInvoker == null) {
- assert config != 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 {
- assert config != null;
- 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);
- msg.setBody(args);
- // dispatch the wire 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 wire 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java
deleted file mode 100644
index dbaab87fce..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java
+++ /dev/null
@@ -1,92 +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.wire.jdk;
-
-import org.apache.tuscany.core.wire.MethodHashMap;
-import org.apache.tuscany.core.wire.WireFactoryInitException;
-import org.apache.tuscany.core.wire.SourceInvocationConfiguration;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.WireSourceConfiguration;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Map;
-
-/**
- * Creates proxies that are injected on references using JDK dynamic proxy facilities and front a wire. The proxies implement the
- * business interface associated with the service required by reference.
- *
- * @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $
- */
-public class JDKSourceWireFactory implements SourceWireFactory {
-
- private static final int UNINITIALIZED = 0;
-
- private static final int INITIALIZED = 1;
-
- private int state = UNINITIALIZED;
-
- private Class[] businessInterfaceArray;
-
- private Map<Method, SourceInvocationConfiguration> methodToInvocationConfig;
-
- private WireSourceConfiguration configuration;
-
- public void initialize() throws WireFactoryInitException {
- if (state != UNINITIALIZED) {
- throw new IllegalStateException("Proxy factory in wrong state [" + state + "]");
- }
- Map<Method, SourceInvocationConfiguration> invocationConfigs = configuration.getInvocationConfigurations();
- methodToInvocationConfig = new MethodHashMap<SourceInvocationConfiguration>(invocationConfigs.size());
- for (Map.Entry<Method, SourceInvocationConfiguration> entry : invocationConfigs.entrySet()) {
- Method method = entry.getKey();
- methodToInvocationConfig.put(method, 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 WireSourceConfiguration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(WireSourceConfiguration 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java
deleted file mode 100644
index 76f3b0389c..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.wire.jdk;
-
-import org.apache.tuscany.core.wire.MethodHashMap;
-import org.apache.tuscany.core.wire.WireFactoryInitException;
-import org.apache.tuscany.core.wire.TargetInvocationConfiguration;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.wire.WireTargetConfiguration;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Map;
-
-/**
- * Creates proxies that are returned to non-SCA clients using JDK dynamic proxy facilities and front a wire. The proxies implement
- * the business interface associated with the target service of the wire and are typically returned by a locate operation.
- *
- * @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $
- */
-public class JDKTargetWireFactory implements TargetWireFactory {
-
- private static final int UNINITIALIZED = 0;
-
- private static final int INITIALIZED = 1;
-
- private int state = UNINITIALIZED;
-
- private Class[] businessInterfaceArray;
-
- private Map<Method, TargetInvocationConfiguration> methodToInvocationConfig;
-
- private WireTargetConfiguration configuration;
-
- public void initialize() throws WireFactoryInitException {
- if (state != UNINITIALIZED) {
- throw new IllegalStateException("Proxy factory in wrong state [" + state + "]");
- }
- Map<Method, TargetInvocationConfiguration> invocationConfigs = configuration.getInvocationConfigurations();
- methodToInvocationConfig = new MethodHashMap<TargetInvocationConfiguration>(invocationConfigs.size());
- for (Map.Entry<Method, TargetInvocationConfiguration> entry : invocationConfigs.entrySet()) {
- Method method = entry.getKey();
- methodToInvocationConfig.put(method, 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 WireTargetConfiguration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(WireTargetConfiguration 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java
deleted file mode 100644
index 3eaffb9ba8..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java
+++ /dev/null
@@ -1,66 +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.wire.jdk;
-
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.wire.WireFactoryFactory;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-
-/**
- * A system service that creates JDK dynamic proxy-based {@link org.apache.tuscany.core.wire.WireFactory}s
- *
- * @version $Rev$ $Date$
- */
-@Scope("MODULE")
-@Service(interfaces = {WireFactoryFactory.class})
-public class JDKWireFactoryFactory implements WireFactoryFactory {
-
- public JDKWireFactoryFactory() {
- }
-
- @Init(eager = true)
- public void init() {
- }
-
- public TargetWireFactory createTargetWireFactory() {
- return new JDKTargetWireFactory();
- }
-
- public SourceWireFactory createSourceWireFactory() {
- return new JDKSourceWireFactory();
- }
-
- 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-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java
deleted file mode 100644
index 3c61081caf..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java
+++ /dev/null
@@ -1,157 +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.wire.service;
-
-import org.apache.tuscany.core.config.JavaIntrospectionHelper;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.apache.tuscany.core.wire.MethodHashMap;
-import org.apache.tuscany.core.wire.WireFactoryFactory;
-import org.apache.tuscany.core.wire.SourceInvocationConfiguration;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.TargetInvocationConfiguration;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.wire.WireSourceConfiguration;
-import org.apache.tuscany.core.wire.WireTargetConfiguration;
-import org.apache.tuscany.core.wire.impl.InvokerInterceptor;
-import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry;
-import org.apache.tuscany.core.builder.BuilderConfigException;
-import org.apache.tuscany.model.assembly.ConfiguredService;
-import org.apache.tuscany.model.assembly.ConfiguredReference;
-import org.apache.tuscany.model.assembly.EntryPoint;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * The default implementation of a <code>WireFactoryFactory</code>
- *
- * @version $$Rev$$ $$Date$$
- */
-@Scope("MODULE")
-@Service(interfaces = {org.apache.tuscany.core.wire.service.WireFactoryService.class})
-public class DefaultWireFactoryService implements org.apache.tuscany.core.wire.service.WireFactoryService {
-
- private MessageFactory messageFactory;
- private WireFactoryFactory wireFactoryFactory;
- private PolicyBuilderRegistry policyRegistry;
-
-
- public DefaultWireFactoryService() {
-
- }
-
- public DefaultWireFactoryService(MessageFactory messageFactory, WireFactoryFactory wireFactoryFactory, PolicyBuilderRegistry registry) {
- this.messageFactory = messageFactory;
- this.wireFactoryFactory = wireFactoryFactory;
- this.policyRegistry = registry;
- }
-
- @Autowire
- public void setMessageFactory(MessageFactory messageFactory) {
- this.messageFactory = messageFactory;
- }
-
- @Autowire
- public void setWireFactoryService(WireFactoryFactory wireFactoryFactory) {
- this.wireFactoryFactory = wireFactoryFactory;
- }
-
- @Autowire
- public void setPolicyRegistry(PolicyBuilderRegistry policyRegistry) {
- this.policyRegistry = policyRegistry;
- }
-
- @Init(eager = true)
- public void init() {
- }
-
- public List<SourceWireFactory> createSourceFactory(ConfiguredReference configuredReference) throws BuilderConfigException{
- String referenceName = configuredReference.getPort().getName();
- Class interfaze;
- // FIXME hack for NPE when entry points with no set service contract on their configuredReference
- if (configuredReference.getPort().getServiceContract() != null){
- interfaze = configuredReference.getPort().getServiceContract().getInterface();
- }else if(configuredReference.getPart() instanceof EntryPoint){
- interfaze = ((EntryPoint)configuredReference.getPart()).getConfiguredService().getPort().getServiceContract().getInterface();
- }else{
- BuilderConfigException bce = new BuilderConfigException("No interface found on configured reference");
- bce.setIdentifier(configuredReference.getName());
- throw bce;
- }
- List<SourceWireFactory> wireFactories = new ArrayList<SourceWireFactory>();
- List<WireSourceConfiguration> wireConfigurations = new ArrayList<WireSourceConfiguration>();
- for (ConfiguredService configuredService : configuredReference.getTargetConfiguredServices()) {
- String targetCompName = configuredService.getPart().getName();
- String targetSerivceName = configuredService.getPort().getName();
- QualifiedName targetName = new QualifiedName(targetCompName + QualifiedName.NAME_SEPARATOR + targetSerivceName);
- SourceWireFactory wireFactory = wireFactoryFactory.createSourceWireFactory();
- Map<Method, SourceInvocationConfiguration> iConfigMap = new HashMap<Method, SourceInvocationConfiguration>();
- Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze);
- for (Method method : javaMethods) {
- SourceInvocationConfiguration iConfig = new SourceInvocationConfiguration(method);
- iConfigMap.put(method, iConfig);
- }
- WireSourceConfiguration wireConfiguration = new WireSourceConfiguration(referenceName, targetName, iConfigMap, interfaze.getClassLoader(),
- messageFactory);
- wireConfigurations.add(wireConfiguration);
- wireFactory.setBusinessInterface(interfaze);
- wireFactory.setConfiguration(wireConfiguration);
- wireFactories.add(wireFactory);
- }
- if (policyRegistry != null) {
- // invoke policy builders
- policyRegistry.buildSource(configuredReference, wireConfigurations);
- }
- return wireFactories;
-
- }
-
- public TargetWireFactory createTargetFactory(ConfiguredService configuredService) {
- org.apache.tuscany.model.assembly.Service service = configuredService.getPort();
- Class interfaze = service.getServiceContract().getInterface();
- QualifiedName targetName = new QualifiedName(configuredService.getPart().getName() + QualifiedName.NAME_SEPARATOR
- + service.getName());
-
- Map<Method, TargetInvocationConfiguration> iConfigMap = new MethodHashMap<TargetInvocationConfiguration>();
- TargetWireFactory wireFactory = wireFactoryFactory.createTargetWireFactory();
- Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze);
- for (Method method : javaMethods) {
- TargetInvocationConfiguration iConfig = new TargetInvocationConfiguration(method);
- iConfigMap.put(method, iConfig);
- }
- WireTargetConfiguration wireConfiguration = new WireTargetConfiguration(targetName, iConfigMap, interfaze.getClassLoader(), messageFactory);
- wireFactory.setBusinessInterface(interfaze);
- wireFactory.setConfiguration(wireConfiguration);
- if (policyRegistry != null) {
- // invoke policy builders
- policyRegistry.buildTarget(configuredService, wireConfiguration);
- }
- // add tail interceptor
- for (TargetInvocationConfiguration iConfig : wireFactory.getConfiguration().getInvocationConfigurations().values()) {
- iConfig.addInterceptor(new InvokerInterceptor());
- }
- return wireFactory;
- }
-
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java
deleted file mode 100644
index eb41baf69a..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java
+++ /dev/null
@@ -1,51 +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.wire.service;
-
-import org.apache.tuscany.core.builder.BuilderConfigException;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.model.assembly.ConfiguredReference;
-import org.apache.tuscany.model.assembly.ConfiguredService;
-
-import java.util.List;
-
-/**
- * Implementations provide a system service that creates {@link org.apache.tuscany.core.wire.SourceWireFactory}s
- * and {@link org.apache.tuscany.core.wire.TargetWireFactory}s. This service is used by {@link
- * org.apache.tuscany.core.builder.ContextFactoryBuilder}s to provide {@link org.apache.tuscany.core.builder.ContextFactory}s with
- * {@link org.apache.tuscany.core.wire.WireFactory}s for their references and target services. This service is typically autowired
- * to.
- *
- * @version $$Rev$$ $$Date$$
- */
-public interface WireFactoryService {
-
- /**
- * Creates the source-side wire factory for a reference
- *
- * @param configuredReference the configured reference to create the wire factory for
- * @throws BuilderConfigException
- */
- public List<SourceWireFactory> createSourceFactory(ConfiguredReference configuredReference) throws BuilderConfigException;
-
- /**
- * Creates a target-side wire factory for a service implementing a given interface
- *
- * @param configuredService the configured service to create the wire factory for
- * @throws BuilderConfigException
- */
- public TargetWireFactory createTargetFactory(ConfiguredService configuredService) throws BuilderConfigException;
-
-}