XPRDMosel
- java.lang.Object
-
- com.dashoptimization.XPRDMosel
-
public class XPRDMosel extends java.lang.Object
A Mosel remote instance.
-
-
Field Summary
Modifier and Type Field and Description java.lang.String
encoding
Character encoding used by this Mosel instance.static int
F_APPEND
Code for opening the file in append mode (output stream).static int
F_BINARY
Code for opening file in binary mode.static int
F_ERROR
Code for error stream.static int
F_INPUT
Code for input stream.static int
F_LINBUF
Code for enabling line buffering (output stream).static int
F_OUTPUT
Code for output stream.static int
SYS_ARCH
Processor architecture of the host running the instance.static int
SYS_NAME
Name of the operating system running the instance.static int
SYS_NODE
Name of host running the instance.static int
SYS_PID
Porcess ID of the instance.static int
SYS_PROC
Processor type of the host running the instance.static int
SYS_RAM
Total amount of memory in megabytes of the host running the instance.static int
SYS_REL
Release number of the operating system running the instance.static int
SYS_VER
Version name of the operating system running the instance.
-
Method Summary
Modifier and Type Method and Description void
compile(java.lang.String options, java.lang.String src, java.lang.String dest)
Compile a model source file.void
compile(java.lang.String options, java.lang.String src, java.lang.String dest, java.lang.String ucom, java.lang.String pass, java.lang.String privkey, java.lang.String pubkeys)
Compile a model source file.int
disconnect()
Disconnect the instance.java.lang.String
getBanner()
Get the connection bannerint
getId()
Get the ID of the instancejava.lang.String
getSystemInformation()
Retrieve information about the system running the instance.java.lang.String
getSystemInformation(int what)
Retrieve information about the system running the instance.XPRD
getXPRD()
Get the XPRD object managing this instance.boolean
isConnected()
Check whether this instance is connected.XPRDModel
loadModel(java.lang.String name)
Load a compiled model into memory.XPRDModel
loadModel(java.lang.String name, java.lang.String options, java.lang.String pass, java.lang.String privkey, java.lang.String pubkeys)
Load a compiled model into memory.java.io.InputStream
openForReading(java.lang.String fname, int mode)
Open a file for reading operations on the instance.java.io.InputStream
openForReading(java.lang.String fname, int mode, int bufsize)
Open a file for reading operations on the instance with buffer size.java.io.BufferedOutputStream
openForWriting(java.lang.String fname, int mode)
Open a file for writing operations on the instance.java.io.BufferedOutputStream
openForWriting(java.lang.String fname, int mode, int bufsize)
Open a file for writing operations on the instance with buffer size.void
setControl(java.lang.String name, java.lang.String val)
Set a Mosel instance control parameter for the instance.void
setDefaultStream(int wmd, java.lang.String fileName)
Set default input/output streams.void
unloadModel(XPRDModel mod)
Unload a previously loaded model.
-
-
-
Field Detail
-
encoding
public final java.lang.String encoding
Character encoding used by this Mosel instance.
-
F_INPUT
public static final int F_INPUT
Code for input stream.
-
F_OUTPUT
public static final int F_OUTPUT
Code for output stream.
-
F_ERROR
public static final int F_ERROR
Code for error stream.
-
F_LINBUF
public static final int F_LINBUF
Code for enabling line buffering (output stream).
-
F_BINARY
public static final int F_BINARY
Code for opening file in binary mode.
-
F_APPEND
public static final int F_APPEND
Code for opening the file in append mode (output stream).
-
SYS_NAME
public static final int SYS_NAME
Name of the operating system running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_REL
public static final int SYS_REL
Release number of the operating system running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_VER
public static final int SYS_VER
Version name of the operating system running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_PROC
public static final int SYS_PROC
Processor type of the host running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_ARCH
public static final int SYS_ARCH
Processor architecture of the host running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_NODE
public static final int SYS_NODE
Name of host running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_RAM
public static final int SYS_RAM
Total amount of memory in megabytes of the host running the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
SYS_PID
public static final int SYS_PID
Porcess ID of the instance.- See Also:
-
getSystemInformation(int)
, Constant Field Values
-
-
Method Detail
-
disconnect
public int disconnect()
Disconnect the instance.- Returns:
- exit status of the instance or -1 if the instance is not connected
-
isConnected
public boolean isConnected()
Check whether this instance is connected.- Returns:
-
true
if the instance is connected
-
getXPRD
public XPRD getXPRD()
Get the XPRD object managing this instance.- Returns:
-
the associated XPRD or
null
if the instance is not connected
-
getSystemInformation
public java.lang.String getSystemInformation(int what)
Retrieve information about the system running the instance.
-
getSystemInformation
public java.lang.String getSystemInformation()
Retrieve information about the system running the instance.- Returns:
- Text string reporting the requested information
-
compile
public void compile(java.lang.String options, java.lang.String src, java.lang.String dest) throws XPRDCompileException, java.io.IOException
Compile a model source file. This method compiles a given model source file into a binary model file (bim file) that is required as input to methodloadModel(java.lang.String)
for loading the model.- Parameters:
-
options
- compilation options (may benull
):"g"
include debugging information: in the case of a run time error during the execution of the model the location of the error in the source file may be indicated"s"
strip symbols: secure the bim file by removing all private symbol names used in the source model"p"
parse only: stop after the syntax analysis of the source file, do not compile (no file generated)
-
src
- name of the source file -
dest
- name of the output (bim) file (may benull
) - Throws:
-
XPRDCompileException
- If compilation fails. -
java.io.IOException
- In case of communication error with the remote instance
-
compile
public void compile(java.lang.String options, java.lang.String src, java.lang.String dest, java.lang.String ucom, java.lang.String pass, java.lang.String privkey, java.lang.String pubkeys) throws XPRDCompileException, java.io.IOException
Compile a model source file. This method compiles a given model source file into a binary model file (bim file) that is required as input to methodloadModel(java.lang.String)
for loading the model.- Parameters:
-
options
- compilation options (may benull
):"g"
include debugging information: in the case of a run time error during the execution of the model the location of the error in the source file may be indicated"s"
strip symbols: secure the bim file by removing all private symbol names used in the source model"p"
parse only: stop after the syntax analysis of the source file, do not compile (no file generated)
-
src
- name of the source file -
dest
- name of the output (bim) file (may benull
) -
ucom
- user comment (may benull
) -
pass
- password file (may benull
) -
privkey
- private key file (may benull
) -
pubkeys
- file of public keys (may benull
) - Throws:
-
XPRDCompileException
- If compilation fails. -
java.io.IOException
- In case of communication error with the remote instance
-
setDefaultStream
public void setDefaultStream(int wmd, java.lang.String fileName) throws java.io.IOException
Set default input/output streams. This method defines the default global streams: they are used as the default when a model is loaded and whenever no model information is available (e.g. compilation errors, error on modules, etc). The method can be used only if no model is currently loaded in memory.
Using an empty string as the file name implies resetting to the corresponding original default stream.- Parameters:
-
wmd
- stream to be set: -
fileName
- extended file name to be used for the stream. The default values are"null:"
for input"rmt:[0]sysfd:1"
for output"rmt:[0]sysfd:2"
for error
- Throws:
-
java.io.IOException
- If the stream cannot be set.
-
setControl
public void setControl(java.lang.String name, java.lang.String val) throws java.io.IOException
Set a Mosel instance control parameter for the instance.- Parameters:
-
name
- name of the parameter. -
val
- value. - Throws:
-
java.io.IOException
- If the control cannot be set (invalid name or value).
-
loadModel
public XPRDModel loadModel(java.lang.String name) throws java.io.IOException
Load a compiled model into memory. This method loads a compiled model (Binary Model file) into memory. While loading a model from a file, Mosel also automatically opens any additional modules that are required by this model.- Parameters:
-
name
- name of a binary model file - Returns:
-
A new model instance of type
XPRDModel
created from a binary model file. - Throws:
-
java.io.IOException
- If the binary model file cannot be found or instance is not connected.
-
loadModel
public XPRDModel loadModel(java.lang.String name, java.lang.String options, java.lang.String pass, java.lang.String privkey, java.lang.String pubkeys) throws java.io.IOException
Load a compiled model into memory. This method loads a compiled model (Binary Model file) into memory. While loading a model from a file, Mosel also automatically opens any additional modules that are required by this model.- Parameters:
-
name
- name of a binary model file -
options
- loader options (may benull
): -
pass
- password file (may benull
) -
privkey
- private key file (may benull
) -
pubkeys
- file of public keys (may benull
) - Returns:
-
A new model instance of type
XPRDModel
created from a binary model file. - Throws:
-
java.io.IOException
- If the binary model file cannot be found or instance is not connected.
-
getBanner
public java.lang.String getBanner()
Get the connection banner- Returns:
- message displayed by the instance upon connection
-
getId
public int getId()
Get the ID of the instance- Returns:
- node number associated to the instance
-
unloadModel
public void unloadModel(XPRDModel mod) throws java.io.IOException
Unload a previously loaded model. After this method has been called, the corresponding model can no longer be used.- Parameters:
-
mod
- model to be unloaded - Throws:
-
java.io.IOException
- If the model is running.
-
openForWriting
public java.io.BufferedOutputStream openForWriting(java.lang.String fname, int mode) throws java.io.IOException
Open a file for writing operations on the instance.- Parameters:
-
fname
- file name -
mode
- open mode - Returns:
- an OutputStream
- Throws:
-
java.io.IOException
- if the file cannot be open
-
openForWriting
public java.io.BufferedOutputStream openForWriting(java.lang.String fname, int mode, int bufsize) throws java.io.IOException
Open a file for writing operations on the instance with buffer size.- Parameters:
-
fname
- file name -
mode
- open mode -
bufsize
- buffer size in kilobytes (from 2 to 63) - Returns:
- an OutputStream
- Throws:
-
java.io.IOException
- if the file cannot be open
-
openForReading
public java.io.InputStream openForReading(java.lang.String fname, int mode) throws java.io.IOException
Open a file for reading operations on the instance.- Parameters:
-
fname
- file name -
mode
- open mode - Returns:
- an InputStream
- Throws:
-
java.io.IOException
- if the file cannot be open
-
openForReading
public java.io.InputStream openForReading(java.lang.String fname, int mode, int bufsize) throws java.io.IOException
Open a file for reading operations on the instance with buffer size.- Parameters:
-
fname
- file name -
mode
- open mode -
bufsize
- buffer size in kilobytes (from 2 to 63) - Returns:
- an InputStream
- Throws:
-
java.io.IOException
- if the file cannot be open
-
-
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.