Package de.osshangar.plugin
Class Plugin<T>
java.lang.Object
de.osshangar.plugin.Plugin<T>
- Type Parameters:
T- type of the object created
This class loads the plugins
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionload(JarInputStream jarInputStream) This loads the plugin from the provided JarInputStream.load(JarInputStream jarInputStream, Arguments constructorArguments) This loads the plugin from the provided JarInputStream and provides the given arguments to its constructorThis loads a plugin from a Map of class byte codes and provides the given arguments to its constructorload(Map<String, byte[]> classFiles, Map<String, byte[]> resources, String classToLoadName, Arguments constructorArguments) This loads a plugin from a Map of class byte codes and provides the given arguments to its constructor
-
Constructor Details
-
Plugin
public Plugin()
-
-
Method Details
-
load
public T load(JarInputStream jarInputStream) throws FileFormatException, IOException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException This loads the plugin from the provided JarInputStream.- Parameters:
jarInputStream- The input stream to a JAR package to load the plugin from- Returns:
- The instantiated plugin instance
- Throws:
FileFormatException- when the structure of the plugin JAR is wrongIOException- when an I/O operation failsClassNotFoundException- when the PluginClassLoader does not find a requested classInvocationTargetException- when the provided constructor arguments does not match the signature of the requested constructorNoSuchMethodException- when then plugin does not have a constructor that matches the requested signatureInstantiationException- when the class of the plugin which implements the required plugin interface is an abstract classIllegalAccessException- when the requested constructor of the plugin is inaccessible due to an enforced Java language access control
-
load
public T load(Map<String, byte[]> classFiles, Map<String, throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessExceptionbyte[]> resources, String classToLoadName) This loads a plugin from a Map of class byte codes and provides the given arguments to its constructor- Parameters:
classFiles- A Map of full qualified class names as its keys and the classes byte codes as its valuesclassToLoadName- The name of the plugin class to load- Returns:
- The instance of the loaded plugin
- Throws:
ClassNotFoundException- when the PluginClassLoader does not find a requested classInvocationTargetException- when the provided constructor arguments does not match the signature of the requested constructorNoSuchMethodException- when then plugin does not have a constructor that matches the requested signatureInstantiationException- when the class of the plugin which implements the required plugin interface is an abstract classIllegalAccessException- when the requested constructor of the plugin is inaccessible due to an enforced Java language access control
-
load
public T load(JarInputStream jarInputStream, Arguments constructorArguments) throws FileFormatException, IOException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException This loads the plugin from the provided JarInputStream and provides the given arguments to its constructor- Parameters:
jarInputStream- The input stream to a JAR package to load the plugin fromconstructorArguments- The arguments to be provided to the constructor of the plugin on its instantiation- Returns:
- The instance of the loaded plugin
- Throws:
FileFormatException- when the structure of the plugin JAR is wrongIOException- when an I/O operation failsClassNotFoundException- when the PluginClassLoader does not find a requested classInvocationTargetException- when the provided constructor arguments does not match the signature of the requested constructorNoSuchMethodException- when then plugin does not have a constructor that matches the requested signatureInstantiationException- when the class of the plugin which implements the required plugin interface is an abstract classIllegalAccessException- when the requested constructor of the plugin is inaccessible due to an enforced Java language access control
-
load
public T load(Map<String, byte[]> classFiles, Map<String, throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessExceptionbyte[]> resources, String classToLoadName, Arguments constructorArguments) This loads a plugin from a Map of class byte codes and provides the given arguments to its constructor- Parameters:
classFiles- A Map of full qualified class names as its keys and the classes byte codes as its valuesresources- A Map of package paths as its keys and their related resources as its valuesclassToLoadName- The name of the plugin class to loadconstructorArguments- The arguments to be provided to the constructor of the plugin on its instantiation- Returns:
- The instance of the loaded plugin
- Throws:
ClassNotFoundException- when the PluginClassLoader does not find a requested classInvocationTargetException- when the provided constructor arguments does not match the signature of the requested constructorNoSuchMethodException- when then plugin does not have a constructor that matches the requested signatureInstantiationException- when the class of the plugin which implements the required plugin interface is an abstract classIllegalAccessException- when the requested constructor of the plugin is inaccessible due to an enforced Java language access control
-