Any site specific property settings may be placed in a custom property file (see /WEB-INF/conf/my.properties for an example). Using a custom property file makes future Jetspeed upgrades easier because the default property files remain unchanged. This feature was added in version 1.4b2.
In order to use this feature, first create a custom property file. In the example below, "out-of-the-box" settings are overriden as follows: default logging is set to "debug", registry is refreshed every minute, portlet logging service is activated, customizer portlet preview is enabled, automatic logon is enabled and passwords expire every 90 days.
# ################################################################### # # T u r b i n e R e s o u r c e s . p r o p e r t i e s : # # ################################################################### # ------------------------------------------------------------------- # # L O G S # # ------------------------------------------------------------------- # # To override the turbine logging settings, you will need to set the 'logging' init # parameter in web.xml to 'org.apache.jetspeed.services.logging.JetspeedLoggingService' # services.LoggingService.facilities = debug,logforj,access services.LoggingService.default = debug # ------------------------------------------------------------------- # # S E R V I C E S # # ------------------------------------------------------------------- services.ResourceService.classname = org.apache.jetspeed.services.resources.JetspeedResourceService # ################################################################### # # J e t s p e e d R e s o u r c e s . p r o p e r t i e s : # # ################################################################### ######################################### # Registry Service # ######################################### services.Registry.refreshRate = 60 ######################################### # Portlet Usage Service # ######################################### services.PortletStats.enabled = true ######################################### # Customization # ######################################### customizer.preview.enable = true ######################################### # New User Registration mail support # ######################################### automatic.logon.enable = true # ################################################################### # # J e t s p e e d S e c u r i t y . p r o p e r t i e s : # # ################################################################### services.JetspeedSecurity.password.expiration.period = 90 # ------------------------------------------------------------------- # # A D D I T I O N A L P R O P E R T I E S # # ------------------------------------------------------------------- # The full path name to an additional properties file. Properties in # this file will be included in this property set. Duplicate name # values will be replaced, so be careful. # # Default: none # ------------------------------------------------------------------- include = TurbineResources.properties
Note that there are two required entries in custom property file:
services.ResourceService.classname = org.apache.jetspeed.services.resources.JetspeedResourceService include = TurbineResources.properties
The first one makes JetspeedResourceService as the ResourceService which makes it all possible. The second one includes default properties from TurbineResources.properties.
The web app descriptor must be changed to use your custom property file and JetspeedResourceService:
<web-app> <servlet> <servlet-name> jetspeed </servlet-name> <servlet-class> org.apache.turbine.Turbine </servlet-class> <init-param> <param-name>properties</param-name> <param-value>WEB-INF/conf/my.properties</param-value> </init-param> <init-param> <param-name>resources</param-name> <param-value>org.apache.jetspeed.services.resources.JetspeedResourceService</param-value> </init-param> </servlet> .... </web-app>
You may use ${variable} substitution with any property regardless of data type. For example, the following property references are valid:
confRoot = /WEB-INF/conf ... services.URLManager.url = ${confRoot}/datasources.properties ... services.Registry.mapping=${confRoot}/registry.xml ... defaultRefresh = 60 ... services.Registry.refreshRate = ${defaultRefresh} ... refresh.portlet.default = ${defaultRefresh}
Order of initializing services may be important. Overriding a service may change this order and cause init failures. It is important that services attempt to initialize dependent services in their early init methods. For example, to make sure that ServletService is running, the following code should be invoked:
TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);