org.apache.avalon.fortress
Class MetaInfoEntry

java.lang.Object
  extended by org.apache.avalon.fortress.MetaInfoEntry

public final class MetaInfoEntry
extends java.lang.Object

Keeps track of the relationship of all the associated meta data for a component type. It records all the roles, short name, component class, and the handler class used to manage it. The short name is included strictly to enable "self-healing" configuration files.

Version:
$Revision: 1.10 $ $Date: 2004/02/28 15:16:24 $
Author:
Avalon Development Team

Field Summary
static java.lang.String FACTORY_HANDLER
           
private  java.lang.String m_configName
           
private  java.util.List m_dependencies
           
private  java.lang.Class m_handler
           
private  java.lang.Class m_klass
           
private static java.util.Map m_lifecycleMap
          Translate from lifestyle to component handler.
private  boolean m_readOnly
           
private  java.util.Set m_roles
           
static java.lang.String PER_THREAD_HANDLER
           
static java.lang.String POOLABLE_HANDLER
           
static java.lang.String THREADSAFE_HANDLER
           
private static java.lang.String TYPE_POOLED
           
private static java.lang.String TYPE_SINGLETON
           
private static java.lang.String TYPE_THREAD
           
private static java.lang.String TYPE_TRANSIENT
           
 
Constructor Summary
MetaInfoEntry(java.lang.Class componentClass, java.util.Properties properties, java.util.List deps)
          Create a MetaInfoEntry from the supplied component class, and the supplied meta information.
MetaInfoEntry(RoleEntry roleEntry)
          Create a MetaInfoEntry from the supplied RoleEntry.
 
Method Summary
 void addRole(java.lang.String role)
          Add a service/role for the component entry.
 boolean containsRole(java.lang.String role)
          Tests to see if a component exposes a role.
static java.lang.String createShortName(java.lang.String className)
          Convert a Component implmentation classname into a shorthand name.
 java.lang.Class getComponentClass()
          Get the Class for the component type.
 java.lang.String getConfigurationName()
          Get the configuration name for the component type.
 java.util.List getDependencies()
          Get a reference to the dependencies list.
private  java.lang.String getHandler(java.util.Properties meta)
          Get the name of the requested component handler.
 java.lang.Class getHandlerClass()
          Get the Class for the component type's org.apache.avalon.fortress.impl.handler.ComponentHandler.
 java.util.Iterator getRoles()
          Get an iterator for all the roles.
 void makeReadOnly()
          Make the component entry read only, so no more services can be added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREADSAFE_HANDLER

public static final java.lang.String THREADSAFE_HANDLER
See Also:
Constant Field Values

POOLABLE_HANDLER

public static final java.lang.String POOLABLE_HANDLER
See Also:
Constant Field Values

FACTORY_HANDLER

public static final java.lang.String FACTORY_HANDLER
See Also:
Constant Field Values

PER_THREAD_HANDLER

public static final java.lang.String PER_THREAD_HANDLER
See Also:
Constant Field Values

m_klass

private final java.lang.Class m_klass

m_configName

private final java.lang.String m_configName

m_handler

private final java.lang.Class m_handler

m_roles

private final java.util.Set m_roles

m_readOnly

private volatile boolean m_readOnly

m_lifecycleMap

private static final java.util.Map m_lifecycleMap
Translate from lifestyle to component handler.


m_dependencies

private final java.util.List m_dependencies

TYPE_SINGLETON

private static final java.lang.String TYPE_SINGLETON
See Also:
Constant Field Values

TYPE_THREAD

private static final java.lang.String TYPE_THREAD
See Also:
Constant Field Values

TYPE_POOLED

private static final java.lang.String TYPE_POOLED
See Also:
Constant Field Values

TYPE_TRANSIENT

private static final java.lang.String TYPE_TRANSIENT
See Also:
Constant Field Values
Constructor Detail

MetaInfoEntry

public MetaInfoEntry(java.lang.Class componentClass,
                     java.util.Properties properties,
                     java.util.List deps)
              throws java.lang.ClassNotFoundException
Create a MetaInfoEntry from the supplied component class, and the supplied meta information.

Parameters:
componentClass - The Class for the component type
properties - The Properties object for meta info
Throws:
java.lang.ClassNotFoundException - if the component handler class could not be found

MetaInfoEntry

public MetaInfoEntry(RoleEntry roleEntry)
Create a MetaInfoEntry from the supplied RoleEntry.

Parameters:
roleEntry - The RoleEntry to convert
Method Detail

makeReadOnly

public void makeReadOnly()
Make the component entry read only, so no more services can be added.


getComponentClass

public java.lang.Class getComponentClass()
Get the Class for the component type.

Returns:
the Class

getHandlerClass

public java.lang.Class getHandlerClass()
Get the Class for the component type's org.apache.avalon.fortress.impl.handler.ComponentHandler.

Returns:
the Class

getConfigurationName

public java.lang.String getConfigurationName()
Get the configuration name for the component type. This is used in "self-healing" configuration files.

Returns:
the config name

addRole

public void addRole(java.lang.String role)
Add a service/role for the component entry.

Parameters:
role - The new role
Throws:
java.lang.SecurityException - if this MetaInfoEntry is read-only

containsRole

public boolean containsRole(java.lang.String role)
Tests to see if a component exposes a role.

Parameters:
role - The role to check
Returns:
true if it does

getRoles

public java.util.Iterator getRoles()
Get an iterator for all the roles.

Returns:
the iterator

getDependencies

public java.util.List getDependencies()
Get a reference to the dependencies list.

Returns:
the dependency list

getHandler

private java.lang.String getHandler(java.util.Properties meta)
Get the name of the requested component handler.

Parameters:
meta - The properties object from the constructor
Returns:
String name of the component handler

createShortName

public static final java.lang.String createShortName(java.lang.String className)
Convert a Component implmentation classname into a shorthand name. It assumes all classnames for a particular component is unique.

Parameters:
className - The classname of a component
Returns:
String the short name