JPF 1.5.1

org.java.plugin.boot
Class DefaultPluginsCollector

java.lang.Object
  extended by org.java.plugin.boot.DefaultPluginsCollector
All Implemented Interfaces:
PluginsCollector

public class DefaultPluginsCollector
extends java.lang.Object
implements PluginsCollector

Default implementation of plug-ins collector interface. Supported configuration parameters are:

org.java.plugin.boot.pluginsRepositories
Comma separated list of local plug-in repositories, given folders will be scanned for plug-ins. Default value is ./plugins.
org.java.plugin.boot.pluginsLocationsDescriptors
Comma separated list of URLs for XML syntax files that describe available plug-in locations (see file syntax bellow). No default value provided.

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.

Version:
$Id$

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
DefaultPluginsCollector()
           
 
Method Summary
 java.util.Collection<PluginManager.PluginLocation> collectPluginLocations()
           
 void configure(ExtendedProperties config)
          Configures this collector instance, this method will be called once before any other method call in this class.
protected  void processFile(java.io.File file, java.util.List<PluginManager.PluginLocation> result)
           
protected  void processFolder(java.io.File folder, java.util.List<PluginManager.PluginLocation> result)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_PLUGINS_REPOSITORIES

protected static final java.lang.String PARAM_PLUGINS_REPOSITORIES
See Also:
Constant Field Values

PARAM_PLUGINS_LOCATIONS_DESCRIPTORS

protected static final java.lang.String PARAM_PLUGINS_LOCATIONS_DESCRIPTORS
See Also:
Constant Field Values

log

protected org.apache.commons.logging.Log log
Constructor Detail

DefaultPluginsCollector

public DefaultPluginsCollector()
Method Detail

configure

public void configure(ExtendedProperties config)
               throws java.lang.Exception
Description copied from interface: PluginsCollector
Configures this collector instance, this method will be called once before any other method call in this class. There is no pre-defined configuration parameters, see concrete implementations for supported parameters.

Specified by:
configure in interface PluginsCollector
Parameters:
config - application configuration data from boot.properties file and System properties as defaults
Throws:
java.lang.Exception - if any error has occurred during collector configuring
See Also:
PluginsCollector.configure( org.java.plugin.util.ExtendedProperties)

collectPluginLocations

public java.util.Collection<PluginManager.PluginLocation> collectPluginLocations()
Specified by:
collectPluginLocations in interface PluginsCollector
Returns:
collection of all discovered plug-in locations
See Also:
PluginsCollector.collectPluginLocations()

processFolder

protected void processFolder(java.io.File folder,
                             java.util.List<PluginManager.PluginLocation> result)

processFile

protected void processFile(java.io.File file,
                           java.util.List<PluginManager.PluginLocation> result)

JPF 1.5.1

Copyright © 2004-2007 Dmitry Olshansky. All Rights Reserved.