|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.accendia.iris.client.ServerContext
public class ServerContext
Encapsulates the client socket connection and information about the applications installed on the server: commands, factories and client callback interfaces. It is responsible for managing parallel access to the socket connection and to dispatch the client callback invocation made from the server side. All client application threads may invoke the server using proxies obtain from a shared ServerContext without synchronizing.
| Constructor Summary | |
|---|---|
ServerContext()
Creates an unconnected ServerContext. |
|
ServerContext(java.lang.String hostname,
int port,
java.lang.String user,
char[] password,
boolean secure)
Creates a connected server context. |
|
| Method Summary | |
|---|---|
void |
addConnectionListener(IConnectionListener connectionListener)
Adds a connection listener to this server context. |
void |
addHandler(java.lang.String appName,
java.lang.Object handler)
Registers a client handler for processing client callback invocations made from the server side. |
void |
close()
Close the connection to the server. |
java.lang.Object |
getCommandProxy(java.lang.String appName,
java.lang.String cmdName)
Returns a proxy to a server command. |
java.lang.Object |
getFactoryProxy(java.lang.String appName,
java.lang.String factoryName)
Returns a proxy to a server command factory. |
java.net.InetAddress |
getInetAddress()
Returns the IP address of the application server. |
int |
getPort()
Returns the listening port number of the application server. |
java.net.InetAddress |
getProxyAddress()
|
int |
getProxyPort()
|
boolean |
getSecure()
|
java.lang.String |
getServerVersion()
Returns a comma separated list of the application versions installed on the server and the server version, example iris2.1,jns2.1,acme3.4. |
java.lang.String |
getUser()
|
boolean |
isClosed()
|
void |
login(java.lang.String user,
char[] password)
Login to the server. |
void |
removeAllHandlers(java.lang.String appName)
Removes all registered client handlers for a remote application |
void |
removeConnectionListener(IConnectionListener connectionListener)
Removes a connection listener from this server context. |
void |
removeHandler(java.lang.String appName,
java.lang.Object handler)
Removes a registered client handler |
void |
setApplicationDescriptor(java.lang.String applicationName,
ApplicationDescriptor descriptor)
This method is invoked by the client code in order to declare the remote application metadata and preventing the invocation of the server for this purpose. |
void |
setProxyAddress(java.net.InetAddress proxyhost,
int proxyport)
Set the HTTP proxy address if the client id behind a firewall and must connect to the server through an HTTP proxy. |
void |
setSecure(boolean secure)
Sets the secure connection flag. |
void |
setServerAddress(java.net.InetAddress hostAddress,
int port)
Sets the address of the application server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServerContext()
public ServerContext(java.lang.String hostname,
int port,
java.lang.String user,
char[] password,
boolean secure)
throws java.io.IOException,
LoginFailedException
hostname - The name of the host where the server is runningport - The server port.user - The name of the user that is connecting to the serverpassword - The user passwordsecure - Set to true if secure communication is required
java.io.IOException - If a network error occurs.
LoginFailedException - If the user does not exist, a wrong password was provided or
a secure connection could not be established when secure flag is specified.| Method Detail |
|---|
public java.lang.String getServerVersion()
iris2.1,jns2.1,acme3.4. The application version
may be used to verify newer client version are connected to the corresponding server version
or to ensure backward compatibility with older remote applications.
The application version is optional and is declared in
the application.properties file:
Application.version=acme3.4
public void setServerAddress(java.net.InetAddress hostAddress,
int port)
hostAddress - IP address of the application serverport - Listening port number of the serverpublic java.net.InetAddress getInetAddress()
public int getPort()
public void setProxyAddress(java.net.InetAddress proxyhost,
int proxyport)
proxyhost - IP address of the HTTP proxy serverproxyport - Listening port number of the proxy serverpublic java.net.InetAddress getProxyAddress()
public int getProxyPort()
public void setSecure(boolean secure)
secure - Secure connection flagpublic boolean getSecure()
public java.lang.String getUser()
public void login(java.lang.String user,
char[] password)
throws java.io.IOException,
LoginFailedException
user - The user namepassword - The login password
java.io.IOException - A communication error occurred
LoginFailedException - The login failed
public java.lang.Object getCommandProxy(java.lang.String appName,
java.lang.String cmdName)
throws RemoteObjectNotFoundException,
java.lang.ClassNotFoundException,
java.io.IOException
appName - The name of the application installed on the server.cmdName - The name of the command.
RemoteObjectNotFoundException - If the command does not exist.
java.lang.ClassNotFoundException - If any of the interfaces implemented by the command
is not deployed with the client.
java.io.IOException - If a network errors occurs.
public java.lang.Object getFactoryProxy(java.lang.String appName,
java.lang.String factoryName)
throws RemoteObjectNotFoundException,
java.lang.ClassNotFoundException,
java.io.IOException
appName - The name of the application installed on the server.factoryName - The name of the command factory.
RemoteObjectNotFoundException - If the command factory does not exist.
java.lang.ClassNotFoundException - If any of the interfaces implemented by the command factory
is not deployed with the client.
java.io.IOException - If a network errors occurs.
public void addHandler(java.lang.String appName,
java.lang.Object handler)
throws java.lang.ClassNotFoundException,
java.io.IOException
appName - The application for which the handler is registeredhandler - The client handler instance
java.lang.ClassNotFoundException - If any of the client callback interfaces declared by the
application is not deployed on the client.
java.io.IOException - If a network error occurs.
public void removeHandler(java.lang.String appName,
java.lang.Object handler)
appName - The name of the application from which the handler is removed.handler - The client handler instance.public void removeAllHandlers(java.lang.String appName)
appName - The name of the application for which the handlers are removedpublic void addConnectionListener(IConnectionListener connectionListener)
connectionListener - The connection listener to be added.public void removeConnectionListener(IConnectionListener connectionListener)
connectionListener - The connection listener to be removed.
public void setApplicationDescriptor(java.lang.String applicationName,
ApplicationDescriptor descriptor)
applicationName - The name of the remote applicationdescriptor - The application descriptorpublic void close()
public boolean isClosed()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||