public class PersistenceUnitInfoImpl extends java.lang.Object implements PersistenceUnitInfo
Modifier and Type | Class and Description |
---|---|
static class |
PersistenceUnitInfoImpl.PersistenceClassFileTransformer |
Constructor and Description |
---|
PersistenceUnitInfoImpl() |
PersistenceUnitInfoImpl(PersistenceClassLoaderHandler persistenceClassLoaderHandler) |
Modifier and Type | Method and Description |
---|---|
void |
addManagedClassName(java.lang.String className) |
void |
addMappingFileName(java.lang.String mappingFileName) |
void |
addTransformer(ClassTransformer classTransformer)
Add a transformer supplied by the provider that will be
called for every new class definition or class redefinition
that gets loaded by the loader returned by the
PersistenceUnitInfo.getClassLoader() method. |
boolean |
excludeUnlistedClasses()
Returns whether classes in the root of the persistence unit
that have not been explicitly listed are to be included in the
set of managed classes.
|
java.lang.ClassLoader |
getClassLoader()
Returns ClassLoader that the provider may use to load any
classes, resources, or open URLs.
|
java.lang.String |
getId() |
java.util.List<java.net.URL> |
getJarFileUrls()
Returns a list of URLs for the jar files or exploded jar
file directories that the persistence provider must examine
for managed classes of the persistence unit.
|
javax.sql.DataSource |
getJtaDataSource()
Returns the JTA-enabled data source to be used by the
persistence provider.
|
java.lang.String |
getJtaDataSourceName() |
java.util.List<java.lang.String> |
getManagedClassNames()
Returns the list of the names of the classes that the
persistence provider must add to its set of managed
classes.
|
java.util.List<java.lang.String> |
getMappingFileNames()
Returns the list of the names of the mapping files that the
persistence provider must load to determine the mappings for
the entity classes.
|
java.lang.ClassLoader |
getNewTempClassLoader()
Return a new instance of a ClassLoader that the provider may
use to temporarily load any classes, resources, or open
URLs.
|
javax.sql.DataSource |
getNonJtaDataSource()
Returns the non-JTA-enabled data source to be used by the
persistence provider for accessing data outside a JTA
transaction.
|
java.lang.String |
getNonJtaDataSourceName() |
java.lang.String |
getPersistenceProviderClassName()
Returns the fully qualified name of the persistence provider
implementation class.
|
java.lang.String |
getPersistenceUnitName()
Returns the name of the persistence unit.
|
java.net.URL |
getPersistenceUnitRootUrl()
Returns the URL for the jar file or directory that is the
root of the persistence unit.
|
java.lang.String |
getPersistenceXMLSchemaVersion()
Returns the schema version of the
persistence.xml file. |
java.util.Properties |
getProperties()
Returns a properties object.
|
SharedCacheMode |
getSharedCacheMode()
Returns the specification of how the provider must use
a second-level cache for the persistence unit.
|
PersistenceUnitTransactionType |
getTransactionType()
Returns the transaction type of the entity managers created by
the
EntityManagerFactory . |
ValidationMode |
getValidationMode()
Returns the validation mode to be used by the persistence
provider for the persistence unit.
|
boolean |
isLazilyInitialized() |
static boolean |
isServerClass(java.lang.String name) |
void |
setClassLoader(java.lang.ClassLoader classLoader) |
void |
setExcludeUnlistedClasses(boolean excludeUnlistedClasses) |
void |
setId(java.lang.String id) |
void |
setJtaDataSource(javax.sql.CommonDataSource jtaDataSource) |
void |
setJtaDataSourceName(java.lang.String jtaDataSourceName) |
void |
setLazilyInitialized(boolean lazilyInitialized) |
void |
setManagedClassNames(java.util.List<java.lang.String> managedClassNames) |
void |
setMappingFileNames(java.util.List<java.lang.String> mappingFileNames) |
void |
setNonJtaDataSource(javax.sql.CommonDataSource nonJtaDataSource) |
void |
setNonJtaDataSourceName(java.lang.String nonJtaDataSourceName) |
void |
setPersistenceProviderClassName(java.lang.String persistenceProviderClassName) |
void |
setPersistenceUnitName(java.lang.String persistenceUnitName) |
void |
setPersistenceXMLSchemaVersion(java.lang.String persistenceXMLSchemaVersion) |
void |
setProperties(java.util.Properties properties) |
void |
setRootUrlAndJarUrls(java.lang.String persistenceUnitRootUrl,
java.util.List<java.lang.String> jarFiles) |
void |
setSharedCacheMode(SharedCacheMode sharedCacheMode) |
void |
setTransactionType(PersistenceUnitTransactionType transactionType) |
void |
setValidationMode(ValidationMode validationMode) |
public PersistenceUnitInfoImpl()
public PersistenceUnitInfoImpl(PersistenceClassLoaderHandler persistenceClassLoaderHandler)
public java.lang.String getId()
public void setId(java.lang.String id)
public java.lang.String getPersistenceUnitName()
PersistenceUnitInfo
name
attribute in the persistence.xml
file.getPersistenceUnitName
in interface PersistenceUnitInfo
public void setPersistenceUnitName(java.lang.String persistenceUnitName)
public java.lang.String getPersistenceProviderClassName()
PersistenceUnitInfo
provider
element in
the persistence.xml
file.getPersistenceProviderClassName
in interface PersistenceUnitInfo
public void setPersistenceProviderClassName(java.lang.String persistenceProviderClassName)
public PersistenceUnitTransactionType getTransactionType()
PersistenceUnitInfo
EntityManagerFactory
. The transaction type corresponds to
the transaction-type
attribute in the persistence.xml
file.getTransactionType
in interface PersistenceUnitInfo
public void setTransactionType(PersistenceUnitTransactionType transactionType)
public javax.sql.DataSource getJtaDataSource()
PersistenceUnitInfo
jta-data-source
element in the persistence.xml
file or is
provided at deployment or by the container.getJtaDataSource
in interface PersistenceUnitInfo
public void setJtaDataSource(javax.sql.CommonDataSource jtaDataSource)
public javax.sql.DataSource getNonJtaDataSource()
PersistenceUnitInfo
non-jta-data-source
element in the persistence.xml
file or
provided at deployment or by the container.getNonJtaDataSource
in interface PersistenceUnitInfo
public void setNonJtaDataSource(javax.sql.CommonDataSource nonJtaDataSource)
public java.util.List<java.lang.String> getMappingFileNames()
PersistenceUnitInfo
mapping-file
element in the
persistence.xml
file.getMappingFileNames
in interface PersistenceUnitInfo
public void setMappingFileNames(java.util.List<java.lang.String> mappingFileNames)
public void addMappingFileName(java.lang.String mappingFileName)
public java.util.List<java.net.URL> getJarFileUrls()
PersistenceUnitInfo
jar-file
element in the
persistence.xml
file. A URL will either be a
file: URL referring to a jar file or referring to a directory
that contains an exploded jar file, or some other URL from
which an InputStream in jar format can be obtained.getJarFileUrls
in interface PersistenceUnitInfo
public java.net.URL getPersistenceUnitRootUrl()
PersistenceUnitInfo
getPersistenceUnitRootUrl
in interface PersistenceUnitInfo
public void setRootUrlAndJarUrls(java.lang.String persistenceUnitRootUrl, java.util.List<java.lang.String> jarFiles) throws java.net.MalformedURLException
java.net.MalformedURLException
public java.util.List<java.lang.String> getManagedClassNames()
PersistenceUnitInfo
class
element in the
persistence.xml
file.getManagedClassNames
in interface PersistenceUnitInfo
public void setManagedClassNames(java.util.List<java.lang.String> managedClassNames)
public void addManagedClassName(java.lang.String className)
public boolean excludeUnlistedClasses()
PersistenceUnitInfo
exclude-unlisted-classes
element in the persistence.xml
file.excludeUnlistedClasses
in interface PersistenceUnitInfo
public void setExcludeUnlistedClasses(boolean excludeUnlistedClasses)
public java.util.Properties getProperties()
PersistenceUnitInfo
property
element in the persistence.xml
file
or to a property set by the container.getProperties
in interface PersistenceUnitInfo
public void setProperties(java.util.Properties properties)
public java.lang.ClassLoader getClassLoader()
PersistenceUnitInfo
getClassLoader
in interface PersistenceUnitInfo
public void setClassLoader(java.lang.ClassLoader classLoader)
public void addTransformer(ClassTransformer classTransformer)
PersistenceUnitInfo
PersistenceUnitInfo.getClassLoader()
method. The transformer
has no effect on the result returned by the
PersistenceUnitInfo.getNewTempClassLoader()
method.
Classes are only transformed once within the same classloading
scope, regardless of how many persistence units they may be
a part of.addTransformer
in interface PersistenceUnitInfo
classTransformer
- provider-supplied transformer that the
container invokes at class-(re)definition timepublic java.lang.ClassLoader getNewTempClassLoader()
PersistenceUnitInfo
PersistenceUnitInfo.getClassLoader()
. None of the classes loaded
by this class loader will be visible to application
components. The provider may only use this ClassLoader within
the scope of the PersistenceProvider.createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
call.getNewTempClassLoader
in interface PersistenceUnitInfo
public boolean isLazilyInitialized()
public void setLazilyInitialized(boolean lazilyInitialized)
public static boolean isServerClass(java.lang.String name)
public java.lang.String getPersistenceXMLSchemaVersion()
PersistenceUnitInfo
persistence.xml
file.getPersistenceXMLSchemaVersion
in interface PersistenceUnitInfo
public void setPersistenceXMLSchemaVersion(java.lang.String persistenceXMLSchemaVersion)
persistenceXMLSchemaVersion
- the persistenceXMLSchemaVersion to setpublic SharedCacheMode getSharedCacheMode()
PersistenceUnitInfo
shared-cache-mode
element in the persistence.xml
file.getSharedCacheMode
in interface PersistenceUnitInfo
public void setSharedCacheMode(SharedCacheMode sharedCacheMode)
sharedCacheMode
- the sharedCacheMode to setpublic ValidationMode getValidationMode()
PersistenceUnitInfo
validation-mode
element in the
persistence.xml
file.getValidationMode
in interface PersistenceUnitInfo
public void setValidationMode(ValidationMode validationMode)
validationMode
- the validationMode to setpublic java.lang.String getJtaDataSourceName()
public void setJtaDataSourceName(java.lang.String jtaDataSourceName)
public java.lang.String getNonJtaDataSourceName()
public void setNonJtaDataSourceName(java.lang.String nonJtaDataSourceName)