public class EngineStub extends Object
The EngineStub class takes care of connecting to and disconnecting from the server. Connections can be local and remote. For local (aka. native) connections, the server process is started by the engine stub on the local machine and communication is handled via pipes. On disconnect the server process is killed. Remote connections do not start a server. Instead, the stub will try to connect to a running server.
The serverHost and serverPort properties determine which host and on which port to connect to the server for remote connections. The connectionMode is used to determine the kind of connection to establish. If connectionMode is BOTH, then the stub will first attempt to create a remote connection and if that fails create a local connection. The serverPath holds the name of the server executable to execute in local mode. After a successful connection has been established the port to which the connection has been established can be queried with getConnectedPort(). Notice that the serverPort property plays no role for local connections.
The server protocol is not state less, as there is a notion of uploading a model and certain operations are only valid after uploading a model. You most likely want to use the Engine class rather than the EngineStub.
Modifier and Type | Field and Description |
---|---|
static int |
BOTH
Try remote connection first, then local.
|
static String |
DEFAULT_HOST
The default host for remote connections.
|
static int |
DEFAULT_PORT
The default port for remote connections.
|
static int |
LOCAL
Local connections only.
|
static int |
SERVER
Remote connections only..
|
Constructor and Description |
---|
EngineStub()
Constructs an EngineStub in LOCAL connection mode.
|
EngineStub(int mode,
int port,
String host,
String path)
Constructs an EngineStub with the given mode, port, port and server path
values.
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connect to the server.
|
void |
disconnect()
Disconnect from the server.
|
ConcreteState |
getConcreteInitial(UppaalSystem system)
Returns the initial concrete state for the system.
|
ConcreteSuccessor |
getConcreteSuccessor(UppaalSystem system,
ConcreteState state,
SystemEdgeSelect[] edges,
BigDecimal currentTime,
BigDecimal delay)
Get the concrete successor
|
int |
getConnectedPort()
Returns the port the engine is connected to.
|
int |
getConnectionMode()
Returns the current connection mode.
|
String |
getErrorStream()
Snapshot of an error stream from the (local) server process.
|
GanttChart |
getGanttChart(UppaalSystem system,
BigDecimal globalTime)
Get the gantt chart
|
String |
getOptionsInfo()
Returns information about available options.
|
String |
getServerHost()
Returns the current server host.
|
String |
getServerPath()
Returns the current server path.
|
int |
getServerPort()
Returns the current server port.
|
SymbolicState |
getSymbolicInitial(UppaalSystem system)
Returns the initial state for the system.
|
ArrayList<SymbolicTransition> |
getTransitions(UppaalSystem system,
SymbolicState state)
Returns the list of outgoing transitions for the state.
|
String |
getVersion()
Returns the version string of the server.
|
void |
handshake()
Performs a handshake with the server.
|
boolean |
isConnected()
Returns true if the engine is connected to a server.
|
boolean |
isRemoteConnection()
Returns true if the engine is connected to a remote server.
|
void |
kill()
Kill the server connection the hard way.
|
QueryVerificationResult |
query(UppaalSystem system,
Query query,
QueryFeedback f)
Verify a query on an instantiated UPPAAL model.
|
void |
setConnectionMode(int mode)
Sets the connection mode.
|
void |
setOptions(String options)
Sets server options used for verification.
|
void |
setServerHost(String host)
Sets the server host.
|
void |
setServerPath(String path)
Sets the server path.
|
void |
setServerPort(int port)
Sets the server port.
|
UppaalSystem |
upload(Document document)
Upload the document to the server.
|
UppaalSystem |
upload(Document document,
ArrayList<Problem> problems)
Upload the document to the server.
|
LscProcess |
uploadLsc(Document document,
ArrayList<Problem> problems)
Upload the lsc process to the server.
|
public static int LOCAL
public static int SERVER
public static int BOTH
public static String DEFAULT_HOST
public static int DEFAULT_PORT
public EngineStub()
public String getErrorStream()
public int getServerPort()
public void setServerPort(int port)
port
- - The port numberpublic int getConnectionMode()
public void setConnectionMode(int mode)
mode
- - The connection modepublic String getServerHost()
public void setServerHost(String host)
host
- - The host stringpublic String getServerPath()
public int getConnectedPort()
public void setServerPath(String path)
path
- - The server pathpublic boolean isConnected()
public boolean isRemoteConnection()
public void connect() throws EngineException, IOException
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.public void disconnect()
public void kill()
public void handshake() throws IOException, EngineException
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.public String getVersion() throws IOException, EngineException
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.public String getOptionsInfo() throws EngineException, IOException
IOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.public void setOptions(String options) throws EngineException, IOException
options
- - The server optionsIOException
- engine crash or problem in communication.EngineException
- problem in the Uppaal engine.public SymbolicState getSymbolicInitial(UppaalSystem system) throws EngineException, IOException, CannotEvaluateException
system
- - The uppaal systemIOException
- I/O communication error.EngineException
- error in the server protocol.CannotEvaluateException
- some expression could not be evaluated.public ConcreteState getConcreteInitial(UppaalSystem system) throws EngineException, IOException, CannotEvaluateException
system
- - The uppaal systemIOException
- I/O communication error.EngineException
- error in the server protocol.CannotEvaluateException
- some expression could not be evaluated.public ConcreteSuccessor getConcreteSuccessor(UppaalSystem system, ConcreteState state, SystemEdgeSelect[] edges, BigDecimal currentTime, BigDecimal delay) throws EngineException, IOException, CannotEvaluateException
system
- - The uppaal systemstate
- - The concrete stateedges
- - The array of the selected system edgecurrentTime
- - The current timedelay
- - The delay valueIOException
- I/O communication error.EngineException
- error in the server protocol.CannotEvaluateException
- some expression could not be evaluated.public GanttChart getGanttChart(UppaalSystem system, BigDecimal globalTime) throws EngineException, IOException
system
- - The uppaal systemglobalTime
- - The global timeIOException
- I/O communication error.EngineException
- error in the server protocol.public ArrayList<SymbolicTransition> getTransitions(UppaalSystem system, SymbolicState state) throws EngineException, IOException, CannotEvaluateException
system
- - The uppaal systemstate
- - symbolic state of the systemIOException
- I/O communication error.EngineException
- error in the server protocol.CannotEvaluateException
- some expression could not be evaluated.public UppaalSystem upload(Document document, ArrayList<Problem> problems) throws EngineException, IOException
document
- - The documentproblems
- - The list of the error reports that are stored in the
problems vector.IOException
- I/O communication error.EngineException
- error in the server protocol.public LscProcess uploadLsc(Document document, ArrayList<Problem> problems) throws EngineException, IOException
document
- - The documentproblems
- - The list of the error reports that are stored in the
problems vector.IOException
- I/O communication error.EngineException
- error in the server protocol.public UppaalSystem upload(Document document) throws EngineException, IOException
document
- - The documentIOException
- I/O communication error.EngineException
- error in the server protocol.public QueryVerificationResult query(UppaalSystem system, Query query, QueryFeedback f) throws EngineException, IOException
system
- - The uppaal systemquery
- - The queryf
- - The feedback of the query from a verifier.IOException
- I/O communication error.EngineException
- error in the server protocol.Copyright © 2014 Uppsala University and Aalborg University. All Rights Reserved.