View Javadoc

    1   /***
    2    * @(#)InterceptorDescriptor.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 InterceptorDescriptor.
    31   *
    32   * @version $Revision: 1.5 $ $Date: 2005/05/22 06:47:43 $
    33   */
    34  public class InterceptorDescriptor extends
    35          org.exolab.castor.xml.util.XMLClassDescriptorImpl {
    36
    37      /***
    38       * Field nsPrefix
    39       */
    40      private java.lang.String nsPrefix;
    41
    42      /***
    43       * Field nsURI
    44       */
    45      private java.lang.String nsURI;
    46
    47      /***
    48       * Field xmlName
    49       */
    50      private java.lang.String xmlName;
    51
    52      /***
    53       * Field identity
    54       */
    55      private org.exolab.castor.xml.XMLFieldDescriptor identity;
    56
    57      public InterceptorDescriptor() {
    58          super();
    59          xmlName = "interceptor";
    60
    61          //-- set grouping compositor
    62          setCompositorAsSequence();
    63          org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
    64          org.exolab.castor.xml.XMLFieldHandler handler = null;
    65          org.exolab.castor.xml.FieldValidator fieldValidator = null;
    66          //-- initialize attribute descriptors
    67
    68          //-- initialize element descriptors
    69
    70          //-- _name
    71          desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
    72                  java.lang.String.class, "_name", "name",
    73                  org.exolab.castor.xml.NodeType.Element);
    74          desc.setImmutable(true);
    75          handler = (new org.exolab.castor.xml.XMLFieldHandler() {
    76              public java.lang.Object getValue(java.lang.Object object)
    77                      throws IllegalStateException {
    78                  Interceptor target = (Interceptor) object;
    79                  return target.getName();
    80              }
    81
    82              public void setValue(java.lang.Object object, java.lang.Object value)
    83                      throws IllegalStateException, IllegalArgumentException {
    84                  try {
    85                      Interceptor target = (Interceptor) object;
    86                      target.setName((java.lang.String) value);
    87                  } catch (java.lang.Exception ex) {
    88                      throw new IllegalStateException(ex.toString());
    89                  }
    90              }
    91
    92              public java.lang.Object newInstance(java.lang.Object parent) {
    93                  return null;
    94              }
    95          });
    96          desc.setHandler(handler);
    97          desc.setRequired(true);
    98          desc.setMultivalued(false);
    99          addFieldDescriptor(desc);
    100
    101         //-- validation code for: _name
    102         fieldValidator = new org.exolab.castor.xml.FieldValidator();
    103         fieldValidator.setMinOccurs(1);
    104         { //-- local scope
    105             StringValidator typeValidator = new StringValidator();
    106             typeValidator.setWhiteSpace("preserve");
    107             fieldValidator.setValidator(typeValidator);
    108         }
    109         desc.setValidator(fieldValidator);
    110         //-- _value
    111         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
    112                 java.lang.String.class, "_value", "value",
    113                 org.exolab.castor.xml.NodeType.Element);
    114         desc.setImmutable(true);
    115         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
    116             public java.lang.Object getValue(java.lang.Object object)
    117                     throws IllegalStateException {
    118                 Interceptor target = (Interceptor) object;
    119                 return target.getValue();
    120             }
    121
    122             public void setValue(java.lang.Object object, java.lang.Object value)
    123                     throws IllegalStateException, IllegalArgumentException {
    124                 try {
    125                     Interceptor target = (Interceptor) object;
    126                     target.setValue((java.lang.String) value);
    127                 } catch (java.lang.Exception ex) {
    128                     throw new IllegalStateException(ex.toString());
    129                 }
    130             }
    131
    132             public java.lang.Object newInstance(java.lang.Object parent) {
    133                 return null;
    134             }
    135         });
    136         desc.setHandler(handler);
    137         desc.setRequired(true);
    138         desc.setMultivalued(false);
    139         addFieldDescriptor(desc);
    140
    141         //-- validation code for: _value
    142         fieldValidator = new org.exolab.castor.xml.FieldValidator();
    143         fieldValidator.setMinOccurs(1);
    144         { //-- local scope
    145             StringValidator typeValidator = new StringValidator();
    146             typeValidator.setWhiteSpace("preserve");
    147             fieldValidator.setValidator(typeValidator);
    148         }
    149         desc.setValidator(fieldValidator);
    150     }
    151
    152     /***
    153      * Method getAccessMode
    154      */
    155     public org.exolab.castor.mapping.AccessMode getAccessMode() {
    156         return null;
    157     }
    158
    159     /***
    160      * Method getExtends
    161      */
    162     public org.exolab.castor.mapping.ClassDescriptor getExtends() {
    163         return null;
    164     }
    165
    166     /***
    167      * Method getIdentity
    168      */
    169     public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
    170         return identity;
    171     }
    172
    173     /***
    174      * Method getJavaClass
    175      */
    176     public java.lang.Class getJavaClass() {
    177         return org.huihoo.jfox.soaf.schema.config.Interceptor.class;
    178     }
    179
    180     /***
    181      * Method getNameSpacePrefix
    182      */
    183     public java.lang.String getNameSpacePrefix() {
    184         return nsPrefix;
    185     }
    186
    187     /***
    188      * Method getNameSpaceURI
    189      */
    190     public java.lang.String getNameSpaceURI() {
    191         return nsURI;
    192     }
    193
    194     /***
    195      * Method getValidator
    196      */
    197     public org.exolab.castor.xml.TypeValidator getValidator() {
    198         return this;
    199     }
    200
    201     /***
    202      * Method getXMLName
    203      */
    204     public java.lang.String getXMLName() {
    205         return xmlName;
    206     }
    207
    208 }