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

public abstract Class JPAInitializer

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer
Imports
java.io.FileWriter, .IOException, java.util.Collection, .Collections, .HashMap, .HashSet, .Hashtable, .Iterator, .Map, .Set, jakarta.persistence.spi.ClassTransformer, .PersistenceUnitInfo, org.eclipse.persistence.config.PersistenceUnitProperties, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider, .EntityManagerSetupImpl, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.jpa.Archive, .PersistenceProvider, org.eclipse.persistence.logging.AbstractSessionLog, .SessionLog

Base class for all JPA initialization classes. This is an abstract class that provides the framework for JPA initialization (finding and initializing persistence units). Subclasses implement the abstract methods to provide customized functionality
Author
tware
See Also
JavaSECMPInitializer

Field Summary

Modifier and TypeField and Description
protected Map<String, EntityManagerSetupImpl>
protected ClassLoader
protected static Map<ClassLoader, JPAInitializer>
protected Map<String, SEPersistenceUnitInfo>
protected boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public EntityManagerSetupImpl
callPredeploy(SEPersistenceUnitInfo persistenceUnitInfo, Map<K, V> m, String persistenceUnitUniqueName, String sessionName)

predeploy (with deploy) is one of the two steps required in deployment of entities This method will prepare to call predeploy, call it and finally register the transformer returned to be used for weaving.

public abstract void
checkWeaving(Map<K, V>
The list of properties to check for weaving and update if weaving is not needed
properties
)

Check whether weaving is possible and update the properties and variable as appropriate

protected abstract ClassLoader
createTempLoader(Collection<E> col)

Create a temporary class loader that can be used to inspect classes and then thrown away.

protected abstract ClassLoader
createTempLoader(Collection<E> col, boolean shouldOverrideLoadClassForCollectionMembers)

public String
createUniquePersistenceUnitName(PersistenceUnitInfo puInfo)

In case persistence unit is not uniquely defined by name this method is called to generate a unique name.

public EntityManagerSetupImpl
public SEPersistenceUnitInfo
findPersistenceUnitInfo(String puName, Map<K, V> m)

Find PersistenceUnitInfo corresponding to the persistence unit name.

protected SEPersistenceUnitInfo
findPersistenceUnitInfoInArchive(String puName, Archive archive, Map<K, V> m)

Find PersistenceUnitInfo corresponding to the persistence unit name in the archive.

protected SEPersistenceUnitInfo
findPersistenceUnitInfoInArchives(String puName, Map<K, V> m)

Find PersistenceUnitInfo corresponding to the persistence unit name.

public ClassLoader
public void
initialize(Map<K, V> m)

This method initializes the container.

public static void
initializeTopLinkLoggingFile()

Initialize the logging file if it is specified by the system property.

protected void
initPersistenceUnits(Archive archive, Map<K, V> m)

Initialize all persistence units found on initializationClassLoader.

public boolean
isPersistenceProviderSupported(String providerClassName)

Returns whether the given persistence provider class is supported by this implementation

public boolean
isPersistenceUnitUniquelyDefinedByName()

Indicates whether puName uniquely defines the persistence unit.

protected boolean
keepAllPredeployedPersistenceUnits()

Indicates whether initialPuInfos and initialEmSetupImpls are used.

protected Set<E>
loadEntityClasses(Collection<E> entityNames, ClassLoader classLoader)

Create a list of java.lang.Class that contains the classes of all the entities that we will be deploying.

public abstract void
registerTransformer(final ClassTransformer transformer, PersistenceUnitInfo persistenceUnitInfo, Map<K, V> properties)

Register a transformer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

initialEmSetupImplsback to summary
protected Map<String, EntityManagerSetupImpl> initialEmSetupImpls
initializationClassloaderback to summary
protected ClassLoader initializationClassloader
initializersback to summary
protected static Map<ClassLoader, JPAInitializer> initializers
initialPuInfosback to summary
protected Map<String, SEPersistenceUnitInfo> initialPuInfos
shouldCreateInternalLoaderback to summary
protected boolean shouldCreateInternalLoader

