KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > transport > mock > MockClientInvoker


1 /***************************************
2  * *
3  * JBoss: The OpenSource J2EE WebOS *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  ***************************************/

9 package org.jboss.remoting.transport.mock;
10
11 import org.jboss.remoting.ConnectionFailedException;
12 import org.jboss.remoting.InvokerLocator;
13 import org.jboss.remoting.RemoteClientInvoker;
14 import org.jboss.remoting.marshal.Marshaller;
15 import org.jboss.remoting.marshal.UnMarshaller;
16
17 import java.io.IOException JavaDoc;
18 import java.util.Map JavaDoc;
19
20 /**
21  * MockClientInvoker
22  *
23  * @author <a HREF="mailto:jhaynie@vocalocity.net">Jeff Haynie</a>
24  * @version $Revision: 1.1.2.2 $
25  */

26 public class MockClientInvoker extends RemoteClientInvoker
27 {
28    private final MockServerInvoker server;
29    private boolean loaded = false;
30
31    public MockClientInvoker(InvokerLocator locator, MockServerInvoker server)
32    {
33       super(locator);
34       this.server = server;
35    }
36
37    /**
38     * subclasses must implement this method to provide a hook to connect to the remote server, if this applies
39     * to the specific transport. However, in some transport implementations, this may not make must difference since
40     * the connection is not persistent among invocations, such as SOAP. In these cases, the method should
41     * silently return without any processing.
42     *
43     * @throws ConnectionFailedException
44     */

45    protected void handleConnect()
46          throws ConnectionFailedException
47    {
48    }
49
50    /**
51     * subclasses must implement this method to provide a hook to disconnect from the remote server, if this applies
52     * to the specific transport. However, in some transport implementations, this may not make must difference since
53     * the connection is not persistent among invocations, such as SOAP. In these cases, the method should
54     * silently return without any processing.
55     */

56    protected void handleDisconnect()
57    {
58    }
59
60
61    public void connect()
62          throws ConnectionFailedException
63    {
64    }
65
66    public void disconnect()
67    {
68    }
69
70    protected String JavaDoc getDefaultDataType()
71    {
72       return null;
73    }
74
75    public boolean isConnected()
76    {
77       return false;
78    }
79
80    protected Object JavaDoc transport(String JavaDoc sessionId, Object JavaDoc invocation, Map JavaDoc metadata, Marshaller marshaller, UnMarshaller unmarshaller)
81          throws IOException JavaDoc, ConnectionFailedException
82    {
83       return server.invoke(invocation);
84    }
85 }
86
Popular Tags