KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > trading > db > OfferDatabase


1
2 // Copyright (C) 1998-1999
3
// Object Oriented Concepts, Inc.
4

5 // **********************************************************************
6
//
7
// Copyright (c) 1997
8
// Mark Spruiell (mark@intellisoft.com)
9
//
10
// See the COPYING file for more information
11
//
12
// **********************************************************************
13

14 package org.jacorb.trading.db;
15
16
17 import java.util.*;
18 import org.omg.CosTrading.Lookup;
19 import org.omg.CosTrading.RegisterPackage.OfferInfo;
20 import org.omg.CosTrading.ProxyPackage.ProxyInfo;
21 import org.omg.CosTrading.Property;
22 import org.omg.CosTrading.Policy;
23
24
25 /**
26  * An abstract interface to the offer database
27  */

28 public interface OfferDatabase
29 {
30   /** One of these must be supplied to the begin() method */
31   public static final int READ = 0;
32   public static final int WRITE = 1;
33
34
35   /** Returns true if the offerId is legal, false otherwise */
36   public boolean validateOfferId(String JavaDoc offerId);
37
38   /** Returns true if the database can store a property with the given value */
39   public boolean isTypeSupported(org.omg.CORBA.Any JavaDoc any);
40
41
42   /**
43    * Must precede any use of the database methods below - may block if the
44    * requested lock is not available
45    */

46   public void begin(int mode);
47
48   /** Must follow any use of the database methods below */
49   public void end();
50
51
52   /** Returns true if the offer with the given ID exists */
53   public boolean exists(String JavaDoc offerId);
54
55   /** Returns true if the offer with the given ID is a proxy offer */
56   public boolean isProxy(String JavaDoc offerId);
57
58   /** Creates a new offer, returning the assigned offer ID */
59   public String JavaDoc create(
60     String JavaDoc serviceType,
61     org.omg.CORBA.Object JavaDoc obj,
62     Property[] props);
63
64   /** Creates a new proxy offer, returning the assigned offer ID */
65   public String JavaDoc createProxy(
66     Lookup target,
67     String JavaDoc serviceType,
68     Property[] props,
69     boolean ifMatchAll,
70     String JavaDoc recipe,
71     Policy[] policies);
72
73   /** Removes the offer with the given ID */
74   public void remove(String JavaDoc offerId);
75
76   /** Removes the proxy offer with the given ID */
77   public void removeProxy(String JavaDoc offerId);
78
79   /**
80     * Returns a description of the offer with the given ID, or null if
81     * the offer wasn't found
82     */

83   public OfferInfo describe(String JavaDoc offerId);
84
85   /**
86     * Returns a description of the proxy offer with the given ID, or null
87     * if the offer wasn't found
88     */

89   public ProxyInfo describeProxy(String JavaDoc offerId);
90
91   /** Updates the properties of an offer */
92   public void modify(String JavaDoc offerId, Property[] props);
93
94   /**
95     * Returns all offers of the given service type in a hashtable,
96     * where the offer ID is the key and OfferInfo is the value;
97     * returns null if the service type does not exist
98     */

99   public Hashtable getOffers(String JavaDoc serviceType);
100
101   /**
102     * Returns all offer IDs of the given service type;
103     * returns null if the service type does not exist
104     */

105   public String JavaDoc[] getOfferIds(String JavaDoc serviceType);
106
107   /**
108     * Returns all proxy offers of the given service type in a hashtable,
109     * where the offer ID is the key and ProxyInfo is the value;
110     * returns null if the service type does not exist
111     */

112   public Hashtable getProxyOffers(String JavaDoc serviceType);
113
114   /**
115     * Returns all proxy offer IDs of the given service type;
116     * returns null if the service type does not exist
117     */

118   public String JavaDoc[] getProxyOfferIds(String JavaDoc serviceType);
119
120   /**
121     * Returns the service type of the given offer;
122     * returns null if the offer ID is malformed
123     */

124   public String JavaDoc whichService(String JavaDoc offerId);
125 }
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Popular Tags