Constructor Detail

JPAInitializerback to summary
protected JPAInitializer()

Method Detail

callPredeployback to summary
public EntityManagerSetupImpl callPredeploy(SEPersistenceUnitInfo persistenceUnitInfo, Map<K, V> m, String persistenceUnitUniqueName, String sessionName)

predeploy (with deploy) is one of the two steps required in deployment of entities This method will prepare to call predeploy, call it and finally register the transformer returned to be used for weaving.

checkWeavingback to summary
public abstract void checkWeaving(Map<K, V> properties)

Check whether weaving is possible and update the properties and variable as appropriate

Parameters
properties:Map<K, V>

The list of properties to check for weaving and update if weaving is not needed

createTempLoaderback to summary
protected abstract ClassLoader createTempLoader(Collection<E> col)

Create a temporary class loader that can be used to inspect classes and then thrown away. This allows classes to be introspected prior to loading them with application's main class loader enabling weaving.

createTempLoaderback to summary
protected abstract ClassLoader createTempLoader(Collection<E> col, boolean shouldOverrideLoadClassForCollectionMembers)
createUniquePersistenceUnitNameback to summary
public String createUniquePersistenceUnitName(PersistenceUnitInfo puInfo)

In case persistence unit is not uniquely defined by name this method is called to generate a unique name.

extractInitialEmSetupImplback to summary
public EntityManagerSetupImpl extractInitialEmSetupImpl(String puName)
findPersistenceUnitInfoback to summary
public SEPersistenceUnitInfo findPersistenceUnitInfo(String puName, Map<K, V> m)

Find PersistenceUnitInfo corresponding to the persistence unit name. Returns null if either persistence unit either not found or provider is not supported.

findPersistenceUnitInfoInArchiveback to summary
protected SEPersistenceUnitInfo findPersistenceUnitInfoInArchive(String puName, Archive archive, Map<K, V> m)

Find PersistenceUnitInfo corresponding to the persistence unit name in the archive. Returns null if either persistence unit either not found or provider is not supported.

findPersistenceUnitInfoInArchivesback to summary
protected SEPersistenceUnitInfo findPersistenceUnitInfoInArchives(String puName, Map<K, V> m)

Find PersistenceUnitInfo corresponding to the persistence unit name. Returns null if either persistence unit either not found or provider is not supported.

getInitializationClassLoaderback to summary
public ClassLoader getInitializationClassLoader()
initializeback to summary
public void initialize(Map<K, V> m)

This method initializes the container. Essentially, it will try to load the class that contains the list of entities and reflectively call the method that contains that list. It will then initialize the container with that list.

initializeTopLinkLoggingFileback to summary
public static void initializeTopLinkLoggingFile()

Initialize the logging file if it is specified by the system property.

initPersistenceUnitsback to summary
protected void initPersistenceUnits(Archive archive, Map<K, V> m)

Initialize all persistence units found on initializationClassLoader. Initialization is a two phase process. First the predeploy process builds the metadata and creates any required transformers. Second the deploy process creates an EclipseLink session based on that metadata.

isPersistenceProviderSupportedback to summary
public boolean isPersistenceProviderSupported(String providerClassName)

Returns whether the given persistence provider class is supported by this implementation

isPersistenceUnitUniquelyDefinedByNameback to summary
public boolean isPersistenceUnitUniquelyDefinedByName()

Indicates whether puName uniquely defines the persistence unit.

keepAllPredeployedPersistenceUnitsback to summary
protected boolean keepAllPredeployedPersistenceUnits()

Indicates whether initialPuInfos and initialEmSetupImpls are used.

loadEntityClassesback to summary
protected Set<E> loadEntityClasses(Collection<E> entityNames, ClassLoader classLoader)

Create a list of java.lang.Class that contains the classes of all the entities that we will be deploying.

registerTransformerback to summary
public abstract void registerTransformer(final ClassTransformer transformer, PersistenceUnitInfo persistenceUnitInfo, Map<K, V> properties)

Register a transformer. This method should be overridden to provide the appropriate transformer registration for the environment