## org.opencyc.api
Interface CycConnectionInterface

All Known Implementing Classes:
  CycConnection, RemoteCycConnection

public interface CycConnectionInterface

Defines the interface for local and remote CycConnection objects

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Method Summary
`void` `close()` Close the api sockets and streams.
`java.lang.String` `connectionInfo()` Returns connection information, suitable for diagnostics.
`java.lang.Object[]` `converse(java.lang.Object message)` Send a message to Cyc and return the `Boolean` true as the first element of an object array, and the cyc response Symbolic Expression as the second element.
`java.lang.Object[]` `converse(java.lang.Object message, Timer timeout)` Send a message to Cyc and return the response code as the first element of an object array, and the cyc response Symbolic Expression as the second element, spending no less time than the specified timer allows but throwing a `TimeOutException` at the first opportunity where that time limit is exceeded.
`int` `getTrace()` Returns the trace value.
`void` `setTrace(int trace)` Sets the trace value.
`void` `traceOff()` Turns off the diagnostic trace of socket messages.
`void` `traceOn()` Turns on the diagnostic trace of socket messages.
`void` `traceOnDetailed()` Turns on the detailed diagnostic trace of socket messages.

Method Detail

### converse

    public java.lang.Object[] converse(java.lang.Object message)
                                throws java.io.IOException,
                                       CycApiException

  Send a message to Cyc and return the `Boolean` true as the first element of an object array, and the cyc response Symbolic Expression as the second element. If an error occurs the first element is `Boolean` false and the second element is the error message string.
  Parameters:
    `message` - the api command
  Returns:
    an array of two objects, the first is an Integer response code, and the second is the response object or error string.

### converse

    public java.lang.Object[] converse(java.lang.Object message,
                                       Timer timeout)
                                throws java.io.IOException,
                                       TimeOutException,
                                       CycApiException

  Send a message to Cyc and return the response code as the first element of an object array, and the cyc response Symbolic Expression as the second element, spending no less time than the specified timer allows but throwing a `TimeOutException` at the first opportunity where that time limit is exceeded. If an error occurs the second element is the error message string.
  Parameters:
    `message` - the api command which must be a String or a CycList
    `timeout` - a `Timer` object giving the time limit for the api call
  Returns:
    an array of two objects, the first is an Integer response code, and the second is the response object or error string.

### connectionInfo

    public java.lang.String connectionInfo()

  Returns connection information, suitable for diagnostics.

### close

    public void close()

  Close the api sockets and streams.

### getTrace

    public int getTrace()

  Returns the trace value.
  Returns:
    the trace value

### setTrace

    public void setTrace(int trace)

  Sets the trace value.
  Parameters:
    `trace` - the trace value

### traceOff

    public void traceOff()

  Turns off the diagnostic trace of socket messages.

### traceOn

    public void traceOn()

  Turns on the diagnostic trace of socket messages.

### traceOnDetailed

    public void traceOnDetailed()

  Turns on the detailed diagnostic trace of socket messages.