de.unidu.is.retrieval.hyrex
Class HyREXClient

java.lang.Object
  extended byde.unidu.is.retrieval.hyrex.HyREXClient

public class HyREXClient
extends java.lang.Object

Low-level interface to HyREX.

Version:
$Revision: 1.12 $, $Date: 2005/02/25 14:33:29 $
Author:
Kai Grossjohann, Gudrun Fischer, Henrik Nottelmann

Field Summary
protected  java.lang.String cls
           
protected  java.lang.String db
           
protected  java.lang.String hostname
           
protected  java.net.Socket hyrex
           
protected  java.io.BufferedReader in
           
protected  java.io.PrintWriter out
           
protected  int port
           
 
Constructor Summary
HyREXClient(java.lang.String hostname, int port, java.lang.String db, java.lang.String cls)
          Constructor.
 
Method Summary
static java.util.Vector bases(java.lang.String hostname, int port)
          Deprecated.  
static java.util.Vector classes(java.lang.String hostname, int port, java.lang.String base)
          Deprecated.  
 void close()
          Closes the connection to HyREX.
static java.util.Vector command(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String cmd)
          Deprecated.  
 java.util.Vector command(java.lang.String cmd)
          Sends a command to HyREX and returns the result as a Vector of lines.
static java.util.Vector commandCheck(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String cmd)
          Deprecated.  
 java.util.Vector commandCheck(java.lang.String cmd)
          Sends a command to HyREX and checks the result code.
 void commandIgnoreResult(java.lang.String cmd)
          Sends a command to HyREX and ignores the result.
 java.util.Vector datatypes()
          Returns a Vector of available data types.
static java.util.Vector datatypes(java.io.PrintWriter out, java.io.BufferedReader in)
          Deprecated.  
 java.lang.String document_id(int docid)
          Likewise, but constructor assures that "open" has been issued.
static java.lang.String document_id(java.io.PrintWriter out, java.io.BufferedReader in, int docid)
          Deprecated.  
static java.lang.String document_id(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String docid)
          Deprecated.  
 java.lang.String document_id(java.lang.String docid)
          Likewise, but constructor assures that "open" has been issued.
static java.util.Vector find(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String query)
          Deprecated.  
 java.util.Vector find(java.lang.String query)
          Likewise, but the constructor assures that "open" has been issued.
static java.util.Vector predicates(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String datatype)
          Deprecated.  
 java.util.Vector predicates(java.lang.String datatype)
          Likewise, but the constructor ensures that "open" has been sent.
static java.lang.String shortCommand(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String cmd)
          Deprecated.  
 java.lang.String shortCommand(java.lang.String cmd)
          Sends a command to HyREX and returns the result as a single string.
static java.lang.String shortCommandCheck(java.io.PrintWriter out, java.io.BufferedReader in, java.lang.String cmd)
          Deprecated.  
 java.lang.String shortCommandCheck(java.lang.String cmd)
          Like commandCheck, but returns entire result as one string.
protected static java.util.Vector split(java.lang.String s)
          Splits a string at whitespace.
protected static java.util.Vector splitnl(java.lang.String s)
          Splits a string into lines at newline boundaries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hyrex

protected java.net.Socket hyrex

out

protected java.io.PrintWriter out

in

protected java.io.BufferedReader in

hostname

protected java.lang.String hostname

port

protected int port

db

protected java.lang.String db

cls

protected java.lang.String cls
Constructor Detail

HyREXClient

public HyREXClient(java.lang.String hostname,
                   int port,
                   java.lang.String db,
                   java.lang.String cls)
Constructor.

Parameters:
hostname -
port -
db -
cls -
Method Detail

shortCommand

public java.lang.String shortCommand(java.lang.String cmd)
                              throws java.io.IOException
Sends a command to HyREX and returns the result as a single string.

Throws:
java.io.IOException

shortCommand

public static java.lang.String shortCommand(java.io.PrintWriter out,
                                            java.io.BufferedReader in,
                                            java.lang.String cmd)
                                     throws java.io.IOException
Deprecated.  

Likewise, but can be used on an already open socket.

Throws:
java.io.IOException

command

public java.util.Vector command(java.lang.String cmd)
                         throws java.io.IOException
Sends a command to HyREX and returns the result as a Vector of lines.

Throws:
java.io.IOException

commandIgnoreResult

public void commandIgnoreResult(java.lang.String cmd)
                         throws java.io.IOException
Sends a command to HyREX and ignores the result.

Throws:
java.io.IOException

command

public static java.util.Vector command(java.io.PrintWriter out,
                                       java.io.BufferedReader in,
                                       java.lang.String cmd)
                                throws java.io.IOException
Deprecated.  

Likewise, but can be used on an already open socket.

Parameters:
out -
in -
cmd -
Throws:
java.io.IOException

commandCheck

