org.z3950.zoom
Class Connection

java.lang.Object
  |
  +--org.z3950.zoom.Connection

public class Connection
extends java.lang.Object

Represents a connection to a Z39.50 Server, as described in the ZOOM Abstract API.

Synopsis:

	Connection conn = new Connection("muffin.indexdata.dk", 210);
	conn.option("databaseName", "gils");
	conn.option("preferredRecordSyntax", "xml");
 

Version:
$Id: Connection.java,v 1.3 2002/12/14 00:17:49 mike Exp $
See Also:
zoom.z3950.org/api/zoom-1.1.html#3.2

Constructor Summary
Connection(java.lang.String hostname, int portnum)
          Creates a new connection object, and forges a Z39.50 connection to the server specified by the parameters.
 
Method Summary
 void close()
          Closes the connection to the server, allowing it to release any resources it has allocated to this client.
 java.lang.String option(java.lang.String key)
          Returns the value of the specified option in this Connection object, if it is defined there; otherwise returns the global option of that name.
 java.lang.String option(java.lang.String key, java.lang.String val)
          Sets the specified option in this Connection object to the specified value, returning its previous value (as would have been returned by the single-parameter version.)
 ResultSet search(Query q)
          Performs a search on the server to which this Connection is attached, using the specified query, and returns a new Result Set object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connection

public Connection(java.lang.String hostname,
                  int portnum)
Creates a new connection object, and forges a Z39.50 connection to the server specified by the parameters.
Parameters:
hostname - the name or IP address of the Z39.50 server
value - the IP port on which the server is listening
See Also:
zoom.z3950.org/api/zoom-1.1.html#3.2.2
Method Detail

option

public java.lang.String option(java.lang.String key)
Returns the value of the specified option in this Connection object, if it is defined there; otherwise returns the global option of that name.
Parameters:
key - the name of the requested option
Returns:
the value of the specified option, or null if no such option has been defined.
See Also:
Global.option(String), zoom.z3950.org/api/zoom-1.1.html#3.2.3

option

public java.lang.String option(java.lang.String key,
                               java.lang.String val)
Sets the specified option in this Connection object to the specified value, returning its previous value (as would have been returned by the single-parameter version.)
Parameters:
key - the name of the option to set
value - the value to which to set the specified option
Returns:
the old value of the specified option, if any
See Also:
option(String), zoom.z3950.org/api/zoom-1.1.html#3.2.3

search

public ResultSet search(Query q)
                 throws SearchException,
                        Bib1Exception
Performs a search on the server to which this Connection is attached, using the specified query, and returns a new Result Set object.
Parameters:
q - A Z39.50 Query expressed as one of the subtypes of the Query class, which see.
Returns:
A newly created ResultSet object representing the set of records which the server selected as satisfying the query. This is the only way to create a ResultSet.
See Also:
zoom.z3950.org/api/zoom-1.1.html#3.2.4

close

public void close()
Closes the connection to the server, allowing it to release any resources it has allocated to this client.
See Also:
zoom.z3950.org/api/zoom-1.1.html#3.2.6