3
import org.omg.CosNaming.*;
6
* This class implements the server side of the example.
8
* $Id: StockItemImpl.java,v 1.3 2001/11/19 22:43:13 momjian Exp $
10
public class StockItemImpl extends stock._StockItemImplBase
13
private String instanceName;
15
public StockItemImpl(String[] args, String iname)
21
db.connect(args[1], args[2], args[3]);
22
System.out.println("StockDB object " + iname + " created");
32
* This is defined in stock.idl
34
* It sets the item to view
36
public void fetchItem(int id) throws stock.StockException
44
throw new stock.StockException(e.toString());
50
* This is defined in stock.idl
52
* It sets the item to view
54
public int newItem() throws stock.StockException
62
throw new stock.StockException(e.toString());
67
* This is defined in stock.idl
69
* It returns the description of a Stock item
71
public String getDescription() throws stock.StockException
75
return db.getDescription();
79
throw new stock.StockException(e.toString());
84
* This is defined in stock.idl
86
* It returns the description of a Stock item
88
public int getAvailable() throws stock.StockException
92
return db.getAvailable();
96
throw new stock.StockException(e.toString());
101
* This is defined in stock.idl
103
* It returns the description of a Stock item
105
public int getOrdered() throws stock.StockException
109
return db.getOrdered();
113
throw new stock.StockException(e.toString());
118
* This is defined in stock.idl
120
* It returns the description of a Stock item
122
public boolean isItemValid() throws stock.StockException
126
return db.isItemValid();
130
throw new stock.StockException(e.toString());
135
* This is defined in stock.idl
137
* It returns the description of a Stock item
139
public void addNewStock(int id) throws stock.StockException
147
throw new stock.StockException(e.toString());
152
* This is defined in stock.idl
154
* It returns the description of a Stock item
156
public void removeStock(int id) throws stock.StockException
164
throw new stock.StockException(e.toString());
169
* This is defined in stock.idl
171
* It returns the description of a Stock item
173
public void orderStock(int id) throws stock.StockException
181
throw new stock.StockException(e.toString());
186
* This returns the highest id used, hence the number of items available
188
public int getLastID() throws stock.StockException
192
return db.getLastID();
196
throw new stock.StockException(e.toString());
201
* This is used by our Dispenser
203
public String getInstanceName()