org.ungoverned.moduleloader
Interface LibrarySource

All Known Implementing Classes:
OSGiLibrarySource

public interface LibrarySource

This interface represents a source for obtaining native libraries for a given module via the module's class loader. The main goal of a library source is to map a library name to a path in the file system.

All library sources are initialized before first usage via a call to the LibrarySource.open() method and are also deinitialized via a call to LibrarySource.close(). Library sources should be implemented such that they can be opened, closed, and then re-opened.

See Also:
Module, ModuleClassLoader

Method Summary
 void close()
           This method de-initializes the library source.
 java.lang.String getPath(java.lang.String name)
           Returns a file system path to the specified library.
 void open()
           This method initializes the library source.
 

Method Detail

open

void open()

This method initializes the library 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 library source is already opened.


close

void close()

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


getPath

java.lang.String getPath(java.lang.String name)
                         throws java.lang.IllegalStateException

Returns a file system path to the specified library.

Parameters:
name - the name of the library that is being requested.
Returns:
a file system path to the specified library.
Throws:
java.lang.IllegalStateException - if the resource source has not been opened.