org.jboss.remoting.transport.mock
Class MockClientInvoker

java.lang.Object
  extended byorg.jboss.remoting.AbstractInvoker
      extended byorg.jboss.remoting.RemoteClientInvoker
          extended byorg.jboss.remoting.transport.mock.MockClientInvoker
All Implemented Interfaces:
ClientInvoker, Invoker

public class MockClientInvoker
extends RemoteClientInvoker

MockClientInvoker

Version:
$Revision: 1.4 $
Author:
Jeff Haynie

Field Summary
 
Fields inherited from class org.jboss.remoting.RemoteClientInvoker
connected
 
Fields inherited from class org.jboss.remoting.AbstractInvoker
classbyteloader, localServerLocator, locator, log, logExtra
 
Constructor Summary
MockClientInvoker(InvokerLocator locator, MockServerInvoker server)
           
 
Method Summary
 void connect()
          connect to the remote invoker
 void disconnect()
          disconnect from the remote invokere
 byte[] getClassBytes(String className)
          method is called to retrieve a byte array of a Class for a given class name
protected  void handleConnect()
          subclasses must implement this method to provide a hook to connect to the remote server, if this applies to the specific transport.
protected  void handleDisconnect()
          subclasses must implement this method to provide a hook to disconnect from the remote server, if this applies to the specific transport.
 boolean isConnected()
          subclasses must provide this method to return true if their remote connection is connected and false if disconnected.
protected  byte[] transport(String sesionId, byte[] buffer)
          called to transport the marshalled invocation to the remote destination, and receive back the marshalled invocation bytes back.
 
Methods inherited from class org.jboss.remoting.RemoteClientInvoker
finalize, invoke, postProcess, preProcess
 
Methods inherited from class org.jboss.remoting.AbstractInvoker
addClass, getClientLocator, getLocator, loadClass, read, setClassLoader, setClientLocator, unmarshal
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.remoting.transport.ClientInvoker
getClientLocator, setClientLocator
 
Methods inherited from interface org.jboss.remoting.Invoker
getLocator
 

Constructor Detail

MockClientInvoker

public MockClientInvoker(InvokerLocator locator,
                         MockServerInvoker server)
Method Detail

handleConnect

protected void handleConnect()
                      throws ConnectionFailedException
subclasses must implement this method to provide a hook to connect to the remote server, if this applies to the specific transport. However, in some transport implementations, this may not make must difference since the connection is not persistent among invocations, such as SOAP. In these cases, the method should silently return without any processing.

Specified by:
handleConnect in class RemoteClientInvoker
Throws:
ConnectionFailedException

handleDisconnect

protected void handleDisconnect()
subclasses must implement this method to provide a hook to disconnect from the remote server, if this applies to the specific transport. However, in some transport implementations, this may not make must difference since the connection is not persistent among invocations, such as SOAP. In these cases, the method should silently return without any processing.

Specified by:
handleDisconnect in class RemoteClientInvoker

getClassBytes

public byte[] getClassBytes(String className)
Description copied from class: AbstractInvoker
method is called to retrieve a byte array of a Class for a given class name

Overrides:
getClassBytes in class AbstractInvoker
Parameters:
className -
Returns:

connect

public void connect()
             throws ConnectionFailedException
Description copied from class: RemoteClientInvoker
connect to the remote invoker

Specified by:
connect in interface ClientInvoker
Overrides:
connect in class RemoteClientInvoker
Throws:
ConnectionFailedException

disconnect

public void disconnect()
Description copied from class: RemoteClientInvoker
disconnect from the remote invokere

Specified by:
disconnect in interface ClientInvoker
Overrides:
disconnect in class RemoteClientInvoker

isConnected

public boolean isConnected()
Description copied from class: RemoteClientInvoker
subclasses must provide this method to return true if their remote connection is connected and false if disconnected. in some transports, such as SOAP, this method may always return true, since the remote connectivity is done on demand and not kept persistent like other transports (such as socket-based transport).

Specified by:
isConnected in interface ClientInvoker
Overrides:
isConnected in class RemoteClientInvoker
Returns:
boolean true if connected, false if not

transport

protected byte[] transport(String sesionId,
                           byte[] buffer)
                    throws IOException
Description copied from class: RemoteClientInvoker
called to transport the marshalled invocation to the remote destination, and receive back the marshalled invocation bytes back. this method allows the subclass to provide the specific mechanism, protocol, etc. for delivering and returning remote invocations in a transport-specific way.

Specified by:
transport in class RemoteClientInvoker
Parameters:
sesionId - session id to pass along
buffer - buffer of the serialized method invocation to send to the server
Returns:
result of the method invocation as serialized bytes
Throws:
IOException - fatal exception should only be raised in the case the transport write fails (but is still a valid connection)


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.