KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > dao > client > DaoManagerBuilder


1 /*
2  * Copyright 2004 Clinton Begin
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 com.ibatis.dao.client;
17
18 import com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder;
19
20 import java.io.Reader JavaDoc;
21 import java.util.Properties JavaDoc;
22
23 /**
24  * Builds a DaoManager given a Reader (dao.xml) and optionally a set of
25  * properties. The following is an example of a dao.xml file.
26  * <ul>
27  * <li> <a HREF="dao.txt">The DAO Configuration file (dao.xml)</a>
28  * <ul>
29  * <p/>
30  */

31 public class DaoManagerBuilder {
32
33   /**
34    * No instantiation allowed.
35    */

36   private DaoManagerBuilder() {
37   }
38
39   /**
40    * Builds a DAO Manager from the reader supplied.
41    *
42    * @param reader A Reader instance that reads a DAO configuration file (dao.xml).
43    * @param props A Properties instance that will be used for parameter substitution
44    * in the DAO configuration file (dao.xml).
45    * @return A configured DaoManager instance
46    */

47   public static DaoManager buildDaoManager(Reader JavaDoc reader, Properties JavaDoc props)
48       throws DaoException {
49     return new XmlDaoManagerBuilder().buildDaoManager(reader, props);
50   }
51
52   /**
53    * Builds a DAO Manager from the reader supplied.
54    *
55    * @param reader A Reader instance that reads a DAO configuration file (dao.xml).
56    * @return A configured DaoManager instance
57    */

58   public static DaoManager buildDaoManager(Reader JavaDoc reader) {
59     return new XmlDaoManagerBuilder().buildDaoManager(reader);
60   }
61
62
63 }
64
Popular Tags