org.objectweb.speedo.naming.lib
Class RdbSequenceNamingManager
java.lang.Object
org.objectweb.speedo.naming.lib.NamingManagerHelper
org.objectweb.speedo.naming.lib.RdbSequenceNamingManager
- All Implemented Interfaces:
- NamingManager
public class RdbSequenceNamingManager
- extends NamingManagerHelper
- implements NamingManager
This is naming manager manages identifier based sequence in database (SQL
sequence or simple counter managed by Speedo).
This identifier can be mapped over a persistent field (type must be long or
java.lang.Long). This identifier format does not support polymorphism directly.
You have to specify discriminator(s). But in all case, this naming is not an
efficient choice when there is polymorphism (ex inheritance). Indeed SQL request
to find a corresponding object is more complex. The null reference depends on
the field type: -1 for long field and NULL or java.lang.Long field type.
- Author:
- S.Chassande-Barrioz
- See Also:
NamingManager
,
SpeedoSequence
,
SpeedoSequenceBinder
,
RdbSequenceBinder
Method Summary |
boolean |
canManage(SpeedoClass sc)
Indicates if the naming manager is able to manage the identifier of a
persistent class. |
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. |
void |
defineClassIdentifierNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.Class jc,
SpeedoClass sc,
org.objectweb.jorm.metainfo.api.ClassMapping cm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb,
java.util.Collection createdMOs)
Fill the name def of a class identifier |
void |
defineClassReferenceNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.ClassRef cr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.ClassMapping cm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
Fill the name def of the class reference from a class |
void |
defineClassReferenceNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.ClassRef cr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
Fill the name def of the class reference from a generic class |
void |
defineGenClassIdentifierNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.GenClassRef gcr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
Fill the name def of the gen class identifier |
void |
defineGenClassReferenceNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.GenClassRef gcr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.ClassMapping cm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
Fill the name def of the generic class reference from a class |
java.lang.Object |
encode(org.objectweb.jorm.naming.api.PName pn)
Encode a PName into an object |
SpeedoColumn[] |
getDefaultColumn(SpeedoClass sc)
|
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. |
protected java.lang.String |
getName()
|
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 cl,
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) |
java.lang.Object[] |
getPNameHints2(SpeedoClass sc,
org.objectweb.jorm.metainfo.api.NameDef nd)
|
Methods inherited from class org.objectweb.speedo.naming.lib.NamingManagerHelper |
canProvidePBinder, canProvidePNamingContext, getBinderClassNameFromHints, getPNamingContext, getPNCClassNameFromHints, getTokens, needInheritanceDiscriminator, setCache, setLogger, setPMapper, setPmf, supportPNamingcontext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEQ_NAME_IDX
public static final int SEQ_NAME_IDX
- See Also:
- Constant Field Values
SEQ_INCREMENT_IDX
public static final int SEQ_INCREMENT_IDX
- See Also:
- Constant Field Values
SEQ_STARTID_IDX
public static final int SEQ_STARTID_IDX
- See Also:
- Constant Field Values
SEQ_CACHE_IDX
public static final int SEQ_CACHE_IDX
- See Also:
- Constant Field Values
SEQ_ALLOCATOR_IDX
public static final int SEQ_ALLOCATOR_IDX
- See Also:
- Constant Field Values
RdbSequenceNamingManager
public RdbSequenceNamingManager()
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
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 mustoid
- is the object identifierclazz
- is the java.lang.Class of the persistent class identified by
the oidjf
- is the JormFactory instance. It permits to
- Returns:
- the object identifier decode as PName
- Throws:
org.objectweb.jorm.api.PException
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
getName
protected java.lang.String getName()
- Specified by:
getName
in class NamingManagerHelper
getPBinder
public org.objectweb.jorm.naming.api.PBinder getPBinder(java.lang.String className,
java.lang.String hints,
java.lang.ClassLoader cl,
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
- Overrides:
getPBinder
in class NamingManagerHelper
hints
- is the helper of the PBinder building. This hints must be
the result of the getJormConfig call.cl
- is the classloader to use for instanciate the PBindermappingStructureRule
- 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
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)
throws SpeedoException
- 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
targetClass
- is the Speedo meta object representing the class which
is designates by theresult
- is the Properties which must be filled
- Throws:
SpeedoException
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 specifiednd
- is the name def of the class
getPNameHints2
public java.lang.Object[] getPNameHints2(SpeedoClass sc,
org.objectweb.jorm.metainfo.api.NameDef nd)
- Specified by:
getPNameHints2
in interface NamingManager
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 specifiednd
- is the name def of the gen class
defineClassIdentifierNameDef
public void defineClassIdentifierNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.Class jc,
SpeedoClass sc,
org.objectweb.jorm.metainfo.api.ClassMapping cm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb,
java.util.Collection createdMOs)
throws SpeedoException,
org.objectweb.jorm.api.PException
- Description copied from interface:
NamingManager
- Fill the name def of a class identifier
- Specified by:
defineClassIdentifierNameDef
in interface NamingManager
- Parameters:
nd
- is the name def to filljc
- is the jorm meta object representing the class.sc
- is the speedo meta object representing the class.cm
- if the mapping structure hosting the mapping of the class.mibh
- is a helper for the management of the JORM meta infomb
- is the mapping builder permitting the creation of the mapping
objects.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 composite names have to be added.
- Throws:
SpeedoException
- if the speedo meta information is not completly
defined.
org.objectweb.jorm.api.PException
defineClassReferenceNameDef
public void defineClassReferenceNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.ClassRef cr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.ClassMapping cm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
throws SpeedoException,
org.objectweb.jorm.api.PException
- Description copied from interface:
NamingManager
- Fill the name def of the class reference from a class
- Specified by:
defineClassReferenceNameDef
in interface NamingManager
- Parameters:
nd
- is the name def to fillcr
- is the speedo meta object representing the class.sf
- is the speedo meta object representing the persistent
reference to a class.currentClass
- is the class mapping the fieldcm
- if the mapping structure hosting the mapping of the class.mibh
- is a helper for the management of the JORM meta infomb
- is the mapping builder permitting the creation of the mapping
objects.
- Throws:
SpeedoException
- if the speedo meta information is not completly
defined.
org.objectweb.jorm.api.PException
defineClassReferenceNameDef
public void defineClassReferenceNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.ClassRef cr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
throws SpeedoException,
org.objectweb.jorm.api.PException
- Description copied from interface:
NamingManager
- Fill the name def of the class reference from a generic class
- Specified by:
defineClassReferenceNameDef
in interface NamingManager
- Parameters:
nd
- is the name def to fillcr
- is the speedo meta object representing the class.sf
- is the speedo meta object representing the persistent
reference to a class.currentClass
- is the class mapping the fieldgcm
- if the mapping structure hosting the mapping of the class.mibh
- is a helper for the management of the JORM meta infomb
- is the mapping builder permitting the creation of the mapping
objects.
- Throws:
SpeedoException
- if the speedo meta information is not completly
defined.
org.objectweb.jorm.api.PException
defineGenClassIdentifierNameDef
public void defineGenClassIdentifierNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.GenClassRef gcr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.GenClassMapping gcm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
throws SpeedoException,
org.objectweb.jorm.api.PException
- Description copied from interface:
NamingManager
- Fill the name def of the gen class identifier
- Specified by:
defineGenClassIdentifierNameDef
in interface NamingManager
- Parameters:
nd
- is the name def to fillgcr
- is the JORM meta object representing the generic class
reference.sf
- is the speedo meta object representing the persistent
reference to a generic class.currentClass
- is the class mapping the fieldgcm
- if the mapping structure hosting the mapping of the generic class.mibh
- is a helper for the management of the JORM meta infomb
- is the mapping builder permitting the creation of the mapping
objects.
- Throws:
SpeedoException
- if the speedo meta information is not completly
defined.
org.objectweb.jorm.api.PException
defineGenClassReferenceNameDef
public void defineGenClassReferenceNameDef(org.objectweb.jorm.metainfo.api.NameDef nd,
org.objectweb.jorm.metainfo.api.GenClassRef gcr,
SpeedoField sf,
SpeedoClass currentClass,
org.objectweb.jorm.metainfo.api.ClassMapping cm,
MIBuilderHelper mibh,
JormMIMappingBuilder mb)
throws SpeedoException,
org.objectweb.jorm.api.PException
- Description copied from interface:
NamingManager
- Fill the name def of the generic class reference from a class
- Specified by:
defineGenClassReferenceNameDef
in interface NamingManager
- Parameters:
nd
- is the name def to fillgcr
- is the speedo meta object representing the generic class.sf
- is the speedo meta object representing the persistent
reference to a generic class.currentClass
- is the class mapping the fieldcm
- if the mapping structure hosting the mapping of the class.mibh
- is a helper for the management of the JORM meta infomb
- is the mapping builder permitting the creation of the mapping
objects.
- Throws:
SpeedoException
- if the speedo meta information is not completly
defined.
org.objectweb.jorm.api.PException
getNamingfields
public NamingManager.NamingField[] getNamingfields(SpeedoClass sc)
throws org.objectweb.jorm.api.PException
- 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
- Overrides:
getNamingfields
in class NamingManagerHelper
- Parameters:
sc
- is the speedo meta object of the persistent class
- Throws:
org.objectweb.jorm.api.PException
getDefaultColumn
public SpeedoColumn[] getDefaultColumn(SpeedoClass sc)
- Specified by:
getDefaultColumn
in interface NamingManager
- Overrides:
getDefaultColumn
in class NamingManagerHelper