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

public Class EntityManagerFactoryProvider

extends Object
Class Inheritance
Imports
java.security.AccessController, java.util.Collection, .HashMap, .Iterator, .Map, org.eclipse.persistence.config.PersistenceUnitProperties, .TargetDatabase, org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.TableCreationType, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedGetSystemProperty, org.eclipse.persistence.internal.sessions.AbstractSession, .DatabaseSessionImpl, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.tools.schemaframework.SchemaManager

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

Field Summary

Modifier and TypeField and Description
public static final Map<String, EntityManagerSetupImpl>
protected static final String[][]

Constructor Summary

AccessConstructor and Description
public
EntityManagerFactoryProvider()

Default constructor to allow reflection.

Method Summary

Modifier and TypeMethod and Description
public static void
addEntityManagerSetupImpl(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(SchemaManager mgr, EntityManagerSetupImpl.TableCreationType
- ddl operation to be performed
ddlType
)

Calls the appropriate create,replace or alter SchemaManager api.

protected static Object
getConfigProperty(String propertyKey, Map<K, V> overrides)

protected static Object
getConfigProperty(String propertyKey, Map<K, V> overrides, boolean useSystemAsDefault)

protected static Object
getConfigProperty(String propertyKey, Map<K, V> overrides, Object defaultObj)

public static String

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
(final String
The name of the configuration System property.
propertyKey
,
final Map<K, V>
Map with property overrides.
overrides
)

Get configuration System property indicated by the specified propertyKey.

public static String
getConfigPropertyAsString(String propertyKey, Map<K, V> overrides, String defaultValue)

Check the provided map for an object with the given key.

protected static String
getConfigPropertyAsStringLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session)

protected static String
getConfigPropertyAsStringLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session, boolean useSystemAsDefault)

protected static String
getConfigPropertyAsStringLogDebug(String propertyKey, Map<K, V> overrides, String defaultValue, AbstractSession session)

protected static Object
getConfigPropertyLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session)

protected static Object
getConfigPropertyLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session, boolean useSystemAsDefault)

public static Map<String, EntityManagerSetupImpl>
public static EntityManagerSetupImpl
getEntityManagerSetupImpl(String emName)

Return the setup class for a given entity manager name

public static boolean
hasConfigProperty(String propertyKey, Map<K, V> overrides)

public static <K, V> Map<K, V>

Returns:

the target object
keepSpecifiedProperties
(Map<K, V> source, Collection<K> keysToBeKept)

target contains the entries from source with keysToBeKept.

protected static void
login(DatabaseSessionImpl
The session to login to.
session
,
Map<K, V>
User specified properties for the persistence unit
properties
,
boolean requiresConnection)

Logs in to given session.

public static <K, V> Map<K, V>

Returns:

the target object
mergeMaps
(Map<K, V> target, Map<K, V> source)

Merge the properties from the source object into the target object.

public static <K, V> Map<K, V>

Returns:

the target object
removeSpecifiedProperties
(Map<K, V> source, Collection<K> keysToBeRemoved)

Copies source into target, removes from target all keysToBeRemoved.

public static <K, V> Map<K, V>[]

Returns:

the target object is array of Maps of size n+1
splitProperties
(Map<K, V> source, Collection<K>[]
is array of Maps of size n
keys
)

Source Map is divided between Map[] in target.

public static <K, V> Map<K, V>[]

Returns:

the target object
splitSpecifiedProperties
(Map<K, V> source, Collection<K> keysToBeKept)

target is a array of two Maps the first one contains specified properties; the second all the rest.

protected static void
translateOldProperties(Map<K, V> m, AbstractSession session)

This is a TEMPORARY method that will be removed.

protected static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

emSetupImplsback to summary
public static final Map<String, EntityManagerSetupImpl> emSetupImpls
oldPropertyNamesback to summary
protected static final String[][] oldPropertyNames

Constructor Detail

EntityManagerFactoryProviderback to summary
public EntityManagerFactoryProvider()

Default constructor to allow reflection.

Method Detail

