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, java.lang.Object[])
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 static java.util.concurrent.atomic.AtomicLong |
COUNTER
A counter to ensure the debugged request/response file names are unique.
|
private static boolean |
DEBUG
Flag indicating if the request/response are to be dumped to files.
|
private boolean |
disabledLegacyErrors
Flag indicating the legacy errors are disabled.
|
private boolean |
disconnected
Flag indicating this helper has disconnected.
|
private AppServerInvocationResult |
lastResult
The result from the last remote invocation.
|
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.String target,
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,
SessionListener listener,
InterruptHandler handler,
java.lang.String appServerName,
boolean sessionFree,
java.lang.String user,
java.lang.String pwd,
java.lang.String serverInfo,
java.lang.Object[] requestInfo)
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,
java.lang.Object[] request)
This code is intended for legacy compatibility, and is used to connect to an appserver, when
a CONNECT statement is encountered.
|
boolean |
deleteObject(handle proc)
Delete the associated remote object, from the remote side.
|
boolean |
deleteObject(ProxyProcedureWrapper proc)
Delete the associated remote object, from the remote side.
|
boolean |
deleteObject(java.lang.String code)
Delete the associated remote object, from the remote side.
|
boolean |
deleteObject(java.lang.String code,
int agentId)
Delete the associated remote object, from the remote side.
|
boolean |
deleteProcedure(handle proc)
Delete the associated remote procedure, from the remote side.
|
boolean |
deleteProcedure(ProxyProcedureWrapper proc)
Delete the associated remote procedure, from the remote side.
|
boolean |
deleteProcedure(java.lang.String procId)
Delete the associated remote procedure, from the remote side.
|
boolean |
deleteProcedure(java.lang.String procId,
int agentId,
java.lang.String token)
Delete the associated remote procedure, from the remote side.
|
void |
disableLegacyErrors()
Disable legacy OO errors thrown on this connection.
|
void |
disconnect(boolean disconnecting)
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(handle proc)
Get the name of the remote procedure, identified by the given handle.
|
character |
getProcedureName(ProxyProcedureWrapper proc)
Get the name of the remote procedure, identified by the given proxy procedure.
|
character |
getProcedureName(java.lang.String code)
Get the name of the remote procedure, identified by the given code.
|
character |
getProcedureName(java.lang.String code,
int agentId)
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.
|
AppServerInvocationResult |
handleWebService(long timeout,
java.lang.Class<?> handler,
java.lang.String basepath,
java.lang.String[] paths,
java.lang.String token,
java.lang.String target,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle a generic web service request.
|
(package private) void |
initializeProxy(AsyncRequestImpl asyncReq,
ProxyProcedureWrapper proxy,
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.
|
java.lang.Object |
invoke(int timeout,
JavaInvokeConfig cfg)
Invoke the given Java method directly.
|
(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,
AsyncRequestImpl asyncReq,
InvokeConfig cfg)
Invoke a remote external procedure, internal procedure, user-defined function or web service
operation.
|
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.
|
BaseDataType |
invokeMethod(boolean returnValue,
character name,
handle h,
java.lang.Object... args)
Invoke a method in a remotely instantiated class.
|
BaseDataType |
invokeMethod(boolean returnValue,
character name,
handle h,
java.lang.String modes,
java.lang.Object... args)
Invoke a method in a remotely instantiated class.
|
BaseDataType |
invokeMethod(long timeout,
boolean returnValue,
character name,
handle h,
java.lang.Object... args)
Invoke a method in a remotely instantiated class.
|
BaseDataType |
invokeMethod(long timeout,
boolean returnValue,
character name,
handle h,
java.lang.String modes,
java.lang.Object... args)
Invoke a method in a remotely instantiated class.
|
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.
|
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.
|
void |
newInstance(character name,
handle h,
java.lang.Object... args)
Create a new instance of the specified qualified class name.
|
void |
newInstance(character name,
handle h,
java.lang.String modes,
java.lang.Object... args)
Create a new instance of the specified qualified class name.
|
void |
newInstance(long timeout,
character name,
handle h,
java.lang.Object... args)
Create a new instance of the specified qualified class name.
|
void |
newInstance(long timeout,
character name,
handle h,
java.lang.String modes,
java.lang.Object... args)
Create a new instance of the specified qualified class name.
|
(package private) ProxyProcedureWrapper |
obtainProxy(character name)
Obtain a proxy for the given external procedure.
|
(package private) AppServerInvocationResult |
obtainProxy(java.lang.String name)
Obtain a proxy for the given external procedure.
|
private void |
postProcessResult(java.lang.String target,
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 target,
java.lang.String modes,
java.lang.Object... args)
Check the parameters before a remote call.
|
private boolean |
proxyProcedureInitialized(ProxyProcedureWrapper p)
Wait for the initialization of a proxy procedure.
|
(package private) void |
restoreResponse(AppServerInvocationResult result,
object<? extends OerequestInfo> responseInfo)
Using the details from the last appserver call, restore the SERVER:RESPONSE-INFO with the
remote side's SESSION:CURRENT-RESPONSE-INFO, as received in the result.
|
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.
|
private static void |
writeArguments(java.lang.String target,
boolean request,
java.lang.Object[] args)
Write the specified arguments to file.
|
disconnect, getServer, setServer
private static final boolean DEBUG
private static final java.util.concurrent.atomic.AtomicLong COUNTER
private static AppServerEntry localAppServer
private final java.lang.String connectionID
private boolean disconnected
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 AppServerInvocationResult lastResult
connect(com.goldencode.p2j.cfg.BootstrapConfig, java.lang.String, java.lang.String, boolean)
, to
restore the OerequestInfo
response.private boolean disabledLegacyErrors
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.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, java.lang.Object[] requestInfo)
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.requestInfo
- The remote OerequestInfo
details, as set by
OerequestInfo.toArray()
.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, java.lang.Object[] request) 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.request
- The remote OerequestInfo
details, as set by
OerequestInfo.toArray()
.NumberedException
private static AppServerEntry getLocalAppServer()
RemoteObject.obtainLocalInstance(java.lang.Class<?>, boolean)
.public void disableLegacyErrors()
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(boolean disconnecting)
disconnect
in class ServerHelper
disconnecting
- Flag indicating if the FWD client session is being terminated.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(handle proc)
proc
- The handle of the remote procedure.java.lang.IllegalStateException
- If the appserver is not connected or the handle is not for a proxy procedure.public character getProcedureName(ProxyProcedureWrapper proc)
proc
- The proxy of the remote procedure.java.lang.IllegalStateException
- If the appserver is not 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 character getProcedureName(java.lang.String code, int agentId)
code
- The handle code of the remote procedure.agentId
- The agent ID which created the procedure.java.lang.IllegalStateException
- If the appserver is not connected or an agent ID was not specified for sessionFree
mode.public boolean deleteProcedure(handle proc)
proc
- The remote procedure.true
if the remote procedure was deleted.java.lang.IllegalStateException
- If the appserver is not connected or the handle is not for a proxy procedure.public boolean deleteProcedure(ProxyProcedureWrapper proc)
proc
- The remote procedure.true
if the remote procedure was deleted.java.lang.IllegalStateException
- If the appserver is not connected.public boolean deleteProcedure(java.lang.String procId)
procId
- The remote procedure ID.true
if the remote procedure was deleted.java.lang.IllegalStateException
- If the appserver is not connected.public boolean deleteProcedure(java.lang.String procId, int agentId, java.lang.String token)
procId
- The remote procedure ID.agentId
- The remote agent ID.token
- When not null, it represents the token of a FWD context created for an authenticated and
authorized web service call. The API call will be performed in that context.true
if the remote procedure was deleted.java.lang.IllegalStateException
- If the appserver is not connected or an agent ID was not specified for sessionFree
mode.public boolean deleteObject(handle proc)
proc
- The proxy for the remote procedure.true
if the remote object was deleted.java.lang.IllegalStateException
- If the appserver is not connected or if the handle is not for a proxy procedure.public boolean deleteObject(ProxyProcedureWrapper proc)
proc
- The proxy for the remote procedure.true
if the remote object was deleted.java.lang.IllegalStateException
- If the appserver is not connected.public boolean deleteObject(java.lang.String code)
code
- The handle code of the remote object.true
if the remote object was deleted.java.lang.IllegalStateException
- If the appserver is not connected.public boolean deleteObject(java.lang.String code, int agentId)
code
- The handle code of the remote object.agentId
- The remote agent ID.true
if the remote object was deleted.java.lang.IllegalStateException
- If the appserver is not connected or an agent ID was not specified for sessionFree
mode.public void newInstance(long timeout, character name, handle h, 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 qualified class name for the legacy class.h
- The handle where to save the proxy object.args
- The constructor's arguments.public void newInstance(long timeout, character name, handle h, 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 qualified class name for the legacy class.h
- The handle where to save the proxy object.modes
- A string representation of the modes of each parameter. May be null
args
- The constructor's arguments.public void newInstance(character name, handle h, java.lang.Object... args)
name
- The legacy qualified class name for the legacy class.h
- The handle where to save the proxy object.args
- The constructor's arguments.public void newInstance(character name, handle h, java.lang.String modes, java.lang.Object... args)
name
- The legacy qualified class name for the legacy class.h
- The handle where to save the proxy object.modes
- A string representation of the modes of each parameter. May be null
args
- The constructor's arguments.public BaseDataType invokeMethod(long timeout, boolean returnValue, character name, handle h, java.lang.Object... args)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.returnValue
- Flag indicating if the return value is required.name
- The legacy 4GL name for the class method.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.args
- The method's arguments.null
if this is a void
method.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 invokeMethod(long timeout, boolean returnValue, character name, handle h, 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.returnValue
- Flag indicating if the return value is required.name
- The legacy 4GL name for the class method.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.modes
- A string representation of the modes of each parameter. May be null
args
- The method's arguments.null
if this is a void
method.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 invokeMethod(boolean returnValue, character name, handle h, java.lang.Object... args)
returnValue
- Flag indicating if the return value is required.name
- The legacy 4GL name for the class method.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.args
- The method's arguments.null
if this is a void
method.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 invokeMethod(boolean returnValue, character name, handle h, java.lang.String modes, java.lang.Object... args)
returnValue
- Flag indicating if the return value is required.name
- The legacy 4GL name for the class method.h
- The proxy procedure in which to invoke the internal procedure or function.
If null
, an external procedure is invoked.modes
- A string representation of the modes of each parameter. May be null
args
- The method's arguments.null
if this is a void
method.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.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 AppServerInvocationResult handleWebService(long timeout, java.lang.Class<?> handler, java.lang.String basepath, java.lang.String[] paths, java.lang.String token, java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.handler
- The WebHandler
implementation.basepath
- The service basepath.paths
- The split paths for this handler.token
- When not null, it represents the token of a FWD context created for an authenticated and
authorized web service call. The API call will be performed in that context.target
- The request original target.request
- The Jetty request.response
- The Jetty response.AppServerInvocationResult
instance with any error throw during the web service
processing.java.lang.IllegalStateException
- If this appserver is not local
.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, ProxyProcedureWrapper proxy, boolean transactionDistinct, java.lang.String modes, java.lang.Object[] args)
asyncReq
- The async request which refers an uninitialized proxy procedureproxy
- The proxy procedure wrapper.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.AppServerInvocationResult 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
.public BaseDataType invoke(long timeout, AsyncRequestImpl asyncReq, InvokeConfig cfg)
invoke
in class ServerHelper
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.asyncReq
- When not-null, an AsyncRequestImpl
instance for the associated async
request.cfg
- The invoke configuration.null
if the
invocation could not be performed.public java.lang.Object invoke(int timeout, JavaInvokeConfig cfg) throws JavaInvokeException
All arguments are sent by references: if it was marked as an OUTPUT or INPUT-OUTPUT, any change to that instance will be reflected back to the caller.
timeout
- The maximum allowed time for this invocation to complete. In milliseconds.
Use 0
to disable the timeout.cfg
- The configuration with the Java method to be invoked.null
if this is a void method.JavaInvokeException
- In case any exception was thrown by the method.ProxyProcedureWrapper obtainProxy(character name)
name
- A name of a remote external procedure.void restoreResponse(AppServerInvocationResult result, object<? extends OerequestInfo> responseInfo)
result
- The invocation result. If null
, use lastResult
.responseInfo
- The SERVER:RESPONSE-INFO where to restore the details.private static void writeArguments(java.lang.String target, boolean request, java.lang.Object[] args)
target
- The target of this remote call.request
- Flag indicating this is for a request.args
- The arguments to write.private java.lang.Object[] preProcessParameters(java.lang.String target, 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.
target
- The target of this remote call.modes
- The parameter modes. If null
, no validation is performed.args
- The argument list.private void checkResult(java.lang.String target, 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.
target
- The target of this remote call.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.String target, java.lang.Object[] args, AppServerInvocationResult result)
target
- The target of this remote call.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.private boolean proxyProcedureInitialized(ProxyProcedureWrapper p)
p
- The proxy procedure.