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 51 public class CMPROTemplateFormatter { 52 53 private final static String templateFile = 54 "com/sun/jdo/spi/persistence/support/ejb/ejbc/CMPROTemplates.properties"; 56 public final static String updateNotAllowed_ = "updateNotAllowed"; public final static String accessNotAllowed_ = "accessNotAllowed"; public final static String loadNonDFG_ = "loadNonDFG"; 61 public static Properties helpers = null; 63 64 public static MessageFormat privatetransientvformatter = null; 67 public static MessageFormat giformatter = null; public static MessageFormat jdolookuppmfformatter = null; public static MessageFormat ejb__refreshformatter = null; public static MessageFormat loadNonDFGformatter = null; 73 public static String privateStaticVariablesTemplate = null; 76 public static String signatureTemplate = null; 77 public static String updateNotAllowedTemplate = null; 78 public static String accessNotAllowedTemplate = null; 79 public static String jdoCleanAllRefsTemplate = null; 80 81 public static String [] jdoGetPersistenceManagerBody = null; 84 public static String [] jdoReleasePersistenceManagerBody = null; 85 86 89 CMPROTemplateFormatter() { 90 } 91 92 95 static synchronized void initHelpers() throws IOException { 96 if (helpers == null) { 97 helpers = new Properties (); 98 CMPTemplateFormatter.loadProperties(helpers, templateFile); 99 100 initFormatters(); 101 initTemplates(); 102 } 103 } 104 105 108 private static void initFormatters() { 109 privatetransientvformatter = new MessageFormat (helpers.getProperty( 111 CMPTemplateFormatter.privateTransientVariables_)); 112 113 giformatter = new MessageFormat (helpers.getProperty( 115 CMPTemplateFormatter.getInstance_)); 116 jdolookuppmfformatter = new MessageFormat (helpers.getProperty( 117 CMPTemplateFormatter.jdoLookupPersistenceManagerFactory_)); 118 ejb__refreshformatter = new MessageFormat (helpers.getProperty( 119 CMPTemplateFormatter.ejb__refresh_)); 120 loadNonDFGformatter = new MessageFormat (helpers.getProperty(loadNonDFG_)); 121 } 122 123 126 private static void initTemplates() { 127 privateStaticVariablesTemplate = helpers.getProperty( 128 CMPTemplateFormatter.privateStaticVariables_); 129 signatureTemplate = helpers.getProperty(CMPTemplateFormatter.signature_); 130 updateNotAllowedTemplate = helpers.getProperty(updateNotAllowed_); 131 accessNotAllowedTemplate = helpers.getProperty(accessNotAllowed_); 132 jdoCleanAllRefsTemplate = helpers.getProperty(CMPTemplateFormatter.jdoCleanAllRefs_); 133 134 jdoGetPersistenceManagerBody = CMPTemplateFormatter.getBodyAsStrings( 135 helpers.getProperty(CMPTemplateFormatter.jdoGetPersistenceManager_)); 136 jdoReleasePersistenceManagerBody = CMPTemplateFormatter.getBodyAsStrings( 137 helpers.getProperty(CMPTemplateFormatter.jdoReleasePersistenceManager_)); 138 } 139 } 140 | Popular Tags |