org.sakaiproject.component.framework.config
Class BasicConfigurationService

java.lang.Object
  extended byorg.sakaiproject.component.framework.config.BasicConfigurationService
All Implemented Interfaces:
ServerConfigurationService

public class BasicConfigurationService
extends Object
implements ServerConfigurationService

BasicConfigurationService is a basic implementation of the ServerConfigurationService.

Version:
$Revision: 6703 $
Author:
University of Michigan, Sakai Software Development Team

Field Summary
protected  String instanceId
          The instance id for this app server.
protected  Map m_defaultTools
          default tools - map keyed by category of List of tool id strings.
protected  Logger m_logger
          Dependency: logging service
protected  Map m_properties
          The map of values from the loaded properties - not synchronized at access.
protected  Map m_toolOrders
          loaded tool orders - map keyed by category of List of tool id strings.
protected  Map m_toolsRequired
          required tools - map keyed by category of List of tool id strings.
protected  String registrationPath
          Full path to registration files.
protected  String serverIdInstance
          This is computed, joining the configured serverId and the set instanceId.
protected  String toolOrderFile
          File name within sakai.home for the tool order file.
 
Fields inherited from interface org.sakaiproject.service.framework.config.ServerConfigurationService
SERVICE_NAME
 
Constructor Summary
BasicConfigurationService()
           
 
Method Summary
 void destroy()
          Final cleanup.
 String getAccessUrl()
          Access the URL to the access service on the server - append any additional path to the end.
 boolean getBoolean(String name, boolean dflt)
          Access some named configuration value as a boolean.
 List getDefaultTools(String category)
          Access the list of tool ids that are selected by default for this category.
 String getGatewaySiteId()
          Access the site id for the gateway (public) site.
 String getHelpUrl(String helpContext)
          Access the URL to the help service on the server - append in the path the tool well known id for context sensitive help.
 int getInt(String name, int dflt)
          Access some named configuration value as an int.
 List getLocks()
          Access the list of security locks in use on this server.
 String getLoggedOutUrl()
          Access the URL to use as a redirect when the user has logged out.
 String getPortalUrl()
          Access the URL to the portal service on the server - append any additional path to the end.
 String getSakaiHomePath()
          Access the file path to the "sakai home" on the app server.
 String getServerId()
          Access the unique (to the cluster) id of the server.
 String getServerIdInstance()
          Access the combined server / instance id.
 String getServerInstance()
          Access the unique (to the cluster) instance id of the server.
 String getServerName()
          Access the server DNS name.
 String getServerUrl()
          Access the URL to the root of the server - append any additional path to the end.
 String getString(String name)
          Access some named configuration value as a string.
 String getString(String name, String dflt)
          Access some named configuration value as a string.
 String[] getStrings(String name)
          Access some named configuration values as an array of strings. The name is the base name. name + ".count" must be defined to be a positive integer - how many are defined. name + "." + i (1..count) must be defined to be the values.
 List getToolOrder(String category)
          Access the list of tool ids in order for this category, to impose on the displays of many tools
 List getToolsRequired(String category)
          Access the list of tool ids that are required for this category.
 String getUserHomeUrl()
          Access the URL to the user's "home" (My Workspace) in the service.
 void init()
          Final initialization, once all dependencies are set.
protected  void loadToolOrder(InputStream in)
          Load this single file as a registration file, loading tools and locks.
 void setLogger(Logger service)
          Dependency: logging service.
 void setRegistrationPath(String string)
          Configuration: set the file path for registration files.
 void setToolOrderFile(String string)
          Configuration: set the file name within sakai.home for tool order file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instanceId

protected String instanceId
The instance id for this app server.


serverIdInstance

protected String serverIdInstance
This is computed, joining the configured serverId and the set instanceId.


m_properties

protected Map m_properties
The map of values from the loaded properties - not synchronized at access.


registrationPath

protected String registrationPath
Full path to registration files.


toolOrderFile

protected String toolOrderFile
File name within sakai.home for the tool order file.


m_toolOrders

protected Map m_toolOrders
loaded tool orders - map keyed by category of List of tool id strings.


m_toolsRequired

protected Map m_toolsRequired
required tools - map keyed by category of List of tool id strings.


m_defaultTools

protected Map m_defaultTools
default tools - map keyed by category of List of tool id strings.


m_logger

protected Logger m_logger
Dependency: logging service

Constructor Detail

BasicConfigurationService

public BasicConfigurationService()
Method Detail

setLogger

public void setLogger(Logger service)
Dependency: logging service.

Parameters:
service - The logging service.

setRegistrationPath

public void setRegistrationPath(String string)
Configuration: set the file path for registration files.

Parameters:
string - The file path for registration files.

setToolOrderFile

public void setToolOrderFile(String string)
Configuration: set the file name within sakai.home for tool order file.

Parameters:
string - The file name for tool order file.

init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Final cleanup.


getServerId

public String getServerId()
Access the unique (to the cluster) id of the server.

Specified by:
getServerId in interface ServerConfigurationService
Returns:
The unique (to the cluster) id of the server.

getServerInstance

