Java docs
[yaz4j-moved-to-github.git] / src / main / java / org / yaz4j / ConnectionExtended.java
1 package org.yaz4j;
2
3 import org.yaz4j.jni.SWIGTYPE_p_ZOOM_options_p;
4 import org.yaz4j.jni.SWIGTYPE_p_ZOOM_package_p;
5 import org.yaz4j.jni.yaz4jlib;
6
7 /**
8  * Offers an interface to a subset of the Z39.50 extended services as well as a 
9  * few privately defined ones. E.g, Z59.50 ILL, record update, database drop,
10  * create, commit.
11  * 
12  * @see <a href="http://www.indexdata.com/yaz/doc/zoom.extendedservices.html">ZOOM Extended Services</a>
13  * 
14  * @author jakub
15  */
16 public class ConnectionExtended extends Connection {
17
18   public ConnectionExtended(String host, int port) {
19     super(host, port);
20   }
21
22   /**
23    * Creates an extended-services package for the connection.
24    * @param type type of package (operation)
25    * @return 
26    */
27   public Package getPackage(String type) {
28     if (closed) {
29       throw new IllegalStateException("Connection is closed.");
30     }
31     Package pack = null;
32     SWIGTYPE_p_ZOOM_options_p options = yaz4jlib.ZOOM_options_create();
33     SWIGTYPE_p_ZOOM_package_p yazPackage = yaz4jlib.ZOOM_connection_package(
34       zoomConnection, options);
35     pack = new Package(yazPackage, this, type);
36     return pack;
37   }
38 }