KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.apache.avalon.framework.component.Component;
11
12 import java.util.ArrayList JavaDoc;
13 import java.util.Collections JavaDoc;
14 import java.util.HashMap JavaDoc;
15 import java.util.List JavaDoc;
16 import java.util.Map JavaDoc;
17
18 /**
19  * The Excalibur Role Manager is used for Excalibur Role Mappings. All of the
20  * information is hard-coded.
21  *
22  * @author <a HREF="mailto:bloritsch@apache.org">Berin Loritsch</a>
23  * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 15:44:06 $
24  * @since 4.1
25  */

26 public class ExcaliburRoleManager
27     extends AbstractRoleManager
28 {
29     /**
30      * Default constructor--this RoleManager has no parent.
31      */

32     public ExcaliburRoleManager()
33     {
34         super( null );
35     }
36
37     /**
38      * Alternate constructor--this RoleManager has the specified
39      * parent.
40      *
41      * @param parent The parent <code>RoleManager</code>.
42      */

43     public ExcaliburRoleManager(RoleManager parent)
44     {
45         super( parent, Thread.currentThread().getContextClassLoader() );
46     }
47
48     /**
49      * Alternate constructor--this RoleManager has the specified
50      * parent and a classloader.
51      *
52      * @param parent The parent <code>RoleManager</code>.
53      */

54     public ExcaliburRoleManager(RoleManager parent, ClassLoader JavaDoc loader)
55     {
56         super( parent, loader );
57
58         HashMap JavaDoc shorts = new HashMap JavaDoc( 10 );
59         HashMap JavaDoc classes = new HashMap JavaDoc( 10 );
60         HashMap JavaDoc handlers = new HashMap JavaDoc( 10 );
61
62         /* Set up Cache relations */
63         setup( shorts, classes, handlers, "cache",
64                "org.apache.avalon.excalibur.cache.Cache",
65                "org.apache.avalon.excalibur.cache.DefaultCache",
66                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
67         setup( shorts, classes, handlers, "lru-cache",
68                "org.apache.avalon.excalibur.cache.Cache",
69                "org.apache.avalon.excalibur.cache.LRUCache",
70                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
71
72         /* Set up DataSource relations */
73         setup( shorts, classes, handlers, "jdbc-datasource",
74                "org.apache.avalon.excalibur.datasource.DataSourceComponent",
75                "org.apache.avalon.excalibur.datasource.JdbcDataSource",
76                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
77         setup( shorts, classes, handlers, "j2ee-datasource",
78                "org.apache.avalon.excalibur.datasource.DataSourceComponent",
79                "org.apache.avalon.excalibur.datasource.J2eeDataSource",
80                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
81         setup( shorts, classes, handlers, "informix-datasource",
82                "org.apache.avalon.excalibur.datasource.DataSourceComponent",
83                "org.apache.avalon.excalibur.datasource.InformixDataSource",
84                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
85
86         /* Set up i18n relations */
87         setup( shorts, classes, handlers, "i18n",
88                "org.apache.avalon.excalibur.i18n.BundleSelector",
89                "org.apache.avalon.excalibur.i18n.BundleSelector",
90                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
91
92         /* Set up Monitor relations */
93         setup( shorts, classes, handlers, "monitor",
94                "org.apache.avalon.excalibur.monitor.Monitor",
95                "org.apache.avalon.excalibur.monitor.ActiveMonitor",
96                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
97         setup( shorts, classes, handlers, "passive-monitor",
98                "org.apache.avalon.excalibur.monitor.Monitor",
99                "org.apache.avalon.excalibur.monitor.PassiveMonitor",
100                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
101
102         /* Set up XPath relations */
103         setup( shorts, classes, handlers, "xalan-xpath",
104                "org.apache.avalon.excalibur.xml.xpath.XPathProcessor",
105                "org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl",
106                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
107         setup( shorts, classes, handlers, "jaxpath",
108                "org.apache.avalon.excalibur.xml.xpath.XPathProcessor",
109                "org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl",
110                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
111
112         /* Set up SourceResolver relations */
113         setup( shorts, classes, handlers, "jaxpath",
114                "org.apache.avalon.excalibur.source.SourceResolver",
115                "org.apache.avalon.excalibur.source.SourceResolverImpl",
116                "org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
117
118         /* Set up XML parser relations */
119         setup( shorts, classes, handlers, "parser",
120                "org.apache.avalon.excalibur.xml.Parser",
121                "org.apache.avalon.excalibur.xml.JaxpParser",
122                "org.apache.avalon.excalibur.system.handler.PoolableComponentHandler" );
123         setup( shorts, classes, handlers, "xerces-parser",
124                "org.apache.avalon.excalibur.xml.Parser",
125                "org.apache.avalon.excalibur.xml.XercesParser",
126                "org.apache.avalon.excalibur.system.handler.FactoryComponentHandler" );
127
128         m_shorthands = Collections.unmodifiableMap( shorts );
129         m_classNames = Collections.unmodifiableMap( classes );
130         m_handlerNames = Collections.unmodifiableMap( handlers );
131     }
132 }
133
Popular Tags