copyright The Portico Project 2008.

org.portico.shared.plugin
Class LoadedLibrary

java.lang.Object
  extended by org.portico.shared.plugin.LoadedLibrary

public class LoadedLibrary
extends Object

This class represents a library (jar, war, ear, etc...) that has been loaded onto the system classpath. It contains a String describing the full path to the jar on the filesystem, as well as a link to the java.io.File object representing the library.

This class also contains information about whether or not the archive represents a Portico plugin (either an RTI or LRC plugin). A file is a plugin if it contains plugin configuration information. See the PluginLocator class for a description of how and where these file are located within a particular library.


Nested Class Summary
static class LoadedLibrary.Type
          Enum specifying which component a plugin configuration is aimed at.
 
Field Summary
private  File file
           
private  String fullLocation
           
private  boolean isPlugin
           
private  Set<URL> lrcPlugins
           
private  Set<URL> rtiPlugins
           
 
Constructor Summary
protected LoadedLibrary(String location, File path)
          Create a new LoadedLibrary that is *NOT* a plugin.
 
Method Summary
 void addPluginConfiguration(LoadedLibrary.Type type, URL configURL)
          Add a URL that points to the location within the library of a plugin configuration.
 File getFile()
          Get the location of the library as a file
 String getLocation()
          Get the location to the library as a string.
 Set<URL> getPluginConfigurations(LoadedLibrary.Type type)
          Get all the plugins contained in the library for the given type.
 boolean isPlugin()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fullLocation

private String fullLocation

file

private File file

isPlugin

private boolean isPlugin

lrcPlugins

private Set<URL> lrcPlugins

rtiPlugins

private Set<URL> rtiPlugins
Constructor Detail

LoadedLibrary

protected LoadedLibrary(String location,
                        File path)
Create a new LoadedLibrary that is *NOT* a plugin. If the library is actually a plugin, it will need to have configurations added to it via #addPluginConfiguration(URL). This constructor is marked as protected so that it is only called from within the package.

Method Detail

getLocation

public String getLocation()
Get the location to the library as a string.


getFile

public File getFile()
Get the location of the library as a file


isPlugin

public boolean isPlugin()

addPluginConfiguration

public void addPluginConfiguration(LoadedLibrary.Type type,
                                   URL configURL)
Add a URL that points to the location within the library of a plugin configuration. If the plugin config file is meant for the RTI, pass LoadedLibrary.Type.RTI as the first parameter. If it is meant for the LRC, pass LoadedLibrary.Type.LRC

Note that we have to use a URL for the configuration file because it will reside inside an archive. The URL class can happily handle URLs that specify this property.

Parameters:
type - The LoadedLibrary.Type the plugin configuration file is meant for
configURL - The URL of the configuration file

getPluginConfigurations

public Set<URL> getPluginConfigurations(LoadedLibrary.Type type)
Get all the plugins contained in the library for the given type. If there are no plugins for the type, an empty set will be returned


toString

public String toString()
Overrides:
toString in class Object

copyright The Portico Project 2008.