org.objectweb.speedo.naming.lib
Class NamingManagerFactory

java.lang.Object
  extended by org.objectweb.speedo.naming.lib.NamingManagerFactory
All Implemented Interfaces:
BindingController, LifeCycleController, NamingManagerFactoryItf

public class NamingManagerFactory
extends java.lang.Object
implements NamingManagerFactoryItf, BindingController, LifeCycleController

This small fractal component is in charge of the naming specialization in Speedo. This component is a factory of NamingManager. Each NamingManager manages a type of naming. Currently Speedo provides the following naming manager implementations: - UserIdCompositeNamingManager - UserIdSingleNamingManager - LongIdNamingManager - OLongIdNamingManager - RdbSequenceNamingManager The NamingManagerFactory has 3 dependencies: - The CacheManager permits for some PNamingContext to lookup persistent object in the cache before doing I/O (polymorphism case for instance). - The POManagerFactory permits to fetch the SequenceManager associated to the POMF. - The PMapper permits to NamingManager to use some internal persistent classes (ex generator).

Author:
S.Chassande-Barrioz
See Also:
NamingManager, UserIdSingleNamingManager, UserIdCompositeNamingManager, RdbSequenceNamingManager, LongIdNamingManager, OLongIdNamingManager, PolymorphIdNamingManager

Field Summary
static java.lang.String CACHE_MANAGER_BINDING
          fractal binding name to the cache manager
static java.lang.String MAPPER_BINDING
          fractal binding name to the mapper
static java.lang.String PMF_BINDING
           
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
NamingManagerFactory()
           
 
Method Summary
 void bindFc(java.lang.String s, java.lang.Object o)
           
 void bindNamingManager(NamingManager nm)
          Binds a new NamaingManager in this factory
 void clean()
          Clean the nmf.
 org.objectweb.jorm.naming.api.PName decode(org.objectweb.jorm.naming.api.PNameCoder pnc, java.lang.Object oid, java.lang.Class clazz, JormFactory jf)
          Decodes an object identifer into a PName.
 java.lang.Object encode(org.objectweb.jorm.naming.api.PName pn)
          Encodes the persistent identifier (PName) into an object identifier usable, externaly to the Speedo system.
 CacheManager getCache()
           
 java.lang.String getFcState()
           
 org.objectweb.util.monolog.api.Logger getLogger()
           
 org.objectweb.jorm.api.PMapper getMapper()
           
 NamingManager getNamingManager(SpeedoClass sc)
           
 NamingManager getNamingManager(java.lang.String hints, java.lang.ClassLoader classloader)
           
 POManagerFactoryItf getPmf()
           
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String s)
           
 void setCache(CacheManager cache)
           
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
           
 void setMapper(org.objectweb.jorm.api.PMapper mapper)
           
 void setPmf(POManagerFactoryItf pmf)
           
 void startFc()
           
 void stopFc()
           
 void unbindFc(java.lang.String s)
           
 boolean unbindNamingManager(NamingManager nm)
          Unbinds an existing NamaingManager in this factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAPPER_BINDING

public static final java.lang.String MAPPER_BINDING
fractal binding name to the mapper

See Also:
Constant Field Values

CACHE_MANAGER_BINDING

public static final java.lang.String CACHE_MANAGER_BINDING
fractal binding name to the cache manager

See Also:
Constant Field Values

PMF_BINDING

public static final java.lang.String PMF_BINDING
See Also:
Constant Field Values
Constructor Detail

NamingManagerFactory

public NamingManagerFactory()
Method Detail

getMapper

public org.objectweb.jorm.api.PMapper getMapper()

setMapper

public void setMapper(org.objectweb.jorm.api.PMapper mapper)

getCache

public CacheManager getCache()

setCache

public void setCache(CacheManager cache)

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface BindingController

lookupFc

public java.lang.Object lookupFc(java.lang.String s)
Specified by:
lookupFc in interface BindingController

