public class LegacyOpenClientCaller
extends java.lang.Object
LegacyJavaAppserverClient.invokeWithArgs(java.lang.String, com.goldencode.p2j.util.LegacyJavaAppserverParameter[]) call.
The target program acts as a controller, where it identifies the program to dispatch to call from the
arguments or other means. Only the OUTPUT or INPUT-OUTPUT argument can be sent back to the caller, via
the setArgument(int, com.goldencode.p2j.util.BaseDataType) and other setter APIs.
Arguments need to be retrieved via the getter APIs, and the target controller will need to prepare them,
as needed, to be eventually passed to the invokeExternalProgram(java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]), invokeMethod(com.goldencode.p2j.util.object<? extends com.goldencode.p2j.oo.lang._BaseObject_>, java.lang.String, java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]) or
invokeStaticMethod(java.lang.String, java.lang.String, java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]), to invoke the real target.
The getter, setters or otherwise APIs can be called only from the context of the target external program
acting as a controller. Using these APIs from other code will throw a ErrorConditionException.
| Modifier and Type | Class and Description |
|---|---|
private static class |
LegacyOpenClientCaller.WorkArea
Stores global data relating to the state of the current context.
|
| Modifier and Type | Field and Description |
|---|---|
private static ContextLocal<LegacyOpenClientCaller.WorkArea> |
local
Context-local state.
|
| Constructor and Description |
|---|
LegacyOpenClientCaller() |
| Modifier and Type | Method and Description |
|---|---|
static void |
asDataSetParameter(int idx,
handle dataset)
Associate the given dataset with the dataset-handle parameter at the given index.
|
static void |
asTableParameter(int idx,
handle table)
Associate the given temp-table with the table-handle parameter at the given index.
|
(package private) static void |
clearArguments()
For the
LegacyJavaAppserverClient.invokeWithArgs(java.lang.String, com.goldencode.p2j.util.LegacyJavaAppserverParameter[]) call, clear the argument state, once the call
has finished. |
static character |
getCharacter(int idx)
Get the argument at the specified position, as a
character. |
static handle |
getDataSetHandle(int idx)
Get the argument at the specified position, as a
DATASET-HANDLE. |
static date |
getDate(int idx)
Get the argument at the specified position, as a
date. |
static datetime |
getDatetime(int idx)
Get the argument at the specified position, as a
datetime. |
static datetimetz |
getDatetimetz(int idx)
Get the argument at the specified position, as a
datetimetz. |
static decimal |
getDecimal(int idx)
Get the argument at the specified position, as a
decimal. |
static int64 |
getInt64(int idx)
Get the argument at the specified position, as a
int64. |
static integer |
getInteger(int idx)
Get the argument at the specified position, as a
integer. |
static logical |
getLogical(int idx)
Get the argument at the specified position, as a
logical. |
static longchar |
getLongchar(int idx)
Get the argument at the specified position, as a
longchar. |
static memptr |
getMemptr(int idx)
Get the argument at the specified position, as a
memptr. |
static integer |
getNumArguments()
Get the number of arguments sent by the remote side.
|
static java.lang.String |
getParameterType(int idx)
Get the argument's type at the specified index.
|
static raw |
getRaw(int idx)
Get the argument at the specified position, as a
raw. |
static recid |
getRecid(int idx)
Get the argument at the specified position, as a
recid. |
static rowid |
getRowid(int idx)
Get the argument at the specified position, as a
rowid. |
static handle |
getTableHandle(int idx)
Get the argument at the specified position, as a
TABLE-HANDLE. |
(package private) static void |
initializeArguments(int[] argTypes,
java.lang.String modes,
java.lang.Object[] args)
For the
LegacyJavaAppserverClient.invokeWithArgs(java.lang.String, com.goldencode.p2j.util.LegacyJavaAppserverParameter[]) call, initialize the argument state, before the
call was performed. |
static void |
invokeExternalProgram(character name,
character[] ptypes,
java.lang.Object[] args)
Invoke the target external program.
|
static void |
invokeExternalProgram(java.lang.String name,
character[] ptypes,
java.lang.Object[] args)
Invoke the target external program.
|
static java.lang.Object |
invokeMethod(object<? extends _BaseObject_> ref,
character name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
Invoke the target method in the given legacy class instance.
|
static java.lang.Object |
invokeMethod(object<? extends _BaseObject_> ref,
java.lang.String name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
Invoke the target method in the given legacy class instance.
|
static java.lang.Object |
invokeStaticMethod(character clsName,
character name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
Invoke the target static method in the given legacy class.
|
static java.lang.Object |
invokeStaticMethod(character clsName,
java.lang.String name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
Invoke the target static method in the given legacy class.
|
static java.lang.Object |
invokeStaticMethod(java.lang.String clsName,
character name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
Invoke the target static method in the given legacy class.
|
static java.lang.Object |
invokeStaticMethod(java.lang.String clsName,
java.lang.String name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
Invoke the target static method in the given legacy class.
|
static boolean |
isInput(int idx)
Check if the argument at the specified index was sent as INPUT.
|
static boolean |
isInputOutput(int idx)
Check if the argument at the specified index was sent as INPUT-OUTPUT.
|
static boolean |
isOutput(int idx)
Check if the argument at the specified index was sent as OUTPUT.
|
private static java.lang.Object[] |
resolveArgs(java.lang.String modes,
character[] ptypes,
java.lang.Object[] args,
boolean isOO)
Resolve the arguments passed to
invokeExternalProgram(java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]), invokeStaticMethod(java.lang.String, java.lang.String, java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]) or
invokeMethod(com.goldencode.p2j.util.object<? extends com.goldencode.p2j.oo.lang._BaseObject_>, java.lang.String, java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]), so that they can be passed to the target invocation. |
private static void |
securityCheck(LegacyOpenClientCaller.WorkArea wa)
Check if the call is being performed in the context of the OpenClient call.
|
private static void |
securityCheck(LegacyOpenClientCaller.WorkArea wa,
boolean root)
Check if the call is being performed in the context of the OpenClient call.
|
static void |
setArgument(int idx,
BaseDataType val)
Set the argument at the specified position.
|
static void |
setArguments(java.lang.Object... args)
Store all the OUTPUT or INPUT-OUTPUT arguments received in the given array to be transferred back to the
caller.
|
static void |
setCharacter(int idx,
character val)
Set the argument at the specified position, as a
character. |
static void |
setDataSetHandle(int idx,
handle val)
Set the argument at the specified position, as a
DATASET-HANDLE. |
static void |
setDate(int idx,
date val)
Set the argument at the specified position, as a
date. |
static void |
setDatetime(int idx,
datetime val)
Set the argument at the specified position, as a
datetime. |
static void |
setDatetimetz(int idx,
datetimetz val)
Set the argument at the specified position, as a
datetimetz. |
static void |
setDecimal(int idx,
decimal val)
Set the argument at the specified position, as a
decimal. |
static void |
setInt64(int idx,
int64 val)
Set the argument at the specified position, as a
int64. |
static void |
setInteger(int idx,
integer val)
Set the argument at the specified position, as a
integer. |
static void |
setLogical(int idx,
logical val)
Set the argument at the specified position, as a
logical. |
static void |
setLongchar(int idx,
longchar val)
Set the argument at the specified position, as a
longchar. |
static void |
setMemptr(int idx,
memptr val)
Set the argument at the specified position, as a
memptr. |
static void |
setRaw(int idx,
raw val)
Set the argument at the specified position, as a
raw. |
static void |
setRecid(int idx,
recid val)
Set the argument at the specified position, as a
recid. |
static void |
setRowid(int idx,
rowid val)
Set the argument at the specified position, as a
rowid. |
static void |
setTableHandle(int idx,
handle val)
Set the argument at the specified position, as a
TABLE-HANDLE. |
private static java.lang.Object |
toJava(LegacyOpenClientCaller.WorkArea wa,
int idx,
int argType,
java.lang.Object arg)
For a setter, convert the given argument to its representation so it can be sent back to the remote
side.
|
private static BaseDataType |
toLegacy(LegacyOpenClientCaller.WorkArea wa,
int idx)
Get the argument at the given 1-based index in a
BaseDataType form, used by the legacy converted
code. |
private static void |
validateIndex(LegacyOpenClientCaller.WorkArea wa,
int idx)
Validate the given index to be in the
LegacyOpenClientCaller.WorkArea.arguments range. |
private static void |
validateIndex(LegacyOpenClientCaller.WorkArea wa,
int idx,
boolean validateBound)
Validate the given index to be in the
LegacyOpenClientCaller.WorkArea.arguments range. |
private static final ContextLocal<LegacyOpenClientCaller.WorkArea> local
public static void asDataSetParameter(int idx,
handle dataset)
This will act as if the given dataset reference has been defined as a parameter for the external program.
idx - The 1-based index for the argument.dataset - The handle to a static dataset or a handle where to store the dynamic dataset, otherwise.public static void asTableParameter(int idx,
handle table)
This will act as if the given DMO reference has been defined as a parameter for the external program.
idx - The 1-based index for the argument.table - The handle to a static temp-table or a handle where to store the dynamic temp-table, otherwise.public static integer getNumArguments()
public static boolean isInput(int idx)
idx - The 1-based index for the argument.true if the argument's mode is INPUT.public static boolean isOutput(int idx)
idx - The 1-based index for the argument.true if the argument's mode is OUTPUT.public static boolean isInputOutput(int idx)
idx - The 1-based index for the argument.true if the argument's mode is INPUT-OUTPUT.public static java.lang.String getParameterType(int idx)
idx - The 1-based index for the argument.public static void invokeExternalProgram(java.lang.String name,
character[] ptypes,
java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
name - The target external program.ptypes - The argument data-types.args - The arguments.public static void invokeExternalProgram(character name, character[] ptypes, java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
name - The target external program.ptypes - The argument data-types.args - The arguments.public static java.lang.Object invokeStaticMethod(java.lang.String clsName,
java.lang.String name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
clsName - The target legacy class name.modes - The argument modes.ptypes - The argument data-types.args - The arguments.public static java.lang.Object invokeStaticMethod(character clsName, java.lang.String name, java.lang.String modes, character[] ptypes, java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
clsName - The target legacy class name.modes - The argument modes.ptypes - The argument data-types.args - The arguments.public static java.lang.Object invokeStaticMethod(java.lang.String clsName,
character name,
java.lang.String modes,
character[] ptypes,
java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
clsName - The target legacy class name.modes - The argument modes.ptypes - The argument data-types.args - The arguments.public static java.lang.Object invokeStaticMethod(character clsName, character name, java.lang.String modes, character[] ptypes, java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
clsName - The target legacy class name.modes - The argument modes.ptypes - The argument data-types.args - The arguments.public static java.lang.Object invokeMethod(object<? extends _BaseObject_> ref, java.lang.String name, java.lang.String modes, character[] ptypes, java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
ref - The target instance.name - The target legacy method name.modes - The argument modes.ptypes - The argument data-types.args - The arguments.public static java.lang.Object invokeMethod(object<? extends _BaseObject_> ref, character name, java.lang.String modes, character[] ptypes, java.lang.Object[] args)
The argument types must be specified, so FWD runtime can build the proper argument for i.e. TABLE-HANDLE or DATASET-HANDLE.
ref - The target instance.name - The target legacy method name.modes - The argument modes.ptypes - The argument data-types.args - The arguments.public static handle getTableHandle(int idx)
TABLE-HANDLE.idx - The 1-based argument index.public static void setTableHandle(int idx,
handle val)
TABLE-HANDLE.idx - The 1-based argument index.val - The argument's value.public static handle getDataSetHandle(int idx)
DATASET-HANDLE.idx - The 1-based argument index.public static void setDataSetHandle(int idx,
handle val)
DATASET-HANDLE.idx - The 1-based argument index.val - The argument's value.public static memptr getMemptr(int idx)
memptr.idx - The 1-based argument index.public static void setMemptr(int idx,
memptr val)
memptr.idx - The 1-based argument index.val - The argument's value.public static integer getInteger(int idx)
integer.idx - The 1-based argument index.public static void setInteger(int idx,
integer val)
integer.idx - The 1-based argument index.val - The argument's value.public static int64 getInt64(int idx)
int64.idx - The 1-based argument index.public static void setInt64(int idx,
int64 val)
int64.idx - The 1-based argument index.val - The argument's value.public static decimal getDecimal(int idx)
decimal.idx - The 1-based argument index.public static void setDecimal(int idx,
decimal val)
decimal.idx - The 1-based argument index.val - The argument's value.public static character getCharacter(int idx)
character.idx - The 1-based argument index.public static void setCharacter(int idx,
character val)
character.idx - The 1-based argument index.val - The argument's value.public static longchar getLongchar(int idx)
longchar.idx - The 1-based argument index.public static void setLongchar(int idx,
longchar val)
longchar.idx - The 1-based argument index.val - The argument's value.public static logical getLogical(int idx)
logical.idx - The 1-based argument index.public static void setLogical(int idx,
logical val)
logical.idx - The 1-based argument index.val - The argument's value.public static date getDate(int idx)
date.idx - The 1-based argument index.public static void setDate(int idx,
date val)
date.idx - The 1-based argument index.val - The argument's value.public static datetime getDatetime(int idx)
datetime.idx - The 1-based argument index.public static void setDatetime(int idx,
datetime val)
datetime.idx - The 1-based argument index.val - The argument's value.public static datetimetz getDatetimetz(int idx)
datetimetz.idx - The 1-based argument index.public static void setDatetimetz(int idx,
datetimetz val)
datetimetz.idx - The 1-based argument index.val - The argument's value.public static recid getRecid(int idx)
recid.idx - The 1-based argument index.public static void setRecid(int idx,
recid val)
recid.idx - The 1-based argument index.val - The argument's value.public static raw getRaw(int idx)
raw.idx - The 1-based argument index.public static void setRaw(int idx,
raw val)
raw.idx - The 1-based argument index.val - The argument's value.public static rowid getRowid(int idx)
rowid.idx - The 1-based argument index.public static void setRowid(int idx,
rowid val)
rowid.idx - The 1-based argument index.val - The argument's value.public static void setArgument(int idx,
BaseDataType val)
idx - The 1-based argument index.val - The argument's value.public static void setArguments(java.lang.Object... args)
args - The arguments.static void initializeArguments(int[] argTypes,
java.lang.String modes,
java.lang.Object[] args)
LegacyJavaAppserverClient.invokeWithArgs(java.lang.String, com.goldencode.p2j.util.LegacyJavaAppserverParameter[]) call, initialize the argument state, before the
call was performed.argTypes - The argument types.modes - The argument modes.args - The arguments.static void clearArguments()
LegacyJavaAppserverClient.invokeWithArgs(java.lang.String, com.goldencode.p2j.util.LegacyJavaAppserverParameter[]) call, clear the argument state, once the call
has finished.private static java.lang.Object toJava(LegacyOpenClientCaller.WorkArea wa, int idx, int argType, java.lang.Object arg)
wa - The context-local instance.idx - The 0-based argument index.argType - The argument type, one of the LegacyJavaAppserverApi.integer() APIs.arg - The argument instance.LegacyOpenClientCaller.WorkArea.arguments, to be sent
back to the remote side.private static BaseDataType toLegacy(LegacyOpenClientCaller.WorkArea wa, int idx)
BaseDataType form, used by the legacy converted
code.wa - The context-local instance.idx - The 1-based argument index.private static java.lang.Object[] resolveArgs(java.lang.String modes,
character[] ptypes,
java.lang.Object[] args,
boolean isOO)
invokeExternalProgram(java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]), invokeStaticMethod(java.lang.String, java.lang.String, java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]) or
invokeMethod(com.goldencode.p2j.util.object<? extends com.goldencode.p2j.oo.lang._BaseObject_>, java.lang.String, java.lang.String, com.goldencode.p2j.util.character[], java.lang.Object[]), so that they can be passed to the target invocation.modes - The argument modes.ptypes - The string-representation of the argument types.args - The arguments.isOO - Flag indicating if this is a OO call.private static void validateIndex(LegacyOpenClientCaller.WorkArea wa, int idx)
LegacyOpenClientCaller.WorkArea.arguments range.wa - The context-local instance.idx - The 1-based index.private static void validateIndex(LegacyOpenClientCaller.WorkArea wa, int idx, boolean validateBound)
LegacyOpenClientCaller.WorkArea.arguments range.wa - The context-local instance.idx - The 1-based index.validateBound - Flag indicating if the LegacyOpenClientCaller.WorkArea.boundArguments needs to be false.private static void securityCheck(LegacyOpenClientCaller.WorkArea wa)
ProcedureManager.ProcedureHelper._thisProcedure() must be the same as ProcedureManager.ProcedureHelper._rootProcedure().wa - The context-local instance.root - Flag indicating we must be in the root external block.private static void securityCheck(LegacyOpenClientCaller.WorkArea wa, boolean root)
ProcedureManager.ProcedureHelper._thisProcedure() must be the same as ProcedureManager.ProcedureHelper._rootProcedure().wa - The context-local instance.root - Flag indicating we must be in the root external block.