com.gargoylesoftware.base.resource

Class ResourceManager

public final class ResourceManager extends Object

An object that manages the resources allocated by the resource factories

Version: $Revision: 1.3 $

Author: Mike Bowler

Field Summary
Stringname_
MapresourceFactories_
Constructor Summary
ResourceManager()
Create an instance
ResourceManager(String name)
Create an instance
Method Summary
voidaddFactory(String name, ResourceFactory factory)
Adds a feature to the Factory attribute of the ResourceManager object
ObjectgetResource(String name)
Return a resource from the specified factory
ResourceFactorygetResourceFactory(String name)
voidreleaseAllResources()
Release all resources
voidreleaseResource(ManagedResource object)
Release the specified resource
StringtoString()
Return a string representation of this object

Field Detail

name_

private final String name_

resourceFactories_

private Map resourceFactories_

Constructor Detail

ResourceManager

public ResourceManager()
Create an instance

ResourceManager

public ResourceManager(String name)
Create an instance

Parameters: name The name of this object.

Method Detail

addFactory

public void addFactory(String name, ResourceFactory factory)
Adds a feature to the Factory attribute of the ResourceManager object

Parameters: name The feature to be added to the Factory attribute factory The feature to be added to the Factory attribute

getResource

public final Object getResource(String name)
Return a resource from the specified factory

Parameters: name The name of the factory

Returns: The specified resource

getResourceFactory

private final ResourceFactory getResourceFactory(String name)

Parameters: name Description of Parameter

Returns: The resourceFactory value

Throws: ResourceFactoryNotFoundException Description of Exception

releaseAllResources

public void releaseAllResources()
Release all resources

releaseResource

public final void releaseResource(ManagedResource object)
Release the specified resource

Parameters: object The resource to release

toString

public String toString()
Return a string representation of this object

Returns: A string respresentation of this object.