bindFc

public void bindFc(java.lang.String s,
                   java.lang.Object o)
Specified by:
bindFc in interface BindingController

unbindFc

public void unbindFc(java.lang.String s)
Specified by:
unbindFc in interface BindingController

getFcState

public java.lang.String getFcState()
Specified by:
getFcState in interface LifeCycleController

startFc

public void startFc()
             throws IllegalLifeCycleException
Specified by:
startFc in interface LifeCycleController
Throws:
IllegalLifeCycleException

stopFc

public void stopFc()
            throws IllegalLifeCycleException
Specified by:
stopFc in interface LifeCycleController
Throws:
IllegalLifeCycleException

getPmf

public POManagerFactoryItf getPmf()

setPmf

public void setPmf(POManagerFactoryItf pmf)

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)

bindNamingManager

public void bindNamingManager(NamingManager nm)
Description copied from interface: NamingManagerFactoryItf
Binds a new NamaingManager in this factory

Specified by:
bindNamingManager in interface NamingManagerFactoryItf
Parameters:
nm - is the new NamingManager instance

unbindNamingManager

public boolean unbindNamingManager(NamingManager nm)
Description copied from interface: NamingManagerFactoryItf
Unbinds an existing NamaingManager in this factory

Specified by:
unbindNamingManager in interface NamingManagerFactoryItf
Parameters:
nm - is the NamingManager instance to forget
Returns:
true is the NamingManager has been really found and therefore forgoten.

getNamingManager

public NamingManager getNamingManager(SpeedoClass sc)
                               throws SpeedoException
Specified by:
getNamingManager in interface NamingManagerFactoryItf
Parameters:
sc - is the speedo meta object representing the persistent class.
Returns:
the NamingManager instance able to manage the identifier of a persistent class.
Throws:
SpeedoException - if no NamingManager can manage the persistent class.

getNamingManager

public NamingManager getNamingManager(java.lang.String hints,
                                      java.lang.ClassLoader classloader)
                               throws org.objectweb.jorm.api.PException
Specified by:
getNamingManager in interface NamingManagerFactoryItf
Parameters:
hints - is string value containing information permitting to find the naming manager required.
classloader - is the class loader of the application.
Returns:
the NamingManager instance able to manage the identifier of a persistent class.
Throws:
org.objectweb.jorm.api.PException

decode

public org.objectweb.jorm.naming.api.PName decode(org.objectweb.jorm.naming.api.PNameCoder pnc,
                                                  java.lang.Object oid,
                                                  java.lang.Class clazz,
                                                  JormFactory jf)
                                           throws org.objectweb.jorm.api.PException
Description copied from interface: NamingManagerFactoryItf
Decodes an object identifer into a PName.

Specified by:
decode in interface NamingManagerFactoryItf
Parameters:
pnc - is the PNamingContext managing the naming of the referenced persistent class
oid - is the object identifier
clazz - is the java class of the referenced class. this paramter permits of course to access to the class loader of the application.
jf - is the JormFactory managing the persistent class.
Returns:
a PName (JORM identifier of persistent class)
Throws:
org.objectweb.jorm.api.PException - if it is not possible to decode the object identifier corresponding to the specified class.
See Also:
NamingManagerFactoryItf.encode(PName)

encode

public java.lang.Object encode(org.objectweb.jorm.naming.api.PName pn)
                        throws org.objectweb.jorm.api.PException
Description copied from interface: NamingManagerFactoryItf
Encodes the persistent identifier (PName) into an object identifier usable, externaly to the Speedo system.

Specified by:
encode in interface NamingManagerFactoryItf
Parameters:
pn - is the Pname to encode
Throws:
org.objectweb.jorm.api.PException
See Also:
NamingManagerFactoryItf.decode(PNameCoder, Object, java.lang.Class, JormFactory)

clean

public void clean()
Clean the nmf.

Specified by:
clean in interface NamingManagerFactoryItf