diff options
Diffstat (limited to 'sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian')
21 files changed, 1278 insertions, 0 deletions
diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java new file mode 100644 index 0000000000..45b108e4b4 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Channel.java @@ -0,0 +1,42 @@ +/* + * 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.hessian; + +import org.apache.tuscany.spi.wire.Message; + +/** + * Channels dispatch service invocations over a transport + * + * @version $Rev$ $Date$ + */ +public interface Channel { + + /** + * Dispatches the service invocation + * + * @param operation the service operation to invoke + * @param returnType the expected return type or null + * @param message the message containing the invocation payload + * @return the response message + * @throws InvocationException if an error occurs during the invocation + */ + Message send(String operation, Class<?> returnType, Message message) throws InvocationException; + + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java new file mode 100644 index 0000000000..a7622f86e8 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/Destination.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.hessian; + +import com.caucho.hessian.io.AbstractHessianInput; +import com.caucho.hessian.io.AbstractHessianOutput; + +/** + * Responsible for receiving invocations for a service endpoint from a transport + * + * @version $Rev$ $Date$ + */ +public interface Destination { + + /** + * Dispatches to the service endpoint + * + * @param in the input stream containing the invocation payload + * @param out the output stream to write the response to + * @throws InvocationException if an error occurs invoking the service + */ + void invoke(AbstractHessianInput in, AbstractHessianOutput out) throws InvocationException; +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java new file mode 100644 index 0000000000..316920d6dd --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/DestinationCreationException.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.hessian; + +import org.apache.tuscany.spi.builder.WiringException; + +/** + * Thrown when an error creating a destination is encountered + * + * @version $Rev$ $Date$ + */ +public abstract class DestinationCreationException extends WiringException { + + public DestinationCreationException(String message) { + super(message); + } + + protected DestinationCreationException(String message, String identifier, Throwable cause) { + super(message, identifier, cause); + } + + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java new file mode 100644 index 0000000000..fbde279be0 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/HessianException.java @@ -0,0 +1,51 @@ +/* +* 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.hessian; + +import org.apache.tuscany.api.TuscanyException; + +/** + * Base checked exception for the Hessian binding extension + * + * @version $Rev$ $Date$ + */ +public abstract class HessianException extends TuscanyException { + protected HessianException() { + } + + protected HessianException(String message) { + super(message); + } + + protected HessianException(String message, String identifier) { + super(message, identifier); + } + + protected HessianException(String message, Throwable cause) { + super(message, cause); + } + + protected HessianException(String message, String identifier, Throwable cause) { + super(message, identifier, cause); + } + + protected HessianException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java new file mode 100644 index 0000000000..aa116293c1 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvalidDestinationException.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.hessian; + +import org.apache.tuscany.spi.builder.WiringException; + +/** + * @version $Rev$ $Date$ + */ +@SuppressWarnings("serial") +public class InvalidDestinationException extends WiringException { + public InvalidDestinationException(String message, Throwable cause) { + super(message, null, null, cause); + } + + public InvalidDestinationException(String message, String identifier) { + super(message, identifier, null, null); + } + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java new file mode 100644 index 0000000000..7456d1baa8 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvocationException.java @@ -0,0 +1,46 @@ +/* + * 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.hessian; + +import org.apache.tuscany.api.TuscanyException; + +/** + * Raised when an error performing a service invocation is encountered + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings("serial") +public class InvocationException extends TuscanyException { + + public InvocationException(String message, String identifier) { + super(message, identifier); + } + + public InvocationException(String message, String identifier, Throwable cause) { + super(message, identifier, cause); + } + + public InvocationException(String message, Throwable cause) { + super(message, cause); + } + + public InvocationException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java new file mode 100644 index 0000000000..53eb5f46b3 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/InvokerInterceptor.java @@ -0,0 +1,67 @@ +/* + * 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.hessian; + +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; + +/** + * Dispatches a service invocation to a Channel + * + * @version $Rev$ $Date$ + */ +public class InvokerInterceptor implements Interceptor { + private String operation; + private Channel channel; + + /** + * Creates the interceptor. + * + * @param operation the service operation the interceptor dispatches for + * @param channel the channel to dispatch to + */ + public InvokerInterceptor(String operation, Channel channel) { + this.operation = operation; + this.channel = channel; + } + + public boolean isOptimizable() { + return false; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + return channel.send(operation, null, msg); + } catch (InvocationException e) { + msg.setBodyWithFault(e); + return msg; + } + } + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last one in an target interceptor chain"); + } + + public Interceptor getNext() { + return null; + } + + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java new file mode 100644 index 0000000000..195642019e --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/ServletHostNotFoundException.java @@ -0,0 +1,28 @@ +package org.apache.tuscany.hessian;/* + * 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. + */ + +/** + * @version $Rev$ $Date$ + */ +@SuppressWarnings("serial") +public class ServletHostNotFoundException extends DestinationCreationException { + public ServletHostNotFoundException(String message) { + super(message); + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java new file mode 100644 index 0000000000..a2d417ff58 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/TypeNotFoundException.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.hessian; + +/** + * Denotes a missing or not found type + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings("serial") +public class TypeNotFoundException extends DestinationCreationException { + + public TypeNotFoundException(String message, String identifier, Throwable cause) { + super(message, identifier, cause); + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java new file mode 100644 index 0000000000..e6077e8003 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/HttpChannel.java @@ -0,0 +1,220 @@ +/* + * 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.hessian.channel; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; + +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; + +import com.caucho.hessian.client.HessianRuntimeException; +import com.caucho.hessian.io.HessianInput; +import com.caucho.hessian.io.HessianOutput; +import org.apache.tuscany.hessian.Channel; +import org.apache.tuscany.hessian.InvocationException; + +/** + * A channel implementation that uses HTTP as the transport protocol + * + * @version $Rev$ $Date$ + */ +public class HttpChannel implements Channel { + private URL destinationUrl; + private boolean chunkedPost; + private String basicAuth; + private String user; + private String password; + private int readTimeout; + + public HttpChannel(URL url) { + this.destinationUrl = url; + } + + public Message send(String operation, Class<?> returnType, Message message) throws InvocationException { + URLConnection conn; + try { + conn = openConnection(destinationUrl); + } catch (IOException e) { + throw new InvocationException(e); + } + if (chunkedPost && conn instanceof HttpURLConnection) { + HttpURLConnection httpConn = (HttpURLConnection) conn; + httpConn.setChunkedStreamingMode(8 * 1024); + } + + OutputStream os; + try { + os = conn.getOutputStream(); + } catch (IOException e) { + throw new HessianRuntimeException(e); + } + + try { + HessianOutput out = new HessianOutput(os); + Object[] args; + Object payload = message.getBody(); + if (payload != null && !payload.getClass().isArray()) { + args = new Object[]{payload}; + } else { + args = (Object[]) payload; + } + out.call(operation, args); + out.flush(); + + InputStream is = null; + if (conn instanceof HttpURLConnection) { + HttpURLConnection httpConn = (HttpURLConnection) conn; + int code = httpConn.getResponseCode(); + if (code != 200) { + StringBuffer sb = new StringBuffer(); + int ch; + + try { + is = httpConn.getInputStream(); + + if (is != null) { + while ((ch = is.read()) >= 0) { + sb.append((char) ch); + } + + is.close(); + } + + is = httpConn.getErrorStream(); + if (is != null) { + while ((ch = is.read()) >= 0) { + sb.append((char) ch); + } + } + } catch (FileNotFoundException e) { + throw new InvocationException(e); + } catch (IOException e) { + if (is == null) { + throw new InvocationException("Invocation exception", String.valueOf(code), e); + } + } + + if (is != null) { + is.close(); + } + throw new InvocationException("Invocation exception", sb.toString()); + } + } + is = conn.getInputStream(); + + HessianInput in = new HessianInput(is); + // FIXME handle faults + Object reply = in.readReply(returnType); + Message msg = new MessageImpl(); + msg.setBody(reply); + return msg; + } catch (RuntimeException e) { + if (conn instanceof HttpURLConnection) { + ((HttpURLConnection) conn).disconnect(); + } + throw e; + } catch (Throwable e) { + if (conn instanceof HttpURLConnection) { + ((HttpURLConnection) conn).disconnect(); + } + + throw new InvocationException(e); + } + } + + protected URLConnection openConnection(URL url) throws IOException { + URLConnection conn = url.openConnection(); + + conn.setDoOutput(true); + + if (readTimeout > 0) { + conn.setReadTimeout(readTimeout); + } + + conn.setRequestProperty("Content-Type", "x-application/hessian"); + + if (basicAuth != null) + conn.setRequestProperty("Authorization", basicAuth); + else if (user != null && password != null) { + basicAuth = "Basic " + base64(user + ":" + password); + conn.setRequestProperty("Authorization", basicAuth); + } + + return conn; + } + + private String base64(String value) { + StringBuffer cb = new StringBuffer(); + + int i = 0; + for (i = 0; i + 2 < value.length(); i += 3) { + long chunk = (int) value.charAt(i); + chunk = (chunk << 8) + (int) value.charAt(i + 1); + chunk = (chunk << 8) + (int) value.charAt(i + 2); + + cb.append(encode(chunk >> 18)); + cb.append(encode(chunk >> 12)); + cb.append(encode(chunk >> 6)); + cb.append(encode(chunk)); + } + + if (i + 1 < value.length()) { + long chunk = (int) value.charAt(i); + chunk = (chunk << 8) + (int) value.charAt(i + 1); + chunk <<= 8; + + cb.append(encode(chunk >> 18)); + cb.append(encode(chunk >> 12)); + cb.append(encode(chunk >> 6)); + cb.append('='); + } else if (i < value.length()) { + long chunk = (int) value.charAt(i); + chunk <<= 16; + + cb.append(encode(chunk >> 18)); + cb.append(encode(chunk >> 12)); + cb.append('='); + cb.append('='); + } + + return cb.toString(); + } + + public static char encode(long d) { + d &= 0x3f; + if (d < 26) + return (char) (d + 'A'); + else if (d < 52) + return (char) (d + 'a' - 26); + else if (d < 62) + return (char) (d + '0' - 52); + else if (d == 62) + return '+'; + else + return '/'; + } + + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java new file mode 100644 index 0000000000..783750940a --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/channel/LocalChannel.java @@ -0,0 +1,78 @@ +/* + * 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.hessian.channel; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; + +import com.caucho.hessian.io.HessianInput; +import com.caucho.hessian.io.HessianOutput; +import org.apache.tuscany.hessian.Channel; +import org.apache.tuscany.hessian.InvocationException; +import org.apache.tuscany.hessian.destination.LocalDestination; + +/** + * A channel implementation that uses an in-VM transport + * + * @version $Rev$ $Date$ + */ +public class LocalChannel implements Channel { + private LocalDestination destination; + + public LocalChannel(LocalDestination destination) { + this.destination = destination; + } + + public Message send(String operation, Class<?> returnType, Message message) throws InvocationException { + Object payload = message.getBody(); + Object[] args; + if (payload != null && !payload.getClass().isArray()) { + args = new Object[]{payload}; + } else { + args = (Object[]) payload; + } + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + HessianOutput output = new HessianOutput(baos); + output.call(operation, args); + output.close(); + ByteArrayInputStream bas = new ByteArrayInputStream(baos.toByteArray()); + HessianInput input = new HessianInput(bas); + + ByteArrayOutputStream returnOutputStream = new ByteArrayOutputStream(); + HessianOutput returnOutput = new HessianOutput(returnOutputStream); + destination.invoke(input, returnOutput); + ByteArrayInputStream returnStream = new ByteArrayInputStream(returnOutputStream.toByteArray()); + HessianInput in = new HessianInput(returnStream); + // FIXME handle faults + Object reply = in.readReply(returnType); + Message msg = new MessageImpl(); + msg.setBody(reply); + return msg; + } catch (Throwable e) { + throw new InvocationException(e); + } + + + } + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java new file mode 100644 index 0000000000..8ae69bfb46 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/HessianBindingComponent.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.hessian.component; + +import java.net.MalformedURLException; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.hessian.Channel; +import org.apache.tuscany.hessian.DestinationCreationException; +import org.apache.tuscany.hessian.InvalidDestinationException; +import org.apache.tuscany.hessian.InvokerInterceptor; +import org.apache.tuscany.hessian.ServletHostNotFoundException; +import org.apache.tuscany.hessian.channel.HttpChannel; +import org.apache.tuscany.hessian.channel.LocalChannel; +import org.apache.tuscany.hessian.destination.HttpDestination; +import org.apache.tuscany.hessian.destination.LocalDestination; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; +import org.apache.tuscany.spi.wire.InvocationChain; +import org.apache.tuscany.spi.wire.Wire; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +/** + * Binding component for hessian transport. + */ +public class HessianBindingComponent { + + public static String LOCAL_SCHEME = "hessianLocal"; + public static String HTTP_SCHEME = "http"; + private URI uri; + private ServletHost servletHost; + private Map<URI, LocalDestination> destinations; + + public HessianBindingComponent(@Property(name = "uri") + URI uri, @Reference(name = "servletHost") + ServletHost host) { + this.uri = uri; + this.servletHost = host; + destinations = new HashMap<URI, LocalDestination>(); + } + + public void createEndpoint(URI endpointUri, Wire wire, ClassLoader loader) throws DestinationCreationException { + if (LOCAL_SCHEME.equals(endpointUri.getScheme())) { + LocalDestination destination = new LocalDestination(wire, loader); + destinations.put(uri, destination); + } else if (HTTP_SCHEME.equals(endpointUri.getScheme())) { + if (servletHost == null) { + throw new ServletHostNotFoundException("ServletHost is was not found"); + } + HttpDestination destination = new HttpDestination(wire, loader); + // FIXME mapping + servletHost.registerMapping(endpointUri.getPath(), destination); + } else { + throw new UnsupportedOperationException("Unsupported scheme"); + } + } + + public void bindToEndpoint(URI endpointUri, Wire wire) throws InvalidDestinationException { + Channel channel = createChannel(endpointUri); + for (Map.Entry<PhysicalOperationDefinition, InvocationChain> entry : wire.getPhysicalInvocationChains() + .entrySet()) { + String name = entry.getKey().getName(); + InvokerInterceptor interceptor = new InvokerInterceptor(name, channel); + entry.getValue().addInterceptor(interceptor); + } + } + + /** + * Creates a Channel to the service at the given URI + * + * @param uri the service uri + * @return the channel + * @throws InvalidDestinationException if an error is encountered creating + * the channel + */ + private Channel createChannel(URI uri) throws InvalidDestinationException { + if (LOCAL_SCHEME.equals(uri.getScheme())) { + LocalDestination destination = destinations.get(uri); + if (destination != null) { + throw new InvalidDestinationException("Destination not found", uri.toString()); + } + return new LocalChannel(destination); + } else if (HTTP_SCHEME.equals(uri.getScheme())) { + try { + return new HttpChannel(uri.toURL()); + } catch (MalformedURLException e) { + throw new InvalidDestinationException("URI must be a valid URL ", e); + } + } + throw new UnsupportedOperationException("Unsupported scheme"); + } + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java new file mode 100644 index 0000000000..5efbefeade --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/component/WireBindException.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.hessian.component; + +import org.apache.tuscany.hessian.HessianException; + +/** + * @version $Rev$ $Date$ + */ +@SuppressWarnings("serial") +public class WireBindException extends HessianException { + + public WireBindException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java new file mode 100644 index 0000000000..baae50677a --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/AbstractDestination.java @@ -0,0 +1,115 @@ +/* + * 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.hessian.destination; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition; +import org.apache.tuscany.spi.wire.InvocationChain; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; +import org.apache.tuscany.spi.wire.Wire; + +import com.caucho.hessian.io.AbstractHessianInput; +import com.caucho.hessian.io.AbstractHessianOutput; +import org.apache.tuscany.hessian.Destination; +import org.apache.tuscany.hessian.InvocationException; +import org.apache.tuscany.hessian.TypeNotFoundException; + +/** + * Base implementation of a Destination + * + * @version $Rev$ $Date$ + */ +public class AbstractDestination implements Destination { + protected Map<String, ChainHolder> chains; + private ClassLoader loader; + + protected AbstractDestination(Wire wire, ClassLoader loader) throws TypeNotFoundException { + this.loader = loader; + chains = new HashMap<String, ChainHolder>(); + for (Map.Entry<PhysicalOperationDefinition, InvocationChain> entry : wire.getPhysicalInvocationChains() + .entrySet()) { + PhysicalOperationDefinition operation = entry.getKey(); + String operationName = operation.getName(); + InvocationChain chain = entry.getValue(); + List<String> params = operation.getParameters(); + Class<?>[] paramTypes = new Class<?>[params.size()]; + // load the param types in the target's classloader + for (int i = 0; i < params.size(); i++) { + String param = params.get(i); + try { + paramTypes[i] = loader.loadClass(param); + } catch (ClassNotFoundException e) { + throw new TypeNotFoundException("Operation parameter type not found", operationName, e); + } + } + AbstractDestination.ChainHolder holder = + new AbstractDestination.ChainHolder(paramTypes, chain); + chains.put(operationName, holder); + } + } + + public void invoke(AbstractHessianInput in, AbstractHessianOutput out) throws InvocationException { + ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); + try { + // ensure serialization is done on the target classloader + Thread.currentThread().setContextClassLoader(loader); + in.readCall(); + String m = in.readMethod(); + ChainHolder holder = chains.get(m); + if (holder == null) { + out.startReply(); + out.writeFault("OperationNotFound", "The service has no method named: " + m, null); + out.completeReply(); + return; + } + Class<?>[] paramType = holder.types; + Object[] values = new Object[paramType.length]; + for (int n = 0; n < paramType.length; n++) { + values[n] = in.readObject(paramType[n]); + } + in.completeCall(); + Message msg = new MessageImpl(); + InvocationChain chain = holder.chain; + Message ret = chain.getHeadInterceptor().invoke(msg); + out.startReply(); + Object o = ret.getBody(); + out.writeObject(o); + out.completeReply(); + } catch (IOException e) { + throw new InvocationException(e); + } finally { + Thread.currentThread().setContextClassLoader(oldLoader); + } + } + + protected class ChainHolder { + Class<?>[] types; + InvocationChain chain; + + public ChainHolder(Class<?>[] types, InvocationChain chain) { + this.types = types; + this.chain = chain; + } + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java new file mode 100644 index 0000000000..cd6281e8bd --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/HttpDestination.java @@ -0,0 +1,71 @@ +/* + * 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.hessian.destination; + +import java.io.IOException; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.apache.tuscany.spi.wire.Wire; + +import com.caucho.hessian.io.HessianInput; +import com.caucho.hessian.io.HessianOutput; +import org.apache.tuscany.hessian.InvocationException; +import org.apache.tuscany.hessian.TypeNotFoundException; + +/** + * A Destination implementation which receives requests over HTTP using a servlet engine + * + * @version $Rev$ $Date$ + */ +public class HttpDestination extends AbstractDestination implements Servlet { + + public HttpDestination(Wire wire, ClassLoader loader) + throws TypeNotFoundException { + super(wire, loader); + } + + public void service(ServletRequest req, ServletResponse resp) + throws ServletException, IOException { + try { + invoke(new HessianInput(req.getInputStream()), new HessianOutput(resp.getOutputStream())); + } catch (InvocationException e) { + throw new ServletException(e); + } + } + + public void init(ServletConfig servletConfig) throws ServletException { + + } + + public ServletConfig getServletConfig() { + return null; + } + + public String getServletInfo() { + return null; + } + + public void destroy() { + + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java new file mode 100644 index 0000000000..55946f96e7 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/destination/LocalDestination.java @@ -0,0 +1,35 @@ +/* + * 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.hessian.destination; + +import org.apache.tuscany.spi.wire.Wire; + +import org.apache.tuscany.hessian.TypeNotFoundException; + +/** + * A Destination implementation which receives requests over an in-VM transport + * + * @version $Rev$ $Date$ + */ +public class LocalDestination extends AbstractDestination { + + public LocalDestination(Wire wire, ClassLoader loader) throws TypeNotFoundException { + super(wire, loader); + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java new file mode 100644 index 0000000000..181733973d --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/loader/HessianBindingLoader.java @@ -0,0 +1,73 @@ +/* + * 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.hessian.loader; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.hessian.model.logical.HessianBindingDefinition; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.model.ModelObject; +import org.osoa.sca.annotations.Reference; + +/** + * Loader for hessian binding. + * + * @version $Revision$ $Date$ + */ +public class HessianBindingLoader extends LoaderExtension<HessianBindingDefinition> { + + /** + * Qualified name of the binding. + */ + public static final QName BINDING_HESSIAN = + new QName("http://tuscany.apache.org/xmlns/binding/hessian/2.0-alpha2-incubating-SNAPSHOT", "binding.hessian"); + + /** + * Injects the loader registry. + * + * @param loaderRegistry Loader registry. + */ + protected HessianBindingLoader(@Reference(name = "loaderRegistry") + LoaderRegistry loaderRegistry) { + super(loaderRegistry); + } + + /** + * Gets the qualified name of the binding element. + */ + @Override + public QName getXMLType() { + return BINDING_HESSIAN; + } + + /** + * Loads the binding from the XML. + */ + public HessianBindingDefinition load(ModelObject arg0, XMLStreamReader arg1, DeploymentContext arg2) + throws XMLStreamException, LoaderException { + // TODO populate the model object + return new HessianBindingDefinition(); + } + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java new file mode 100644 index 0000000000..74c305254c --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/logical/HessianBindingDefinition.java @@ -0,0 +1,28 @@ +/* + * 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.hessian.model.logical; + +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * @version $Revision$ $Date$ + */ +public class HessianBindingDefinition extends BindingDefinition { + +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java new file mode 100644 index 0000000000..e24432d513 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireSourceDefinition.java @@ -0,0 +1,38 @@ +/* + * 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.hessian.model.physical; + +import java.net.URI; + +import org.apache.tuscany.spi.model.physical.PhysicalWireSourceDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class HessianWireSourceDefinition extends PhysicalWireSourceDefinition { + private URI endpointUri; + + public URI getEndpointUri() { + return endpointUri; + } + + public void setEndpointUri(URI endpointUri) { + this.endpointUri = endpointUri; + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java new file mode 100644 index 0000000000..52dd8728f1 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/model/physical/HessianWireTargetDefinition.java @@ -0,0 +1,38 @@ +/* + * 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.hessian.model.physical; + +import java.net.URI; + +import org.apache.tuscany.spi.model.physical.PhysicalWireTargetDefinition; + +/** + * @version $Rev$ $Date$ + */ +public class HessianWireTargetDefinition extends PhysicalWireTargetDefinition { + private URI endpointUri; + + public URI getEndpointUri() { + return endpointUri; + } + + public void setEndpointUri(URI endpointUri) { + this.endpointUri = endpointUri; + } +} diff --git a/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java new file mode 100644 index 0000000000..0ca3132d11 --- /dev/null +++ b/sandbox/old/contrib/binding-hessian/binding/src/main/java/org/apache/tuscany/hessian/wire/HessianWireAttacher.java @@ -0,0 +1,58 @@ +/* + * 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.hessian.wire; + +import java.net.URI; + +import org.apache.tuscany.hessian.DestinationCreationException; +import org.apache.tuscany.hessian.InvalidDestinationException; +import org.apache.tuscany.hessian.component.HessianBindingComponent; +import org.apache.tuscany.hessian.model.physical.HessianWireSourceDefinition; +import org.apache.tuscany.hessian.model.physical.HessianWireTargetDefinition; +import org.apache.tuscany.spi.builder.physical.WireAttacher; +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.wire.Wire; +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class HessianWireAttacher<C extends Component> implements + WireAttacher<C, HessianWireSourceDefinition, HessianWireTargetDefinition> { + + private HessianBindingComponent bindingComponent; + + public HessianWireAttacher(@Reference(name="bindingComponent") HessianBindingComponent bindingComponent) { + this.bindingComponent = bindingComponent; + } + + public void attach(C source, Component target, Wire wire, HessianWireSourceDefinition definition) + throws DestinationCreationException { + URI endpointUri = definition.getEndpointUri(); + // FIXME classloader + bindingComponent.createEndpoint(endpointUri, wire, null); + + } + + public void attach(C component, Wire wire, HessianWireTargetDefinition definition) + throws InvalidDestinationException { + URI endpointUri = definition.getEndpointUri(); + bindingComponent.bindToEndpoint(endpointUri, wire); + } +} |