org.objectweb.jorm.interp.genclass.lib
Class GenClassMapping

java.lang.Object
  |
  +--org.objectweb.jorm.interp.genclass.lib.GenClassMapping
All Implemented Interfaces:
GenClassProp, Loggable, PClassMapping
Direct Known Subclasses:
FileGenClassMapping, FosGenClassMapping, MemoryGenClassMapping, RdbGenClassMapping

public abstract class GenClassMapping
extends java.lang.Object
implements PClassMapping, GenClassProp, Loggable

This abstract class provides all the generic code for the PClassMapping associated with JORM generic classes. It implements all methods except the following ones: createPBinding, initMappingStructures, isConform, and removeMappingStructures.

Author:
P. D?chamboux

Inner classes inherited from class org.objectweb.jorm.api.PClassMapping
PClassMapping.ReferenceConfigurator
 
Field Summary
protected  PBinder binder
          The actual PBinder.
protected  PClassMapping elemClassMapping
          The PClassMapping of the generic class instance representing the element stored within this generic class object.
protected  boolean elemCodingOnly
           
protected  FieldDesc[] elemFields
          This array contains the ScalarField meta object elements which represent the element fields of the generic class instance.
protected  PNamingContext elemNamingContext
          The naming context associated to the reference elements of this generic class instance.
protected  GenClass genClassMetaInfo
          It references the meta-information associated with this generic class.
protected  PType genClassPType
          This field is the PType of the involved generic class.
protected  FieldDesc[] identifierFields
          This array contains the ScalarField meta object elements which represent the identifier fields of the generic class instance.
protected  FieldDesc[] indexFields
          This array contains the ScalarField meta object elements which represent the index fields of the generic class instance.
protected  org.objectweb.util.monolog.api.Logger logger
          The logger to log all information related to the mapping of this class.
protected  org.objectweb.util.monolog.api.LoggerFactory loggerFactory
          The loggerFactory.
protected  PMapper mapper
          This field references the mapper.
 
Fields inherited from interface org.objectweb.jorm.api.PClassMapping
CLEANUP_DONOTHING, CLEANUP_REMOVEALL, CLEANUP_REMOVEDATA, CREATE_STRUCTURE_IF_NEEDED
 
Constructor Summary
GenClassMapping()
           
 
Method Summary
 void configureRefFields(PClassMapping.ReferenceConfigurator rc)
          It permits to assign the PNamingContext of all the reference fields of the persitent class.
 java.lang.String getClassName()
          It retrieves the name of the class mapped by this PClassMapping.
 FieldDesc[] getElemFields()
           
 PClassMapping getGenClassMapping()
          It gives access to the PClassMapping associated to the element of a generic class whose type is a generic class.
 PClassMapping getGenClassMapping(java.lang.String fn)
          It gives access to the PClassMapping associated to a field whose type is a generic class.
 FieldDesc[] getIdentifierFields()
           
 FieldDesc[] getIndexFields()
           
 org.objectweb.util.monolog.api.Logger getLogger()
          Returns a logger to an component that wants to log things.
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 MetaObject getMetaInfo()
          It returns the Class/GenClass object representing the meta-information associated to the JORM class/generic class whose mapping is defined by this PClassMapping.
 PBinder getPBinder()
          It yields the PBinder associated to this PClassMapping.
 PMapper getPMapper()
          It gives access to the mapper that has mapped the associated JORM class as defined by this PClassMapping.
 PNamingContext getPNameManager()
          It returns the naming context that manages the references contained by the generic class instance whose mapping is defined by this PClassMapping.
 PNamingContext getPNameManager(java.lang.String fn)
          It returns the naming context that manages the reference associated to a field whose type is a JORM class.
 PType getPType()
          Retrieves the PType associated to the JORM class which is the type of the name managed by this naming context.
 void init(PMapper mapper, MetaObject metaclass)
          It intialises the class mapping.
 void setElemDesc(FieldDesc[] fds)
          Defines the fields property specifying the fields composing the element value structure of a generic class instance elements.
 void setGcType(PType pt)
          Defines the type property of a generic class instance.
 void setGenClassMapping(PClassMapping pcm)
          It assigns the GenClassMapping used to manage the reference hold by a field whose type is a JORM class.
 void setGenClassMapping(java.lang.String fn, PClassMapping pcm)
          It assigns the GenClassMapping used to manage the reference hold by a field whose type is a JORM class.
 void setIdentifierDesc(FieldDesc[] fds)
          Defines the fields property specifying the fields composing the identifier structure of a generic class instance.
 void setIndexDesc(FieldDesc[] fds)
          Defines the fields property specifying the fields composing the index structure of a generic class instance elements.
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
          It assigns a logger to an component that wants to log things.
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
          It assigns a logger factory that allows the creation of new loggers.
 void setPBinder(PBinder pb)
          It assigns the PBinder associated to this PClassMapping.
 void setPNamingContext(PNamingContext pnc, boolean codingonly)
          It assigns the PNamingContext used to manage the references hold by a generic class instance whose mapping is described by this PClassMapping.
 void setPNamingContext(java.lang.String fn, PNamingContext pnc, boolean codingonly)
          It assigns the PNamingContext used to manage the reference hold by a field whose type is a JORM class.
 void setPType(PType pt)
          It assigns the PType associated to the JORM class which is the type of the reference managed by this naming context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.api.PClassMapping
