WISA.wisa3D
Class ResourceManager

java.lang.Object
  |
  +--WISA.wisa3D.ResourceManager

public class ResourceManager
extends java.lang.Object

The ResourceManager provides informations nearly about all available types of data and all other resources used by the Wisa3D package.


Supported keys:
color
file
icon
image
location
option
path
size
value


Constructor Summary
protected ResourceManager()
          Construct a new standard ResourceManager.
 
Method Summary
protected static java.io.File getConfigFile()
          Get the config file for the current user.
protected static java.io.File getDefaultConfigFile()
          Get the default config file.
static java.lang.Object getResource(java.lang.String key)
          Get a ressource from the ResourceManager identified by the specified key.
static ResourceManager getSystemResourceManager()
          Returns the ResourceManager the Wisa3D-System uses to manage its data and resources.
static void saveResource(java.lang.String key, java.lang.Object value)
          Saves a single resource to the current users config file.
static void saveResources(java.util.Hashtable resources)
          Saves the contents of the specified Hashtable as resources to the current users config file.
protected static void setResource(java.lang.String key, java.lang.Object value)
          Set the specified resource.
protected static void writeConfigFile(java.util.Hashtable table)
          Write the contents of the given table to the config file for the current user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManager

protected ResourceManager()
Construct a new standard ResourceManager. Only used for internal purposes. Use the getSystemResourceManager() method to get the ResourceManager holding all informations about the Wisa3D datas and resources.

Method Detail

getSystemResourceManager

public static ResourceManager getSystemResourceManager()
Returns the ResourceManager the Wisa3D-System uses to manage its data and resources.

Returns:
The system ResourceManager.

getResource

public static java.lang.Object getResource(java.lang.String key)
Get a ressource from the ResourceManager identified by the specified key.

Parameters:
key - The identifier of the ressource to be loaded.
Returns:
The ressource or null if either the key could not be identified or the ressource was not found.

getConfigFile

protected static java.io.File getConfigFile()
Get the config file for the current user. If no config file could be found a new one will be generated.

Returns:
The config file for the current user.

getDefaultConfigFile

protected static java.io.File getDefaultConfigFile()
Get the default config file.

Returns:
The default config file for Wisa3D.

writeConfigFile

protected static void writeConfigFile(java.util.Hashtable table)
                               throws ResourceException
Write the contents of the given table to the config file for the current user.

Parameters:
table - The contents beeing written in the config file.
Throws:
ResourceException - If the config file for the current user could not be found and a new file could not be constructed.

setResource

protected static void setResource(java.lang.String key,
                                  java.lang.Object value)
Set the specified resource.

Parameters:
key - The key with which this resource can be refound.
value - The resource itself.

saveResource

public static void saveResource(java.lang.String key,
                                java.lang.Object value)
Saves a single resource to the current users config file.

Parameters:
key - The key of the resource.
value - The resource itself.

saveResources

public static void saveResources(java.util.Hashtable resources)
Saves the contents of the specified Hashtable as resources to the current users config file.