org.bsf.remoting.util.naming
Class PropertiesICFactory

java.lang.Object
  |
  +--org.bsf.remoting.util.naming.PropertiesICFactory
All Implemented Interfaces:
InitialContextFactory

public class PropertiesICFactory
extends java.lang.Object
implements InitialContextFactory

This class allows to create an Initial context depending on a property file. The normal use is to set the properties ressources and then to call the getInitialContext() that will returns the cached initial context. However, another solution is to call the static method getInitialContext(String ) that allows the use of different Initial contexts in the same JVM This is usefull when more than one IC can be used in the same JVM.

Author:
Gaetan Zoritchak

Field Summary
private  javax.naming.Context _ic
           
private  java.lang.String _propertiesRessources
           
 
Constructor Summary
PropertiesICFactory()
           
 
Method Summary
static javax.naming.Context createInitialContext(java.lang.String propertiesRessource)
          Creates a new Initial context using the ressource properties.
 javax.naming.Context getInitialContext()
           
private  void loadICInstance()
          Instantiates the Initial context according to the properties.
 void setPropertiesRessources(java.lang.String propertiesRessources)
          sets the properties ressource and load the Initial context corresponding to the ressource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_propertiesRessources

private java.lang.String _propertiesRessources

_ic

private javax.naming.Context _ic
Constructor Detail

PropertiesICFactory

public PropertiesICFactory()
Method Detail

setPropertiesRessources

public void setPropertiesRessources(java.lang.String propertiesRessources)
sets the properties ressource and load the Initial context corresponding to the ressource.


loadICInstance

private void loadICInstance()
Instantiates the Initial context according to the properties.


getInitialContext

public javax.naming.Context getInitialContext()
Specified by:
getInitialContext in interface InitialContextFactory
Returns:
the cached initial context.

createInitialContext

public static javax.naming.Context createInitialContext(java.lang.String propertiesRessource)
Creates a new Initial context using the ressource properties.