public class EntityManagerSetupImpl extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
enableLazyForOneToOne |
static String |
ERROR_LOADING_XML_FILE
Initial -----> PredeployFailed
| |
V V
|-> Predeployed --> DeployFailed
| | | |
| V V V
| Deployed -> Undeployed-->|
| |
|<-------------------------V
|
static String |
EXCEPTION_LOADING_ENTITY_CLASS |
protected int |
factoryCount |
protected boolean |
isInContainerMode |
protected PersistenceUnitInfo |
persistenceUnitInfo |
protected Map |
predeployProperties |
protected MetadataProcessor |
processor |
protected SecurableObjectHolder |
securableObjectHolder |
protected ServerSession |
session |
protected String |
state |
static String |
STATE_DEPLOY_FAILED |
static String |
STATE_DEPLOYED |
static String |
STATE_INITIAL |
static String |
STATE_PREDEPLOY_FAILED |
static String |
STATE_PREDEPLOYED |
static 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(ClassLoader realClassLoader,
Map additionalProperties)
Deploy a persistence session and return an EntityManagerFactory.
|
protected static Class |
findClass(String className,
ClassLoader loader) |
protected static Class |
findClassForProperty(String className,
String propertyName,
ClassLoader loader) |
String |
getConfigPropertyAsString(String propertyKey) |
String |
getConfigPropertyAsString(String propertyKey,
String defaultValue)
Check the provided map for an object with the given key.
|
protected DataSource |
getDatasourceFromProperties(Map m,
String property,
DataSource defaultDataSource)
This is used to return either the defaultDatasource or, if one exists, a datasource
defined under the property from the Map m.
|
String |
getDeployedSessionName()
Return the name of the session this SetupImpl is building.
|
int |
getFactoryCount() |
PersistenceUnitInfo |
getPersistenceUnitInfo() |
protected void |
initOrUpdateLogging(Map m,
SessionLog log) |
protected void |
initServerSession(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(Map m) |
protected boolean |
isValidationOnly(Map m,
boolean shouldMergeMap) |
protected Map |
mergeWithExistingMap(Map m) |
ClassTransformer |
predeploy(PersistenceUnitInfo info,
Map extendedProperties)
Perform any steps necessary prior to actual deployment.
|
protected void |
processDescriptorCustomizers(Map m,
ClassLoader loader) |
protected void |
processSessionCustomizer(Map m,
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(Map m)
Set ServerSession name but do not register the session.
|
boolean |
shouldGetSessionOnCreateFactory(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(Map m,
ClassLoader loader) |
protected void |
updateLoggers(Map m,
boolean serverPlatformChanged,
boolean sessionNameChanged,
ClassLoader loader)
INTERNAL:
Update loggers and settings for the singleton logger and the session logger.
|
protected void |
updateLoginDefaultConnector(DatasourceLogin login,
Map m)
In cases where there is no data source, we will use properties to configure the login for
our session.
|
protected void |
updateLogins(Map m)
Override the default login creation method.
|
protected void |
updatePools(Map m) |
protected boolean |
updateServerPlatform(Map m,
ClassLoader loader)
INTERNAL:
Updates the TopLink ServerPlatform class for use with this platform.
|
protected void |
updateServerSession(Map m,
ClassLoader loader)
Make any changes to our ServerSession that can be made after it is created.
|
protected boolean |
updateSessionName(Map m)
Updates server session name if changed.
|
protected MetadataProcessor processor
protected PersistenceUnitInfo persistenceUnitInfo
protected Map predeployProperties
protected int factoryCount
protected ServerSession session
protected boolean isInContainerMode
protected boolean enableLazyForOneToOne
protected SecurableObjectHolder securableObjectHolder
public static final String STATE_INITIAL
public static final String STATE_PREDEPLOYED
public static final String STATE_DEPLOYED
public static final String STATE_PREDEPLOY_FAILED
public static final String STATE_DEPLOY_FAILED
public static final String STATE_UNDEPLOYED
protected String state
public static final String ERROR_LOADING_XML_FILE
public static final String EXCEPTION_LOADING_ENTITY_CLASS
protected void removeSessionFromGlobalSessionManager()
public ServerSession deploy(ClassLoader realClassLoader, 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(Map m, ClassLoader loader)
protected void updateLoggers(Map m, boolean serverPlatformChanged, boolean sessionNameChanged, 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 Class findClass(String className, ClassLoader loader) throws ClassNotFoundException, PrivilegedActionException
protected static Class findClassForProperty(String className, String propertyName, ClassLoader loader)
protected void updateDescriptorCacheSettings(Map m, ClassLoader loader)
public ClassTransformer predeploy(PersistenceUnitInfo info, Map extendedProperties)
predeploy(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
public String getConfigPropertyAsString(String propertyKey, String defaultValue)
propertyKey
- defaultValue
- public String getDeployedSessionName()
public PersistenceUnitInfo getPersistenceUnitInfo()
public boolean isValidationOnly(Map m)
protected boolean isValidationOnly(Map m, boolean shouldMergeMap)
public boolean shouldGetSessionOnCreateFactory(Map m)
public boolean isInContainerMode()
protected void updateLogins(Map m)
m
- protected DataSource getDatasourceFromProperties(Map m, String property, DataSource defaultDataSource)
protected void updateLoginDefaultConnector(DatasourceLogin login, Map m)
login
- m
- protected void updatePools(Map m)
protected void initServerSession(Map m)
m
- protected void setServerSessionName(Map m)
m
- the combined properties map.protected void updateServerSession(Map m, ClassLoader loader)
m
- public void setIsInContainerMode(boolean isInContainerMode)
isInContainerMode
- protected void processSessionCustomizer(Map m, ClassLoader loader)
protected void initOrUpdateLogging(Map m, SessionLog log)
protected boolean updateSessionName(Map m)
protected void processDescriptorCustomizers(Map m, 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()
Copyright © 2021. All rights reserved.