EJClient is a TCP/IP based network client, which which is exclusively capable to communicate with a EJServer.
EJClient offers support for:
EJClient()Creates a new instance of EJClient, pre-configured with the settings out of the file "ejoe.properties", which has to be able on the classpath.
EJClient(Properties properties)Creates a new instance of EJClient, pre-configured with the passed settings. This constructor can be used, if the settings for EJClient were already read from another configuration file...
EJClient(String pathToConfigFile)Creates a new instance of EJClient, pre-configured with the settings out of the given file.
EJClient(String host, int port)Creates a new instance of EJClient, which is able to communicate with the EJServer listening to "host:port".
EJClient(String host, int port, SerializeAdapter adapter)Creates a new instance of EJClient, which is able to communicate with the EJServer listening to "host:port". EJClient will use the passed SerializeAdapter.
EJClient(String host, int port, SerializeAdapter adapter, boolean isPersistent, boolean isHttp, boolean useCompression)Creates a new instance of EJClient, which is able to communicate with the EJServer listening to "host:port". EJClient will use the passed SerializeAdapter. If "isPersistent" was set to true, EJClient will use a persitent connection to the corresponding EJServer. If "isHttp" was set to true, EJClient will encapsulate requests within HTTP-Post-Requests. If "useCompression" was set to true, EJClient will use GZIP-compression to compact request data.
execute(Object request). The request object can be any object of a non-primitive type and has to fulfill possibly requirements of the chossen SerializeAdapter. Errors during communication between client and server will be thrown as java.io.IOException, error during the serverside processing of a request will be thrown as java.rmi.RemoteException.
import de.netseeker.ejoe.EJClient; ... { Integer myIntegerRequest = new Integer(1); String myStringRequest = "Hallo EJServer"; Map myMapRequest = new HashMap(); SomeBean myBeanRequest = new SomeBean(); ... EClient client = new EJClient(...); try { client.execute( myIntegerRequest); client.execute( myStringRequest ); client.execute( myMapRequest ); client.execute( myBeanRequest ); ... } catch(RemoteException re) { //EJServer did return an Error } catch(IOException e) { //connection or serialization issues maybe? } ... }