|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.root1.simon.Simon
public class Simon
This is SIMONs core class which contains all the core functionality like setting up a SIMON server or lookup a remote object from the client side
Field Summary | |
---|---|
protected static java.lang.String |
SIMON_STD_PROTOCOL_CODEC_FACTORY
Identifies the class, that is used as SIMON's standard protocol codec factory |
Constructor Summary | |
---|---|
Simon()
|
Method Summary | |
---|---|
static Lookup |
createInterfaceLookup(java.net.InetAddress address,
int port)
Creates a interface lookup object that is used to lookup remote objects. |
static Lookup |
createInterfaceLookup(java.lang.String host,
int port)
Creates a interface lookup object that is used to lookup remote objects. |
static Lookup |
createNameLookup(java.net.InetAddress address,
int port)
Creates a name lookup object that is used to lookup remote objects. |
static Lookup |
createNameLookup(java.lang.String host,
int port)
Creates a name lookup object that is used to lookup remote objects. |
static Registry |
createRegistry(java.net.InetAddress address,
int port)
Creates a registry listening on a specific network interface, identified by the given InetAddress with the last known
worker thread pool size set by setWorkerThreadPoolSize(int) |
static Registry |
createRegistry(int port)
Creates a registry listening on all interfaces with the last known worker thread pool size set by setWorkerThreadPoolSize(int) |
static Registry |
createRegistry(SslContextFactory sslContextFactory,
java.net.InetAddress address,
int port)
Creates a registry listening on a specific network interface, identified by the given InetAddress with the last known
worker thread pool size set by setWorkerThreadPoolSize(int) . |
static int |
getDefaultKeepAliveTimeout()
Gets the default network write timeout time in seconds. |
static int |
getDgcInterval()
Deprecated. use getKeepAliveInterval() instead! |
static int |
getKeepAliveInterval()
Gets the default keep-alive interval time in seconds. |
static int |
getKeepAliveInterval(java.lang.Object remoteObject)
Gets the keep alive interval time in seconds of the given remote object. |
static int |
getKeepAliveTimeout(java.lang.Object remoteObject)
Gets the keep alive timeout time in seconds of the given remote object. |
static java.net.InetSocketAddress |
getLocalInetSocketAddress(java.lang.Object proxyObject)
Gets the InetSocketAddress used on the local-side of the given proxy object |
static int |
getLocalPort(java.lang.Object proxyObject)
Deprecated. use Simon.getLocalInetSocketAddress(proxyObject).getPort()
instead! |
static java.lang.String |
getProtocolCodecFactory()
Returns the current set class name for the protocol codec factory |
static java.net.InetAddress |
getRemoteInetAddress(java.lang.Object proxyObject)
Deprecated. use Simon.getRemoteInetSocketAddress(Object).getAddress()
instead! |
static java.net.InetSocketAddress |
getRemoteInetSocketAddress(java.lang.Object proxyObject)
Gets the InetSocketAddress used on the remote-side of the given proxy object |
static int |
getRemotePort(java.lang.Object proxyObject)
Deprecated. use Simon.getRemoteInetSocketAddress(proxyObject).getPort()
instead! |
protected static SimonProxy |
getSimonProxy(java.lang.Object o)
Retrieves SimonProxy invocation handler wrapped in a simple proxy |
static SimonRemoteStatistics |
getStatistics(java.lang.Object remoteObject)
Returns a object that lets you get some network related information on the session of the given remote object (an instance of SimonProxy |
protected static java.util.concurrent.ExecutorService |
getThreadPool()
Returns the reference to the worker thread pool |
static SimonRemote |
lookup(java.net.InetAddress host,
int port,
java.lang.String remoteObjectName)
Deprecated. Use Simon#createNameLookup() instead ... |
static SimonRemote |
lookup(SslContextFactory sslContextFactory,
SimonProxyConfig proxyConfig,
java.net.InetAddress host,
int port,
java.lang.String remoteObjectName)
Deprecated. Use Simon#createNameLookup() instead ... |
static SimonRemote |
lookup(SslContextFactory sslContextFactory,
SimonProxyConfig proxyConfig,
java.net.InetAddress host,
int port,
java.lang.String remoteObjectName,
ClosedListener listener)
Deprecated. Use Simon#createNameLookup() instead ... |
static SimonRemote |
lookup(java.lang.String host,
int port,
java.lang.String remoteObjectName)
Deprecated. Use Simon#createNameLookup() instead ... |
static java.lang.Object |
markAsRemote(java.lang.Object o)
Marks the object with SimonRemote to make it able to receive incoming calls. |
static RawChannel |
openRawChannel(int channelToken,
java.lang.Object simonRemote)
Opens a raw channel to transfer data from the current station to the remote station described by the given simonRemote |
static int |
prepareRawChannel(RawChannelDataListener listener,
java.lang.Object simonRemote)
Prepare simonRemote 's internal message dispatcher for
receiving raw data. |
protected static void |
publish(SimonPublication simonPublication)
Publishes a remote object. |
protected static void |
registerLookupTable(LookupTable lookupTable)
TODO document me |
static boolean |
release(java.lang.Object proxyObject)
Deprecated. Use Simon#createNameLookup() and AbstractLookup#release() instead ... |
static java.util.List<SimonPublication> |
searchRemoteObjects(int searchTime)
Starts a search on the local network for published remote objects. |
static PublicationSearcher |
searchRemoteObjects(SearchProgressListener listener,
int searchTime)
Creates a background thread that searches for published remote objects on the local network |
static void |
setDefaultKeepAliveInterval(int seconds)
Sets the keep alive default interval time in seconds. |
static void |
setDefaultKeepAliveTimeout(int seconds)
Sets the default keep alive timeout time in seconds. |
static void |
setDgcInterval(int milliseconds)
Deprecated. use setDefaultKeepAliveInterval(int) instead! |
static void |
setKeepAliveInterval(java.lang.Object remoteObject,
int seconds)
Sets the keep alive interval time in seconds for the specified remote object |
static void |
setKeepAliveTimeout(java.lang.Object remoteObject,
int seconds)
Sets the keep alive timeout time in seconds for the specified remote object. |
static void |
setProtocolCodecFactory(java.lang.String protocolFactoryClassName)
Sets class name for the protocol codec factory to use for all future createRegistry() or lookup() calls. |
static void |
setWorkerThreadPoolSize(int size)
Sets the size of the worker thread pool. |
static void |
shutdownRegistry(Registry registry)
Deprecated. You should call stop() on the registry to
shutdown the registry instead of using this method. |
protected static boolean |
unpublish(SimonPublication simonPublication)
Unpublishs a already published SimonPublication . |
protected static void |
unregisterLookupTable(LookupTable lookupTable)
TODO document me |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String SIMON_STD_PROTOCOL_CODEC_FACTORY
Constructor Detail |
---|
public Simon()
Method Detail |
---|
public static Registry createRegistry(int port) throws java.net.UnknownHostException, java.io.IOException
setWorkerThreadPoolSize(int)
port
- the port on which SIMON listens for connections
java.net.UnknownHostException
- if no IP address for the host could be found
java.io.IOException
- if there is a problem with the networking layerpublic static void shutdownRegistry(Registry registry) throws java.lang.IllegalStateException
stop()
on the registry to
shutdown the registry instead of using this method.
LookupTable
and stops
the Dispatcher
. After running this method, no further
connection/communication is possible. You have to create again a registry
to run server mode again.
registry
- the registry to shut down
java.lang.IllegalStateException
public static Registry createRegistry(java.net.InetAddress address, int port) throws java.io.IOException, java.lang.IllegalArgumentException
InetAddress
with the last known
worker thread pool size set by setWorkerThreadPoolSize(int)
address
- the InetAddress
the registry is bind toport
- the port the registry is bind to
java.io.IOException
- if there is a problem with the networking layer
java.lang.IllegalArgumentException
- i.e. if specified protocol codec factory class cannot be usedpublic static Registry createRegistry(SslContextFactory sslContextFactory, java.net.InetAddress address, int port) throws java.io.IOException, java.lang.IllegalArgumentException
InetAddress
with the last known
worker thread pool size set by setWorkerThreadPoolSize(int)
.
The communication is done via SSL encryption provided by the given
SslContextFactory
sslContextFactory
- the factory that provides the ssl context for the SSL powered registryaddress
- the InetAddress
the registry is bind toport
- the port the registry is bind to
java.io.IOException
- if there is a problem with the networking layer
java.lang.IllegalArgumentException
- i.e. if specified protocol codec factory class cannot be usedpublic static SimonRemote lookup(java.lang.String host, int port, java.lang.String remoteObjectName) throws SimonRemoteException, java.io.IOException, EstablishConnectionFailed, LookupFailedException
release(Object)
to decrease the reference count and
finally release the connection to the server
host
- hostname where the lookup takes placeport
- port number of the simon remote registryremoteObjectName
- name of the remote object which is bind to the remote registry
SimonRemoteException
- if there's a problem with the simon communication
java.io.IOException
- if there is a problem with the communication itself
EstablishConnectionFailed
- if its not possible to establish a connection to the remote
registry
LookupFailedException
- if there's no such object on the server
java.lang.IllegalArgumentException
- i.e. if specified protocol codec factory class cannot be usedpublic static SimonRemote lookup(java.net.InetAddress host, int port, java.lang.String remoteObjectName) throws LookupFailedException, SimonRemoteException, java.io.IOException, EstablishConnectionFailed
release(Object)
to decrease the reference count and
finally release the connection to the server
host
- host address where the lookup takes placeport
- port number of the simon remote registryremoteObjectName
- name of the remote object which is bind to the remote registry
SimonRemoteException
- if there's a problem with the simon communication
java.io.IOException
- if there is a problem with the communication itself
EstablishConnectionFailed
- if its not possible to establish a connection to the remote
registry
LookupFailedException
- if there's no such object on the server
java.lang.IllegalArgumentException
- i.e. if specified protocol codec factory class cannot be usedpublic static SimonRemote lookup(SslContextFactory sslContextFactory, SimonProxyConfig proxyConfig, java.net.InetAddress host, int port, java.lang.String remoteObjectName) throws LookupFailedException, SimonRemoteException, java.io.IOException, EstablishConnectionFailed
release(Object)
to decrease the reference count and
finally release the connection to the server
sslContextFactory
- the factory for creating the ssl context. No SSL is used if
null
is given!proxyConfig
- configuration details for connecting via proxy. No proxy is
used if null
is given!host
- host address where the lookup takes placeport
- port number of the simon remote registryremoteObjectName
- name of the remote object which is bind to the remote registry
SimonRemoteException
- if there's a problem with the simon communication
java.io.IOException
- if there is a problem with the communication itself
EstablishConnectionFailed
- if its not possible to establish a connection to the remote
registry
LookupFailedException
- if there's no such object on the server
java.lang.IllegalArgumentException
- i.e. if specified protocol codec factory class cannot be used *public static SimonRemote lookup(SslContextFactory sslContextFactory, SimonProxyConfig proxyConfig, java.net.InetAddress host, int port, java.lang.String remoteObjectName, ClosedListener listener) throws LookupFailedException, SimonRemoteException, java.io.IOException, EstablishConnectionFailed
release(Object)
to decrease the reference count and
finally release the connection to the server
sslContextFactory
- the factory for creating the ssl context. No SSL is used if
null
is given!proxyConfig
- configuration details for connecting via proxy. No proxy is
used if null
is given!host
- host address where the lookup takes placeport
- port number of the simon remote registryremoteObjectName
- name of the remote object which is bind to the remote registrylistener
- a listener that get's notified if the remote object's
connection is closed/released. No listener is
used if null
is given!
SimonRemoteException
- if there's a problem with the simon communication
java.io.IOException
- if there is a problem with the communication itself
EstablishConnectionFailed
- if its not possible to establish a connection to the remote
registry
LookupFailedException
- if there's no such object on the server
java.lang.IllegalArgumentException
- i.e. if specified protocol codec factory class cannot be usedpublic static Lookup createInterfaceLookup(java.lang.String host, int port) throws java.net.UnknownHostException
host
- the name of the host on which the registry server runsport
- the port on which the registry server is listening
java.net.UnknownHostException
- if the specified hostname is unknownpublic static Lookup createInterfaceLookup(java.net.InetAddress address, int port)
address
- the address of the host on which the registry server runsport
- the port on which the registry server is listening
public static Lookup createNameLookup(java.lang.String host, int port) throws java.net.UnknownHostException
host
- the name of the host on which the registry server runsport
- the port on which the registry server is listening
java.net.UnknownHostException
- if the specified hostname is unknownpublic static Lookup createNameLookup(java.net.InetAddress address, int port)
address
- the address of the host on which the registry server runsport
- the port on which the registry server is listening
public static java.net.InetSocketAddress getRemoteInetSocketAddress(java.lang.Object proxyObject)
proxyObject
- the proxy object
public static java.net.InetAddress getRemoteInetAddress(java.lang.Object proxyObject)
Simon.getRemoteInetSocketAddress(Object).getAddress()
instead!
proxyObject
- the proxy-object
public static int getRemotePort(java.lang.Object proxyObject)
Simon.getRemoteInetSocketAddress(proxyObject).getPort()
instead!
proxyObject
- the proxy-object
public static java.net.InetSocketAddress getLocalInetSocketAddress(java.lang.Object proxyObject)
proxyObject
- the proxy object
public static int getLocalPort(java.lang.Object proxyObject)
Simon.getLocalInetSocketAddress(proxyObject).getPort()
instead!
proxyObject
- the proxy-object
protected static SimonProxy getSimonProxy(java.lang.Object o) throws java.lang.IllegalArgumentException
SimonProxy
invocation handler wrapped in a simple proxy
o
- the object that holds the proxy
java.lang.IllegalArgumentException
- if the object does not contain a SimonProxy invocation
handlerprotected static java.util.concurrent.ExecutorService getThreadPool()
public static void setWorkerThreadPoolSize(int size)
Executors.newCachedThreadPool()
size
- the size of the used worker thread poolpublic static void setDgcInterval(int milliseconds)
setDefaultKeepAliveInterval(int)
instead!
milliseconds
- time in millisecondspublic static int getDgcInterval()
getKeepAliveInterval()
instead!
public static void setDefaultKeepAliveInterval(int seconds)
seconds
- time in secondspublic static int getKeepAliveInterval()
public static void setDefaultKeepAliveTimeout(int seconds)
seconds
- time in secondspublic static int getDefaultKeepAliveTimeout()
public static void setKeepAliveInterval(java.lang.Object remoteObject, int seconds)
remoteObject
- seconds
- time in seconds
java.lang.IllegalArgumentException
- if the object is not a valid remote objectpublic static int getKeepAliveInterval(java.lang.Object remoteObject)
remoteObject
-
java.lang.IllegalArgumentException
- if the object is not a valid remote objectpublic static void setKeepAliveTimeout(java.lang.Object remoteObject, int seconds)
remoteObject
- seconds
- time in seconds
java.lang.IllegalArgumentException
- if the object is not a valid remote objectpublic static int getKeepAliveTimeout(java.lang.Object remoteObject) throws java.lang.IllegalArgumentException
remoteObject
-
java.lang.IllegalArgumentException
- if the object is not a valid remote objectprotected static void publish(SimonPublication simonPublication) throws java.io.IOException
simonPublication
- the object to publish
java.io.IOException
- if the publish service cannot be started due to IO problemsprotected static boolean unpublish(SimonPublication simonPublication)
SimonPublication
. If there are no
more publications available, shutdown the publish service.
simonPublication
- the publication to unpublish
public static PublicationSearcher searchRemoteObjects(SearchProgressListener listener, int searchTime)
listener
- a SearchProgressListener
implementation which is
informed about the current search progresssearchTime
- the time the background search thread spends for searching
published remote objects
PublicationSearcher
which is used to access the search
resultpublic static java.util.List<SimonPublication> searchRemoteObjects(int searchTime)
searchTime
- the time that is spend to search for published remote objects
List
of SimonPublication
spublic static void setProtocolCodecFactory(java.lang.String protocolFactoryClassName) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.lang.ClassCastException
createRegistry()
or lookup()
calls. This
does not affect already created registry or already established
sessions.
protocolFactoryClassName
- a class name like
"com.mydomain.myproject.codec.mySimonProtocolCodecFactory"
which points to a class, that extends
SimonProtocolCodecFactory
. The important thing is,
that this class correctly overrides
SimonProtocolCodecFactory.setup(boolean)
. For further
details, look at SimonProtocolCodecFactory
!
java.lang.IllegalAccessException
- if the class or its nullary constructor is not accessible.
java.lang.InstantiationException
- if this Class represents an abstract class, an interface, an
array class, a primitive type, or void; or if the class has
no nullary constructor; or if the instantiation fails for
some other reason.
java.lang.ClassNotFoundException
- if the class is not found by the classloader. if so, please
check your classpath.
java.lang.ClassCastException
- if the given class is no instance of
SimonProtocolCodecFactory
public static java.lang.String getProtocolCodecFactory()
public static SimonRemoteStatistics getStatistics(java.lang.Object remoteObject)
SimonProxy
remoteObject
- the remote object that is asked for the statistics
SimonRemoteStatistics
that gives
access to the statistics datapublic static RawChannel openRawChannel(int channelToken, java.lang.Object simonRemote) throws SimonRemoteException
simonRemote
channelToken
- a token that identifies the already prepared raw channel from
the remote station. Those token can only be created on the
remote station. Thus a remote call which does the
prepareRawChannel(RawChannelDataListener, Object)
is needed in advance.simonRemote
- the remote object which lives on the remote station which has
a prepared raw data channel, related to the
channelToken
. Note: This has to be a remote object stub.
SimonRemoteException
public static int prepareRawChannel(RawChannelDataListener listener, java.lang.Object simonRemote) throws SimonException
simonRemote
's internal message dispatcher for
receiving raw data.RawChannelDataListener
,RawChannel
by
calling openRawChannel(int, Object)
.
listener
- the listener which gets all the received data related to this
channelsimonRemote
- a reference to the remote object whos Dispatcher
is
prepared to receive raw data.
SimonException
protected static void registerLookupTable(LookupTable lookupTable)
lookupTable
- protected static void unregisterLookupTable(LookupTable lookupTable)
lookupTable
- public static boolean release(java.lang.Object proxyObject)
proxyObject
-
public static java.lang.Object markAsRemote(java.lang.Object o)
o
- the object to mark as an SimonRemote
IllegalRemoteObjectException
- thrown in case of missing interfaces of given object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |