org.ungoverned.moduleloader
Class SystemResourceSource

java.lang.Object
  extended byorg.ungoverned.moduleloader.SystemResourceSource
All Implemented Interfaces:
ResourceSource

public class SystemResourceSource
extends java.lang.Object
implements ResourceSource

This class implements a ResourceSource for retrieving resources from the system class loader. Effectively, the methods of this resource source defer their functionality to ClassLoder.getSystemClassLoader().getResource().

See Also:
ResourceSource

Constructor Summary
SystemResourceSource()
           
 
Method Summary
 void close()
           This method de-initializes the resource source.
 byte[] getBytes(java.lang.String name)
           This method returns a byte array of the specified resource's contents.
 boolean hasResource(java.lang.String name)
           This method returns a boolean indicating whether the resource source contains the specified resource.
 void open()
           This method initializes the resource source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemResourceSource

public SystemResourceSource()
Method Detail

open

public void open()
Description copied from interface: ResourceSource

This method initializes the resource source. It is called when the associated module is added to the ModuleManager. It is acceptable for implementations to ignore duplicate calls to this method if the resource source is already opened.

Specified by:
open in interface ResourceSource

close

public void close()
Description copied from interface: ResourceSource

This method de-initializes the resource source. It is called when the associated module is removed from the ModuleManager or when the module is reset by the ModuleManager.

Specified by:
close in interface ResourceSource

hasResource

public boolean hasResource(java.lang.String name)
                    throws java.lang.IllegalStateException
Description copied from interface: ResourceSource

This method returns a boolean indicating whether the resource source contains the specified resource.

Specified by:
hasResource in interface ResourceSource
Parameters:
name - the name of the resource whose existence is being checked.
Throws:
java.lang.IllegalStateException - if the resource source has not been opened.

getBytes

public byte[] getBytes(java.lang.String name)
                throws java.lang.IllegalStateException
Description copied from interface: ResourceSource

This method returns a byte array of the specified resource's contents.

Specified by:
getBytes in interface ResourceSource
Parameters:
name - the name of the resource to retrieve.
Throws:
java.lang.IllegalStateException - if the resource source has not been opened.