Package io.helidon.integrations.cdi.jpa
Class PersistenceUnitInfoBean
java.lang.Object
io.helidon.integrations.cdi.jpa.PersistenceUnitInfoBean
- All Implemented Interfaces:
PersistenceUnitInfo
A
PersistenceUnitInfo
implementation that can be
constructed by hand.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A functional interface indicating that its implementations can supplyDataSource
s. -
Constructor Summary
ConstructorDescriptionPersistenceUnitInfoBean
(String persistenceUnitName, URL persistenceUnitRootUrl, String persistenceXMLSchemaVersion, String persistenceProviderClassName, ClassLoader classLoader, Supplier<? extends ClassLoader> tempClassLoaderSupplier, Consumer<? super ClassTransformer> classTransformerConsumer, boolean excludeUnlistedClasses, Collection<? extends URL> jarFileUrls, Collection<? extends String> managedClassNames, Collection<? extends String> mappingFileNames, String jtaDataSourceName, String nonJtaDataSourceName, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider, Properties properties, SharedCacheMode sharedCacheMode, PersistenceUnitTransactionType transactionType, ValidationMode validationMode) Creates a newPersistenceUnitInfoBean
.PersistenceUnitInfoBean
(String persistenceUnitName, URL persistenceUnitRootUrl, String persistenceXMLSchemaVersion, String persistenceProviderClassName, ClassLoader classLoader, Supplier<? extends ClassLoader> tempClassLoaderSupplier, Consumer<? super ClassTransformer> classTransformerConsumer, boolean excludeUnlistedClasses, Collection<? extends URL> jarFileUrls, Collection<? extends String> managedClassNames, Collection<? extends String> mappingFileNames, String jtaDataSourceName, String nonJtaDataSourceName, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier, Properties properties, SharedCacheMode sharedCacheMode, PersistenceUnitTransactionType transactionType, ValidationMode validationMode) Creates a newPersistenceUnitInfoBean
.PersistenceUnitInfoBean
(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider, Properties properties) Creates a newPersistenceUnitInfoBean
using as many defaults as reasonably possible.PersistenceUnitInfoBean
(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier, Properties properties) Creates a newPersistenceUnitInfoBean
using as many defaults as reasonably possible. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTransformer
(ClassTransformer classTransformer) boolean
static final PersistenceUnitInfoBean
fromPersistenceUnit
(Persistence.PersistenceUnit persistenceUnit, ClassLoader classLoader, Supplier<? extends ClassLoader> tempClassLoaderSupplier, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider) Given aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aClassLoader
for loading JPA classes and resources, aSupplier
ofClassLoader
instances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()
method, aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProvider
that can provideDataSource
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.static final PersistenceUnitInfoBean
fromPersistenceUnit
(Persistence.PersistenceUnit persistenceUnit, ClassLoader classLoader, Supplier<? extends ClassLoader> tempClassLoaderSupplier, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier) Given aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aClassLoader
for loading JPA classes and resources, aSupplier
ofClassLoader
instances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()
method, aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProvider
that can provideDataSource
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.static final PersistenceUnitInfoBean
fromPersistenceUnit
(Persistence.PersistenceUnit persistenceUnit, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider) Given aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProvider
that can supplyDataSource
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.static final PersistenceUnitInfoBean
fromPersistenceUnit
(Persistence.PersistenceUnit persistenceUnit, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier) Given aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aDataSourceProviderSupplier
that can supplyDataSourceProvider
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.final DataSource
final DataSource
toString()
-
Constructor Details
-
PersistenceUnitInfoBean
public PersistenceUnitInfoBean(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider, Properties properties) Creates a newPersistenceUnitInfoBean
using as many defaults as reasonably possible.- Parameters:
persistenceUnitName
- the name of the persistence unit thisPersistenceUnitInfoBean
represents; must not benull
persistenceUnitRootUrl
- theURL
identifying the root of the persistence unit thisPersistenceUnitInfoBean
represents; must not benull
managedClassNames
- aCollection
of fully-qualified class names identifying JPA-managed classes (such as entity classes, mapped superclasses and the like); may benull
. TheCollection
is copied and no reference to it is retained.dataSourceProvider
- aPersistenceUnitInfoBean.DataSourceProvider
capable of supplyingDataSource
instances; must not benull
properties
- aProperties
object representing the properties of the persistence unit represented by thisPersistenceUnitInfoBean
; may benull
. A reference is retained to this object.- Throws:
NullPointerException
- ifpersistenceUnitName
,persistenceUnitRootUrl
ordataSourceProvider
isnull
- See Also:
-
PersistenceUnitInfoBean
public PersistenceUnitInfoBean(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier, Properties properties) Creates a newPersistenceUnitInfoBean
using as many defaults as reasonably possible.- Parameters:
persistenceUnitName
- the name of the persistence unit thisPersistenceUnitInfoBean
represents; must not benull
persistenceUnitRootUrl
- theURL
identifying the root of the persistence unit thisPersistenceUnitInfoBean
represents; must not benull
managedClassNames
- aCollection
of fully-qualified class names identifying JPA-managed classes (such as entity classes, mapped superclasses and the like); may benull
. TheCollection
is copied and no reference to it is retained.dataSourceProviderSupplier
- aSupplier
capable of supplyingPersistenceUnitInfoBean.DataSourceProvider
instances; must not benull
properties
- aProperties
object representing the properties of the persistence unit represented by thisPersistenceUnitInfoBean
; may benull
. A reference is retained to this object.- Throws:
NullPointerException
- ifpersistenceUnitName
,persistenceUnitRootUrl
ordataSourceProviderSupplier
isnull
- See Also:
-
-
Method Details
-
getJarFileUrls
- Specified by:
getJarFileUrls
in interfacePersistenceUnitInfo
-
getPersistenceUnitRootUrl
- Specified by:
getPersistenceUnitRootUrl
in interfacePersistenceUnitInfo
-
getManagedClassNames
- Specified by:
getManagedClassNames
in interfacePersistenceUnitInfo
-
excludeUnlistedClasses
public boolean excludeUnlistedClasses()- Specified by:
excludeUnlistedClasses
in interfacePersistenceUnitInfo
-
getValidationMode
- Specified by:
getValidationMode
in interfacePersistenceUnitInfo
-
getProperties
- Specified by:
getProperties
in interfacePersistenceUnitInfo
-
getClassLoader
- Specified by:
getClassLoader
in interfacePersistenceUnitInfo
-
getPersistenceXMLSchemaVersion
- Specified by:
getPersistenceXMLSchemaVersion
in interfacePersistenceUnitInfo
-
getNewTempClassLoader
- Specified by:
getNewTempClassLoader
in interfacePersistenceUnitInfo
-
addTransformer
- Specified by:
addTransformer
in interfacePersistenceUnitInfo
-
getPersistenceUnitName
- Specified by:
getPersistenceUnitName
in interfacePersistenceUnitInfo
-
getPersistenceProviderClassName
- Specified by:
getPersistenceProviderClassName
in interfacePersistenceUnitInfo
-
getTransactionType
- Specified by:
getTransactionType
in interfacePersistenceUnitInfo
-
getJtaDataSource
- Specified by:
getJtaDataSource
in interfacePersistenceUnitInfo
-
getNonJtaDataSource
- Specified by:
getNonJtaDataSource
in interfacePersistenceUnitInfo
-
getMappingFileNames
- Specified by:
getMappingFileNames
in interfacePersistenceUnitInfo
-
toString
-
fromPersistenceUnit
public static final PersistenceUnitInfoBean fromPersistenceUnit(Persistence.PersistenceUnit persistenceUnit, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider) throws MalformedURLExceptionGiven aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProvider
that can supplyDataSource
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.This method never returns
null
.This method calls the
fromPersistenceUnit(Persistence.PersistenceUnit, ClassLoader, Supplier, URL, Map, DataSourceProvider)
method using the return value of theThread.getContextClassLoader()
method as theClassLoader
.- Parameters:
persistenceUnit
- aPersistence.PersistenceUnit
; must not benull
rootUrl
- theURL
representing the root of the persistence unit; must not benull
unlistedClasses
- aMap
of managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit
; may benull
dataSourceProvider
- aPersistenceUnitInfoBean.DataSourceProvider
; must not benull
- Returns:
- a non-
null
PersistenceUnitInfoBean
- Throws:
MalformedURLException
- if aURL
could not be constructedNullPointerException
- ifpersistenceUnit
,rootUrl
ordataSourceProvider
isnull
- See Also:
-
fromPersistenceUnit
public static final PersistenceUnitInfoBean fromPersistenceUnit(Persistence.PersistenceUnit persistenceUnit, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier) throws MalformedURLExceptionGiven aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aDataSourceProviderSupplier
that can supplyDataSourceProvider
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.This method never returns
null
.- Parameters:
persistenceUnit
- aPersistence.PersistenceUnit
; must not benull
rootUrl
- theURL
representing the root of the persistence unit; must not benull
unlistedClasses
- aMap
of managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit
; may benull
dataSourceProviderSupplier
- aSupplier
capable of supplyingPersistenceUnitInfoBean.DataSourceProvider
instances; must not benull
- Returns:
- a non-
null
PersistenceUnitInfoBean
- Throws:
MalformedURLException
- if aURL
could not be constructedNullPointerException
- ifpersistenceUnit
,rootUrl
ordataSourceProviderSupplier
isnull
-
fromPersistenceUnit
public static final PersistenceUnitInfoBean fromPersistenceUnit(Persistence.PersistenceUnit persistenceUnit, ClassLoader classLoader, Supplier<? extends ClassLoader> tempClassLoaderSupplier, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider) throws MalformedURLExceptionGiven aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aClassLoader
for loading JPA classes and resources, aSupplier
ofClassLoader
instances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()
method, aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProvider
that can provideDataSource
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.This method never returns
null
.- Parameters:
persistenceUnit
- aPersistence.PersistenceUnit
; must not benull
classLoader
- aClassLoader
that the resultingPersistenceUnitInfoBean
will use; may benull
tempClassLoaderSupplier
- aSupplier
of aClassLoader
that will be used to implement thePersistenceUnitInfo.getNewTempClassLoader()
method; may benull
rootUrl
- theURL
representing the root of the persistence unit; must not benull
unlistedClasses
- aMap
of managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit
; may benull
dataSourceProvider
- aPersistenceUnitInfoBean.DataSourceProvider
; must not benull
- Returns:
- a non-
null
PersistenceUnitInfoBean
- Throws:
MalformedURLException
- if aURL
could not be constructedNullPointerException
- ifpersistenceUnit
orrootUrl
isnull
- See Also:
-
fromPersistenceUnit
public static final PersistenceUnitInfoBean fromPersistenceUnit(Persistence.PersistenceUnit persistenceUnit, ClassLoader classLoader, Supplier<? extends ClassLoader> tempClassLoaderSupplier, URL rootUrl, Map<? extends String, ? extends Set<? extends Class<?>>> unlistedClasses, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier) throws MalformedURLExceptionGiven aPersistence.PersistenceUnit
(a Java object representation of a<persistence-unit>
element in aMETA-INF/persistence.xml
resource), aClassLoader
for loading JPA classes and resources, aSupplier
ofClassLoader
instances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()
method, aURL
representing the persistence unit's root, aMap
of unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProvider
that can provideDataSource
instances, returns aPersistenceUnitInfoBean
representing the persistence unit in question.This method never returns
null
.- Parameters:
persistenceUnit
- aPersistence.PersistenceUnit
; must not benull
classLoader
- aClassLoader
that the resultingPersistenceUnitInfoBean
will use; may benull
tempClassLoaderSupplier
- aSupplier
of aClassLoader
that will be used to implement thePersistenceUnitInfo.getNewTempClassLoader()
method; may benull
rootUrl
- theURL
representing the root of the persistence unit; must not benull
unlistedClasses
- aMap
of managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit
; may benull
dataSourceProviderSupplier
- aSupplier
ofPersistenceUnitInfoBean.DataSourceProvider
instances; must not benull
- Returns:
- a non-
null
PersistenceUnitInfoBean
- Throws:
MalformedURLException
- if aURL
could not be constructedNullPointerException
- ifpersistenceUnit
,rootUrl
ordataSourceProviderSupplier
isnull
- See Also:
-