Package org.apache.openjpa.persistence
Class PersistenceUnitInfoImpl
- java.lang.Object
-
- org.apache.openjpa.persistence.PersistenceUnitInfoImpl
-
- All Implemented Interfaces:
jakarta.persistence.spi.PersistenceUnitInfo
,SourceTracker
public class PersistenceUnitInfoImpl extends java.lang.Object implements jakarta.persistence.spi.PersistenceUnitInfo, SourceTracker
Implementation of thePersistenceUnitInfo
interface used by OpenJPA when parsing persistence configuration information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PersistenceUnitInfoImpl.ClassResolverImpl
Simple class resolver built around the persistence unit loader.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PERSISTENCE_VERSION
-
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
-
Constructor Summary
Constructors Constructor Description PersistenceUnitInfoImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addJarFile(java.net.URL jar)
void
addJarFileName(java.lang.String name)
void
addManagedClassName(java.lang.String name)
void
addMappingFileName(java.lang.String name)
void
addTransformer(jakarta.persistence.spi.ClassTransformer transformer)
boolean
excludeUnlistedClasses()
void
fromUserProperties(java.util.Map map)
Load the given user-supplied map of properties into this persistence unit.java.lang.ClassLoader
getClassLoader()
int
getColNumber()
Return the column number in the line of the file at which this instance was parsed.java.util.List<java.net.URL>
getJarFileUrls()
javax.sql.DataSource
getJtaDataSource()
java.lang.String
getJtaDataSourceName()
int
getLineNumber()
Return the line number of the file at which this instance was parsed.java.util.List<java.lang.String>
getManagedClassNames()
java.util.List<java.lang.String>
getMappingFileNames()
java.lang.ClassLoader
getNewTempClassLoader()
javax.sql.DataSource
getNonJtaDataSource()
java.lang.String
getNonJtaDataSourceName()
java.lang.String
getPersistenceProviderClassName()
java.lang.String
getPersistenceUnitName()
java.net.URL
getPersistenceUnitRootUrl()
java.net.URL
getPersistenceXmlFileUrl()
The location of the persistence.xml resource.java.lang.String
getPersistenceXMLSchemaVersion()
java.util.Properties
getProperties()
java.lang.String
getResourceName()
Return the domain-meaningful name of the resource that was loaded from this source.jakarta.persistence.SharedCacheMode
getSharedCacheMode()
java.io.File
getSourceFile()
Return the file from which this instance was parsed.java.lang.Object
getSourceScope()
Return the domain-dependent scope of this instance within its file.int
getSourceType()
Return the type of source.jakarta.persistence.spi.PersistenceUnitTransactionType
getTransactionType()
jakarta.persistence.ValidationMode
getValidationMode()
void
processJarFileNames()
Process jar-file elements.void
setExcludeUnlistedClasses(boolean excludeUnlisted)
void
setJtaDataSource(javax.sql.DataSource ds)
void
setJtaDataSourceName(java.lang.String jta)
void
setNonJtaDataSource(javax.sql.DataSource ds)
void
setNonJtaDataSourceName(java.lang.String nonJta)
void
setPersistenceProviderClassName(java.lang.String providerClassName)
void
setPersistenceUnitName(java.lang.String emName)
void
setPersistenceUnitRootUrl(java.net.URL root)
void
setPersistenceXmlFileUrl(java.net.URL url)
The location of the persistence.xml resource.void
setPersistenceXMLSchemaVersion(java.lang.String version)
void
setProperty(java.lang.String key, java.lang.String value)
void
setSharedCacheMode(jakarta.persistence.SharedCacheMode mode)
void
setTransactionType(jakarta.persistence.spi.PersistenceUnitTransactionType transType)
void
setValidationMode(jakarta.persistence.ValidationMode mode)
java.util.Map
toOpenJPAProperties()
Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in this persistence unit info.static java.util.Map
toOpenJPAProperties(jakarta.persistence.spi.PersistenceUnitInfo info)
Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in the given persistence unit info.void
validateJarFileName(java.lang.String name)
-
-
-
Field Detail
-
PERSISTENCE_VERSION
public static final java.lang.String PERSISTENCE_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
- Specified by:
getClassLoader
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
getNewTempClassLoader
public java.lang.ClassLoader getNewTempClassLoader()
- Specified by:
getNewTempClassLoader
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
getPersistenceUnitName
public java.lang.String getPersistenceUnitName()
- Specified by:
getPersistenceUnitName
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceUnitName
public void setPersistenceUnitName(java.lang.String emName)
-
getPersistenceProviderClassName
public java.lang.String getPersistenceProviderClassName()
- Specified by:
getPersistenceProviderClassName
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceProviderClassName
public void setPersistenceProviderClassName(java.lang.String providerClassName)
-
getTransactionType
public jakarta.persistence.spi.PersistenceUnitTransactionType getTransactionType()
- Specified by:
getTransactionType
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setTransactionType
public void setTransactionType(jakarta.persistence.spi.PersistenceUnitTransactionType transType)
-
getJtaDataSourceName
public java.lang.String getJtaDataSourceName()
-
setJtaDataSourceName
public void setJtaDataSourceName(java.lang.String jta)
-
getJtaDataSource
public javax.sql.DataSource getJtaDataSource()
- Specified by:
getJtaDataSource
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setJtaDataSource
public void setJtaDataSource(javax.sql.DataSource ds)
-
getNonJtaDataSourceName
public java.lang.String getNonJtaDataSourceName()
-
setNonJtaDataSourceName
public void setNonJtaDataSourceName(java.lang.String nonJta)
-
getNonJtaDataSource
public javax.sql.DataSource getNonJtaDataSource()
- Specified by:
getNonJtaDataSource
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setNonJtaDataSource
public void setNonJtaDataSource(javax.sql.DataSource ds)
-
getPersistenceUnitRootUrl
public java.net.URL getPersistenceUnitRootUrl()
- Specified by:
getPersistenceUnitRootUrl
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceUnitRootUrl
public void setPersistenceUnitRootUrl(java.net.URL root)
-
excludeUnlistedClasses
public boolean excludeUnlistedClasses()
- Specified by:
excludeUnlistedClasses
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setExcludeUnlistedClasses
public void setExcludeUnlistedClasses(boolean excludeUnlisted)
-
getMappingFileNames
public java.util.List<java.lang.String> getMappingFileNames()
- Specified by:
getMappingFileNames
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
addMappingFileName
public void addMappingFileName(java.lang.String name)
-
getJarFileUrls
public java.util.List<java.net.URL> getJarFileUrls()
- Specified by:
getJarFileUrls
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
addJarFile
public void addJarFile(java.net.URL jar)
-
addJarFileName
public void addJarFileName(java.lang.String name)
-
processJarFileNames
public void processJarFileNames()
Process jar-file elements. An IllegalArgumentException may be thrown if the jar file does not exist in the classpath.
-
validateJarFileName
public void validateJarFileName(java.lang.String name)
-
getManagedClassNames
public java.util.List<java.lang.String> getManagedClassNames()
- Specified by:
getManagedClassNames
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
addManagedClassName
public void addManagedClassName(java.lang.String name)
-
getProperties
public java.util.Properties getProperties()
- Specified by:
getProperties
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setProperty
public void setProperty(java.lang.String key, java.lang.String value)
-
addTransformer
public void addTransformer(jakarta.persistence.spi.ClassTransformer transformer)
- Specified by:
addTransformer
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
getPersistenceXmlFileUrl
public java.net.URL getPersistenceXmlFileUrl()
The location of the persistence.xml resource. May be null.
-
setPersistenceXmlFileUrl
public void setPersistenceXmlFileUrl(java.net.URL url)
The location of the persistence.xml resource. May be null.
-
fromUserProperties
public void fromUserProperties(java.util.Map map)
Load the given user-supplied map of properties into this persistence unit.
-
toOpenJPAProperties
public java.util.Map toOpenJPAProperties()
Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in this persistence unit info.
-
toOpenJPAProperties
public static java.util.Map toOpenJPAProperties(jakarta.persistence.spi.PersistenceUnitInfo info)
Return aMap
containing the properties necessary to create aConfiguration
that reflects the information in the given persistence unit info.
-
getSourceFile
public java.io.File getSourceFile()
Description copied from interface:SourceTracker
Return the file from which this instance was parsed.- Specified by:
getSourceFile
in interfaceSourceTracker
-
getSourceScope
public java.lang.Object getSourceScope()
Description copied from interface:SourceTracker
Return the domain-dependent scope of this instance within its file.- Specified by:
getSourceScope
in interfaceSourceTracker
-
getSourceType
public int getSourceType()
Description copied from interface:SourceTracker
Return the type of source.- Specified by:
getSourceType
in interfaceSourceTracker
-
getLineNumber
public int getLineNumber()
Description copied from interface:SourceTracker
Return the line number of the file at which this instance was parsed.- Specified by:
getLineNumber
in interfaceSourceTracker
-
getColNumber
public int getColNumber()
Description copied from interface:SourceTracker
Return the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumber
in interfaceSourceTracker
-
getResourceName
public java.lang.String getResourceName()
Description copied from interface:SourceTracker
Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.- Specified by:
getResourceName
in interfaceSourceTracker
-
getPersistenceXMLSchemaVersion
public java.lang.String getPersistenceXMLSchemaVersion()
- Specified by:
getPersistenceXMLSchemaVersion
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setPersistenceXMLSchemaVersion
public void setPersistenceXMLSchemaVersion(java.lang.String version)
-
getValidationMode
public jakarta.persistence.ValidationMode getValidationMode()
- Specified by:
getValidationMode
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setValidationMode
public void setValidationMode(jakarta.persistence.ValidationMode mode)
-
getSharedCacheMode
public jakarta.persistence.SharedCacheMode getSharedCacheMode()
- Specified by:
getSharedCacheMode
in interfacejakarta.persistence.spi.PersistenceUnitInfo
-
setSharedCacheMode
public void setSharedCacheMode(jakarta.persistence.SharedCacheMode mode)
-
-