java.lang.Object
org.eclipse.persistence.internal.jpa.deployment.JPAInitializer
org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializer

public class JavaSECMPInitializer extends JPAInitializer
INTERNAL: JavaSECMPInitializer is used to bootstrap the deployment of EntityBeans in EJB 3.0 when deployed in a non-managed setting It is called internally by our Provider
See Also:
  • Field Details

    • globalInstrumentation

      public static Instrumentation globalInstrumentation
    • usesAgent

      protected static boolean usesAgent
    • isInContainer

      protected static boolean isInContainer
    • isInitialized

      protected static boolean isInitialized
    • initializer

      protected static JavaSECMPInitializer initializer
  • Constructor Details

    • JavaSECMPInitializer

      protected JavaSECMPInitializer()
      User should not instantiate JavaSECMPInitializer.
    • JavaSECMPInitializer

      protected JavaSECMPInitializer(ClassLoader loader)
  • Method Details

    • isInContainer

      public static boolean isInContainer()
    • setIsInContainer

      public static void setIsInContainer(boolean isInContainer)
    • getJavaSECMPInitializer

      public static JavaSECMPInitializer getJavaSECMPInitializer()
      Get the singleton entityContainer.
    • getJavaSECMPInitializer

      public static JavaSECMPInitializer getJavaSECMPInitializer(ClassLoader classLoader)
    • getJavaSECMPInitializerFromAgent

      public static JavaSECMPInitializer getJavaSECMPInitializerFromAgent()
    • getJavaSECMPInitializerFromMain

      public static JavaSECMPInitializer getJavaSECMPInitializerFromMain(Map m)
    • getJavaSECMPInitializer

      public static JavaSECMPInitializer getJavaSECMPInitializer(ClassLoader classLoader, Map m, boolean fromAgent)
    • checkWeaving

      public void checkWeaving(Map properties)
      Check whether weaving is possible and update the properties and variable as appropriate
      Specified by:
      checkWeaving in class JPAInitializer
      Parameters:
      properties - The list of properties to check for weaving and update if weaving is not needed
    • createTempLoader

      protected ClassLoader createTempLoader(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.
      Specified by:
      createTempLoader in class JPAInitializer
    • createTempLoader

      protected ClassLoader createTempLoader(Collection col, boolean shouldOverrideLoadClassForCollectionMembers)
      Specified by:
      createTempLoader in class JPAInitializer
    • initializeFromAgent

      protected static void initializeFromAgent(Instrumentation instrumentation) throws Exception
      INTERNAL: Should be called only by the agent. (when weaving classes) If succeeded return true, false otherwise.
      Throws:
      Exception
    • initializeFromMain

      public static void initializeFromMain(Map m)
      Usually JavaSECMPInitializer is initialized from agent during premain to ensure that the classes to be weaved haven't been loaded before initialization. However, in this case initialization can't be debugged. In order to be able to debug initialization specify in java options -javaagent with parameter "main": (note: a separate eclipselink-agent.jar is no longer required) -javaagent:c:\trunk\eclipselink.jar=main that causes instrumentation to be cached during premain and postpones initialization until main. With initialization done in main (during the first createEntityManagerFactory call) there's a danger of the classes to be weaved being already loaded. In that situation initializeFromMain should be called before any classes are loaded. The sure-to-work method would be to create a new runnable class with a main method consisting of just two lines: calling initializeFromMain followed by reflective call to the main method of the original runnable class. The same could be achieved by calling PersistenceProvider.createEntityManagerFactory method instead of JavaSECMPInitializer.initializeFromMain method, however initializeFromMain might be more convenient because it doesn't require a persistence unit name. The method doesn't do anything if JavaSECMPInitializer has been already initialized.
      Parameters:
      m - - a map containing the set of properties to instantiate with.
    • initializeFromMain

      public static void initializeFromMain()
      The version of initializeFromMain that passes an empty map.
    • registerTransformer

      public void registerTransformer(ClassTransformer transformer, PersistenceUnitInfo persistenceUnitInfo, Map properties)
      Register a transformer. In this case, we use the instrumentation to add a transformer for the JavaSE environment
      Specified by:
      registerTransformer in class JPAInitializer
    • isPersistenceUnitUniquelyDefinedByName

      public boolean isPersistenceUnitUniquelyDefinedByName()
      Indicates whether puName uniquely defines the persistence unit. usesAgent means that it is a stand alone SE case. Otherwise it could be an application server case where different persistence units may have the same name: that could happen if they are loaded by different classloaders; the common case is the same persistence unit jar deployed in several applications.
      Overrides:
      isPersistenceUnitUniquelyDefinedByName in class JPAInitializer
    • isInitialized

      public static boolean isInitialized()
      Indicates whether initialization has already occurred.
    • usesAgent

      public static boolean usesAgent()
      Indicates whether Java agent and globalInstrumentation was used.
    • keepAllPredeployedPersistenceUnits

      protected boolean keepAllPredeployedPersistenceUnits()
      Indicates whether initialPuInfos and initialEmSetupImpls are used.
      Overrides:
      keepAllPredeployedPersistenceUnits in class JPAInitializer