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.binding;
17  
18  import java.util.Vector;
19  
20  import org.apache.juddi.datatype.Description;
21  import org.apache.juddi.datatype.RegistryObject;
22  import org.apache.juddi.datatype.TModelKey;
23  
24  /***
25   * A TModelInstanceInfo object represents the BindingTemplate instance
26   * specific details for a single TModel by reference.<p>
27   *
28   * A set of these is held by the TModelInstanceDetails Map. When taken as a
29   * group they form a technically descriptive fingerprint by virtue of the
30   * unordered list of tModelKey references that they form. Each singular
31   * TModelInstanceInfo refers to a single tModel, and its presence in a
32   * bindingTemplate.tModelInstanceDetails implies that this containing web
33   * service supports the tModel that is referenced.
34   *
35   * @author Steve Viens (sviens@apache.org)
36   */
37  public class TModelInstanceInfo implements RegistryObject
38  {
39    // Required attribute. This is the unique key referenced that implies that
40    // the service being described has implementation details that are specified
41    // by the specifications associated with the tModel that is referenced.
42    String tModelKey;
43  
44    // Optional repeating element. This is one or more language qualified text
45    // descriptions that designate what role a TModel referenc plays in the
46    // overall service description.
47    Vector descVector;
48  
49    // Optional, can be used when tModel reference specific settings or other
50    // descriptive information are required to either describe a tModel specific
51    // component of a service description or support services that require
52    // additional technical data support (eg, via settings or other handshake
53    // support). If this element is supplied it should not be empty.
54    InstanceDetails instanceDetails;
55  
56    /***
57     * Constructs a new empty TModelInstanceDetails.
58     */
59    public TModelInstanceInfo()
60    {
61    }
62  
63    /***
64     * Constructs a new empty TModelInstanceDetails.
65     */
66    public TModelInstanceInfo(String key)
67    {
68      this.tModelKey = key;
69    }
70  
71    /***
72     * Sets the tModel key of this tModelInstanceInfo to the given key.
73     *
74     * @param key The key of the tModel this tModelInstanceInfo is
75     *  referencing to.
76     */
77    public void setTModelKey(TModelKey key)
78    {
79      if ((key != null) && (key.getValue() != null))
80        this.tModelKey = key.getValue();
81    }
82  
83    /***
84     * Sets the tModel key of this tModelInstanceInfo to the given key.
85     *
86     * @param key The key of the tModel this tModelInstanceInfo is
87     *  referencing to.
88     */
89    public void setTModelKey(String key)
90    {
91      this.tModelKey = key;
92    }
93  
94    /***
95     * Returns the tModel key of this tModelInstanceInfo.
96     *
97     * @return The tModel key of this tModelInstanceInfo.
98     */
99    public String getTModelKey()
100   {
101     return this.tModelKey;
102   }
103 
104   /***
105    * Add a Description to the collection of Descriptions.
106    *
107    * @param desc The Description to add.
108    */
109   public void addDescription(Description desc)
110   {
111     if (this.descVector == null)
112       this.descVector = new Vector();
113     this.descVector.add(desc);
114   }
115 
116   /***
117    * Sets the Description intance to the one one passed in.
118    *
119    * @param descs Descriptions of Description objects to set
120    */
121   public void setDescriptionVector(Vector descs)
122   {
123     this.descVector = descs;
124   }
125 
126   /***
127    * Returns the descriptions.
128    *
129    * @return the descriptions. If the aren't any descriptions, an empty
130    *  enumeration is returned.
131    */
132   public Vector getDescriptionVector()
133   {
134     return this.descVector;
135   }
136 
137   /***
138    * Sets the instanceDetails of this tModelInstanceInfo to the given
139    * instanceDetails.
140    *
141    * @param details The instanceDetails of this tModelInstanceInfo, or null if
142    *  this tModelInstanceInfo doesn't have any instanceDetails.
143    */
144   public void setInstanceDetails(InstanceDetails details)
145   {
146     this.instanceDetails = details;
147   }
148 
149   /***
150    * Returns the instanceDetails of this tModelInstanceInfo.
151    *
152    * @return The instanceDetails of this tModelInstanceInfo, or null if this
153    *  tModelInstanceInfo doesn't have an instanceDetails.
154    */
155   public InstanceDetails getInstanceDetails()
156   {
157     return this.instanceDetails;
158   }
159 }