KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > datatype > service > BusinessService


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.service;
17
18 import java.util.Vector JavaDoc;
19
20 import org.apache.juddi.datatype.CategoryBag;
21 import org.apache.juddi.datatype.Description;
22 import org.apache.juddi.datatype.KeyedReference;
23 import org.apache.juddi.datatype.Name;
24 import org.apache.juddi.datatype.RegistryObject;
25 import org.apache.juddi.datatype.binding.BindingTemplate;
26 import org.apache.juddi.datatype.binding.BindingTemplates;
27
28 /**
29  * "A descriptive container that is used to group a series of related
30  * Web Services related to either a business process or category of
31  * services." - technical whitepaper
32  *
33  * "descriptive information about the party who publishes information about
34  * a service" - XML Structure Reference
35  *
36  * @author Steve Viens (sviens@apache.org)
37  */

38 public class BusinessService implements RegistryObject
39 {
40   String JavaDoc businessKey;
41   String JavaDoc serviceKey;
42   Vector JavaDoc nameVector;
43   Vector JavaDoc descrVector;
44   BindingTemplates bindingTemplates;
45   CategoryBag categoryBag;
46
47   /**
48    * Constructs a new initialized BusinessService instance.
49    */

50   public BusinessService()
51   {
52   }
53
54   /**
55    * Sets the String of this BusinessService. If the BusinessEntity for
56    * this BusinessService has been set, this new String must be null or
57    * must be the same as the BusinessEntity. If the BusinessEntity for this
58    * BindingTemplate has not been set, this new String may not be null.
59    *
60    * @param key The new business key.
61    */

62   public void setBusinessKey(String JavaDoc key)
63   {
64     this.businessKey = key;
65   }
66
67   /**
68    * Returns the business key of this business service. This method can return
69    * null if the business entity for this business service has been set and if
70    * the business key for this business service has not been set.
71    *
72    * @return The business key of this business service.
73    */

74   public String JavaDoc getBusinessKey()
75   {
76     return this.businessKey;
77   }
78
79   /**
80    * Sets the service key of this business service to the given key.
81    *
82    * @param key The service key of this business service.
83    */

84   public void setServiceKey(String JavaDoc key)
85   {
86     serviceKey = key;
87   }
88
89   /**
90    * Returns the service key of this business service.
91    *
92    * @return The service key of this business service.
93    */

94   public String JavaDoc getServiceKey()
95   {
96     return serviceKey;
97   }
98
99   /**
100    * Add a name to this BusinessService.
101    *
102    * @param name The Name to add.
103    */

104   public void addName(Name name)
105   {
106     if (nameVector == null)
107       nameVector = new Vector JavaDoc();
108     nameVector.add(name);
109   }
110
111   /**
112    * Adds the given description. If there was already a description with the
113    * same language-code as the new description, an exception will be thrown.
114    *
115    * @param desc The description to add.
116    */

117   public void addDescription(Description desc)
118   {
119     if (descrVector == null)
120       descrVector = new Vector JavaDoc();
121     descrVector.add(desc);
122   }
123
124   /**
125    * Returns the names of this BusinessService.
126    *
127    * @return The names of thes BusinessService. If this BusinessService
128    * doesn't have any names, an empty set is returned.
129    */

130   public Vector JavaDoc getNameVector()
131   {
132     return nameVector;
133   }
134
135   /**
136    * Sets the name list to the current one. Ignores any object in the
137    * collection that is not an "instanceof" the Name class.
138    *
139    * @param names the Names object to set
140    */

141   public void setNameVector(Vector JavaDoc names)
142   {
143     this.nameVector = names;
144   }
145
146   /**
147    * Sets the description list to the current one. Ignores any object in the
148    * collection that is not an "instanceof" the Description class.
149    *
150    * @param descs Descriptions object to set
151    */

152   public void setDescriptionVector(Vector JavaDoc descs)
153   {
154     this.descrVector = descs;
155   }
156
157   /**
158    * Returns the descriptions.
159    *
160    * @return the descriptions object
161    */

162   public Vector JavaDoc getDescriptionVector()
163   {
164     return this.descrVector;
165   }
166
167   /**
168    * Add a binding template to this business service.
169    *
170    * @param binding The binding template to add.
171    */

172   public void addBindingTemplate(BindingTemplate binding)
173   {
174     if (this.bindingTemplates == null)
175       this.bindingTemplates = new BindingTemplates();
176     this.bindingTemplates.addBindingTemplate(binding);
177   }
178
179   /**
180    * Returns the binding templates of this business service.
181    *
182    * @return The binding templates of this business service.
183    */

184   public BindingTemplates getBindingTemplates()
185   {
186     return this.bindingTemplates;
187   }
188
189   /**
190    * Sets the binding templates of this business service.
191    */

192   public void setBindingTemplates(BindingTemplates bindings)
193   {
194     this.bindingTemplates = bindings;
195   }
196
197   /**
198    * Add a category to the categorybag of this business service.
199    * @param ref The category to add.
200    */

201   public void addCategory(KeyedReference ref)
202   {
203     // just return if the KeyedReference parameter is null (nothing to add)
204
if (ref == null)
205       return;
206
207     // make sure the CategoryBag has been initialized
208
if (this.categoryBag == null)
209       this.categoryBag = new CategoryBag();
210
211     this.categoryBag.addKeyedReference(ref);
212   }
213
214   /**
215    * Returns the categorybag of this business service. If this business
216    * service doesn't contain any categories, an empty enumeration is
217    * returned.
218    *
219    * @return The categorybag of this business service.
220    */

221   public CategoryBag getCategoryBag()
222   {
223     return this.categoryBag;
224   }
225
226   /**
227    * Set the categorybag of this business service to the given one.
228    *
229    * @param bag The new categorybag.
230    */

231   public void setCategoryBag(CategoryBag bag)
232   {
233     this.categoryBag = bag;
234   }
235 }
Popular Tags