1 30 package org.jahia.settings; 31 32 import java.io.File ; 33 import java.util.Enumeration ; 34 import java.util.Hashtable ; 35 import java.util.Properties ; 36 37 import org.jahia.data.constants.JahiaConstants; 38 import org.jahia.exceptions.JahiaException; 39 import org.jahia.tools.files.DtdEntityResolver; 40 import org.jahia.tools.files.MimeTypesFromWebAppXmlFile; 41 import org.jahia.utils.JahiaTools; 42 import org.jahia.utils.properties.PropertiesManager; 43 import org.xml.sax.EntityResolver ; 44 import java.util.NoSuchElementException ; 45 import org.jahia.utils.PathResolver; 46 47 48 public class SettingsBean { 49 50 private static org.apache.log4j.Logger logger = 51 org.apache.log4j.Logger.getLogger (SettingsBean.class); 52 53 54 final private static Hashtable settings = new Hashtable (); 55 56 private PathResolver pathResolver = null; 57 58 private static String mLicenseFilename; 59 private static String propertiesFileName; 60 61 private Properties properties; 62 63 public int buildNumber; 65 66 private String server; 68 private String serverHomeDiskPath; 69 private String jahiaHomeDiskPath; 70 private String jahiaTemplatesDiskPath; 71 private String jahiaHtmlEditorsDiskPath; 72 private String jahiaWebAppsDiskPath; 73 private String jahiaEnginesDiskPath; 74 private String jahiaJspDiskPath; 75 private String jahiaFilesDiskPath; 76 private String jahiaEtcDiskPath; 77 private String jahiaVarDiskPath; 78 private String jahiaFilesBigTextDiskPath; 79 private String jahiaFilesTemplatesDiskPath; 80 private String jahiaLdapDiskPath; 81 private String jahiaCasDiskPath; 82 private String jahiaHostHttpPath; 83 private String jahiaCoreHttpPath; 84 private String jahiaTemplatesHttpPath; 85 private String jahiaEnginesHttpPath; 86 private String jahiaWebAppsDeployerBaseURL; 87 private String jahiaJavaScriptDiskPath; 88 private String jahiaNewTemplatesDiskPath; 89 private String jahiaNewWebAppsDiskPath; 90 private String jahiaSharedComponentsDiskPath; 91 private String jahiaSharedTemplatesDiskPath; 92 private String jspContext; 93 private String templatesContext; 94 private String htmlEditorsContext; 95 private String enginesContext; 96 private String javascriptContext; 97 private String jahiaJavaScriptHttpPath; 98 private String classDiskPath; 99 private String componentsDiskPath; 100 101 private String jahiaOutputCacheConfigDiskPath; 103 104 private Hashtable jahiaMaxCachedValues; 106 107 private int jahiaWebAppsAutoDeploy; 109 private int jahiaTemplatesAutoDeploy; 110 111 private String jahiaFileRepositoryDiskPath; 113 private int jahiaFileUploadMaxSize; 114 115 private String db_driver; 117 private String db_url; 118 private String db_username; 119 private String db_password; 120 private boolean db_transactions; 121 private int db_min_connections; 122 private int db_max_connections; 123 private boolean db_waitIfBusy; 124 private boolean db_verbose; 125 private boolean db_veryVerbose; 126 private boolean db_support_embedded_select_statement; 127 private int db_maxOpenPreparedStatements; 128 private boolean db_poolPreparedStatements; 129 130 private boolean utf8Encoding; 132 133 private boolean locksActivated; 135 136 private boolean fileLockOnPublication; 138 139 final public static String OUTPUT_CACHE_ACTIVATED = "outputCacheActivated"; 141 142 final public static String PRELOAD_HOMEPAGE_FIELDS_ACTIVATED = "preloadHomepageFieldsActivated"; 144 145 private long outputCacheDefaultExpirationDelay; 147 148 private boolean siteIDInURL; 150 151 private boolean appInheritJahiaSessionAttributes; 154 155 private String defaultLanguageCode; 157 158 private String defaultSite; 160 161 private int aclPreloadCount = 0; 165 166 private boolean transformFilenames; 168 169 private boolean transformDirnames; 170 171 final public static String JMS_CACHE_ACTIVATION = "org.jahia.cache.jmsCacheActivated"; 175 final public static String JMS_INITIAL_CONTEXT = "org.jahia.cache.jmsCacheInitialContextFactory"; 176 final public static String JMS_CONTEXT_PROVIDER_URL = "org.jahia.cache.jmsCacheContextProviderURL"; 177 final public static String JMS_TOPIC_CONNECTION_FACTORY_NAME = "org.jahia.cache.jmsCacheTopicConnectionFactoryName"; 178 final public static String JMS_TOPIC_NAME = "org.jahia.cache.jmsCacheTopicName"; 179 final public static String JMS_MAX_MESSAGES_IN_PACKAGE = "org.jahia.cache.jmsCacheMaxMessagesInPackage"; 180 final public static String JMS_SERVER_LOOKUP_SLEEP_TIME = "org.jahia.cache.jmsServerLookupSleepTime"; 181 final public static long JMS_SERVER_LOOKUP_SLEEP_TIME_DEFAULT = 5000; 183 public String mail_server; 185 public String mail_administrator; 186 public String mail_from; 187 public int mail_paranoia; 188 189 private DtdEntityResolver mResolver; 190 protected Properties mimeTypes; 191 192 private boolean jmxHTTPAdaptorActivated = false; 193 private boolean jmxXSLProcessorActivated = false; 194 private boolean jmxRMIAdaptorActivated = false; 195 196 private String jmxHTTPHostname = null; 197 private int jmxHTTPPort = 8082; 198 private String jmxHTTPAutorizationMode = null; 199 private String jmxHTTPAuthorizationUser = null; 200 private String jmxHTTPAuthorizationPassword = null; 201 private String jmxHTTPProcessorNameString = null; 202 private String jmxHTTPSocketFactoryNameString = null; 203 private boolean jmxRMISSLServerSocketFactoryActivated = false; 204 private String jmxRMISSLServerSocketFactoryKeyStoreName = null; 205 private String jmxRMISSLServerSocketFactoryKeyStorePassword = null; 206 private String jmxRMISSLServerSocketFactoryKeyManagerPassword = null; 207 private String defaultResponseBodyEncoding; 208 private String defaultURIEncoding; 209 private int preloadCountForPageProperties; 210 private boolean jmxActivated; 211 private int cookieAuthIDLength; 212 private String cookieAuthUserPropertyName; 213 private String cookieAuthCookieName; 214 private int cookieAuthMaxAgeInSeconds; 215 private boolean cookieAuthRenewalActivated; 216 private String authPipelineFileName; 217 private String authPipelineClassName; 218 private boolean cookieAuthActivated; 219 private String slideContentDiskPath; 220 private String tmpContentDiskPath; 221 private long templatesObserverInterval; 222 private long webAppsObserverInterval; 223 private String schedulerConfigFile; 224 private String siteServerNameTestURLExpr; 225 private int siteServerNameTestConnectTimeout; 226 227 private boolean pageCounterIncrementActivated = true; 228 private boolean preloadHomepageFieldsActivated = true; 229 230 private int maxParallelProcessings = 10; 232 private long pageGenerationWaitTime = 1800000; 234 242 public SettingsBean (PathResolver aPathResolver, 243 String propertiesFilename, 244 String licenseFilename, 245 int aBuildNumber) { 246 this.pathResolver = aPathResolver; 249 SettingsBean.propertiesFileName = propertiesFilename; 250 this.buildNumber = aBuildNumber; 251 mLicenseFilename = licenseFilename; 252 253 } 255 256 261 public static Properties readJahiaPropertiesFile () { 262 PropertiesManager propertiesManager = new PropertiesManager (propertiesFileName); 263 return propertiesManager.getPropertiesObject (); 264 } 266 267 271 public void load () { 272 PropertiesManager propertiesManager = new PropertiesManager (propertiesFileName); 273 properties = propertiesManager.getPropertiesObject (); 274 275 try { 277 server = getString("server"); 279 serverHomeDiskPath = getString("serverHomeDiskPath"); 280 jahiaTemplatesDiskPath = pathResolver.resolvePath (getString("jahiaTemplatesDiskPath")); 281 jahiaHtmlEditorsDiskPath = pathResolver.resolvePath (getString("jahiaHtmlEditorsDiskPath")); 282 jahiaJspDiskPath = pathResolver.resolvePath (getString("jahiaJspDiskPath")); 283 jahiaEnginesDiskPath = pathResolver.resolvePath (getString("jahiaEnginesDiskPath")); 284 jahiaJavaScriptDiskPath = pathResolver.resolvePath (getString("jahiaJavaScriptDiskPath")); 285 classDiskPath = pathResolver.resolvePath (getString("classDiskPath")); 286 componentsDiskPath = pathResolver.resolvePath (getString("componentsDiskPath")); 287 jahiaFilesDiskPath = JahiaTools.convertContexted (getString("jahiaFilesDiskPath"), pathResolver); 288 jahiaEtcDiskPath = JahiaTools.convertContexted (getString("jahiaEtcDiskPath"), pathResolver); 289 jahiaVarDiskPath = JahiaTools.convertContexted (getString("jahiaVarDiskPath"), pathResolver); 290 jahiaFilesBigTextDiskPath = JahiaTools.convertContexted (getString("jahiaFilesBigTextDiskPath"), pathResolver); 291 slideContentDiskPath = JahiaTools.convertContexted (getString("slideContentDiskPath"), pathResolver); 292 tmpContentDiskPath = JahiaTools.convertContexted (getString("tmpContentDiskPath"), pathResolver); 293 jahiaFilesTemplatesDiskPath = JahiaTools.convertContexted (getString("jahiaFilesTemplatesDiskPath"), pathResolver); 294 jahiaLdapDiskPath = JahiaTools.convertContexted (getString("jahiaLdapDiskPath"), pathResolver); 295 jahiaCasDiskPath = JahiaTools.convertContexted (getString("jahiaCasDiskPath"), pathResolver); 296 jahiaNewTemplatesDiskPath = JahiaTools.convertContexted (getString("jahiaNewTemplatesDiskPath"), pathResolver); 297 jahiaNewWebAppsDiskPath = JahiaTools.convertContexted (getString("jahiaNewWebAppsDiskPath"), pathResolver); 298 jahiaSharedComponentsDiskPath = JahiaTools.convertContexted (getString("jahiaSharedComponentsDiskPath"), pathResolver); 299 jahiaSharedTemplatesDiskPath = JahiaTools.convertContexted (getString("jahiaSharedTemplatesDiskPath"), pathResolver); 300 jahiaOutputCacheConfigDiskPath = JahiaTools.convertContexted (getString("jahiaOutputCacheConfigDiskPath"), pathResolver); 301 302 jahiaHostHttpPath = getString("jahiaHostHttpPath"); 303 jahiaCoreHttpPath = getString("jahiaCoreHttpPath"); 304 jahiaTemplatesHttpPath = getString("jahiaTemplatesHttpPath"); 305 jahiaEnginesHttpPath = getString("jahiaEnginesHttpPath"); 306 jahiaJavaScriptHttpPath = getString("jahiaJavaScriptHttpPath"); 307 jspContext = getString("jahiaJspDiskPath"); 308 templatesContext = getString("jahiaTemplatesDiskPath"); 309 htmlEditorsContext = getString("jahiaHtmlEditorsDiskPath"); 310 enginesContext = getString("jahiaEnginesDiskPath"); 311 javascriptContext = getString("jahiaJavaScriptDiskPath"); 312 313 File jahiaContextFolder = new File (pathResolver.resolvePath("." + File.separator)); 315 File parent = jahiaContextFolder.getAbsoluteFile().getParentFile (); 316 317 if (server.indexOf (JahiaConstants.SERVER_TOMCAT4_BETA1) != -1) { jahiaHomeDiskPath = jahiaContextFolder.getAbsolutePath (); 319 jahiaWebAppsDiskPath = parent.getAbsolutePath () + File.separator; 320 } else if (server.indexOf (JahiaConstants.SERVER_TOMCAT) != -1) { jahiaHomeDiskPath = parent.getAbsolutePath (); 322 jahiaWebAppsDiskPath = parent.getParentFile ().getAbsolutePath () + File.separator; 323 330 } else if (server.equals (JahiaConstants.SERVER_ORION)) { jahiaHomeDiskPath = jahiaContextFolder.getAbsolutePath (); 332 jahiaWebAppsDiskPath = serverHomeDiskPath + "applications" + File.separator; 333 } else { 334 jahiaHomeDiskPath = jahiaContextFolder.getAbsolutePath (); 335 jahiaWebAppsDiskPath = jahiaContextFolder.getAbsolutePath (); 336 } 337 338 String webappAutoDeploy = getString("jahiaWebAppsAutoDeploy"); 340 String templateAutoDeploy = getString("jahiaTemplatesAutoDeploy"); 341 if (webappAutoDeploy != null) { 342 jahiaWebAppsAutoDeploy = Integer.parseInt (webappAutoDeploy); 343 } 344 if (templateAutoDeploy != null) { 345 jahiaTemplatesAutoDeploy = Integer.parseInt (templateAutoDeploy); 346 } 347 templatesObserverInterval = getLong("templates.observer.interval", 5000); 348 webAppsObserverInterval = getLong("webapps.observer.interval", 5000); 349 350 jahiaFileRepositoryDiskPath = JahiaTools.convertContexted (getString("jahiaFileRepositoryDiskPath"), pathResolver); 352 jahiaFileUploadMaxSize = Integer.parseInt (getString("jahiaFileUploadMaxSize")); 353 354 db_driver = getString ("db_driver"); 356 db_url = getString ("db_url"); 357 db_username = getString ("db_username"); 358 db_password = getString ("db_password"); 359 db_transactions = getBoolean("db_transactions", false); 360 db_poolPreparedStatements = getBoolean("db_poolPreparedStatements", true); 361 db_maxOpenPreparedStatements = getInt("db_maxOpenPreparedStatements", 0); 362 db_min_connections = getInt("db_min_connections"); 363 db_max_connections = getInt("db_max_connections"); 364 db_waitIfBusy = getBoolean ("db_waitIfBusy"); 365 db_verbose = getBoolean ("db_verbose"); 366 db_veryVerbose = getBoolean("db_veryVerbose", false); 367 db_support_embedded_select_statement = getBoolean("db_support_embedded_select_statement", false); 368 369 utf8Encoding = getBoolean("utf8Encoding"); 371 defaultResponseBodyEncoding = getString("defaultResponseBodyEncoding", "ISO-8859-1"); 372 defaultURIEncoding = getString("defaultURIEncoding", "UTF-8"); 373 374 locksActivated = getBoolean ("locksActivated", true); 376 377 fileLockOnPublication = getBoolean("fileLockOnPublication", true); 379 380 settings.put(OUTPUT_CACHE_ACTIVATED, 382 new Boolean (getBoolean(OUTPUT_CACHE_ACTIVATED, true))); 383 384 maxParallelProcessings = getInt("maxParallelProcessings", maxParallelProcessings); 386 pageGenerationWaitTime = getLong("pageGenerationWaitTime", pageGenerationWaitTime); 387 388 preloadHomepageFieldsActivated = getBoolean(PRELOAD_HOMEPAGE_FIELDS_ACTIVATED, true); 389 390 outputCacheDefaultExpirationDelay = getLong ("outputCacheDefaultExpirationDelay", -1); 392 393 siteIDInURL = getBoolean ("siteIDInURL", false); 395 396 appInheritJahiaSessionAttributes =getBoolean ("webapps.dispatcher.inheritJahiaSessionAttributes", false); 399 400 jahiaWebAppsDeployerBaseURL = getString ("jahiaWebAppsDeployerBaseURL", "http://127.0.0.1:8080"); 402 403 defaultLanguageCode = getString ("org.jahia.multilang.default_language_code", "en"); 405 406 aclPreloadCount = getInt("org.jahia.acl.preload_count", 0 ); 408 409 preloadCountForPageProperties = getInt("org.jahia.pages.properties.preload_count", 2000); 410 411 settings.put (JMS_CACHE_ACTIVATION, 412 new Boolean (getBoolean (JMS_CACHE_ACTIVATION, false))); 413 settings.put (JMS_INITIAL_CONTEXT, getString (JMS_INITIAL_CONTEXT, null)); 414 settings.put (JMS_CONTEXT_PROVIDER_URL, getString (JMS_CONTEXT_PROVIDER_URL, null)); 415 settings.put (JMS_TOPIC_CONNECTION_FACTORY_NAME, 416 getString (JMS_TOPIC_CONNECTION_FACTORY_NAME, null)); 417 settings.put (JMS_TOPIC_NAME, getString (JMS_TOPIC_NAME, null)); 418 settings.put (JMS_MAX_MESSAGES_IN_PACKAGE, new Integer (getInt(JMS_MAX_MESSAGES_IN_PACKAGE, 2000))); 419 settings.put (JMS_SERVER_LOOKUP_SLEEP_TIME, 420 new Long ( 421 getLong (JMS_SERVER_LOOKUP_SLEEP_TIME, 422 JMS_SERVER_LOOKUP_SLEEP_TIME_DEFAULT))); 423 424 mail_server = getString("mail_server"); 426 mail_administrator = getString("mail_administrator"); 427 mail_from = getString("mail_from"); 428 mail_paranoia = 0; 429 430 String getMailParanoia = getString("mail_paranoia"); 432 if (getMailParanoia.equals ("Standard")) { 433 mail_paranoia = JahiaException.CRITICAL_SEVERITY; 434 } else if (getMailParanoia.equals ("Wary")) { 435 mail_paranoia = JahiaException.ERROR_SEVERITY; 436 } else if (getMailParanoia.equals ("Paranoid")) { 437 mail_paranoia = JahiaException.WARNING_SEVERITY; 438 } 439 440 jmxActivated = getBoolean("org.jahia.jmx.activated", false); 441 jmxHTTPAdaptorActivated = getBoolean("org.jahia.jmx.httpAdaptorActivated", false); 442 jmxXSLProcessorActivated = getBoolean("org.jahia.jmx.xslProcessorActivated", false); 443 jmxRMIAdaptorActivated = getBoolean("org.jahia.jmx.rmiAdaptorActivated", false); 444 jmxHTTPHostname = getString("org.jahia.jmx.httpHostName", "localhost"); 445 jmxHTTPPort = getInt("org.jahia.jmx.httpPort", 8082); 446 jmxHTTPAutorizationMode = getString("org.jahia.jmx.httpAuthorizationMode", null); 447 jmxHTTPAuthorizationUser = getString("org.jahia.jmx.httpAuthorizationUser", null); 448 jmxHTTPAuthorizationPassword = getString("org.jahia.jmx.httpAuthorizationPassword", null); 449 jmxHTTPProcessorNameString = getString("org.jahia.jmx.httpProcessorNameString", null); 450 jmxHTTPSocketFactoryNameString = getString("org.jahia.jmx.httpSocketFactoryNameString", null); 451 jmxRMISSLServerSocketFactoryActivated = getBoolean("org.jahia.jmx.rmiSSLServerSocketFactoryActivated", false); 452 jmxRMISSLServerSocketFactoryKeyStoreName = getString("org.jahia.jmx.rmiSSLServerSocketFactoryKeyStoreName", null); 453 jmxRMISSLServerSocketFactoryKeyStorePassword = getString("org.jahia.jmx.rmiSSLServerSocketFactoryKeyStorePassword", null); 454 jmxRMISSLServerSocketFactoryKeyManagerPassword = getString("org.jahia.jmx.rmiSSLServerSocketFactoryKeyManagerPassword", null); 455 456 initDtdEntityResolver (); 458 loadMimeTypes (); 459 460 defaultSite = getString("defautSite"); 461 462 jahiaMaxCachedValues = new Hashtable (); 464 for (Enumeration e = properties.propertyNames (); e.hasMoreElements ();) { 465 String key = (String )e.nextElement (); 466 String lowerKey = key.toLowerCase ().trim (); 467 if (lowerKey.indexOf ("max_cached_") == 0) { 469 String cacheKey = key.trim().substring (11); 470 String value = properties.getProperty (key); 471 if ((cacheKey != null) && (value != null)) { 472 jahiaMaxCachedValues.put (cacheKey, value); 473 } else { 474 logger.debug ("Ignoring cache key : " + key + " because value or key is invalid (value=" + value + ")"); 475 } 476 } 477 } 478 479 transformFilenames = getBoolean("transformFilenames", false); 481 transformDirnames = getBoolean("transformDirnames", true); 482 483 cookieAuthActivated = getBoolean("cookieAuthActivated", true); 484 cookieAuthIDLength = getInt("cookieAuthIDLength", 30); 485 cookieAuthUserPropertyName = getString("cookieAuthUserPropertyName", "org.jahia.user.cookieauth.id"); 486 cookieAuthCookieName = getString("cookieAuthCookieName", "jid"); 487 cookieAuthMaxAgeInSeconds = getInt("cookieAuthMaxAgeInSeconds", 60*60*24*30 ); 488 cookieAuthRenewalActivated = getBoolean("cookieAuthRenewalActivated", true); 489 490 authPipelineFileName = getString("authPipelineFileName", "/WEB-INF/etc/config/auth-pipeline.xml"); 491 authPipelineClassName = getString("authPipelineClassName", "org.jahia.pipelines.impl.GenericPipeline"); 492 493 schedulerConfigFile = JahiaTools.convertContexted (getString("schedulerConfigFile", "$context/WEB-INF/etc/config/quartz.properties"), pathResolver); 494 495 siteServerNameTestURLExpr = getString("siteServerNameTestURLExpr", "${request.scheme}://${siteServerName}:${request.serverPort}${request.contextPath}/jsp/isjahia.jsp"); 496 siteServerNameTestConnectTimeout = getInt("siteServerNameTestConnectTimeout", 500); 497 498 pageCounterIncrementActivated = getBoolean("pageCounterIncrementActivated", true); 499 500 } catch (NullPointerException npe) { 501 logger.debug ("Properties file is not valid...!", npe); 502 } catch (NumberFormatException nfe) { 503 logger.debug ("Properties file is not valid...!", nfe); 504 } 505 } 507 508 private boolean getBoolean (String propertyName) 509 throws NoSuchElementException { 510 boolean result = false; 511 String curProperty = properties.getProperty(propertyName); 512 if (curProperty != null) { 513 curProperty = curProperty.trim(); 514 if (!"".equals(curProperty)) { 515 result = new Boolean (curProperty).booleanValue(); 516 return result; 517 } else { 518 throw new NoSuchElementException ("Boolean property : " + 519 propertyName + " is empty!"); 520 } 521 } else { 522 throw new NoSuchElementException ("No boolean found for property : " + 523 propertyName); 524 } 525 } 526 527 private boolean getBoolean (String propertyName, boolean defaultValue) { 528 try { 529 return getBoolean(propertyName); 530 } catch (NoSuchElementException nsee) { 531 return defaultValue; 532 } 533 } 534 535 private String getString (String propertyName) 536 throws NoSuchElementException { 537 String result = null; 538 String curProperty = properties.getProperty(propertyName); 539 if (curProperty != null) { 540 result = curProperty.trim(); 541 return result; 542 } else { 543 throw new NoSuchElementException ("No String found for property : " + 544 propertyName); 545 } 546 } 547 548 private String getString (String propertyName, String defaultValue) { 549 try { 550 return getString(propertyName); 551 } catch (NoSuchElementException nsee) { 552 return defaultValue; 553 } 554 } 555 556 private int getInt (String propertyName) 557 throws NoSuchElementException { 558 int result = -1; 559 String curProperty = properties.getProperty(propertyName); 560 if (curProperty != null) { 561 curProperty = curProperty.trim(); 562 result = Integer.parseInt(curProperty); 563 return result; 564 } else { 565 throw new NoSuchElementException ("No int found for property : " + 566 propertyName); 567 } 568 } 569 570 private int getInt (String propertyName, int defaultValue) { 571 try { 572 return getInt(propertyName); 573 } catch (NoSuchElementException nsee) { 574 return defaultValue; 575 } 576 } 577 578 private long getLong (String propertyName) 579 throws NoSuchElementException { 580 long result = -1; 581 String curProperty = properties.getProperty(propertyName); 582 if (curProperty != null) { 583 curProperty = curProperty.trim(); 584 result = Long.parseLong(curProperty); 585 return result; 586 } else { 587 throw new NoSuchElementException ("No long found for property : " + 588 propertyName); 589 } 590 } 591 592 private long getLong (String propertyName, long defaultValue) { 593 try { 594 return getLong(propertyName); 595 } catch (NoSuchElementException nsee) { 596 return defaultValue; 597 } 598 } 599 600 606 public String lookupString (String key) { 607 Object param = settings.get (key); 608 if (param instanceof String ) 609 return (String ) param; 610 return null; 611 } 612 613 614 620 public boolean lookupBoolean (String key) { 621 Object param = settings.get (key); 622 if (param instanceof Boolean ) 623 return ((Boolean ) param).booleanValue (); 624 return false; 625 } 626 627 628 634 public long lookupLong (String key) { 635 Object param = settings.get (key); 636 if (param instanceof Long ) 637 return ((Long ) param).longValue (); 638 return Long.MIN_VALUE; 639 } 640 641 642 648 public int lookupInt (String key) { 649 Object param = settings.get (key); 650 if (param instanceof Integer ) 651 return ((Integer ) param).intValue (); 652 return Integer.MIN_VALUE; 653 } 654 655 660 public Properties getPropertiesFile () { 661 return this.properties; 662 } 664 665 public String getLicenseFileName () { 667 return mLicenseFilename; 668 } 669 670 675 public void setJahiaCoreHttpPath (String value) { 676 jahiaCoreHttpPath = value; 677 } 678 679 public void setSiteServerNameTestURLExpr (String aSiteServerNameTestURLExpr) { 680 681 this.siteServerNameTestURLExpr = aSiteServerNameTestURLExpr; 682 } 683 684 public void setSiteServerNameTestConnectTimeout (int 685 aSiteServerNameTestConnectTimeout) { 686 this.siteServerNameTestConnectTimeout = 687 aSiteServerNameTestConnectTimeout; 688 } 689 690 703 private void loadMimeTypes () { 704 705 String filepath = pathResolver.resolvePath ("/WEB-INF/web.xml"); 706 File f = new File (filepath); 707 if (f.exists () && f.canRead ()) { 708 try { 709 MimeTypesFromWebAppXmlFile mtHandler 710 = new MimeTypesFromWebAppXmlFile (f.getAbsolutePath (), mResolver); 711 712 mimeTypes = mtHandler.getMimeTypes (); 713 } catch (Exception t) { 714 t.printStackTrace (); 715 } 716 } 717 if (mimeTypes == null) 718 mimeTypes = new Properties (); 719 720 } 721 722 726 private void initDtdEntityResolver () { 727 728 mResolver = new DtdEntityResolver (); 729 String diskPath = this.jahiaEtcDiskPath + File.separator; 730 731 File resourceFile = new File (diskPath + JahiaConstants.WEB_DTD_RESOURCE_PATH_22); 734 logger.debug ("Registering resource file : " + resourceFile.toString ()); 735 mResolver.registerDTD (JahiaConstants.WEB_DTD_PUBLICID_22, resourceFile.toString ()); 736 737 resourceFile = new File (diskPath + JahiaConstants.WEB_DTD_RESOURCE_PATH_23); 739 mResolver.registerDTD (JahiaConstants.WEB_DTD_PUBLICID_23, resourceFile.toString ()); 740 741 resourceFile = new File (diskPath + JahiaConstants.J2EE_APP_DTD_RESOURCE_PATH_12); 743 mResolver.registerDTD (JahiaConstants.J2EE_APP_DTD_PUBLICID_12, resourceFile.toString ()); 744 745 resourceFile = new File (diskPath + JahiaConstants.ORION_APP_SERVER_DTD_RESOURCE_PATH); 747 mResolver.registerDTD (JahiaConstants.ORION_APP_SERVER_DTD_PUBLICID, resourceFile.toString ()); 748 749 resourceFile = new File (diskPath + JahiaConstants.ORION_WEB_SITE_DTD_RESOURCE_PATH); 751 mResolver.registerDTD (JahiaConstants.ORION_WEB_SITE_DTD_PUBLICID, resourceFile.toString ()); 752 753 } 754 755 761 public Properties getMimeTypes () { 762 return mimeTypes; 763 } 764 765 771 public EntityResolver getDtdEntityResolver () { 772 return mResolver; 773 } 774 775 780 public boolean isUtf8Encoding () { 781 return utf8Encoding; 782 } 783 784 789 public boolean areLocksActivated () { 790 return locksActivated; 791 } 792 793 798 public boolean isFileLockOnPublication() { 799 return fileLockOnPublication; 800 } 801 802 806 public long getOutputCacheDefaultExpirationDelay () { 807 return outputCacheDefaultExpirationDelay; 808 } 809 810 814 public boolean isSiteIDInURL () { 815 return siteIDInURL; 816 } 817 818 public boolean isAppInheritingJahiaSessionAttributes () { 819 return appInheritJahiaSessionAttributes; 820 } 821 822 823 public String getJahiaWebAppsDeployerBaseURL () { 824 return jahiaWebAppsDeployerBaseURL; 825 } 826 827 public String getDefaultLanguageCode () { 828 return defaultLanguageCode; 829 } 830 831 public int getAclPreloadCount () { 832 return aclPreloadCount; 833 } 834 835 840 public int getBuildNumber() { 841 return buildNumber; 842 } 844 849 public String getServer() { 850 return server; 851 } 853 858 public String getServerHomeDiskPath() { 859 return serverHomeDiskPath; 860 } 862 867 public String getJahiaWebAppsDiskPath() { 868 return jahiaWebAppsDiskPath; 869 } 871 876 public String getJahiaTemplatesDiskPath() { 877 return jahiaTemplatesDiskPath; 878 } 880 884 public String getJahiaHtmlEditorsDiskPath() { 885 return this.jahiaHtmlEditorsDiskPath; 886 } 887 888 893 public String getJahiaEnginesDiskPath() { 894 return jahiaEnginesDiskPath; 895 } 897 903 904 909 910 915 public String getJahiaEtcDiskPath() { 916 return jahiaEtcDiskPath; 917 } 918 919 924 public String getJahiaVarDiskPath() { 925 return jahiaVarDiskPath; 926 } 927 928 929 934 public String getJahiaFilesDataDiskPath() { 935 return jahiaFilesBigTextDiskPath; 936 } 938 943 public String getJahiaFilesTemplatesDiskPath() { 944 return jahiaFilesTemplatesDiskPath; 945 } 947 952 public String getJahiaLdapDiskPath() { 953 return jahiaLdapDiskPath; 954 } 956 961 public String getJahiaCasDiskPath() { 962 return jahiaCasDiskPath; 963 } 965 970 971 public String getJahiaOutputCacheConfigDiskPath() { 972 return jahiaOutputCacheConfigDiskPath; 973 } 974 975 980 public String getJahiaNewTemplatesDiskPath() { 981 return jahiaNewTemplatesDiskPath; 982 } 984 985 990 public String getJahiaSharedComponentsDiskPath() { 991 return jahiaSharedComponentsDiskPath; 992 } 993 994 995 1000 public String getJahiaSharedTemplatesDiskPath() { 1001 return jahiaSharedTemplatesDiskPath; 1002 } 1003 1004 1005 1010 public String getComponentsDiskPath() { 1011 return componentsDiskPath; 1012 } 1014 1019 public String getJahiaCoreHttpPath() { 1020 return jahiaCoreHttpPath; 1021 } 1023 1028 public String getJahiaTemplatesHttpPath() { 1029 return jahiaTemplatesHttpPath; 1030 } 1032 1037 public String getJahiaEnginesHttpPath() { 1038 return jahiaEnginesHttpPath; 1039 } 1041 1046 public String getJsHttpPath() { 1047 return jahiaJavaScriptHttpPath; 1048 } 1050 1055 public String getJspContext() { 1056 return jspContext; 1057 } 1059 1064 public String getHtmlEditorsContext() { 1065 return this.htmlEditorsContext; 1066 } 1067 1068 1073 public String getTemplatesContext() { 1074 return templatesContext; 1075 } 1077 1082 public String getEnginesContext() { 1083 return enginesContext; 1084 } 1086 1091 public String getJavascriptContext() { 1092 return javascriptContext; 1093 } 1095 1100 public int getJahiaWebAppsAutoDeploy() { 1101 return jahiaWebAppsAutoDeploy; 1102 } 1104 1109 public int getJahiaTemplatesAutoDeploy() { 1110 return jahiaTemplatesAutoDeploy; 1111 } 1112 1113 1121 public String getDb_driver() { 1122 return db_driver; 1123 } 1124 public int getDb_max_connections() { 1125 return db_max_connections; 1126 } 1127 public int getDb_min_connections() { 1128 return db_min_connections; 1129 } 1130 public int getDb_maxOpenPreparedStatements() { 1131 return db_maxOpenPreparedStatements; 1132 } 1133 public String getDb_password() { 1134 return db_password; 1135 } 1136 public boolean isDb_transactions() { 1137 return db_transactions; 1138 } 1139 public boolean isDb_poolPreparedStatements() { 1140 return db_poolPreparedStatements; 1141 } 1142 public String getDb_url() { 1143 return db_url; 1144 } 1145 public String getDb_username() { 1146 return db_username; 1147 } 1148 public boolean isDb_verbose() { 1149 return db_verbose; 1150 } 1151 public boolean isDb_veryVerbose() { 1152 return db_veryVerbose; 1153 } 1154 public boolean isDb_waitIfBusy() { 1155 return db_waitIfBusy; 1156 } 1157 1158 public boolean isDb_support_embedded_select_statement() { 1159 return db_support_embedded_select_statement; 1160 } 1161 1162 public String getClassDiskPath() { 1163 return classDiskPath; 1164 } 1165 public String getJahiaFileRepositoryDiskPath() { 1166 return jahiaFileRepositoryDiskPath; 1167 } 1168 public String getJahiaFilesBigTextDiskPath() { 1169 return jahiaFilesBigTextDiskPath; 1170 } 1171 public String getJahiaFilesDiskPath() { 1172 return jahiaFilesDiskPath; 1173 } 1174 public int getJahiaFileUploadMaxSize() { 1175 return jahiaFileUploadMaxSize; 1176 } 1177 public String getJahiaHomeDiskPath() { 1178 return jahiaHomeDiskPath; 1179 } 1180 public String getJahiaHostHttpPath() { 1181 return jahiaHostHttpPath; 1182 } 1183 public String getJahiaJavaScriptDiskPath() { 1184 return jahiaJavaScriptDiskPath; 1185 } 1186 public String getJahiaJavaScriptHttpPath() { 1187 return jahiaJavaScriptHttpPath; 1188 } 1189 public String getJahiaJspDiskPath() { 1190 return jahiaJspDiskPath; 1191 } 1192 public Hashtable getJahiaMaxCachedValues() { 1193 return jahiaMaxCachedValues; 1194 } 1195 public String getJahiaNewWebAppsDiskPath() { 1196 return jahiaNewWebAppsDiskPath; 1197 } 1198 public boolean isLocksActivated() { 1199 return locksActivated; 1200 } 1201 public String getMail_administrator() { 1202 return mail_administrator; 1203 } 1204 public String getMail_from() { 1205 return mail_from; 1206 } 1207 public int getMail_paranoia() { 1208 return mail_paranoia; 1209 } 1210 public String getMail_server() { 1211 return mail_server; 1212 } 1213 public String getMLicenseFilename() { 1214 return mLicenseFilename; 1215 } 1216 public boolean isJmxActivated() { 1217 return jmxActivated; 1218 } 1219 public boolean isJmxHTTPAdaptorActivated() { 1220 return jmxHTTPAdaptorActivated; 1221 } 1222 public String getJmxHTTPAuthorizationPassword() { 1223 return jmxHTTPAuthorizationPassword; 1224 } 1225 public String getJmxHTTPAuthorizationUser() { 1226 return jmxHTTPAuthorizationUser; 1227 } 1228 public String getJmxHTTPAutorizationMode() { 1229 return jmxHTTPAutorizationMode; 1230 } 1231 public String getJmxHTTPHostname() { 1232 return jmxHTTPHostname; 1233 } 1234 public int getJmxHTTPPort() { 1235 return jmxHTTPPort; 1236 } 1237 public String getJmxHTTPProcessorNameString() { 1238 return jmxHTTPProcessorNameString; 1239 } 1240 public String getJmxHTTPSocketFactoryNameString() { 1241 return jmxHTTPSocketFactoryNameString; 1242 } 1243 public boolean isJmxRMIAdaptorActivated() { 1244 return jmxRMIAdaptorActivated; 1245 } 1246 public boolean isJmxXSLProcessorActivated() { 1247 return jmxXSLProcessorActivated; 1248 } 1249 public boolean isJmxRMISSLServerSocketFactoryActivated() { 1250 return jmxRMISSLServerSocketFactoryActivated; 1251 } 1252 public String getJmxRMISSLServerSocketFactoryKeyStoreName() { 1253 return jmxRMISSLServerSocketFactoryKeyStoreName; 1254 } 1255 public String getJmxRMISSLServerSocketFactoryKeyStorePassword() { 1256 return jmxRMISSLServerSocketFactoryKeyStorePassword; 1257 } 1258 public String getJmxRMISSLServerSocketFactoryKeyManagerPassword() { 1259 return jmxRMISSLServerSocketFactoryKeyManagerPassword; 1260 } 1261 1262 public String getDefaultResponseBodyEncoding() { 1263 return defaultResponseBodyEncoding; 1264 } 1265 public String getDefaultURIEncoding() { 1266 return defaultURIEncoding; 1267 } 1268 public String getDefaultSite() { 1269 return defaultSite; 1270 } 1271 public int getPreloadCountForPageProperties() { 1272 return preloadCountForPageProperties; 1273 } 1274 1275 public boolean isTransformFilenames() { 1276 return transformFilenames; 1277 } 1278 1279 public boolean isTransformDirnames() { 1280 return transformDirnames; 1281 } 1282 public int getCookieAuthIDLength() { 1283 return cookieAuthIDLength; 1284 } 1285 public String getCookieAuthUserPropertyName() { 1286 return cookieAuthUserPropertyName; 1287 } 1288 public String getCookieAuthCookieName() { 1289 return cookieAuthCookieName; 1290 } 1291 public int getCookieAuthMaxAgeInSeconds() { 1292 return cookieAuthMaxAgeInSeconds; 1293 } 1294 public boolean isCookieAuthRenewalActivated() { 1295 return cookieAuthRenewalActivated; 1296 } 1297 public String getAuthPipelineFileName() { 1298 return authPipelineFileName; 1299 } 1300 public String getAuthPipelineClassName() { 1301 return authPipelineClassName; 1302 } 1303 public PathResolver getPathResolver() { 1304 return pathResolver; 1305 } 1306 public boolean isCookieAuthActivated() { 1307 return cookieAuthActivated; 1308 } 1309 public String getSlideContentDiskPath() { 1310 return slideContentDiskPath; 1311 } 1312 public String getTmpContentDiskPath() { 1313 return tmpContentDiskPath; 1314 } 1315 public long getTemplatesObserverInterval() { 1316 return templatesObserverInterval; 1317 } 1318 public long getWebAppsObserverInterval() { 1319 return webAppsObserverInterval; 1320 } 1321 public String getSchedulerConfigFile() { 1322 return schedulerConfigFile; 1323 } 1324 1325 public String getSiteServerNameTestURLExpr () { 1326 1327 return siteServerNameTestURLExpr; 1328 } 1329 1330 public int getSiteServerNameTestConnectTimeout () { 1331 return siteServerNameTestConnectTimeout; 1332 } 1333 1334 public boolean isPageCounterIncrementActivated() { 1335 return pageCounterIncrementActivated; 1336 } 1337 1338 1339 public boolean isPreloadHomepageFieldsActivated() { 1340 return preloadHomepageFieldsActivated; 1341 } 1342 1343 public long getPageGenerationWaitTime() { 1344 return pageGenerationWaitTime; 1345 } 1346 1347 public int getMaxParallelProcessings() { 1348 return maxParallelProcessings; 1349 } 1350 1351} 1352 | Popular Tags |