createPBinding, getPNameIterator, initMappingStructures, isConform, removeMappingStructures
 

Field Detail

mapper

protected PMapper mapper
This field references the mapper. The mapper is used to know the mapper name and the mapping name.

genClassMetaInfo

protected GenClass genClassMetaInfo
It references the meta-information associated with this generic class.

genClassPType

protected PType genClassPType
This field is the PType of the involved generic class.

indexFields

protected FieldDesc[] indexFields
This array contains the ScalarField meta object elements which represent the index fields of the generic class instance.

identifierFields

protected FieldDesc[] identifierFields
This array contains the ScalarField meta object elements which represent the identifier fields of the generic class instance.

elemFields

protected FieldDesc[] elemFields
This array contains the ScalarField meta object elements which represent the element fields of the generic class instance. If it is a reference, there must be at least two fields: one describing the reference field, and one describing its structural projection. This structural projection may be a composite name in which case it should describes all the fields of this composite name.

binder

protected PBinder binder
The actual PBinder.

elemClassMapping

protected PClassMapping elemClassMapping
The PClassMapping of the generic class instance representing the element stored within this generic class object. This is valid only if the elements of this generic class object are also generic class objects.

elemNamingContext

protected PNamingContext elemNamingContext
The naming context associated to the reference elements of this generic class instance.

elemCodingOnly

protected boolean elemCodingOnly

logger

protected org.objectweb.util.monolog.api.Logger logger
The logger to log all information related to the mapping of this class.

loggerFactory

protected org.objectweb.util.monolog.api.LoggerFactory loggerFactory
The loggerFactory.
Constructor Detail

GenClassMapping

public GenClassMapping()
Method Detail

getElemFields

public FieldDesc[] getElemFields()

getIdentifierFields

public FieldDesc[] getIdentifierFields()

getIndexFields

public FieldDesc[] getIndexFields()

getClassName

public java.lang.String getClassName()
It retrieves the name of the class mapped by this PClassMapping. It should be the same as the one get when calling "getPType().getJormName()" if the PType exists.
Specified by:
getClassName in interface PClassMapping
Following copied from interface: org.objectweb.jorm.api.PClassMapping
Returns:
The name of this class.

getGenClassMapping

public PClassMapping getGenClassMapping()
It gives access to the PClassMapping associated to the element of a generic class whose type is a generic class.
Specified by:
getGenClassMapping in interface PClassMapping
Returns:
The PClassMapping of the generic class instance.

getGenClassMapping

