Interface EclipseConnection

All Known Subinterfaces:
EclipseEngine, EclipseMultitaskConnection
All Known Implementing Classes:
EclipseConnectionImpl, EmbeddedEclipse, OutOfProcessEclipse, RemoteEclipse

public interface EclipseConnection
Interface of objects which provide a connection to an ECLiPSe engine. Classes implementing EclipseConnection provide the following areas of functionality:
  • "RPC" calls: deterministic ECLiPSe goals which are executed in ECLiPSe and whose resulting instantiation is returned to Java.
  • The ability to create/access "queues" between Java and ECLiPSe.
  • The ability to register a handler to be called when ECLiPSe enters/leaves multitasking phases.
See Also:
  • Method Details

    • rpc

      Make an "RPC" (remote predicate call) to the ECLiPSe engine.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • rpc

      Make an "RPC" (remote predicate call) to the ECLiPSe engine.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • getFromEclipseQueue

      FromEclipseQueue getFromEclipseQueue(String name) throws EclipseException, IOException
      Create 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.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • getToEclipseQueue

      ToEclipseQueue getToEclipseQueue(String name) throws EclipseException, IOException
      Create 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.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • getAsyncEclipseQueue

      AsyncEclipseQueue getAsyncEclipseQueue(String name) throws EclipseException, IOException
      Create 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.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • compile

      void compile(File f) throws EclipseException, IOException
      Direct ECLiPSe to compile a named object file.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • getPath

      Convert a file path from the Java representation to the ECLiPSe representation.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.
    • rpc

      CompoundTerm rpc(String functor, Object arg1) throws EclipseException, IOException
      Convenience rpc method. The user supplies the functor string and 1 argument.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • rpc

      CompoundTerm rpc(String functor, Object arg1, Object arg2) throws EclipseException, IOException
      Convenience rpc method. The user supplies the functor string and 2 arguments.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • rpc

      CompoundTerm rpc(String functor, Object arg1, Object arg2, Object arg3) throws EclipseException, IOException
      Convenience rpc method. The user supplies the functor string and 3 arguments.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • rpc

      CompoundTerm rpc(String functor, Object arg1, Object arg2, Object arg3, Object arg4) throws EclipseException, IOException
      Convenience rpc method. The user supplies the functor string and 4 arguments.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • rpc

      CompoundTerm rpc(String functor, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws EclipseException, IOException
      Convenience rpc method. The user supplies the functor string and 5 arguments.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • rpc

      CompoundTerm rpc(String functor, Object[] args) throws EclipseException, IOException
      Convenience rpc method. The user supplies the functor string and an array of arguments.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • rpc

      Convenience rpc method. The user supplies an array. Element 0 is the functor of the goal term and the remaining elements are the arguments.
      Throws:
      EclipseTerminatedException - if this EclipseConnection has been terminated.
      EclipseException
      IOException
      See Also:
    • getPeerName

      Atom getPeerName()
      Return the name by which the peer representing the Java side of the connection is indexed in ECLiPSe.
      Returns:
      an Atom, the peer name.
    • registerMultitask

      EclipseMultitaskConnection registerMultitask(MultitaskListener multitaskListener) throws EclipseException, IOException
      Register this peer as desiring participation in any multitasking phases that ECLiPSe enters.
      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.
      EclipseTerminatedException - if this EclipseConnection has been terminated.