|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 |
addLifecycleListeners(BrokerImpl broker)
Add factory-registered lifecycle listeners to the broker. |
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. |
protected static AbstractBrokerFactory |
getPooledFactory(Map map)
Return the pooled factory matching the given configuration data, or null if none. |
static AbstractBrokerFactory |
getPooledFactory(OpenJPAConfiguration conf)
Return the pooled factory matching the given configuration, or null if none. |
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 void |
pool()
Add the factory to the pool. |
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. |
void |
removeLifecycleListener(Object listener)
Remove a listener for lifecycle-related events. |
protected void |
setup()
Setup transient state used by this factory based on the current configuration, which will subsequently be locked down. |
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 |
---|
public static AbstractBrokerFactory getPooledFactory(OpenJPAConfiguration conf)
protected static AbstractBrokerFactory getPooledFactory(Map map)
public OpenJPAConfiguration getConfiguration()
getConfiguration
in interface BrokerFactory
public 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 BrokerFactory
protected void addLifecycleListeners(BrokerImpl broker)
public void addLifecycleListener(Object listener, Class[] classes)
BrokerFactory
addLifecycleListener
in interface BrokerFactory
public void removeLifecycleListener(Object listener)
BrokerFactory
removeLifecycleListener
in interface BrokerFactory
public boolean isClosed()
isClosed
in interface BrokerFactory
public void close()
BrokerFactory
close
in interface BrokerFactory
close
in interface Closeable
public Properties getProperties()
Platform
property listing the runtime platform, such as:
OpenJPA JDBC Edition: Oracle Database
getProperties
in interface BrokerFactory
public Object getUserObject(Object key)
BrokerFactory
getUserObject
in interface BrokerFactory
public Object putUserObject(Object key, Object val)
BrokerFactory
putUserObject
in interface BrokerFactory
public void lock()
BrokerFactory
lock
in interface BrokerFactory
public void unlock()
BrokerFactory
unlock
in interface BrokerFactory
protected Object readResolve() throws ObjectStreamException
ObjectStreamException
protected 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)
protected void pool()
public void makeReadOnly()
protected Object getFactoryInitializationBanner()
public Collection getOpenBrokers()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |