org.objectweb.speedo.naming.lib
Class OLongIdNamingManager

java.lang.Object
  extended byorg.objectweb.jorm.facility.naming.olongid.LongIdManager
      extended byorg.objectweb.speedo.naming.lib.OLongIdNamingManager
All Implemented Interfaces:
NamingManager

public class OLongIdNamingManager
extends org.objectweb.jorm.facility.naming.olongid.LongIdManager
implements NamingManager

Author:
S.Chassande-Barrioz

Nested Class Summary
 
Nested classes inherited from class org.objectweb.speedo.naming.api.NamingManager
NamingManager.NamingField
 
Field Summary
 
Fields inherited from class org.objectweb.jorm.facility.naming.olongid.LongIdManager
CLASS_ID_NAME, DEFAULT_CID_SIZE, ID_CLASS_NAME, LONG_SIZE
 
Fields inherited from interface org.objectweb.speedo.naming.api.NamingManager
SEP
 
Constructor Summary
OLongIdNamingManager()
           
 
Method Summary
 boolean canManage(SpeedoClass sc)
          Indicates if the naming manager is able to manage the identifier of a persistent class.
 boolean canProvidePBinder(java.lang.Object hints, java.lang.ClassLoader classLoader)
          indicates if the naming manager is able to build a PBinder instance for this hints parameter specified
 boolean canProvidePNamingContext(java.lang.Object hints, java.lang.ClassLoader classLoader)
          indicates if the naming manager is able to build a PNC instance for this hints parameter specified
protected  boolean checkFieldType(java.lang.String type)
           
 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 identifier into a PName.
 java.lang.Object encode(org.objectweb.jorm.naming.api.PName pn)
          Encode a PName into an object
 void fillNameDef(MIBuilderHelper mibh, org.objectweb.jorm.metainfo.api.Manager manager, org.objectweb.jorm.metainfo.api.NameDef nd, SpeedoClass tsc, SpeedoClass ssc, org.objectweb.jorm.metainfo.api.MetaObject mo, org.objectweb.jorm.metainfo.api.Reference ref, org.objectweb.jorm.metainfo.api.CommonClassMapping hcm, JormMIMappingBuilder mb, boolean isIdentifier, boolean isInGenClass, boolean createField, java.util.Collection createdMOs)
          Fill the name def of an identifier or a reference
protected  org.objectweb.medor.expression.lib.BasicOperand getBasicOperand()
           
protected  org.objectweb.jorm.type.api.PType getFieldType()
           
 java.lang.String getGCPNameHints(SpeedoClass sc, org.objectweb.jorm.metainfo.api.NameDef nd)
          compute a string value which permit to help the building of the genclass PName (export)
 void getJormNamingConfig(org.objectweb.jorm.metainfo.api.NameDef nd, SpeedoClass targetClass, org.objectweb.jorm.metainfo.api.MetaObject sourceMO, java.lang.String key, java.util.Properties result)
          computes the naming configuration information for a class or a reference.
 NamingManager.NamingField[] getNamingfields(SpeedoClass sc)
          Retrieves the array of field used in the identifier of a persistent class and which values are not calculated by the application.
 org.objectweb.jorm.naming.api.PBinder getPBinder(java.lang.String className, java.lang.String hints, java.lang.ClassLoader classLoader, byte mappingStructureRule, java.util.Map cn2binder, java.util.Map cn2pnc)
          Build a PBinder instance for this hints parameter specified
 java.lang.String getPNameHints(SpeedoClass sc, org.objectweb.jorm.metainfo.api.NameDef nd)
          compute a string value which permit to help the building of the class PName (export)
 org.objectweb.jorm.naming.api.PNamingContext getPNamingContext(java.lang.String className, java.lang.String hints, java.lang.ClassLoader classLoader, byte mappingStructureRule, java.util.Map cn2binder, java.util.Map cn2pnc, org.objectweb.jorm.metainfo.api.Manager miManager, org.objectweb.jorm.api.PClassMapping pcm)
          Build a PNamingContext instance for this hints parameter specified
 void init()
           
protected  java.lang.String LONG_ID_LID()
           
protected  java.lang.String LONG_ID_NAME()
           
 void setCache(org.objectweb.perseus.cache.api.CacheManager cache)
           
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
           
 void setPMapper(org.objectweb.jorm.api.PMapper mapper)
           
 void setPmf(ProxyManagerFactory pmf)
           
 boolean supportPNamingcontext()
          indicates if the use of PNamingContext is support by this mapping.
 
Methods inherited from class org.objectweb.jorm.facility.naming.olongid.LongIdManager
getCidSize, getMapper, newClassPBinder, newClassPNamingContext, newGenClassPBinder, setCidSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OLongIdNamingManager

