public class EntityManagerSetupImpl
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
enableLazyForOneToOne |
static java.lang.String |
ERROR_LOADING_XML_FILE
Initial -----> PredeployFailed
| |
V V
|-> Predeployed --> DeployFailed
| | | |
| V V V
| Deployed -> Undeployed-->|
| |
|<-------------------------V
|
static java.lang.String |
EXCEPTION_LOADING_ENTITY_CLASS |
protected int |
factoryCount |
protected boolean |
isInContainerMode |
protected javax.persistence.spi.PersistenceUnitInfo |
persistenceUnitInfo |
protected java.util.Map |
predeployProperties |
protected MetadataProcessor |
processor |
protected SecurableObjectHolder |
securableObjectHolder |
protected ServerSession |
session |
protected java.lang.String |
state |
static java.lang.String |
STATE_DEPLOY_FAILED |
static java.lang.String |
STATE_DEPLOYED |
static java.lang.String |
STATE_INITIAL |
static java.lang.String |
STATE_PREDEPLOY_FAILED |
static java.lang.String |
STATE_PREDEPLOYED |
static java.lang.String |
STATE_UNDEPLOYED |
Constructor and Description |
---|
EntityManagerSetupImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
addProjectToSession(ServerSession session,
Project project)
INTERNAL:
Adds descriptors plus sequencing info found on the project to the session.
|
protected void |
addSessionToGlobalSessionManager()
INTERNAL:
Put the given session into the session manager so it can be looked up later
|
protected void |
assignCMP3Policy()
INTERNAL:
Assign a CMP3Policy to each descriptor
|
ServerSession |
deploy(java.lang.ClassLoader realClassLoader,
java.util.Map additionalProperties)
Deploy a persistence session and return an EntityManagerFactory.
|
protected static java.lang.Class |
findClass(java.lang.String className,
java.lang.ClassLoader loader) |
protected static java.lang.Class |
findClassForProperty(java.lang.String className,
java.lang.String propertyName,
java.lang.ClassLoader loader) |
java.lang.String |
getConfigPropertyAsString(java.lang.String propertyKey) |
java.lang.String |
getConfigPropertyAsString(java.lang.String propertyKey,
java.lang.String defaultValue)
Check the provided map for an object with the given key.
|
protected javax.sql.DataSource |
getDatasourceFromProperties(java.util.Map m,
java.lang.String property,
javax.sql.DataSource defaultDataSource)
This is used to return either the defaultDatasource or, if one exists, a datasource
defined under the property from the Map m.
|
java.lang.String |
getDeployedSessionName()
Return the name of the session this SetupImpl is building.
|
int |
getFactoryCount() |
javax.persistence.spi.PersistenceUnitInfo |
getPersistenceUnitInfo() |
protected void |
initOrUpdateLogging(java.util.Map m,
SessionLog log) |
protected void |
initServerSession(java.util.Map m)
Normally when a property is missing nothing should be applied to the session.
|
boolean |
isDeployed() |
boolean |
isDeployFailed() |
boolean |
isInContainerMode() |
boolean |
isInitial() |
boolean |
isPredeployed() |
boolean |
isPredeployFailed() |
boolean |
isUndeployed() |
boolean |
isValidationOnly(java.util.Map m) |
protected boolean |
isValidationOnly(java.util.Map m,
boolean shouldMergeMap) |
protected java.util.Map |
mergeWithExistingMap(java.util.Map m) |
javax.persistence.spi.ClassTransformer |
predeploy(javax.persistence.spi.PersistenceUnitInfo info,
java.util.Map extendedProperties)
Perform any steps necessary prior to actual deployment.
|
protected void |
processDescriptorCustomizers(java.util.Map m,
java.lang.ClassLoader loader) |
protected void |
processSessionCustomizer(java.util.Map m,
java.lang.ClassLoader loader) |
protected void |
removeSessionFromGlobalSessionManager()
This method can be used to ensure the session represented by emSetupImpl
is removed from the SessionManager.
|
void |
setIsInContainerMode(boolean isInContainerMode)
This sets the isInContainerMode flag.
|
protected void |
setServerSessionName(java.util.Map m)
Set ServerSession name but do not register the session.
|
boolean |
shouldGetSessionOnCreateFactory(java.util.Map m) |
boolean |
shouldRedeploy() |
void |
undeploy()
Undeploy may be called several times, but only the call that decreases
factoryCount to 0 disconnects the session and removes it from the session manager.
|
protected void |
updateDescriptorCacheSettings(java.util.Map m,
java.lang.ClassLoader loader) |
protected void |
updateLoggers(java.util.Map m,
boolean serverPlatformChanged,
boolean sessionNameChanged,
java.lang.ClassLoader loader)
INTERNAL:
Update loggers and settings for the singleton logger and the session logger.
|
protected void |
updateLoginDefaultConnector(DatasourceLogin login,
java.util.Map m)
In cases where there is no data source, we will use properties to configure the login for
our session.
|
protected void |
updateLogins(java.util.Map m)
Override the default login creation method.
|
protected void |
updatePools(java.util.Map m) |
protected boolean |
updateServerPlatform(java.util.Map m,
java.lang.ClassLoader loader)
INTERNAL:
Updates the TopLink ServerPlatform class for use with this platform.
|
protected void |
updateServerSession(java.util.Map m,
java.lang.ClassLoader loader)
Make any changes to our ServerSession that can be made after it is created.
|
protected boolean |
updateSessionName(java.util.Map m)
Updates server session name if changed.
|
protected MetadataProcessor processor
protected javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo
protected java.util.Map predeployProperties
protected int factoryCount
protected ServerSession session
protected boolean isInContainerMode
protected boolean enableLazyForOneToOne
protected SecurableObjectHolder securableObjectHolder
public static final java.lang.String STATE_INITIAL
public static final java.lang.String STATE_PREDEPLOYED
public static final java.lang.String STATE_DEPLOYED
public static final java.lang.String STATE_PREDEPLOY_FAILED
public static final java.lang.String STATE_DEPLOY_FAILED
public static final java.lang.String STATE_UNDEPLOYED
protected java.lang.String state
public static final java.lang.String ERROR_LOADING_XML_FILE
public static final java.lang.String EXCEPTION_LOADING_ENTITY_CLASS
protected void removeSessionFromGlobalSessionManager()
public ServerSession deploy(java.lang.ClassLoader realClassLoader, java.util.Map additionalProperties)
realClassLoader
- The class loader that was used to load the entity classes. This loader
will be maintained for the lifespan of the loaded classes.additionalProperties
- added to predeployProperties for updateServerSession overriding existing properties.
In JSE case it allows to alter properties in main (as opposed to preMain where preDeploy is called).protected void addProjectToSession(ServerSession session, Project project)
protected void addSessionToGlobalSessionManager()
protected void assignCMP3Policy()
protected boolean updateServerPlatform(java.util.Map m, java.lang.ClassLoader loader)
protected void updateLoggers(java.util.Map m, boolean serverPlatformChanged, boolean sessionNameChanged, java.lang.ClassLoader loader)
m
- the properties mapserverPlatformChanged
- the boolean that denotes a serverPlatform change in the session.sessionNameChanged
- the boolean that denotes a sessionNameChanged change in the session.protected static java.lang.Class findClass(java.lang.String className, java.lang.ClassLoader loader) throws java.lang.ClassNotFoundException, java.security.PrivilegedActionException
java.lang.ClassNotFoundException
java.security.PrivilegedActionException
protected static java.lang.Class findClassForProperty(java.lang.String className, java.lang.String propertyName, java.lang.ClassLoader loader)
protected void updateDescriptorCacheSettings(java.util.Map m, java.lang.ClassLoader loader)
public javax.persistence.spi.ClassTransformer predeploy(javax.persistence.spi.PersistenceUnitInfo info, java.util.Map extendedProperties)
predeploy(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
public java.lang.String getConfigPropertyAsString(java.lang.String propertyKey, java.lang.String defaultValue)
propertyKey
- defaultValue
- public java.lang.String getConfigPropertyAsString(java.lang.String propertyKey)
public java.lang.String getDeployedSessionName()
public javax.persistence.spi.PersistenceUnitInfo getPersistenceUnitInfo()
public boolean isValidationOnly(java.util.Map m)
protected boolean isValidationOnly(java.util.Map m, boolean shouldMergeMap)
public boolean shouldGetSessionOnCreateFactory(java.util.Map m)
protected java.util.Map mergeWithExistingMap(java.util.Map m)
public boolean isInContainerMode()
protected void updateLogins(java.util.Map m)
m
- protected javax.sql.DataSource getDatasourceFromProperties(java.util.Map m, java.lang.String property, javax.sql.DataSource defaultDataSource)
protected void updateLoginDefaultConnector(DatasourceLogin login, java.util.Map m)
login
- m
- protected void updatePools(java.util.Map m)
protected void initServerSession(java.util.Map m)
m
- protected void setServerSessionName(java.util.Map m)
m
- the combined properties map.protected void updateServerSession(java.util.Map m, java.lang.ClassLoader loader)
m
- public void setIsInContainerMode(boolean isInContainerMode)
isInContainerMode
- protected void processSessionCustomizer(java.util.Map m, java.lang.ClassLoader loader)
protected void initOrUpdateLogging(java.util.Map m, SessionLog log)
protected boolean updateSessionName(java.util.Map m)
protected void processDescriptorCustomizers(java.util.Map m, java.lang.ClassLoader loader)
public boolean isInitial()
public boolean isPredeployed()
public boolean isDeployed()
public boolean isUndeployed()
public boolean isPredeployFailed()
public boolean isDeployFailed()
public int getFactoryCount()
public boolean shouldRedeploy()
public void undeploy()