1 64 65 package com.jcorporate.expresso.core.misc; 66 67 import com.jcorporate.expresso.core.cache.CacheManager; 68 import com.jcorporate.expresso.core.controller.ControllerException; 69 import com.jcorporate.expresso.core.controller.ControllerFactory; 70 import com.jcorporate.expresso.core.db.DBConnectionPool; 71 import com.jcorporate.expresso.core.db.DBException; 72 import com.jcorporate.expresso.core.dbobj.DBObject; 73 import com.jcorporate.expresso.core.dbobj.Schema; 74 import com.jcorporate.expresso.core.dbobj.SchemaFactory; 75 import com.jcorporate.expresso.core.dbobj.SecuredDBObject; 76 import com.jcorporate.expresso.core.job.ServerException; 77 import com.jcorporate.expresso.core.jsdkapi.GenericDispatcher; 78 import com.jcorporate.expresso.core.registry.MutableRequestRegistry; 79 import com.jcorporate.expresso.core.registry.RequestRegistry; 80 import com.jcorporate.expresso.core.security.SuperUser; 81 import com.jcorporate.expresso.core.security.User; 82 import com.jcorporate.expresso.core.utility.JobHandler; 83 import com.jcorporate.expresso.kernel.LogManager; 84 import com.jcorporate.expresso.kernel.digester.SaxParserConfigurer; 85 import com.jcorporate.expresso.kernel.util.FastStringBuffer; 86 import com.jcorporate.expresso.services.dbobj.DBOtherMap; 87 import com.jcorporate.expresso.services.dbobj.SchemaList; 88 import com.jcorporate.expresso.services.dbobj.Setup; 89 import com.jcorporate.expresso.services.test.TestSystemInitializer; 90 import org.apache.commons.beanutils.BeanUtils; 91 import org.apache.commons.digester.Digester; 92 import org.apache.log4j.Logger; 93 import org.apache.struts.action.ActionMapping; 94 import org.apache.struts.config.ActionConfig; 95 import org.apache.struts.config.ForwardConfig; 96 import org.apache.struts.config.ModuleConfig; 97 import org.xml.sax.InputSource ; 98 import org.xml.sax.SAXException ; 99 100 import javax.servlet.ServletConfig ; 101 import javax.servlet.ServletContext ; 102 import javax.servlet.ServletException ; 103 import javax.servlet.http.HttpServletRequest ; 104 import java.io.File ; 105 import java.io.FileInputStream ; 106 import java.io.FileNotFoundException ; 107 import java.io.IOException ; 108 import java.net.URL ; 109 import java.util.ArrayList ; 110 import java.util.Enumeration ; 111 import java.util.HashMap ; 112 import java.util.Hashtable ; 113 import java.util.Iterator ; 114 import java.util.List ; 115 import java.util.Map ; 116 import java.util.Vector ; 117 118 126 public final class ConfigManager { 127 128 132 public static final String EXPRESSO_DTD_COPY_LOCATION = "/com/jcorporate/expresso/core/expresso-config_4_0.dtd"; 133 134 137 public static final String LOG_DIR_PARAM_NAME = "logDir"; 138 139 142 private static Hashtable currentLogins = new Hashtable (); 143 144 148 private static Hashtable allContexts = new Hashtable (); 149 150 155 private static String configDir = ""; 156 private static String servletAPIVersion = "2_2"; 160 166 private static Map mapModuleMapping = new HashMap (); 168 private static ConfigExpresso myConfig = null; 169 170 private static Hashtable dbOtherMap = new Hashtable (); 172 private static Logger log = Logger.getLogger(ConfigManager.class); 173 174 175 private static boolean xmlConfigOk = false; 176 private static boolean configurationFailed = false; 177 178 181 private static Hashtable jobHandlers = new Hashtable (); 182 183 187 private static Throwable configurationFailureException = null; 188 private static HttpServletRequest myRequest = null; 189 190 193 private static ConfigManager theInstance = null; 194 private static ControllerFactory controllerFactory = null; 195 196 197 202 public static void addSession(CurrentLogin newLogin) { 203 if (currentLogins == null) { 204 currentLogins = new Hashtable (); 205 } 206 207 if (newLogin == null) { 208 return; 209 } 210 211 String sessionid = newLogin.getSessionId(); 212 if (sessionid == null) { 213 return; 214 } 215 216 if (currentLogins.containsKey(newLogin.getSessionId())) { 217 currentLogins.remove(newLogin.getSessionId()); 218 } 219 currentLogins.put(newLogin.getSessionId(), newLogin); 220 } 221 222 public static void setConfigurationFailureException(Throwable ee) { 223 configurationFailureException = ee; 224 } 225 226 public static Throwable getConfigurationFailureException() { 227 return configurationFailureException; 228 } 229 230 236 public static void removeSession(String sessionId) { 237 if (sessionId == null) { 238 return; 239 } 240 241 if (currentLogins == null) { 242 currentLogins = new Hashtable (); 243 } 244 245 if (currentLogins.containsKey(sessionId)) { 246 currentLogins.remove(sessionId); 247 } 248 249 if (currentLogins.size() == 0) { 254 System.gc(); 255 System.runFinalization(); 256 } 257 } 258 259 264 public static Hashtable getCurrentLogins() { 265 return (Hashtable ) currentLogins.clone(); 266 } 267 268 275 public static JobHandler getJobHandler(String contextName) { 276 return (JobHandler) jobHandlers.get(contextName); 277 } 278 279 284 public static Hashtable getAllJobHandlers() { 285 return jobHandlers; 286 } 287 288 291 public ConfigManager() { 292 293 super(); 295 } 296 297 302 public static String getServletAPIVersion() { 303 return servletAPIVersion; 304 } 305 306 313 public static synchronized void dbUninitialize() 314 throws DBException { 315 if (log.isInfoEnabled()) { 316 log.info("Tearing down connection pools"); 317 } 318 319 320 DBConnectionPool.reInitialize(); 321 } 322 323 329 public static synchronized void destroy() { 330 if (theInstance == null) { 331 return; 332 } 333 334 ConfigManager cm = ConfigManager.getInstance(); 335 336 try { 337 cm.stopJobHandler(); 338 ConfigManager.dbUninitialize(); 339 340 341 com.jcorporate.expresso.core.dbobj.NextNumber.destroy(); 342 CacheManager.destroy(); 343 com.jcorporate.expresso.core.security.CryptoManager.getInstance().destroy(); 344 com.jcorporate.expresso.core.security.DelayThread.kill(); 345 LogManager.destroy(); 346 350 for (Enumeration e = ConfigManager.getAllConfigKeys(); e.hasMoreElements();) { 351 String oneKey = (String ) e.nextElement(); 352 try { 353 ConfigJdbc jdbcConfig = ConfigManager.getContext(oneKey).getJdbc(); 354 if (jdbcConfig.getDriver().equals("org.hsqldb.jdbcDriver")) { 355 356 DBConnectionPool pool = DBConnectionPool.getInstance(oneKey); 357 pool.executeExclusiveUpdate("SHUTDOWN"); 358 } 359 } catch (DBException ex) { 360 System.err.println("Error shutting down hypersonic: " + ex.getMessage()); 361 } 362 363 } 364 theInstance = null; 365 } catch (Exception e) { 366 e.printStackTrace(); 367 System.err.println(e.getMessage()); 368 } 369 370 } 371 372 378 public static synchronized void dbInitialize() 379 throws ConfigurationException { 380 if (log.isInfoEnabled()) { 381 log.info("Initializing connection pool(s)"); 382 } 383 384 String oneConfigKey = null; 385 386 for (Enumeration e = getAllConfigKeys(); e.hasMoreElements();) { 387 oneConfigKey = (String ) e.nextElement(); 388 if (log.isInfoEnabled()) { 389 log.info("Initializing pool for context '" + oneConfigKey + "'"); 390 } 391 392 ConfigJdbc myConfig = getJdbc(oneConfigKey); 393 394 if (myConfig != null) { 395 398 399 400 try { 401 402 405 DBConnectionPool myPool = DBConnectionPool.getInstance(oneConfigKey); 406 407 if (!StringUtil.notNull(myConfig.getDbTest()).equalsIgnoreCase("")) { 408 myPool.setTestQuery(myConfig.getDbTest()); 409 if (log.isInfoEnabled()) { 410 log.info("DB connection testing enabled"); 411 } 412 } else { 413 if (log.isInfoEnabled()) { 414 log.info("DB connection testing disabled"); 415 } 416 } 417 } catch (DBException de) { 418 log.error("Initialize failed for context '" + 419 oneConfigKey + 420 "'. This pool will not be available.", de); 421 } 422 } 423 424 } 425 426 427 if (log.isInfoEnabled()) { 428 log.info("All connection pools initialized"); 429 } 430 431 if (log.isInfoEnabled()) { 432 log.info("Initializing all registered DBObjets"); 433 } 434 435 } 436 437 443 static public synchronized void initializeAllDBObjects() { 444 boolean expressoInitialized = false; 445 446 447 for (Iterator i = allContexts.keySet().iterator(); i.hasNext();) { 448 try { 449 String oneDBName = (String ) i.next(); 450 ConfigContext oneContext = ConfigManager.getContext(oneDBName); 451 452 User old = null; 455 try { 456 old = RequestRegistry.getUser(); 457 } catch (Exception e) { 458 } 460 try { 461 new MutableRequestRegistry(oneDBName, SuperUser.SUPER_USER); 466 if (oneContext.hasSetupTables()) { 467 468 try { 469 SchemaList sl = new SchemaList(SecuredDBObject.SYSTEM_ACCOUNT); 470 sl.setDataContext(oneDBName); 471 sl.count(); 472 } catch (DBException e) { 473 if (log.isInfoEnabled()) { 474 log.info("Schema is not initialized yet- run dbcreate for context: " + oneDBName); 475 } 476 continue; 477 } 478 479 480 if (expressoInitialized == false) { 482 initializeOneSchema(com.jcorporate.expresso.core.ExpressoSchema.class.getName()); 483 expressoInitialized = true; 484 } 485 486 SchemaList sl = new SchemaList(SecuredDBObject.SYSTEM_ACCOUNT); 487 sl.setDataContext(oneDBName); 488 ArrayList al = sl.searchAndRetrieveList(); 489 490 for (Iterator schemas = al.iterator(); schemas.hasNext();) { 491 SchemaList oneSchema = (SchemaList) schemas.next(); 492 try { 493 initializeOneSchema(oneSchema.getField(SchemaList.FLD_SCHEMA_CLASS)); 494 } catch (Exception ex) { 495 log.error("Error initializing schema: " 496 + oneSchema.getField(SchemaList.FLD_SCHEMA_CLASS), ex); 497 } 498 499 } 500 } 501 } finally { 502 new MutableRequestRegistry(oneDBName, old); 503 } 504 } catch (DBException dbe) { 505 log.warn("Unable to initialize dbobjects... SchemaList may not be initialized yet", dbe); 506 } catch (Exception e) { 507 log.error("Error in initializeAllDBObjects", e); 508 } 509 } 510 } 511 512 static protected synchronized void initializeOneSchema(String className) { 513 if (className == null) { 514 log.warn("initializeOneSchema: Received null className"); 515 return; 516 } 517 518 Schema schema = SchemaFactory.getInstance().getSchema(className); 519 if (schema == null) { 520 log.error("initializeOneSchema: cannot find schema: " + className); 521 return; 522 } 523 524 Enumeration anEnum = schema.getMembers(); 526 while (anEnum.hasMoreElements()) { 527 DBObject obj = (DBObject) anEnum.nextElement(); 528 try { 529 obj.setSchema(schema); 530 } catch (Exception e) { 531 log.warn("cannot set schema for: " + obj.getClass().getName() + " because of: " + e.getMessage()); 532 } 533 } 534 535 } 536 537 538 544 public static Enumeration getAllConfigKeys() { 545 return allContexts.keys(); 546 } 547 548 549 557 public static synchronized ConfigManager getInstance() { 558 if (theInstance == null) { 559 theInstance = new ConfigManager(); 560 } 561 562 return theInstance; 563 } 564 565 570 public static boolean isInitialized() { 571 return xmlConfigOk; 572 } 573 574 580 public static ConfigExpresso getConfig() { 581 return myConfig; 582 } 583 584 585 595 public static HashMap getConfigInputSources(String filterDocType) 596 throws ConfigurationException { 597 final String myName = "ConfigManager.getConfigInputSources(String)"; 598 HashMap returnSources = new HashMap (); 599 String configDir = ConfigManager.getConfigDir(); 600 601 if (configDir == null) { 602 throw new ConfigurationException(myName + 603 ": There is no config Directory Set"); 604 } 605 606 InputSource inputSource = null; 607 XmlDocTypeFilter xmldtf = new XmlDocTypeFilter(); 608 609 if ('/' == configDir.charAt(0) == false) { 610 configDir = "/" + configDir; 611 } 612 613 if (log.isDebugEnabled()) { 614 log.debug("Getting Input Sources in directory: " + configDir); 615 } 616 617 File propDir = new File (configDir); 618 619 if (!propDir.isDirectory()) { 620 throw new ConfigurationException(myName + ": " + configDir + 621 " is not a directory"); 622 } 623 624 String [] flist = propDir.list(); 625 626 for (int i = 0; i < flist.length; i++) { 627 if (log.isDebugEnabled()) { 628 log.debug("Checking file: " + flist[i]); 629 } 630 if (flist[i].endsWith(".xml")) { 631 if (log.isDebugEnabled()) { 632 log.debug("File ends with xml"); 633 } 634 635 try { 636 String propFileName = configDir + "/" + flist[i]; 637 FileInputStream fis = new FileInputStream (propFileName); 638 639 try { 640 inputSource = new InputSource (fis); 641 inputSource.setSystemId(configDir + "/"); 642 643 if (xmldtf.isProperDocType(filterDocType, inputSource) == true) { 644 if (log.isDebugEnabled()) { 645 log.debug(propFileName + " is doctype " + 646 filterDocType + 647 " adding as inputsource"); 648 } 649 fis.close(); 650 inputSource = new InputSource (new FileInputStream (propFileName)); 651 inputSource.setSystemId(configDir + "/"); 652 returnSources.put(flist[i], inputSource); 653 } else { 654 if (log.isDebugEnabled()) { 655 log.debug(propFileName + " is not of doctype " + 656 filterDocType); 657 } 658 } 659 } finally { 660 fis.close(); 661 } 662 } catch (java.io.FileNotFoundException fnfe) { 663 throw new ConfigurationException(fnfe); 664 } catch (java.io.IOException ioe) { 665 throw new ConfigurationException(ioe); 666 } 667 } 668 } 669 670 return returnSources; 671 } 672 673 683 public static ConfigContext getContext(String contextName) 684 throws ConfigurationException { 685 StringUtil.assertNotBlank(contextName, 686 "You must specify a context name"); 687 688 if (allContexts == null) { 689 throw new ConfigurationException("No contexts available"); 690 } 691 692 ConfigContext oneContext = (ConfigContext) allContexts.get(contextName); 693 694 if (oneContext == null) { 695 throw new ConfigurationException("No such configuration context as '" + contextName + "'"); 696 } 697 698 return oneContext; 699 } 700 701 707 public static String getClassHandler(String handlerName) { 708 ConfigClassHandler cch = (ConfigClassHandler) myConfig.getClassHandlers().get(handlerName); 709 710 if (cch == null) { 711 return null; 712 } 713 714 return cch.getClassHandler(); 715 } 716 717 724 public static String getClassHandlerParameter(String handlerName, 725 String parameter) { 726 return ((ConfigClassHandler) myConfig.getClassHandlers().get(handlerName)).getParameter(parameter); 727 } 728 729 736 public static ConfigJdbc getJdbc(String contextName) 737 throws ConfigurationException { 738 ConfigContext oneContext = getContext(contextName); 739 740 if (oneContext != null) { 741 return oneContext.getJdbc(); 742 } 743 744 return null; 745 } 746 747 755 public static ConfigJdbc getJdbcRequired(String contextName) 756 throws ConfigurationException { 757 ConfigJdbc myJdbc = getJdbc(contextName); 758 759 if (myJdbc == null) { 760 throw new ConfigurationException("Context '" + contextName + 761 "' is not configured for JDBC access"); 762 } 763 764 return myJdbc; 765 } 766 767 772 public static String getWebAppDir() { 773 String webAppDir = SystemMacros.getInstance().getWebAppDir(); 774 775 if (webAppDir == null) { 776 try { 777 throw new Exception ("Getting requests for web application directory, but system is deployed in a " + 778 "compressed war file. There is no such thing"); 779 } catch (Exception ex) { 780 log.warn("getWebAppDir path error", ex); 781 } 782 } 783 return webAppDir; 784 } 785 786 796 public static boolean isReservedWord(String testWord) { 797 798 return ReservedWords.getInstance().isExpressoReservedWord(testWord); 800 } 801 802 810 public static boolean isParameterReservedWord(String testWord) { 811 return ReservedWords.getInstance().isExpressoReservedWord(testWord); 812 } 813 814 822 public static synchronized void startJobHandler() 823 throws ConfigurationException { 824 if (log.isInfoEnabled()) { 825 log.info("Starting job handler(s)"); 826 } 827 828 String oneConfigKey = null; 829 830 for (Enumeration e = getAllConfigKeys(); e.hasMoreElements();) { 832 oneConfigKey = (String ) e.nextElement(); 833 834 if (!getContext(oneConfigKey).startJobHandler()) { 836 log.warn("Job handler for configuration '" + oneConfigKey + 837 "' not enabled (because of the setting in expresso-config.xml)."); 838 } else { 839 if (log.isInfoEnabled()) { 840 log.info("Job handler for configuration '" + oneConfigKey + 841 "' starting..."); 842 } 843 844 845 846 try { 847 JobHandler ts = new JobHandler(oneConfigKey); 848 ts.setDaemon(true); 849 850 ts.start(); 852 jobHandlers.put(oneConfigKey, ts); 853 if (log.isInfoEnabled()) { 854 log.info("Job handler for '" + oneConfigKey + 855 "' running."); 856 } 857 } catch (DBException de) { 858 log.error("Job handler start failed for config key '" + 859 oneConfigKey + "'. Jobs for this config will " + 860 "will not be run.", de); 861 } catch (ServerException se) { 862 log.error("Job handler start failed for config key ' " + 863 oneConfigKey + 864 "'. Jobs for this config will will " + 865 "not be run.", se); 866 } 867 } 868 } 869 870 871 if (log.isInfoEnabled()) { 872 log.info("All job handlers started"); 873 } 874 } 875 876 877 883 protected void stopJobHandler() 884 throws ConfigurationException { 885 if (log.isInfoEnabled()) { 886 log.info("Stops job handler(s)"); 887 } 888 889 String oneConfigKey = null; 890 891 for (Enumeration e = getAllConfigKeys(); e.hasMoreElements();) { 893 oneConfigKey = (String ) e.nextElement(); 894 895 if (getContext(oneConfigKey).startJobHandler()) { 897 if (log.isInfoEnabled()) { 898 log.info("Job handler for configuration '" + oneConfigKey + 899 "' interrupting..."); 900 } 901 902 903 904 905 JobHandler ts = (JobHandler) jobHandlers.get(oneConfigKey); 906 907 if (ts != null) { 908 ts.shutDown(); 909 } 910 911 } 913 } 914 915 916 if (log.isInfoEnabled()) { 917 log.info("All job handlers interrupted"); 918 } 919 } 920 921 929 public static void setWebAppDir(String newDir) { 930 SystemMacros.getInstance().setWebAppDir(newDir); 931 } 932 933 940 public static void setContextPath(String newContextPath) { 941 SystemMacros.getInstance().setContextPath(newContextPath); 942 } 943 944 951 public synchronized static void setControllerFactory(ControllerFactory cf) { 952 controllerFactory = cf; 953 } 954 955 960 public static String getContextPath() { 961 if (!isInitialized()) { 962 throw new IllegalArgumentException ("ConfigManager not initialized"); 963 } 964 965 return SystemMacros.getInstance().getContextPath(); 966 } 967 968 975 public static synchronized void config(ServletConfig c) 976 throws ServletException { 977 978 979 if (configurationFailed) { 980 throw new ServletException ( 981 "ConfigManager: Configuration has already been attempted and has failed - cannot re-run"); 982 } 983 984 985 if (c == null) { 986 ServletException se = new ServletException ("ConfigManager: ServletConfig may not be null"); 987 setConfigurationFailureException(se); 988 throw se; 989 } 990 991 992 993 try { 994 ServletContext sc = c.getServletContext(); 995 servletAPIVersion = Integer.toString(sc.getMajorVersion()) + 996 "_" + 997 Integer.toString(sc.getMinorVersion()); 998 configDir = StringUtil.notNull(c.getInitParameter("configDir")); 1001 1002 if (configDir.equals("")) { 1003 configDir = StringUtil.notNull(sc.getInitParameter("configDir")); 1004 } 1005 if (configDir.equals("")) { 1006 ServletException se = new ServletException ("ConfigManager: No 'configDir' initial " + 1007 "parameter was read - unable to initialize. " + 1008 "Check web.xml to ensure the configDir parameter is set " + 1009 "to a non-blank value"); 1010 setConfigurationFailureException(se); 1011 throw se; 1012 } 1013 1014 String rootDir = StringUtil.notNull(sc.getRealPath("/")); 1015 1016 1021 if (rootDir.equals("")) { 1022 rootDir = System.getProperty("expresso.home", ""); 1024 if (rootDir.length() == 0) { 1025 log.warn("Deployed inside WAR file and no expresso.home " + 1026 "directory set. %WEB-APP% will expand to null"); 1027 } else { 1028 configDir = FileUtil.makeAbsolutePath(rootDir, configDir); 1029 1030 if (!('/' == configDir.charAt(0))) { 1031 configDir = "/" + configDir; 1032 } 1033 1034 setWebAppDir(rootDir); 1037 } 1038 } else { 1039 configDir = FileUtil.makeAbsolutePath(rootDir, configDir); 1040 1041 if (!('/' == configDir.charAt(0))) { 1042 configDir = "/" + configDir; 1043 } 1044 1045 1048 if (configDir.indexOf(' ') != -1) { 1050 System.err.println( 1052 "Bad name for installation path: Reinstall in directory without a space in name."); 1053 } 1054 setWebAppDir(rootDir); 1055 } 1056 1057 initLogManager(c); 1058 1059 load(configDir); 1060 } catch (Throwable thrown) { 1061 if (log != null) { 1062 log.error(thrown); 1063 } 1064 setConfigurationFailureException(thrown); 1065 System.err.println("ConfigManager: Expresso configuration encountered an exception:"); 1066 thrown.printStackTrace(System.err); 1067 configurationFailed = true; 1068 throw new ServletException (thrown); 1069 } 1070 } 1071 1072 1077 private static void initLogManager(ServletConfig sc) { 1078 String configDir = sc.getServletContext().getInitParameter("configDir"); 1079 String logDir = sc.getServletContext().getInitParameter(LOG_DIR_PARAM_NAME); 1080 String logConfig = null; 1081 1082 if (!('/' == configDir.charAt(0))) { 1083 configDir = getWebAppDir() + configDir; 1084 } 1085 1086 if (logDir != null && logDir.length() > 0 && !('/' == logDir.charAt(0))) { 1087 logDir = getWebAppDir() + logDir; 1088 } 1089 if (configDir != null && configDir.length() > 0) { 1095 logConfig = configDir + "/expressoLogging.xml"; 1096 java.io.File f = new java.io.File (logConfig); 1097 if (f == null || !f.exists()) { 1098 logConfig = null; 1099 } 1100 } 1101 1102 new LogManager(logConfig, logDir); 1103 } 1104 1105 1113 public static synchronized void load(String theConfigDir) 1114 throws DBException, ConfigurationException { 1115 1116 1117 StringUtil.assertNotBlank(theConfigDir, 1118 "No configuration directory specified"); 1119 Logger.getLogger(ConfigManager.class); ConfigManager.configDir = theConfigDir; 1121 1122 ConfigManager instance = ConfigManager.getInstance(); 1123 instance.readXMLConfig(configDir); 1124 1125 1127 if (log.isInfoEnabled()) { 1129 log.info("Initializing connection pool(s)"); 1130 } 1131 ConfigManager.dbInitialize(); 1132 1133 ConfigManager.mapOtherDBs(); 1135 1136 1137 if (log.isInfoEnabled()) { 1138 log.info("Reading setup values"); 1139 } 1140 Setup.readSetups(); 1141 1142 if (log.isInfoEnabled()) { 1143 log.info("Initializing Schema Objects"); 1144 } 1145 1146 initializeAllDBObjects(); 1147 1148 com.jcorporate.expresso.core.dbobj.NextNumber.getInstance(); 1149 CacheManager.getInstance(); 1150 1151 if (log.isInfoEnabled()) { 1157 log.info("Starting job handler(s)"); 1158 } 1159 ConfigManager.startJobHandler(); 1160 if (log.isInfoEnabled()) { 1161 log.info("Expresso initialization complete"); 1162 } 1163 } 1164 1165 1166 1173 public static String expandValue(String propValue) { 1174 return SystemMacros.getInstance().expandValue(propValue); 1175 } 1176 1177 1183 public static String getConfigDir() { 1184 return configDir; 1185 } 1186 1187 1193 public static synchronized ControllerFactory getControllerFactory() { 1194 if (controllerFactory == null) { 1195 controllerFactory = new com.jcorporate.expresso.core.controller.DefaultControllerFactory(); 1196 } 1197 1198 return controllerFactory; 1199 } 1200 1201 1210 public static String getOtherDbLocation(String dbName, String objectName) { 1211 FastStringBuffer fsb = FastStringBuffer.getInstance(); 1212 try { 1213 fsb.append(dbName); 1214 fsb.append("|"); 1215 fsb.append(objectName); 1216 return (String ) dbOtherMap.get(fsb.toString()); 1217 } finally { 1218 fsb.release(); 1219 } 1220 } 1221 1222 1228 public static Hashtable getOtherDBLocations() { 1229 return (Hashtable ) dbOtherMap.clone(); 1230 } 1231 1232 1241 public static synchronized void mapOtherDBs() 1242 throws ConfigurationException { 1243 String oneKey = ""; 1244 dbOtherMap.clear(); 1246 for (Enumeration ek = getAllConfigKeys(); ek.hasMoreElements();) { 1247 oneKey = (String ) ek.nextElement(); 1248 1249 ConfigContext oneContext = getContext(oneKey); 1250 1251 if (oneContext.hasSetupTables() && oneContext.isActive()) { 1252 if (log.isInfoEnabled()) { 1253 log.info("Reading DBObject mappings to other databases, context '" + 1254 oneKey + "'..."); 1255 } 1256 new MutableRequestRegistry(oneKey, SuperUser.SUPER_USER); 1261 1262 try { 1263 SchemaList sl = new SchemaList(SecuredDBObject.SYSTEM_ACCOUNT); 1264 sl.setDataContext(oneKey); 1265 sl.count(); 1266 } catch (DBException e) { 1267 if (log.isInfoEnabled()) { 1268 log.info("Context: " + oneKey + " does not have a SchemaList yet. Skipping for now"); 1269 continue; 1270 } 1271 } 1272 1273 int i = 0; 1274 1275 try { 1276 DBOtherMap otherDB = new DBOtherMap(); 1277 otherDB.setDataContext(oneKey); 1278 1279 DBOtherMap oneOtherDB = null; 1280 FastStringBuffer fsb = FastStringBuffer.getInstance(); 1281 try { 1282 for (Iterator allOtherDB = otherDB.searchAndRetrieveList().iterator(); 1283 allOtherDB.hasNext();) { 1284 oneOtherDB = (DBOtherMap) allOtherDB.next(); 1285 fsb.append(oneKey); 1286 fsb.append("|"); 1287 fsb.append(oneOtherDB.getField("DBObjName")); 1288 dbOtherMap.put(fsb.toString(), 1289 oneOtherDB.getField("DBConnName")); 1290 fsb.clear(); 1291 i++; 1292 } 1293 } finally { 1294 fsb.release(); 1295 } 1296 1297 if (log.isInfoEnabled()) { 1298 log.info("Added " + i + 1299 " entries to the DBObject Other Database Map."); 1300 } 1301 } catch (DBException de) { 1302 if (oneKey.equalsIgnoreCase(TestSystemInitializer.getTestContext())) { 1303 log.warn("Didn't read test database mapping context: " + 1304 de.getMessage()); 1305 } else { 1306 log.error("Unable to read database mapping entries for context '" + 1307 oneKey + "'", de); 1308 } 1309 } 1310 } else { 1311 if (log.isInfoEnabled()) { 1312 log.info( 1313 "DB/Context '" + oneKey + 1314 "' is not an Expresso database, or is not active - not reading mapping entries from this context"); 1315 } 1316 } 1317 } 1318 1319 } 1320 1321 1322 1328 public static void reInitialize(HttpServletRequest req, ServletConfig c) 1329 throws ServletException { 1330 try { 1331 DBConnectionPool.reInitialize(); 1332 checkInitialized(req, c); 1333 } catch (DBException de) { 1334 System.err.println("ConfigManager: Error re-initializing:"); 1335 de.printStackTrace(System.err); 1336 } 1337 1338 } 1339 1340 1352 public static void checkInitialized(HttpServletRequest req, 1353 ServletConfig c) 1354 throws ServletException { 1355 1356 if (!isInitialized()) { 1360 System.err.println("ConfigManager: Expresso was not initialized - initializing now"); 1361 config(c); 1362 } 1363 1364 setRequest(req); 1365 } 1366 1367 1368 1375 public static synchronized void setRequest(HttpServletRequest req) { 1376 if (myRequest == null) { 1377 myRequest = req; 1378 SystemMacros sm = SystemMacros.getInstance(); 1379 sm.setContextPath(GenericDispatcher.getContextPath(req)); 1380 sm.setServerPrefix(req.getServerName() + ":" + req.getServerPort()); 1381 } 1382 } 1383 1384 1388 1408 public static void storeModuleActionConfig(ModuleConfig moduleConfig) { 1409 String prefixName = moduleConfig.getPrefix(); 1410 ActionConfig actionConfig[] = moduleConfig.findActionConfigs(); 1411 if (log.isDebugEnabled()) { 1412 log.debug("ConfigManager.saveModuleActionConfig() prefix=`" + prefixName + "'"); 1413 } 1414 1415 synchronized (mapModuleMapping) { 1416 Map mapMappings = new HashMap (); 1417 for (int j = 0; j < actionConfig.length; ++j) { 1418 String controllerName = actionConfig[j].getType(); 1419 List list = (List) mapMappings.get(controllerName); 1420 if (list == null) { 1421 list = new ArrayList (); 1422 } 1423 list.add(actionConfig[j]); 1424 mapMappings.put(controllerName, list); 1425 if (log.isDebugEnabled()) { 1426 log.debug(" " + controllerName + " => { `" + actionConfig[j].getPath() + "' " + 1427 "name:`" + actionConfig[j].getName() + "' " + 1428 "scope:`" + actionConfig[j].getScope() + "' " + 1429 "input:`" + actionConfig[j].getInput() + "' " + 1430 "attribute:`" + actionConfig[j].getAttribute() + "' " + 1431 "parameter:`" + actionConfig[j].getParameter() + "' " + 1432 "validate:`" + actionConfig[j].getValidate() + "' " + 1433 "}"); 1434 } 1435 } 1436 1437 mapModuleMapping.put(prefixName, mapMappings); 1438 } 1439 } 1440 1441 1451 public static ActionConfig getActionConfig(String controllerName, String stateName) { 1452 return getActionConfig("", controllerName, stateName); 1453 } 1454 1455 1512 public static ActionConfig getActionConfig(String moduleName, String controllerName, String stateName) { 1513 if (log.isDebugEnabled()) { 1514 log.debug("CF.getActionConfig() moduleName=`" + moduleName + 1515 "', controllerName=`" + controllerName + "', stateName=`" + stateName + "'"); 1516 } 1517 1518 if (moduleName == null) { 1519 throw new IllegalArgumentException ("ConfigManager.getActionMapping(): " + 1520 "parameter moduleName cannot be null"); 1521 } 1522 if (controllerName == null) { 1523 throw new IllegalArgumentException ("ConfigManager.getActionMapping(): " + 1524 "parameter controllerName cannot be null"); 1525 } 1526 1527 if (stateName == null || stateName.length() == 0) { 1528 try { 1529 com.jcorporate.expresso.core.controller.Controller c = 1530 ConfigManager.getControllerFactory().getController(moduleName, controllerName); 1531 1532 stateName = c.getInitialState(); 1533 if (stateName == null || stateName.length() == 0) { 1534 throw new IllegalArgumentException ("ConfigManager.getMapping(): " + 1535 "stateName was null and there is no defined initial state for: " 1536 + controllerName); 1537 } 1538 if (log.isDebugEnabled()) { 1539 log.debug("using initial state =`" + stateName + "'"); 1540 } 1541 } catch (ControllerException ex) { 1542 throw new RuntimeException ("ConfigManager.getMapping(): " 1543 + "stateName was null and can't construct controller of name: " 1544 + controllerName, ex); 1545 } catch (ClassCastException ex) { 1546 log.error("Error getting controller", ex); 1547 throw new IllegalArgumentException ("ClassCastException getting" 1548 + " controller: " + ex.toString()); 1549 } 1550 } 1551 1552 synchronized (mapModuleMapping) { 1553 Map mapMappings = (Map) mapModuleMapping.get(moduleName); 1554 if (mapMappings != null) { 1555 List list = (List) mapMappings.get(controllerName); 1556 if (list != null) { 1557 for (int j = 0; j < list.size(); ++j) { 1558 ActionConfig oneConfig = (ActionConfig) list.get(j); 1559 if (StringUtil.notNull(oneConfig.getParameter()).equals(stateName)) { 1560 if (log.isDebugEnabled()) { 1561 log.debug("CM.getActionConfig() *FOUND* parameter=`" + oneConfig.getParameter() + "' actionConfig:" 1562 + oneConfig.getName() + "," + oneConfig.getPath()); 1563 } 1564 return oneConfig; 1565 } 1566 1567 ForwardConfig aForward = findForwardConfig(oneConfig, stateName); 1568 if (aForward != null) { 1569 if (log.isDebugEnabled()) { 1570 log.debug("CM.getActionConfig() *FOUND* forwards=`" 1571 + aForward.getName() + "',`" + aForward.getPath() + 1572 "' actionConfig:" + oneConfig.getName() + "," + oneConfig.getPath()); 1573 } 1574 return oneConfig; 1575 } 1576 } 1577 1578 1579 if (list.size() > 0) { 1583 ActionConfig oneConfig = (ActionConfig) list.get(0); 1584 if (log.isDebugEnabled()) { 1585 log.debug("CM.getActionConfig() *FOUND* using the FIRST actionConfig:" 1586 + oneConfig.getName() + "," + oneConfig.getPath()); 1587 } 1588 return oneConfig; 1589 } 1590 } 1591 } 1592 } 1593 1594 return (null); 1595 } 1596 1597 1605 public static final ForwardConfig findForwardConfig(ActionConfig oneConfig, 1606 String stateName) { 1607 1608 ForwardConfig forwards[] = oneConfig.findForwardConfigs(); 1609 for (int k = 0; k < forwards.length; ++k) { 1610 if (forwards[k].getName().equals(stateName)) { 1611 return forwards[k]; 1612 } 1613 } 1614 1615 return null; 1616 } 1617 1618 1628 public static List getActionConfigList(String controllerName) { 1629 return getActionConfigList("", controllerName); 1630 } 1631 1632 1643 public static List getActionConfigList(String moduleName, String controllerName) { 1644 if (moduleName == null) { 1645 throw new IllegalArgumentException ("ConfigManager.getActionConfigList(): " + 1646 "parameter moduleName cannot be null"); 1647 } 1648 if (controllerName == null) { 1649 throw new IllegalArgumentException ("ConfigManager.getActionConfigList(): " + 1650 "parameter controllerName cannot be null"); 1651 } 1652 1653 List result = new ArrayList (); 1654 1655 synchronized (mapModuleMapping) { 1656 Map mapMappings = (Map) mapModuleMapping.get(moduleName); 1657 if (mapMappings != null) { 1658 List mappings = (List) mapMappings.get(controllerName); 1659 if (mappings != null) { 1660 result.addAll(mappings); 1663 } 1664 } 1665 } 1666 1667 return result; 1668 } 1669 1670 1680 public static ActionMapping getMapping(String controllerName, String stateName) { 1681 ActionMapping mapping = null; 1682 ActionConfig config = getActionConfig("", controllerName, stateName); 1683 if (config != null) { 1684 mapping = new ActionMapping(); 1690 try { 1691 BeanUtils.copyProperties(mapping, config); 1692 } catch (Exception e) { 1693 log.error("BeanUtils failed to copy properties", e); 1694 e.printStackTrace(); 1695 } 1696 } 1697 1698 return mapping; 1699 } 1700 1701 1702 1706 1707 1718 private void readXMLConfig(String configDir) 1719 throws ConfigurationException { 1720 Logger setupLog = Logger.getLogger(ConfigManager.class); 1721 setupLog.info("ConfigManager: Reading XML config"); 1722 1723 setSAXParser(); 1724 1725 Digester digester = new Digester(); 1726 URL url = ConfigManager.class.getResource(EXPRESSO_DTD_COPY_LOCATION); 1727 1728 if (url != null) { 1729 digester.register("-//Jcorporate Ltd//DTD Expresso Configuration 4.0//EN", 1730 url.toString()); 1731 } else { 1732 ConfigurationException ce = new ConfigurationException( 1733 "ConfigManager: Unable to get URL to the expresso-config dtd from: " + EXPRESSO_DTD_COPY_LOCATION + " relative to classes directory (DTD should be copied there)."); 1734 setConfigurationFailureException(ce); 1735 throw ce; 1736 } 1737 1738 myConfig = new ConfigExpresso(); 1739 1740 ConfigErrorHandler myHandler = new ConfigErrorHandler(); 1741 digester.setErrorHandler(myHandler); 1742 digester.setUseContextClassLoader(true); 1743 1751 this.setDigesterRules(myConfig, digester); 1752 1753 1754 FileInputStream fin = null; 1755 1756 try { 1757 fin = new FileInputStream (configDir + "/expresso-config.xml"); 1758 } catch (FileNotFoundException fe) { 1759 ConfigurationException ce = new ConfigurationException("No such file as '" + 1760 configDir + 1761 "/expresso-config.xml"); 1762 setConfigurationFailureException(ce); 1763 throw ce; 1764 } 1765 try { 1766 digester.parse(fin); 1767 } catch (IOException ie) { 1768 System.err.println("ConfigManager: IOException reading expresso-config.xml:"); 1769 ie.printStackTrace(System.err); 1770 configurationFailed = true; 1771 setConfigurationFailureException(ie); 1772 throw new ConfigurationException("IO Exception reading expresso-config.xml"); 1773 } catch (SAXException se) { 1774 System.err.println("ConfigManager: SAXException reading expresso-config.xml:"); 1775 se.printStackTrace(System.err); 1776 setConfigurationFailureException(se); 1777 1778 if (se.getException() != null) { 1779 System.err.println("ConfigManager: Nested SAX Exception:"); 1780 se.getException().printStackTrace(System.err); 1781 } 1782 1783 configurationFailed = true; 1784 throw new ConfigurationException("SAX Exception reading expresso-config.xml"); 1785 } catch (IllegalArgumentException ia) { 1786 configurationFailed = true; 1787 setConfigurationFailureException(ia); 1788 throw new ConfigurationException("Illegal Setup Value Specified", 1789 ia); 1790 } finally { 1791 if (fin != null) { 1792 try { 1793 fin.close(); 1794 } catch (IOException ex) { 1795 setupLog.error("Error closing file input stream", ex); 1796 } 1797 } 1798 } 1799 1800 digester = null; 1801 System.gc(); 1803 if (myHandler.anyErrorsOrWarnings()) { 1805 Exception oneException = null; 1806 Vector warnings = myHandler.getWarnings(); 1807 1808 if (warnings.size() > 0) { 1809 System.err.println("ConfigManager: XML warnings:"); 1810 1811 for (Enumeration ee2 = warnings.elements(); 1812 ee2.hasMoreElements();) { 1813 oneException = (Exception ) ee2.nextElement(); 1814 oneException.printStackTrace(System.err); 1815 setConfigurationFailureException(oneException); 1816 } 1817 } 1818 1819 1820 Vector errors = myHandler.getErrors(); 1821 1822 if (errors.size() > 0) { 1823 System.err.println("ConfigManager: XML errors:"); 1824 1825 for (Enumeration ee = errors.elements(); ee.hasMoreElements();) { 1826 oneException = (Exception ) ee.nextElement(); 1827 oneException.printStackTrace(System.err); 1828 setConfigurationFailureException(oneException); 1829 } 1830 } 1831 1832 1833 Exception fatal = myHandler.getFatalException(); 1834 1835 if (fatal != null) { 1836 System.err.println("ConfigManager: Fatal XML exception:"); 1837 setConfigurationFailureException(oneException); 1838 fatal.printStackTrace(System.err); 1839 } 1840 1841 configurationFailed = true; 1842 throw new ConfigurationException("Unable to parse expresso-config.xml successfully. " + 1843 "Please see your 'system.err' log file for details of the problem"); 1844 } 1845 1846 System.err.println("ConfigManager: Done reading XML config - no errors or warnings"); 1847 1848 1850 1851 ConfigContext oneContext = null; 1852 1853 Vector contexts = myConfig.getContexts(); 1854 int contextsize = contexts.size(); 1855 for (int i = 0; i < contextsize; i++) { 1856 oneContext = (ConfigContext) contexts.elementAt(i); 1858 if (oneContext.isActive() == true) { 1859 allContexts.put(oneContext.getName(), oneContext); 1860 } else { 1861 contexts.removeElementAt(i); 1862 contextsize -= 1; 1863 i--; 1864 } 1865 } 1866 1867 xmlConfigOk = true; 1868 } 1869 1870 1876 protected void setDigesterRules(ConfigExpresso myConfig, Digester digester) { 1877 digester.push(myConfig); 1878 1879 1880 digester.addSetProperties("expresso-config"); 1881 digester.addCallMethod("expresso-config/logDirectory", 1882 "setLogDirectory", 0); 1883 digester.addCallMethod("expresso-config/strongCrypto", 1884 "setStrongCrypto", 0); 1885 digester.addCallMethod("expresso-config/cryptoKey", "setCryptoKey", 0); 1886 digester.addCallMethod("expresso-config/servletAPI", "setServletAPI", 1887 0); 1888 digester.addCallMethod("expresso-config/encryptMode", "setEncryptMode", 1889 0); 1890 1891 digester.addCallMethod("expresso-config/httpPort", "setHttpPort", 0); 1892 digester.addCallMethod("expresso-config/sslPort", "setSslPort", 0); 1893 1894 1895 digester.addObjectCreate("expresso-config/cacheManager", 1896 "com.jcorporate.expresso.core.misc.ConfigCacheManager"); 1897 digester.addSetProperties("expresso-config/context/cacheManager"); 1898 digester.addSetNext("expresso-config/cacheManager", "addCacheManager", 1899 "com.jcorporate.expresso.core.misc.ConfigCacheManager"); 1900 1901 1902 digester.addObjectCreate("expresso-config/class-handlers/class-handler", 1903 "com.jcorporate.expresso.core.misc.ConfigClassHandler"); 1904 digester.addSetProperties("expresso-config/class-handlers/class-handler"); 1905 digester.addSetNext("expresso-config/class-handlers/class-handler", 1906 "addClassHandler", 1907 "com.jcorporate.expresso.core.misc.ConfigClassHandler"); 1908 digester.addObjectCreate("expresso-config/class-handlers/class-handler/handler-parameter", 1909 "com.jcorporate.expresso.core.misc.ConfigClassHandlerParameter"); 1910 digester.addSetProperties("expresso-config/class-handlers/class-handler/handler-parameter"); 1911 digester.addSetNext("expresso-config/class-handlers/class-handler/handler-parameter", 1912 "addParameter", 1913 "com.jcorporate.expresso.core.misc.ConfigClassHandlerParameter"); 1914 1915 1916 digester.addObjectCreate("expresso-config/context", 1917 "com.jcorporate.expresso.core.misc.ConfigContext"); 1918 digester.addSetProperties("expresso-config/context"); 1919 digester.addCallMethod("expresso-config/context/description", 1920 "setDescription", 0); 1921 digester.addCallMethod("expresso-config/context/images", "setImages", 1922 0); 1923 digester.addCallMethod("expresso-config/context/startJobHandler", 1924 "setStartJobHandler", 0); 1925 digester.addCallMethod("expresso-config/context/showStackTrace", 1926 "setShowStackTrace", 0); 1927 digester.addCallMethod("expresso-config/context/mailDebug", 1928 "setMailDebug", 0); 1929 digester.addCallMethod("expresso-config/context/expressoDir", 1930 "setExpressoDir", 0); 1931 digester.addCallMethod("expresso-config/context/hasSetupTables", 1932 "setHasSetupTables", 0); 1933 digester.addSetNext("expresso-config/context", "addContext", 1934 "com.jcorporate.expresso.core.misc.ConfigContext"); 1935 1936 1937 digester.addObjectCreate("expresso-config/context/jdbc", 1938 "com.jcorporate.expresso.core.misc.ConfigJdbc"); 1939 digester.addCallMethod("expresso-config/context/jdbc/dbWildcard", 1940 "addWildcard", 0); 1941 digester.addSetProperties("expresso-config/context/jdbc"); 1942 digester.addSetNext("expresso-config/context/jdbc", "addJdbc", 1943 "com.jcorporate.expresso.core.misc.ConfigJdbc"); 1944 1945 1946 digester.addObjectCreate("expresso-config/context/jdbc/jndi", 1947 "com.jcorporate.expresso.core.misc.ConfigJndi"); 1948 digester.addSetProperties("expresso-config/context/jdbc/jndi"); 1949 digester.addSetNext("expresso-config/context/jdbc/jndi", "addJndi", 1950 "com.jcorporate.expresso.core.misc.ConfigJndi"); 1951 1952 1953 digester.addObjectCreate("expresso-config/context/path-mappings/path-mapping", 1954 "com.jcorporate.expresso.core.misc.ConfigPathMapping"); 1955 digester.addSetProperties("expresso-config/context/path-mappings/path-mapping"); 1956 digester.addSetNext("expresso-config/context/path-mappings/path-mapping", 1957 "addPathMapping", 1958 "com.jcorporate.expresso.core.misc.ConfigPathMapping"); 1959 digester.addCallMethod("expresso-config/context/path-mappings/path-mapping/url-pattern", 1960 "setUrlPattern", 0); 1961 digester.addCallMethod("expresso-config/context/path-mappings/path-mapping/path", 1962 "setPath", 0); 1963 digester.addObjectCreate("expresso-config/context/path-mappings/path-mapping/param", 1964 "com.jcorporate.expresso.core.misc.ConfigPathParam"); 1965 digester.addSetNext("expresso-config/context/path-mappings/path-mapping/param", 1966 "addParam", 1967 "com.jcorporate.expresso.core.misc.ConfigPathParam"); 1968 digester.addObjectCreate("expresso-config/context/path-mappings/path-mapping/fixed-param", 1969 "com.jcorporate.expresso.core.misc.ConfigPathFixedParam"); 1970 digester.addSetNext("expresso-config/context/path-mappings/path-mapping/fixed-param", 1971 "addFixedParam", 1972 "com.jcorporate.expresso.core.misc.ConfigPathFixedParam"); 1973 1974 digester.addCallMethod("expresso-config/context/path-mappings/path-mapping/param/param-name", 1977 "setName", 0); 1978 digester.addCallMethod("expresso-config/context/path-mappings/path-mapping/param/param-number", 1979 "setNumber", 0); 1980 digester.addCallMethod("expresso-config/context/path-mappings/path-mapping/fixed-param/param-name", 1981 "setName", 0); 1982 digester.addCallMethod("expresso-config/context/path-mappings/path-mapping/fixed-param/param-value", 1983 "setValue", 0); 1984 1985 1986 digester.addObjectCreate("expresso-config/context/ldap", 1987 "com.jcorporate.expresso.core.misc.ConfigLdap"); 1988 digester.addSetProperties("expresso-config/context/ldap"); 1989 digester.addSetNext("expresso-config/context/ldap", "addLdap", 1990 "com.jcorporate.expresso.core.misc.ConfigLdap"); 1991 1992 1993 digester.addObjectCreate("expresso-config/context/setupDefault", 1994 "com.jcorporate.expresso.core.misc.ConfigSetupDefault"); 1995 digester.addSetProperties("expresso-config/context/setupDefault"); 1996 digester.addSetNext("expresso-config/context/setupDefault", 1997 "addSetupDefault", 1998 "com.jcorporate.expresso.core.misc.ConfigSetupDefault"); 1999 2000 2001 digester.addObjectCreate("expresso-config/context/type-mapping", 2002 "com.jcorporate.expresso.core.misc.ConfigTypeMapping"); 2003 digester.addSetNext("expresso-config/context/type-mapping", 2004 "addTypeMapping", 2005 "com.jcorporate.expresso.core.misc.ConfigTypeMapping"); 2006 digester.addCallMethod("expresso-config/context/type-mapping/java-type", 2007 "setJavaType", 0); 2008 digester.addCallMethod("expresso-config/context/type-mapping/db-type", 2009 "setDBType", 0); 2010 digester.addCallMethod("expresso-config/context/type-mapping/expresso-type", 2011 "setExpressoType", 0); 2012 2013 2014 digester.addObjectCreate("expresso-config/context/customProperty", 2015 "com.jcorporate.expresso.core.misc.ConfigCustomProperty"); 2016 digester.addSetNext("expresso-config/context/customProperty", 2017 "addCustomProperty", 2018 "com.jcorporate.expresso.core.misc.ConfigCustomProperty"); 2019 digester.addSetProperties("expresso-config/context/customProperty"); 2020 digester.addCallMethod("expresso-config/context/customProperty/name", 2021 "setName", 0); 2022 digester.addCallMethod("expresso-config/context/customProperty/value", 2023 "setValue", 0); 2024 digester.setValidating(true); 2026 2027 } 2028 2029 2033 protected void setSAXParser() { 2034 2035 new SaxParserConfigurer(); 2039 } 2040 2041} 2042 | Popular Tags |