KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rmijdbc > RJArrayServer


1  
2 /**
3  * RmiJdbc client/server JDBC Driver
4  * (C) ExperLog 1999-2000
5  *
6  * @version 1.0
7  * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com)
8  * Additional SSL Support
9  * Douglas Hammond(djhammond@sympatico.ca)
10  */

11
12 package org.objectweb.rmijdbc;
13
14 import java.sql.*;
15 import java.util.Map JavaDoc;
16 import java.rmi.RemoteException JavaDoc;
17 import java.rmi.server.UnicastRemoteObject JavaDoc;
18 import java.rmi.server.Unreferenced JavaDoc;
19
20 /**
21  * The mapping in the Java programming language for the SQL type ARRAY.
22  * By default, an Array is a transaction duration reference to an SQL array.
23  * By default, an Array is implemented using an SQL LOCATOR(array) internally.
24  */

25
26 public class RJArrayServer
27 extends UnicastRemoteObject JavaDoc
28 implements RJArrayInterface, Unreferenced JavaDoc {
29
30   java.sql.Array JavaDoc jdbcArray_;
31
32   public RJArrayServer(java.sql.Array JavaDoc a) throws RemoteException JavaDoc {
33      super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory);
34     jdbcArray_ = a;
35   }
36
37   public void unreferenced() { Runtime.getRuntime().gc(); }
38
39   /**
40    * Retrieves the contents of the SQL array designated by this Array object
41    * in the form of an array in the Java programming language.
42    */

43   public Object JavaDoc getArray() throws RemoteException JavaDoc, SQLException {
44     return jdbcArray_.getArray();
45   }
46
47   /**
48    * Returns an array containing a slice of the SQL array, beginning with the
49    * specified index and containing up to count successive elements of the
50    * SQL array.
51    */

52   public Object JavaDoc getArray(long index, int count)
53   throws RemoteException JavaDoc, SQLException {
54     return jdbcArray_.getArray(index, count);
55   }
56
57   /**
58    * Returns an array containing a slice of the SQL array object designated by
59    * this object, beginning with the specified index and containing up to
60    * count successive elements of the SQL array.
61    */

62   public Object JavaDoc getArray(long index, int count, Map JavaDoc map)
63   throws RemoteException JavaDoc, SQLException {
64     return jdbcArray_.getArray(index, count, map);
65   }
66
67   /**
68    * Retrieves the contents of the SQL array designated by this Array object,
69    * using the specified map for type map customizations.
70    */

71   public Object JavaDoc getArray(Map JavaDoc map) throws RemoteException JavaDoc, SQLException {
72     return jdbcArray_.getArray(map);
73   }
74
75   /**
76    * Returns the JDBC type of the elements in the array designated by this
77    * Array object.
78    */

79   public int getBaseType() throws RemoteException JavaDoc, SQLException {
80     return jdbcArray_.getBaseType();
81   }
82
83   /**
84    * Returns the SQL type name of the elements in the array designated by this
85    * Array object.
86    */

87   public String JavaDoc getBaseTypeName() throws RemoteException JavaDoc, SQLException {
88     return jdbcArray_.getBaseTypeName();
89   }
90
91   /**
92    * Returns a result set that contains the elements of the array
93    * designated by this Array object.
94    */

95   public RJResultSetInterface getResultSet()
96   throws RemoteException JavaDoc, SQLException {
97     return new RJResultSetServer(jdbcArray_.getResultSet());
98   }
99
100   /**
101    * Returns a result set holding the elements of the subarray that starts
102    * at index index and contains up to count successive elements.
103    */

104   public RJResultSetInterface getResultSet(long index, int count)
105   throws RemoteException JavaDoc, SQLException {
106     return new RJResultSetServer(jdbcArray_.getResultSet(index, count));
107   }
108
109   /**
110    * Returns a result set holding the elements of the subarray that starts
111    * at index index and contains up to count successive elements.
112    */

113   public RJResultSetInterface getResultSet(long index, int count, Map JavaDoc map)
114   throws RemoteException JavaDoc, SQLException {
115     return new RJResultSetServer(jdbcArray_.getResultSet(index, count, map));
116   }
117
118   /**
119    * Returns a result set that contains the elements of the array designated
120    * by this Array object and uses the given map to map the array elements.
121    */

122   public RJResultSetInterface getResultSet(Map JavaDoc map)
123   throws RemoteException JavaDoc, SQLException {
124     return new RJResultSetServer(jdbcArray_.getResultSet(map));
125   }
126
127 };
128
129
Popular Tags