net.officefloor.plugin.servlet.resource
Class FileSystemResourceLocator

java.lang.Object
  extended by net.officefloor.plugin.servlet.resource.FileSystemResourceLocator
All Implemented Interfaces:
ResourceLocator

public class FileSystemResourceLocator
extends Object
implements ResourceLocator

ResourceLocator for a file system.

Author:
Daniel Sagenschneider

Constructor Summary
FileSystemResourceLocator(File root)
          Initiate.
 
Method Summary
 URL getResource(String resourcePath)
          Obtains the URL for the resource.
 InputStream getResourceAsStream(String resourcePath)
          Obtains the InputStream to the contents of the resource.
 Set<String> getResourceChildren(String resourcePath)
          Obtains the direct children for the resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemResourceLocator

public FileSystemResourceLocator(File root)
Initiate.

Parameters:
root - Root of file system for which all paths are relative.
Method Detail

getResource

public URL getResource(String resourcePath)
                throws MalformedURLException
Description copied from interface: ResourceLocator
Obtains the URL for the resource.

Specified by:
getResource in interface ResourceLocator
Parameters:
resourcePath - Path to the resource.
Returns:
URL to the resource or null if no resource at path.
Throws:
MalformedURLException - If resource path is malformed.

getResourceAsStream

public InputStream getResourceAsStream(String resourcePath)
Description copied from interface: ResourceLocator
Obtains the InputStream to the contents of the resource.

Specified by:
getResourceAsStream in interface ResourceLocator
Parameters:
resourcePath - Path to the resource.
Returns:
InputStream to the contents of the resource or null if no resource at path.

getResourceChildren

public Set<String> getResourceChildren(String resourcePath)
Description copied from interface: ResourceLocator
Obtains the direct children for the resource.

Specified by:
getResourceChildren in interface ResourceLocator
Parameters:
resourcePath - Path to the resource.
Returns:
Direct children for the resource.


Copyright © 2005-2012. All Rights Reserved.