org.apache.cocoon.core.container
Class RoleManager

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.core.container.RoleManager
All Implemented Interfaces:
Configurable, LogEnabled

public class RoleManager
extends AbstractLogEnabled
implements Configurable

Default RoleManager implementation. It populates the RoleManager from a configuration file.

Since:
2.2
Version:
$Id: RoleManager.java 312637 2005-10-10 13:00:42Z cziegeler $

Constructor Summary
RoleManager()
          Default constructor--this RoleManager has no parent.
RoleManager(RoleManager parent)
          Alternate constructor--this RoleManager has the specified parent.
 
Method Summary
 void configure(Configuration configuration)
          Reads a configuration object and creates the role, shorthand, and class name mapping.
 ComponentInfo getDefaultServiceInfoForKey(String role, String shorthand)
          Retrieves a default class name for a role/key combination.
 ComponentInfo getDefaultServiceInfoForRole(String role)
          Retrieves the default class name for the specified role.
 String getRoleForName(String shorthandName)
          Retrieves the real role name from a shorthand name.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoleManager

public RoleManager()
Default constructor--this RoleManager has no parent.


RoleManager

public RoleManager(RoleManager parent)
Alternate constructor--this RoleManager has the specified parent.

Parameters:
parent - The parent RoleManager.
Method Detail

getRoleForName

public final String getRoleForName(String shorthandName)
Retrieves the real role name from a shorthand name. Usually the shorthand name refers to a configuration element name. If this RoleManager does not have the match, and there is a parent RoleManager, the parent will be asked to resolve the role.

Parameters:
shorthandName - The shortname that is an alias for the role.
Returns:
the official role name.

getDefaultServiceInfoForRole

public final ComponentInfo getDefaultServiceInfoForRole(String role)
Retrieves the default class name for the specified role. This is only called when the configuration does not specify the class explicitly. If this RoleManager does not have the match, and there is a parent RoleManager, the parent will be asked to resolve the class name.

Parameters:
role - The role that has a default implementation.
Returns:
the Fully Qualified Class Name (FQCN) for the role.

getDefaultServiceInfoForKey

public final ComponentInfo getDefaultServiceInfoForKey(String role,
                                                       String shorthand)
Retrieves a default class name for a role/key combination. This is only called when a role is mapped to a StandaloneServiceSelector, and the configuration elements use shorthand names for the type of component. If this RoleManager does not have the match, and there is a parent RoleManager, the parent will be asked to resolve the class name.

Parameters:
role - The role that this shorthand refers to.
shorthand - The shorthand name for the type of component
Returns:
the FQCN for the role/key combination.

configure

public final void configure(Configuration configuration)
                     throws ConfigurationException
Reads a configuration object and creates the role, shorthand, and class name mapping.

Specified by:
configure in interface Configurable
Parameters:
configuration - The configuration object.
Throws:
ConfigurationException - if the configuration is malformed


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.