|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.chain.CatalogFactory
A CatalogFactory
is a class used to store and retrieve
Catalog
s. The factory allows for a default Catalog
as well as Catalog
s stored with a name key. Follows the
Factory pattern (see GoF).
Constructor Summary | |
CatalogFactory()
|
Method Summary | |
abstract void |
addCatalog(String name,
Catalog catalog)
Adds a named instance of Catalog to the factory (for subsequent retrieval later). |
static void |
clear()
Clear all references to registered catalogs, as well as to the relevant class loader. |
abstract Catalog |
getCatalog()
Gets the default instance of Catalog associated with the factory (if any); otherwise, return null . |
abstract Catalog |
getCatalog(String name)
Retrieves a Catalog instance by name (if any); otherwise return null . |
static CatalogFactory |
getInstance()
Return the singleton CatalogFactory instance
for the relevant ClassLoader . |
abstract Iterator |
getNames()
Return an Iterator over the set of named
Catalog s known to this CatalogFactory . |
abstract void |
setCatalog(Catalog catalog)
Sets the default instance of Catalog associated with the factory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CatalogFactory()
Method Detail |
public abstract Catalog getCatalog()
Gets the default instance of Catalog associated with the factory
(if any); otherwise, return null
.
public abstract void setCatalog(Catalog catalog)
Sets the default instance of Catalog associated with the factory.
catalog
- the default Catalog instancepublic abstract Catalog getCatalog(String name)
Retrieves a Catalog instance by name (if any); otherwise
return null
.
name
- the name of the Catalog to retrieve
public abstract void addCatalog(String name, Catalog catalog)
Adds a named instance of Catalog to the factory (for subsequent retrieval later).
name
- the name of the Catalog to addcatalog
- the Catalog to addpublic abstract Iterator getNames()
Return an Iterator
over the set of named
Catalog
s known to this CatalogFactory
.
If there are no known catalogs, an empty Iterator is returned.
public static CatalogFactory getInstance()
Return the singleton CatalogFactory
instance
for the relevant ClassLoader
. For applications
that use a thread context class loader (such as web applications
running inside a servet container), this will return a separate
instance for each application, even if this class is loaded from
a shared parent class loader.
CatalogFactory
public static void clear()
Clear all references to registered catalogs, as well as to the relevant class loader. This method should be called, for example, when a web application utilizing this class is removed from service, to allow for garbage collection.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |