org.apache.jetspeed.services.resources
Class JetspeedResourceService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.turbine.services.resources.TurbineResourceService
                  extended byorg.apache.jetspeed.services.resources.JetspeedResourceService
All Implemented Interfaces:
org.apache.turbine.services.Initable, org.apache.turbine.services.resources.ResourceService, org.apache.turbine.services.Service

public class JetspeedResourceService
extends org.apache.turbine.services.resources.TurbineResourceService

This service subclasses TurbineResourceService and provides functionality for overriding properties in default resource files. This override behavior is extended to non-string properties

To override properties:

Important note on overriding services.Order of initializing services may be important. Overriding a service may change this order. It is important that services attempt to initialize dependent services in their early init methods. For example, to make sure that ServletService is running, invoke the following code:

 TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);
 

Also, ${variable} substitution is extended to non-string properties. For example, the following property references are valid:

 confRoot=/WEB-INF/conf
 
 psmlMapFile=${confRoot}/psml-mapping.xml
 registryMapFile=${confRoot}/registry-mapping.xml
 
 defaultRefresh=60
 
 registryRefresh=${defaultRefresh}
 psmlRefresh=${defaultRefresh}
 

Version:
$Id: JetspeedResourceService.java,v 1.8 2004/02/23 03:29:53 jford Exp $
Author:
Mark Orciuch, David Sean Taylor

Field Summary
 
Fields inherited from class org.apache.turbine.services.BaseService
name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.resources.ResourceService
SERVICE_NAME
 
Constructor Summary
JetspeedResourceService()
           
 
Method Summary
 boolean getBoolean(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a boolean value.
 boolean getBoolean(java.lang.String name, boolean def)
          The purppose of this method is to get the configuration resource with the given name as a boolean value, or a default value.
 double getDouble(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a double.
 double getDouble(java.lang.String name, double def)
          The purpose of this method is to get the configuration resource with the given name as a double, or a default value.
 float getFloat(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a float.
 float getFloat(java.lang.String name, float def)
          The purpose of this method is to get the configuration resource with the given name as a float, or a default value.
 int getInt(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as an integer.
 int getInt(java.lang.String name, int def)
          The purpose of this method is to get the configuration resource with the given name as an integer, or a default value.
 long getLong(java.lang.String name)
          The purpose of this method is to get the configuration resource with the given name as a long.
 long getLong(java.lang.String name, long def)
          The purpose of this method is to get the configuration resource with the given name as a long, or a default value.
 org.apache.turbine.services.resources.ResourceService getResources(java.lang.String prefix)
          The purpose of this method is to extract a subset of configuraton resources sharing a common name prefix.
 void init()
          This method is called when the Service is initialized It provides a way to override properties at runtime.
 void init(javax.servlet.ServletConfig config)
           
protected  java.lang.String makeFileNamePath(java.lang.String propsDir, java.lang.String fileName)
           
 
Methods inherited from class org.apache.turbine.services.resources.TurbineResourceService
getConfiguration, getConfiguration, getKeys, getKeys, getString, getString, getStringArray, getVector, getVector, init, interpolate, setProperties, setPropertiesFileName, setProperty
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, setInitableBroker, shutdown
 

Constructor Detail

JetspeedResourceService

public JetspeedResourceService()
Method Detail

getBoolean

public boolean getBoolean(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a boolean value.

Parameters:
name - The resource name.
Returns:
The value of the named resource as a boolean.

getBoolean

public boolean getBoolean(java.lang.String name,
                          boolean def)
The purppose of this method is to get the configuration resource with the given name as a boolean value, or a default value.

Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the named resource as a boolean.

getDouble

public double getDouble(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a double.

Parameters:
name - The resoource name.
Returns:
The value of the named resource as double.

getDouble

public double getDouble(java.lang.String name,
                        double def)
The purpose of this method is to get the configuration resource with the given name as a double, or a default value.

Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the named resource as a double.

getFloat

public float getFloat(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a float.

Parameters:
name - The resource name.
Returns:
The value of the resource as a float.

getFloat

public float getFloat(java.lang.String name,
                      float def)
The purpose of this method is to get the configuration resource with the given name as a float, or a default value.

Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as a float.

getInt

public int getInt(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as an integer.

Parameters:
name - The resource name.
Returns:
The value of the resource as an integer.

getInt

public int getInt(java.lang.String name,
                  int def)
The purpose of this method is to get the configuration resource with the given name as an integer, or a default value.

Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as an integer.

getLong

public long getLong(java.lang.String name)
The purpose of this method is to get the configuration resource with the given name as a long.

Parameters:
name - The resource name.
Returns:
The value of the resource as a long.

getLong

public long getLong(java.lang.String name,
                    long def)
The purpose of this method is to get the configuration resource with the given name as a long, or a default value.

Parameters:
name - The resource name.
def - The default value of the resource.
Returns:
The value of the resource as a long.

getResources

public org.apache.turbine.services.resources.ResourceService getResources(java.lang.String prefix)
The purpose of this method is to extract a subset of configuraton resources sharing a common name prefix. The prefix is stripped from the names of the resulting resources.

Parameters:
prefix - the common name prefix
Returns:
A ResourceService providing the subset of configuration.

init

public void init()
          throws org.apache.turbine.services.InitializationException
This method is called when the Service is initialized It provides a way to override properties at runtime. To use 'runtime' time properties, define a directory where you are keeping your 'runtime' parameters and pass it in as a System Property named 'jetspeed.conf.dir' This implementation will take the name of the web application (i.e. 'jetspeed') and use it to find the name of a properties file. These properties are merged with the TurbineResources/JetspeedResources.properties Similarly, you can override Torque properties by naming a file in your runtime directory as ${webapp.name}_Torque.properties Examples: jetspeed.conf.dir = /Users/sysadmin/conf This directory contains two files: 1. jetspeed.properties - overrides properties in JetspeedResources.properties and TurbineResources.properties 2. jetspeed_torque.properties - overrides properties in Torque.properties

Throws:
org.apache.turbine.services.InitializationException

init

public void init(javax.servlet.ServletConfig config)
          throws org.apache.turbine.services.InitializationException
Throws:
org.apache.turbine.services.InitializationException

makeFileNamePath

protected java.lang.String makeFileNamePath(java.lang.String propsDir,
                                            java.lang.String fileName)


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.