public OLongIdNamingManager()
Method Detail

LONG_ID_NAME

protected java.lang.String LONG_ID_NAME()

LONG_ID_LID

protected java.lang.String LONG_ID_LID()

getFieldType

protected org.objectweb.jorm.type.api.PType getFieldType()

getBasicOperand

protected org.objectweb.medor.expression.lib.BasicOperand getBasicOperand()

checkFieldType

protected boolean checkFieldType(java.lang.String type)

init

public void init()
          throws org.objectweb.jorm.api.PException
Throws:
org.objectweb.jorm.api.PException

setPMapper

public void setPMapper(org.objectweb.jorm.api.PMapper mapper)
                throws org.objectweb.jorm.api.PException
Specified by:
setPMapper in interface NamingManager
Throws:
org.objectweb.jorm.api.PException

setPmf

public void setPmf(ProxyManagerFactory pmf)
Specified by:
setPmf in interface NamingManager

supportPNamingcontext

public boolean supportPNamingcontext()
Description copied from interface: NamingManager
indicates if the use of PNamingContext is support by this mapping. If true then getPNamingContext method can be use, otherwise the getPBinder must be use instead. The case of PNamingContext are not supported, means the PBinder are used as PNameCoder by PBinding as reference coder.

Specified by:
supportPNamingcontext in interface NamingManager

canManage

public boolean canManage(SpeedoClass sc)
Description copied from interface: NamingManager
Indicates if the naming manager is able to manage the identifier of a persistent class.

Specified by:
canManage in interface NamingManager
Parameters:
sc - The speedo meta object representing the persistent class

canProvidePBinder

public boolean canProvidePBinder(java.lang.Object hints,
                                 java.lang.ClassLoader classLoader)
Description copied from interface: NamingManager
indicates if the naming manager is able to build a PBinder instance for this hints parameter specified

Specified by:
canProvidePBinder in interface NamingManager
Parameters:
hints - is the helper of the PBinder building
classLoader - is the classloader to use for instanciate the PBinder

canProvidePNamingContext

public boolean canProvidePNamingContext(java.lang.Object hints,
                                        java.lang.ClassLoader classLoader)
Description copied from interface: NamingManager
indicates if the naming manager is able to build a PNC instance for this hints parameter specified

Specified by:
canProvidePNamingContext in interface NamingManager
Parameters:
hints - is the helper of the PNC building
classLoader - is the classloader to use for instanciate the PNC

encode

public java.lang.Object encode(org.objectweb.jorm.naming.api.PName pn)
                        throws org.objectweb.jorm.api.PException
Description copied from interface: NamingManager
Encode a PName into an object

Specified by:
encode in interface NamingManager
Parameters:
pn - is the pname to encode
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: NamingManager
Decodes an object identifier into a PName.

Specified by:
decode in interface NamingManager
Parameters:
pnc - is the PNameCoder instance to use for the decoding the object identifier. The pnc parameter can be null. In this case the oid must
oid - is the object identifier
clazz - is the java.lang.Class of the persistent class identified by the oid
jf - is the JormFactory instance. It permits to
Returns:
the object identifier decode as PName
Throws:
org.objectweb.jorm.api.PException

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)
Specified by:
setLogger in interface NamingManager

getPNameHints

public java.lang.String getPNameHints(SpeedoClass sc,
                                      org.objectweb.jorm.metainfo.api.NameDef nd)
Description copied from interface: NamingManager
compute a string value which permit to help the building of the class PName (export)

Specified by:
getPNameHints in interface NamingManager
Parameters:
sc - is the Speedo class which the hints must be specified
nd - is the name def of the class

getGCPNameHints

public java.lang.String getGCPNameHints(SpeedoClass sc,
                                        org.objectweb.jorm.metainfo.api.NameDef nd)
Description copied from interface: NamingManager
compute a string value which permit to help the building of the genclass PName (export)

Specified by:
getGCPNameHints in interface NamingManager
Parameters:
sc - is the Speedo class which the hints must be specified
nd - is the name def of the gen class

getNamingfields

public NamingManager.NamingField[] getNamingfields(SpeedoClass sc)
Description copied from interface: NamingManager
Retrieves the array of field used in the identifier of a persistent class and which values are not calculated by the application. The application field must be set at makePersistent time.

Specified by:
getNamingfields in interface NamingManager
Parameters:
sc - is the speedo meta object of the persistent class

fillNameDef

