public class Connection extends Object implements Closeable
try { c = new Connection(...) //possibly set some options c.connect //establishes connection c.search //or other operation //possibly retrieve records catch (ZoomException e) { //handle any protocol- or network-level errors } finally { c.close //close the socket }
Modifier and Type | Class and Description |
---|---|
static class |
Connection.QueryType |
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed |
protected org.yaz4j.jni.SWIGTYPE_p_ZOOM_connection_p |
zoomConnection |
Constructor and Description |
---|
Connection(String host,
int port)
Create new connection object without physically opening a connection to the
remote server.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
void |
connect()
Establishes a connection to the remote server.
|
void |
finalize() |
String |
getDatabaseName()
Same as option("databaseName")
|
String |
getPassword()
Same as option("password")
|
String |
getSyntax()
Same as option("preferredRecordSyntax")
|
String |
getUsername()
Same as option("user")
|
String |
option(String name)
Read option with a given name
|
Connection |
option(String name,
String value)
Write option with a given name.
|
ScanSet |
scan(Query query)
Performs a scan operation (obtains a list of candidate search terms against
a particular access point).
|
ScanSet |
scan(String query)
Deprecated.
Only allows PQF scan queries, use
scan(Query) instead |
ResultSet |
search(Query query)
Performs a search operation (submits the query to the server, waits for
response and creates a new result set that allows to retrieve particular
results).
|
ResultSet |
search(String query,
Connection.QueryType queryType)
Deprecated.
Does not allow specifying sort criteria prior to search
use
search(Query) instead. |
void |
setDatabaseName(String value)
Same as option("databaseName", value)
|
void |
setPassword(String value)
Same as option("password", value)
|
void |
setSyntax(String value)
Same as option("preferredRecordSyntax", value)
|
void |
setUsername(String value)
Same as option("user", value)
|
protected org.yaz4j.jni.SWIGTYPE_p_ZOOM_connection_p zoomConnection
protected boolean closed
public Connection(String host, int port)
host
- host name of the serverport
- port of the server@Deprecated public ResultSet search(String query, Connection.QueryType queryType) throws ZoomException
search(Query)
instead.query
- search queryqueryType
- type of the query (e.g RPN. CQL)ZoomException
- protocol or network-level errorpublic ResultSet search(Query query) throws ZoomException
query
- search query of any type supported by YAZ.ZoomException
- protocol or network-level error@Deprecated public ScanSet scan(String query) throws ZoomException
scan(Query)
insteadquery
- query for scanningZoomException
- a protocol or network-level errorpublic ScanSet scan(Query query) throws ZoomException
query
- scan query of type supported by YAZZoomException
- a protocol or network-level errorpublic void connect() throws ZoomException
ZoomException
- any (possibly network-level) errors that may occurrpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
public Connection option(String name, String value)
name
- option namevalue
- option valuepublic String option(String name)
name
- option namepublic String getSyntax()
public void setSyntax(String value)
value
- value of preferred record syntaxpublic String getDatabaseName()
public void setDatabaseName(String value)
value
- value of databaseNamepublic String getUsername()
public void setUsername(String value)
value
- value of userpublic String getPassword()
public void setPassword(String value)
value
- Copyright © 2008–2015 Index Data. All rights reserved.