KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > datatype > request > FindService


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.juddi.datatype.request;
17
18 import java.util.Vector JavaDoc;
19
20 import org.apache.juddi.datatype.CategoryBag;
21 import org.apache.juddi.datatype.KeyedReference;
22 import org.apache.juddi.datatype.Name;
23 import org.apache.juddi.datatype.RegistryObject;
24 import org.apache.juddi.datatype.TModelBag;
25
26 /**
27  * "Used to locate specific services within a registered
28  * businessEntity. Return a serviceList message." From the
29  * XML spec (API, p18) it appears that the name, categoryBag,
30  * and tModelBag arguments are mutually exclusive.
31  *
32  * @author Steve Viens (sviens@apache.org)
33  */

34 public class FindService implements RegistryObject,Inquiry
35 {
36   String JavaDoc generic;
37   String JavaDoc businessKey;
38   Vector JavaDoc nameVector;
39   CategoryBag categoryBag;
40   TModelBag tModelBag;
41   FindQualifiers findQualifiers;
42   int maxRows;
43
44   /**
45    * Constructs a new empty find_service request.
46    */

47   public FindService()
48   {
49   }
50
51   /**
52    * Construct a new find_service request. The services searched for must be part of the
53    * businessEntity with the given businessKey.
54    *
55    * @param businessKey The key of the businessEntity to search in.
56    * @throws NullPointerException If the given key is null.
57    */

58   public FindService(String JavaDoc businessKey)
59   {
60     setBusinessKey(businessKey);
61   }
62
63   /**
64    * Sets the businesskey of this find_service request to the given key. Only services of the
65    * referenced businessEntity are searched.
66    *
67    * @param key A reference to the businessEntity.
68    * @throws NullPointerException If the given key is null.
69    */

70   public void setBusinessKey(String JavaDoc key)
71   {
72     businessKey = key;
73   }
74
75   /**
76   * Returns the businesskey of this find_service request. Only services of the referenced
77   * businessEntity are searched.
78   *
79   * @return The businesskey of the referenced businessEntity.
80   */

81   public String JavaDoc getBusinessKey()
82   {
83     return businessKey;
84   }
85
86   /**
87    *
88    * @param genericValue
89    */

90   public void setGeneric(String JavaDoc genericValue)
91   {
92     this.generic = genericValue;
93   }
94
95   /**
96    *
97    * @return String UDDI request's generic value.
98    */

99   public String JavaDoc getGeneric()
100   {
101     return this.generic;
102   }
103
104   /**
105    * Sets the name argument of the search to the given name. This value is a partial
106    * name. The serviceList return contains ServiceInfo objects for services whose
107    * name matches the value passed (leftmost match).
108    *
109    * @param nameValue The name argument of the search.
110    */

111   public void addName(Name nameValue)
112   {
113     if (this.nameVector == null)
114       this.nameVector = new Vector JavaDoc();
115     this.nameVector.add(nameValue);
116   }
117
118   /**
119    * Returns the name argument of the search. Null is returned if the name
120    * argument for this search has not been specified.
121    *
122    * @return The name argument of the search, or null if the argument has not been specified.
123    */

124   public Vector JavaDoc getNameVector()
125   {
126     return this.nameVector;
127   }
128
129   /**
130    * Sets the name argument of the search to the given name. This value is a partial
131    * name. The serviceList return contains ServiceInfo objects for services whose
132    * name matches the value passed (leftmost match).
133    *
134    * @param names The name argument of the search.
135    */

136   public void setNameVector(Vector JavaDoc names)
137   {
138     this.nameVector = names;
139   }
140
141   /**
142    * Adds a category reference to the categoryBag argument of this search.
143    *
144    * @param ref The category reference to add.
145    */

146   public void addCategory(KeyedReference ref)
147   {
148     // just return if the KeyedReference parameter is null (nothing to add)
149
if (ref == null)
150       return;
151
152     // make sure the CategoryBag has been initialized
153
if (this.categoryBag == null)
154       this.categoryBag = new CategoryBag();
155
156     this.categoryBag.addKeyedReference(ref);
157   }
158
159   /**
160    * Sets the CategoryBag value
161    *
162    * @param bag The new CategoryBag
163    */

164   public void setCategoryBag(CategoryBag bag)
165   {
166     categoryBag = bag;
167   }
168
169   /**
170    * Returns the CategoryBag value
171    *
172    * @return The CategoryBag value
173    */

174   public CategoryBag getCategoryBag()
175   {
176     return this.categoryBag;
177   }
178
179   /**
180    * Adds a tModel reference to the tModelBag argument of this search. This tModelBag argument
181    * lets you search for businesses that have bindings that are compatible with a specific
182    * tModel pattern.
183    *
184    * @param key The key of the tModel to add to the tModelBag argument.
185    */

186   public void addTModelKey(String JavaDoc key)
187   {
188     // just return if the TModel key parameter is null (nothing to add)
189
if (key == null)
190       return;
191
192     // make sure the TModelBag has been initialized
193
if (this.tModelBag == null)
194       this.tModelBag = new TModelBag();
195
196     this.tModelBag.addTModelKey(key);
197   }
198
199   /**
200    * Sets the TModelBag value.
201    *
202    * @param bag the new TModelBag.
203    */

204   public void setTModelBag(TModelBag bag)
205   {
206     this.tModelBag = bag;
207   }
208
209   /**
210    * Returns the list of tModel references as an enumeration. If the tModelBag has not
211    * been specified, an empty list is returned.
212    *
213    * @return The list of the tModel references.
214    */

215   public TModelBag getTModelBag()
216   {
217     return this.tModelBag;
218   }
219
220   /**
221    *
222    */

223   public int getMaxRows()
224   {
225     return maxRows;
226   }
227
228   /**
229    *
230    */

231   public void setMaxRows(int maxRows)
232   {
233     this.maxRows = maxRows;
234   }
235
236   /**
237    *
238    */

239   public void setMaxRows(String JavaDoc maxRows)
240   {
241     setMaxRows(Integer.parseInt(maxRows));
242   }
243
244   /**
245    *
246    */

247   public void addFindQualifier(FindQualifier findQualifier)
248   {
249     if (this.findQualifiers == null)
250       this.findQualifiers = new FindQualifiers();
251     this.findQualifiers.addFindQualifier(findQualifier);
252   }
253
254   /**
255    *
256    */

257   public void setFindQualifiers(FindQualifiers findQualifiers)
258   {
259     this.findQualifiers = findQualifiers;
260   }
261
262   /**
263    *
264    */

265   public FindQualifiers getFindQualifiers()
266   {
267     return this.findQualifiers;
268   }
269 }
Popular Tags