com.valhalla.pluginmanager
Class PluginJAR

java.lang.Object
  extended bycom.valhalla.pluginmanager.PluginJAR

public class PluginJAR
extends java.lang.Object

Represents a plugin in a Jar File

Version:
1.0
Author:
Adam Olsen

Constructor Summary
PluginJAR(java.lang.String location)
          Constructs the Plugin Jar
 
Method Summary
 void close()
          Closes the JarFile
 boolean contains(java.lang.String file)
           
 java.io.InputStream getInputStream(java.util.jar.JarEntry entry)
          Gets the InputStream from an entry
 java.util.jar.JarEntry getJarEntry(java.lang.String name)
          Gets the jarEntry with a specific name
 boolean getLoaded()
           
 java.lang.String getLocation()
           
 java.lang.String getName()
           
 java.util.Properties getProperties()
          Returns the jar information(
 void loadContents()
          Loads the contents of the Jar into the Properties
 Plugin loadPlugin()
          Loads the specified plugin
 void setLoaded(boolean loaded)
          Sets whether or not the jar has been loaded
 void unloadPlugin()
          Unloads the specified plugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginJAR

public PluginJAR(java.lang.String location)
          throws java.io.IOException
Constructs the Plugin Jar

Parameters:
location - The location of the plugin
Throws:
java.io.IOException - if there is an exception while opening the plugin
Method Detail

getJarEntry

public java.util.jar.JarEntry getJarEntry(java.lang.String name)
Gets the jarEntry with a specific name

Parameters:
name - the name of the file you want to get the entry for
Returns:
The jarEntry value

close

public void close()
Closes the JarFile


getInputStream

public java.io.InputStream getInputStream(java.util.jar.JarEntry entry)
Gets the InputStream from an entry

Parameters:
entry - which entry to get the input stream for
Returns:
The InputStream

getLocation

public java.lang.String getLocation()
Returns:
the location of this Jar

setLoaded

public void setLoaded(boolean loaded)
Sets whether or not the jar has been loaded

Parameters:
loaded - true if boolean

getLoaded

public boolean getLoaded()
Returns:
true if this jar is loaded

loadContents

public void loadContents()
                  throws java.io.IOException
Loads the contents of the Jar into the Properties

Throws:
java.io.IOException - if there is an error reading the jar file

loadPlugin

public Plugin loadPlugin()
Loads the specified plugin

Returns:
the Plugin

unloadPlugin

public void unloadPlugin()
Unloads the specified plugin


getProperties

public java.util.Properties getProperties()
Returns the jar information(

Returns:
a Properties with information about the jar

getName

public java.lang.String getName()
Returns:
the name of this plugin

contains

public boolean contains(java.lang.String file)
Parameters:
file - the file to check
Returns:
true if the jar contains a file