KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > ejb > ejbc > CMPTemplateFormatter


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  * CMPTemplateFormatter.java
28  *
29  * Created on December 03, 2001
30  */

31
32 package com.sun.jdo.spi.persistence.support.ejb.ejbc;
33
34 import java.io.*;
35
36 import java.text.MessageFormat JavaDoc;
37 import java.util.HashMap JavaDoc;
38 import java.util.Properties JavaDoc;
39 import java.util.StringTokenizer JavaDoc;
40
41 import com.sun.jdo.spi.persistence.utility.generator.JavaClassWriterHelper;
42
43 /*
44  * This is the helper class for JDO specific generation of
45  * a concrete bean implementation.
46  *
47  * @author Marina Vatkina
48  */

49 public class CMPTemplateFormatter extends JavaClassWriterHelper{
50
51     private final static String JavaDoc templateFile =
52         "com/sun/jdo/spi/persistence/support/ejb/ejbc/CMPTemplates.properties"; // NOI18N
53

54     // Strings for CMP code generation:
55
public final static String JavaDoc ejb_ = "ejb"; // NOI18N
56
public final static String JavaDoc ejbObject_ = "EJBObject"; // NOI18N
57
public final static String JavaDoc ejbHome_ = "EJBHome"; // NOI18N
58
public final static String JavaDoc ejbContext_ = "EJBContext"; // NOI18N
59
public final static String JavaDoc context_ = "context"; // NOI18N
60
public final static String JavaDoc key_ = "key"; // NOI18N
61
public final static String JavaDoc keys_ = "keys"; // NOI18N
62
public final static String JavaDoc oid_ = "jdoObjectId"; // NOI18N
63
public final static String JavaDoc oids_ = "oids"; // NOI18N
64
public final static String JavaDoc pc_ = "pc"; // NOI18N
65
public final static String JavaDoc cmpImplComments_ = "cmpImplComments"; // NOI18N
66
public final static String JavaDoc imports_ = "imports"; // NOI18N
67
public final static String JavaDoc interfaces_ = "interfaces"; // NOI18N
68
public final static String JavaDoc helperImports_ = "helperImports"; // NOI18N
69
public final static String JavaDoc staticTransientPackageVariables_ = "staticTransientPackageVariables"; // NOI18N
70
public final static String JavaDoc privateStaticVariables_ = "privateStaticVariables"; // NOI18N
71
public final static String JavaDoc privateTransientVariables_ = "privateTransientVariables"; // NOI18N
72
public final static String JavaDoc privateStaticFinalVariables_ = "privateStaticFinalVariables"; // NOI18N
73
public final static String JavaDoc publicStaticFinalVariables_ = "publicStaticFinalVariables"; // NOI18N
74
public final static String JavaDoc finderSelectorStaticVariables_ = "finderSelectorStaticVariables"; // NOI18N
75
public final static String JavaDoc finderSelectorStaticFinalVariables_ = "finderSelectorStaticFinalVariables"; // NOI18N
76
public final static String JavaDoc otherVariables_ = "otherVariables"; // NOI18N
77
public final static String JavaDoc setNull_ = "setNull"; // NOI18N
78
public final static String JavaDoc commonPrivateMethods_ = "commonPrivateMethods"; // NOI18N
79
public final static String JavaDoc commonPublicMethods_ = "commonPublicMethods"; // NOI18N
80
public final static String JavaDoc otherPublicMethods_ = "otherPublicMethods"; // NOI18N
81
public final static String JavaDoc jdoLookupPersistenceManagerFactory_
82                                                           = "jdoLookupPersistenceManagerFactory"; // NOI18N
83
public final static String JavaDoc helperMethods_ = "helperMethods"; // NOI18N
84
public final static String JavaDoc getInstance_ = "jdoGetInstance"; // NOI18N
85
public final static String JavaDoc findByPrimaryKey_ = "findByPrimaryKey"; // NOI18N
86
public final static String JavaDoc ejbFindByPrimaryKey_ = "ejbFindByPrimaryKey"; // NOI18N
87
public final static String JavaDoc ejbFinderSelectorBody_ = "ejbFinderSelectorBody"; // NOI18N
88
public final static String JavaDoc ejbQueryExecutionParamConvBody_ = "ejbQueryExecutionParamConvBody"; // NOI18N
89
public final static String JavaDoc ejbQueryExecutionParamConvBodyArgument_ = "ejbQueryExecutionParamConvBodyArgument"; // NOI18N
90
public final static String JavaDoc ejbQueryExecutionBody_ = "ejbQueryExecutionBody"; // NOI18N
91
public final static String JavaDoc ejbAggregateQueryExecutionBody_ = "ejbAggregateQueryExecutionBody"; // NOI18N
92
public final static String JavaDoc ejbAggregateQueryExecutionParamConvBody_ = "ejbAggregateQueryExecutionParamConvBody"; // NOI18N
93
public final static String JavaDoc ejbMultiFinderBody_ = "ejbMultiFinderBody"; // NOI18N
94
public final static String JavaDoc ejbMultiFinderBodyEnumeration_ = "ejbMultiFinderBodyEnumeration"; // NOI18N
95
public final static String JavaDoc ejbSingleFinderBody_ = "ejbSingleFinderBody"; // NOI18N
96
public final static String JavaDoc jdoGetJdoInstanceClass_ = "jdoGetJdoInstanceClass"; // NOI18N
97
public final static String JavaDoc find_ = "find"; // NOI18N
98
public final static String JavaDoc catchClause_ = "catchClause"; //NOI18N
99
public final static String JavaDoc ejbSelect_ = "ejbSelect"; // NOI18N
100
public final static String JavaDoc create_ = "create"; // NOI18N
101
public final static String JavaDoc remove_ = "remove"; // NOI18N
102
public final static String JavaDoc ejbCreate_ = "ejbCreate"; // NOI18N
103
public final static String JavaDoc ejbCreateUnknownPK_ = "ejbCreateUnknownPK"; // NOI18N
104
public final static String JavaDoc ejbPostCreate_ = "ejbPostCreate"; // NOI18N
105
public final static String JavaDoc ejbRemove_ = "ejbRemove"; // NOI18N
106
public final static String JavaDoc ejbLoad_ = "ejbLoad"; // NOI18N
107
public final static String JavaDoc CreateException_ = "javax.ejb.CreateException"; // NOI18N
108
public final static String JavaDoc DuplicateKeyException_ = "javax.ejb.DuplicateKeyException"; // NOI18N
109
public final static String JavaDoc RemoveException_ = "javax.ejb.RemoveException"; // NOI18N
110
public final static String JavaDoc ejbException_ = "EJBException"; // NOI18N
111
public final static String JavaDoc finderException_ = "javax.ejb.FinderException"; // NOI18N
112
public final static String JavaDoc assertInTransaction_ = "assertInTransaction"; // NOI18N
113
public final static String JavaDoc assertPersistenceManagerIsNull_
114                                                           = "assertPersistenceManagerIsNull"; // NOI18N
115
public final static String JavaDoc assertPersistenceManagerIsNullCall_
116                                                           = "assertPersistenceManagerIsNullCall"; // NOI18N
117
public final static String JavaDoc setEntityContext_ = "setEntityContext"; // NOI18N
118
public final static String JavaDoc EntityContext_ = "javax.ejb.EntityContext"; // NOI18N
119
public final static String JavaDoc castKey_ = "castKey"; // NOI18N
120
public final static String JavaDoc castOid_ = "castOid"; // NOI18N
121
public final static String JavaDoc getPK_ = "getPK"; // NOI18N
122
public final static String JavaDoc getPKClone_ = "getPKClone"; // NOI18N
123
public final static String JavaDoc newPK_ = "newPK"; // NOI18N
124
public final static String JavaDoc newOid_ = "newOid"; // NOI18N
125
public final static String JavaDoc getPK1_ = "getPK1"; // NOI18N
126
public final static String JavaDoc getPK1Clone_ = "getPK1Clone"; // NOI18N
127
public final static String JavaDoc getPK1primitive_ = "getPK1primitive"; // NOI18N
128
public final static String JavaDoc getOid_ = "getOid"; // NOI18N
129
public final static String JavaDoc getOidString_ = "getOidString"; // NOI18N
130
public final static String JavaDoc getOidClone_ = "getOidClone"; // NOI18N
131
public final static String JavaDoc getOid1_ = "getOid1"; // NOI18N
132
public final static String JavaDoc getOid1primitive_ = "getOid1primitive"; // NOI18N
133
public final static String JavaDoc getOid1String_ = "getOid1String"; // NOI18N
134
public final static String JavaDoc getOid1Clone_ = "getOid1Clone"; // NOI18N
135
public final static String JavaDoc getObjectId_ = "jdoGetObjectId"; // NOI18N
136
public final static String JavaDoc convertObjectIdToPrimaryKey_
137                                      = "convertObjectIdToPrimaryKey"; // NOI18N
138
public final static String JavaDoc convertPrimaryKeyToObjectId_
139                                      = "convertPrimaryKeyToObjectId"; // NOI18N
140

141     public final static String JavaDoc convertPCToEJBObject_ = "convertPCToEJBObject"; // NOI18N
142
public final static String JavaDoc convertEJBObjectToPC_ = "convertEJBObjectToPC"; // NOI18N
143
public final static String JavaDoc convertEJBLocalObjectToPC_
144                                      = "convertEJBLocalObjectToPC"; // NOI18N
145

146     public final static String JavaDoc jdoPersistenceManager_ = "_jdoPersistenceManager"; // NOI18N
147
public final static String JavaDoc jdoPersistenceManagerClass_
148                                      = "com.sun.jdo.api.persistence.support.PersistenceManager"; // NOI18N
149
public final static String JavaDoc jdoGetPersistenceManager_ = "jdoGetPersistenceManager"; // NOI18N
150
public final static String JavaDoc jdoClosePersistenceManager_= "jdoClosePersistenceManager"; // NOI18N
151
public final static String JavaDoc jdoReleasePersistenceManager_
152                                      = "jdoReleasePersistenceManager"; // NOI18N
153

154     public final static String JavaDoc jdoArrayCopy_ = "jdoArrayCopy"; // NOI18N
155
public final static String JavaDoc jdoCleanAllRefs_ = "jdoCleanAllRefs"; // NOI18N
156
public final static String JavaDoc returnKey_ = "return key;"; // NOI18N
157
public final static String JavaDoc returnOid_ = "return jdoObjectId;"; // NOI18N
158

159     // Inner helper Class strings.
160
public final static String JavaDoc helperComments_ = "helperComments"; // NOI18N
161
public final static String JavaDoc helperVariables_ = "helperVariables"; // NOI18N
162
public final static String JavaDoc getHelperInstance_ = "getHelperInstance"; // NOI18N
163

164     public final static String JavaDoc getPCClass_ = "getPCClass"; // NOI18N
165
public final static String JavaDoc getContainer_ = "getContainer"; // NOI18N
166
public final static String JavaDoc assertInstanceOfRemoteInterfaceImpl_
167                                                           = "assertInstanceOfRemoteInterfaceImpl"; // NOI18N
168
public final static String JavaDoc assertPKNotNull_ = "assertPKNotNull"; // NOI18N
169
public final static String JavaDoc assertPKFieldNotNull_ = "assertPKFieldNotNull"; // NOI18N
170
public final static String JavaDoc assertOidNotNull_ = "assertOidNotNull"; // NOI18N
171
public final static String JavaDoc afterCompletion_ = "afterCompletion"; // NOI18N
172
public final static String JavaDoc ejb__flush_ = "ejb__flush"; // NOI18N
173
public final static String JavaDoc ejb__refresh_ = "ejb__refresh"; // NOI18N
174
public final static String JavaDoc ejb__remove_ = "ejb__remove"; // NOI18N
175

176     // property key for the CVS keyword substitution
177
public final static String JavaDoc signature_ = "signature"; //NOI18N
178

179     public final static String JavaDoc signatureDelimiter_ = " ## "; //NOI18N
180

181     // Code generator templates.
182
public static Properties JavaDoc helpers = null;
183
184     // JDOHelper comments have the concrete impl name.
185
public static MessageFormat JavaDoc hcomformatter = null;
186
187     // variables
188
public static MessageFormat JavaDoc privatetransientvformatter = null; // private transient varibales
189
public static MessageFormat JavaDoc privatestaticfinalvformatter = null; // final static variables
190
public static MessageFormat JavaDoc publicstaticfinalvformatter = null; // static final variables
191
public static MessageFormat JavaDoc finderselectorstaticvformatter = null; // finder / selector static variables
192
public static MessageFormat JavaDoc finderselectorstaticfinalvformatter = null; // finder / selector static final variables
193
public static MessageFormat JavaDoc hvformatter = null; // helper class variables
194

195     // methods
196
public static MessageFormat JavaDoc giformatter = null; // jdoGetInstance
197
public static MessageFormat JavaDoc goidformatter = null; // jdoGetObjectId
198
public static MessageFormat JavaDoc intxformatter = null; // assertInTransaction
199
public static MessageFormat JavaDoc jdolookuppmfformatter = null; // jdoLookupPersistenceManagerFactory
200
public static MessageFormat JavaDoc jdoarraycopyformatter = null; // jdoCopyArray
201

202     // finder/selector methods
203
public static MessageFormat JavaDoc finderselectorformatter = null; //common body for selector and finder
204
public static MessageFormat JavaDoc queryexecformatter = null; //body for queryexec without paramconversion
205
public static MessageFormat JavaDoc aggqueryexecformatter = null; //body for aggqueryexec without paramconversion
206
public static MessageFormat JavaDoc queryexecparamconvformatter = null; //body for queryexec with paramconversion
207
public static MessageFormat JavaDoc queryexecparamconvargumentformatter = null; //body for the argument of the queryexec with paramconversion
208
public static MessageFormat JavaDoc aggqueryexecparamconvformatter = null; //body for aggqueryexec with paramconversion
209
public static MessageFormat JavaDoc multifinderformatter = null; // finder body for multi-value-objects
210
public static MessageFormat JavaDoc multifinderenumerationformatter = null; // finder body for multi-value-objects with conversion to Enumeration (CMP11))
211
public static MessageFormat JavaDoc singlefinderformatter = null; // finder body for single-value-objects
212

213     // PK and Oid handling
214
public static MessageFormat JavaDoc pkcformatter = null; // cast PK statement
215
public static MessageFormat JavaDoc oidcformatter = null; // cast Oid statement
216
public static MessageFormat JavaDoc npkformatter = null; // new PK statement
217
public static MessageFormat JavaDoc noidformatter = null; // new Oid statement
218
public static MessageFormat JavaDoc pkformatter = null;
219     public static MessageFormat JavaDoc oidformatter = null;
220     public static MessageFormat JavaDoc oidstringformatter = null; // PK -> Oid for String PK field
221
public static MessageFormat JavaDoc pkcloneformatter = null; // Oid -> PK for mutable PK field
222
public static MessageFormat JavaDoc oidcloneformatter = null; // PK -> Oid for mutable PK field
223
public static MessageFormat JavaDoc pk1formatter = null;
224     public static MessageFormat JavaDoc oid1formatter = null;
225     public static MessageFormat JavaDoc pk1pformatter = null;
226     public static MessageFormat JavaDoc oid1pformatter = null;
227     public static MessageFormat JavaDoc oid1stringformatter = null; // PK -> Oid for String PK class
228
public static MessageFormat JavaDoc pk1cloneformatter = null; // Oid -> PK for mutable PK class
229
public static MessageFormat JavaDoc oid1cloneformatter = null; // PK -> Oid for mutable PK class
230
public static MessageFormat JavaDoc assertpkfieldformatter = null; // for assertPKFieldNotNull_
231

232     // Other JDOHelper methods.
233
public static MessageFormat JavaDoc pcclassgetterformatter = null;
234
235     // standard templates for the corresponding keys, so that a template "xxxTemplate"
236
// corresponds to a "xxx" key.
237
public static String JavaDoc cmpImplCommentsTemplate = null;
238     public static String JavaDoc privateStaticVariablesTemplate = null;
239     public static String JavaDoc otherVariablesTemplate = null;
240     public static String JavaDoc jdoGetJdoInstanceClassTemplate = null;
241     public static String JavaDoc assertPersistenceManagerIsNullTemplate = null;
242     public static String JavaDoc assertInstanceOfRemoteInterfaceImplTemplate = null;
243     public static String JavaDoc getHelperInstanceTemplate = null;
244     public static String JavaDoc catchClauseTemplate = null;
245     public static String JavaDoc signatureTemplate = null;
246     public static String JavaDoc assertPKNotNullTemplate = null;
247     public static String JavaDoc assertOidNotNullTemplate = null;
248
249     // standard templates that had been converted to String[] to be used
250
// in a 'for' loop.
251
public static String JavaDoc[] importsArray = null;
252     public static String JavaDoc[] interfacesArray = null;
253     public static String JavaDoc[] helperImportsArray = null;
254     public static String JavaDoc[] commonPublicMethodsArray = null;
255     public static String JavaDoc[] otherPublicMethodsArray = null;
256     public static String JavaDoc[] commonPrivateMethodsArray = null;
257
258
259     // standard method bodies for the corresponding keys, so that a method body with
260
// a name "xxxBody" corresponds to a "xxx" key.
261
public static String JavaDoc[] ejbFindByPrimaryKeyBody = null;
262     public static String JavaDoc[] afterCompletionBody = null;
263     public static String JavaDoc[] jdoGetPersistenceManagerBody = null;
264     public static String JavaDoc[] assertPersistenceManagerIsNullBody = null;
265     public static String JavaDoc[] jdoClosePersistenceManagerBody = null;
266     public static String JavaDoc[] jdoReleasePersistenceManagerBody = null;
267     public static String JavaDoc[] setEntityContextBody = null;
268     public static String JavaDoc[] getContainerBody = null;
269
270     /**
271      * Constructs a new <code>CMPTemplateFormatter</code> instance.
272      */

273     CMPTemplateFormatter() {
274     }
275
276     /**
277      * Initializes templates for code generation.
278      */

279     static synchronized void initHelpers() throws IOException {
280         if (helpers == null) {
281             helpers = new Properties JavaDoc();
282             loadProperties(helpers, templateFile);
283             initFormatters();
284             initTemplates();
285         }
286     }
287
288     /**
289      * Loads Properties object from the specified template file.
290      */

291     static synchronized void loadProperties(Properties JavaDoc helpers,
292             final String JavaDoc templateFile) throws IOException {
293
294         BufferedInputStream bin = null;
295         try {
296             final ClassLoader JavaDoc loader = CMPTemplateFormatter.class.getClassLoader();
297             InputStream in = (InputStream)java.security.AccessController.doPrivileged(
298                 new java.security.PrivilegedAction JavaDoc() {
299                     public Object JavaDoc run() {
300                         if (loader != null) {
301                             return loader.getResourceAsStream(templateFile);
302                         } else {
303                             return ClassLoader.getSystemResourceAsStream(templateFile);
304                         }
305                     }
306                 }
307             );
308
309             bin = new BufferedInputStream(in);
310             helpers.load(bin);
311         } finally {
312             try {
313                 bin.close();
314             } catch (Exception JavaDoc e) {
315                 // no action
316
}
317         }
318     }
319
320     /**
321      * Initializes MessageFormats for code generation.
322      */

323     private static void initFormatters() {
324         // JDOHelper comments have the concrete impl name.
325
hcomformatter = new MessageFormat JavaDoc(helpers.getProperty(helperComments_));
326
327         // variables
328
privatetransientvformatter = new MessageFormat JavaDoc(helpers.getProperty(privateTransientVariables_));
329         privatestaticfinalvformatter = new MessageFormat JavaDoc(helpers.getProperty(privateStaticFinalVariables_));
330         publicstaticfinalvformatter = new MessageFormat JavaDoc(helpers.getProperty(publicStaticFinalVariables_));
331         finderselectorstaticvformatter = new MessageFormat JavaDoc(helpers.getProperty(finderSelectorStaticVariables_));
332         finderselectorstaticfinalvformatter = new MessageFormat JavaDoc(helpers.getProperty(finderSelectorStaticFinalVariables_));
333         hvformatter = new MessageFormat JavaDoc(helpers.getProperty(helperVariables_));
334
335         // methods
336
giformatter = new MessageFormat JavaDoc(helpers.getProperty(getInstance_));
337         goidformatter = new MessageFormat JavaDoc(helpers.getProperty(getObjectId_));
338         intxformatter = new MessageFormat JavaDoc(helpers.getProperty(assertInTransaction_));
339         jdolookuppmfformatter = new MessageFormat JavaDoc(helpers.getProperty(jdoLookupPersistenceManagerFactory_));
340         jdoarraycopyformatter = new MessageFormat JavaDoc(helpers.getProperty(jdoArrayCopy_));
341
342         // finder/selector methods
343
finderselectorformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbFinderSelectorBody_));
344         queryexecparamconvformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbQueryExecutionParamConvBody_));
345         queryexecparamconvargumentformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbQueryExecutionParamConvBodyArgument_));
346         queryexecformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbQueryExecutionBody_));
347         aggqueryexecformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbAggregateQueryExecutionBody_));
348         aggqueryexecparamconvformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbAggregateQueryExecutionParamConvBody_));
349         multifinderformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbMultiFinderBody_));
350         multifinderenumerationformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbMultiFinderBodyEnumeration_));
351         singlefinderformatter = new MessageFormat JavaDoc(helpers.getProperty(ejbSingleFinderBody_));
352
353         // PK and Oid handling
354
pkcformatter = new MessageFormat JavaDoc(helpers.getProperty(castKey_));
355         oidcformatter = new MessageFormat JavaDoc(helpers.getProperty(castOid_));
356         npkformatter = new MessageFormat JavaDoc(helpers.getProperty(newPK_));
357         noidformatter = new MessageFormat JavaDoc(helpers.getProperty(newOid_));
358         pk1formatter = new MessageFormat JavaDoc(helpers.getProperty(getPK1_));
359         pk1cloneformatter = new MessageFormat JavaDoc(helpers.getProperty(getPK1Clone_));
360         oid1formatter = new MessageFormat JavaDoc(helpers.getProperty(getOid1_));
361         pk1pformatter = new MessageFormat JavaDoc(helpers.getProperty(getPK1primitive_));
362         oid1pformatter = new MessageFormat JavaDoc(helpers.getProperty(getOid1primitive_));
363         oid1stringformatter = new MessageFormat JavaDoc(helpers.getProperty(getOid1String_));
364         oid1cloneformatter = new MessageFormat JavaDoc(helpers.getProperty(getOid1Clone_));
365         pkformatter = new MessageFormat JavaDoc(helpers.getProperty(getPK_));
366         pkcloneformatter = new MessageFormat JavaDoc(helpers.getProperty(getPKClone_));
367         oidformatter = new MessageFormat JavaDoc(helpers.getProperty(getOid_));
368         oidstringformatter = new MessageFormat JavaDoc(helpers.getProperty(getOidString_));
369         oidcloneformatter = new MessageFormat JavaDoc(helpers.getProperty(getOidClone_));
370
371         assertpkfieldformatter = new MessageFormat JavaDoc(helpers.getProperty(assertPKFieldNotNull_));
372
373         // Other JDOHelper methods.
374
pcclassgetterformatter = new MessageFormat JavaDoc(helpers.getProperty(getPCClass_));
375
376     }
377
378     /**
379      * Initializes standard templates for code generation.
380      */

