View Javadoc

1   package org.apache.torque.generator.configuration;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.HashSet;
23  import java.util.Set;
24  
25  import org.apache.torque.generator.configuration.mergepoint.ActionSaxHandlerFactories;
26  import org.apache.torque.generator.configuration.mergepoint.OptionsSaxHandlerFactories;
27  import org.apache.torque.generator.configuration.source.SourceSaxHandlerFactories;
28  import org.apache.torque.generator.source.stream.PropertiesSourceFormat;
29  import org.apache.torque.generator.source.stream.StreamSourceFormat;
30  import org.apache.torque.generator.source.stream.XmlSourceFormat;
31  
32  /**
33   * Contains the required handlers for reading the configuration.
34   *
35   * $Id: ConfigurationHandlers.java 1331190 2012-04-27 02:41:35Z tfischer $
36   */
37  public class ConfigurationHandlers
38  {
39      /**
40       * The known types of outlets and how to read their configuration.
41       */
42      private OutletTypes outletTypes = new OutletTypes();
43  
44      /**
45       * The known (file) formats of stream sources (e.g. XML, properties).
46       */
47      private Set<StreamSourceFormat> streamSourceFormats
48          = new HashSet<StreamSourceFormat>();
49  
50      /**
51       * The known mergepoint action configuration handlers.
52       */
53      private ActionSaxHandlerFactories actionSaxHandlerFactories
54              = new ActionSaxHandlerFactories();
55  
56      /**
57       * The known option configuration handlers.
58       */
59      private OptionsSaxHandlerFactories optionsSaxHandlerFactories
60              = new OptionsSaxHandlerFactories();
61  
62      /**
63       * The known source configuration handlers.
64       */
65      private SourceSaxHandlerFactories sourceSaxHandlerFactories
66              = new SourceSaxHandlerFactories();
67  
68      /**
69       * Standard constructor.
70       */
71      public ConfigurationHandlers()
72      {
73          streamSourceFormats.add(new XmlSourceFormat());
74          streamSourceFormats.add(new PropertiesSourceFormat());
75      }
76  
77      /**
78       * Returns the known outlet types.
79       *
80       * @return the known outlet types, not null.
81       */
82      public OutletTypes getOutletTypes()
83      {
84          return outletTypes;
85      }
86  
87      /**
88       * Returns the known source configuration handlers.
89       *
90       * @return the known source configuration handlers, not mull.
91       */
92      public SourceSaxHandlerFactories getSourceSaxHandlerFactories()
93      {
94          return sourceSaxHandlerFactories;
95      }
96  
97      /**
98       * Returns the known formats of stream (e.g. file) sources.
99       *
100      * @return the known stream source formats, not null.
101      */
102     public Set<StreamSourceFormat> getStreamSourceFormats()
103     {
104         return streamSourceFormats;
105     }
106 
107     /**
108      * Returns the known mergepoint action handlers.
109      *
110      * @return the known mergepoint action handlers, not null.
111      */
112     public ActionSaxHandlerFactories getActionSaxHandlerFactories()
113     {
114         return actionSaxHandlerFactories;
115     }
116 
117     /**
118      * Returns the known options handlers.
119      *
120      * @return the known options handlers, not null.
121      */
122     public OptionsSaxHandlerFactories getOptionsSaxHandlerFactories()
123     {
124         return optionsSaxHandlerFactories;
125     }
126 }