KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > ejb > ejbqlc > EJBQLASTFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25
26 /*
27  * EJBQLASTFactory.java
28  *
29  * Created on November 12, 2001
30  */

31
32 package com.sun.jdo.spi.persistence.support.ejb.ejbqlc;
33
34 import persistence.antlr.collections.AST;
35 import persistence.antlr.ASTFactory;
36
37 import java.util.ResourceBundle JavaDoc;
38 import com.sun.jdo.spi.persistence.utility.I18NHelper;
39
40 /**
41  * Factory to create and connect EJBQLAST nodes.
42  *
43  * @author Michael Bouschen
44  */

45 public class EJBQLASTFactory
46     extends ASTFactory
47 {
48     /** The singleton EJBQLASTFactory instance. */
49     private static EJBQLASTFactory factory = new EJBQLASTFactory();
50
51     /** I18N support. */
52     private final static ResourceBundle JavaDoc msgs =
53         I18NHelper.loadBundle(EJBQLASTFactory.class);
54     
55     /**
56      * Get an instance of EJBQLASTFactory.
57      * @return an instance of EJBQLASTFactory
58      */

59     public static EJBQLASTFactory getInstance()
60     {
61         return factory;
62     }
63     
64     /**
65      * Constructor. EJBQLASTFactory is a singleton, please use
66      * {@link #getInstance} to get the factory instance.
67      */

68     protected EJBQLASTFactory()
69     {
70         this.theASTNodeTypeClass = EJBQLAST.class;
71         this.theASTNodeType = this.theASTNodeTypeClass.getName();
72     }
73     
74     /** Overwrites superclass method to create the correct AST instance. */
75     public AST create()
76     {
77         return new EJBQLAST();
78     }
79
80     /** Overwrites superclass method to create the correct AST instance. */
81     public AST create(AST tr)
82     {
83         return create((EJBQLAST)tr);
84     }
85
86     /** Creates a clone of the specified EJBQLAST instance. */
87     public EJBQLAST create(EJBQLAST tr)
88     {
89         try {
90             return (tr==null) ? null : (EJBQLAST)tr.clone();
91         }
92         catch(CloneNotSupportedException JavaDoc ex) {
93             throw new EJBQLException(
94                 I18NHelper.getMessage(msgs, "ERR_UnexpectedExceptionClone"), ex); //NOI18N
95
}
96     }
97 }
98
99
Popular Tags