public java.util.Vector commandCheck(java.lang.String cmd)
                              throws java.io.IOException
Sends a command to HyREX and checks the result code. If the status code indicates "no error", it returns the result as a Vector of lines. The first line will contain the status code, then a space, then a descriptive status message. The remaining lines are the extra data returned. If the status code indicates an error, an IOException will be thrown and the message will contain the status code, a space, and a descriptive error message.

Throws:
java.io.IOException

commandCheck

public static java.util.Vector commandCheck(java.io.PrintWriter out,
                                            java.io.BufferedReader in,
                                            java.lang.String cmd)
                                     throws java.io.IOException
Deprecated.  

Likewise, but can be used on an already open socket.

Throws:
java.io.IOException

shortCommandCheck

public java.lang.String shortCommandCheck(java.lang.String cmd)
                                   throws java.io.IOException
Like commandCheck, but returns entire result as one string.

Throws:
java.io.IOException

shortCommandCheck

public static java.lang.String shortCommandCheck(java.io.PrintWriter out,
                                                 java.io.BufferedReader in,
                                                 java.lang.String cmd)
                                          throws java.io.IOException
Deprecated.  

Likewise, but can be used on already open socket.

Throws:
java.io.IOException

bases

public static java.util.Vector bases(java.lang.String hostname,
                                     int port)
                              throws java.net.UnknownHostException,
                                     java.io.IOException
Deprecated.  

Returns a list of bases for a given HyREX server. Expects the hostname and port as arguments.

Throws:
java.net.UnknownHostException
java.io.IOException

classes

public static java.util.Vector classes(java.lang.String hostname,
                                       int port,
                                       java.lang.String base)
                                throws java.net.UnknownHostException,
                                       java.io.IOException
Deprecated.  

Returns a list of classes in a given base. Expects the hostname, port number, and name of base as arguments.

Throws:
java.net.UnknownHostException
java.io.IOException

datatypes

public static java.util.Vector datatypes(java.io.PrintWriter out,
                                         java.io.BufferedReader in)
                                  throws java.io.IOException
Deprecated.  

Returns a Vector of available data types. The "open" command must previously have been sent to the HyREX server. The socket is specified in the "out" and "in" arguments.

Throws:
java.io.IOException

datatypes

public java.util.Vector datatypes()
                           throws java.io.IOException
Returns a Vector of available data types. The constructor ensures that the "open" command has already been sent, so the caveat from the previous method does not apply.

Throws:
java.io.IOException

predicates

public static java.util.Vector predicates(java.io.PrintWriter out,
                                          java.io.BufferedReader in,
                                          java.lang.String datatype)
                                   throws java.io.IOException
Deprecated.  

Returns a Vector of available search predicates. The "open" command must previously have been sent to the HyREX server.

Throws:
java.io.IOException

predicates

public java.util.Vector predicates(java.lang.String datatype)
                            throws java.io.IOException
Likewise, but the constructor ensures that "open" has been sent.

Throws:
java.io.IOException

find

public static java.util.Vector find(java.io.PrintWriter out,
                                    java.io.BufferedReader in,
                                    java.lang.String query)
                             throws java.io.IOException
Deprecated.  

Sends a query to the remote host and returns a Vector of results. The first element of the Vector is a String and contains the status code and status message from HyREX. Subsequent elements of the Vector are Path objects, representing one result each. This method assumes that the "open" command has been sent to the HyREX server previously.

Throws:
java.io.IOException

find

public java.util.Vector find(java.lang.String query)
                      throws java.io.IOException
Likewise, but the constructor assures that "open" has been issued.

Throws:
java.io.IOException

document_id

public static java.lang.String document_id(java.io.PrintWriter out,
                                           java.io.BufferedReader in,
                                           int docid)
                                    throws java.io.IOException
Deprecated.  

Retrieves a document from HyREX, given a document id. Returns a string, which contains the document.

Throws:
java.io.IOException

document_id

public static java.lang.String document_id(java.io.PrintWriter out,
                                           java.io.BufferedReader in,
                                           java.lang.String docid)
                                    throws java.io.IOException
Deprecated.  

Retrieves a document from HyREX, given a document id. Returns a string, which contains the document.

Throws:
java.io.IOException

document_id

public java.lang.String document_id(int docid)
                             throws java.io.IOException
Likewise, but constructor assures that "open" has been issued.

Throws:
java.io.IOException

document_id

public java.lang.String document_id(java.lang.String docid)
                             throws java.io.IOException
Likewise, but constructor assures that "open" has been issued.

Throws:
java.io.IOException

splitnl

protected static java.util.Vector splitnl(java.lang.String s)
Splits a string into lines at newline boundaries.


split

protected static java.util.Vector split(java.lang.String s)
Splits a string at whitespace.


close

public void close()
           throws java.io.IOException
Closes the connection to HyREX.

Throws:
java.io.IOException