|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.any23.plugin.Any23PluginManager
public class Any23PluginManager
The Any23PluginManager is responsible for inspecting dynamically the classpath and retrieving useful classes.
Field Summary | |
---|---|
static String |
CLI_PACKAGE
Any23 Command Line Interface package. |
static String |
PLUGIN_DIRS_LIST_SEPARATOR
List separator for the string declaring the plugin list. |
static String |
PLUGIN_DIRS_PROPERTY
Property where look for plugins. |
static String |
PLUGINS_PACKAGE
Any23 Plugins package. |
Method Summary | ||
---|---|---|
ExtractorGroup |
configureExtractors(ExtractorGroup initialExtractorGroup)
Configures a new list of extractors containing the extractors declared in initialExtractorGroup
and also the extractors detected in classpath specified by the default configuration. |
|
ExtractorGroup |
configureExtractors(ExtractorGroup initialExtractorGroup,
File... pluginLocations)
Configures a new list of extractors containing the extractors declared in initialExtractorGroup
and also the extractors detected in classpath specified by pluginLocations . |
|
ExtractorGroup |
getApplicableExtractors(File... pluginLocations)
Returns an extractor group containing both the default extractors declared by the ExtractorRegistry and the ExtractorPlugin s. |
|
|
getClassesInPackage(String packageName,
ClassFilter filter)
Returns all classes within the specified packageName satisfying the given class
filter . |
|
static Any23PluginManager |
getInstance()
|
|
Class<ExtractorPlugin>[] |
getPlugins()
List of ExtractorPlugin classes declared within the classpath. |
|
Class<Tool>[] |
getTools()
Returns the list of all the Tool classes declared within the classpath. |
|
boolean |
loadClassDir(File classDir)
Loads a classes directory in the classpath. |
|
Throwable[] |
loadClassDirs(File... classDirs)
Loads a list of class dirs in the classpath. |
|
protected
|
loadClassesInPackageFromClasspath(String packageName,
ClassFilter filter,
Set<Class<T>> result)
Filters classes by criteria within the initialization classpath. |
|
protected
|
loadClassesInPackageFromDir(File classDir,
String packageName,
ClassFilter filter,
Set<Class<T>> result)
Filters classes by criteria within a class dir. |
|
protected
|
loadClassesInPackageFromJAR(File jarFile,
String packageName,
ClassFilter filter,
Set<Class<T>> result)
Filters classes by criteria within a JAR. |
|
Throwable[] |
loadFiles(File... files)
Loads a generic list of files, trying to determine the type of every file. |
|
boolean |
loadJAR(File jar)
Loads a JAR file in the classpath. |
|
boolean |
loadJARDir(File jarDir)
Loads all the JARs detected in a given directory. |
|
Throwable[] |
loadJARs(File... jars)
Loads a list of JARs in the classpath. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CLI_PACKAGE
public static final String PLUGINS_PACKAGE
public static final String PLUGIN_DIRS_PROPERTY
public static final String PLUGIN_DIRS_LIST_SEPARATOR
Method Detail |
---|
public static Any23PluginManager getInstance()
Any23PluginManager
.public boolean loadJAR(File jar)
jar
- the JAR file to be loaded.
true
if the JAR is added for the first time to the classpath,
false
otherwise.
MalformedURLException
public Throwable[] loadJARs(File... jars)
jars
- list of JARs to be loaded.
public boolean loadClassDir(File classDir)
classDir
- the directory to be loaded.
true
if the directory is added for the first time to the classpath,
false
otherwise.public Throwable[] loadClassDirs(File... classDirs)
classDirs
- list of class dirs to be loaded.
public boolean loadJARDir(File jarDir)
jarDir
- directory containing the JARs to be loaded.
true
if all JARs in dir are loaded.public Throwable[] loadFiles(File... files)
files
- list of files to be loaded.
public <T> Set<Class<T>> getClassesInPackage(String packageName, ClassFilter filter) throws IOException
packageName
satisfying the given class
filter
. The search is performed on the static classpath (the one the application
started with) and the dynamic classpath (the one specified using the load methods).
T
- type of filtered class.packageName
- package name to look at classes, if null
all packages will be found.filter
- class filter to select classes, if null
all classes will be returned.
IOException
public Class<Tool>[] getTools() throws IOException
Tool
classes declared within the classpath.
null
list of tool classes.
IOException
public Class<ExtractorPlugin>[] getPlugins() throws IOException
ExtractorPlugin
classes declared within the classpath.
null
list of plugin classes.
IOException
public ExtractorGroup configureExtractors(ExtractorGroup initialExtractorGroup, File... pluginLocations) throws IOException, IllegalAccessException, InstantiationException
initialExtractorGroup
and also the extractors detected in classpath specified by pluginLocations
.
initialExtractorGroup
- initial list of extractors.pluginLocations
-
IOException
IllegalAccessException
InstantiationException
public ExtractorGroup configureExtractors(ExtractorGroup initialExtractorGroup) throws IOException, InstantiationException, IllegalAccessException
initialExtractorGroup
and also the extractors detected in classpath specified by the default configuration.
initialExtractorGroup
- initial list of extractors.
IOException
InstantiationException
IllegalAccessException
public ExtractorGroup getApplicableExtractors(File... pluginLocations) throws IOException, IllegalAccessException, InstantiationException
ExtractorRegistry
and the ExtractorPlugin
s.
pluginLocations
- optional list of plugin locations.
null
and not empty extractor group.
IOException
IllegalAccessException
InstantiationException
protected <T> void loadClassesInPackageFromJAR(File jarFile, String packageName, ClassFilter filter, Set<Class<T>> result) throws IOException
jarFile
- file addressing the JAR.packageName
- name of package to scan.filter
- filter class, all returned classes must extend the specified one.result
- list for writing result.
IOException
protected <T> void loadClassesInPackageFromDir(File classDir, String packageName, ClassFilter filter, Set<Class<T>> result) throws MalformedURLException
T
- class types.classDir
- class directory.packageName
- name of package to scan.filter
- filter class, all returned classes must extend the specified one.result
- list for writing result.
MalformedURLException
protected <T> void loadClassesInPackageFromClasspath(String packageName, ClassFilter filter, Set<Class<T>> result) throws IOException
T
- packageName
- name of package to scan.filter
- filter class, all returned classes must extend the specified one.result
- list for writing result.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |