org.objectweb.speedo.naming.lib
Class LongIdNamingManager

java.lang.Object
  extended by org.objectweb.speedo.naming.lib.NamingManagerHelper
      extended by org.objectweb.speedo.naming.lib.CommonLongIdNamingManager
          extended by org.objectweb.speedo.naming.lib.LongIdNamingManager
All Implemented Interfaces:
NamingManager

public class LongIdNamingManager
extends CommonLongIdNamingManager

This is naming manager manages identifier based on a long value generated by Speedo, using a persistent generator (Speedo structure in database). The long value is composed of two parts. Some bits are used for the class identifier, and the rest is used to identify the object instance in the class. This identifier format supports very well the polymorphism. The null reference is represented by the -1 value. The long field can be a visible persistent field, otherwise it is hidden by Speedo/JORM implementation.

Author:
S.Chassande-Barrioz
See Also:
NamingManager, LongIdManager

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.objectweb.speedo.naming.api.NamingManager
NamingManager.NamingField
 
Field Summary
 
Fields inherited from class org.objectweb.speedo.naming.lib.NamingManagerHelper
BINDER_IDX, cache, HINTS_SEP, ID_CAT_IDX, logger, mapper, PCLASS_IDX, pmf, PNC_IDX, POLYMORPHIC_PNC
 
Fields inherited from interface org.objectweb.speedo.naming.api.NamingManager
PNH_NULL_VALUE, PNH_PFIELD, PNH_REF_STATE, SEP
 
Constructor Summary
LongIdNamingManager()
           
 
Method Summary
 boolean canManage(SpeedoClass sc)
          Indicates if the naming manager is able to manage the identifier of a persistent class.
protected  boolean checkFieldType(java.lang.String type)
          Checks if the field type is the one expected
protected  org.objectweb.jorm.naming.api.PName decodeLong(org.objectweb.jorm.naming.api.PNameCoder pnc, java.lang.String idStr)
          Decodes a string value into a PName.
 java.lang.Object encode(org.objectweb.jorm.naming.api.PName pn)
          Encodes a PName into a value.
protected  org.objectweb.medor.expression.lib.BasicOperand getBasicOperand()
           
protected  java.lang.String getBinderForClass()
           
protected  java.lang.String getBinderForGenClass()
           
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)
protected  java.lang.String getHiddenLidFieldName()
           
protected  java.lang.Class getJavaFieldType()
           
protected  java.lang.String getLongIdLid()
           
 java.lang.Class getLongIdManagerClass()
           
protected  java.lang.String getLongIdName()
           
 org.objectweb.jorm.api.PMapper getMapper()
           
protected  java.lang.String getName()
           
 java.lang.Class getPBinderClass()
           
 java.lang.Class getPNameClass()
           
 java.lang.Class getPNamingContextClass()
           
 org.objectweb.jorm.naming.api.PBinder newClassPBinder(java.lang.String className, java.lang.Object conn)
           
 org.objectweb.jorm.naming.api.PNamingContext newClassPNamingContext()
           
 org.objectweb.jorm.naming.api.PBinder newGenClassPBinder()
           
 void setPMapper(org.objectweb.jorm.api.PMapper mapper)
           
 
Methods inherited from class org.objectweb.speedo.naming.lib.CommonLongIdNamingManager
canProvidePBinder, canProvidePNamingContext, decode, defineClassIdentifierNameDef, defineClassReferenceNameDef, defineClassReferenceNameDef, defineGenClassIdentifierNameDef, defineGenClassReferenceNameDef, getDefaultColumn, getJormNamingConfig, getNamingfields, getPBinder, getPBinder, getPNameHints, getPNameHints2, getPNamingContext, init, needInheritanceDiscriminator, setCache, setLogger, setPmf, supportPNamingcontext
 
Methods inherited from class org.objectweb.speedo.naming.lib.NamingManagerHelper
getBinderClassNameFromHints, getPNCClassNameFromHints, getTokens
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongIdNamingManager

public LongIdNamingManager()
Method Detail

getLongIdName

protected java.lang.String getLongIdName()
Specified by:
getLongIdName in class CommonLongIdNamingManager
Returns:
the name of the composite name (JORM object) corresponding the identifier.

getLongIdLid

protected java.lang.String getLongIdLid()
Specified by:
getLongIdLid in class CommonLongIdNamingManager
Returns:
the default name of the identifier field.

getFieldType

protected org.objectweb.jorm.type.api.PType getFieldType()
Specified by:
getFieldType in class CommonLongIdNamingManager
Returns:
the default jorm type of the identifier field.

getJavaFieldType

protected java.lang.Class getJavaFieldType()
Specified by:
getJavaFieldType in class CommonLongIdNamingManager
Returns:
the default java type of the identifier field.

getBasicOperand

