KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > security > realm > factory > JResourceFactory


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or 1any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: JResourceFactory.java,v 1.5 2004/10/08 07:24:13 benoitf Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas.security.realm.factory;
28
29 //import java
30
import java.util.Hashtable JavaDoc;
31
32 import javax.naming.Context JavaDoc;
33 import javax.naming.Name JavaDoc;
34 import javax.naming.spi.ObjectFactory JavaDoc;
35
36 import org.objectweb.jonas.common.Log;
37
38 import org.objectweb.util.monolog.api.Logger;
39
40 /**
41  * This class provides an implementation of the abstract JResource factory for
42  * managing users
43  * @author Florent Benoit
44  */

45 public abstract class JResourceFactory implements ObjectFactory JavaDoc {
46
47     /**
48      * The logger used in JOnAS
49      */

50     private static Logger logger = Log.getLogger(Log.JONAS_SECURITY_PREFIX);
51
52     /**
53      * Creates a object using the location or reference information specified.
54      * @param obj the possibly null object containing location or reference
55      * information that can be used in creating an object.
56      * @param name the name of this object relative to nameCtx, or null if no
57      * name is specified.
58      * @param nameCtx the context relative to which the name parameter is
59      * specified, or null if name is relative to the default initial
60      * context.
61      * @param environment the possibly null environment that is used in creating
62      * the object.
63      * @return a newly created object with the specific configuration; null if
64      * an object cannot be created.
65      * @throws Exception if this object factory encountered an exception while
66      * attempting to create an object, and no other object factories are
67      * to be tried.
68      */

69     public abstract Object JavaDoc getObjectInstance(Object JavaDoc obj, Name JavaDoc name, Context JavaDoc nameCtx, Hashtable JavaDoc environment)
70             throws Exception JavaDoc;
71
72     /**
73      * @return Returns the logger.
74      */

75     public static Logger getLogger() {
76         return logger;
77     }
78     /**
79      * @param logger The logger to set.
80      */

81     public static void setLogger(Logger logger) {
82         JResourceFactory.logger = logger;
83     }
84 }
Popular Tags