|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.netseeker.ejoe.EJClient
public class EJClient
This is the client component of EJOE. You have to use this component to send and retrieve data to/from a EJOE server.
Basic usage:
EJClient client = new EJClient("127.0.0.1", 12577); //you could also use EJConstants.EJOE_PORT Object response = client.execute("Hello World"); ...
Usage with persistent connections:
EJClient client = new EJClient("127.0.0.1", 12577); //you could also use EJConstants.EJOE_PORT client.enablePersistentConnection(true); //request a persistent connection to the server Object response = client.execute("Hello World"); ... reponse = client.execute("Bye World"); //close the connection client.close(); ...
Usage with In-JVM EJServer:
EJClient client = new EJClient("127.0.0.1", 12577); //you could also use EJConstants.EJOE_PORT client.setInJvm(true); //enable In-JVM mode, no socket connections will be used Object response = client.execute("Hello World"); ... reponse = client.execute("Bye World"); ...
Constructor Summary | |
---|---|
EJClient()
Creates an instance of the EJOE client pre-configured with settings from the global ejoe.properties file. |
|
EJClient(java.util.Properties properties)
Creates an instance of the EJOE client pre-configured with settings from the given properties store. |
|
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,
SerializeAdapter adapter)
Creates an instance of the EJOE client. |
|
EJClient(java.lang.String host,
int port,
SerializeAdapter adapter,
boolean isPersistent,
boolean isHttp,
boolean useCompression)
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 |
enableHttpPackaging(boolean enable)
Enables/disables usage of a persistent connection. |
void |
enablePersistentConnection(boolean enable)
Enables/disables usage of a persistent connection. |
void |
enableRemoteClassloading()
Enables remote classloading on the default remote port. |
java.lang.Object |
execute(java.lang.Object obj)
Main entry point for client tier implementations. |
long |
executeAsync(java.lang.Object obj,
EJAsyncCallback callback)
Asynchrounous entry point for executing server invocations. |
ConnectionHeader |
getConnectionHeader()
Getter method to get direct access to the underlying ConnectionHeader (as required by the WSIF port implementation) |
boolean |
isInJVM()
|
void |
setAdapterStrategy(int adapterStrategy)
Controls the used Adapter Strategy: ADAPTER_STRATEGY_DEFAULT: both, client and server, will serialize and deserialize objects. |
void |
setConnectionTimeout(int timeout)
Sets the connection timeout used when waiting for server responses. |
void |
setInJVM(boolean injvm)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EJClient()
public EJClient(java.lang.String pathToConfigFile)
pathToConfigFile
- path to the properties filepublic EJClient(java.util.Properties properties)
properties
- properties store containing EJClient settingspublic EJClient(java.lang.String host, int port)
host
- address (dns name or ip address) of the EJOE serverport
- port which the EJOE server listens topublic EJClient(java.lang.String host, int port, SerializeAdapter adapter)
host
- address (dns name or ip address) of the EJOE serverport
- port which the EJOE server listens toadapter
- the adapter used for (de)serializing input paramter objects for the server and the return valuespublic EJClient(java.lang.String host, int port, SerializeAdapter adapter, boolean isPersistent, boolean isHttp, boolean useCompression)
host
- address (dns name or ip address) of the EJOE serverport
- port which the EJOE server listens toadapter
- the adapter used for (de)serializing input paramter objects for the server and the return valuesisPersistent
- whether EJClient should use a persistent connection to the server or notisHttp
- whether EJClient should wrap requests in HTTP headers or not (lets EJClient socket data look like a
HTTP 1.1 browser communication)Method Detail |
---|
public void setConnectionTimeout(int timeout)
timeout
- the new timeout in millisecondspublic void enableCompression(boolean enable)
enable
- public void enableCompression(int compressionLevel)
compressionLevel
- the level of compression to use, must be in range of 0-9public void enablePersistentConnection(boolean enable)
enable
- public void enableHttpPackaging(boolean enable)
enable
- public boolean isInJVM()
public void setInJVM(boolean injvm)
injvm
- the _inJVM to setpublic void setAdapterStrategy(int adapterStrategy)
adapterStrategy
- public void enableRemoteClassloading()
public ConnectionHeader getConnectionHeader()
public java.lang.Object execute(java.lang.Object obj) throws java.io.IOException
obj
- input objects for the EJOE Server
java.io.IOException
public long executeAsync(java.lang.Object obj, EJAsyncCallback callback)
obj
- input objects for the EJOE Servercallback
- callback instance which will be notified if the request was processed or an an error occured
public void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |