Class JPAInitializer

  • Direct Known Subclasses:
    JavaSECMPInitializer

    public abstract class JPAInitializer
    extends java.lang.Object
    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 Detail

      • shouldCreateInternalLoader

        protected boolean shouldCreateInternalLoader
      • initializationClassloader

        protected java.lang.ClassLoader initializationClassloader
      • initialEmSetupImpls

        protected java.util.Map<java.lang.String,​EntityManagerSetupImpl> initialEmSetupImpls
      • initializers

        protected static java.util.Map<java.lang.ClassLoader,​JPAInitializer> initializers
    • Constructor Detail

      • JPAInitializer

        public JPAInitializer()
    • Method Detail

      • initializeTopLinkLoggingFile

        public static void initializeTopLinkLoggingFile()
        Initialize the logging file if it is specified by the system property.
      • callPredeploy

        public EntityManagerSetupImpl callPredeploy​(SEPersistenceUnitInfo persistenceUnitInfo,
                                                    java.util.Map m,
                                                    java.lang.String persistenceUnitUniqueName,
                                                    java.lang.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.
      • checkWeaving

        public abstract void checkWeaving​(java.util.Map properties)
        Check whether weaving is possible and update the properties and variable as appropriate
        Parameters:
        properties - The list of properties to check for weaving and update if weaving is not needed
      • createTempLoader

        protected abstract java.lang.ClassLoader createTempLoader​(java.util.Collection 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.
      • createTempLoader

        protected abstract java.lang.ClassLoader createTempLoader​(java.util.Collection col,
                                                                  boolean shouldOverrideLoadClassForCollectionMembers)
      • findPersistenceUnitInfo

        public SEPersistenceUnitInfo findPersistenceUnitInfo​(java.lang.String puName,
                                                             java.util.Map m)
        Find PersistenceUnitInfo corresponding to the persistence unit name. Returns null if either persistence unit either not found or provider is not supported.
      • findPersistenceUnitInfoInArchives

        protected SEPersistenceUnitInfo findPersistenceUnitInfoInArchives​(java.lang.String puName,
                                                                          java.util.Map m)
        Find PersistenceUnitInfo corresponding to the persistence unit name. Returns null if either persistence unit either not found or provider is not supported.
      • findPersistenceUnitInfoInArchive

        protected SEPersistenceUnitInfo findPersistenceUnitInfoInArchive​(java.lang.String puName,
                                                                         Archive archive,
                                                                         java.util.Map 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.
      • isPersistenceProviderSupported

        public boolean isPersistenceProviderSupported​(java.lang.String providerClassName)
        Returns whether the given persistence provider class is supported by this implementation
        Parameters:
        providerClassName -
        Returns:
      • loadEntityClasses

        protected java.util.Set loadEntityClasses​(java.util.Collection entityNames,
                                                  java.lang.ClassLoader classLoader)
        Create a list of java.lang.Class that contains the classes of all the entities that we will be deploying.
      • registerTransformer

        public abstract void registerTransformer​(javax.persistence.spi.ClassTransformer transformer,
                                                 javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo,
                                                 java.util.Map properties)
        Register a transformer. This method should be overridden to provide the appropriate transformer registration for the environment
        Parameters:
        transformer -
        persistenceUnitInfo -
      • isPersistenceUnitUniquelyDefinedByName

        public boolean isPersistenceUnitUniquelyDefinedByName()
        Indicates whether puName uniquely defines the persistence unit.
      • createUniquePersistenceUnitName

        public java.lang.String createUniquePersistenceUnitName​(javax.persistence.spi.PersistenceUnitInfo puInfo)
        In case persistence unit is not uniquely defined by name this method is called to generate a unique name.
      • extractInitialEmSetupImpl

        public EntityManagerSetupImpl extractInitialEmSetupImpl​(java.lang.String puName)
      • initialize

        public void initialize​(java.util.Map 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.
      • initPersistenceUnits

        protected void initPersistenceUnits​(Archive archive,
                                            java.util.Map 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.
      • keepAllPredeployedPersistenceUnits

        protected boolean keepAllPredeployedPersistenceUnits()
        Indicates whether initialPuInfos and initialEmSetupImpls are used.
      • getInitializationClassLoader

        public java.lang.ClassLoader getInitializationClassLoader()