|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.rad.remote.AbstractConnection
public abstract class AbstractConnection
The AbstractConnection
encapsulates the access to an
IConnection
implementation.
It implements the connection
listener handling and an implementation of ConnectionInfo
.
IConnection
Nested Class Summary | |
---|---|
static class |
AbstractConnection.CallBackResultDelegate
The CallBackResultDelegate is an ICallBackResultListener that forwards
callback result events to single listeners. |
static class |
AbstractConnection.ListenerDelegate<K>
The ListenerDelegate is the base class for listener delegates. |
static class |
AbstractConnection.PropertyChangedDelegate
The PropertyChangedDelegate is an IConnectionPropertyChangedListener that forwards
property changed events to single property listeners. |
Field Summary | |
---|---|
protected ConnectionInfo |
coninf
the connection information. |
protected IConnection |
connection
the connection implementation. |
Constructor Summary | |
---|---|
protected |
AbstractConnection(IConnection pConnection)
Creates a new instance of AppliationConnection with an
IConnection implementation. |
Method Summary | |
---|---|
void |
addCallBackResultListener(ICallBackResultListener pListener)
Adds an ICallBackResultListener to the list of registered listeners. |
void |
addCallBackResultListener(java.lang.String pInstruction,
ICallBackResultListener pListener)
Adds an ICallBackResultListener to the list of registered listeners,
for the given instruction. |
void |
addConnectionListener(IConnectionListener pListener)
Adds an IConnectionListener to the list of registered listeners. |
void |
addPropertyChangedListener(IConnectionPropertyChangedListener pListener)
Adds an IConnectionPropertyChangedListener to the list of registered listeners. |
void |
addPropertyChangedListener(java.lang.String pPropertyName,
IConnectionPropertyChangedListener pListener)
Adds an IConnectionPropertyChangedListener to the list of registered listeners,
for the given property. |
void |
call(ICallBackListener[] pCallBack,
java.lang.String[] pObjectName,
java.lang.String[] pMethod,
java.lang.Object[][] pParams)
Calls desired methods of server objects, through the connection. |
void |
call(ICallBackListener pCallBack,
java.lang.String pObjectName,
java.lang.String pMethod)
The method will call a remote method from a remote object. |
void |
call(ICallBackListener pCallBack,
java.lang.String pObjectName,
java.lang.String pMethod,
java.lang.Object... pParams)
The method will call a remote method from a remote object. |
java.lang.Object[] |
call(java.lang.String[] pObjectName,
java.lang.String[] pMethod)
Calls desired methods of server objects, through the connection. |
java.lang.Object[] |
call(java.lang.String[] pObjectName,
java.lang.String[] pMethod,
java.lang.Object[][] pParams)
Calls desired methods of server objects, through the connection. |
java.lang.Object |
call(java.lang.String pObjectName,
java.lang.String pMethod)
The method will call a remote method from a remote object. |
java.lang.Object |
call(java.lang.String pObjectName,
java.lang.String pMethod,
java.lang.Object... pParams)
The method will call a remote method from a remote object. |
void |
callAction(ICallBackListener[] pCallBack,
java.lang.String[] pAction,
java.lang.Object[][] pParams)
The method will call one or more remote actions. |
void |
callAction(ICallBackListener pCallBack,
java.lang.String pAction)
The method will call a remote action. |
void |
callAction(ICallBackListener pCallBack,
java.lang.String pAction,
java.lang.Object... pParams)
The method will call a remote action. |
java.lang.Object |
callAction(java.lang.String pAction)
The method will call a remote action. |
java.lang.Object[] |
callAction(java.lang.String[] pAction)
The method will call one or more remote actions. |
java.lang.Object[] |
callAction(java.lang.String[] pAction,
java.lang.Object[][] pParams)
The method will call one or more remote actions. |
java.lang.Object |
callAction(java.lang.String pAction,
java.lang.Object... pParams)
The method will call a remote action. |
void |
callBack(java.lang.Object[] pCallBackObject,
java.lang.String[] pCallBackMethod,
java.lang.String[] pObjectName,
java.lang.String[] pMethod,
java.lang.Object[][] pParams)
Calls desired methods of server objects, through the connection. |
void |
callBack(java.lang.Object pCallBackObject,
java.lang.String pCallBackMethod,
java.lang.String pObjectName,
java.lang.String pMethod)
The method will call a remote method from a remote object. |
void |
callBack(java.lang.Object pCallBackObject,
java.lang.String pCallBackMethod,
java.lang.String pObjectName,
java.lang.String pMethod,
java.lang.Object... pParams)
The method will call a remote method from a remote object. |
void |
callBackAction(java.lang.Object[] pCallBackObject,
java.lang.String[] pCallBackMethod,
java.lang.String[] pAction,
java.lang.Object[][] pParams)
The method will call one or more remote actions. |
void |
callBackAction(java.lang.Object pCallBackObject,
java.lang.String pCallBackMethod,
java.lang.String pAction)
The method will call a remote action. |
void |
callBackAction(java.lang.Object pCallBackObject,
java.lang.String pCallBackMethod,
java.lang.String pAction,
java.lang.Object... pParams)
The method will call a remote action. |
void |
close()
Close the connection. |
protected void |
close(boolean pDoCall)
Close the connection, with or without remote call. |
protected ChangedHashtable<java.lang.String,java.lang.Object> |
createConnectionProperties()
Gets the properties which will be sent to the server when opening a new connection. |
protected void |
finalize()
|
protected void |
fireCall(boolean pCallBack,
java.lang.String pObjectName,
java.lang.String pMethodName,
java.lang.Object... pParams)
Fires the objectCalled methods to all registered connection listeners. |
protected void |
fireCallAction(boolean pCallBack,
java.lang.String pAction,
java.lang.Object... pParams)
Fires the actionCalled methods to all registered connection listeners. |
protected void |
fireCallBackResult(CallBackResultEvent pEvent)
Fires the callBackResult methods to all registered callback result listeners. |
protected void |
fireCallError(java.lang.Throwable pError)
Fires the callError methods to all registered connection listeners. |
protected void |
fireClose()
Fires the connectionClosed methods to all registered connection listeners. |
protected void |
fireOpen()
Fires the connectionOpened methods to all registered connection listeners. |
protected void |
fireReOpen()
Fires the connectionReOpened methods to all registered connection listeners. |
java.lang.String |
getApplicationName()
Gets the application name which will be used from the remote server to authenticate the connection. |
IConnection |
getConnection()
Returns the connection to the server. |
java.lang.Object |
getConnectionId()
Gets the connection identifier for this connection. |
IConnectionListener[] |
getConnectionListener()
Gets all registered IConnectionListener s. |
java.lang.String |
getLifeCycleName()
Gets the name of the server-side life-cycle object. |
java.lang.String |
getPassword()
Gets the password which will be used from the remote server to authenticate the connection. |
java.util.Hashtable<java.lang.String,java.lang.Object> |
getProperties()
Gets a copy of the current properties. |
java.lang.Object |
getProperty(java.lang.String pName)
Gets a connection property. |
int |
getTimeout()
Gets the timeout of the connection. |
protected abstract UIInvoker |
getUIInvoker()
Gets the UI invoker. |
java.lang.String |
getUserName()
Gets the user name which will be used from the remote server to authenticate the connection. |
protected java.lang.Throwable |
handleCallError(java.lang.Throwable pError)
Handles a call error. |
boolean |
isOpen()
Checks if the connection is open. |
protected void |
logCommunication(long pStart,
java.lang.String pTitle,
java.lang.Throwable pError,
java.lang.Object... pInfo)
Loggs communication duration. |
void |
open()
Opens the connection. |
protected abstract void |
openConnection()
Opens the connection without event handling. |
void |
removeCallBackResultListener(ICallBackResultListener pListener)
Removes the given ICallBackResultListener from the list of registered listeners. |
void |
removeCallBackResultListener(java.lang.String pInstruction)
Removes all registered listeners for the given instruction. |
void |
removeCallBackResultListener(java.lang.String pInstruction,
ICallBackResultListener pListener)
Removes an ICallBackResultListener from the list of registered listeners,
for the given instruction. |
void |
removeConnectionListener(IConnectionListener pListener)
Removes an IConnectionListener from the list of registered listeners. |
void |
removePropertyChangedListener(IConnectionPropertyChangedListener pListener)
Removes the given IConnectionPropertyChangedListener from the list of registered listeners. |
void |
removePropertyChangedListener(java.lang.String pPropertyName)
Removes all registered listeners for the given property. |
void |
removePropertyChangedListener(java.lang.String pPropertyName,
IConnectionPropertyChangedListener pListener)
Removes an IConnectionPropertyChangedListener from the list of registered listeners,
for the given property. |
void |
reopen()
Reopens the connection. |
void |
setApplicationName(java.lang.String pApplicationName)
Sets the application name which will be used from the remote server to authenticate the connection, when the connection is not open. |
protected java.lang.Throwable |
setConnection(java.lang.Throwable pError)
Sets the connection property for all CommunicationException in the hierarchy of the given
error. |
void |
setLifeCycleName(java.lang.String pName)
Sets the name of the server-side life-cycle object. |
void |
setPassword(java.lang.String pPassword)
Sets the password which will be used from the remote server to authenticate the connection, when the connection is not open. |
void |
setProperty(java.lang.String pName,
java.lang.Object pValue)
Sets a connection property. |
void |
setTimeout(int pMinutes)
Sets the timeout of the connection. |
void |
setUserName(java.lang.String pUserName)
Sets the user name which will be used from the remote server to authenticate the connection, when the connection is not open. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IConnection connection
protected ConnectionInfo coninf
Constructor Detail |
---|
protected AbstractConnection(IConnection pConnection)
AppliationConnection
with an
IConnection
implementation.
pConnection
- the IConnection
implementationMethod Detail |
---|
protected abstract void openConnection() throws java.lang.Throwable
java.lang.Throwable
- if the connection can not be or is already openedprotected abstract UIInvoker getUIInvoker()
UIInvoker
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setLifeCycleName(java.lang.String pName)
pName
- the name of the life-cycle objectpublic java.lang.String getLifeCycleName()
public void setApplicationName(java.lang.String pApplicationName)
pApplicationName
- the application namepublic java.lang.String getApplicationName()
public void setUserName(java.lang.String pUserName)
pUserName
- the user namepublic java.lang.String getUserName()
public void setPassword(java.lang.String pPassword)
pPassword
- the passwordpublic java.lang.String getPassword()
public void open() throws java.lang.Throwable
java.lang.Throwable
- if the connection can not be or is already openedpublic boolean isOpen()
true
if the connection is open, otherwise false
public void close() throws java.lang.Throwable
close
in interface ICloseable
java.lang.Throwable
- if it is not possible to close the connectionprotected void close(boolean pDoCall) throws java.lang.Throwable
pDoCall
- true
to send close to the server, false
to close internal without
remote communication (client-side close)
java.lang.Throwable
- if it is not possible to close the connectionpublic void reopen() throws java.lang.Throwable
java.lang.Throwable
- if an error occurs while opening the connectionpublic IConnection getConnection()
public java.lang.Object getConnectionId()
public void callBack(java.lang.Object[] pCallBackObject, java.lang.String[] pCallBackMethod, java.lang.String[] pObjectName, java.lang.String[] pMethod, java.lang.Object[][] pParams) throws java.lang.Throwable
pCallBackObject
- the callback listener objectspCallBackMethod
- the callback listener methodspObjectName
- list of already mapped server object names/aliasespMethod
- method names which should be calledpParams
- parameters for the method calls
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void call(ICallBackListener[] pCallBack, java.lang.String[] pObjectName, java.lang.String[] pMethod, java.lang.Object[][] pParams) throws java.lang.Throwable
pCallBack
- callback listeners for asynchronous or null for synchronous callspObjectName
- list of already mapped server object names/aliasespMethod
- method names which should be calledpParams
- parameters for the method calls
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callBack(java.lang.Object pCallBackObject, java.lang.String pCallBackMethod, java.lang.String pObjectName, java.lang.String pMethod, java.lang.Object... pParams) throws java.lang.Throwable
pCallBackObject
- the callback listener objectpCallBackMethod
- the callback listener methodpObjectName
- an already mapped server object name/aliaspMethod
- method name which should be calledpParams
- parameters for the method call
java.lang.Throwable
- communication error, security checks, invalid method, ...public void call(ICallBackListener pCallBack, java.lang.String pObjectName, java.lang.String pMethod, java.lang.Object... pParams) throws java.lang.Throwable
pCallBack
- callback listener for asynchronous or null for synchronous callpObjectName
- an already mapped server object name/aliaspMethod
- method name which should be calledpParams
- parameters for the method call
java.lang.Throwable
- communication error, security checks, invalid method, ...public void callBack(java.lang.Object pCallBackObject, java.lang.String pCallBackMethod, java.lang.String pObjectName, java.lang.String pMethod) throws java.lang.Throwable
pCallBackObject
- the callback listener objectpCallBackMethod
- the callback listener methodpObjectName
- an already mapped server object name/aliaspMethod
- method name which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...public void call(ICallBackListener pCallBack, java.lang.String pObjectName, java.lang.String pMethod) throws java.lang.Throwable
pCallBack
- callback listener for asynchronous or null for synchronous callpObjectName
- an already mapped server object name/aliaspMethod
- method name which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...public java.lang.Object[] call(java.lang.String[] pObjectName, java.lang.String[] pMethod, java.lang.Object[][] pParams) throws java.lang.Throwable
pObjectName
- list of already mapped server object names/aliasespMethod
- method names which should be calledpParams
- parameters for the method calls
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object[] call(java.lang.String[] pObjectName, java.lang.String[] pMethod) throws java.lang.Throwable
pObjectName
- list of already mapped server object names/aliasespMethod
- method names which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object call(java.lang.String pObjectName, java.lang.String pMethod, java.lang.Object... pParams) throws java.lang.Throwable
pObjectName
- an already mapped server object name/aliaspMethod
- method name which should be calledpParams
- parameters for the method call
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object call(java.lang.String pObjectName, java.lang.String pMethod) throws java.lang.Throwable
pObjectName
- an already mapped server object name/aliaspMethod
- method name which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object callAction(java.lang.String pAction) throws java.lang.Throwable
pAction
- action which should be called
java.lang.Throwable
- communication error, security checks, invalid action, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object callAction(java.lang.String pAction, java.lang.Object... pParams) throws java.lang.Throwable
pAction
- action which should be calledpParams
- parameters for the action call
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object[] callAction(java.lang.String[] pAction, java.lang.Object[][] pParams) throws java.lang.Throwable
pAction
- list of actions which should be calledpParams
- parameters for the action calls
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public java.lang.Object[] callAction(java.lang.String[] pAction) throws java.lang.Throwable
pAction
- list of actions which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callBackAction(java.lang.Object pCallBackObject, java.lang.String pCallBackMethod, java.lang.String pAction) throws java.lang.Throwable
pCallBackObject
- the callback listener objectpCallBackMethod
- the callback listener methodpAction
- action which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callAction(ICallBackListener pCallBack, java.lang.String pAction) throws java.lang.Throwable
pCallBack
- callback listener for asynchronous or null for synchronous callpAction
- action which should be called
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callBackAction(java.lang.Object pCallBackObject, java.lang.String pCallBackMethod, java.lang.String pAction, java.lang.Object... pParams) throws java.lang.Throwable
pCallBackObject
- the callback listener objectpCallBackMethod
- the callback listener methodpAction
- action which should be calledpParams
- parameters for the action call
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callAction(ICallBackListener pCallBack, java.lang.String pAction, java.lang.Object... pParams) throws java.lang.Throwable
pCallBack
- callback listener for asynchronous or null for synchronous callpAction
- action which should be calledpParams
- parameters for the action call
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callBackAction(java.lang.Object[] pCallBackObject, java.lang.String[] pCallBackMethod, java.lang.String[] pAction, java.lang.Object[][] pParams) throws java.lang.Throwable
pCallBackObject
- the callback listener objectspCallBackMethod
- the callback listener methodspAction
- list of actions which should be calledpParams
- parameters for the action calls
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void callAction(ICallBackListener[] pCallBack, java.lang.String[] pAction, java.lang.Object[][] pParams) throws java.lang.Throwable
pCallBack
- callback listeners for asynchronous or null for synchronous callspAction
- list of actions which should be calledpParams
- parameters for the action calls
java.lang.Throwable
- communication error, security checks, invalid method, ...IConnection.call(ConnectionInfo, String[], String[], Object[][], ICallBackListener[])
public void setProperty(java.lang.String pName, java.lang.Object pValue) throws java.lang.Throwable
pName
- the property namepValue
- the value of the property or null
to delete the property
java.lang.Throwable
- communication error, security checks, invalid method, ...public java.lang.Object getProperty(java.lang.String pName) throws java.lang.Throwable
pName
- the property name
java.lang.Throwable
- communication error, security checks, invalid method, ...public java.util.Hashtable<java.lang.String,java.lang.Object> getProperties() throws java.lang.Throwable
java.lang.Throwable
- communication error, security checks, invalid method, ...public void setTimeout(int pMinutes) throws java.lang.Throwable
pMinutes
- the timeout in minutes or -1 to disable timeout
java.lang.Throwable
- communication error, security checks, invalid method, ...public int getTimeout() throws java.lang.Throwable
java.lang.Throwable
- communication error, security checks, invalid method, ...protected ChangedHashtable<java.lang.String,java.lang.Object> createConnectionProperties()
public void addConnectionListener(IConnectionListener pListener)
IConnectionListener
to the list of registered listeners.
pListener
- the new connection listenerpublic void removeConnectionListener(IConnectionListener pListener)
IConnectionListener
from the list of registered listeners.
pListener
- the new connection listenerpublic IConnectionListener[] getConnectionListener()
IConnectionListener
s.
IConnectionListener
s or null if no listener is registeredpublic void addPropertyChangedListener(IConnectionPropertyChangedListener pListener)
IConnectionPropertyChangedListener
to the list of registered listeners.
pListener
- the listenerpublic void addPropertyChangedListener(java.lang.String pPropertyName, IConnectionPropertyChangedListener pListener)
IConnectionPropertyChangedListener
to the list of registered listeners,
for the given property.
pPropertyName
- the property namepListener
- the listenerpublic void removePropertyChangedListener(java.lang.String pPropertyName)
pPropertyName
- the property namepublic void removePropertyChangedListener(IConnectionPropertyChangedListener pListener)
IConnectionPropertyChangedListener
from the list of registered listeners.
pListener
- the listener or null
to remove all registered listenerspublic void removePropertyChangedListener(java.lang.String pPropertyName, IConnectionPropertyChangedListener pListener)
IConnectionPropertyChangedListener
from the list of registered listeners,
for the given property.
pPropertyName
- the property namepListener
- the listener or null
to remove all registered listenerspublic void addCallBackResultListener(ICallBackResultListener pListener)
ICallBackResultListener
to the list of registered listeners.
pListener
- the listenerpublic void addCallBackResultListener(java.lang.String pInstruction, ICallBackResultListener pListener)
ICallBackResultListener
to the list of registered listeners,
for the given instruction.
pInstruction
- the instruction identifierpListener
- the listenerpublic void removeCallBackResultListener(ICallBackResultListener pListener)
ICallBackResultListener
from the list of registered listeners.
pListener
- the listener or null
to remove all registered listenerspublic void removeCallBackResultListener(java.lang.String pInstruction)
pInstruction
- the instruction identifierpublic void removeCallBackResultListener(java.lang.String pInstruction, ICallBackResultListener pListener)
ICallBackResultListener
from the list of registered listeners,
for the given instruction.
pInstruction
- the instruction identifierpListener
- the listener or null
to remove all registered listenersprotected void fireCallError(java.lang.Throwable pError)
callError
methods to all registered connection listeners.
pError
- the occured errorprotected void fireCallBackResult(CallBackResultEvent pEvent) throws java.lang.Throwable
callBackResult
methods to all registered callback result listeners.
pEvent
- the event
java.lang.Throwable
- if notification failsprotected java.lang.Throwable handleCallError(java.lang.Throwable pError)
CommunicationException
and
notifies connection listeners via fireCallError(Throwable)
.
pError
- the occured error
pError
setConnection(Throwable)
,
fireCallError(Throwable)
protected java.lang.Throwable setConnection(java.lang.Throwable pError)
CommunicationException
in the hierarchy of the given
error.
pError
- the occured error
pError
protected void fireOpen()
connectionOpened
methods to all registered connection listeners.
protected void fireReOpen()
connectionReOpened
methods to all registered connection listeners.
protected void fireClose()
connectionClosed
methods to all registered connection listeners.
protected void fireCall(boolean pCallBack, java.lang.String pObjectName, java.lang.String pMethodName, java.lang.Object... pParams)
objectCalled
methods to all registered connection listeners.
pCallBack
- whether the call was a callback callpObjectName
- the name of the remote objectpMethodName
- the name of the methodpParams
- the method parametersprotected void fireCallAction(boolean pCallBack, java.lang.String pAction, java.lang.Object... pParams)
actionCalled
methods to all registered connection listeners.
pCallBack
- whether the action call was a callback callpAction
- the name of the actionpParams
- the method parametersprotected void logCommunication(long pStart, java.lang.String pTitle, java.lang.Throwable pError, java.lang.Object... pInfo)
pStart
- the communication startpTitle
- the communication "title", means the triggering method name like "open"pError
- if an error occuredpInfo
- the log information (parameter)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |