Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/esau/ptarmigan/GeneratorFactory.java


1   /* $Header: /cvsroot/ptarmigan/ptarmigan/src/java/org/esau/ptarmigan/GeneratorFactory.java,v 1.1 2002/09/10 06:24:34 reedesau Exp $ */
2   
3   package org.esau.ptarmigan;
4   
5   import java.io.File;
6   
7   //import org.apache.commons.discovery.tools.DiscoverClass;
8   //import org.apache.commons.logging.Log;
9   //import org.apache.commons.logging.LogFactory;
10  
11  import org.esau.ptarmigan.impl.GeneratorImpl;
12  
13  /**
14   * Generator Factory
15   * <p>
16   * Loads the default Generator implementation via Jakarta Commons Discovery.
17   * <p>
18   * See the Generator inteface for usage.
19   * <p>
20   * Eventually this will be expanded to support:
21   * <p>
22   * TODO: add DiscoverClass when jakarta.commons.discovery supports multiple
23   * for use with ByteStreamSource, CharacterStreamSource, etc.
24   * <P>
25   *
26   * @author Reed Esau
27   * @version $Revision: 1.1 $ $Date: 2002/09/10 06:24:34 $
28   */
29  public class GeneratorFactory {
30  
31      //static final String DEFAULT_IMPL = "org.esau.ptarmigan.impl.GeneratorImpl";
32  
33      public static Generator newInstance()
34      throws InstantiationException, IllegalAccessException {
35  
36  //         DiscoverClass dc = new DiscoverClass();
37  //         Class clazz = dc.find(Generator.class, DEFAULT_IMPL);
38  //
39  //         if (log.isDebugEnabled())
40  //             log.error("Generator implementation=" + (clazz!=null
41  //                                                      ? clazz.getName()
42  //                                                      : "not found"));
43  //
44  //         return (clazz!=null
45  //                 ? (Generator)clazz.newInstance()
46  //                 : null);
47  
48          return (Generator)GeneratorImpl.class.newInstance();
49      }
50  
51      /**
52       * logging object
53       */
54      //static Log log = LogFactory.getLog(GeneratorFactory.class);
55  }
56  
57  /*
58  PTARMIGAN MODIFIED BSD LICENSE
59  
60  Copyright (c) 2002, Reed Esau (reed.esau@pobox.com) All rights reserved.
61  
62  Redistribution and use in source and binary forms, with or without
63  modification, are permitted provided that the following conditions are
64  met:
65  
66  Redistributions of source code must retain the above copyright notice,
67  this list of conditions and the following disclaimer.
68  
69  Redistributions in binary form must reproduce the above copyright notice,
70  this list of conditions and the following disclaimer in the documentation
71  and/or other materials provided with the distribution.
72  
73  Neither the name of the Ptarmigan Project
74  (http://ptarmigan.sourceforge.net) nor the names of its contributors may
75  be used to endorse or promote products derived from this software without
76  specific prior written permission.
77  
78  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
79  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
80  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
81  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
82  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
83  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
84  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
85  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
86  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
87  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
88  POSSIBILITY OF SUCH DAMAGE.
89  */