KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > logging > logkit > DefaultLogTargetFactoryManager


1 /*
2  * Copyright 2004 Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.avalon.logging.logkit;
19
20 import java.util.Map JavaDoc;
21
22 import org.apache.avalon.util.i18n.ResourceManager;
23 import org.apache.avalon.util.i18n.Resources;
24
25 /**
26  * A <code>LoggerManager</code> interface declares operation supporting
27  * the management of a logging hierarchy.
28  *
29  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
30  */

31 class DefaultLogTargetFactoryManager implements LogTargetFactoryManager
32 {
33     //---------------------------------------------------------------
34
// static
35
//---------------------------------------------------------------
36

37     private static final Resources REZ =
38       ResourceManager.getPackageResources( DefaultLogTargetFactoryManager.class );
39
40     //---------------------------------------------------------------
41
// state
42
//---------------------------------------------------------------
43

44    /**
45     * Map for id to factory mapping.
46     */

47     private final Map JavaDoc m_map;
48
49     //---------------------------------------------------------------
50
// constructor
51
//---------------------------------------------------------------
52

53     /**
54      * Creation of a new log target manager.
55      * @param targets a map of log targets
56      */

57     public DefaultLogTargetFactoryManager( Map JavaDoc map ) throws Exception JavaDoc
58     {
59         if( null == map )
60         {
61             throw new NullPointerException JavaDoc( "map" );
62         }
63         m_map = map;
64     }
65
66     //---------------------------------------------------------------
67
// LogTargetFactoryManager
68
//---------------------------------------------------------------
69

70    /**
71     * Return a log target factory using a supplied factory key. If the
72     * supplied key is unknown a null value is returned.
73     * @param key the logging target factory key
74     * @return the logging target factory
75     */

76     public LogTargetFactory getLogTargetFactory( final String JavaDoc key )
77     {
78         return (LogTargetFactory) m_map.get( key );
79     }
80 }
81
Popular Tags