public PClassMapping getGenClassMapping(java.lang.String fn)
It gives access to the PClassMapping associated to a field whose type is a generic class. It has no meaning within this context.
Specified by:
getGenClassMapping in interface PClassMapping
Parameters:
fn - The name of the generic class field.
Returns:
The PClassMapping of the generic class instance: always null here.

getMetaInfo

public MetaObject getMetaInfo()
It returns the Class/GenClass object representing the meta-information associated to the JORM class/generic class whose mapping is defined by this PClassMapping. It may be null if not requested at mapping time.
Specified by:
getMetaInfo in interface PClassMapping
Returns:
The Class/GenClass meta-object or null.
See Also:
PMapper.map(org.objectweb.jorm.api.PClassMapping, byte)

getPBinder

public PBinder getPBinder()
It yields the PBinder associated to this PClassMapping. As a PBinder itself, this PClassMapping delegates this behaviour to this PBinder.
Specified by:
getPBinder in interface PClassMapping
Returns:
The PBinder associated to this PClassMapping.

getPMapper

public PMapper getPMapper()
It gives access to the mapper that has mapped the associated JORM class as defined by this PClassMapping.
Specified by:
getPMapper in interface PClassMapping
Returns:
The associated PMapper.

getPNameManager

public PNamingContext getPNameManager()
                               throws java.lang.UnsupportedOperationException
It returns the naming context that manages the references contained by the generic class instance whose mapping is defined by this PClassMapping.
Specified by:
getPNameManager in interface PClassMapping
Returns:
The naming context that manages references contained by a generic class instance.
Throws:
java.lang.UnsupportedOperationException - It is raised when this PClassMapping does not map a generic class instance, or when the elements of this generic class instance are not references.

getPNameManager

public PNamingContext getPNameManager(java.lang.String fn)
                               throws java.lang.UnsupportedOperationException
It returns the naming context that manages the reference associated to a field whose type is a JORM class.
Specified by:
getPNameManager in interface PClassMapping
Returns:
The naming context that manages the reference defined by a field.
Throws:
java.lang.UnsupportedOperationException - It is raised when no naming context is associated to the corresponding field.

init

public void init(PMapper mapper,
                 MetaObject metaclass)
It intialises the class mapping. It especially assigns a mapper as well as a meta-object describing either a class or a generic class.
Specified by:
init in interface PClassMapping
Parameters:
mapper - The mapper to be assigned to this class mapping.
metaclass - The meta-object describing the associated class. It may be null.

setPBinder

public void setPBinder(PBinder pb)
                throws PExceptionTyping
It assigns the PBinder associated to this PClassMapping. As a PBinder itself, this PClassMapping delegates this behaviour to this PBinder.
Specified by:
setPBinder in interface PClassMapping
Parameters:
pb - The PBinder associated to this PClassMapping.
Throws:
PExceptionTyping - It is raised when the structure of the the name that identifies the DSI for the PClassMapping is not supported by this PBinder that should be connected to this PClassMapping.

setPNamingContext

public void setPNamingContext(PNamingContext pnc,
                              boolean codingonly)
                       throws PExceptionTyping,
                              java.lang.UnsupportedOperationException
It assigns the PNamingContext used to manage the references hold by a generic class instance whose mapping is described by this PClassMapping. It should verify that the name structure for this reference is supported by the corresponding naming context.
Specified by:
setPNamingContext in interface PClassMapping
Parameters:
pnc - The PNamingContext to be associated to this generic class PClassMapping for managing its reference elements.
codingonly - It specifies that when using this naming context for managing a reference, it only executes coding or both coding and export/resolve phase.
Throws:
PExceptionTyping - It is raised when the structure of the the names that reference the DSI stored within the generic class instance is not supported by this naming context.
java.lang.UnsupportedOperationException - It is raised when this PClassMapping does not map a generic class instance, or when the elements of this generic class instance are not references.

setPNamingContext