public void fillNameDef(MIBuilderHelper mibh,
                        org.objectweb.jorm.metainfo.api.Manager manager,
                        org.objectweb.jorm.metainfo.api.NameDef nd,
                        SpeedoClass tsc,
                        SpeedoClass ssc,
                        org.objectweb.jorm.metainfo.api.MetaObject mo,
                        org.objectweb.jorm.metainfo.api.Reference ref,
                        org.objectweb.jorm.metainfo.api.CommonClassMapping hcm,
                        JormMIMappingBuilder mb,
                        boolean isIdentifier,
                        boolean isInGenClass,
                        boolean createField,
                        java.util.Collection createdMOs)
                 throws SpeedoException,
                        org.objectweb.jorm.api.PException
Description copied from interface: NamingManager
Fill the name def of an identifier or a reference

Specified by:
fillNameDef in interface NamingManager
Parameters:
nd - is the name def to fill
isIdentifier - indicates if the name represents an identifier (true) or a reference (false).
isInGenClass - indicates if the name is defined in a generic class (true) of in a class (false).
ref - meta object which the name def must be defined. This value is used only in the case of isIdentifier == false and isInGenClass == false.
tsc - is the speedo meta object representing the referenced class. This value is used only in the case of isIdentifier == false.
mo - is the jorm meta object hosting the name def and on which the eventual hidden field will be created.
hcm - if the mapping structure hosting the mapping of the reference. This value must be ClassMapping or GenClassMapping instance.
mb - is the mapping builder permitting the creation of the mapping part.
createdMOs - is a result paramter. This collection must be fill with the created Jorm Meta objects representing a class or a composite name. Here only the new used composite name will be added.
Throws:
SpeedoException - if the speedo meta information is not completly defined.
org.objectweb.jorm.api.PException

getJormNamingConfig

public void getJormNamingConfig(org.objectweb.jorm.metainfo.api.NameDef nd,
                                SpeedoClass targetClass,
                                org.objectweb.jorm.metainfo.api.MetaObject sourceMO,
                                java.lang.String key,
                                java.util.Properties result)
Description copied from interface: NamingManager
computes the naming configuration information for a class or a reference. This information is store as a String. The string value will be passed to the getPBinder and getPNamingContext methods as hints. This method is used at generation time.
naming of a/td>MOClass/td>
class/td>Class/td>
reference to a Class/td>ClassRef/td>
reference to a GenClass/td>GenClassRef/td>
a GenClass identifier/td>GenClassRef/td>

Specified by:
getJormNamingConfig in interface NamingManager
Parameters:
targetClass - is the Speedo meta object representing the class which is designates by the
result - is the Properties which must be filled

getPBinder

public org.objectweb.jorm.naming.api.PBinder getPBinder(java.lang.String className,
                                                        java.lang.String hints,
                                                        java.lang.ClassLoader classLoader,
                                                        byte mappingStructureRule,
                                                        java.util.Map cn2binder,
                                                        java.util.Map cn2pnc)
                                                 throws org.objectweb.jorm.api.PException
Description copied from interface: NamingManager
Build a PBinder instance for this hints parameter specified

Specified by:
getPBinder in interface NamingManager
Parameters:
hints - is the helper of the PBinder building. This hints must be the result of the getJormConfig call.
classLoader - is the classloader to use for instanciate the PBinder
mappingStructureRule - indicates the rule to apply concerning the data strucuture. Indeed a PBinder building can require to read the data support.
cn2binder - is the map of the existing PBinder instance (key = class name, value = PBinder instance)
cn2pnc - is the map of the existing PNC instance (key = class name, value = PNC instance)
Throws:
org.objectweb.jorm.api.PException

getPNamingContext

public org.objectweb.jorm.naming.api.PNamingContext getPNamingContext(java.lang.String className,
                                                                      java.lang.String hints,
                                                                      java.lang.ClassLoader classLoader,
                                                                      byte mappingStructureRule,
                                                                      java.util.Map cn2binder,
                                                                      java.util.Map cn2pnc,
                                                                      org.objectweb.jorm.metainfo.api.Manager miManager,
                                                                      org.objectweb.jorm.api.PClassMapping pcm)
                                                               throws org.objectweb.jorm.api.PException
Description copied from interface: NamingManager
Build a PNamingContext instance for this hints parameter specified

Specified by:
getPNamingContext in interface NamingManager
Parameters:
hints - is the helper of the PBinder building. This hints must be the result of the getJormConfig call.
classLoader - is the classloader to use for instanciate the PBinder
mappingStructureRule - indicates the rule to apply concerning the data strucuture. Indeed a PBinder building can require to read the data support.
cn2binder - is the map of the existing PBinder instance (key = class name, value = PBinder instance)
cn2pnc - is the map of the existing PNC instance (key = class name, value = PNC instance)
Throws:
org.objectweb.jorm.api.PException

setCache

public void setCache(org.objectweb.perseus.cache.api.CacheManager cache)
Specified by:
setCache in interface NamingManager