Package org.apache.openjpa.jdbc.meta
Class MappingRepository
java.lang.Object
org.apache.openjpa.meta.MetaDataRepository
org.apache.openjpa.jdbc.meta.MappingRepository
- All Implemented Interfaces:
Serializable,PCRegistry.RegisterClassListener,Configurable,Closeable,MetaDataModes
Repository of object/relational mapping information.
- Author:
- Abe White
- See Also:
-
Field Summary
Fields inherited from class org.apache.openjpa.meta.MetaDataRepository
_locking, _preload, _preloadComplete, EMPTY_CLASSES, EMPTY_FIELDS, EMPTY_METAS, EMPTY_NON_PERSISTENT, EMPTY_ORDERS, EMPTY_XMLMETAS, VALIDATE_MAPPING, VALIDATE_META, VALIDATE_NONE, VALIDATE_RUNTIME, VALIDATE_UNENHANCEDFields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddQueryResultMapping(Class cls, String name) Add a query result mapping.voidclear()Clear the cache of parsed metadata.protected ValueHandlerDetermine the default handler to use for the given value.protected ValueHandlerdefaultHandler(ValueMapping val, boolean adapting) Determine the default handler to use for the given value.protected ClassStrategyDetermine the default strategy to use for the given class.protected ClassStrategydefaultStrategy(ClassMapping cls, boolean adapting) Determine the default strategy to use for the given class.protected DiscriminatorStrategydefaultStrategy(Discriminator discrim) Determine the default strategy to use for the given discriminator.protected DiscriminatorStrategydefaultStrategy(Discriminator discrim, boolean adapting) Determine the default strategy to use for the given discriminator.protected FieldStrategydefaultStrategy(FieldMapping field, boolean installHandlers) Determine the default strategy to use for the given field.protected FieldStrategydefaultStrategy(FieldMapping field, boolean installHandlers, boolean adapting) Determine the default strategy to use for the given field.protected VersionStrategydefaultStrategy(Version version) Determine the default strategy to use for the given version.protected VersionStrategydefaultStrategy(Version version, boolean adapting) Determine the default strategy to use for the given version.protected VersionStrategydefaultStrategy(Version vers, FieldMapping vfield) Return the default version strategy, given a version field.protected FieldStrategydefaultTypeStrategy(FieldMapping field, boolean installHandlers, boolean adapting) Return the built-in strategy for the field's type, or null if none.voidInvoked upon completion of bean property configuration for this object.protected ClassMappingfindBaseClassMapping(ClassMapping mapping) Finds the base class mapping for the specified mapping.getCachedQueryResultMapping(Class cls, String name) Return the cached query result mapping with the given name, or null if none.Convenient access to dictionary for mappings.getImplementorMappings(Class<?> cls, ClassLoader envLoader, boolean mustExist) getMapping(Class<?> cls, ClassLoader envLoader, boolean mustExist) getMapping(Object oid, ClassLoader envLoader, boolean mustExist) Mapping defaults.getQueryResultMapping(Class<?> cls, String name, ClassLoader loader, boolean mustExist) Return the query result mapping for the given name.Return all cached query result mappings.Representation of the database schema.Installs mapping strategies on components.protected FieldStrategyhandlerCollectionStrategy(FieldMapping field, ValueHandler ehandler, boolean installHandlers) Return the collection strategy for the given element handler, or null if none.protected FieldStrategyhandlerMapStrategy(FieldMapping field, ValueHandler khandler, ValueHandler vhandler, boolean krel, boolean vrel, boolean installHandlers) Return the map strategy for the given key and value handlers / relations, or null if none.protected booleanhasInheritanceStrategy(ClassMapping mapping) Determines whether an inhertance strategy has been set on the specified mapping.booleanhasJoinColumn(FieldMapping field) booleanhasJoinTable(FieldMapping field) protected ClassStrategyinstantiateClassStrategy(String name, ClassMapping cls) Return the strategy for the given name.protected DiscriminatorStrategyinstantiateDiscriminatorStrategy(String name, Discriminator discrim) Instantiate the given discriminator strategy.protected VersionStrategyinstantiateVersionStrategy(Class<?> strat, Version version, String props) Instantiate the given version strategy.protected VersionStrategyinstantiateVersionStrategy(String name, Version version) Instantiate the given version strategy.booleanisBi1To1JT(FieldMapping field) booleanisBidirectional(FieldMapping field) booleanisBiMTo1JT(FieldMapping field) booleanbooleanisUni1To1JT(FieldMapping field) booleanisUni1ToMFK(FieldMapping field) booleanisUniMTo1JT(FieldMapping field) protected ValueHandlernamedHandler(ValueMapping val) Instantiate the given value's named handler, or return null if no named handler.protected ClassStrategyInstantiate the given class' named strategy, or return null if no named strategy.protected DiscriminatorStrategynamedStrategy(Discriminator discrim) Instantiate the given discriminator's named strategy, or return null if no named strategy.protected FieldStrategynamedStrategy(FieldMapping field, boolean installHandlers) Instantiate the given field's named strategy, or return null if no named strategy.protected VersionStrategynamedStrategy(Version version) Instantiate the given version's named strategy, or return null if no named strategy.protected ClassMetaDatanewClassMetaData(Class<?> type) Create a new class metadata instance.protected ClassMetaData[]newClassMetaDataArray(int length) Create a new array of the proper class metadata subclass.protected DiscriminatorCreate discriminator metadata for the given class.protected ClassMetaDataCreate a new embedded class metadata instance.protected FieldMetaDatanewFieldMetaData(String name, Class<?> type, ClassMetaData owner) Create a new field metadata instance.protected FieldMetaData[]newFieldMetaDataArray(int length) Create a new array of the proper field metadata subclass.protected ClassMappingInfoCreate raw mapping info for the given instance.protected DiscriminatorMappingInfonewMappingInfo(Discriminator disc) Create raw mapping info for the given instance.protected FieldMappingInfoCreate raw mapping info for the given instance.protected ValueMappingInfoCreate raw mapping info for the given instance.protected VersionMappingInfonewMappingInfo(Version version) Create raw mapping info for the given instance.protected Order[]newOrderArray(int size) Create an array of orders of the given size.protected OrdernewRelatedFieldOrder(FieldMetaData owner, FieldMetaData rel, boolean asc) Order by a field of the related type.protected SequenceMetaDatanewSequenceMetaData(String name) Create a new sequence metadata instance.protected ValueMetaDatanewValueMetaData(FieldMetaData owner) Create a new value metadata instance.protected OrdernewValueOrder(FieldMetaData owner, boolean asc) Order by the field value.protected VersionnewVersion(ClassMapping cls) Create version metadata for the given class.protected voidprepareMapping(ClassMetaData meta) Prepare metadata for mapping resolution.booleanremoveQueryResultMapping(Class cls, String name) Remove a query result mapping.booleanRemove a query result mapping.protected voidIf an inheritance strategy has not been set on this mapping, set it to the default (flat).voidsetMappingDefaults(MappingDefaults defaults) Mapping default.voidsetSchemaGroup(SchemaGroup schema) Representation of the database schema.voidsetStrategyInstaller(StrategyInstaller installer) Installs mapping strategies on components.Methods inherited from class org.apache.openjpa.meta.MetaDataRepository
addMetaData, addMetaData, addMetaData, addNonMappedInterface, addPersistenceAware, addQueryMetaData, addQueryMetaData, addSequenceMetaData, addSystemListener, addXMLClassMetaData, close, getAliasNames, getCachedMetaData, getCachedMetaData, getCachedQueryMetaData, getCachedQueryMetaData, getCachedSequenceMetaData, getCachedXMLMetaData, getClosestAliasName, getConfiguration, getImplementorMetaDatas, getLog, getMetaData, getMetaData, getMetaData, getMetaDataFactory, getMetaDatas, getMetaModel, getMetaModel, getNonMappedInterface, getNonMappedInterfaces, getOrderByField, getPersistenceAware, getPersistenceAwares, getPersistentTypeNames, getPreload, getQueryKey, getQueryMetaData, getQueryMetaDatas, getResolve, getSequenceMetaData, getSequenceMetaDatas, getSourceMode, getSystemListeners, getValidate, getXMLMetaData, is_systemListenersActivated, loadPersistentTypes, loadPersistentTypes, needsPreload, newOrder, newQueryMetaData, newXMLClassMetaData, newXMLClassMetaDataArray, newXMLFieldMetaData, preload, register, registerAlias, removeMetaData, removeMetaData, removeNonMappedInterface, removePersistenceAware, removeQueryMetaData, removeQueryMetaData, removeSequenceMetaData, removeSequenceMetaData, removeSystemListener, searchQueryMetaDataByName, setConfiguration, setMetaDataFactory, setMetaModel, setMetaModel, setPreload, setResolve, setResolve, setSourceMode, setSourceMode, setValidate, setValidate, skipMetadata, startConfiguration
-
Constructor Details
-
MappingRepository
public MappingRepository()Default constructor. Configure viaConfigurable.
-
-
Method Details
-
getDBDictionary
Convenient access to dictionary for mappings. -
getMappingDefaults
Mapping defaults. -
setMappingDefaults
Mapping default. -
getSchemaGroup
Representation of the database schema. -
setSchemaGroup
Representation of the database schema. -
getStrategyInstaller
Installs mapping strategies on components. -
setStrategyInstaller
Installs mapping strategies on components. -
getQueryResultMapping
public QueryResultMapping getQueryResultMapping(Class<?> cls, String name, ClassLoader loader, boolean mustExist) Return the query result mapping for the given name. -
getQueryResultMappings
Return all cached query result mappings. -
getCachedQueryResultMapping
Return the cached query result mapping with the given name, or null if none. -
addQueryResultMapping
Add a query result mapping. -
removeQueryResultMapping
Remove a query result mapping. -
removeQueryResultMapping
Remove a query result mapping. -
getMapping
-
getMappings
-
getMapping
-
getImplementorMappings
public ClassMapping[] getImplementorMappings(Class<?> cls, ClassLoader envLoader, boolean mustExist) -
clear
public void clear()Description copied from class:MetaDataRepositoryClear the cache of parsed metadata. This method also clears the internalMetaDataFactory's cache.- Overrides:
clearin classMetaDataRepository
-
prepareMapping
Description copied from class:MetaDataRepositoryPrepare metadata for mapping resolution. This method might map parts of the metadata that don't rely on other classes being mapped, but that other classes might rely on during their own mapping (for example, primary key fields). By default, this method only callsClassMetaData.defineSuperclassFields(boolean).- Overrides:
prepareMappingin classMetaDataRepository
-
newClassMetaData
Description copied from class:MetaDataRepositoryCreate a new class metadata instance.- Overrides:
newClassMetaDatain classMetaDataRepository
-
newClassMetaDataArray
Description copied from class:MetaDataRepositoryCreate a new array of the proper class metadata subclass.- Overrides:
newClassMetaDataArrayin classMetaDataRepository
-
newFieldMetaData
Description copied from class:MetaDataRepositoryCreate a new field metadata instance.- Overrides:
newFieldMetaDatain classMetaDataRepository
-
newFieldMetaDataArray
Description copied from class:MetaDataRepositoryCreate a new array of the proper field metadata subclass.- Overrides:
newFieldMetaDataArrayin classMetaDataRepository
-
newEmbeddedClassMetaData
Description copied from class:MetaDataRepositoryCreate a new embedded class metadata instance.- Overrides:
newEmbeddedClassMetaDatain classMetaDataRepository
-
newValueMetaData
Description copied from class:MetaDataRepositoryCreate a new value metadata instance.- Overrides:
newValueMetaDatain classMetaDataRepository
-
newSequenceMetaData
Description copied from class:MetaDataRepositoryCreate a new sequence metadata instance.- Overrides:
newSequenceMetaDatain classMetaDataRepository
-
newValueOrder
Description copied from class:MetaDataRepositoryOrder by the field value.- Overrides:
newValueOrderin classMetaDataRepository
-
newRelatedFieldOrder
Description copied from class:MetaDataRepositoryOrder by a field of the related type.- Overrides:
newRelatedFieldOrderin classMetaDataRepository
-
newOrderArray
Description copied from class:MetaDataRepositoryCreate an array of orders of the given size.- Overrides:
newOrderArrayin classMetaDataRepository
-
newVersion
Create version metadata for the given class. -
newDiscriminator
Create discriminator metadata for the given class. -
newMappingInfo
Create raw mapping info for the given instance. -
newMappingInfo
Create raw mapping info for the given instance. -
newMappingInfo
Create raw mapping info for the given instance. -
newMappingInfo
Create raw mapping info for the given instance. -
newMappingInfo
Create raw mapping info for the given instance. -
namedStrategy
Instantiate the given class' named strategy, or return null if no named strategy. -
instantiateClassStrategy
Return the strategy for the given name. -
namedStrategy
Instantiate the given field's named strategy, or return null if no named strategy. -
namedStrategy
Instantiate the given discriminator's named strategy, or return null if no named strategy. -
instantiateDiscriminatorStrategy
protected DiscriminatorStrategy instantiateDiscriminatorStrategy(String name, Discriminator discrim) Instantiate the given discriminator strategy. -
namedStrategy
Instantiate the given version's named strategy, or return null if no named strategy. -
instantiateVersionStrategy
Instantiate the given version strategy. -
instantiateVersionStrategy
Instantiate the given version strategy. -
defaultStrategy
Determine the default strategy to use for the given class. Does not take into account the current strategy, if any. -
defaultStrategy
Determine the default strategy to use for the given class. Does not take into account the current strategy, if any. -
defaultStrategy
Determine the default strategy to use for the given field. Does not take into account the named or current strategy, if any. If a non-null strategy is returned, this method may as a side effect install value handlers on the field's value mappings. -
defaultStrategy
protected FieldStrategy defaultStrategy(FieldMapping field, boolean installHandlers, boolean adapting) Determine the default strategy to use for the given field. Does not take into account the named or current strategy, if any. If a non-null strategy is returned, this method may as a side effect install value handlers on the field's value mappings. -
defaultTypeStrategy
protected FieldStrategy defaultTypeStrategy(FieldMapping field, boolean installHandlers, boolean adapting) Return the built-in strategy for the field's type, or null if none. -
handlerCollectionStrategy
protected FieldStrategy handlerCollectionStrategy(FieldMapping field, ValueHandler ehandler, boolean installHandlers) Return the collection strategy for the given element handler, or null if none. -
handlerMapStrategy
protected FieldStrategy handlerMapStrategy(FieldMapping field, ValueHandler khandler, ValueHandler vhandler, boolean krel, boolean vrel, boolean installHandlers) Return the map strategy for the given key and value handlers / relations, or null if none. -
isNonDefaultMappingAllowed
public boolean isNonDefaultMappingAllowed() -
isUniMTo1JT
-
isUni1To1JT
-
isBi1To1JT
-
isUni1ToMFK
-
isBiMTo1JT
-
getBi_1ToM_JoinTableField
-
getBi_MTo1_JoinTableField
-
hasJoinColumn
-
hasJoinTable
-
isBidirectional
-
namedHandler
Instantiate the given value's named handler, or return null if no named handler. -
defaultHandler
Determine the default handler to use for the given value. Does not take into account the named handler, if any. -
defaultHandler
Determine the default handler to use for the given value. Does not take into account the named handler, if any. -
defaultStrategy
Determine the default strategy to use for the given discriminator. Does not take into account the current strategy, if any. -
defaultStrategy
Determine the default strategy to use for the given discriminator. Does not take into account the current strategy, if any. -
defaultStrategy
Determine the default strategy to use for the given version. Does not take into account the current strategy, if any. -
defaultStrategy
Determine the default strategy to use for the given version. Does not take into account the current strategy, if any. -
defaultStrategy
Return the default version strategy, given a version field. -
endConfiguration
public void endConfiguration()Description copied from interface:ConfigurableInvoked upon completion of bean property configuration for this object.- Specified by:
endConfigurationin interfaceConfigurable- Overrides:
endConfigurationin classMetaDataRepository
-
findBaseClassMapping
Finds the base class mapping for the specified mapping. Loads all persistent types if necessary, since all persistent subclasses of this mapping may not have been resolved before this method is called. -
setDefaultInheritanceStrategy
If an inheritance strategy has not been set on this mapping, set it to the default (flat). This method should be called before strategies are created for the specified mapping. -
hasInheritanceStrategy
Determines whether an inhertance strategy has been set on the specified mapping.
-