public void setPNamingContext(java.lang.String fn,
                              PNamingContext pnc,
                              boolean codingonly)
                       throws PExceptionTyping,
                              java.lang.UnsupportedOperationException
It assigns the PNamingContext used to manage the reference hold by a field whose type is a JORM class. It should verify that the name structure for this reference is supported by the corresponding naming context.
Specified by:
setPNamingContext in interface PClassMapping
Parameters:
fn - The name of the involved field.
pnc - The PNamingContext to be associated to this field for managing the reference it may hold.
codingonly - It specifies that when using this naming context for managing a reference, it only executes coding or both coding and export/resolve phase.
Throws:
PExceptionTyping - It is raised when the structure of the the names that reference the DSI stored within the generic class instance is not supported by this naming context.
java.lang.UnsupportedOperationException - It is raised when no naming context is associated to the corresponding field.

configureRefFields

public void configureRefFields(PClassMapping.ReferenceConfigurator rc)
                        throws PException,
                               java.lang.UnsupportedOperationException
Description copied from interface: PClassMapping
It permits to assign the PNamingContext of all the reference fields of the persitent class. The implementation of this method must call both method 'getPNameManager' and 'isCodingOnly' of the specified PNCGetter. for each field which is a reference (to a class or a GenClass).
Specified by:
configureRefFields in interface PClassMapping
Following copied from interface: org.objectweb.jorm.api.PClassMapping
Parameters:
pncg - is the callback object which knows the PNamingContext to use.
Throws:
PExceptionTyping - It is raised when the structure of the the names that reference the DSI stored within the generic class instance is not supported by the naming context returned by the callBack method.

setGenClassMapping

public void setGenClassMapping(PClassMapping pcm)
                        throws java.lang.UnsupportedOperationException
It assigns the GenClassMapping used to manage the reference hold by a field whose type is a JORM class.
Specified by:
setGenClassMapping in interface PClassMapping

setGenClassMapping

public void setGenClassMapping(java.lang.String fn,
                               PClassMapping pcm)
                        throws java.lang.UnsupportedOperationException
It assigns the GenClassMapping used to manage the reference hold by a field whose type is a JORM class.
Specified by:
setGenClassMapping in interface PClassMapping

getPType

public PType getPType()
Retrieves the PType associated to the JORM class which is the type of the name managed by this naming context.
Returns:
The related PType.

setPType

public void setPType(PType pt)
It assigns the PType associated to the JORM class which is the type of the reference managed by this naming context.
Parameters:
pt - The PType of the JORM class reference managed by this naming context.

setGcType

public void setGcType(PType pt)
Defines the type property of a generic class instance.
Specified by:
setGcType in interface GenClassProp
Parameters:
pt - The associated type.

setIdentifierDesc

public void setIdentifierDesc(FieldDesc[] fds)
Defines the fields property specifying the fields composing the identifier structure of a generic class instance.
Specified by:
setIdentifierDesc in interface GenClassProp
Parameters:
fds - The array of descriptions of the associated fields.

setIndexDesc

public void setIndexDesc(FieldDesc[] fds)
Defines the fields property specifying the fields composing the index structure of a generic class instance elements.
Specified by:
setIndexDesc in interface GenClassProp
Parameters:
fds - The array of descriptions of the associated fields.

setElemDesc

public void setElemDesc(FieldDesc[] fds)
Defines the fields property specifying the fields composing the element value structure of a generic class instance elements.
Specified by:
setElemDesc in interface GenClassProp
Parameters:
fds - The array of descriptions of the associated fields.

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
It assigns a logger factory that allows the creation of new loggers.
Specified by:
setLoggerFactory in interface Loggable
Parameters:
loggerfactory - The LoggerFactory object to obtain new loggers.

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)
It assigns a logger to an component that wants to log things.
Specified by:
setLogger in interface Loggable
Parameters:
Logger - The logger object.

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.
Specified by:
getLogger in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
logger - the logger object

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.
Specified by:
getLoggerFactory in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
loggerfactory - the LoggerFactory object to obtain new loggers