diff options
author | Marc G. Fournier <scrappy@hub.org> | 1999-01-25 21:22:06 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1999-01-25 21:22:06 +0000 |
commit | 2ee522954d0d634d520e6f10454a8c63ef004a00 (patch) | |
tree | 2b1b3b0756fb3ad81d689008dd5465cbd1c56389 /src/interfaces/jdbc/example/corba/StockItemImpl.java | |
parent | 1401f63dd15fbc073775fb0279c3b7153ef95f66 (diff) | |
download | postgresql-2ee522954d0d634d520e6f10454a8c63ef004a00.tar.gz postgresql-2ee522954d0d634d520e6f10454a8c63ef004a00.zip |
From: Peter T Mount <peter@retep.org.uk>
This implements some of the JDBC2 methods, fixes a bug introduced into the
JDBC1 portion of the driver, and introduces a new example, showing how to
use the CORBA ORB thats in Java2 with JDBC.
The Tar file contains the new files, the diff the changes to the others.
CHANGELOG is separate as I forgot to make a .orig ;-)
Diffstat (limited to 'src/interfaces/jdbc/example/corba/StockItemImpl.java')
-rw-r--r-- | src/interfaces/jdbc/example/corba/StockItemImpl.java | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/src/interfaces/jdbc/example/corba/StockItemImpl.java b/src/interfaces/jdbc/example/corba/StockItemImpl.java new file mode 100644 index 00000000000..7f6c5be9307 --- /dev/null +++ b/src/interfaces/jdbc/example/corba/StockItemImpl.java @@ -0,0 +1,163 @@ +package example.corba; + +import org.omg.CosNaming.*; + +/** + * This class implements the server side of the example. + * + * $Id: StockItemImpl.java,v 1.1 1999/01/25 21:22:04 scrappy Exp $ + */ +public class StockItemImpl extends stock._StockItemImplBase +{ + private StockDB db; + private String instanceName; + + public StockItemImpl(String[] args,String iname) { + super(); + try { + db =new StockDB(); + db.connect(args[1],args[2],args[3]); + System.out.println("StockDB object "+iname+" created"); + instanceName = iname; + } catch(Exception e) { + e.printStackTrace(); + } + } + + /** + * This is defined in stock.idl + * + * It sets the item to view + */ + public void fetchItem(int id) throws stock.StockException { + try { + db.fetchItem(id); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + + /** + * This is defined in stock.idl + * + * It sets the item to view + */ + public int newItem() throws stock.StockException { + try { + return db.newItem(); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public String getDescription() throws stock.StockException { + try { + return db.getDescription(); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public int getAvailable() throws stock.StockException { + try { + return db.getAvailable(); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public int getOrdered() throws stock.StockException { + try { + return db.getOrdered(); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public boolean isItemValid() throws stock.StockException { + try { + return db.isItemValid(); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public void addNewStock(int id) throws stock.StockException { + try { + db.addNewStock(id); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public void removeStock(int id) throws stock.StockException { + try { + db.removeStock(id); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is defined in stock.idl + * + * It returns the description of a Stock item + */ + public void orderStock(int id) throws stock.StockException { + try { + db.orderStock(id); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This returns the highest id used, hence the number of items available + */ + public int getLastID() throws stock.StockException { + try { + return db.getLastID(); + } catch(Exception e) { + throw new stock.StockException(e.toString()); + } + } + + /** + * This is used by our Dispenser + */ + public String getInstanceName() { + return instanceName; + } +} + |