bloritsch 02/02/19 12:48:04
Modified: src/java/org/apache/avalon/excalibur/datasource
AbstractJdbcConnection.java
src/scratchpad/org/apache/avalon/excalibur/system
AbstractContainer.java ContainerManager.java
src/scratchpad/org/apache/avalon/excalibur/system/handler
ComponentFactory.java FactoryComponentHandler.java
PerThreadComponentHandler.java
PoolableComponentHandler.java
ThreadSafeComponentHandler.java
Added: src/scratchpad/org/apache/avalon/excalibur/system/util
AbstractRoleManager.java
ConfigurableRoleManager.java ContextManager.java
ExcaliburRoleManager.java RoleManager.java
src/scratchpad/org/apache/avalon/excalibur/system/util/test
ConfigurableRoleManagerTestCase.java
ExcaliburRoleManagerTestCase.java
Removed: src/scratchpad/org/apache/avalon/excalibur/system
AbstractRoleManager.java
ConfigurableRoleManager.java
ExcaliburRoleManager.java RoleManager.java
src/scratchpad/org/apache/avalon/excalibur/system/test
ConfigurableRoleManagerTestCase.java
ExcaliburRoleManagerTestCase.java
Log:
fix compilation error, move RoleManager and beginnings of ContextManager to
system.util
Revision Changes Path
1.13 +2 -1
jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcConnection.java
Index: AbstractJdbcConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcConnection.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractJdbcConnection.java 19 Feb 2002 20:27:36 -0000 1.12
+++ AbstractJdbcConnection.java 19 Feb 2002 20:48:03 -0000 1.13
@@ -13,6 +13,7 @@
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
+import java.sql.ResultSet;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Disposable;
@@ -29,7 +30,7 @@
* total number of Connection objects that are created.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.12 $ $Date: 2002/02/19 20:27:36 $
+ * @version CVS $Revision: 1.13 $ $Date: 2002/02/19 20:48:03 $
* @since 4.1
*/
public abstract class AbstractJdbcConnection
1.22 +2 -1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/AbstractContainer.java
Index: AbstractContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/AbstractContainer.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AbstractContainer.java 18 Feb 2002 15:40:46 -0000 1.21
+++ AbstractContainer.java 19 Feb 2002 20:48:03 -0000 1.22
@@ -20,6 +20,7 @@
import org.apache.avalon.excalibur.logger.LoggerManager;
import org.apache.avalon.excalibur.event.Queue;
import org.apache.avalon.excalibur.mpool.PoolManager;
+import org.apache.avalon.excalibur.system.util.*;
import java.util.ArrayList;
import java.util.Collections;
@@ -34,7 +35,7 @@
* Manager can expose that to the instantiating class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.21 $ $Date: 2002/02/18 15:40:46 $
+ * @version CVS $Revision: 1.22 $ $Date: 2002/02/19 20:48:03 $
*/
public abstract class AbstractContainer
extends AbstractLogEnabled
1.28 +2 -1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/ContainerManager.java
Index: ContainerManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/ContainerManager.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ContainerManager.java 19 Feb 2002 02:05:58 -0000 1.27
+++ ContainerManager.java 19 Feb 2002 20:48:03 -0000 1.28
@@ -21,6 +21,7 @@
import org.apache.avalon.excalibur.source.*;
import org.apache.avalon.excalibur.command.*;
import org.apache.avalon.excalibur.mpool.*;
+import org.apache.avalon.excalibur.system.util.*;
import java.io.File;
@@ -109,7 +110,7 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.27 $ $Date: 2002/02/19 02:05:58 $
+ * @version CVS $Revision: 1.28 $ $Date: 2002/02/19 20:48:03 $
*/
public class ContainerManager implements Disposable
{
1.3 +2 -2
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/ComponentFactory.java
Index: ComponentFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/ComponentFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComponentFactory.java 12 Feb 2002 21:30:43 -0000 1.2
+++ ComponentFactory.java 19 Feb 2002 20:48:03 -0000 1.3
@@ -7,7 +7,7 @@
*/
package org.apache.avalon.excalibur.system.handler;
-import org.apache.avalon.excalibur.system.RoleManager;
+import org.apache.avalon.excalibur.system.util.RoleManager;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
@@ -30,7 +30,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.2 $ $Date: 2002/02/12 21:30:43 $
+ * @version CVS $Revision: 1.3 $ $Date: 2002/02/19 20:48:03 $
* @since 4.0
*/
public class ComponentFactory
1.6 +2 -2
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/FactoryComponentHandler.java
Index: FactoryComponentHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/FactoryComponentHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FactoryComponentHandler.java 12 Feb 2002 21:30:43 -0000 1.5
+++ FactoryComponentHandler.java 19 Feb 2002 20:48:03 -0000 1.6
@@ -8,7 +8,7 @@
package org.apache.avalon.excalibur.system.handler;
import org.apache.avalon.excalibur.system.Container;
-import org.apache.avalon.excalibur.system.RoleManager;
+import org.apache.avalon.excalibur.system.util.RoleManager;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentManager;
@@ -23,7 +23,7 @@
* and destroyed correctly.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.5 $ $Date: 2002/02/12 21:30:43 $
+ * @version CVS $Revision: 1.6 $ $Date: 2002/02/19 20:48:03 $
* @since 4.0
*/
public final class FactoryComponentHandler
1.6 +2 -2
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/PerThreadComponentHandler.java
Index: PerThreadComponentHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/PerThreadComponentHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PerThreadComponentHandler.java 12 Feb 2002 21:30:43 -0000 1.5
+++ PerThreadComponentHandler.java 19 Feb 2002 20:48:03 -0000 1.6
@@ -8,7 +8,7 @@
package org.apache.avalon.excalibur.system.handler;
import org.apache.avalon.excalibur.system.Container;
-import org.apache.avalon.excalibur.system.RoleManager;
+import org.apache.avalon.excalibur.system.util.RoleManager;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
@@ -23,7 +23,7 @@
* and destroyed correctly.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.5 $ $Date: 2002/02/12 21:30:43 $
+ * @version CVS $Revision: 1.6 $ $Date: 2002/02/19 20:48:03 $
* @since 4.0
*/
public final class PerThreadComponentHandler implements ComponentHandler {
1.9 +2 -2
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/PoolableComponentHandler.java
Index: PoolableComponentHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/PoolableComponentHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PoolableComponentHandler.java 18 Feb 2002 16:14:32 -0000 1.8
+++ PoolableComponentHandler.java 19 Feb 2002 20:48:03 -0000 1.9
@@ -8,7 +8,7 @@
package org.apache.avalon.excalibur.system.handler;
import org.apache.avalon.excalibur.system.Container;
-import org.apache.avalon.excalibur.system.RoleManager;
+import org.apache.avalon.excalibur.system.util.RoleManager;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentManager;
@@ -25,7 +25,7 @@
* and destroyed correctly.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.8 $ $Date: 2002/02/18 16:14:32 $
+ * @version CVS $Revision: 1.9 $ $Date: 2002/02/19 20:48:03 $
* @since 4.0
*/
public final class PoolableComponentHandler implements ComponentHandler {
1.6 +2 -2
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/ThreadSafeComponentHandler.java
Index: ThreadSafeComponentHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/handler/ThreadSafeComponentHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ThreadSafeComponentHandler.java 12 Feb 2002 21:30:43 -0000 1.5
+++ ThreadSafeComponentHandler.java 19 Feb 2002 20:48:03 -0000 1.6
@@ -8,7 +8,7 @@
package org.apache.avalon.excalibur.system.handler;
import org.apache.avalon.excalibur.system.Container;
-import org.apache.avalon.excalibur.system.RoleManager;
+import org.apache.avalon.excalibur.system.util.RoleManager;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
@@ -23,7 +23,7 @@
* and destroyed correctly.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.5 $ $Date: 2002/02/12 21:30:43 $
+ * @version CVS $Revision: 1.6 $ $Date: 2002/02/19 20:48:03 $
* @since 4.0
*/
public final class ThreadSafeComponentHandler implements ComponentHandler {
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/AbstractRoleManager.java
Index: AbstractRoleManager.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util;
import org.apache.avalon.framework.component.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* The Excalibur Role Manager is used for Excalibur Role Mappings. All of the
* information is hard-coded.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public abstract class AbstractRoleManager
implements RoleManager
{
protected static final String EMPTY_STRING = "";
protected final ClassLoader m_loader;
/** Map for shorthand to class mapping */
protected Map m_shorthands;
/** Map for role to classname mapping */
protected Map m_classNames;
/** Map for role to handler classname mapping */
protected Map m_handlerNames;
/** Parent <code>RoleManager</code> for nested resolution */
protected final RoleManager m_parent;
/**
* Default constructor--this RoleManager has no parent.
*/
public AbstractRoleManager()
{
this( null );
}
/**
* Alternate constructor--this RoleManager has the specified
* parent.
*
* @param parent The parent <code>RoleManager</code>.
*/
public AbstractRoleManager(RoleManager parent)
{
this( parent, Thread.currentThread().getContextClassLoader() );
}
/**
* Alternate constructor--this RoleManager has the specified
* parent.
*
* @param parent The parent <code>RoleManager</code>.
*/
public AbstractRoleManager(RoleManager parent, ClassLoader loader)
{
ClassLoader thisLoader = loader;
if ( null == thisLoader )
{
thisLoader = Thread.currentThread().getContextClassLoader();
}
m_loader = thisLoader;
m_parent = parent;
}
protected void setup( Map shorts, Map classes, Map handlers,
String shortName, String role, String className,
String handlerClassName )
{
final Class klass;
Class handlerKlass;
try
{
klass = m_loader.loadClass( className );
if ( ! Component.class.isAssignableFrom( klass ) )
{
// Do not store reference if it is not a Component
return;
}
}
catch ( Exception e )
{
// Do not store reference if class does not exist.
return;
}
try
{
handlerKlass = m_loader.loadClass( handlerClassName );
}
catch ( Exception e )
{
handlerKlass =
org.apache.avalon.excalibur.system.handler.PerThreadComponentHandler.class;
}
shorts.put( shortName, klass );
shorts.put( klass, shortName );
classes.put( klass,
role );
List classList = (List) classes.get( role );
if ( null == classList )
{
classList = new ArrayList(5);
}
classList.add( klass );
classes.put( role, classList );
handlers.put( klass, handlerKlass );
}
/**
* Find the Class for the given shorthand name. If there is no
* correspondence between the class and the shorthand name, the method
* returns <code>null</code>. If this RoleManager does not have the
match,
* and there is a parent RoleManager, the parent will be asked to resolve
* the request.
*/
public final Class getClassForName( final String shorthandName )
{
if (shorthandName == null) return null;
final Class component = (Class)m_shorthands.get( shorthandName );
if( null == component && null != m_parent )
{
return m_parent.getClassForName( shorthandName );
}
return component;
}
/**
* 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.
*
* @param shorthandName The shortname that is an alias for the role.
* @return the official role name.
*/
public final String getNameForClass( final Class klass )
{
final String shorthandName = (String)m_shorthands.get( klass );
if( null == shorthandName && null != m_parent )
{
return m_parent.getNameForClass( klass );
}
return shorthandName;
}
/**
* Retrieves the handler class name for the specified class name. This
* is called for every ComponentImplementation. If this RoleManager does
* not have the match, and there is a parent RoleManager, the parent will
be
* asked to resolve the handler's class name.
*
* @param role The role that has a default implementation.
* @return the Fully Qualified Class Name (FQCN) for the role.
*/
public final Class getHandlerClassForClass( final Class className )
{
final Class handler = (Class)m_handlerNames.get( className );
if( null == handler && null != m_parent )
{
return m_parent.getHandlerClassForClass( className );
}
return handler;
}
/**
* 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.
*
* @param role The role that has a default implementation.
* @return the Fully Qualified Class Name (FQCN) for the role.
*/
public final Class[] getClassesForRole( final String role )
{
final List classes = (List)m_classNames.get( role );
if( null == classes && null != m_parent )
{
return m_parent.getClassesForRole( role );
}
return (Class []) classes.toArray( new Class[] {} );
}
/**
* Retrieves a default class name for a role/hint combination.
* This is only called when a role is mapped to a
* DefaultComponentSelector, 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.
*
* @param role The role that this shorthand refers to.
* @param shorthand The shorthand name for the type of Component
* @return the FQCN for the role/hint combination.
*/
public final String getRoleForClass( final Class klass )
{
final String role = (String)m_classNames.get( klass );
if( null == role )
{
if( null != m_parent )
{
return m_parent.getRoleForClass( klass );
}
else
{
return EMPTY_STRING;
}
}
return role;
}
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/ConfigurableRoleManager.java
Index: ConfigurableRoleManager.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLoggable;
/**
* Configurable RoleManager implementation. It populates the RoleManager
* from a configuration hierarchy. This is based on the DefaultRoleManager
* in the org.apache.avalon.component package.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public class ConfigurableRoleManager
extends AbstractRoleManager
implements Configurable
{
/**
* Default constructor--this RoleManager has no parent.
*/
public ConfigurableRoleManager()
{
super( null );
}
/**
* Alternate constructor--this RoleManager has the specified
* parent.
*
* @param parent The parent <code>RoleManager</code>.
*/
public ConfigurableRoleManager(RoleManager parent)
{
super( parent, Thread.currentThread().getContextClassLoader() );
}
/**
* Alternate constructor--this RoleManager has the specified
* parent and a classloader.
*
* @param parent The parent <code>RoleManager</code>.
*/
public ConfigurableRoleManager(RoleManager parent, ClassLoader loader)
{
super( parent, loader );
}
/**
* Reads a configuration object and creates the role, shorthand,
* and class name mapping.
*
* @param configuration The configuration object.
* @throws ConfigurationException if the configuration is malformed
*/
public final void configure( final Configuration configuration )
throws ConfigurationException
{
final Map shorts = new HashMap();
final Map classes = new HashMap();
final Map handlers = new HashMap();
final Map hintclasses = new HashMap();
final Configuration[] roles = configuration.getChildren( "role" );
for( int i = 0; i < roles.length; i++ )
{
final String role = roles[ i ].getAttribute( "name" );
Configuration[] components = roles[i].getChildren( "component" );
for ( int j = 0; j < components.length; j++)
{
final String shorthand = components[ j ].getAttribute(
"shorthand" );
final String className =
components[ j ].getAttribute( "class", null );
final String handlerClassName =
components[ j ].getAttribute( "handler",
"org.apache.avalon.excalibur.system.handler.PerThreadComponentHandler" );
setup( shorts, classes, handlers, shorthand, role, className,
handlerClassName );
}
}
m_shorthands = Collections.unmodifiableMap( shorts );
m_classNames = Collections.unmodifiableMap( classes );
m_handlerNames = Collections.unmodifiableMap( handlers );
}
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/ContextManager.java
Index: ContextManager.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util;
/**
* RoleManager Interface, use this to specify the Components and how they
* correspond to easy shorthand names. The RoleManager assumes a flat
* relationship of shorthand names to classes, and classes to roles.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public interface ContextManager
{
/**
* Find the Class for the given shorthand name. If there is no
* correspondence between the class and the shorthand name, the method
* returns <code>null</code>. If this RoleManager does not have the
match,
* and there is a parent RoleManager, the parent will be asked to resolve
* the request.
*/
Class getClassForName( final String shorthandName );
/**
* This method is merely a hint for serialization. If this RoleManager
does
* not have the match, and there is a parent RoleManager, the parent will
be
* asked to resolve the request.
*/
String getNameForClass( final Class component );
/**
* Get the Role name for a specific class. If the class does not belong
to
* a Component, or the Role is not easily determinable, this method will
return
* <code>null</code>. If this RoleManager does not have the match, and
* there is a parent RoleManager, the parent will be asked to resolve the
* request.
*/
String getRoleForClass( final Class component );
/**
* Get an array of classes registered with the role manager that
implement a
* role. If this RoleManager does not have the match, and there is a
parent
* RoleManager, the parent will be asked to resolve the request.
*/
Class[] getClassesForRole( final String role );
/**
* Retrieves the handler class name for the specified class. This
* is called for every Component Implementation. If this RoleManager does
* not have the match, and there is a parent RoleManager, the parent will
be
* asked to resolve the handler's class name.
*
* @param class The class of the Component in question.
* @return the Class instance of the ComponentHandler.
*/
Class getHandlerClassForClass( final Class className );
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/ExcaliburRoleManager.java
Index: ExcaliburRoleManager.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util;
import org.apache.avalon.framework.component.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The Excalibur Role Manager is used for Excalibur Role Mappings. All of the
* information is hard-coded.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public class ExcaliburRoleManager
extends AbstractRoleManager
{
/**
* Default constructor--this RoleManager has no parent.
*/
public ExcaliburRoleManager()
{
super( null );
}
/**
* Alternate constructor--this RoleManager has the specified
* parent.
*
* @param parent The parent <code>RoleManager</code>.
*/
public ExcaliburRoleManager(RoleManager parent)
{
super( parent, Thread.currentThread().getContextClassLoader() );
}
/**
* Alternate constructor--this RoleManager has the specified
* parent and a classloader.
*
* @param parent The parent <code>RoleManager</code>.
*/
public ExcaliburRoleManager(RoleManager parent, ClassLoader loader)
{
super( parent, loader );
HashMap shorts = new HashMap( 10 );
HashMap classes = new HashMap( 10 );
HashMap handlers = new HashMap( 10 );
/* Set up Cache relations */
setup( shorts, classes, handlers, "cache",
"org.apache.avalon.excalibur.cache.Cache",
"org.apache.avalon.excalibur.cache.DefaultCache",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
setup( shorts, classes, handlers, "lru-cache",
"org.apache.avalon.excalibur.cache.Cache",
"org.apache.avalon.excalibur.cache.LRUCache",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up DataSource relations */
setup( shorts, classes, handlers, "jdbc-datasource",
"org.apache.avalon.excalibur.datasource.DataSourceComponent",
"org.apache.avalon.excalibur.datasource.JdbcDataSource",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
setup( shorts, classes, handlers, "j2ee-datasource",
"org.apache.avalon.excalibur.datasource.DataSourceComponent",
"org.apache.avalon.excalibur.datasource.J2eeDataSource",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
setup( shorts, classes, handlers, "informix-datasource",
"org.apache.avalon.excalibur.datasource.DataSourceComponent",
"org.apache.avalon.excalibur.datasource.InformixDataSource",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up i18n relations */
setup( shorts, classes, handlers, "i18n",
"org.apache.avalon.excalibur.i18n.BundleSelector",
"org.apache.avalon.excalibur.i18n.BundleSelector",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up Monitor relations */
setup( shorts, classes, handlers, "monitor",
"org.apache.avalon.excalibur.monitor.Monitor",
"org.apache.avalon.excalibur.monitor.ActiveMonitor",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
setup( shorts, classes, handlers, "passive-monitor",
"org.apache.avalon.excalibur.monitor.Monitor",
"org.apache.avalon.excalibur.monitor.PassiveMonitor",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up XPath relations */
setup( shorts, classes, handlers, "xalan-xpath",
"org.apache.avalon.excalibur.xml.xpath.XPathProcessor",
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
setup( shorts, classes, handlers, "jaxpath",
"org.apache.avalon.excalibur.xml.xpath.XPathProcessor",
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up SourceResolver relations */
setup( shorts, classes, handlers, "resolver",
"org.apache.avalon.excalibur.source.SourceResolver",
"org.apache.avalon.excalibur.source.SourceResolverImpl",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up XML parser relations */
setup( shorts, classes, handlers, "parser",
"org.apache.avalon.excalibur.xml.Parser",
"org.apache.avalon.excalibur.xml.JaxpParser",
"org.apache.avalon.excalibur.system.handler.PerThreadComponentHandler" );
setup( shorts, classes, handlers, "xerces-parser",
"org.apache.avalon.excalibur.xml.Parser",
"org.apache.avalon.excalibur.xml.XercesParser",
"org.apache.avalon.excalibur.system.handler.FactoryComponentHandler" );
m_shorthands = Collections.unmodifiableMap( shorts );
m_classNames = Collections.unmodifiableMap( classes );
m_handlerNames = Collections.unmodifiableMap( handlers );
}
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/RoleManager.java
Index: RoleManager.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util;
/**
* RoleManager Interface, use this to specify the Components and how they
* correspond to easy shorthand names. The RoleManager assumes a flat
* relationship of shorthand names to classes, and classes to roles.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public interface RoleManager
{
/**
* Find the Class for the given shorthand name. If there is no
* correspondence between the class and the shorthand name, the method
* returns <code>null</code>. If this RoleManager does not have the
match,
* and there is a parent RoleManager, the parent will be asked to resolve
* the request.
*/
Class getClassForName( final String shorthandName );
/**
* This method is merely a hint for serialization. If this RoleManager
does
* not have the match, and there is a parent RoleManager, the parent will
be
* asked to resolve the request.
*/
String getNameForClass( final Class component );
/**
* Get the Role name for a specific class. If the class does not belong
to
* a Component, or the Role is not easily determinable, this method will
return
* <code>null</code>. If this RoleManager does not have the match, and
* there is a parent RoleManager, the parent will be asked to resolve the
* request.
*/
String getRoleForClass( final Class component );
/**
* Get an array of classes registered with the role manager that
implement a
* role. If this RoleManager does not have the match, and there is a
parent
* RoleManager, the parent will be asked to resolve the request.
*/
Class[] getClassesForRole( final String role );
/**
* Retrieves the handler class name for the specified class. This
* is called for every Component Implementation. If this RoleManager does
* not have the match, and there is a parent RoleManager, the parent will
be
* asked to resolve the handler's class name.
*
* @param class The class of the Component in question.
* @return the Class instance of the ComponentHandler.
*/
Class getHandlerClassForClass( final Class className );
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/test/ConfigurableRoleManagerTestCase.java
Index: ConfigurableRoleManagerTestCase.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util.test;
import org.apache.avalon.excalibur.system.util.ConfigurableRoleManager;
import org.apache.avalon.framework.configuration.*;
import junit.framework.TestCase;
/**
* Configurable RoleManager implementation. It populates the RoleManager
* from a configuration hierarchy. This is based on the DefaultRoleManager
* in the org.apache.avalon.component package.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public class ConfigurableRoleManagerTestCase
extends TestCase
{
/**
* Default constructor--this RoleManager has no parent.
*/
public ConfigurableRoleManagerTestCase( String name )
{
super( name );
}
/**
* Test the shorthand return values.
*/
public void testShorthandReturnValues()
throws Exception
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
ConfigurableRoleManager roles = new ConfigurableRoleManager( null,
this.getClass().getClassLoader() );
roles.configure( builder.build(this.getClass().getClassLoader()
.getResourceAsStream(
"org/apache/avalon/excalibur/system/test/ContainerProfile.roles" ) ) );
assertEquals(
roles.getClassForName( "datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" )
);
assertEquals(
roles.getClassForName( "monitor" ),
Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" )
);
assertEquals(
roles.getClassForName( "parser" ),
Class.forName( "org.apache.avalon.excalibur.xml.JaxpParser" )
);
}
/**
* Test the shorthand return values.
*/
public void testShorthandRemapReturnValues()
throws Exception
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
ConfigurableRoleManager roles = new ConfigurableRoleManager( null,
this.getClass().getClassLoader() );
roles.configure( builder.build(this.getClass().getClassLoader()
.getResourceAsStream(
"org/apache/avalon/excalibur/system/test/ContainerProfile.roles" ) ) );
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
"datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
"monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
"parser"
);
}
/**
* Test the shorthand return values.
*/
public void testRoleForClass()
throws Exception
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
ConfigurableRoleManager roles = new ConfigurableRoleManager( null,
this.getClass().getClassLoader() );
roles.configure( builder.build(this.getClass().getClassLoader()
.getResourceAsStream(
"org/apache/avalon/excalibur/system/test/ContainerProfile.roles" ) ) );
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
"org.apache.avalon.excalibur.datasource.DataSourceComponent"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
"org.apache.avalon.excalibur.monitor.Monitor"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
"org.apache.avalon.excalibur.xml.Parser"
);
}
/**
* Test the shorthand return values.
*/
public void testClassesForRole()
throws Exception
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
ConfigurableRoleManager roles = new ConfigurableRoleManager( null,
this.getClass().getClassLoader() );
roles.configure( builder.build(this.getClass().getClassLoader()
.getResourceAsStream(
"org/apache/avalon/excalibur/system/test/ContainerProfile.roles" ) ) );
Class[] classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.datasource.DataSourceComponent" );
assertEquals(
classes[0],
Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.monitor.Monitor" );
assertEquals(
classes[0],
Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.xml.Parser" );
assertEquals(
classes[0],
Class.forName( "org.apache.avalon.excalibur.xml.JaxpParser" )
);
}
/**
* Test the handler class return values.
*/
public void testHandlerClassReturnValues()
throws Exception
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
ConfigurableRoleManager roles = new ConfigurableRoleManager( null,
this.getClass().getClassLoader() );
roles.configure( builder.build(this.getClass().getClassLoader()
.getResourceAsStream(
"org/apache/avalon/excalibur/system/test/ContainerProfile.roles" ) ) );
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.PoolableComponentHandler" )
);
}
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/util/test/ExcaliburRoleManagerTestCase.java
Index: ExcaliburRoleManagerTestCase.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.util.test;
import org.apache.avalon.excalibur.system.util.ExcaliburRoleManager;
import junit.framework.TestCase;
/**
* Configurable RoleManager implementation. It populates the RoleManager
* from a configuration hierarchy. This is based on the DefaultRoleManager
* in the org.apache.avalon.component package.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 20:48:04 $
* @since 4.1
*/
public class ExcaliburRoleManagerTestCase
extends TestCase
{
/**
* Default constructor--this RoleManager has no parent.
*/
public ExcaliburRoleManagerTestCase( String name )
{
super( name );
}
/**
* Test the shorthand return values.
*/
public void testShorthandReturnValues()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getClassForName( "cache" ),
Class.forName( "org.apache.avalon.excalibur.cache.DefaultCache" )
);
assertEquals(
roles.getClassForName( "lru-cache" ),
Class.forName( "org.apache.avalon.excalibur.cache.LRUCache" )
);
assertEquals(
roles.getClassForName( "jdbc-datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" )
);
assertEquals(
roles.getClassForName( "j2ee-datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" )
);
assertEquals(
roles.getClassForName( "informix-datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" )
);
assertEquals(
roles.getClassForName( "i18n" ),
Class.forName( "org.apache.avalon.excalibur.i18n.BundleSelector" )
);
assertEquals(
roles.getClassForName( "monitor" ),
Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" )
);
assertEquals(
roles.getClassForName( "passive-monitor" ),
Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" )
);
assertEquals(
roles.getClassForName( "xalan-xpath" ),
Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" )
);
assertEquals(
roles.getClassForName( "jaxpath" ),
Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" )
);
assertEquals(
roles.getClassForName( "resolver" ),
Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" )
);
assertEquals(
roles.getClassForName( "parser" ),
Class.forName( "org.apache.avalon.excalibur.xml.JaxpParser" )
);
assertEquals(
roles.getClassForName( "xerces-parser" ),
Class.forName( "org.apache.avalon.excalibur.xml.XercesParser" )
);
}
/**
* Test the shorthand return values.
*/
public void testShorthandRemapReturnValues()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
"cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.LRUCache" ) ),
"lru-cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
"jdbc-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" ) ),
"j2ee-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" ) ),
"informix-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.i18n.BundleSelector" ) ),
"i18n"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
"monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" ) ),
"passive-monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" ) ),
"xalan-xpath"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" ) ),
"jaxpath"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" ) ),
"resolver"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
"parser"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.XercesParser" ) ),
"xerces-parser"
);
}
/**
* Test the shorthand return values.
*/
public void testRoleForClass()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
"org.apache.avalon.excalibur.cache.Cache"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.cache.LRUCache" ) ),
"org.apache.avalon.excalibur.cache.Cache"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
"org.apache.avalon.excalibur.datasource.DataSourceComponent"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" ) ),
"org.apache.avalon.excalibur.datasource.DataSourceComponent"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" ) ),
"org.apache.avalon.excalibur.datasource.DataSourceComponent"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.i18n.BundleSelector" ) ),
"org.apache.avalon.excalibur.i18n.BundleSelector"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
"org.apache.avalon.excalibur.monitor.Monitor"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" ) ),
"org.apache.avalon.excalibur.monitor.Monitor"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" ) ),
"org.apache.avalon.excalibur.xml.xpath.XPathProcessor"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" ) ),
"org.apache.avalon.excalibur.xml.xpath.XPathProcessor"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" ) ),
"org.apache.avalon.excalibur.source.SourceResolver"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
"org.apache.avalon.excalibur.xml.Parser"
);
assertEquals(
roles.getRoleForClass( Class.forName(
"org.apache.avalon.excalibur.xml.XercesParser" ) ),
"org.apache.avalon.excalibur.xml.Parser"
);
}
/**
* Test the shorthand return values.
*/
public void testClassesForRole()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
Class[] classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.cache.Cache" );
assertEquals(
classes[0],
Class.forName( "org.apache.avalon.excalibur.cache.DefaultCache" )
);
assertEquals(
classes[1],
Class.forName( "org.apache.avalon.excalibur.cache.LRUCache" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.datasource.DataSourceComponent" );
assertEquals(
classes[0],
Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" )
);
assertEquals(
classes[1],
Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" )
);
assertEquals(
classes[2],
Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.i18n.BundleSelector" );
assertEquals(
classes[0],
Class.forName( "org.apache.avalon.excalibur.i18n.BundleSelector" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.monitor.Monitor" );
assertEquals(
classes[0],
Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" )
);
assertEquals(
classes[1],
Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessor" );
assertEquals(
classes[0],
Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" )
);
assertEquals(
classes[1],
Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.source.SourceResolver" );
assertEquals(
classes[0],
Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" )
);
classes = roles.getClassesForRole(
"org.apache.avalon.excalibur.xml.Parser" );
assertEquals(
classes[0],
Class.forName( "org.apache.avalon.excalibur.xml.JaxpParser" )
);
assertEquals(
classes[1],
Class.forName( "org.apache.avalon.excalibur.xml.XercesParser" )
);
}
/**
* Test the handler class return values.
*/
public void testHandlerClassReturnValues()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.cache.LRUCache" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.i18n.BundleSelector" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.PerThreadComponentHandler" )
);
assertEquals(
roles.getHandlerClassForClass( Class.forName(
"org.apache.avalon.excalibur.xml.XercesParser" ) ),
Class.forName(
"org.apache.avalon.excalibur.system.handler.FactoryComponentHandler" )
);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>