protected org.objectweb.medor.expression.lib.BasicOperand getBasicOperand()
Specified by:
getBasicOperand in class CommonLongIdNamingManager
Returns:
the operand (Medor object) used for computing the class identifier

checkFieldType

protected boolean checkFieldType(java.lang.String type)
Description copied from class: CommonLongIdNamingManager
Checks if the field type is the one expected

Specified by:
checkFieldType in class CommonLongIdNamingManager
Parameters:
type - is the field type as a string.
Returns:
true if this the right type.

getMapper

public org.objectweb.jorm.api.PMapper getMapper()
Specified by:
getMapper in class CommonLongIdNamingManager
Returns:
the mapper used

getName

protected java.lang.String getName()
Specified by:
getName in class NamingManagerHelper

newClassPBinder

public org.objectweb.jorm.naming.api.PBinder newClassPBinder(java.lang.String className,
                                                             java.lang.Object conn)
                                                      throws org.objectweb.jorm.api.PException
Specified by:
newClassPBinder in class CommonLongIdNamingManager
Parameters:
className - is the class name of the persistent class
conn - is the connection to the underlying persistent support.
Returns:
a new PBinder for managing class identifier.
Throws:
org.objectweb.jorm.api.PException

newClassPNamingContext

public org.objectweb.jorm.naming.api.PNamingContext newClassPNamingContext()
                                                                    throws org.objectweb.jorm.api.PException
Specified by:
newClassPNamingContext in class CommonLongIdNamingManager
Returns:
a new PBinder for managing class reference.
Throws:
org.objectweb.jorm.api.PException

newGenClassPBinder

public org.objectweb.jorm.naming.api.PBinder newGenClassPBinder()
                                                         throws org.objectweb.jorm.api.PException
Specified by:
newGenClassPBinder in class CommonLongIdNamingManager
Returns:
a new PBinder for managing GenClass identifier.
Throws:
org.objectweb.jorm.api.PException

setPMapper

public void setPMapper(org.objectweb.jorm.api.PMapper mapper)
Specified by:
setPMapper in interface NamingManager
Overrides:
setPMapper in class NamingManagerHelper

getLongIdManagerClass

public java.lang.Class getLongIdManagerClass()
Specified by:
getLongIdManagerClass in class CommonLongIdNamingManager
Returns:
the class of the IdManager used by this naming.

getPBinderClass

public java.lang.Class getPBinderClass()
Specified by:
getPBinderClass in class CommonLongIdNamingManager
Returns:
the class of the PBinder used by this naming.

getPNameClass

public java.lang.Class getPNameClass()
Specified by:
getPNameClass in class CommonLongIdNamingManager
Returns:
the class of the PName used by this naming.

getPNamingContextClass

public java.lang.Class getPNamingContextClass()
Specified by:
getPNamingContextClass in class CommonLongIdNamingManager
Returns:
the class of the PNamingContext used by this naming.

getBinderForGenClass

protected java.lang.String getBinderForGenClass()
Specified by:
getBinderForGenClass in class CommonLongIdNamingManager
Returns:
Returns the bINDER_FOR_GENCLASS.

getBinderForClass

protected java.lang.String getBinderForClass()
Specified by:
getBinderForClass in class CommonLongIdNamingManager
Returns:
Returns the bINDER_FOR_CLASS.

getHiddenLidFieldName

protected java.lang.String getHiddenLidFieldName()
Specified by:
getHiddenLidFieldName in class CommonLongIdNamingManager
Returns:
Returns the hIDDEN_LID_FIELD_NAME.

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
Specified by:
canManage in class CommonLongIdNamingManager
Parameters:
sc - The speedo meta object representing the persistent class

encode

public java.lang.Object encode(org.objectweb.jorm.naming.api.PName pn)
                        throws org.objectweb.jorm.api.PException
Description copied from class: CommonLongIdNamingManager
Encodes a PName into a value.

Specified by:
encode in interface NamingManager
Specified by:
encode in class CommonLongIdNamingManager
Parameters:
pn - is the PName to encode
Returns:
the encoded PName
Throws:
org.objectweb.jorm.api.PException

decodeLong

protected org.objectweb.jorm.naming.api.PName decodeLong(org.objectweb.jorm.naming.api.PNameCoder pnc,
                                                         java.lang.String idStr)
                                                  throws org.objectweb.jorm.api.PException
Description copied from class: CommonLongIdNamingManager
Decodes a string value into a PName.

Specified by:
decodeLong in class CommonLongIdNamingManager
Parameters:
pnc - is the PNameCoder able to decode the string
idStr - is the string representation of an identifier
Returns:
a PName
Throws:
org.objectweb.jorm.api.PException

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)

Parameters:
sc - is the Speedo class which the hints must be specified
nd - is the name def of the gen class