|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.objectpools.KeyedObjectPoolFactory
org.osesb.objectpools.ValidationBeanKeyedPoolFactory
public class ValidationBeanKeyedPoolFactory
This class is a factory for object pools of org.osesb.validationbeans.ValidationBean(s), with different configurations (heterogeneous). ValidationBean(s) are used to apply constraints to data (usually XML).
This class is is a thread-safe singleton, so only one instance of ValidationBeanKeyedPoolFactory and its associated KeyedObjectPool instance will exist per class loader. ValidationBean pools are useful in multi-threaded environments, where there are multiple clients using ValidationBean(s). Instead of repeatedly creating ValidationBean(s), clients call getObject() on a pool of ValidationBean(s) and then call returnObject() when validation is complete. PooledValidationBeanAccessHelper is a helper class for accessing pooled ValidationBean(s). This class uses org.apache.commons.pool.impl.GenericKeyedObjectPool as the pool implementation. It is a good model for creating other heterogeneous object pools, which are pools that contain different kinds of objects. This factory uses a configuration file to load a pool of ValidationBean(s). The configuration contains a pool content model, which defines the characteristics of the pool and repeating org.osesb.validationbeans.ValidationBeanConfiguration(s), one for each ValidationBean in the keyed pool. There is no default configuration file for a ValidationBean pool. So, set the System property defined by org.osesb.objectpools.ObjectPoolConstants.VALIDATIONBEANKEYEDPOOLCONFIGFILE_PROPERTY to the pool configuration file or set a VALIDATIONBEANKEYEDPOOLCONFIGFILE_PROPERTY entry in a properties file named ObjectPoolConstants.OBJECTPOOLCONFIGURATIONS_PROPERTIES_FILE. Generally, a single ValidationBean pool is configured for an integration project. Object pool configurations must be stand-alone configuration files with all configurations specified in-line. Object pool configurations cannot be embedded in another configuration file and then referenced externally using XPath. In addition, all pooled object configurations must be specified in-line and cannot use the 'configFile' attribute to redirect the configuration to an external file. See org.osesb.objectpools.test.testdata for example pool configurations.
| Nested Class Summary | |
|---|---|
protected static class |
ValidationBeanKeyedPoolFactory.ValidationBeanPoolableObjectFactory
Inner class that implements org.apache.commons.pool.KeyedPoolableObjectFactory, which is instantiated by the enclosing class and passed to GenericObjectPool's constructor. |
| Field Summary | |
|---|---|
protected static KeyedObjectPoolConfiguration |
keyedObjectPoolConfiguration
The pool configuration as a whole including the ObjectPoolConfiguration and the pooled object configuration(s). |
protected static ValidationBeanKeyedPoolFactory |
poolFactoryInstance
Singleton pattern - thread-safe construction. |
protected static KeyedObjectPool |
poolInstance
The instance of the objectpool we will create. |
protected static java.lang.String |
thisClassName
The full name of this class |
| Fields inherited from class org.osesb.objectpools.KeyedObjectPoolFactory |
|---|
log |
| Constructor Summary | |
|---|---|
protected |
ValidationBeanKeyedPoolFactory()
Singleton pattern - cannot be instantiated directly. |
| Method Summary | |
|---|---|
static KeyedObjectPoolFactory |
getInstance()
Singleton pattern - - returns the instance of this class. |
KeyedObjectPoolConfiguration |
getKeyedObjectPoolConfiguration()
Return the pool configuration as a whole including the ObjectPoolConfiguration and the pooled object configuration(s). |
KeyedObjectPool |
getPool()
Returns the object pool instance. |
static void |
main(java.lang.String[] args)
Main method for testing and sandboxing. |
void |
resetPoolInstance()
Close the pool and reset the poolInstance. |
| Methods inherited from class org.osesb.objectpools.KeyedObjectPoolFactory |
|---|
getPoolConfig |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static KeyedObjectPool poolInstance
protected static KeyedObjectPoolConfiguration keyedObjectPoolConfiguration
protected static java.lang.String thisClassName
protected static ValidationBeanKeyedPoolFactory poolFactoryInstance
| Constructor Detail |
|---|
protected ValidationBeanKeyedPoolFactory()
| Method Detail |
|---|
public static KeyedObjectPoolFactory getInstance()
public KeyedObjectPool getPool()
throws java.lang.Exception
getPool in class KeyedObjectPoolFactoryjava.lang.Exceptionpublic KeyedObjectPoolConfiguration getKeyedObjectPoolConfiguration()
getKeyedObjectPoolConfiguration in class KeyedObjectPoolFactorypublic void resetPoolInstance()
resetPoolInstance in class KeyedObjectPoolFactorypublic static void main(java.lang.String[] args)
args -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||