org.milyn.resource
Class ClasspathResourceLocator

java.lang.Object
  extended by org.milyn.resource.ClasspathResourceLocator
All Implemented Interfaces:
ContainerResourceLocator, ExternalResourceLocator

public class ClasspathResourceLocator
extends Object
implements ContainerResourceLocator

Classpath Resource Locator.

Loads resources from the classpath. The URI must have no scheme or authority components, and have a leading slash character ('/') on the path i.e. it must be relative to the root of the classpath.

Author:
tfennelly

Constructor Summary
ClasspathResourceLocator()
           
 
Method Summary
 URI getBaseURI()
          Get the base URI for the locator instance.
 InputStream getResource(String uri)
          Get the stream specified by the 'uri' parameter.
 InputStream getResource(String configName, String defaultUri)
          Get the resource specified by the container 'config' value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClasspathResourceLocator

public ClasspathResourceLocator()
Method Detail

getResource

public InputStream getResource(String configName,
                               String defaultUri)
                        throws IllegalArgumentException
Description copied from interface: ContainerResourceLocator
Get the resource specified by the container 'config' value.

If the config value isn't specified, uses the defaultLocation.

Specified by:
getResource in interface ContainerResourceLocator
Parameters:
configName - The container configuration entry name whose value specifies the location of the resource.
defaultUri - The default location for the resource.
Returns:
The InputStream associated with resource.
Throws:
IllegalArgumentException - Illegal argument. Check the cause exception for more information.

getResource

public InputStream getResource(String uri)
                        throws IllegalArgumentException
Description copied from interface: ExternalResourceLocator
Get the stream specified by the 'uri' parameter.

Specified by:
getResource in interface ExternalResourceLocator
Parameters:
uri - The location of the resource to be located.
Returns:
The InputStream associated with the org.milyn.resource.
Throws:
IllegalArgumentException - Illegal argument. Check the cause exception for more information.

getBaseURI

public URI getBaseURI()
Description copied from interface: ContainerResourceLocator
Get the base URI for the locator instance.

Specified by:
getBaseURI in interface ContainerResourceLocator
Returns:
The base URI for the locator instance.


Copyright © 2018. All rights reserved.