KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > system > RoleManager


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.system;
9
10 /**
11  * RoleManager Interface, use this to specify the Components and how they
12  * correspond to easy shorthand names. The RoleManager assumes a flat
13  * relationship of shorthand names to classes, and classes to roles.
14  *
15  * @author <a HREF="mailto:bloritsch@apache.org">Berin Loritsch</a>
16  * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 15:44:06 $
17  * @since 4.1
18  */

19 public interface RoleManager
20 {
21     /**
22      * Find the Class for the given shorthand name. If there is no
23      * correspondence between the class and the shorthand name, the method
24      * returns <code>null</code>. If this RoleManager does not have the match,
25      * and there is a parent RoleManager, the parent will be asked to resolve
26      * the request.
27      */

28     Class JavaDoc getClassForName( final String JavaDoc shorthandName );
29
30     /**
31      * This method is merely a hint for serialization. If this RoleManager does
32      * not have the match, and there is a parent RoleManager, the parent will be
33      * asked to resolve the request.
34      */

35     String JavaDoc getNameForClass( final Class JavaDoc component );
36
37     /**
38      * Get the Role name for a specific class. If the class does not belong to
39      * a Component, or the Role is not easily determinable, this method will return
40      * <code>null</code>. If this RoleManager does not have the match, and
41      * there is a parent RoleManager, the parent will be asked to resolve the
42      * request.
43      */

44     String JavaDoc getRoleForClass( final Class JavaDoc component );
45
46     /**
47      * Get an array of classes registered with the role manager that implement a
48      * role. If this RoleManager does not have the match, and there is a parent
49      * RoleManager, the parent will be asked to resolve the request.
50      */

51     Class JavaDoc[] getClassesForRole( final String JavaDoc role );
52
53     /**
54      * Retrieves the handler class name for the specified class. This
55      * is called for every Component Implementation. If this RoleManager does
56      * not have the match, and there is a parent RoleManager, the parent will be
57      * asked to resolve the handler's class name.
58      *
59      * @param class The class of the Component in question.
60      * @return the Class instance of the ComponentHandler.
61      */

62     Class JavaDoc getHandlerClassForClass( final Class JavaDoc className );
63 }
64
Popular Tags