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.OverviewDoc;
22  import org.apache.juddi.datatype.RegistryObject;
23  
24  /***
25   * Holds service-instance specific information that is required to either
26   * understand the service implementation details relative to a specific
27   * tModelKey reference, or to provide further parameter and settings support.
28   * If present this element should not be empty.
29   *
30   * @author Steve Viens (sviens@apache.org)
31   */
32  public class InstanceDetails implements RegistryObject
33  {
34    // Optional repeating element. This language-quailified string is
35    // intended for holding a description of the purpose and/or use of the
36    // particular InstanceDetails entry.
37    Vector descVector;
38  
39    // Optional, used to house references to remote descriptive or instructions
40    // related to proper use of a bindingTemplate technical sub-element.
41    OverviewDoc overviewDoc;
42  
43    // Optional, used to contain settings parameters or a URL reference to a
44    // file that contains settings or parameters required to use a specific
45    // facet of a bindingTemplate description. If used to house the parameters
46    // themselves, the suggested content is a namespace qualifed XML string -
47    // using a namespace outside of the XML schema. If used to house a URL
48    // pointer to a file, the suggested format is a URL that is suitable for
49    // retrieving the settings or parameters via HTTP GET.
50    String instanceParms;
51  
52    /***
53     * Construct a new empty instanceDetails object.
54     */
55    public InstanceDetails()
56    {
57    }
58  
59    /***
60     * Adds the given description. If there was already a description with the
61     * same language-code as the new description, an exception will be thrown.
62     *
63     * @param desc The description to add.
64     *  languagecode.
65     */
66    public void addDescription(Description desc)
67    {
68      if (this.descVector == null)
69        this.descVector = new Vector();
70      this.descVector.add(desc);
71    }
72  
73    /***
74     * Sets the description list to the current one. Ignores any object in the
75     * collection that is not an "instanceof" the Description class.
76     *
77     * @param descs Collection of Description objects to set
78     */
79    public void setDescriptionVector(Vector descs)
80    {
81      this.descVector = descs;
82    }
83  
84    /***
85     * Returns the descriptions.
86     *
87     * @return the descriptions.
88     */
89    public Vector getDescriptionVector()
90    {
91      return this.descVector;
92    }
93  
94    /***
95     * Sets the overview document of this instanceDetails to the given overview
96     * document.
97     *
98     * @param doc The new overview document, or null if the instanceDetails
99     *  doesn't have an overview document anymore.
100    */
101   public void setOverviewDoc(OverviewDoc doc)
102   {
103     this.overviewDoc = doc;
104   }
105 
106   /***
107    * Returns the overview document of this instanceDetails.
108    *
109    * @return The overview document of this instanceDetails, or null if this
110    *  instanceDetails doesn't have an overvieuw document.
111    */
112   public OverviewDoc getOverviewDoc()
113   {
114     return this.overviewDoc;
115   }
116 
117   /***
118    * Sets the instance parameters of this instanceDetails to the given instance
119    * parameters.
120    *
121    * @param parms The new instance parameters, or null if this instanceDetails
122    *  doesn't have instance parameters anymore.
123    */
124   public void setInstanceParms(String parms)
125   {
126     this.instanceParms = parms;
127   }
128 
129   /***
130    * Sets the instance parameters of this instanceDetails to the given instance
131    * parameters.
132    *
133    * @param parms The new instance parameters, or null if this instanceDetails
134    *  doesn't have instance parameters anymore.
135    */
136   public void setInstanceParms(InstanceParms parms)
137   {
138     if ((parms != null) && (parms.getValue() != null))
139       setInstanceParms(parms.getValue());
140   }
141 
142   /***
143    * Returns the instance parameters of this instanceDetails as a String.
144    *
145    * @return An InstanceParms instance containing the value of the instance
146    *  parameters of this instanceDetails, or null if this instanceDetails
147    *  doesn't have instance parameters.
148    */
149   public InstanceParms getInstanceParms()
150   {
151     if (this.instanceParms != null)
152       return new InstanceParms(this.instanceParms);
153     else
154       return null;
155   }
156 
157   /***
158    * Returns the instance parameters of this instanceDetails as a String.
159    *
160    * @return A String containing the text value of the instance parameters
161    *  of this instanceDetails, or null if this instanceDetails doesn't have
162    *  instance parameters.
163    */
164   public String getInstanceParmsString()
165   {
166     return this.instanceParms;
167   }
168 }