de.netseeker.ejoe
Class EJClient

java.lang.Object
  extended byde.netseeker.ejoe.EJClient
All Implemented Interfaces:
java.io.Serializable

public class EJClient
extends java.lang.Object
implements java.io.Serializable

This is the client component of EJOE. You have to use this component to send and retrieve data to/from a EJOE server.

Author:
netseeker aka Michael Manske
See Also:
Serialized Form

Constructor Summary
EJClient()
          Creates an instance of the EJOE client pre-configured with settings from the global ejoe.properties file.
EJClient(java.lang.String pathToConfigFile)
          Creates an instance of the EJOE client pre-configured with settings from a global properties file.
EJClient(java.lang.String host, int port)
          Creates an instance of the EJOE client preconfigured to use an instance of de.netseeker.ejoe.adapter.ObjectStreamAdapter for (de)serializing.
EJClient(java.lang.String host, int port, int classLoaderPort, SerializeAdapter adapter)
          Creates an instance of the EJOE client with remote classloading enabled.
EJClient(java.lang.String host, int port, SerializeAdapter adapter)
          Creates an instance of the EJOE client.
 
Method Summary
 void close()
          Closes an existing persistent connection to the corresponding EJOE server.
 void enableCompression(boolean enable)
          Tells this client to use compression (if supported by the server) or not.
 void enableCompression(int compressionLevel)
          Tells this client to use compression (if supported by the server) with the given compression level.
 void enablePersistentConnection(boolean enable)
          Enables/disables usage of a persistent connection.
 void enableRemoteClassloading()
          Enables remote classloading on the default remote port.
 void enableRemoteClassloading(int port)
          Enables remote classloading on the given remote port
 java.lang.Object execute(java.lang.Object obj)
          Main entry point for client tier implementations.
 void setConnectionTimeout(int timeout)
          Sets the connection timeout used when waiting for server responses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJClient

public EJClient()
Creates an instance of the EJOE client pre-configured with settings from the global ejoe.properties file. You MUST provide such an property file to use this constructor.


EJClient

public EJClient(java.lang.String pathToConfigFile)
Creates an instance of the EJOE client pre-configured with settings from a global properties file.

Parameters:
pathToConfigFile - path to the properties file

EJClient

public EJClient(java.lang.String host,
                int port)
Creates an instance of the EJOE client preconfigured to use an instance of de.netseeker.ejoe.adapter.ObjectStreamAdapter for (de)serializing.

Parameters:
host - address (dns name or ip address) of the EJOE server
port - port which the EJOE server listens to

EJClient

public EJClient(java.lang.String host,
                int port,
                SerializeAdapter adapter)
Creates an instance of the EJOE client.

Parameters:
host - address (dns name or ip address) of the EJOE server
port - port which the EJOE server listens to
adapter - the adapter used for (de)serializing input paramter objects for the server and the return values

EJClient

public EJClient(java.lang.String host,
                int port,
                int classLoaderPort,
                SerializeAdapter adapter)
Creates an instance of the EJOE client with remote classloading enabled.

Parameters:
host - address (dns name or ip address) of the EJOE server
port - port which the EJOE server listens to
classLoaderPort - port which the EJOE class loader server listens to
adapter - the adapter used for (de)serializing input paramter objects for the server and the return values
Method Detail

setConnectionTimeout

public void setConnectionTimeout(int timeout)
Sets the connection timeout used when waiting for server responses. A value of zero (the default) blocks indefinitely.

Parameters:
timeout - the new timeout in milliseconds

enableCompression

public void enableCompression(boolean enable)
Tells this client to use compression (if supported by the server) or not.

Parameters:
enable -

enableCompression

public void enableCompression(int compressionLevel)
Tells this client to use compression (if supported by the server) with the given compression level.

Parameters:
compressionLevel - the level of compression to use, must be in range of 0-9

enablePersistentConnection

public void enablePersistentConnection(boolean enable)
Enables/disables usage of a persistent connection. If persistent connection is disabled a new connection will be used for each request.

Parameters:
enable -

enableRemoteClassloading

public void enableRemoteClassloading(int port)
Enables remote classloading on the given remote port

Parameters:
port - port on which the EJOE classloader server listens

enableRemoteClassloading

public void enableRemoteClassloading()
Enables remote classloading on the default remote port.


execute

public java.lang.Object execute(java.lang.Object obj)
                         throws java.io.IOException
Main entry point for client tier implementations. Handles all remote server calls... This method is threadsafe, ensuring that only one request is processed at a time.

Parameters:
obj - input objects for the EJOE Server
Returns:
the object(s) returned by the EJOE server
Throws:
java.io.IOException

close

public void close()
Closes an existing persistent connection to the corresponding EJOE server. Invoking this method when non-persistent connections are used has no effect.



Copyright © 2005-2006 netseeker. All Rights Reserved.