addEntityManagerSetupImplback to summary
public static void addEntityManagerSetupImpl(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

generateDefaultTablesback to summary
protected static void generateDefaultTables(SchemaManager mgr, EntityManagerSetupImpl.TableCreationType ddlType)

Calls the appropriate create,replace or alter SchemaManager api.

Parameters
ddlType:EntityManagerSetupImpl.TableCreationType

- ddl operation to be performed

getConfigPropertyback to summary
protected static Object getConfigProperty(String propertyKey, Map<K, V> overrides)
getConfigPropertyback to summary
protected static Object getConfigProperty(String propertyKey, Map<K, V> overrides, boolean useSystemAsDefault)
getConfigPropertyback to summary
protected static Object getConfigProperty(String propertyKey, Map<K, V> overrides, Object defaultObj)
getConfigPropertyAsStringback to summary
public static String getConfigPropertyAsString(final String propertyKey, final Map<K, V> overrides)

Get configuration System property indicated by the specified propertyKey. Property value may be overridden by overrides Map.

Parameters
propertyKey:String

The name of the configuration System property.

overrides:Map<K, V>

Map with property overrides.

Returns:String

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.

getConfigPropertyAsStringback to summary
public static String getConfigPropertyAsString(String propertyKey, Map<K, V> overrides, 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.

getConfigPropertyAsStringLogDebugback to summary
protected static String getConfigPropertyAsStringLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session)
getConfigPropertyAsStringLogDebugback to summary
protected static String getConfigPropertyAsStringLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session, boolean useSystemAsDefault)
getConfigPropertyAsStringLogDebugback to summary
protected static String getConfigPropertyAsStringLogDebug(String propertyKey, Map<K, V> overrides, String defaultValue, AbstractSession session)
getConfigPropertyLogDebugback to summary
protected static Object getConfigPropertyLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session)
getConfigPropertyLogDebugback to summary
protected static Object getConfigPropertyLogDebug(String propertyKey, Map<K, V> overrides, AbstractSession session, boolean useSystemAsDefault)
getEmSetupImplsback to summary
public static Map<String, EntityManagerSetupImpl> getEmSetupImpls()
getEntityManagerSetupImplback to summary
public static EntityManagerSetupImpl getEntityManagerSetupImpl(String emName)

Return the setup class for a given entity manager name

hasConfigPropertyback to summary
public static boolean hasConfigProperty(String propertyKey, Map<K, V> overrides)
keepSpecifiedPropertiesback to summary
public static <K, V> Map<K, V> keepSpecifiedProperties(Map<K, V> source, Collection<K> keysToBeKept)

target contains the entries from source with keysToBeKept.

Returns:Map<K, V>

the target object

loginback to summary
protected static void login(DatabaseSessionImpl session, Map<K, V> properties, boolean requiresConnection)

Logs in to given session. If user has not specified TARGET_DATABASE the platform would be auto detected

Parameters
session:DatabaseSessionImpl

The session to login to.

properties:Map<K, V>

User specified properties for the persistence unit

mergeMapsback to summary
public static <K, V> Map<K, V> mergeMaps(Map<K, V> target, Map<K, V> 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

Returns:Map<K, V>

the target object

removeSpecifiedPropertiesback to summary
public static <K, V> Map<K, V> removeSpecifiedProperties(Map<K, V> source, Collection<K> keysToBeRemoved)

Copies source into target, removes from target all keysToBeRemoved.

Returns:Map<K, V>

the target object

splitPropertiesback to summary
public static <K, V> Map<K, V>[] splitProperties(Map<K, V> source, Collection<K>[] 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
keys:Collection<K>[]

is array of Maps of size n

Returns:Map<K, V>[]

the target object is array of Maps of size n+1

splitSpecifiedPropertiesback to summary
public static <K, V> Map<K, V>[] splitSpecifiedProperties(Map<K, V> source, Collection<K> keysToBeKept)

target is a array of two Maps the first one contains specified properties; the second all the rest.

Returns:Map<K, V>[]

the target object

translateOldPropertiesback to summary
protected static void translateOldProperties(Map<K, V> m, AbstractSession session)

This is a TEMPORARY method that will be removed. DON'T USE THIS METHOD - for internal use only.

warnOldPropertiesback to summary
protected static void warnOldProperties(Map<K, V> m, AbstractSession session)