View Javadoc

1   /***
2    * @(#)ConfigurationEntryDescriptor.java
3    * 
4    * JFoxSOAF, Service-Oriented Application Framework
5    * 
6    * Copyright(c) JFoxSOAF Team
7    * 
8    * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
9    * you may not use this file except in compliance with the License. 
10   * You may obtain a copy of the License at  
11   * 
12   * http://www.gnu.org/copyleft/lesser.html
13   * 
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, 
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
17   * See the License for the specific language governing permissions and 
18   * limitations under the License. 
19   * 
20   * For more information, please visit:
21   * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22   * http://www.huihoo.org/jfox/jfoxsoaf
23   */
24  
25  package org.huihoo.jfox.soaf.schema.config;
26  
27  import org.exolab.castor.xml.validators.StringValidator;
28  
29  /***
30   * Class ConfigurationEntryDescriptor.
31   * 
32   * @version $Revision: 1.6 $ $Date: 2005/01/17 13:29:58 $
33   */
34  
35  public class ConfigurationEntryDescriptor extends
36          org.exolab.castor.xml.util.XMLClassDescriptorImpl {
37  
38      /***
39       * Field nsPrefix
40       */
41      private java.lang.String nsPrefix;
42  
43      /***
44       * Field nsURI
45       */
46      private java.lang.String nsURI;
47  
48      /***
49       * Field xmlName
50       */
51      private java.lang.String xmlName;
52  
53      /***
54       * Field identity
55       */
56      private org.exolab.castor.xml.XMLFieldDescriptor identity;
57  
58      public ConfigurationEntryDescriptor() {
59          super();
60          xmlName = "configuration-entry";
61  
62          //-- set grouping compositor
63          setCompositorAsSequence();
64          org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
65          org.exolab.castor.xml.XMLFieldHandler handler = null;
66          org.exolab.castor.xml.FieldValidator fieldValidator = null;
67          //-- initialize attribute descriptors
68  
69          //-- initialize element descriptors
70  
71          //-- _name
72          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
73                  java.lang.String.class, "_name", "name",
74                  org.exolab.castor.xml.NodeType.Element);
75          desc.setImmutable(true);
76          handler = (new org.exolab.castor.xml.XMLFieldHandler() {
77              public java.lang.Object getValue(java.lang.Object object)
78                      throws IllegalStateException {
79                  ConfigurationEntry target = (ConfigurationEntry) object;
80                  return target.getName();
81              }
82  
83              public void setValue(java.lang.Object object, java.lang.Object value)
84                      throws IllegalStateException, IllegalArgumentException {
85                  try {
86                      ConfigurationEntry target = (ConfigurationEntry) object;
87                      target.setName((java.lang.String) value);
88                  } catch (java.lang.Exception ex) {
89                      throw new IllegalStateException(ex.toString());
90                  }
91              }
92  
93              public java.lang.Object newInstance(java.lang.Object parent) {
94                  return null;
95              }
96          });
97          desc.setHandler(handler);
98          desc.setRequired(true);
99          desc.setMultivalued(false);
100         addFieldDescriptor(desc);
101 
102         //-- validation code for: _name
103         fieldValidator = new org.exolab.castor.xml.FieldValidator();
104         fieldValidator.setMinOccurs(1);
105         { //-- local scope
106             StringValidator typeValidator = new StringValidator();
107             typeValidator.setWhiteSpace("preserve");
108             fieldValidator.setValidator(typeValidator);
109         }
110         desc.setValidator(fieldValidator);
111         //-- _value
112         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
113                 java.lang.String.class, "_value", "value",
114                 org.exolab.castor.xml.NodeType.Element);
115         desc.setImmutable(true);
116         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
117             public java.lang.Object getValue(java.lang.Object object)
118                     throws IllegalStateException {
119                 ConfigurationEntry target = (ConfigurationEntry) object;
120                 return target.getValue();
121             }
122 
123             public void setValue(java.lang.Object object, java.lang.Object value)
124                     throws IllegalStateException, IllegalArgumentException {
125                 try {
126                     ConfigurationEntry target = (ConfigurationEntry) object;
127                     target.setValue((java.lang.String) value);
128                 } catch (java.lang.Exception ex) {
129                     throw new IllegalStateException(ex.toString());
130                 }
131             }
132 
133             public java.lang.Object newInstance(java.lang.Object parent) {
134                 return null;
135             }
136         });
137         desc.setHandler(handler);
138         desc.setRequired(true);
139         desc.setMultivalued(false);
140         addFieldDescriptor(desc);
141 
142         //-- validation code for: _value
143         fieldValidator = new org.exolab.castor.xml.FieldValidator();
144         fieldValidator.setMinOccurs(1);
145         { //-- local scope
146             StringValidator typeValidator = new StringValidator();
147             typeValidator.setWhiteSpace("preserve");
148             fieldValidator.setValidator(typeValidator);
149         }
150         desc.setValidator(fieldValidator);
151     }
152 
153     /***
154      * Method getAccessMode
155      */
156     public org.exolab.castor.mapping.AccessMode getAccessMode() {
157         return null;
158     }
159 
160     /***
161      * Method getExtends
162      */
163     public org.exolab.castor.mapping.ClassDescriptor getExtends() {
164         return null;
165     }
166 
167     /***
168      * Method getIdentity
169      */
170     public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
171         return identity;
172     }
173 
174     /***
175      * Method getJavaClass
176      */
177     public java.lang.Class getJavaClass() {
178         return org.huihoo.jfox.soaf.schema.config.ConfigurationEntry.class;
179     }
180 
181     /***
182      * Method getNameSpacePrefix
183      */
184     public java.lang.String getNameSpacePrefix() {
185         return nsPrefix;
186     }
187 
188     /***
189      * Method getNameSpaceURI
190      */
191     public java.lang.String getNameSpaceURI() {
192         return nsURI;
193     }
194 
195     /***
196      * Method getValidator
197      */
198     public org.exolab.castor.xml.TypeValidator getValidator() {
199         return this;
200     }
201 
202     /***
203      * Method getXMLName
204      */
205     public java.lang.String getXMLName() {
206         return xmlName;
207     }
208 
209 }