|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.kernel.AbstractBrokerFactory
public abstract class AbstractBrokerFactory
Abstract implementation of the BrokerFactory
that must be subclassed for a specific runtime.
| Constructor Summary | |
|---|---|
protected |
AbstractBrokerFactory(OpenJPAConfiguration config)
Constructor. |
| Method Summary | |
|---|---|
void |
addLifecycleListener(Object listener,
Class[] classes)
Register a listener for lifecycle-related events on the specified classes. |
protected void |
addListeners(BrokerImpl broker)
Add factory-registered lifecycle listeners to the broker. |
void |
addTransactionListener(Object listener)
Register a listener for transaction-related events on the specified classes. |
void |
close()
Close the factory. |
protected void |
configureBroker(BrokerImpl broker)
Configures the given broker with the current factory option settings. |
protected BrokerImpl |
findBroker(String user,
String pass,
boolean managed)
Find a pooled broker, or return null if none. |
protected BrokerImpl |
findTransactionalBroker(String user,
String pass)
Find a managed runtime broker associated with the current transaction, or returns null if none. |
OpenJPAConfiguration |
getConfiguration()
Return the configuration for this factory. |
protected Object |
getFactoryInitializationBanner()
Return an object to be written to the log when this broker factory initializes. |
Collection |
getOpenBrokers()
Returns a set of all the open brokers associated with this factory. |
static AbstractBrokerFactory |
getPooledFactoryForKey(Object key)
Return the pooled factory matching the given key, or null if none. |
Object |
getPoolKey()
|
Properties |
getProperties()
Subclasses should override this method to add a Platform
property listing the runtime platform, such as:
OpenJPA JDBC Edition: Oracle Database |
Object |
getUserObject(Object key)
Get the value for the specified key from the map of user objects. |
boolean |
isClosed()
Returns true if this broker factory is closed. |
void |
lock()
Synchronizes on an internal lock. |
void |
makeReadOnly()
Freezes the configuration of this factory. |
Broker |
newBroker()
Return a broker with default settings. |
Broker |
newBroker(boolean managed,
int connRetainMode)
|
Broker |
newBroker(String user,
String pass)
|
Broker |
newBroker(String user,
String pass,
boolean managed,
int connRetainMode)
|
Broker |
newBroker(String user,
String pass,
boolean managed,
int connRetainMode,
boolean findExisting)
Return a broker using the given credentials and in the given transaction and connection retain mode, optionally finding existing broker in the global transaction. |
protected BrokerImpl |
newBrokerImpl(String user,
String pass)
Return a broker configured with the proper settings. |
protected abstract StoreManager |
newStoreManager()
Return a new StoreManager for this runtime. |
protected static void |
pool(Object key,
AbstractBrokerFactory factory)
Register factory in the pool under key. |
Object |
putUserObject(Object key,
Object val)
Put the specified key-value pair into the map of user objects. |
protected Object |
readResolve()
Replaces the factory with this JVMs pooled version if it exists. |
protected void |
releaseBroker(BrokerImpl broker)
Release broker from any internal data structures. |
void |
removeLifecycleListener(Object listener)
Remove a listener for lifecycle-related events. |
void |
removeTransactionListener(Object listener)
Remove a listener for transaction-related events. |
protected void |
setup()
Setup transient state used by this factory based on the current configuration, which will subsequently be locked down. |
protected static Object |
toPoolKey(Map map)
Return an internal factory pool key for the given configuration. |
void |
unlock()
Release the internal lock. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractBrokerFactory(OpenJPAConfiguration config)
| Method Detail |
|---|
protected static Object toPoolKey(Map map)
protected static void pool(Object key,
AbstractBrokerFactory factory)
factory in the pool under key.
public static AbstractBrokerFactory getPooledFactoryForKey(Object key)
getPoolKey().
public OpenJPAConfiguration getConfiguration()
getConfiguration in interface BrokerFactorypublic Broker newBroker()
BrokerFactory
newBroker in interface BrokerFactory
public Broker newBroker(String user,
String pass)
public Broker newBroker(boolean managed,
int connRetainMode)
public Broker newBroker(String user,
String pass,
boolean managed,
int connRetainMode)
public Broker newBroker(String user,
String pass,
boolean managed,
int connRetainMode,
boolean findExisting)
BrokerFactory
newBroker in interface BrokerFactoryprotected void addListeners(BrokerImpl broker)
public void addLifecycleListener(Object listener,
Class[] classes)
BrokerFactory
addLifecycleListener in interface BrokerFactorypublic void removeLifecycleListener(Object listener)
BrokerFactory
removeLifecycleListener in interface BrokerFactorypublic void addTransactionListener(Object listener)
BrokerFactoryBrokers created
from this instance moving forward.
addTransactionListener in interface BrokerFactorypublic void removeTransactionListener(Object listener)
BrokerFactoryBrokers created from this instance.
removeTransactionListener in interface BrokerFactorypublic boolean isClosed()
isClosed in interface BrokerFactorypublic void close()
BrokerFactory
close in interface BrokerFactoryclose in interface Closeablepublic Properties getProperties()
Platform
property listing the runtime platform, such as:
OpenJPA JDBC Edition: Oracle Database
getProperties in interface BrokerFactorypublic Object getUserObject(Object key)
BrokerFactory
getUserObject in interface BrokerFactory
public Object putUserObject(Object key,
Object val)
BrokerFactory
putUserObject in interface BrokerFactorypublic void lock()
BrokerFactory
lock in interface BrokerFactorypublic void unlock()
BrokerFactory
unlock in interface BrokerFactory
protected Object readResolve()
throws ObjectStreamException
ObjectStreamExceptionprotected abstract StoreManager newStoreManager()
newBroker() method.
protected BrokerImpl findBroker(String user,
String pass,
boolean managed)
newStoreManager() so that factory subclasses implementing
pooling can return a matching manager before a new StoreManager
is created.
protected BrokerImpl newBrokerImpl(String user,
String pass)
protected void setup()
protected BrokerImpl findTransactionalBroker(String user,
String pass)
protected void configureBroker(BrokerImpl broker)
public void makeReadOnly()
protected Object getFactoryInitializationBanner()
public Collection getOpenBrokers()
protected void releaseBroker(BrokerImpl broker)
broker from any internal data structures. This
is invoked by broker after the broker is fully closed.
public Object getPoolKey()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||