Interface BrokerFactory
- All Superinterfaces:
Closeable, Serializable
- All Known Subinterfaces:
DistributedBrokerFactory
- All Known Implementing Classes:
AbstractBrokerFactory, AbstractStoreBrokerFactory, DelegatingBrokerFactory, DistributedJDBCBrokerFactory, JDBCBrokerFactory
Factory for
Broker instances.- Since:
- 0.4.0
- Author:
- Abe White
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(Object listener, Class<?>[] classes) Register a listener for lifecycle-related events on the specified classes.voidaddTransactionListener(Object listener) Register a listener for transaction-related events on the specified classes.voidassert that this broker is open.voidclose()Close the factory.voidcreatePersistenceStructure(boolean createSchemas) Creates the database schema and tables required by the persistence unit.voiddropPersistenceStructure(boolean dropSchemas) Drops the database schema and tables managed by the persistence unit.Return the configuration for this factory.Return properties describing this runtime.Return all of the supported properties as a set of keys.getUserObject(Object key) Get the value for the specified key from the map of user objects.booleanisClosed()Returns true if this broker factory is closed.voidlock()Synchronizes on an internal lock.Return a broker with default settings.Return a broker using the given credentials and in the given transaction and connection retain mode, optionally finding existing broker in the global transaction.newBroker(String user, String pass, boolean managed, int connRetainMode, boolean findExisting, String cfName, String cf2Name) Return a new broker using the supplied credentials transaction management mode connectionRetainMode connectionFactoriesvoidThis method is invoked AFTER a BrokerFactory has been instantiated.putUserObject(Object key, Object val) Put the specified key-value pair into the map of user objects.voidremoveLifecycleListener(Object listener) Remove a listener for lifecycle-related events.voidremoveTransactionListener(Object listener) Remove a listener for transaction-related events.voidTruncates all rows from tables managed by the persistence unit.voidunlock()Release the internal lock.voidValidates that the live database schema matches the metadata of the persistence unit.
-
Method Details
-
getConfiguration
OpenJPAConfiguration getConfiguration()Return the configuration for this factory. -
getProperties
-
getSupportedProperties
-
putUserObject
-
getUserObject
-
newBroker
Broker newBroker()Return a broker with default settings. -
newBroker
-
newBroker
Broker newBroker(String user, String pass, boolean managed, int connRetainMode, boolean findExisting, String cfName, String cf2Name) Return a new broker using the supplied- credentials
- transaction management mode
- connectionRetainMode
- connectionFactories
- Parameters:
user- Username to use when obtaining a connection. Will be ignored if a connection factory is obtained from JNDI.pass- Password to use when obtaining a connection. Will be ignored if a connection factory is obtained from JNDI.managed- Whether managed transactions will be used by this BrokerconnRetainMode-ConnectionRetainModesfindExisting- Whether the internal pool of brokers should be used.cfName- JTA ConnectionFactory to usecf2Name- Non-JTA ConnectionFactory to use.- Returns:
- A Broker which matches the provided criteria.
-
addLifecycleListener
-
removeLifecycleListener
Remove a listener for lifecycle-related events.- Since:
- 0.3.3
-
addTransactionListener
-
removeTransactionListener
-
close
-
isClosed
boolean isClosed()Returns true if this broker factory is closed. -
lock
void lock()Synchronizes on an internal lock. -
unlock
void unlock()Release the internal lock. -
assertOpen
void assertOpen()assert that this broker is open. If the broker has been closed an IllegalStateException will be thrown with information on when the broker was closed. -
postCreationCallback
void postCreationCallback()This method is invoked AFTER a BrokerFactory has been instantiated. -
createPersistenceStructure
void createPersistenceStructure(boolean createSchemas) Creates the database schema and tables required by the persistence unit. Implements thecreateaction of the JPA 3.2jakarta.persistence.SchemaManagercontract.- Since:
- 4.2.0
-
dropPersistenceStructure
void dropPersistenceStructure(boolean dropSchemas) Drops the database schema and tables managed by the persistence unit. Implements thedropaction of the JPA 3.2jakarta.persistence.SchemaManagercontract.- Since:
- 4.2.0
-
validatePersistenceStructure
-
truncateData
void truncateData()Truncates all rows from tables managed by the persistence unit. Implements thetruncateaction of the JPA 3.2jakarta.persistence.SchemaManagercontract.- Since:
- 4.2.0
-