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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */16package org.apache.juddi.datatype.binding;
1718import java.util.Vector;
1920import org.apache.juddi.datatype.CategoryBag;
21import org.apache.juddi.datatype.Description;
22import org.apache.juddi.datatype.KeyedReference;
23import org.apache.juddi.datatype.RegistryObject;
2425/***26 * Technical web service description. Contains "information relevant for27 * application programs that need to connect to and then communicate with a28 * remote Web Service. This information includes the address to make contact29 * with a Web Service, as well as support for option information that can be30 * used to describe both hosted services and services that require additional31 * values to be discovered prior to invoking a service" - technical32 * whitepaper33 *34 * "Technical information about a service entry point and construction35 * specs" - XML Structure Reference36 *37 * @author Steve Viens (sviens@apache.org)38 */39publicclassBindingTemplate implements RegistryObject40 {
41// unique key for the bindingTemplate.42 String bindingKey;
4344// the unique key of the enclosing service45// is required if the business service is not specified46 String serviceKey;
4748// Optional repeating element. This is zero or more language-qualified49// text descriptions of the technical service entry point.50 Vector descVector;
5152// One of accessPoint or hostingRedirector is required. accessPoint may be an53// email, a URL, or even a phone nbr. No assumptions can be made about this54// field without understanding the specifics of the service.55AccessPoint accessPoint;
5657// hostingRedirector is required if accessPoint is not supplied. This field58// is a redirected reference to a DIFFERENT bindingTemplate. If you query a59// bindingTemplate and find a hostingRedirector value, you should retrieve60// that bindingTemplate and use it in place of the first one (the one61// containing the hostingRedirector).62HostingRedirector hostingRedirector;
6364// the "technical fingerprint". Contains a set of 0..n references to65// tModelInstanceInfo instances that are all completely supported by this web66// service.67TModelInstanceDetails tModelInstanceDetails;
6869// UDDI v3.0 The ability to classify bindingTemplates with70// categoryBags now allows metadata to be attributed directly to71// the technical details of a Web service, enabling more granular72// searches to be performed on the specific technical metadata73// for a given service.74CategoryBag categoryBag;
7576/***77 * Constructs a new empty BindingTemplate.78 */79publicBindingTemplate()
80 {
81 }
8283/***84 * Sets the bindingkey of this bindingtemplate to the given key.85 *86 * @param key The new bindingkey of this bindingtemplate.87 */88publicvoid setBindingKey(String key)
89 {
90this.bindingKey = key;
91 }
9293/***94 * Returns the bindingkey of this binding template.95 * @return The bindingkey of this binding template.96 */97public String getBindingKey()
98 {
99returnthis.bindingKey;
100 }
101102/***103 * Sets the servicekey of this bindingtemplate.104 *105 * @param key The new service key.106 */107publicvoid setServiceKey(String key)
108 {
109this.serviceKey = key;
110 }
111112/***113 * Returns the servicekey of this bindingtemplate. This method can return null114 * if the business service for this binding template has been set and if the115 * service key for this binding template has not been set.116 *117 * @return The servicekey of this bindingtemplate.118 */119public String getServiceKey()
120 {
121returnthis.serviceKey;
122 }
123124/***125 * Adds the given description. If there was already a description with the126 * same language-code as the new description, an exception will be thrown.127 *128 * @param desc The description to add.129 */130publicvoid addDescription(Description desc)
131 {
132if (this.descVector == null)
133this.descVector = new Vector();
134this.descVector.add(desc);
135 }
136137/***138 * Sets the description list to the current one. Ignores any object in the139 * collection that is not an "instanceof" the Description class.140 *141 * @param descs Descriptions of Description objects to set142 */143publicvoid setDescriptionVector(Vector descs)
144 {
145this.descVector = descs;
146 }
147148/***149 * Returns the descriptions.150 *151 * @return the descriptions. If the aren't any descriptions, an empty152 * enumeration is returned.153 */154public Vector getDescriptionVector()
155 {
156returnthis.descVector;
157 }
158159/***160 * Sets the AccessPoint of this BindingTemplate. If the new AccessPoint is161 * 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 */166publicvoid setAccessPoint(AccessPoint point)
167 {
168this.accessPoint = point;
169 }
170171/***172 * Returns the accesspoint of this binding template.173 *174 * @return The accesspoint of this binding template, or null if the hosting175 * redirector of this binding template has been set.176 */177publicAccessPoint getAccessPoint()
178 {
179returnthis.accessPoint;
180 }
181182/***183 * Sets the hosting redirector of this BindingTemplate. If the new184 * HostingRedirector is not null and if this BindingTemplate also contains185 * an AccessPoint, that AccessPoint is set to null.186 *187 * @param director The new HostingRedirector of this BindingTemplate.188 */189publicvoid setHostingRedirector(HostingRedirector director)
190 {
191this.hostingRedirector = director;
192 }
193194/***195 * Returns the hosting redirector of this binding template.196 *197 * @return The hosting redirector of this BindingTemplate, or null if the198 * AccessPoint of this BindingTemplate has been set.199 */200publicHostingRedirector getHostingRedirector()
201 {
202returnthis.hostingRedirector;
203 }
204205206/***207 * Returns the tModelInstanceDetails of this binding template.208 *209 * @return The tModelInstanceDetails of this binding template. If this binding210 * template doesn't contain any tModelInstanceDetails, an empty enumeration is returned.211 */212publicTModelInstanceDetails getTModelInstanceDetails()
213 {
214returnthis.tModelInstanceDetails;
215 }
216217/***218 * Sets the tModelInstanceDetails of this binding template.219 */220publicvoid setTModelInstanceDetails(TModelInstanceDetails details)
221 {
222this.tModelInstanceDetails = details;
223 }
224225/***226 * Add a category to the categorybag of this binding template.227 * @param ref The category to add.228 */229publicvoid addCategory(KeyedReference ref)
230 {
231// just return if the KeyedReference parameter is null (nothing to add)232if (ref == null)
233return;
234235// make sure the CategoryBag has been initialized236if (this.categoryBag == null)
237this.categoryBag = newCategoryBag();
238239this.categoryBag.addKeyedReference(ref);
240 }
241242/***243 * Returns the categorybag of this binding template. If this binding244 * template doesn't contain any categories, an empty enumeration is245 * returned.246 *247 * @return The categorybag of this binding template.248 */249publicCategoryBag getCategoryBag()
250 {
251returnthis.categoryBag;
252 }
253254/***255 * Set the categorybag of this binding template to the given one.256 *257 * @param bag The new categorybag.258 */259publicvoid setCategoryBag(CategoryBag bag)
260 {
261this.categoryBag = bag;
262 }
263 }