Interface JPAEntityManagerProviderFactory
-
@ProviderType public interface JPAEntityManagerProviderFactoryA factory for creating JPAEntityManagerProvider instancesThis factory can be used if the
JPAEntityManagerProvidershould not be a public service, for example to protect a username/password.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONNECTION_LIFETIMEThe property used to set the maximum amount of time that connections in the pool should remain openstatic java.lang.StringCONNECTION_POOLING_ENABLEDThe property used to determine whether connection pooling is enabled for this resource providerstatic java.lang.StringCONNECTION_TIMEOUTThe property used to set the maximum amount of time that the pool should wait for a connectionstatic java.lang.StringIDLE_TIMEOUTThe property used to set the maximum amount of time that connections in the pool should remain idle before being closedstatic java.lang.StringLOCAL_ENLISTMENT_ENABLEDThe property used to determine whether local enlistment is enabled for this resource providerstatic java.lang.StringMAX_CONNECTIONSThe property used to set the maximum number of connections that should be held in the poolstatic java.lang.StringMIN_CONNECTIONSThe property used to set the minimum number of connections that should be held in the poolstatic java.lang.StringOSGI_RECOVERY_IDENTIFIERThe property used to set the recovery identifier that should be used by this resourcestatic java.lang.StringPRE_ENLISTED_DB_CONNECTIONThe property used to indicate that database connections will be automatically enlisted in ongoing transactions without intervention from the JPA resource providerstatic java.lang.StringTRANSACTIONAL_DB_CONNECTIONThe property used to provide aJDBCConnectionProviderto the resource provider.static java.lang.StringXA_ENLISTMENT_ENABLEDThe property used to determine whether XA enlistment is enabled for this resource providerstatic java.lang.StringXA_RECOVERY_ENABLEDThe property used to determine whether XA recovery is enabled for this resource provider
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JPAEntityManagerProvidergetProviderFor(javax.persistence.EntityManagerFactory emf, java.util.Map<java.lang.String,java.lang.Object> resourceProviderProperties)Create a privateJPAEntityManagerProviderusing an existingEntityManagerFactory.JPAEntityManagerProvidergetProviderFor(EntityManagerFactoryBuilder emfb, java.util.Map<java.lang.String,java.lang.Object> jpaProperties, java.util.Map<java.lang.String,java.lang.Object> resourceProviderProperties)Create a privateJPAEntityManagerProviderusing anEntityManagerFactoryBuilder.voidreleaseProvider(JPAEntityManagerProvider provider)Release aJPAEntityManagerProviderinstance that has been created by this factory.
-
-
-
Field Detail
-
XA_ENLISTMENT_ENABLED
static final java.lang.String XA_ENLISTMENT_ENABLED
The property used to determine whether XA enlistment is enabled for this resource provider- See Also:
- Constant Field Values
-
LOCAL_ENLISTMENT_ENABLED
static final java.lang.String LOCAL_ENLISTMENT_ENABLED
The property used to determine whether local enlistment is enabled for this resource provider- See Also:
- Constant Field Values
-
XA_RECOVERY_ENABLED
static final java.lang.String XA_RECOVERY_ENABLED
The property used to determine whether XA recovery is enabled for this resource provider- See Also:
- Constant Field Values
-
CONNECTION_POOLING_ENABLED
static final java.lang.String CONNECTION_POOLING_ENABLED
The property used to determine whether connection pooling is enabled for this resource provider- See Also:
- Constant Field Values
-
CONNECTION_TIMEOUT
static final java.lang.String CONNECTION_TIMEOUT
The property used to set the maximum amount of time that the pool should wait for a connection- See Also:
- Constant Field Values
-
IDLE_TIMEOUT
static final java.lang.String IDLE_TIMEOUT
The property used to set the maximum amount of time that connections in the pool should remain idle before being closed- See Also:
- Constant Field Values
-
CONNECTION_LIFETIME
static final java.lang.String CONNECTION_LIFETIME
The property used to set the maximum amount of time that connections in the pool should remain open- See Also:
- Constant Field Values
-
MIN_CONNECTIONS
static final java.lang.String MIN_CONNECTIONS
The property used to set the minimum number of connections that should be held in the pool- See Also:
- Constant Field Values
-
MAX_CONNECTIONS
static final java.lang.String MAX_CONNECTIONS
The property used to set the maximum number of connections that should be held in the pool- See Also:
- Constant Field Values
-
TRANSACTIONAL_DB_CONNECTION
static final java.lang.String TRANSACTIONAL_DB_CONNECTION
The property used to provide aJDBCConnectionProviderto the resource provider. This will be converted into a DataSource by the factory, and passed to theEntityManagerFactoryBuilderusing the javax.persistence.jtaDataSource property- See Also:
- Constant Field Values
-
PRE_ENLISTED_DB_CONNECTION
static final java.lang.String PRE_ENLISTED_DB_CONNECTION
The property used to indicate that database connections will be automatically enlisted in ongoing transactions without intervention from the JPA resource provider- See Also:
- Constant Field Values
-
OSGI_RECOVERY_IDENTIFIER
static final java.lang.String OSGI_RECOVERY_IDENTIFIER
The property used to set the recovery identifier that should be used by this resource- See Also:
- Constant Field Values
-
-
Method Detail
-
getProviderFor
JPAEntityManagerProvider getProviderFor(EntityManagerFactoryBuilder emfb, java.util.Map<java.lang.String,java.lang.Object> jpaProperties, java.util.Map<java.lang.String,java.lang.Object> resourceProviderProperties)
Create a privateJPAEntityManagerProviderusing anEntityManagerFactoryBuilder. This call may fail with aTransactionExceptionif the supplied configuration is invalid. Examples of invalid configuration include:- The properties request XA enlistment, but the provider implementation only supports local enlistment
- The properties attempt to set a recovery alias, but the provider does not support recovery.
If XA transactions are used then this factory will provide configuration to ensure that the JPA Provider can participate correctly in ongoing transactions.
- Parameters:
emfb-jpaProperties- The properties to pass to theEntityManagerFactoryBuilderin order to create the underlyingEntityManagerFactoryandEntityManagerinstancesresourceProviderProperties- Configuration properties to pass to the JPA Resource Provider runtime- Returns:
- A
JPAEntityManagerProviderthat can be used in transactions
-
getProviderFor
JPAEntityManagerProvider getProviderFor(javax.persistence.EntityManagerFactory emf, java.util.Map<java.lang.String,java.lang.Object> resourceProviderProperties)
Create a privateJPAEntityManagerProviderusing an existingEntityManagerFactory. This call may fail with aTransactionExceptionif the supplied configuration is invalid. Examples of invalid configuration include:- The properties request XA enlistment, but the provider implementation only supports local enlistment
- The properties attempt to set a recovery alias, but the provider does not support recovery.
When using this method the client is responsible for all configuration of the
EntityManagerFactory. This includes setting any relevant integration plugins for ensuring that the JPA provider can participate in the ongoing transaction context.- Parameters:
emf-resourceProviderProperties- Configuration properties to pass to the JDBC Resource Provider runtime- Returns:
- A
JPAEntityManagerProviderthat can be used in transactions
-
releaseProvider
void releaseProvider(JPAEntityManagerProvider provider)
Release aJPAEntityManagerProviderinstance that has been created by this factory. Released instances are eligible to be shut down and have any remaining open connections closed.Note that all
JPAEntityManagerProviderinstances created by this factory service are implicitly released when the factory service is released by this bundle.- Parameters:
provider-- Throws:
java.lang.IllegalArgumentException- if the supplied resource was not created by this factory service instance.
-
-