Class EntityManagerFactoryProvider


  • public class EntityManagerFactoryProvider
    extends java.lang.Object
    This is a helper/impl class for the EclipseLink EJB 3.0 provider The default constructor can be used to build the provider by reflection, after which it can be used to create EntityManagerFactories
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addEntityManagerSetupImpl​(java.lang.String name, EntityManagerSetupImpl setup)
      Add an EntityManagerSetupImpl to the cached list These are used to ensure all persistence units that are the same get the same underlying session
      protected static void generateDefaultTables​(org.eclipse.persistence.tools.schemaframework.SchemaManager mgr, EntityManagerSetupImpl.TableCreationType ddlType)
      Calls the appropriate create,replace or alter SchemaManager api.
      protected static java.lang.Object getConfigProperty​(java.lang.String propertyKey, java.util.Map overrides)  
      protected static java.lang.Object getConfigProperty​(java.lang.String propertyKey, java.util.Map overrides, boolean useSystemAsDefault)  
      protected static java.lang.Object getConfigProperty​(java.lang.String propertyKey, java.util.Map overrides, java.lang.Object defaultObj)  
      static java.lang.String getConfigPropertyAsString​(java.lang.String propertyKey, java.util.Map overrides)
      Get configuration System property indicated by the specified propertyKey.
      static java.lang.String getConfigPropertyAsString​(java.lang.String propertyKey, java.util.Map overrides, java.lang.String defaultValue)
      Check the provided map for an object with the given key.
      protected static java.lang.String getConfigPropertyAsStringLogDebug​(java.lang.String propertyKey, java.util.Map overrides, java.lang.String defaultValue, org.eclipse.persistence.internal.sessions.AbstractSession session)  
      protected static java.lang.String getConfigPropertyAsStringLogDebug​(java.lang.String propertyKey, java.util.Map overrides, org.eclipse.persistence.internal.sessions.AbstractSession session)  
      protected static java.lang.String getConfigPropertyAsStringLogDebug​(java.lang.String propertyKey, java.util.Map overrides, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean useSystemAsDefault)  
      protected static java.lang.Object getConfigPropertyLogDebug​(java.lang.String propertyKey, java.util.Map overrides, org.eclipse.persistence.internal.sessions.AbstractSession session)  
      protected static java.lang.Object getConfigPropertyLogDebug​(java.lang.String propertyKey, java.util.Map overrides, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean useSystemAsDefault)  
      static java.util.Map<java.lang.String,​EntityManagerSetupImpl> getEmSetupImpls()  
      static EntityManagerSetupImpl getEntityManagerSetupImpl​(java.lang.String emName)
      Return the setup class for a given entity manager name
      static boolean hasConfigProperty​(java.lang.String propertyKey, java.util.Map overrides)  
      static java.util.Map keepSpecifiedProperties​(java.util.Map source, java.util.Collection keysToBeKept)
      target contains the entries from source with keysToBeKept.
      protected static void login​(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session, java.util.Map properties, boolean requiresConnection)
      Logs in to given session.
      static java.util.Map mergeMaps​(java.util.Map target, java.util.Map source)
      Merge the properties from the source object into the target object.
      static java.util.Map removeSpecifiedProperties​(java.util.Map source, java.util.Collection keysToBeRemoved)
      Copies source into target, removes from target all keysToBeRemoved.
      static java.util.Map[] splitProperties​(java.util.Map source, java.util.Collection[] keys)
      Source Map is divided between Map[] in target.
      static java.util.Map[] splitSpecifiedProperties​(java.util.Map source, java.util.Collection keysToBeKept)
      target is a array of two Maps the first one contains specified properties; the second all the rest.
      protected static void translateOldProperties​(java.util.Map m, org.eclipse.persistence.internal.sessions.AbstractSession session)
      This is a TEMPORARY method that will be removed.
      protected static void warnOldProperties​(java.util.Map m, org.eclipse.persistence.internal.sessions.AbstractSession session)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • oldPropertyNames

        protected static final java.lang.String[][] oldPropertyNames
    • Constructor Detail

      • EntityManagerFactoryProvider

        public EntityManagerFactoryProvider()
    • Method Detail

      • addEntityManagerSetupImpl

        public static void addEntityManagerSetupImpl​(java.lang.String name,
                                                     EntityManagerSetupImpl setup)
        Add an EntityManagerSetupImpl to the cached list These are used to ensure all persistence units that are the same get the same underlying session
        Parameters:
        name -
        setup -
      • generateDefaultTables

        protected static void generateDefaultTables​(org.eclipse.persistence.tools.schemaframework.SchemaManager mgr,
                                                    EntityManagerSetupImpl.TableCreationType ddlType)
        Calls the appropriate create,replace or alter SchemaManager api.
        Parameters:
        mgr -
        ddlType - - ddl operation to be performed
      • getConfigPropertyAsString

        public static java.lang.String getConfigPropertyAsString​(java.lang.String propertyKey,
                                                                 java.util.Map overrides)
        Get configuration System property indicated by the specified propertyKey. Property value may be overridden by overrides Map.
        Parameters:
        propertyKey - The name of the configuration System property.
        overrides - Map with property overrides.
        Returns:
        The String value of the property from overrides Map or value of configuration System property or null if property identified by propertyKey does not exist.
      • getConfigPropertyAsString

        public static java.lang.String getConfigPropertyAsString​(java.lang.String propertyKey,
                                                                 java.util.Map overrides,
                                                                 java.lang.String defaultValue)
        Check the provided map for an object with the given key. If that object is not available, check the System properties. If it is not available from either location, return the default value.
        Parameters:
        propertyKey -
        overrides -
        defaultValue -
        Returns:
      • getConfigPropertyAsStringLogDebug

        protected static java.lang.String getConfigPropertyAsStringLogDebug​(java.lang.String propertyKey,
                                                                            java.util.Map overrides,
                                                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
      • getConfigPropertyAsStringLogDebug

        protected static java.lang.String getConfigPropertyAsStringLogDebug​(java.lang.String propertyKey,
                                                                            java.util.Map overrides,
                                                                            org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                            boolean useSystemAsDefault)
      • getConfigPropertyAsStringLogDebug

        protected static java.lang.String getConfigPropertyAsStringLogDebug​(java.lang.String propertyKey,
                                                                            java.util.Map overrides,
                                                                            java.lang.String defaultValue,
                                                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
      • getConfigPropertyLogDebug

        protected static java.lang.Object getConfigPropertyLogDebug​(java.lang.String propertyKey,
                                                                    java.util.Map overrides,
                                                                    org.eclipse.persistence.internal.sessions.AbstractSession session)
      • getConfigPropertyLogDebug

        protected static java.lang.Object getConfigPropertyLogDebug​(java.lang.String propertyKey,
                                                                    java.util.Map overrides,
                                                                    org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                    boolean useSystemAsDefault)
      • hasConfigProperty

        public static boolean hasConfigProperty​(java.lang.String propertyKey,
                                                java.util.Map overrides)
      • getConfigProperty

        protected static java.lang.Object getConfigProperty​(java.lang.String propertyKey,
                                                            java.util.Map overrides)
      • getConfigProperty

        protected static java.lang.Object getConfigProperty​(java.lang.String propertyKey,
                                                            java.util.Map overrides,
                                                            boolean useSystemAsDefault)
      • getConfigProperty

        protected static java.lang.Object getConfigProperty​(java.lang.String propertyKey,
                                                            java.util.Map overrides,
                                                            java.lang.Object defaultObj)
      • getEntityManagerSetupImpl

        public static EntityManagerSetupImpl getEntityManagerSetupImpl​(java.lang.String emName)
        Return the setup class for a given entity manager name
        Parameters:
        emName -
      • login

        protected static void login​(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                                    java.util.Map properties,
                                    boolean requiresConnection)
        Logs in to given session. If user has not specified TARGET_DATABASE the platform would be auto detected
        Parameters:
        session - The session to login to.
        properties - User specified properties for the persistence unit
      • mergeMaps

        public static java.util.Map mergeMaps​(java.util.Map target,
                                              java.util.Map source)
        Merge the properties from the source object into the target object. If the property exists in both objects, use the one from the target
        Parameters:
        target -
        source -
        Returns:
        the target object
      • removeSpecifiedProperties

        public static java.util.Map removeSpecifiedProperties​(java.util.Map source,
                                                              java.util.Collection keysToBeRemoved)
        Copies source into target, removes from target all keysToBeRemoved.
        Parameters:
        source -
        keysToBeRemoved -
        Returns:
        the target object
      • keepSpecifiedProperties

        public static java.util.Map keepSpecifiedProperties​(java.util.Map source,
                                                            java.util.Collection keysToBeKept)
        target contains the entries from source with keysToBeKept.
        Parameters:
        source -
        keysToBeKept -
        Returns:
        the target object
      • splitSpecifiedProperties

        public static java.util.Map[] splitSpecifiedProperties​(java.util.Map source,
                                                               java.util.Collection keysToBeKept)
        target is a array of two Maps the first one contains specified properties; the second all the rest.
        Parameters:
        source -
        keysToBeKept -
        Returns:
        the target object
      • splitProperties

        public static java.util.Map[] splitProperties​(java.util.Map source,
                                                      java.util.Collection[] keys)
        Source Map is divided between Map[] in target. Target's i-th member contains all source's Map.Entries keys for which are in keys[i] Collection. Target's size equals keys' size + 1: all the source's Map.Entries not found in any of keys Collections go into the last target's map.
        Parameters:
        source -
        keys - is array of Maps of size n
        Returns:
        the target object is array of Maps of size n+1
      • translateOldProperties

        protected static void translateOldProperties​(java.util.Map m,
                                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
        This is a TEMPORARY method that will be removed. DON'T USE THIS METHOD - for internal use only.
        Parameters:
        Map - m
        AbstractSession - session
      • warnOldProperties

        protected static void warnOldProperties​(java.util.Map m,
                                                org.eclipse.persistence.internal.sessions.AbstractSession session)