Package com.parctechnologies.eclipse
Class OutOfProcessEclipse
java.lang.Object
com.parctechnologies.eclipse.OutOfProcessEclipse
- All Implemented Interfaces:
EclipseConnection,EclipseEngine
An ECLiPSe engine which runs in a child process of the Java virtual machine.
An OutOfProcessEclipse is created using the public constructor, which
takes an EclipseEngineOptions object. A JVM may have any number of
instances of this class. Invocation of the
destroy() method does
not affect the ability to create new OutOfProcessEclipse instances.-
Constructor Summary
ConstructorsConstructorDescriptionOutOfProcessEclipse(EclipseEngineOptions options) Create a new OutOfProcessEclipse using the supplied options. -
Method Summary
Modifier and TypeMethodDescriptionvoidDirect ECLiPSe to compile a named object file.voiddestroy()Terminate the OutOfProcessEclipse process and the connection to it.getAsyncEclipseQueue(String name) Create or access an asynchronous queue to transfer data between Java and ECLiPSe.Return a FromEclipseQueue which allows access to the ECLiPSe engine'sstderrstream.Return a ToEclipseQueue which allows access to the ECLiPSe engine'sstdinstream.Return a FromEclipseQueue which allows access to the ECLiPSe engine'sstdoutstream.getFromEclipseQueue(String name) Create or access a queue to transfer data from ECLiPSe to Java.Convert a file path from the Java representation to the ECLiPSe representation.Return the name by which the peer representing the Java side of the connection is indexed in ECLiPSe.getToEclipseQueue(String name) Create or access a queue to transfer data from Java to ECLiPSe.booleanQuery the ECLiPSe engine's "use queues" flag.registerMultitask(MultitaskListener multitaskListener) Register this peer as desiring participation in any multitasking phases that ECLiPSe enters.rpc(CompoundTerm goal) Make an "RPC" (remote predicate call) to the ECLiPSe engine.Conveniencerpcmethod.Make an "RPC" (remote predicate call) to the ECLiPSe engine.Conveniencerpcmethod.Conveniencerpcmethod.Conveniencerpcmethod.Conveniencerpcmethod.Conveniencerpcmethod.Conveniencerpcmethod.
-
Constructor Details
-
OutOfProcessEclipse
Create a new OutOfProcessEclipse using the supplied options.- Parameters:
options- settings for the new ECLiPSe engine.- Throws:
IOException- if the connection to the child process failedEclipseException- if there was a problem setting up the ECLiPSe side of the connection.
-
-
Method Details
-
isUsingQueues
public boolean isUsingQueues()Description copied from interface:EclipseEngineQuery the ECLiPSe engine's "use queues" flag. If true, ECLiPSe's standard streams (stdin, stdout and stderr) have been linked to FromEclipseQueue/ToEclipseQueue objects: if false, they have been linked to the operating system standard streams.- Specified by:
isUsingQueuesin interfaceEclipseEngine
-
getEclipseStdin
Description copied from interface:EclipseEngineReturn a ToEclipseQueue which allows access to the ECLiPSe engine'sstdinstream. Returns null if the ECLiPSe was not set up to use queue objects for its standard streams (seeEclipseEngineOptions).- Specified by:
getEclipseStdinin interfaceEclipseEngine- Throws:
EclipseTerminatedException- if the ECLiPSe engine has been destroyed or disconnected.
-
getEclipseStdout
Description copied from interface:EclipseEngineReturn a FromEclipseQueue which allows access to the ECLiPSe engine'sstdoutstream. Returns null if the ECLiPSe was not set up to use queue objects for its standard streams (seeEclipseEngineOptions).- Specified by:
getEclipseStdoutin interfaceEclipseEngine- Throws:
EclipseTerminatedException- if the ECLiPSe engine has been destroyed.
-
getEclipseStderr
Description copied from interface:EclipseEngineReturn a FromEclipseQueue which allows access to the ECLiPSe engine'sstderrstream. Returns null if the ECLiPSe was not set up to use queue objects for its standard streams (seeEclipseEngineOptions).- Specified by:
getEclipseStderrin interfaceEclipseEngine- Throws:
EclipseTerminatedException- if the ECLiPSe engine has been destroyed.
-
destroy
Terminate the OutOfProcessEclipse process and the connection to it. Afterdestroy()has been invoked, future invocations of public methods will throw EclipseTerminatedExceptions- Throws:
EclipseTerminatedException- if thedestroy()method had already been called.IOException
-
rpc
Description copied from interface:EclipseConnectionMake an "RPC" (remote predicate call) to the ECLiPSe engine.- Specified by:
rpcin interfaceEclipseConnection- Parameters:
goal- the goal as it would be typed in on the ECLiPSe command line, (the full stop is unnecessary).- Returns:
- a CompoundTerm representing the goal, with any variables possibly further instantiated with the results of the computation.
- Throws:
EclipseException- if execution of the goal fails or throws an ECLiPSe exception.IOException- if there was an I/O problem communicating with the ECLiPSe engine.
-
rpc
Description copied from interface:EclipseConnectionMake an "RPC" (remote predicate call) to the ECLiPSe engine.- Specified by:
rpcin interfaceEclipseConnection- Parameters:
goal- the goal represented as a CompoundTerm.- Returns:
- a CompoundTerm representing the goal, with any variables possibly further instantiated with the results of the computation.
- Throws:
EclipseException- if execution of the goal fails or throws an ECLiPSe exception.IOException- if there was an I/O problem communicating with the ECLiPSe engine.
-
getFromEclipseQueue
Description copied from interface:EclipseConnectionCreate or access a queue to transfer data from ECLiPSe to Java. If a FromEclipseQueue with this name has already been created for this EclipseConnection, it is returned. The supplied name should not be in use by any ECLiPSe stream which is not a FromEclipseQueue between ECLiPSe and this EclipseConnection: if it is, an EclipseException is thrown. Otherwise, a new FromEclipseQueue with the specified name is returned.- Specified by:
getFromEclipseQueuein interfaceEclipseConnection- Parameters:
name- the name to be used for the stream representing the queue on the ECLiPSe side.- Returns:
- a FromEclipseQueue object which can be used by Java to read data on the queue which was written there by ECLiPSe.
- Throws:
EclipseException- if the name for the ECLiPSe stream is already in use, or ECLiPSe could not create its side of the queue for some reason.IOException- if there was an I/O problem while accessing ECLiPSe.
-
getToEclipseQueue
Description copied from interface:EclipseConnectionCreate or access a queue to transfer data from Java to ECLiPSe. If a ToEclipseQueue with this name has already been created for this EclipseConnection, it is returned. The supplied name should not be in use by any ECLiPSe stream which is not a ToEclipseQueue between ECLiPSe and this EclipseConnection: if it is, an EclipseException is thrown. Otherwise, a new ToEclipseQueue with the specified name is returned.- Specified by:
getToEclipseQueuein interfaceEclipseConnection- Parameters:
name- the name to be used for the stream representing the queue on the ECLiPSe side.- Returns:
- a ToEclipseQueue object which can be used by Java to write data on the queue which can be read by ECLiPSe.
- Throws:
EclipseException- if the name for the ECLiPSe stream is already in use, or ECLiPSe could not create its side of the queue for some reason.IOException- if there was an I/O problem while accessing ECLiPSe.
-
getAsyncEclipseQueue
Description copied from interface:EclipseConnectionCreate or access an asynchronous queue to transfer data between Java and ECLiPSe. If an AsyncEclipseQueue with this name has already been created for this EclipseConnection, it is returned. The supplied name should not be in use by any ECLiPSe stream which is not a AsyncEclipseQueue between ECLiPSe and this EclipseConnection: if it is, an EclipseException is thrown. Otherwise, a new AsyncEclipseQueue with the specified name is returned.- Specified by:
getAsyncEclipseQueuein interfaceEclipseConnection- Parameters:
name- the name to be used for the stream representing the queue on the ECLiPSe side.- Returns:
- a AsyncEclipseQueue object which can be used by Java to obtain an InputStream object (which can be used to read data from the queue which was written there by ECLiPSe) and/or an OutputStream object (which can be used to write data on the queue which can be read by ECLiPSe).
- Throws:
EclipseException- if the name for the ECLiPSe stream is already in use, or ECLiPSe could not create its side of the queue for some reason.IOException- if there was an I/O problem while accessing ECLiPSe.
-
compile
Description copied from interface:EclipseConnectionDirect ECLiPSe to compile a named object file.- Specified by:
compilein interfaceEclipseConnection- Parameters:
f- file the path of the ECLiPSe object file which is to be compiled.- Throws:
EclipseException- if ECLiPSe failed or threw an exception whilst trying to compile the file.IOException- if there was an I/O problem while communicating with ECLiPSe.
-
getPath
Description copied from interface:EclipseConnectionConvert a file path from the Java representation to the ECLiPSe representation.- Specified by:
getPathin interfaceEclipseConnection- Parameters:
f- the file path to be converted.- Returns:
- a String: the file path in the ECLiPSe representation
- Throws:
EclipseException- if ECLiPSe failed or threw an exception whilst trying to convert the file path.IOException- if there was an I/O problem while communicating with ECLiPSe.
-
rpc
Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies the functor string and 1 argument.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
rpc
public CompoundTerm rpc(String functor, Object arg1, Object arg2) throws EclipseException, IOException Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies the functor string and 2 arguments.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
rpc
public CompoundTerm rpc(String functor, Object arg1, Object arg2, Object arg3) throws EclipseException, IOException Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies the functor string and 3 arguments.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
rpc
public CompoundTerm rpc(String functor, Object arg1, Object arg2, Object arg3, Object arg4) throws EclipseException, IOException Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies the functor string and 4 arguments.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
rpc
public CompoundTerm rpc(String functor, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws EclipseException, IOException Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies the functor string and 5 arguments.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
rpc
Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies the functor string and an array of arguments.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
rpc
Description copied from interface:EclipseConnectionConveniencerpcmethod. The user supplies an array. Element 0 is the functor of the goal term and the remaining elements are the arguments.- Specified by:
rpcin interfaceEclipseConnection- Throws:
EclipseExceptionIOException- See Also:
-
getPeerName
Description copied from interface:EclipseConnectionReturn the name by which the peer representing the Java side of the connection is indexed in ECLiPSe.- Specified by:
getPeerNamein interfaceEclipseConnection- Returns:
- an Atom, the peer name.
-
registerMultitask
public EclipseMultitaskConnection registerMultitask(MultitaskListener multitaskListener) throws EclipseException, IOException Description copied from interface:EclipseConnectionRegister this peer as desiring participation in any multitasking phases that ECLiPSe enters.- Specified by:
registerMultitaskin interfaceEclipseConnection- Parameters:
multitaskListener- A listener whose methods are called when ECLiPSe enters/leaves multitasking phases.- Returns:
- An object which can be used to perform RPCs during ECLiPSe multitasking phases.
- Throws:
EclipseException- if registration fails or throws an ECLiPSe exception.IOException- if there was an I/O problem communicating with the ECLiPSe engine.
-