Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa.metadata

public Class MetadataProcessor

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.URISyntaxException, .URL, java.util.ArrayList, .Collection, .Collections, .Enumeration, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, jakarta.persistence.spi.PersistenceUnitInfo, org.eclipse.persistence.config.DescriptorCustomizer, .PersistenceUnitProperties, org.eclipse.persistence.exceptions.PersistenceUnitLoadingException, .ValidationException, org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl, org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor, .PersistenceUnitProcessor.Mode, org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor, .ConverterAccessor, .EmbeddableAccessor, .EntityAccessor, .MappedSuperclassAccessor, org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory, .MetadataClass, .MetadataFactory, org.eclipse.persistence.internal.jpa.metadata.converters.StructConverterMetadata, org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings, .XMLEntityMappingsReader, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.jpa.Archive, org.eclipse.persistence.jpa.metadata.MetadataSource, org.eclipse.persistence.logging.AbstractSessionLog, .SessionLog

INTERNAL: The object/relational metadata processor for the EJB3.0 specification.
Author
Guy Pelletier
Since
TopLink EJB 3.0 Reference Implementation

Field Summary

Modifier and TypeField and Description
protected Set<MetadataProcessor>
protected MetadataProcessor
protected MetadataFactory
protected ClassLoader
protected MetadataSource
protected Map<String, Object>
protected MetadataProject
protected AbstractSession

Constructor Summary

AccessConstructor and Description
public
MetadataProcessor()

INTERNAL: Empty processor to be used as a composite processor.

public
MetadataProcessor(PersistenceUnitInfo puInfo, AbstractSession session, ClassLoader loader, boolean weaveLazy, boolean weaveEager, boolean weaveFetchGroups, boolean multitenantSharedEmf, boolean multitenantSharedCache, Map<String, Object> predeployProperties, MetadataProcessor compositeProcessor)

INTERNAL: Called from EntityManagerSetupImpl.

Method Summary

Modifier and TypeMethod and Description
public void
addCompositeMemberProcessor(MetadataProcessor compositeMemberProcessor)

INTERNAL: Add containedProcessor to compositeProcessor.

public void
addEntityListeners()

INTERNAL: Method to place EntityListener's on the descriptors from the given session.

public void
addNamedQueries()

INTERNAL: Method to place NamedQueries and NamedNativeQueries on the given session.

public void
addStructConverterNames()

INTERNAL: Adds a list of StructConverter string names that were defined in the metadata of this project to the native EclipseLink project.

public void
createDynamicClasses()

INTERNAL: During EntityManagerSetup deploy, using the real class loader we must create our dynamic classes.

public MetadataProcessor
getCompositeProcessor()

INTERNAL: Return compositeProcessor.

public MetadataFactory
getMetadataFactory()

INTERNAL:

public MetadataSource
getMetadataSource()

INTERNAL:

public Set<MetadataProject>
getPearProjects(MetadataProject project)

INTERNAL: Returns projects owned by compositeProcessor minus the passed project.

public Set<String>
getPersistenceUnitClassSetFromMappingFiles()

INTERNAL: Return a set of class names for each entity, embeddable and mapped superclass found in the mapping files to be processed by the MetadataProcessor.

public MetadataProject
getProject()

INTERNAL:

protected SessionLog

Returns:

SessionLog
getSessionLog
()

INTERNAL: Return the SessionLog from the Session.

protected void
handleORMException(RuntimeException e, String mappingFile, boolean throwException)

INTERNAL: Handle an exception that occurred while processing ORM xml.

protected void
initPersistenceUnitClasses()

INTERNAL: This method is responsible for discovering all the entity classes for this PU and adding corresponding MetadataDescriptor in the MetadataProject.

public void
loadMappingFiles(boolean throwExceptionOnFail)

INTERNAL: This method is responsible for figuring out list of mapping files to read into XMLEntityMappings objects and store on the project.

private void
loadMappingFiles(String
null to load all mapping files referenced from the persistence unit (ie custom.xml), specific value to load particular mapping file (ie orm.xml)
mappingFile
,
boolean
false to log warning if referenced mapping file is not found, true to throw an Exception instead
throwExceptionOnFail
)

protected void
loadSpecifiedMappingFiles(boolean throwExceptionOnFail)

INTERNAL:

protected void
loadStandardMappingFiles(String ormXMLFile)

INTERNAL:

public void
processCustomizers()

INTERNAL: Process the customizer for those entities and embeddables that have one defined.

public void
processEntityMappings(PersistenceUnitProcessor.Mode mode)

INTERNAL: Performs the initialization of the persistence unit classes and then processes the xml metadata.

public void
processORMMetadata(PersistenceUnitProcessor.Mode mode)

INTERNAL: Process the ORM metadata on this processors metadata project (representing a single persistence-unit)

public void
setClassLoader(ClassLoader loader)

INTERNAL: Use this method to set the correct class loader that should be used during processing.

public void
setMetadataSource(MetadataSource source)

INTERNAL: Use this method to set the MetadataSource class to use for loading extensible mappings

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_compositeMemberProcessorsback to summary
protected Set<MetadataProcessor> m_compositeMemberProcessors
m_compositeProcessorback to summary
protected MetadataProcessor m_compositeProcessor
m_factoryback to summary
protected MetadataFactory m_factory
m_loaderback to summary
protected ClassLoader m_loader
m_metadataSourceback to summary
protected MetadataSource m_metadataSource
m_predeployPropertiesback to summary
protected Map<String, Object> m_predeployProperties
m_projectback to summary
protected MetadataProject m_project
m_sessionback to summary
protected AbstractSession m_session

