KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > jndi > spi > JRMPContextWrapperFactory


1 /**
2  * Copyright (C) 2002,2004 - INRIA (www.inria.fr)
3  *
4  * CAROL: Common Architecture for RMI ObjectWeb Layer
5  *
6  * This library is developed inside the ObjectWeb Consortium,
7  * http://www.objectweb.org
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22  * USA
23  *
24  * --------------------------------------------------------------------------
25  * $Id: JRMPContextWrapperFactory.java,v 1.5 2005/03/10 10:05:01 benoitf Exp $
26  * --------------------------------------------------------------------------
27  */

28 package org.objectweb.carol.jndi.spi;
29
30 import javax.naming.spi.InitialContextFactory JavaDoc;
31
32 import org.objectweb.carol.jndi.ns.JRMPRegistry;
33 import org.objectweb.carol.util.configuration.CarolDefaultValues;
34
35 /**
36  * Class <code> JRMPContextWrapperFactory </code> is the CAROL
37  * JNDI Context factory. This context factory build the jrmp context for
38  * reference wrapping to/from a remote object
39  * @author Guillaume Riviere
40  * @author Florent Benoit (refactoring)
41  * @see javax.naming.spi.InitialContextFactory
42  */

43 public class JRMPContextWrapperFactory extends AbsInitialContextFactory implements InitialContextFactory JavaDoc {
44
45     /**
46      * Referencing factory
47      */

48     public static final String JavaDoc REFERENCING_FACTORY = "com.sun.jndi.rmi.registry.RegistryContextFactory";
49
50     /**
51      * @return the real factory of this wrapper
52      */

53     protected String JavaDoc getReferencingFactory() {
54         return REFERENCING_FACTORY;
55     }
56
57     /**
58      * @return class of the wrapper (to be instantiated + pool).
59      */

60     protected Class JavaDoc getWrapperClass() {
61         boolean localO = new Boolean JavaDoc(System.getProperty(CarolDefaultValues.LOCAL_JRMP_PROPERTY, "false")).booleanValue();
62         if ((localO) && JRMPRegistry.isLocal()) {
63             return JRMPLocalContext.class;
64         } else {
65             return JRMPContext.class;
66         }
67     }
68
69 }
Popular Tags