public String getServerInstance()
Access the unique (to the cluster) instance id of the server.

Specified by:
getServerInstance in interface ServerConfigurationService
Returns:
The unique (to the cluster) instance id of the server.

getServerIdInstance

public String getServerIdInstance()
Access the combined server / instance id.

Specified by:
getServerIdInstance in interface ServerConfigurationService
Returns:
The combined server / instance id.

getServerUrl

public String getServerUrl()
Access the URL to the root of the server - append any additional path to the end.

Specified by:
getServerUrl in interface ServerConfigurationService
Returns:
The URL to the root of the server.

getServerName

public String getServerName()
Access the server DNS name.

Specified by:
getServerName in interface ServerConfigurationService
Returns:
The server DNS name.

getAccessUrl

public String getAccessUrl()
Access the URL to the access service on the server - append any additional path to the end.

Specified by:
getAccessUrl in interface ServerConfigurationService
Returns:
The URL to the access service on the server.

getHelpUrl

public String getHelpUrl(String helpContext)
Access the URL to the help service on the server - append in the path the tool well known id for context sensitive help.

Specified by:
getHelpUrl in interface ServerConfigurationService
Parameters:
helpContext - The context string.
Returns:
The URL to the help service on the server.

getPortalUrl

public String getPortalUrl()
Access the URL to the portal service on the server - append any additional path to the end.

Specified by:
getPortalUrl in interface ServerConfigurationService
Returns:
The URL to the portal service on the server.

getUserHomeUrl

public String getUserHomeUrl()
Access the URL to the user's "home" (My Workspace) in the service.

Specified by:
getUserHomeUrl in interface ServerConfigurationService
Returns:
The URL to the user's "home" (My Workspace) in the service.

getGatewaySiteId

public String getGatewaySiteId()
Access the site id for the gateway (public) site.

Specified by:
getGatewaySiteId in interface ServerConfigurationService
Returns:
The site id for the gateway (public) site.

getLoggedOutUrl

public String getLoggedOutUrl()
Access the URL to use as a redirect when the user has logged out.

Specified by:
getLoggedOutUrl in interface ServerConfigurationService
Returns:
The URL to use as a redirect when the user has logged out.

getSakaiHomePath

public String getSakaiHomePath()
Access the file path to the "sakai home" on the app server.

Specified by:
getSakaiHomePath in interface ServerConfigurationService
Returns:
The file path to the "sakai home" on the app server.

getString

public String getString(String name)
Access some named configuration value as a string.

Specified by:
getString in interface ServerConfigurationService
Parameters:
name - The configuration value name.
Returns:
The configuration value with this name, or "" if not found.

getString

public String getString(String name,
                        String dflt)
Access some named configuration value as a string.

Specified by:
getString in interface ServerConfigurationService
Parameters:
name - The configuration value name.
dflt - The value to return if not found.
Returns:
The configuration value with this name, or the default value if not found.

getStrings

public String[] getStrings(String name)
Access some named configuration values as an array of strings. The name is the base name. name + ".count" must be defined to be a positive integer - how many are defined. name + "." + i (1..count) must be defined to be the values.

Specified by:
getStrings in interface ServerConfigurationService
Parameters:
name - The configuration value name base.
Returns:
The configuration value with this name, or the null if not found.

getInt

public int getInt(String name,
                  int dflt)
Access some named configuration value as an int.

Specified by:
getInt in interface ServerConfigurationService
Parameters:
name - The configuration value name.
dflt - The value to return if not found.
Returns:
The configuration value with this name, or the default value if not found.

getBoolean

public boolean getBoolean(String name,
                          boolean dflt)
Access some named configuration value as a boolean.

Specified by:
getBoolean in interface ServerConfigurationService
Parameters:
name - The configuration value name.
dflt - The value to return if not found.
Returns:
The configuration value with this name, or the default value if not found.

getLocks

public List getLocks()
Access the list of security locks in use on this server.

Specified by:
getLocks in interface ServerConfigurationService
Returns:
List (String) of security locks in use on this server.

getToolOrder

public List getToolOrder(String category)
Access the list of tool ids in order for this category, to impose on the displays of many tools

Specified by:
getToolOrder in interface ServerConfigurationService
Parameters:
category - The tool category
Returns:
An ordered list of tool ids (String) indicating the desired tool display order, or an empty list if there are none for this category.

getToolsRequired

public List getToolsRequired(String category)
Access the list of tool ids that are required for this category.

Specified by:
getToolsRequired in interface ServerConfigurationService
Parameters:
category - The tool category.
Returns:
A list of tool ids (String) that are required for this category, or an empty list if there are none for this category.

getDefaultTools

public List getDefaultTools(String category)
Access the list of tool ids that are selected by default for this category.

Specified by:
getDefaultTools in interface ServerConfigurationService
Parameters:
category - The tool category.
Returns:
A list of tool ids (String) for this category to use by default, or an empty list if there are none for this category.

loadToolOrder

protected void loadToolOrder(InputStream in)
Load this single file as a registration file, loading tools and locks.

Parameters:
in - The Stream to load