com.armatiek.infofuze.pool
Class ResultPool

java.lang.Object
  extended by com.armatiek.infofuze.pool.ResultPool

public class ResultPool
extends java.lang.Object

A pool implementation for objects that implement the interface DataResultIf

Author:
Maarten Kroon

Method Summary
static void destroy()
          Closes all the pooled DataResultIf objects and destroys the pool
 DataResultIf getResult(java.lang.String name)
          Returns the DataResultIf object with specified name from the pool.
static ResultPool getResultPool()
          Returns The singleton ResultPool object.
static void init(org.w3c.dom.Document configDocument)
          Initializes the pool using the result objects defined in the configuration file (infofuze-config.xml)
 void returnResult(DataResultIf result)
          Returns specified DataResultIf to the pool.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public static void init(org.w3c.dom.Document configDocument)
Initializes the pool using the result objects defined in the configuration file (infofuze-config.xml)

Parameters:
configDocument - The configuration document

destroy

public static void destroy()
Closes all the pooled DataResultIf objects and destroys the pool


getResultPool

public static ResultPool getResultPool()
                                throws InfofuzeException
Returns The singleton ResultPool object. The init method must be called previously.

Throws:
InfofuzeException

getResult

public DataResultIf getResult(java.lang.String name)
                       throws java.lang.Exception
Returns the DataResultIf object with specified name from the pool. If a object of specified name does not exists in the pool, a new one will be created.

Parameters:
name - The name of a result object as configured in infofuze-config.xml
Throws:
java.lang.Exception

returnResult

public void returnResult(DataResultIf result)
Returns specified DataResultIf to the pool. If the result implements TransactionableIf and the transaction is not yet committed or rolled back, the transaction of the result will be rolled back. If the result is still open it will be closed.

Parameters:
result - The DataResultIf to return to the pool