1 23 24 25 26 31 32 package com.sun.jdo.spi.persistence.support.ejb.ejbc; 33 34 import java.io.*; 35 36 import java.text.MessageFormat ; 37 import java.util.HashMap ; 38 import java.util.Properties ; 39 import java.util.StringTokenizer ; 40 41 import com.sun.jdo.spi.persistence.utility.generator.JavaClassWriterHelper; 42 43 53 class CMP20TemplateFormatter extends CMPTemplateFormatter { 54 55 private final static String templateFile = 56 "com/sun/jdo/spi/persistence/support/ejb/ejbc/CMP20Templates.properties"; 58 public final static String local_ = "Local"; public final static String ejbLocalObject_ = "EJBLocalObject"; public final static String ejbLocalHome_ = "EJBLocalHome"; public final static String getter_ = "getter"; public final static String setter_ = "setter"; public final static String assertPKsetter_ = "assertPKsetter"; public final static String pksetter_ = "pksetter"; public final static String pkstringsetter_ = "pkstringsetter"; public final static String pkcopysetter_ = "pkcopysetter"; public final static String copygetter_ = "copygetter"; public final static String copysetter_ = "copysetter"; public final static String arraygetter_ = "arraygetter"; public final static String arraysetter_ = "arraysetter"; public final static String sfldgetter_ = "sfldGetter"; public final static String sfldsetter_ = "sfldSetter"; public final static String cmrGetter_ = "cmrGetter"; public final static String cmrSetter_ = "cmrSetter"; public final static String cmrGetterCollection_ = "cmrGetterCollection"; public final static String cmrSetterCollection_ = "cmrSetterCollection"; public final static String startCascadeDelete_ = "startCascadeDelete"; public final static String endCascadeDelete_ = "endCascadeDelete"; public final static String cmrCascadeDelete_ = "cmrCascadeDelete"; public final static String cmrCascadeDeleteCollection_ = "cmrCascadeDeleteCollection"; public final static String localCmrVariables_ = "localCmrVariables"; public final static String cleanCollectionCmr_ = "cleanCollectionCmr"; public final static String ejbFinderSelectorParamCheckLocalInterface_ 85 = "ejbFinderSelectorParamCheckLocalInterface"; public final static String ejbFinderSelectorParamCheckRemoteInterface_ 87 = "ejbFinderSelectorParamCheckRemoteInterface"; public final static String ejbMultiSelectorBodyConversion_ = "ejbMultiSelectorBodyConversion"; public final static String ejbMultiSelectorBody_ = "ejbMultiSelectorBody"; public final static String ejbMultiSelectorBodySet_ = "ejbMultiSelectorBodySet"; public final static String ejbSingleSelectorReturnBodyConversion_ = "ejbSingleSelectorReturnBodyConversion"; public final static String ejbSingleSelectorReturnBody_ = "ejbSingleSelectorReturnBody"; public final static String ejbAggregateSelectorPrimitiveReturnBody_ = "ejbAggregateSelectorPrimitiveReturnBody"; public final static String ejbAggregateSelectorReturnBody_ = "ejbAggregateSelectorReturnBody"; public final static String ejbAggregateSelectorReturnBodyConversion_ = "ejbAggregateSelectorReturnBodyConversion"; public final static String ejbAggregateSelectorReturnBigDecimalConversion_ = "ejbAggregateSelectorReturnBigDecimalConversion"; public final static String ejbAggregateSelectorReturnBigIntegerConversion_ = "ejbAggregateSelectorReturnBigIntegerConversion"; public final static String ejbSingleSelectorBody_ = "ejbSingleSelectorBody"; public final static String preSelect_ = "preSelect"; public final static String convertPCToEJBLocalObject_ 101 = "convertPCToEJBLocalObject"; public final static String convertCollectionPCToEJBObject_ 103 = "convertCollectionPCToEJBObject"; public final static String convertCollectionPCToEJBObjectSet_ 105 = "convertCollectionPCToEJBObjectSet"; public final static String convertCollectionPCToEJBLocalObject_ 107 = "convertCollectionPCToEJBLocalObject"; public final static String convertCollectionPCToEJBLocalObjectSet_ 109 = "convertCollectionPCToEJBLocalObjectSet"; public final static String jdoCleanCollectionRef_ = "jdoCleanCollectionRef"; 112 public final static String helper20Interface_ 114 = "com.sun.jdo.spi.persistence.support.sqlstore.ejb.JDOEJB20Helper"; public final static String helper20Impl_ 116 = "com.sun.jdo.spi.persistence.support.ejb.cmp.JDOEJB20HelperImpl"; 118 public final static String ejbHashSetImport_ 119 = "com.sun.jdo.spi.persistence.support.ejb.cmp.EJBHashSet"; 121 public final static String assertInstanceOfLocalInterfaceImpl_ 122 = "assertInstanceOfLocalInterfaceImpl"; public final static String signature2_0_ = "signature2_0"; 126 public static MessageFormat gformatter = null; public static MessageFormat sformatter = null; public static MessageFormat copygformatter = null; public static MessageFormat copysformatter = null; public static MessageFormat arraygformatter = null; public static MessageFormat arraysformatter = null; public static MessageFormat assertpksformatter = null; public static MessageFormat pksformatter = null; public static MessageFormat pkstringsformatter = null; public static MessageFormat pkcopysformatter = null; public static MessageFormat sfldgformatter = null; public static MessageFormat sfldsformatter = null; 140 public static MessageFormat cmrgformatter = null; public static MessageFormat cmrsformatter = null; public static MessageFormat cmrCgformatter = null; public static MessageFormat cmrCsformatter = null; public static MessageFormat cmrcdformatter = null; public static MessageFormat cmrcdCformatter = null; 147 public static MessageFormat cmrvformatter = null; public static MessageFormat cleancmrformatter = null; 151 public static MessageFormat cformatter = null; public static MessageFormat cunpkformatter = null; public static MessageFormat postcformatter = null; public static MessageFormat rmformatter = null; 157 public static MessageFormat finderselectorchecklocalformatter = null; public static MessageFormat finderselectorcheckremoteformatter = null; public static MessageFormat preselectformatter = null; public static MessageFormat multiselectorconvformatter = null; public static MessageFormat multiselectorformatter = null; public static MessageFormat multiselectorsetformatter = null; public static MessageFormat singleselectorreturnconvformatter = null; public static MessageFormat singleselectorreturnformatter = null; public static MessageFormat aggregateselectorprimitivereturnformatter = null; public static MessageFormat aggregateselectorreturnformatter = null; public static MessageFormat aggregateselectorreturnconvformatter = null; public static MessageFormat aggregateselectorreturnbigdecimalconvformatter = null; public static MessageFormat aggregateselectorreturnbigintegerconvformatter = null; public static MessageFormat singleselectorformatter = null; 173 public static String startCascadeDeleteTemplate = null; 176 public static String endCascadeDeleteTemplate = null; 177 public static String assertInstanceOfLocalInterfaceImplTemplate = null; 178 public static String signature2_0Template = null; 179 180 private static boolean is20HelpersLoaded = false; 181 182 185 CMP20TemplateFormatter() { 186 } 187 188 191 static synchronized void initHelpers() throws IOException { 192 if (is20HelpersLoaded == false) { 193 loadProperties(helpers, templateFile); 194 init20Formatters(); 195 init20Templates(); 196 197 is20HelpersLoaded = true; 198 199 } 200 } 201 202 205 private static void init20Formatters() { 206 gformatter = new MessageFormat (helpers.getProperty(getter_)); 208 sformatter = new MessageFormat (helpers.getProperty(setter_)); 209 copygformatter = new MessageFormat (helpers.getProperty(copygetter_)); 210 copysformatter = new MessageFormat (helpers.getProperty(copysetter_)); 211 arraygformatter = new MessageFormat (helpers.getProperty(arraygetter_)); 212 arraysformatter = new MessageFormat (helpers.getProperty(arraysetter_)); 213 assertpksformatter = new MessageFormat (helpers.getProperty(assertPKsetter_)); 214 pksformatter = new MessageFormat (helpers.getProperty(pksetter_)); 215 pkstringsformatter = new MessageFormat (helpers.getProperty(pkstringsetter_)); 216 pkcopysformatter = new MessageFormat (helpers.getProperty(pkcopysetter_)); 217 sfldsformatter = new MessageFormat (helpers.getProperty(sfldsetter_)); 218 sfldgformatter = new MessageFormat (helpers.getProperty(sfldgetter_)); 219 cmrgformatter = new MessageFormat (helpers.getProperty(cmrGetter_)); 220 cmrsformatter = new MessageFormat (helpers.getProperty(cmrSetter_)); 221 cmrCgformatter = new MessageFormat (helpers.getProperty(cmrGetterCollection_)); 222 cmrCsformatter = new MessageFormat (helpers.getProperty(cmrSetterCollection_)); 223 cmrcdformatter = new MessageFormat (helpers.getProperty(cmrCascadeDelete_)); 224 cmrcdCformatter = new MessageFormat (helpers.getProperty(cmrCascadeDeleteCollection_)); 225 226 cmrvformatter = new MessageFormat (helpers.getProperty(localCmrVariables_)); 228 cleancmrformatter = new MessageFormat (helpers.getProperty(cleanCollectionCmr_)); 229 230 cformatter = new MessageFormat (helpers.getProperty(ejbCreate_)); 232 cunpkformatter = new MessageFormat (helpers.getProperty(ejbCreateUnknownPK_)); 233 postcformatter = new MessageFormat (helpers.getProperty(ejbPostCreate_)); 234 rmformatter = new MessageFormat (helpers.getProperty(ejbRemove_)); 235 236 finderselectorchecklocalformatter = new MessageFormat (helpers.getProperty(ejbFinderSelectorParamCheckLocalInterface_)); 238 finderselectorcheckremoteformatter = new MessageFormat (helpers.getProperty(ejbFinderSelectorParamCheckRemoteInterface_)); 239 preselectformatter = new MessageFormat (helpers.getProperty(preSelect_)); 240 multiselectorconvformatter = new MessageFormat (helpers.getProperty(ejbMultiSelectorBodyConversion_)); 241 multiselectorformatter = new MessageFormat (helpers.getProperty(ejbMultiSelectorBody_)); 242 multiselectorsetformatter = new MessageFormat (helpers.getProperty(ejbMultiSelectorBodySet_)); 243 singleselectorreturnconvformatter = new MessageFormat (helpers.getProperty(ejbSingleSelectorReturnBodyConversion_)); 244 singleselectorreturnformatter = new MessageFormat (helpers.getProperty(ejbSingleSelectorReturnBody_)); 245 aggregateselectorprimitivereturnformatter = new MessageFormat (helpers.getProperty(ejbAggregateSelectorPrimitiveReturnBody_)); 246 aggregateselectorreturnformatter = new MessageFormat (helpers.getProperty(ejbAggregateSelectorReturnBody_)); 247 aggregateselectorreturnconvformatter = new MessageFormat (helpers.getProperty(ejbAggregateSelectorReturnBodyConversion_)); 248 aggregateselectorreturnbigdecimalconvformatter = new MessageFormat (helpers.getProperty(ejbAggregateSelectorReturnBigDecimalConversion_)); 249 aggregateselectorreturnbigintegerconvformatter = new MessageFormat (helpers.getProperty(ejbAggregateSelectorReturnBigIntegerConversion_)); 250 singleselectorformatter = new MessageFormat (helpers.getProperty(ejbSingleSelectorBody_)); 251 } 252 253 256 private static void init20Templates() { 257 startCascadeDeleteTemplate = helpers.getProperty(startCascadeDelete_); 258 endCascadeDeleteTemplate = helpers.getProperty(endCascadeDelete_); 259 assertInstanceOfLocalInterfaceImplTemplate = helpers.getProperty( 260 assertInstanceOfLocalInterfaceImpl_); 261 signature2_0Template = helpers.getProperty(signature2_0_); 262 } 263 } 264 | Popular Tags |