381     private static void initTemplates() {
382         cmpImplCommentsTemplate = helpers.getProperty(cmpImplComments_);
383         privateStaticVariablesTemplate = helpers.getProperty(privateStaticVariables_);
384         otherVariablesTemplate = helpers.getProperty(otherVariables_);
385         jdoGetJdoInstanceClassTemplate = helpers.getProperty(jdoGetJdoInstanceClass_);
386         assertPersistenceManagerIsNullTemplate = helpers.getProperty(
387             assertPersistenceManagerIsNullCall_);
388         assertInstanceOfRemoteInterfaceImplTemplate = helpers.getProperty(
389             assertInstanceOfRemoteInterfaceImpl_);
390         getHelperInstanceTemplate = helpers.getProperty(getHelperInstance_);
391         catchClauseTemplate = helpers.getProperty(catchClause_);
392         signatureTemplate = helpers.getProperty(signature_);
393         assertPKNotNullTemplate = helpers.getProperty(assertPKNotNull_);
394         assertOidNotNullTemplate = helpers.getProperty(assertOidNotNull_);
395
396         importsArray = tokenize(imports_);
397         interfacesArray = tokenize(interfaces_);
398         helperImportsArray = tokenize(helperImports_);
399         commonPublicMethodsArray = tokenize(commonPublicMethods_);
400         otherPublicMethodsArray = tokenize(otherPublicMethods_);
401         commonPrivateMethodsArray = tokenize(commonPrivateMethods_);
402
403         ejbFindByPrimaryKeyBody = getBodyAsStrings(helpers.getProperty(ejbFindByPrimaryKey_));
404         afterCompletionBody = getBodyAsStrings(helpers.getProperty(afterCompletion_));
405         jdoGetPersistenceManagerBody = getBodyAsStrings(helpers.getProperty(jdoGetPersistenceManager_));
406         jdoClosePersistenceManagerBody = getBodyAsStrings(helpers.getProperty(jdoClosePersistenceManager_));
407         jdoReleasePersistenceManagerBody = getBodyAsStrings(helpers.getProperty(jdoReleasePersistenceManager_));
408         setEntityContextBody = getBodyAsStrings(helpers.getProperty(setEntityContext_));
409         getContainerBody = getBodyAsStrings(helpers.getProperty(getContainer_));
410         assertPersistenceManagerIsNullBody = getBodyAsStrings(helpers.getProperty(assertPersistenceManagerIsNull_));
411     }
412
413     static String JavaDoc[] tokenize(String JavaDoc template) {
414         StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(helpers.getProperty(template), delim_);
415         String JavaDoc[] rc = new String JavaDoc[st.countTokens()];
416
417         int i = 0;
418         while (st.hasMoreElements()) {
419             rc[i++] = st.nextToken();
420         }
421
422         return rc;
423     }
424 }
425
Popular Tags