Top Description Fields Constructors Methods
net.java.games.util.plugins

public Class Plugins

extends Object
Class Inheritance
Imports
java.io.*, java.util.*, java.util.jar.*

This is the application interface to the Plugin system. One Plugins object should be created for each plug-in directory tree root. On creation the Plugins object will scan its assigned directory tree and examine all Jar files in that tree to see if they qualify as Plug-ins. The Plugin classes may then be retrived from the Plugins object by calling the appropriate get function (see below). If a plugin requires a native code library, that library must be present in the same directory as the plugin Jar file UNLESS the property "net.java.games.util.plugins.nolocalnative" is set. In that case it will fall abck to the VM or environment's default way of finding native libraries. (This is n ecessary for Java Web Start apps.)

Field Summary

Modifier and TypeField and Description
pack-priv static final boolean
pack-priv List<E>

Constructor Summary

AccessConstructor and Description
public
Plugins(File
The root od the directory tree to scan for Jars containing plugins.
pluginRoot
)

Creates a new instance of Plugins

Method Summary

Modifier and TypeMethod and Description
private boolean
classExtends(Class<T> testClass, Class<T> superclass)

private boolean
classImplementsAll(Class<T> testClass, Set<E> interfaces)

private boolean
classImplementsAny(Class<T> testClass, Set<E> interfaces)

public Class<T>[]

Returns:

An array of Plugin objects
get
()

This method returns all the Plugins found in the directory passed in at object creation time or any of its sub-directories.

public Class<T>[]

Returns:

The list of plugin classes that extend the passed in class.
getExtends
(Class<T>
The class to match.
superclass
)

This method returns a sub-list of all the found Plugin classes that extend the passed in Class (either directly or through inheritance.)

public Class<T>[]

Returns:

The list of plugin classes that implement at least one member of the passed in set of interfaces.
getImplementsAll
(Class<T>[]
A set of interfaces to match against the interfaces implemented by the plugin classes.
interfaces
)

This method returns a sub-list of all the found Plugin classes that implement all of the passed in set of Interfaces (either directly or through inheritance.)

public Class<T>[]

Returns:

The list of plugin classes that implement at least one member of the passed in set of interfaces.
getImplementsAny
(Class<T>[]
A set of interfaces to match against the interfaces implemented by the plugin classes.
interfaces
)

This method returns a sub-list of all the found Plugin classes that implement any of the passed in set of Interfaces (either directly or through inheritance.)

private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
pack-priv static final boolean DEBUG
pluginListback to summary
pack-priv List<E> pluginList

Constructor Detail

Pluginsback to summary
public Plugins(File pluginRoot) throws IOException

Creates a new instance of Plugins

Parameters
pluginRoot:File

The root od the directory tree to scan for Jars containing plugins.

Method Detail

classExtendsback to summary
private boolean classExtends(Class<T> testClass, Class<T> superclass)
classImplementsAllback to summary
private boolean classImplementsAll(Class<T> testClass, Set<E> interfaces)
classImplementsAnyback to summary
private boolean classImplementsAny(Class<T> testClass, Set<E> interfaces)
getback to summary
public Class<T>[] get()

This method returns all the Plugins found in the directory passed in at object creation time or any of its sub-directories.

Returns:Class<T>[]

An array of Plugin objects

getExtendsback to summary
public Class<T>[] getExtends(Class<T> superclass)

This method returns a sub-list of all the found Plugin classes that extend the passed in Class (either directly or through inheritance.)

Parameters
superclass:Class<T>

The class to match.

Returns:Class<T>[]

The list of plugin classes that extend the passed in class.

getImplementsAllback to summary
public Class<T>[] getImplementsAll(Class<T>[] interfaces)

This method returns a sub-list of all the found Plugin classes that implement all of the passed in set of Interfaces (either directly or through inheritance.)

Parameters
interfaces:Class<T>[]

A set of interfaces to match against the interfaces implemented by the plugin classes.

Returns:Class<T>[]

The list of plugin classes that implement at least one member of the passed in set of interfaces.

getImplementsAnyback to summary
public Class<T>[] getImplementsAny(Class<T>[] interfaces)

This method returns a sub-list of all the found Plugin classes that implement any of the passed in set of Interfaces (either directly or through inheritance.)

Parameters
interfaces:Class<T>[]

A set of interfaces to match against the interfaces implemented by the plugin classes.

Returns:Class<T>[]

The list of plugin classes that implement at least one member of the passed in set of interfaces.

processJarback to summary
private void processJar(File f)
scanPluginsback to summary
private void scanPlugins(File dir) throws IOException