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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface indicating that its implementations can supplyDataSources. -
Constructor Summary
ConstructorsConstructorDescriptionPersistenceUnitInfoBean(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 newPersistenceUnitInfoBeanusing as many defaults as reasonably possible.PersistenceUnitInfoBean(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier, Properties properties) Creates a newPersistenceUnitInfoBeanusing as many defaults as reasonably possible. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransformer(ClassTransformer classTransformer) booleanstatic final PersistenceUnitInfoBeanfromPersistenceUnit(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.xmlresource), aClassLoaderfor loading JPA classes and resources, aSupplierofClassLoaderinstances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()method, aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProviderthat can provideDataSourceinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.static final PersistenceUnitInfoBeanfromPersistenceUnit(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.xmlresource), aClassLoaderfor loading JPA classes and resources, aSupplierofClassLoaderinstances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()method, aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProviderthat can provideDataSourceinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.static final PersistenceUnitInfoBeanfromPersistenceUnit(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.xmlresource), aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProviderthat can supplyDataSourceinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.static final PersistenceUnitInfoBeanfromPersistenceUnit(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.xmlresource), aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aDataSourceProviderSupplierthat can supplyDataSourceProviderinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.final DataSourcefinal DataSourcetoString()
-
Constructor Details
-
PersistenceUnitInfoBean
public PersistenceUnitInfoBean(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, PersistenceUnitInfoBean.DataSourceProvider dataSourceProvider, Properties properties) Creates a newPersistenceUnitInfoBeanusing as many defaults as reasonably possible.- Parameters:
persistenceUnitName- the name of the persistence unit thisPersistenceUnitInfoBeanrepresents; must not benullpersistenceUnitRootUrl- theURLidentifying the root of the persistence unit thisPersistenceUnitInfoBeanrepresents; must not benullmanagedClassNames- aCollectionof fully-qualified class names identifying JPA-managed classes (such as entity classes, mapped superclasses and the like); may benull. TheCollectionis copied and no reference to it is retained.dataSourceProvider- aPersistenceUnitInfoBean.DataSourceProvidercapable of supplyingDataSourceinstances; must not benullproperties- aPropertiesobject representing the properties of the persistence unit represented by thisPersistenceUnitInfoBean; may benull. A reference is retained to this object.- Throws:
NullPointerException- ifpersistenceUnitName,persistenceUnitRootUrlordataSourceProviderisnull- See Also:
-
PersistenceUnitInfoBean
public PersistenceUnitInfoBean(String persistenceUnitName, URL persistenceUnitRootUrl, Collection<? extends String> managedClassNames, Supplier<? extends PersistenceUnitInfoBean.DataSourceProvider> dataSourceProviderSupplier, Properties properties) Creates a newPersistenceUnitInfoBeanusing as many defaults as reasonably possible.- Parameters:
persistenceUnitName- the name of the persistence unit thisPersistenceUnitInfoBeanrepresents; must not benullpersistenceUnitRootUrl- theURLidentifying the root of the persistence unit thisPersistenceUnitInfoBeanrepresents; must not benullmanagedClassNames- aCollectionof fully-qualified class names identifying JPA-managed classes (such as entity classes, mapped superclasses and the like); may benull. TheCollectionis copied and no reference to it is retained.dataSourceProviderSupplier- aSuppliercapable of supplyingPersistenceUnitInfoBean.DataSourceProviderinstances; must not benullproperties- aPropertiesobject representing the properties of the persistence unit represented by thisPersistenceUnitInfoBean; may benull. A reference is retained to this object.- Throws:
NullPointerException- ifpersistenceUnitName,persistenceUnitRootUrlordataSourceProviderSupplierisnull- See Also:
-
-
Method Details
-
getJarFileUrls
- Specified by:
getJarFileUrlsin interfacePersistenceUnitInfo
-
getPersistenceUnitRootUrl
- Specified by:
getPersistenceUnitRootUrlin interfacePersistenceUnitInfo
-
getManagedClassNames
- Specified by:
getManagedClassNamesin interfacePersistenceUnitInfo
-
excludeUnlistedClasses
public boolean excludeUnlistedClasses()- Specified by:
excludeUnlistedClassesin interfacePersistenceUnitInfo
-
getValidationMode
- Specified by:
getValidationModein interfacePersistenceUnitInfo
-
getProperties
- Specified by:
getPropertiesin interfacePersistenceUnitInfo
-
getClassLoader
- Specified by:
getClassLoaderin interfacePersistenceUnitInfo
-
getPersistenceXMLSchemaVersion
- Specified by:
getPersistenceXMLSchemaVersionin interfacePersistenceUnitInfo
-
getNewTempClassLoader
- Specified by:
getNewTempClassLoaderin interfacePersistenceUnitInfo
-
addTransformer
- Specified by:
addTransformerin interfacePersistenceUnitInfo
-
getPersistenceUnitName
- Specified by:
getPersistenceUnitNamein interfacePersistenceUnitInfo
-
getPersistenceProviderClassName
- Specified by:
getPersistenceProviderClassNamein interfacePersistenceUnitInfo
-
getTransactionType
- Specified by:
getTransactionTypein interfacePersistenceUnitInfo
-
getJtaDataSource
- Specified by:
getJtaDataSourcein interfacePersistenceUnitInfo
-
getNonJtaDataSource
- Specified by:
getNonJtaDataSourcein interfacePersistenceUnitInfo
-
getMappingFileNames
- Specified by:
getMappingFileNamesin 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.xmlresource), aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProviderthat can supplyDataSourceinstances, returns aPersistenceUnitInfoBeanrepresenting 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 benullrootUrl- theURLrepresenting the root of the persistence unit; must not benullunlistedClasses- aMapof managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit; may benulldataSourceProvider- aPersistenceUnitInfoBean.DataSourceProvider; must not benull- Returns:
- a non-
nullPersistenceUnitInfoBean - Throws:
MalformedURLException- if aURLcould not be constructedNullPointerException- ifpersistenceUnit,rootUrlordataSourceProviderisnull- 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.xmlresource), aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aDataSourceProviderSupplierthat can supplyDataSourceProviderinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.This method never returns
null.- Parameters:
persistenceUnit- aPersistence.PersistenceUnit; must not benullrootUrl- theURLrepresenting the root of the persistence unit; must not benullunlistedClasses- aMapof managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit; may benulldataSourceProviderSupplier- aSuppliercapable of supplyingPersistenceUnitInfoBean.DataSourceProviderinstances; must not benull- Returns:
- a non-
nullPersistenceUnitInfoBean - Throws:
MalformedURLException- if aURLcould not be constructedNullPointerException- ifpersistenceUnit,rootUrlordataSourceProviderSupplierisnull
-
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.xmlresource), aClassLoaderfor loading JPA classes and resources, aSupplierofClassLoaderinstances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()method, aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProviderthat can provideDataSourceinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.This method never returns
null.- Parameters:
persistenceUnit- aPersistence.PersistenceUnit; must not benullclassLoader- aClassLoaderthat the resultingPersistenceUnitInfoBeanwill use; may benulltempClassLoaderSupplier- aSupplierof aClassLoaderthat will be used to implement thePersistenceUnitInfo.getNewTempClassLoader()method; may benullrootUrl- theURLrepresenting the root of the persistence unit; must not benullunlistedClasses- aMapof managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit; may benulldataSourceProvider- aPersistenceUnitInfoBean.DataSourceProvider; must not benull- Returns:
- a non-
nullPersistenceUnitInfoBean - Throws:
MalformedURLException- if aURLcould not be constructedNullPointerException- ifpersistenceUnitorrootUrlisnull- 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.xmlresource), aClassLoaderfor loading JPA classes and resources, aSupplierofClassLoaderinstances for helping to implement thePersistenceUnitInfo.getNewTempClassLoader()method, aURLrepresenting the persistence unit's root, aMapof unlisted managed classes (entity classes, mapped superclasses and so on) indexed by persistence unit name, and aPersistenceUnitInfoBean.DataSourceProviderthat can provideDataSourceinstances, returns aPersistenceUnitInfoBeanrepresenting the persistence unit in question.This method never returns
null.- Parameters:
persistenceUnit- aPersistence.PersistenceUnit; must not benullclassLoader- aClassLoaderthat the resultingPersistenceUnitInfoBeanwill use; may benulltempClassLoaderSupplier- aSupplierof aClassLoaderthat will be used to implement thePersistenceUnitInfo.getNewTempClassLoader()method; may benullrootUrl- theURLrepresenting the root of the persistence unit; must not benullunlistedClasses- aMapof managed classes indexed by persistence unit name whose values might not be explicitly listed in the suppliedPersistence.PersistenceUnit; may benulldataSourceProviderSupplier- aSupplierofPersistenceUnitInfoBean.DataSourceProviderinstances; must not benull- Returns:
- a non-
nullPersistenceUnitInfoBean - Throws:
MalformedURLException- if aURLcould not be constructedNullPointerException- ifpersistenceUnit,rootUrlordataSourceProviderSupplierisnull- See Also:
-