View Javadoc

    1   /***
    2    * @(#)Configuration.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 java.io.Reader;
    28
    29  import org.exolab.castor.xml.Marshaller;
    30  import org.exolab.castor.xml.Unmarshaller;
    31  import org.exolab.castor.xml.ValidationException;
    32  import org.exolab.castor.xml.Validator;
    33
    34  /***
    35   * Configuration.
    36   *
    37   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
    38   * @version $Revision: 1.10 $ $Date: 2005/05/22 06:47:43 $
    39   * @version Revision: 1.0
    40   */
    41
    42  public class Configuration implements java.io.Serializable {
    43
    44      /***
    45       * Field _serviceConfiguration
    46       */
    47      private ServiceConfiguration _serviceConfiguration;
    48
    49      /***
    50       * Field _systemInterceptor
    51       */
    52      private SystemInterceptor _systemInterceptor;
    53
    54      public Configuration() {
    55          super();
    56      }
    57
    58      /***
    59       * Method getServiceConfigurationReturns the value of field
    60       * 'serviceConfiguration'.
    61       *
    62       * @return the value of field 'serviceConfiguration'.
    63       */
    64      public ServiceConfiguration getServiceConfiguration() {
    65          return this._serviceConfiguration;
    66      }
    67
    68      /***
    69       * Method getSystemInterceptorReturns the value of field
    70       * 'systemInterceptor'.
    71       *
    72       * @return the value of field 'systemInterceptor'.
    73       */
    74      public SystemInterceptor getSystemInterceptor() {
    75          return this._systemInterceptor;
    76      }
    77
    78      /***
    79       * Method isValid
    80       */
    81      public boolean isValid() {
    82          try {
    83              validate();
    84          } catch (org.exolab.castor.xml.ValidationException vex) {
    85              return false;
    86          }
    87          return true;
    88      }
    89
    90      /***
    91       * Method marshal
    92       *
    93       * @param out
    94       */
    95      public void marshal(java.io.Writer out)
    96              throws org.exolab.castor.xml.MarshalException,
    97              org.exolab.castor.xml.ValidationException {
    98
    99          Marshaller.marshal(this, out);
    100     }
    101
    102     /***
    103      * Method marshal
    104      *
    105      * @param handler
    106      */
    107     public void marshal(org.xml.sax.ContentHandler handler)
    108             throws java.io.IOException, org.exolab.castor.xml.MarshalException,
    109             org.exolab.castor.xml.ValidationException {
    110
    111         Marshaller.marshal(this, handler);
    112     }
    113
    114     /***
    115      * Method setServiceConfigurationSets the value of field
    116      * 'serviceConfiguration'.
    117      *
    118      * @param serviceConfiguration the value of field 'serviceConfiguration'.
    119      */
    120     public void setServiceConfiguration(
    121             ServiceConfiguration serviceConfiguration) {
    122         this._serviceConfiguration = serviceConfiguration;
    123     }
    124
    125     /***
    126      * Method setSystemInterceptorSets the value of field 'systemInterceptor'.
    127      *
    128      * @param systemInterceptor the value of field 'systemInterceptor'.
    129      */
    130     public void setSystemInterceptor(SystemInterceptor systemInterceptor) {
    131         this._systemInterceptor = systemInterceptor;
    132     }
    133
    134     /***
    135      * Method unmarshal
    136      *
    137      * @param reader
    138      */
    139     public static Configuration unmarshal(Reader reader)
    140             throws org.exolab.castor.xml.MarshalException,
    141             org.exolab.castor.xml.ValidationException {
    142         return (Configuration) Unmarshaller.unmarshal(
    143                 org.huihoo.jfox.soaf.schema.config.Configuration.class, reader);
    144     }
    145
    146     /***
    147      * Method validate
    148      */
    149     public void validate() throws ValidationException {
    150         Validator validator = new Validator();
    151         validator.validate(this);
    152     }
    153
    154 }