|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.java.plugin.extension.PluginsCollector
public class PluginsCollector
This boroughs code from the JPF boot library with a few modifications.
Default implementation of plug-ins collector. Supported
configuration parameters are:
./plugins
.
Given repositories are scanned recursively collecting all folders that
contain plugin.xml
or plugin-fragment.xml
and
*.zip
and *.jar
files.
Plug-ins locations descriptor is a simple XML syntax file that stores
locations of all available plug-in manifests and contexts (in terms of
PluginManager.PluginLocation
). Here is an example:
<plugins> <plugin manifest="http://localhost/myPlugins/plugin1/plugin.xml" context="http://localhost/myPlugins/plugin1/"/> <plugin manifest="http://localhost/myPlugins/plugin2/plugin.xml" context="http://localhost/myPlugins/plugin2/"/> <plugin manifest="http://www.plugins.com/repository/plugin1/plugin.xml" context="http://www.plugins.com/repository/plugin1/"/> <plugin manifest="http://www.plugins.com/repository/plugin1/plugin.xml" context="http://www.plugins.com/repository/plugin1/"/> </plugins>Using such simple descriptor you may, for example, publish plug-ins on a site to make them available for clients without needing to download plug-ins manually.
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
log
|
protected static java.lang.String |
PARAM_PLUGINS_LOCATIONS_DESCRIPTORS
|
protected static java.lang.String |
PARAM_PLUGINS_REPOSITORIES
|
Constructor Summary | |
---|---|
PluginsCollector(java.util.Properties configuration)
Create and configure a new PluginsCollector. |
Method Summary | |
---|---|
boolean |
addRepository(java.io.File location)
Add a new location as plugin repository. |
PluginManager.PluginLocation[] |
collectPluginLocations()
After configure(Properties) was called, this scans the found
directories and locations and creates an array of PluginManager.PluginLocation s. |
protected void |
configure(java.util.Properties config)
Takes the configuration from the given properties and scans for plugins and description locations. |
java.util.List<java.net.URL> |
getDescriptors()
|
java.util.List<java.net.URL> |
getJars()
|
java.util.List<java.io.File> |
getRepositories()
|
protected static java.net.URL |
jarelement2jar(java.net.URL cUrl)
|
protected static java.lang.String |
jarelement2jarfile(java.net.URL cUrl)
|
protected void |
processFile(java.io.File file,
java.util.List<PluginManager.PluginLocation> result)
Process a file as PluginManager.PluginLocation . |
protected void |
processFolder(java.io.File folder,
java.util.List<PluginManager.PluginLocation> result)
Process a folder while creating PluginManager.PluginLocation s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String PARAM_PLUGINS_REPOSITORIES
protected static final java.lang.String PARAM_PLUGINS_LOCATIONS_DESCRIPTORS
protected org.apache.commons.logging.Log log
Constructor Detail |
---|
public PluginsCollector(java.util.Properties configuration)
configuration
- Method Detail |
---|
protected void configure(java.util.Properties config)
PluginManager.PluginLocation
s but detects local directories and
remote URL
s.
config
-
java.lang.Exception
public PluginManager.PluginLocation[] collectPluginLocations()
configure(Properties)
was called, this scans the found
directories and locations and creates an array of PluginManager.PluginLocation
s.
protected void processFolder(java.io.File folder, java.util.List<PluginManager.PluginLocation> result)
PluginManager.PluginLocation
s.
This creates a PluginManager.PluginLocation
for the folder and recursively for each sub-folder.
folder
- the folderresult
- list of PluginManager.PluginLocation
protected void processFile(java.io.File file, java.util.List<PluginManager.PluginLocation> result)
PluginManager.PluginLocation
. This creates a PluginManager.PluginLocation
for the given file.
file
- result
- protected static java.lang.String jarelement2jarfile(java.net.URL cUrl)
protected static java.net.URL jarelement2jar(java.net.URL cUrl)
public java.util.List<java.io.File> getRepositories()
public java.util.List<java.net.URL> getDescriptors()
public java.util.List<java.net.URL> getJars()
public boolean addRepository(java.io.File location)
location
- the new location
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |