de.root1.simon
Class SimonProxy

java.lang.Object
  extended by de.root1.simon.SimonProxy
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class SimonProxy
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

The InvocationHandler which redirects each method call over the network to the related dispatcher

Author:
achristian

Constructor Summary
protected SimonProxy(Dispatcher dispatcher, org.apache.mina.core.session.IoSession session, java.lang.String remoteObjectName, java.lang.Class<?>[] remoteInterfaces)
          Constructor which sets the reference to the dispatcher and the remote object name
 
Method Summary
protected  java.lang.String getDetailString()
           
protected  Dispatcher getDispatcher()
          Returns the Dispatcher instance related to this proxy.
protected  org.apache.mina.core.session.IoSession getIoSession()
          Returns the IoSession related to this proxy
protected  java.net.SocketAddress getLocalSocketAddress()
          Returns the SocketAddress of the local host connected with this proxy
protected  java.lang.String getRemoteObjectName()
          Returns the proxy's remote object name in the related lookup table
protected  java.net.SocketAddress getRemoteSocketAddress()
          Returns the SocketAddress of the remote host connected with this proxy
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  Dispatcher release()
          Releases this proxy.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimonProxy

protected SimonProxy(Dispatcher dispatcher,
                     org.apache.mina.core.session.IoSession session,
                     java.lang.String remoteObjectName,
                     java.lang.Class<?>[] remoteInterfaces)
Constructor which sets the reference to the dispatcher and the remote object name

Parameters:
dispatcher - a reference to the underlying dispatcher
session - a reference to the IoSession of the corresponding network connection
remoteObjectName - name of the remote object
remoteInterfaces - the interfaces that the remote object has exported
Method Detail

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

getRemoteSocketAddress

protected java.net.SocketAddress getRemoteSocketAddress()
Returns the SocketAddress of the remote host connected with this proxy

Returns:
the SocketAddress of the remote host

getLocalSocketAddress

protected java.net.SocketAddress getLocalSocketAddress()
Returns the SocketAddress of the local host connected with this proxy

Returns:
the SocketAddress of the local host

release

protected Dispatcher release()
Releases this proxy. This cancels also the session on the Dispatcher.

Returns:
the Dispatcher related to this proxy.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDetailString

protected java.lang.String getDetailString()

getRemoteObjectName

protected java.lang.String getRemoteObjectName()
Returns the proxy's remote object name in the related lookup table

Returns:
the remote object name

getIoSession

protected org.apache.mina.core.session.IoSession getIoSession()
Returns the IoSession related to this proxy

Returns:
an instance of IoSession

getDispatcher

protected Dispatcher getDispatcher()
Returns the Dispatcher instance related to this proxy. May return null in case of an already shutdown session

Returns:
an instance of Dispatcher


Copyright © 2011. All Rights Reserved.