|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.jinx.plugin.PluginLoader
public class PluginLoader
| Constructor Summary | |
|---|---|
PluginLoader(java.lang.Class tag,
java.io.File dir,
boolean deep)
Constructs a PluginLoader. |
|
PluginLoader(java.io.File dir)
Constructs a PluginLoader. |
|
PluginLoader(java.io.File dir,
boolean deep)
Constructs a PluginLoader. |
|
| Method Summary | |
|---|---|
protected void |
foundTaggedClass(java.lang.Class c)
Adds a class to the tagged class cache. |
protected java.lang.ClassLoader |
getClassLoader(java.io.File jar)
Provides a class loader for the given jar file. |
java.lang.Class[] |
getTagged()
Returns an array containing all of the found tagged classes. |
java.lang.Class[] |
getTaggedExtending(java.lang.Class sc)
Returns an array of all of the Classes that extend sc. |
java.lang.Class[] |
getTaggedImplementingAll(java.lang.Class[] interfaces)
Returns an array of all of the Classes that implement all of interfaces. |
java.lang.Class[] |
getTaggedImplementingAny(java.lang.Class[] interfaces)
Returns an array of all of the Classes that implement any of interfaces. |
protected boolean |
hasScanned(java.io.File file)
Provides a way to check if a given file has already been marked scanned. |
protected void |
markScanned(java.io.File file)
Marks the given File object as having been scanned. |
protected void |
rescan()
Resets this PluginLoader, discarding all cached tagged classes. |
void |
scan()
Scans for new jar files and adds their classes to the tagged class collection if they extend/implement tag (from the constructor). |
protected void |
scan(java.io.File dir,
boolean deep)
Scans a directory for new jar files. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PluginLoader(java.io.File dir)
dir - the directory to load plugins from.
java.lang.NullPointerException - if dir is null.
java.lang.IllegalArgumentException - if dir is not a directory or doesn't
exist.
java.lang.SecurityException - if dir is not accessible.
public PluginLoader(java.io.File dir,
boolean deep)
dir - the directory to load plugins from.deep - indicates if dir should be deep scanned. If true, then all
sub-directories of dir will be searched as well.
java.lang.NullPointerException - if dir is null.
java.lang.IllegalArgumentException - if dir is not a directory or doesn't
exist.
java.lang.SecurityException - if dir is not accessible.
public PluginLoader(java.lang.Class tag,
java.io.File dir,
boolean deep)
tag - the tagging class/interface to scan for.dir - the directory to load plugins from.deep - indicates if dir should be deep scanned. If true, then all
sub-directories of dir will be searched as well.
java.lang.NullPointerException - if dir or tag are null.
java.lang.IllegalArgumentException - if dir is not a directory or doesn't
exist.
java.lang.SecurityException - if dir is not accessible.| Method Detail |
|---|
public void scan()
protected void scan(java.io.File dir,
boolean deep)
dir - the directory to search.deep - should dir be recursively searched?
protected java.lang.ClassLoader getClassLoader(java.io.File jar)
throws java.io.IOException
jar - the File object for the jar file.
java.io.IOException - if an I/O error occurs while setting up the class
loader.protected void rescan()
protected boolean hasScanned(java.io.File file)
file - the File to check.
protected void markScanned(java.io.File file)
file - the File that's been scanned.protected void foundTaggedClass(java.lang.Class c)
c - the Class.public java.lang.Class[] getTagged()
public java.lang.Class[] getTaggedExtending(java.lang.Class sc)
sc - the class to search for extensions of.
public java.lang.Class[] getTaggedImplementingAll(java.lang.Class[] interfaces)
interfaces - the interfaces that must be implemented.
public java.lang.Class[] getTaggedImplementingAny(java.lang.Class[] interfaces)
interfaces - the interfaces that must be implemented.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||