View Javadoc

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.tmodel;
17  
18  import java.util.Vector;
19  
20  import org.apache.juddi.datatype.CategoryBag;
21  import org.apache.juddi.datatype.Description;
22  import org.apache.juddi.datatype.IdentifierBag;
23  import org.apache.juddi.datatype.KeyedReference;
24  import org.apache.juddi.datatype.Name;
25  import org.apache.juddi.datatype.OverviewDoc;
26  import org.apache.juddi.datatype.RegistryObject;
27  
28  /***
29   * "Descriptions of specifications for services or taxonomies. Basis for
30   * technical fingerprints" - XML Structure Reference
31   *
32   * The primary role that the tModel plays is to represent a technical
33   * spec. Implementors of that spec reference the tModel with a tModelKey in
34   * a bindingTemplate in the service definition.
35   *
36   * The other place that a tModel reference is used is in the identifierBag and
37   * categoryBag structures. Used in this context the tModel reference represents
38   * a relationship between the keyed name-value pairs to the namespace within
39   * which they are meaningful. Eg, a tModel named "US tax codes". The tModel
40   * is still a specific concept but instead of being a technical specification
41   * it represents a unique namespace within which tax code IDs have meaning.
42   * Once this meaning is established a business can use the tModelKey for the
43   * tax code tModel as a unique reference that qualifies the entry in the
44   * identifierBag. UDDI has already defined a number of tModels including US tax
45   * codes, NAICS, UNSPC, and an unnamed geographic taxonomy.
46   * (See also KeyedReference).
47   *
48   * @author Steve Viens (sviens@apache.org)
49   */
50  public class TModel implements RegistryObject
51  {
52    /***
53     * UDDI Type Taxonomy [uddi-org:types]
54     * This taxonomy assists in general categorization of the tModels themselves.
55     */
56    public static final String TYPES_TMODEL_KEY = "UUID:C1ACF26D-9672-4404-9D70-39B756E62AB4";
57  
58    /***
59     * Business Taxonomy: NAICS (1997 Release) [ntis-gov:naics:1997]
60     * This tModel defines the NAICS (North American Industry Classification
61     * System) 1997 Release industry taxonomy.
62     */
63    public static final String NAICS_TMODEL_KEY = "UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2";
64  
65    /***
66     * Product Taxonomy: UNSPSC (Version 3.1) [unspsc-org:unspsc:3-1]
67     * This tModel defines the UNSPSC (United Nations Standard Products and
68     * Services Code System) version 3.1 product taxonomy.
69     * <B>This taxonomy has been superceeded by the Universal Standard Products
70     * and Services Classification (see {@link #UNSPSC_73_TMODEL_KEY}) taxonomy.
71     */
72    public static final String UNSPSC_TMODEL_KEY = "UUID:DB77450D-9FA8-45D4-A7BC-04411D14E384";
73  
74    /***
75     * Product and Services Taxonomy:UNSPSC (Version 7.3) [unspsc-org:unspsc]
76     * This tModel defines the UNSPSC (Universal Standard Products and Services
77     * Classification) version 7.3 product and services taxonomy.
78     */
79    public static final String UNSPSC_73_TMODEL_KEY = "UUID:CD153257-086A-4237-B336-6BDCBDCC6634";
80  
81    /***
82     * ISO 3166 Geographic Taxonomy [uddi-org:iso-ch:3166-1999]
83     * This tModel defines the ISO 3166 geographic classification taxonomy.
84     */
85    public static final String ISO_CH_TMODEL_KEY = "UUID:4E49A8D6-D5A2-4FC2-93A0-0411D8D19E88";
86  
87    /***
88     * UDDI Other Taxonomy [uddi-org:misc-taxomony]
89     * This tModel defines an unidentified taxonomy.
90     */
91    public static final String GENERAL_KEYWORDS_TMODEL_KEY = "UUID:A035A07C-F362-44dd-8F95-E2B134BF43B4";
92  
93    /***
94     * UDDI Owning Business [uddi-org:owningBusiness]
95     * This tModel identifies the businessEntity that published or owns the
96     * tagged information. Used with tModels to establish an 'owned'
97     * relationship with a registered businessEntity.
98     */
99    public static final String OWNING_BUSINESS_TMODEL_KEY = "UUID:4064C064-6D14-4F35-8953-9652106476A9";
100 
101   /***
102    * UDDI businessEntity relationship [uddi-org:relationships]
103    * This tModel is used to describe business relationships. Used in the
104    * publisher assertion messages.
105    */
106   public static final String RELATIONSHIPS_TMODEL_KEY = "UUID:807A2C6A-EE22-470D-ADC7-E0424A337C03";
107 
108   /***
109    * UDDI Operators [uddi-org:operators]
110    * This checked value set is used to identify UDDI operators.
111    */
112   public static final String OPERATORS_TMODEL_KEY = "UUID:327A56F0-3299-4461-BC23-5CD513E95C55";
113 
114   /***
115    * D-U-N-S� Number Identifier System [dnb-com:D-U-N-S]
116    * This tModel is used for the Dun & Bradstreet D-U-N-S� Number identifier.
117    */
118   public static final String D_U_N_S_TMODEL_KEY = "UUID:8609C81E-EE1F-4D5A-B202-3EB13AD01823";
119 
120   /***
121    * Thomas Register Supplier Identifier Code System
122    * [thomasregister-com:supplierID]
123    * This tModel is used for the Thomas Register supplier identifier codes.
124    */
125   public static final String THOMAS_REGISTER_TMODEL_KEY = "UUID:B1B1BAF5-2329-43E6-AE13-BA8E97195039";
126 
127   /***
128    * UDDI IsReplacedBy [uddi-org:isReplacedBy]
129    * An identifier system used to point (using UDDI keys) to the tModel
130    * (or businessEntity) that is the logical replacement for the one in
131    * which isReplacedBy is used.
132    */
133   public static final String IS_REPLACED_BY_TMODEL_KEY = "UUID:E59AE320-77A5-11D5-B898-0004AC49CC1E";
134 
135   /***
136    * Email based web service [uddi-org:smtp]
137    * This tModel is used to describe a web service that is invoked through
138    * SMTP email transmissions. These transmissions may be between people or
139    * applications.
140    */
141   public static final String SMTP_TMODEL_KEY = "UUID:93335D49-3EFB-48A0-ACEA-EA102B60DDC6";
142 
143   /***
144    * Fax based web service [uddi-org:fax]
145    * This tModel is used to describe a web service that is invoked through
146    * fax transmissions. These transmissions may be between people or
147    * applications.
148    */
149   public static final String FAX_TMODEL_KEY = "UUID:1A2B00BE-6E2C-42F5-875B-56F32686E0E7";
150 
151   /***
152    * FTP based web service [uddi-org:ftp]
153    * This tModel is used to describe a web service that is invoked through
154    * file transfers via the ftp protocol.
155    */
156   public static final String FTP_TMODEL_KEY = "UUID:5FCF5CD0-629A-4C50-8B16-F94E9CF2A674";
157 
158   /***
159    * Telephone based web service [uddi-org:telephone]
160    * This tModel is used to describe a web service that is invoked through a
161    * telephone call and interaction by voice and/or touch-tone.
162    */
163   public static final String TELEPHONE_TMODEL_KEY = "UUID:38E12427-5536-4260-A6F9-B5B530E63A07";
164 
165   /***
166    * Web browser or HTTP based web service [uddi-org:http]
167    * This tModel is used to describe a web service that is invoked through a
168    * web browser and/or the HTTP protocol.
169    */
170   public static final String HTTP_TMODEL_KEY = "UUID:68DE9E80-AD09-469D-8A37-088422BFBC36";
171 
172   /***
173    * HTTP Web Home Page URL [uddi-org:homepage]
174    * This tModel is used as the bindingTemplate fingerprint for a web home
175    * page reference.
176    */
177   public static final String HOMEPAGE_TMODEL_KEY = "UUID:4CEC1CEF-1F68-4B23-8CB7-8BAA763AEB89";
178 
179   String tModelKey;
180   String authorizedName;
181   String operator;
182   Name name;
183   Vector descVector;
184   OverviewDoc overviewDoc;
185   IdentifierBag identifierBag;
186   CategoryBag categoryBag;
187 
188   /***
189    * Construct a new initialized TModel instance.
190    */
191   public TModel()
192   {
193   }
194 
195   /***
196    * Construct a brand new TModel with a given name.  Assumes this is a brand
197    * new TModel instance and doesn't have a key yet - one is created in the
198    * constructor.
199    *
200    * @param name The name of the tModel.
201    */
202   public TModel(String name)
203   {
204     setName(name);
205   }
206 
207   /***
208    * Construct a new tModel with a given name and key.
209    *
210    * @param name The name of the tModel, given as a string.
211    * @param key The key of the tModel.
212    */
213   public TModel(String name,String key)
214   {
215     setName(name);
216     this.tModelKey = key;
217   }
218 
219   /***
220    * Sets the key of this tModel to the given key.
221    *
222    * @param key The new key of this tModel.
223    */
224   public void setTModelKey(String key)
225   {
226     this.tModelKey = key;
227   }
228 
229   /***
230    * Returns the key of this tModel.
231    *
232    * @return The key of this tModel.
233    *
234    */
235   public String getTModelKey()
236   {
237     return this.tModelKey;
238   }
239 
240   /***
241    * Sets the authorized name of this tModel to the given name.
242    *
243    * @param name The new authorized name of this tModel.
244    */
245   public void setAuthorizedName(String name)
246   {
247     this.authorizedName = name;
248   }
249 
250   /***
251    * Returns the authorized name of this tModel.
252    *
253    * @return The authorized name of this tModel, or null if this tModel
254    * doesn't have an authorized name.
255    */
256   public String getAuthorizedName()
257   {
258     return this.authorizedName;
259   }
260 
261   /***
262    * Sets the name of this tModel to the given name.
263    *
264    * @param name The new name of this tModel.
265    */
266   public void setName(String nameValue)
267   {
268       if (nameValue == null) {
269           this.name = null;
270       } else {
271           this.name = new Name(nameValue);
272       }
273   }
274 
275   /***
276    * Returns the name of this tModel.
277    *
278    * @return The name of this tModel.
279    */
280   public Name getName()
281   {
282       return this.name;
283   }
284 
285   /***
286     * Sets the name of this tModel to the given name.
287     *
288     * @param name The new name of this tModel.
289     */
290   public void setName(Name name)
291   {
292       this.name = name;
293   }
294 
295   /***
296    * Adds the given description.
297    *
298    * @param descr The description to add.
299    */
300   public void addDescription(Description descr)
301   {
302     // just return if the Description parameter is null (nothing to add)
303     if (descr == null)
304       return;
305 
306     if (this.descVector == null)
307       this.descVector = new Vector();
308     this.descVector.add(descr);
309   }
310 
311   /***
312    * Sets the description list to the current one. Ignores any object in the
313    * collection that is not an "instanceof" the Description class.
314    *
315    * @param descriptions Collection of Description objects to set
316    */
317   public void setDescriptionVector(Vector descriptions)
318   {
319     this.descVector = descriptions;
320   }
321 
322   /***
323    * Returns the descriptions.
324    *
325    * @return the descriptions. If the aren't any descriptions, an empty
326    *  enumeration is returned.
327    */
328   public Vector getDescriptionVector()
329   {
330     return this.descVector;
331   }
332 
333   /***
334    * Sets the overviewDoc of this tModel to the given overviewDoc.
335    *
336    * @param doc The new overviewDoc of this tModel, or null if this tModel
337    * doesn't have an overviewDoc anymore.
338    */
339   public void setOverviewDoc(OverviewDoc doc)
340   {
341     this.overviewDoc = doc;
342   }
343 
344   /***
345    * Returns the overviewDoc of this tModel.
346    *
347    * @return The overviewDoc of this tModel, or null if this tModel doesn't have an overviewDoc.
348    */
349   public OverviewDoc getOverviewDoc()
350   {
351     return this.overviewDoc;
352   }
353 
354   /***
355    * Sets the operator of this tModel to the given operator.
356    *
357    * @param operator The new operator of this tModel.
358    */
359   public void setOperator(String operator)
360   {
361     this.operator = operator;
362   }
363 
364   /***
365    * Returns the operator of this tModel.
366    *
367    * @return The operator of this tModel, or null if this tModel
368    * doesn't have an operator.
369    */
370   public String getOperator()
371   {
372     return this.operator;
373   }
374 
375   /***
376    * Add a new identifier to this tModel.
377    *
378    * @param k The identifier to add.
379    */
380   public void addIdentifier(KeyedReference k)
381   {
382     if (this.identifierBag == null)
383       this.identifierBag = new IdentifierBag();
384     this.identifierBag.addKeyedReference(k);
385   }
386 
387   /***
388    * Returns the identifierbag of this tModel.
389    *
390    * @return The identifierbag of this tModel. If this tModel doesn't
391    * contain any identifiers, an empty enumeration is returned.
392    */
393   public IdentifierBag getIdentifierBag()
394   {
395     return this.identifierBag;
396   }
397 
398   /***
399    * Set the categorybag of this business entity to the given one.
400    *
401    * @param bag The new categorybag.
402    */
403   public void setIdentifierBag(IdentifierBag bag)
404   {
405     this.identifierBag = bag;
406   }
407 
408   /***
409    * Add a new category to this tModel.
410    *
411    * @param keyedRef The category to add.
412    */
413   public void addCategory(KeyedReference keyedRef)
414   {
415     if (this.categoryBag == null)
416       this.categoryBag = new CategoryBag();
417     this.categoryBag.addKeyedReference(keyedRef);
418   }
419 
420   /***
421    * Returns the categorybag of this tModel.
422    *
423    * @return The categorybag of this tModel. If this tModel doesn't
424    * contain any categories, an empty enumeration is returned.
425    */
426   public CategoryBag getCategoryBag()
427   {
428     return this.categoryBag;
429   }
430 
431   /***
432    * Set the categorybag of this business entity to the given one.
433    *
434    * @param bag The new categorybag.
435    */
436   public void setCategoryBag(CategoryBag bag)
437   {
438     this.categoryBag = bag;
439   }
440 }