Constructor Detail

MetadataProcessorback to summary
public MetadataProcessor()

INTERNAL: Empty processor to be used as a composite processor.

MetadataProcessorback to summary
public MetadataProcessor(PersistenceUnitInfo puInfo, AbstractSession session, ClassLoader loader, boolean weaveLazy, boolean weaveEager, boolean weaveFetchGroups, boolean multitenantSharedEmf, boolean multitenantSharedCache, Map<String, Object> predeployProperties, MetadataProcessor compositeProcessor)

INTERNAL: Called from EntityManagerSetupImpl. The 'real' EJB 3.0 processing that includes XML and annotations.

Method Detail

addCompositeMemberProcessorback to summary
public void addCompositeMemberProcessor(MetadataProcessor compositeMemberProcessor)

INTERNAL: Add containedProcessor to compositeProcessor.

addEntityListenersback to summary
public void addEntityListeners()

INTERNAL: Method to place EntityListener's on the descriptors from the given session. This call is made from the EntityManagerSetup deploy call.

addNamedQueriesback to summary
public void addNamedQueries()

INTERNAL: Method to place NamedQueries and NamedNativeQueries on the given session. This call is made from the EntityManagerSetup deploy call.

addStructConverterNamesback to summary
public void addStructConverterNames()

INTERNAL: Adds a list of StructConverter string names that were defined in the metadata of this project to the native EclipseLink project. These StructConverters can be added to the Project to be processed later

createDynamicClassesback to summary
public void createDynamicClasses()

INTERNAL: During EntityManagerSetup deploy, using the real class loader we must create our dynamic classes.

getCompositeProcessorback to summary
public MetadataProcessor getCompositeProcessor()

INTERNAL: Return compositeProcessor.

getMetadataFactoryback to summary
public MetadataFactory getMetadataFactory()

INTERNAL:

getMetadataSourceback to summary
public MetadataSource getMetadataSource()

INTERNAL:

getPearProjectsback to summary
public Set<MetadataProject> getPearProjects(MetadataProject project)

INTERNAL: Returns projects owned by compositeProcessor minus the passed project.

getPersistenceUnitClassSetFromMappingFilesback to summary
public Set<String> getPersistenceUnitClassSetFromMappingFiles()

INTERNAL: Return a set of class names for each entity, embeddable and mapped superclass found in the mapping files to be processed by the MetadataProcessor.

getProjectback to summary
public MetadataProject getProject()

INTERNAL:

getSessionLogback to summary
protected SessionLog getSessionLog()

INTERNAL: Return the SessionLog from the Session. If the session is null, return the AbstractSessionLog's SessionLog.

Returns:SessionLog

SessionLog

handleORMExceptionback to summary
protected void handleORMException(RuntimeException e, String mappingFile, boolean throwException)

INTERNAL: Handle an exception that occurred while processing ORM xml.

initPersistenceUnitClassesback to summary
protected void initPersistenceUnitClasses()

INTERNAL: This method is responsible for discovering all the entity classes for this PU and adding corresponding MetadataDescriptor in the MetadataProject. This method will also gather all the weavable classes for this PU. Currently, entity and embeddable classes are weavable.

Note

The order of processing should not be changed as the steps are dependent on one another.

loadMappingFilesback to summary
public void loadMappingFiles(boolean throwExceptionOnFail)

INTERNAL: This method is responsible for figuring out list of mapping files to read into XMLEntityMappings objects and store on the project. Note, the order the files are discovered and read is very important so do not change the order of invocation.

loadMappingFilesback to summary
private void loadMappingFiles(String mappingFile, boolean throwExceptionOnFail)
Parameters
mappingFile:String

null to load all mapping files referenced from the persistence unit (ie custom.xml), specific value to load particular mapping file (ie orm.xml)

throwExceptionOnFail:boolean

false to log warning if referenced mapping file is not found, true to throw an Exception instead

loadSpecifiedMappingFilesback to summary
protected void loadSpecifiedMappingFiles(boolean throwExceptionOnFail)

INTERNAL:

loadStandardMappingFilesback to summary
protected void loadStandardMappingFiles(String ormXMLFile)

INTERNAL:

processCustomizersback to summary
public void processCustomizers()

INTERNAL: Process the customizer for those entities and embeddables that have one defined. This must be the last thing called on this processor before cleanup.

processEntityMappingsback to summary
public void processEntityMappings(PersistenceUnitProcessor.Mode mode)

INTERNAL: Performs the initialization of the persistence unit classes and then processes the xml metadata.

Note

Do not change the order of invocation of various methods.

processORMMetadataback to summary
public void processORMMetadata(PersistenceUnitProcessor.Mode mode)

INTERNAL: Process the ORM metadata on this processors metadata project (representing a single persistence-unit)

setClassLoaderback to summary
public void setClassLoader(ClassLoader loader)

INTERNAL: Use this method to set the correct class loader that should be used during processing. Currently, the class loader should only change once, from preDeploy to deploy.

setMetadataSourceback to summary
public void setMetadataSource(MetadataSource source)

INTERNAL: Use this method to set the MetadataSource class to use for loading extensible mappings