KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > datatype > binding > BindingTemplate


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.binding;
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.RegistryObject;
24
25 /**
26  * Technical web service description. Contains "information relevant for
27  * application programs that need to connect to and then communicate with a
28  * remote Web Service. This information includes the address to make contact
29  * with a Web Service, as well as support for option information that can be
30  * used to describe both hosted services and services that require additional
31  * values to be discovered prior to invoking a service" - technical
32  * whitepaper
33  *
34  * "Technical information about a service entry point and construction
35  * specs" - XML Structure Reference
36  *
37  * @author Steve Viens (sviens@apache.org)
38  */

39 public class BindingTemplate implements RegistryObject
40 {
41   // unique key for the bindingTemplate.
42
String JavaDoc bindingKey;
43
44   // the unique key of the enclosing service
45
// is required if the business service is not specified
46
String JavaDoc serviceKey;
47
48   // Optional repeating element. This is zero or more language-qualified
49
// text descriptions of the technical service entry point.
50
Vector JavaDoc descVector;
51
52   // One of accessPoint or hostingRedirector is required. accessPoint may be an
53
// email, a URL, or even a phone nbr. No assumptions can be made about this
54
// field without understanding the specifics of the service.
55
AccessPoint accessPoint;
56
57   // hostingRedirector is required if accessPoint is not supplied. This field
58
// is a redirected reference to a DIFFERENT bindingTemplate. If you query a
59
// bindingTemplate and find a hostingRedirector value, you should retrieve
60
// that bindingTemplate and use it in place of the first one (the one
61
// containing the hostingRedirector).
62
HostingRedirector hostingRedirector;
63
64   // the "technical fingerprint". Contains a set of 0..n references to
65
// tModelInstanceInfo instances that are all completely supported by this web
66
// service.
67
TModelInstanceDetails tModelInstanceDetails;
68
69   // UDDI v3.0 The ability to classify bindingTemplates with
70
// categoryBags now allows metadata to be attributed directly to
71
// the technical details of a Web service, enabling more granular
72
// searches to be performed on the specific technical metadata
73
// for a given service.
74
CategoryBag categoryBag;
75
76   /**
77    * Constructs a new empty BindingTemplate.
78    */

79   public BindingTemplate()
80   {
81   }
82
83   /**
84    * Sets the bindingkey of this bindingtemplate to the given key.
85    *
86    * @param key The new bindingkey of this bindingtemplate.
87    */

88   public void setBindingKey(String JavaDoc key)
89   {
90     this.bindingKey = key;
91   }
92
93   /**
94    * Returns the bindingkey of this binding template.
95    * @return The bindingkey of this binding template.
96    */

97   public String JavaDoc getBindingKey()
98   {
99     return this.bindingKey;
100   }
101
102   /**
103    * Sets the servicekey of this bindingtemplate.
104    *
105    * @param key The new service key.
106    */

107   public void setServiceKey(String JavaDoc key)
108   {
109     this.serviceKey = key;
110   }
111
112   /**
113    * Returns the servicekey of this bindingtemplate. This method can return null
114    * if the business service for this binding template has been set and if the
115    * service key for this binding template has not been set.
116    *
117    * @return The servicekey of this bindingtemplate.
118    */

119   public String JavaDoc getServiceKey()
120   {
121     return this.serviceKey;
122   }
123
124   /**
125    * Adds the given description. If there was already a description with the
126    * same language-code as the new description, an exception will be thrown.
127    *
128    * @param desc The description to add.
129    */

130   public void addDescription(Description desc)
131   {
132     if (this.descVector == null)
133       this.descVector = new Vector JavaDoc();
134     this.descVector.add(desc);
135   }
136
137   /**
138    * Sets the description list to the current one. Ignores any object in the
139    * collection that is not an "instanceof" the Description class.
140    *
141    * @param descs Descriptions of Description objects to set
142    */

143   public void setDescriptionVector(Vector JavaDoc descs)
144   {
145     this.descVector = descs;
146   }
147
148   /**
149    * Returns the descriptions.
150    *
151    * @return the descriptions. If the aren't any descriptions, an empty
152    * enumeration is returned.
153    */

154   public Vector JavaDoc getDescriptionVector()
155   {
156     return this.descVector;
157   }
158
159   /**
160    * Sets the AccessPoint of this BindingTemplate. If the new AccessPoint is
161    * not null and if this BindingTemplate also contains a HostingRedirector,
162    * that HostingRedirector is set to null.
163    *
164    * @param point The new AccessPoint of this BindingTemplate.
165    */

166   public void setAccessPoint(AccessPoint point)
167   {
168     this.accessPoint = point;
169   }
170
171   /**
172    * Returns the accesspoint of this binding template.
173    *
174    * @return The accesspoint of this binding template, or null if the hosting
175    * redirector of this binding template has been set.
176    */

177   public AccessPoint getAccessPoint()
178   {
179     return this.accessPoint;
180   }
181
182   /**
183    * Sets the hosting redirector of this BindingTemplate. If the new
184    * HostingRedirector is not null and if this BindingTemplate also contains
185    * an AccessPoint, that AccessPoint is set to null.
186    *
187    * @param director The new HostingRedirector of this BindingTemplate.
188    */

189   public void setHostingRedirector(HostingRedirector director)
190   {
191     this.hostingRedirector = director;
192   }
193
194   /**
195    * Returns the hosting redirector of this binding template.
196    *
197    * @return The hosting redirector of this BindingTemplate, or null if the
198    * AccessPoint of this BindingTemplate has been set.
199    */

200   public HostingRedirector getHostingRedirector()
201   {
202     return this.hostingRedirector;
203   }
204
205
206   /**
207    * Returns the tModelInstanceDetails of this binding template.
208    *
209    * @return The tModelInstanceDetails of this binding template. If this binding
210    * template doesn't contain any tModelInstanceDetails, an empty enumeration is returned.
211    */

212   public TModelInstanceDetails getTModelInstanceDetails()
213   {
214     return this.tModelInstanceDetails;
215   }
216
217   /**
218    * Sets the tModelInstanceDetails of this binding template.
219    */

220   public void setTModelInstanceDetails(TModelInstanceDetails details)
221   {
222     this.tModelInstanceDetails = details;
223   }
224
225   /**
226    * Add a category to the categorybag of this binding template.
227    * @param ref The category to add.
228    */

229   public void addCategory(KeyedReference ref)
230   {
231     // just return if the KeyedReference parameter is null (nothing to add)
232
if (ref == null)
233       return;
234
235     // make sure the CategoryBag has been initialized
236
if (this.categoryBag == null)
237       this.categoryBag = new CategoryBag();
238
239     this.categoryBag.addKeyedReference(ref);
240   }
241
242   /**
243    * Returns the categorybag of this binding template. If this binding
244    * template doesn't contain any categories, an empty enumeration is
245    * returned.
246    *
247    * @return The categorybag of this binding template.
248    */

249   public CategoryBag getCategoryBag()
250   {
251     return this.categoryBag;
252   }
253
254   /**
255    * Set the categorybag of this binding template to the given one.
256    *
257    * @param bag The new categorybag.
258    */

259   public void setCategoryBag(CategoryBag bag)
260   {
261     this.categoryBag = bag;
262   }
263 }
Popular Tags