public class EntityManagerSetupImpl extends java.lang.Object implements MetadataRefreshListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
connectionPropertyNames |
static java.lang.String |
ERROR_LOADING_XML_FILE
Initial -----------> PredeployFailed ---
| |
V |
Predeployed ---> DeployFailed -- |
| | |
V V V
HalfDeployed --> Deployed -> Undeployed
| ^
V |
DeployFailed -------------------
|
static java.lang.String |
EXCEPTION_LOADING_ENTITY_CLASS |
static java.lang.String |
STATE_DEPLOY_FAILED |
static java.lang.String |
STATE_DEPLOYED |
static java.lang.String |
STATE_HALF_DEPLOYED |
static java.lang.String |
STATE_HALF_PREDEPLOYED_COMPOSITE_MEMBER |
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() |
EntityManagerSetupImpl(java.lang.String persistenceUnitUniqueName,
java.lang.String sessionName) |
Modifier and Type | Method and Description |
---|---|
void |
addStructConverters()
Add the StructConverters that were specified by annotation on the DatabasePlatform
This method must be called after the DatabasePlatform has been detected
|
void |
changeSessionName(java.lang.String newSessionName) |
AbstractSession |
deploy(java.lang.ClassLoader realClassLoader,
java.util.Map additionalProperties)
Deploy a persistence session and return an EntityManagerFactory.
|
EntityManagerSetupImpl |
getCompositeEmSetupImpl() |
static ConnectionPolicy.ExclusiveMode |
getConnectionPolicyExclusiveModeFromProperties(java.util.Map m,
AbstractSession abstractSession,
boolean useSystemAsDefault) |
DatabaseSessionImpl |
getDatabaseSession() |
DatabaseSessionImpl |
getDatabaseSession(java.util.Map props)
We may be provided a connection via the properties to use.
|
java.lang.String |
getDeployedSessionName()
Return the name of the session this SetupImpl is building.
|
int |
getFactoryCount() |
javax.persistence.metamodel.Metamodel |
getMetamodel(java.lang.ClassLoader classLoader)
INTERNAL:
Return an instance of Metamodel interface for access to the
metamodel of the persistence unit.
|
static java.lang.String |
getOrBuildSessionName(java.util.Map properties,
javax.persistence.spi.PersistenceUnitInfo puInfo,
java.lang.String persistenceUnitUniqueName) |
javax.persistence.spi.PersistenceUnitInfo |
getPersistenceUnitInfo() |
java.lang.String |
getPersistenceUnitUniqueName() |
AbstractSession |
getSession() |
java.lang.String |
getSessionName() |
boolean |
isComposite() |
static boolean |
isComposite(javax.persistence.spi.PersistenceUnitInfo puInfo) |
boolean |
isCompositeMember() |
boolean |
isDeployed() |
boolean |
isDeployFailed() |
boolean |
isHalfDeployed() |
boolean |
isHalfPredeployedCompositeMember() |
boolean |
isInContainerMode() |
boolean |
isInitial() |
boolean |
isMetadataExpired()
Used to indicate that an EntityManagerFactoryImpl based on this
EntityManagerSetupImpl has been refreshed.
|
boolean |
isPredeployed() |
boolean |
isPredeployFailed() |
boolean |
isUndeployed() |
boolean |
isValidationOnly(java.util.Map m) |
boolean |
mustBeCompositeMember() |
static boolean |
mustBeCompositeMember(javax.persistence.spi.PersistenceUnitInfo puInfo) |
javax.persistence.spi.ClassTransformer |
predeploy(javax.persistence.spi.PersistenceUnitInfo info,
java.util.Map extendedProperties)
Perform any steps necessary prior to actual deployment.
|
void |
preInitializeCanonicalMetamodel(EntityManagerFactoryImpl factory)
INTERNAL:
First phase of canonical metamodel initialization.
|
void |
preInitializeMetamodel()
INTERNAL:
Cause the first phase of metamodel initialization.
|
EntityManagerSetupImpl |
refreshMetadata(java.util.Map properties)
Create a new version of this EntityManagerSetupImpl and cache it.
|
void |
setCompositeEmSetupImpl(EntityManagerSetupImpl compositeEmSetupImpl) |
void |
setIsInContainerMode(boolean isInContainerMode)
This sets the isInContainerMode flag.
|
void |
setIsMetadataExpired(boolean hasExpiredMetadata)
Used to indicate that an EntityManagerFactoryImpl based on this
EntityManagerSetupImpl has been refreshed.
|
void |
setMetamodel(javax.persistence.metamodel.Metamodel aMetamodel)
INTERNAL:
Convenience function to allow us to reset the Metamodel
in the possible case that we want to regenerate it.
|
void |
setRequiresConnection(boolean requiresConnection)
INTERNAL:
By default we require a connection to the database.
|
void |
setStaticWeaveInfo(StaticWeaveInfo staticWeaveInfo) |
boolean |
shouldGetSessionOnCreateFactory(java.util.Map m)
Return if the session should be deployed and connected during the creation of the EntityManagerFactory,
or if it should be deferred until createEntityManager().
|
boolean |
shouldRedeploy() |
boolean |
shouldSendMetadataRefreshCommand(java.util.Map m)
Return if MetadataSource refresh commands should be sent when refresh is called
Checks the PersistenceUnitProperties.METADATA_SOURCE_RCM_COMMAND property and defaults to true.
|
static void |
throwPersistenceUnitNameAlreadyInUseException(java.lang.String puName,
javax.persistence.spi.PersistenceUnitInfo newPuInfo,
javax.persistence.spi.PersistenceUnitInfo exsitingPuInfo) |
void |
triggerMetadataRefresh(java.util.Map properties)
This method is just a wrapper on refreshMetadata so that core does not need a dependency on JPA
due to the EntityManagerSetupImpl return value.
|
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.
|
static void |
updateCaseSensitivitySettings(java.util.Map m,
MetadataProject project,
AbstractSession session)
/**
Enable or disable forcing field names to be case insensitive.
|
void |
writeDDL(java.util.Map props,
DatabaseSessionImpl session,
java.lang.ClassLoader classLoader)
INTERNAL:
Generate the DDL per the properties specified.
|
public static final java.lang.String STATE_INITIAL
public static final java.lang.String STATE_PREDEPLOYED
public static final java.lang.String STATE_HALF_DEPLOYED
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
public static final java.lang.String STATE_HALF_PREDEPLOYED_COMPOSITE_MEMBER
public static final java.lang.String ERROR_LOADING_XML_FILE
public static final java.lang.String EXCEPTION_LOADING_ENTITY_CLASS
public static java.lang.String[] connectionPropertyNames
public EntityManagerSetupImpl(java.lang.String persistenceUnitUniqueName, java.lang.String sessionName)
public EntityManagerSetupImpl()
public static java.lang.String getOrBuildSessionName(java.util.Map properties, javax.persistence.spi.PersistenceUnitInfo puInfo, java.lang.String persistenceUnitUniqueName)
public void changeSessionName(java.lang.String newSessionName)
public AbstractSession 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 persistence unit properties for updateServerSession overriding existing properties.
In JSE case it allows to alter properties in main (as opposed to preMain where preDeploy is called).public void addStructConverters()
public AbstractSession getSession()
public DatabaseSessionImpl getDatabaseSession()
public DatabaseSessionImpl getDatabaseSession(java.util.Map props)
public static ConnectionPolicy.ExclusiveMode getConnectionPolicyExclusiveModeFromProperties(java.util.Map m, AbstractSession abstractSession, boolean useSystemAsDefault)
public javax.persistence.spi.ClassTransformer predeploy(javax.persistence.spi.PersistenceUnitInfo info, java.util.Map extendedProperties)
deploy(ClassLoader, Map)
public java.lang.String getDeployedSessionName()
public javax.persistence.spi.PersistenceUnitInfo getPersistenceUnitInfo()
public boolean isValidationOnly(java.util.Map m)
public boolean shouldGetSessionOnCreateFactory(java.util.Map m)
public boolean isInContainerMode()
public void setIsInContainerMode(boolean isInContainerMode)
public void setIsMetadataExpired(boolean hasExpiredMetadata)
public boolean isInitial()
public boolean isMetadataExpired()
public boolean isPredeployed()
public boolean isDeployed()
public boolean isHalfDeployed()
public boolean isUndeployed()
public boolean isPredeployFailed()
public boolean isDeployFailed()
public boolean isHalfPredeployedCompositeMember()
public java.lang.String getPersistenceUnitUniqueName()
public int getFactoryCount()
public java.lang.String getSessionName()
public boolean shouldRedeploy()
public boolean shouldSendMetadataRefreshCommand(java.util.Map m)
public void undeploy()
public void setRequiresConnection(boolean requiresConnection)
public static void updateCaseSensitivitySettings(java.util.Map m, MetadataProject project, AbstractSession session)
public javax.persistence.metamodel.Metamodel getMetamodel(java.lang.ClassLoader classLoader)
public void setMetamodel(javax.persistence.metamodel.Metamodel aMetamodel)
aMetamodel
- public boolean mustBeCompositeMember()
public boolean isCompositeMember()
public boolean isComposite()
public static boolean mustBeCompositeMember(javax.persistence.spi.PersistenceUnitInfo puInfo)
public static boolean isComposite(javax.persistence.spi.PersistenceUnitInfo puInfo)
public void setCompositeEmSetupImpl(EntityManagerSetupImpl compositeEmSetupImpl)
public EntityManagerSetupImpl getCompositeEmSetupImpl()
public void setStaticWeaveInfo(StaticWeaveInfo staticWeaveInfo)
public void preInitializeMetamodel()
public void preInitializeCanonicalMetamodel(EntityManagerFactoryImpl factory)
factory
- public static void throwPersistenceUnitNameAlreadyInUseException(java.lang.String puName, javax.persistence.spi.PersistenceUnitInfo newPuInfo, javax.persistence.spi.PersistenceUnitInfo exsitingPuInfo)
public EntityManagerSetupImpl refreshMetadata(java.util.Map properties)
properties
- public void triggerMetadataRefresh(java.util.Map properties)
triggerMetadataRefresh
in interface MetadataRefreshListener
refreshMetadata
public void writeDDL(java.util.Map props, DatabaseSessionImpl session, java.lang.ClassLoader classLoader)
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference