public class AppServerHelper extends ServerHelper
When the connect(com.goldencode.p2j.cfg.BootstrapConfig, java.lang.String, java.lang.String, boolean)
or connectLegacyMode(java.lang.String, java.lang.String, java.lang.String, int, boolean, boolean, com.goldencode.p2j.util.character, com.goldencode.p2j.util.character, com.goldencode.p2j.util.character)
is called, an instance of this class is
returned which contains the connection ID and can be used to execute remote calls, via the
determined appServer
network server.
When establishing connections from Java code, use the connect(com.goldencode.p2j.cfg.BootstrapConfig, java.lang.String, java.lang.String, boolean)
, invoke(com.goldencode.p2j.util.character, com.goldencode.p2j.util.handle, boolean, java.lang.Object...)
and
invokePersistent(com.goldencode.p2j.util.character, com.goldencode.p2j.util.handle, boolean, java.lang.Object...)
APIs to establish a connection and send requests to the remote side.
The getConnectError()
, getConnectResult()
and getConnectionID()
APIs
provide information about the state of the last CONNECT request; note that a connection ID will
be sent back only if the connection was successful.
Modifier and Type | Field and Description |
---|---|
private AppServerEntry |
appServer
A network server to the P2J server running this appserver.
|
private java.lang.String |
appServerName
The name of the connected appserver.
|
private NumberedException |
connectError
The error encountered during the CONNECT call.
|
private java.lang.String |
connectionID
The id of this appserver connection.
|
private character |
connectResult
The result returned by this CONNECT call.
|
private boolean |
local
Flag indicating the appserver is running in the same JVM as the requester.
|
private static AppServerEntry |
localAppServer
A local appserver instance, used when the P2J server running the appserver is the same as
the P2J server from where the connection request originates.
|
private Session |
session
The P2J session used to communicate with the remote side.
|
private boolean |
sessionFree
Flag indicating if this connection is in session free mode (if true) or in session-managed
mode (if false).
|
server
Modifier | Constructor and Description |
---|---|
private |
AppServerHelper()
Initialize this helper when the connection was not established.
|
private |
AppServerHelper(java.lang.String appServerName,
java.lang.String connectionID,
Session session,
AppServerEntry appServer,
boolean sessionFree)
Instantiate a new helper to communicate with the specified appServer instance.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkConnected()
Check if the appserver is connected and if not, throw a
IllegalStateException . |
private void |
checkResult(java.lang.Object[] args,
AppServerInvocationResult result)
Verify the current invocation result instance, by checking if any errors were thrown by the
remote call.
|
static AppServerHelper |
connect(BootstrapConfig config,
java.lang.String account,
SessionListener listener,
InterruptHandler handler,
java.lang.String appServerName,
boolean sessionFree)
Authenticate with the given P2J server and establish an appserver connection.
|
static AppServerHelper |
connect(BootstrapConfig config,
java.lang.String account,
SessionListener listener,
InterruptHandler handler,
java.lang.String appServerName,
boolean sessionFree,
java.lang.String user,
java.lang.String pwd,
java.lang.String serverInfo)
Authenticate with the given P2J server and establish an appserver connection.
|
static AppServerHelper |
connect(BootstrapConfig config,
java.lang.String account,
java.lang.String appServerName,
boolean sessionFree)
Authenticate with the given P2J server and establish an appserver connection.
|
static AppServerHelper |
connect(BootstrapConfig config,
java.lang.String account,
java.lang.String appServerName,
boolean sessionFree,
java.lang.String user,
java.lang.String pwd,
java.lang.String serverInfo)
Authenticate with the given P2J server and establish an appserver connection.
|
(package private) static AppServerHelper |
connectLegacyMode(java.lang.String appService,
java.lang.String host,
java.lang.String serviceName,
int port,
boolean directConnect,
boolean sessionFree,
character user,
character pwd,
character info)
This code is intended for legacy compatibility, and is used to connect to an appserver, when
a CONNECT statement is encountered.
|
boolean |
deleteProcedure(java.lang.String code)
Delete the associated remote procedure, from the remote side.
|
void |
disconnect()
Disconnect from the appserver and terminate the associated P2J session.
|
java.lang.String |
getAppServerName()
Deprecated.
Use
getServerName() instead. |
NumberedException |
getConnectError()
Get the error returned by CONNECT call.
|
java.lang.String |
getConnectionID()
Get the ID of this appserver connection.
|
character |
getConnectResult()
Get the CONNECT call result.
|
private static AppServerEntry |
getLocalAppServer()
Get the appserver export local to the P2J server.
|
character |
getProcedureName(java.lang.String code)
Get the name of the remote procedure, identified by the given code.
|
java.lang.String |
getServerName()
Get the name of the connected appserver.
|
java.lang.String |
getSubType()
Get the sub-type of this server.
|
(package private) void |
initializeProxy(AsyncRequestImpl asyncReq,
java.lang.String code,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object[] args)
Initialize the specified proxy procedure.
|
BaseDataType |
invoke(character name,
handle h,
boolean function,
boolean dynamicFunction,
boolean superCall,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure, internal procedure or user-defined function.
|
character |
invoke(character name,
handle h,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote external procedure or internal procedure.
|
character |
invoke(character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure or internal procedure.
|
(package private) BaseDataType |
invoke(long timeout,
AsyncRequestImpl asyncReq,
character name,
handle h,
boolean function,
boolean dynamicFunction,
boolean superCall,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure, internal procedure or user-defined function.
|
BaseDataType |
invoke(long timeout,
character name,
handle h,
boolean function,
boolean dynamicFunction,
boolean superCall,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure, internal procedure or user-defined function.
|
character |
invoke(long timeout,
character name,
handle h,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote external procedure or internal procedure.
|
character |
invoke(long timeout,
character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure or internal procedure.
|
BaseDataType |
invokeFunction(character name,
handle h,
boolean dynamicFunction,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(character name,
handle h,
boolean dynamicFunction,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(character name,
handle h,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(long timeout,
character name,
handle h,
boolean dynamicFunction,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(long timeout,
character name,
handle h,
boolean dynamicFunction,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(long timeout,
character name,
handle h,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
BaseDataType |
invokeFunction(long timeout,
character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote remote user-defined function, using the given proxy procedure.
|
character |
invokePersistent(character name,
handle h,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote external procedure as persistent.
|
character |
invokePersistent(character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure as persistent.
|
(package private) character |
invokePersistent(long timeout,
AsyncRequestImpl asyncReq,
character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure as persistent.
|
character |
invokePersistent(long timeout,
character name,
handle h,
boolean transactionDistinct,
java.lang.Object... args)
Invoke a remote external procedure as persistent.
|
character |
invokePersistent(long timeout,
character name,
handle h,
boolean transactionDistinct,
java.lang.String modes,
java.lang.Object... args)
Invoke a remote external procedure as persistent.
|
boolean |
isConnected()
Check if the connection is still established.
|
boolean |
isSessionFree()
Check if this connection is in session-free mode or in session-managed mode.
|
boolean |
isWebService()
Check if this is a web service.
|
(package private) ProxyProcedureWrapper |
obtainProxy(character name)
Obtain a proxy for the given external procedure.
|
(package private) java.lang.String |
obtainProxy(java.lang.String name)
Obtain a proxy for the given external procedure.
|
private void |
postProcessResult(java.lang.Object[] args,
AppServerInvocationResult result)
On the requester side, this receives an argument list and updates it, depending on the
parameter's mode (OUTPUT or INPUT-OUTPUT) and if the remote side sent an updated value of
this argument.
|
private java.lang.Object[] |
preProcessParameters(java.lang.String modes,
java.lang.Object... args)
Check the parameters before a remote call.
|
void |
sendStop()
Send a STOP condition to the request currently being executed on this connection.
|
void |
sendStop(int requestId)
Send a STOP condition to the specified async request.
|
private void |
setConnectError(NumberedException error)
Set the error returned by the CONNECT call.
|
private void |
setConnectResult(character result)
Set the CONNECT call result.
|
getServer, setServer
private static AppServerEntry localAppServer
private final java.lang.String connectionID
private final java.lang.String appServerName
private final boolean sessionFree
private final AppServerEntry appServer
private character connectResult
private NumberedException connectError
private Session session
null
if the
appserver is in the same JVM as the requester.private boolean local
private AppServerHelper()
private AppServerHelper(java.lang.String appServerName, java.lang.String connectionID, Session session, AppServerEntry appServer, boolean sessionFree)
appServerName
- The name of the connected appserver.connectionID
- The ID for this appServer connection.session
- The P2J session used to communicate with the remote side. May be null
if the appServer is on the same P2J Server as the requester.appServer
- The AppServerEntry
network server instance.public static AppServerHelper connect(BootstrapConfig config, java.lang.String account, java.lang.String appServerName, boolean sessionFree)
config
- The configuration for the P2J server connection.account
- The P2J account to authenticate on the remote side.appServerName
- The name of the appserver to which the connection will be established.sessionFree
- true
to indicate a session-free operating mode, false
to indicate a session-managed operating mode.public static AppServerHelper connect(BootstrapConfig config, java.lang.String account, java.lang.String appServerName, boolean sessionFree, java.lang.String user, java.lang.String pwd, java.lang.String serverInfo) throws NumberedException
config
- The configuration for the P2J server connection.account
- The P2J account to authenticate on the remote side.appServerName
- The name of the appserver to which the connection will be established.sessionFree
- true
to indicate a session-free operating mode, false
to indicate a session-managed operating mode.user
- The username passed to the appserver's connect procedure.pwd
- The password passed to the appserver's connect procedure.serverInfo
- The info passed to the appserver's connect procedure.NumberedException
public static AppServerHelper connect(BootstrapConfig config, java.lang.String account, SessionListener listener, InterruptHandler handler, java.lang.String appServerName, boolean sessionFree)
config
- The configuration for the P2J server connection.account
- The P2J account to authenticate on the remote side.listener
- The session listener, used when a virtual or direct session is established.handler
- The interrupt handler, used when a direct session is established.appServerName
- The name of the appserver to which the connection will be established.sessionFree
- true
to indicate a session-free operating mode, false
to indicate a session-managed operating mode.public static AppServerHelper connect(BootstrapConfig config, java.lang.String account, SessionListener listener, InterruptHandler handler, java.lang.String appServerName, boolean sessionFree, java.lang.String user, java.lang.String pwd, java.lang.String serverInfo)
config
- The configuration for the P2J server connection.account
- The P2J account to authenticate on the remote side.listener
- The session listener, used when a virtual or direct session is established.handler
- The interrupt handler, used when a direct session is established.appServerName
- The name of the appserver to which the connection will be established.sessionFree
- true
to indicate a session-free operating mode, false
to indicate a session-managed operating mode.user
- The username passed to the appserver's connect procedure.pwd
- The password passed to the appserver's connect procedure.serverInfo
- The info passed to the appserver's connect procedure.static AppServerHelper connectLegacyMode(java.lang.String appService, java.lang.String host, java.lang.String serviceName, int port, boolean directConnect, boolean sessionFree, character user, character pwd, character info) throws NumberedException
This will use the known appservers configured in the directory to identify the P2J server and account, on which the appserver targeted by the CONNECT statement is running.
appService
- The value of the "-AppService" parameter.host
- The value of the "-H" parameter.serviceName
- The service name specified by the "-S" parameter.port
- The port specified by the "-S" parameter.sessionFree
- true
to indicate a session-free operating mode, false
to indicate a session-managed operating mode.user
- The username passed to the appserver's connect procedure.pwd
- The password passed to the appserver's connect procedure.info
- The info passed to the appserver's connect procedure.NumberedException
private static AppServerEntry getLocalAppServer()
RemoteObject.obtainLocalInstance(java.lang.Class<?>, boolean)
.public java.lang.String getSubType()
getSubType
in class ServerHelper
"APPSERVER"
string.public void sendStop(int requestId)
sendStop
in class ServerHelper
requestId
- The request where to send a STOP condition.java.lang.IllegalStateException
- If the appserver is not connected.public void sendStop()
sendStop
in class ServerHelper
java.lang.IllegalStateException
- If the appserver is not connected.public boolean isSessionFree()
isSessionFree
in class ServerHelper
sessionFree
flag.public java.lang.String getConnectionID()
getConnectionID
in class ServerHelper
public boolean isWebService()
isWebService
in class ServerHelper
false
.public void disconnect()
disconnect
in class ServerHelper
java.lang.IllegalStateException
- If the appserver is not connected.public boolean isConnected()
This includes determining if the session
is still running and if the appserver
connection was established.
isConnected
in class ServerHelper
true
if the server is currently connected.public character getProcedureName(java.lang.String code)
code
- The handle code of the remote procedure.java.lang.IllegalStateException
- If the appserver is not connected.public boolean deleteProcedure(java.lang.String code)
code
- The handle code of the remote procedure.java.lang.IllegalStateException
- If the appserver is not connected.public character invokePersistent(character name, handle h, boolean transactionDistinct, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The handle where to save the proxy procedure. May be null
.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invokePersistent(character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The handle where to save the proxy procedure. May be null
.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invokePersistent(long timeout, character name, handle h, boolean transactionDistinct, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The handle where to save the proxy procedure. May be null
.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invokePersistent(long timeout, character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The handle where to save the proxy procedure. May be null
.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(character name, handle h, boolean transactionDistinct, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(character name, handle h, boolean dynamicFunction, boolean transactionDistinct, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(character name, handle h, boolean dynamicFunction, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(long timeout, character name, handle h, boolean transactionDistinct, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(long timeout, character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(long timeout, character name, handle h, boolean dynamicFunction, boolean transactionDistinct, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invokeFunction(long timeout, character name, handle h, boolean dynamicFunction, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the procedure or function.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invoke(character name, handle h, boolean transactionDistinct, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure.
If null
, an external procedure is invoked.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invoke(character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure.
If null
, an external procedure is invoked.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invoke(character name, handle h, boolean function, boolean dynamicFunction, boolean superCall, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.function
- true
if this is a function call.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.superCall
- true
if this is a RUN SUPER or SUPER() call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invoke(long timeout, character name, handle h, boolean transactionDistinct, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure.
If null
, an external procedure is invoked.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public character invoke(long timeout, character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure.
If null
, an external procedure is invoked.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public BaseDataType invoke(long timeout, character name, handle h, boolean function, boolean dynamicFunction, boolean superCall, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.function
- true
if this is a function call.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.superCall
- true
if this is a RUN SUPER or SUPER() call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.public NumberedException getConnectError()
public character getConnectResult()
public java.lang.String getServerName()
getServerName
in class ServerHelper
public java.lang.String getAppServerName()
getServerName()
instead.void initializeProxy(AsyncRequestImpl asyncReq, java.lang.String code, boolean transactionDistinct, java.lang.String modes, java.lang.Object[] args)
asyncReq
- The async request which refers an uninitialized proxy procedurecode
- The code of a persistent external procedure to which the agent is associated. May
be null
.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.java.lang.String obtainProxy(java.lang.String name)
name
- A name of a remote external procedure.java.lang.IllegalStateException
- If the appserver is not connected.BaseDataType invoke(long timeout, AsyncRequestImpl asyncReq, character name, handle h, boolean function, boolean dynamicFunction, boolean superCall, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
invoke
in class ServerHelper
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.name
- The legacy 4GL name for the procedure/function.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.function
- true
if this is a function call.dynamicFunction
- true
if this is a DYNAMIC-FUNCTION call.superCall
- true
if this is a RUN SUPER or SUPER() call.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.character invokePersistent(long timeout, AsyncRequestImpl asyncReq, character name, handle h, boolean transactionDistinct, java.lang.String modes, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.asyncReq
- The AsyncRequestImpl
instance when this is an async request, or null for
sync requests.name
- The legacy 4GL name for the procedure/function.h
- The handle where to save the proxy procedure. May be null
.transactionDistinct
- Flag indicating if the TRANSACTION DISTINCT clause is in effect.modes
- A string representation of the modes of each parameter. May be null
args
- The procedure's arguments.java.lang.IllegalStateException
- If the appserver is not connected.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.ProxyProcedureWrapper obtainProxy(character name)
name
- A name of a remote external procedure.private java.lang.Object[] preProcessParameters(java.lang.String modes, java.lang.Object... args)
DMO
, TableParameter
or a
result set
.
This will not change the references in the passed argument list. Instead, it will return a distinct array which will need to be sent to the remote side.
modes
- The parameter modes. If null
, no validation is performed.args
- The argument list.private void checkResult(java.lang.Object[] args, AppServerInvocationResult result)
Also, this receives an argument list and updates it, depending on the parameter's mode (OUTPUT or INPUT-OUTPUT) and if the remote side sent an updated value of this argument. The post-processing of the argument list is done only if no errors were received from the remote side.
args
- The arguments which need to be processed.result
- The result which needs to be checked for errors.ConditionException
- If the appserver call ended with a ERROR, QUIT, STOP, END-ERROR conditionjava.lang.RuntimeException
- If the API call ended with other type of Exception
, which is not a
ConditionException
.private void postProcessResult(java.lang.Object[] args, AppServerInvocationResult result)
args
- The arguments (from the requester side) which need to be processed.result
- The result which needs to be checked for errors.private void setConnectResult(character result)
result
- The result return by the latest CONNECT call.private void setConnectError(NumberedException error)
error
- The error returned by the CONNECT call.private void checkConnected()
IllegalStateException
.
Details about the server-side problem are found in the connectError
and in the
connectResult
fields.java.lang.IllegalStateException
- If the appserver is not connected.