01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2004 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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 5577 2004-10-08 07:24:13Z benoitf $
24: * --------------------------------------------------------------------------
25: */package org.objectweb.jonas.security.realm.factory;
26:
27: //import java
28: import java.util.Hashtable;
29:
30: import javax.naming.Context;
31: import javax.naming.Name;
32: import javax.naming.spi.ObjectFactory;
33:
34: import org.objectweb.jonas.common.Log;
35:
36: import org.objectweb.util.monolog.api.Logger;
37:
38: /**
39: * This class provides an implementation of the abstract JResource factory for
40: * managing users
41: * @author Florent Benoit
42: */
43: public abstract class JResourceFactory implements ObjectFactory {
44:
45: /**
46: * The logger used in JOnAS
47: */
48: private static Logger logger = Log
49: .getLogger(Log.JONAS_SECURITY_PREFIX);
50:
51: /**
52: * Creates a object using the location or reference information specified.
53: * @param obj the possibly null object containing location or reference
54: * information that can be used in creating an object.
55: * @param name the name of this object relative to nameCtx, or null if no
56: * name is specified.
57: * @param nameCtx the context relative to which the name parameter is
58: * specified, or null if name is relative to the default initial
59: * context.
60: * @param environment the possibly null environment that is used in creating
61: * the object.
62: * @return a newly created object with the specific configuration; null if
63: * an object cannot be created.
64: * @throws Exception if this object factory encountered an exception while
65: * attempting to create an object, and no other object factories are
66: * to be tried.
67: */
68: public abstract Object getObjectInstance(Object obj, Name name,
69: Context nameCtx, Hashtable environment) throws Exception;
70:
71: /**
72: * @return Returns the logger.
73: */
74: public static Logger getLogger() {
75: return logger;
76: }
77:
78: /**
79: * @param logger The logger to set.
80: */
81: public static void setLogger(Logger logger) {
82: JResourceFactory.logger = logger;
83: }
84: }
|