com.armatiek.infofuze.pool
Class SourcePool

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

public class SourcePool
extends java.lang.Object

A pool implementation for objects that implement the interface DataSourceIf

Author:
Maarten Kroon

Method Summary
static void destroy()
          Closes all the pooled DataSourceIf objects and destroys the pool
 DataSourceIf getSource(java.lang.String name)
          Returns the DataSourceIf object with specified name from the pool.
static SourcePool getSourcePool()
          Returns the singleton SourcePool object.
static void init(org.w3c.dom.Document configDocument)
          Initializes the pool using the source objects defined in the configuration file (infofuze-config.xml)
 void returnSource(DataSourceIf source)
          Returns specified DataSourceIf 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 source objects defined in the configuration file (infofuze-config.xml)

Parameters:
configDocument - The configuration document

destroy

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


getSourcePool

public static SourcePool getSourcePool()
                                throws InfofuzeException
Returns the singleton SourcePool object. The init method must be called previously.

Throws:
InfofuzeException

getSource

public DataSourceIf getSource(java.lang.String name)
                       throws java.lang.Exception
Returns the DataSourceIf 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 source object as configured in infofuze-config.xml
Throws:
java.lang.Exception

returnSource

public void returnSource(DataSourceIf source)
Returns specified DataSourceIf to the pool. If the source is still open it will be closed.

Parameters:
source - The DataSourceIf to return to the pool