de.esw.eengine.resource
Class ResourceManager

java.lang.Object
  extended by de.esw.eengine.resource.ResourceManager

public class ResourceManager
extends java.lang.Object

The ResourceManager handles all file I/O operations. Each resource is attached to an id for easy access afterwards.

Since:
1.0
Version:
$Id: ResourceManager.java 211 2005-07-24 14:29:44Z markusw $
Author:
markusw

Constructor Summary
ResourceManager(IRenderDevice renderDevice)
           
 
Method Summary
 int createResource(java.lang.String path)
           
 int createResource(java.net.URL location)
           
 void dispose()
          Shutdown of the ResouceManager and dispose of all loaded resources.
 IResource getResource(int resourceId)
           
 IResource getResource(java.lang.String path)
           
 IResource getResource(java.net.URL location)
           
 int loadResource(java.lang.String path)
           
 int loadResource(java.net.URL location)
           
 void registerCodec(ICodec codec)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManager

public ResourceManager(IRenderDevice renderDevice)
Parameters:
renderDevice - IRenderDevice this resource manager uses
Method Detail

loadResource

public int loadResource(java.lang.String path)
                 throws EEngineException
Parameters:
path - Path the resource is located at relative to current working directory
Returns:
Resource id if successful created
Throws:
EEngineException - If no URL could be created from path

loadResource

public int loadResource(java.net.URL location)
                 throws EEngineException
Parameters:
location - Resource location in URL space
Returns:
Resource id if successful created.
Note that resource ids must not be continuous
Throws:
EEngineException - Thrown if an error occured during creation of the resource

createResource

public int createResource(java.lang.String path)
                   throws EEngineException
Parameters:
path - Path the resource is located at relative to current working directory
Returns:
Resource id if successful created
Throws:
EEngineException - If no URL could be created from path

createResource

public int createResource(java.net.URL location)
                   throws EEngineException
Parameters:
location - Resource location in URL space
Returns:
Resource id if successful created.
Note that resource ids must not be continuous
Throws:
EEngineException - Thrown if an error occured during creation of the resource

getResource

public IResource getResource(int resourceId)
Parameters:
resourceId - Id of the resource to retrieve
Returns:
IResource if found or null

getResource

public IResource getResource(java.lang.String path)
Parameters:
path - Path the resource is located at relative to current working directory
Returns:
IResource if found or null

getResource

public IResource getResource(java.net.URL location)
Parameters:
location - Location of the IResource
Returns:
IResource if found or null

registerCodec

public void registerCodec(ICodec codec)
Parameters:
codec - ICodec to register for resource management

dispose

public void dispose()
Shutdown of the ResouceManager and dispose of all loaded resources.