org.apache.myfaces.test.mock.resource
Class MockClassLoaderResourceLoader

java.lang.Object
  extended by org.apache.myfaces.test.mock.resource.MockResourceLoader
      extended by org.apache.myfaces.test.mock.resource.MockClassLoaderResourceLoader

public class MockClassLoaderResourceLoader
extends MockResourceLoader

A resource loader implementation which loads resources from the thread ClassLoader.

Since:
1.0.0
Version:
$Revision: 882702 $ $Date: 2009-11-20 15:16:07 -0500 (Vie, 20 Nov 2009) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.myfaces.test.mock.resource.MockResourceLoader
MockResourceLoader.VersionComparator
 
Field Summary
 
Fields inherited from class org.apache.myfaces.test.mock.resource.MockResourceLoader
VERSION_INVALID
 
Constructor Summary
MockClassLoaderResourceLoader(ClassLoader loader, String prefix)
           
 
Method Summary
 MockResourceMeta createResourceMeta(String prefix, String libraryName, String libraryVersion, String resourceName, String resourceVersion)
           
 ClassLoader getClassLoader()
          Returns the ClassLoader to use when looking up resources under the top level package.
 String getLibraryVersion(String path)
          Return the max available version found (if exists) or return null if no version available.
 InputStream getResourceInputStream(MockResourceMeta resourceMeta)
           
 URL getResourceURL(MockResourceMeta resourceMeta)
          Return the max available version found (if exists) or return null if no version available.
 String getResourceVersion(String path)
           
 boolean libraryExists(String libraryName)
           
 void setClassLoader(ClassLoader loader)
           
 
Methods inherited from class org.apache.myfaces.test.mock.resource.MockResourceLoader
getPrefix, getVersionComparator, setPrefix, setVersionComparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockClassLoaderResourceLoader

public MockClassLoaderResourceLoader(ClassLoader loader,
                                     String prefix)
Method Detail

getLibraryVersion

public String getLibraryVersion(String path)
Description copied from class: MockResourceLoader
Return the max available version found (if exists) or return null if no version available.

Specified by:
getLibraryVersion in class MockResourceLoader

getResourceInputStream

public InputStream getResourceInputStream(MockResourceMeta resourceMeta)
Specified by:
getResourceInputStream in class MockResourceLoader

getResourceURL

public URL getResourceURL(MockResourceMeta resourceMeta)
Description copied from class: MockResourceLoader
Return the max available version found (if exists) or return null if no version available.

Specified by:
getResourceURL in class MockResourceLoader

getResourceVersion

public String getResourceVersion(String path)
Specified by:
getResourceVersion in class MockResourceLoader

createResourceMeta

public MockResourceMeta createResourceMeta(String prefix,
                                           String libraryName,
                                           String libraryVersion,
                                           String resourceName,
                                           String resourceVersion)
Specified by:
createResourceMeta in class MockResourceLoader

getClassLoader

public ClassLoader getClassLoader()
Returns the ClassLoader to use when looking up resources under the top level package. By default, this is the context class loader.

Returns:
the ClassLoader used to lookup resources

setClassLoader

public void setClassLoader(ClassLoader loader)

libraryExists

public boolean libraryExists(String libraryName)
Specified by:
libraryExists in class MockResourceLoader


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.