public class ClientCore
extends java.lang.Object
This code provides supports the startup of a client session within the same process as the server. This can be used to duplicate the traditional Progress 4GL fat client approach (a "single process" mode). It can also be used to implement multiple client sessions within a true server process which would be used to support web-based clients.
Modifier and Type | Field and Description |
---|---|
private static boolean |
nativeLayerInitialized
Flag to prevent multiple native library loading.
|
Constructor and Description |
---|
ClientCore() |
Modifier and Type | Method and Description |
---|---|
private static BootstrapConfig |
buildTemporaryClientConfig(BootstrapConfig config)
Build a separate BootstrapConfig for temporary clients.
|
private static long |
getPid()
Native call to read the operating system pid for the current JVM process.
|
private static java.lang.String |
getUserName()
Native call to read the operating system user name for the current JVM process.
|
private static void |
initLogging(boolean toFile)
Initialize logging at a detailed level for the infrastructure packages.
|
static boolean |
isCauseStop(java.lang.Throwable chained)
Inspect the chain of exceptions and report if any of them are STOP
conditions.
|
private static void |
loadNativeLibrary()
Loads native library and performs required initial steps for P2J library to working.
|
private static ClientParameters |
processClientParams(ScreenDriver<?> driver,
BootstrapConfig config)
Pull the client parameters from the driver and bootstrap configuration and initialize
a parameters object with the resulting data.
|
private static void |
processInit()
Native call to set up and redefine signal processing handlers.
|
private static ScreenDriver<?> |
processTemporaryClient(java.lang.String uuid,
BootstrapConfig config)
Establish a direct connection using the temporary credentials and perform custom work,
depending on the
TemporaryClient implementation returned by
Spawner.getTemporaryClient(java.lang.String) . |
static void |
start(BootstrapConfig config,
boolean file)
Start the client loop.
|
static void |
start(BootstrapConfig config,
boolean file,
boolean single)
Start the client loop.
|
private static boolean nativeLayerInitialized
public static void start(BootstrapConfig config, boolean file) throws java.lang.Exception
This method implements the full, normal client JVM startup and cannot be used within the server process.
config
- The configuration to use for setup of the client and for the
server connection.file
- true
to direct logging to file. false
for console logging.java.lang.Exception
public static void start(BootstrapConfig config, boolean file, boolean single) throws java.lang.Exception
config
- The configuration to use for setup of the client and for the
server connection.file
- true
to direct logging to file. false
for console logging.single
- true
to startup within the server process which
must bypass the shared infrastructure initialization. Use
false
for the normal client JVM startup.java.lang.Exception
public static boolean isCauseStop(java.lang.Throwable chained)
chained
- The top of the chain of exceptions.true
if any of the exceptions in the chain are
STOP conditions.private static void loadNativeLibrary()
private static void processInit()
private static long getPid()
private static java.lang.String getUserName()
private static void initLogging(boolean toFile)
toFile
- true
to direct logging to file. false
for console logging.private static BootstrapConfig buildTemporaryClientConfig(BootstrapConfig config)
config
- Client bootstrap configuration.private static ClientParameters processClientParams(ScreenDriver<?> driver, BootstrapConfig config)
driver
- The primary UI driver for this client session.config
- The bootstrap configuration for this session (this must have been previously
merged with any command line overrides).private static ScreenDriver<?> processTemporaryClient(java.lang.String uuid, BootstrapConfig config) throws java.lang.Exception
TemporaryClient
implementation returned by
Spawner.getTemporaryClient(java.lang.String)
.uuid
- Remote client identifier uuid.config
- The configuration to use for setup of the client and for the server connection.TemporaryClient.doWork(com.goldencode.p2j.main.Spawner, java.lang.String, com.goldencode.p2j.cfg.BootstrapConfig)
.java.lang.Exception
- If something goes wrong.