com.atlassian.plugin.main
Class PluginsConfigurationBuilder

java.lang.Object
  extended by com.atlassian.plugin.main.PluginsConfigurationBuilder

public class PluginsConfigurationBuilder
extends java.lang.Object

The builder for PluginsConfiguration instances that additionally performs validation and default creation. For a usage example, see the package javadocs.

Not thread-safe. Instances of this class should be thread and preferably method local.

Since:
2.2

Constructor Summary
PluginsConfigurationBuilder()
           
 
Method Summary
 PluginsConfigurationBuilder applicationKey(java.lang.String applicationKey)
          Sets the current application key to use when filtering modules in a plugin
 PluginsConfiguration build()
          Builds a PluginsConfiguration instance by processing the configuration that was previously set, validating the input, and setting any defaults where not explicitly specified.
 PluginsConfigurationBuilder bundledPluginCacheDirectory(java.io.File bundledPluginCacheDirectory)
          Sets the directory to unzip bundled plugins into.
 PluginsConfigurationBuilder bundledPluginUrl(java.net.URL bundledPluginUrl)
          Sets the URL to a ZIP file containing plugins that are to be started before any user plugins but after framework bundles.
 PluginsConfigurationBuilder hostComponentProvider(HostComponentProvider hostComponentProvider)
          Sets the host component provider instance, used for registering application services as OSGi services so that they can be automatically available to plugins
 PluginsConfigurationBuilder hotDeployPollingFrequency(long hotDeployPollingFrequency, java.util.concurrent.TimeUnit timeUnit)
          Sets the polling frequency for scanning for new plugins
 PluginsConfigurationBuilder moduleDescriptorFactory(ModuleDescriptorFactory moduleDescriptorFactory)
          Sets the module descriptor factory that will be used to create instances of discovered module descriptors.
 PluginsConfigurationBuilder osgiPersistentCache(java.io.File osgiPersistentCache)
          Sets the set of persistent caching directories the OSGi classes will use.
 PluginsConfigurationBuilder packageScannerConfiguration(PackageScannerConfiguration packageScannerConfiguration)
          Sets the package scanner configuration instance that contains information about what packages to expose to plugins.
 PluginsConfigurationBuilder pluginDescriptorFilename(java.lang.String pluginDescriptorFilename)
          Sets the plugin descriptor file name to expect in a plugin JAR artifact
 PluginsConfigurationBuilder pluginDirectory(java.io.File pluginDirectory)
          Sets the directory that contains the plugins and will be used to store installed plugins.
static PluginsConfigurationBuilder pluginsConfiguration()
          Static factory for creating a new builder.
 PluginsConfigurationBuilder pluginStateStore(PluginPersistentStateStore pluginStateStore)
          Sets the plugin state store implementation used for persisting which plugins and modules are enabled or disabled across restarts.
 PluginsConfigurationBuilder useLegacyDynamicPluginDeployer(boolean useLegacyDynamicPluginDeployer)
          Defines whether ther legacy plugin deployer should be used or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginsConfigurationBuilder

public PluginsConfigurationBuilder()
Method Detail

pluginsConfiguration

public static PluginsConfigurationBuilder pluginsConfiguration()
Static factory for creating a new builder.

Returns:
a new builder.

packageScannerConfiguration

public PluginsConfigurationBuilder packageScannerConfiguration(PackageScannerConfiguration packageScannerConfiguration)
Sets the package scanner configuration instance that contains information about what packages to expose to plugins.

Parameters:
packageScannerConfiguration - The configuration instance
Returns:
this

hostComponentProvider

public PluginsConfigurationBuilder hostComponentProvider(HostComponentProvider hostComponentProvider)
Sets the host component provider instance, used for registering application services as OSGi services so that they can be automatically available to plugins

Parameters:
hostComponentProvider - The host component provider implementation
Returns:
this

osgiPersistentCache

public PluginsConfigurationBuilder osgiPersistentCache(java.io.File osgiPersistentCache)
Sets the set of persistent caching directories the OSGi classes will use. This includes the caching directory to extract framework bundles into, the container bundle cache, and the transformed plugin cache.

Parameters:
osgiPersistentCache - A directory that exists
Returns:
this

pluginDirectory

public PluginsConfigurationBuilder pluginDirectory(java.io.File pluginDirectory)
Sets the directory that contains the plugins and will be used to store installed plugins.

Parameters:
pluginDirectory - A directory that exists
Returns:
this

bundledPluginUrl

public PluginsConfigurationBuilder bundledPluginUrl(java.net.URL bundledPluginUrl)
Sets the URL to a ZIP file containing plugins that are to be started before any user plugins but after framework bundles. Must be set if bundledPluginCacheDirectory(java.io.File) is set.

Parameters:
bundledPluginUrl - A URL to a ZIP of plugin JAR files
Returns:
this

bundledPluginCacheDirectory

public PluginsConfigurationBuilder bundledPluginCacheDirectory(java.io.File bundledPluginCacheDirectory)
Sets the directory to unzip bundled plugins into. The directory will automatically be cleaned out if the framework detects any modification. Must be set if bundledPluginUrl(java.net.URL) is set.

Parameters:
bundledPluginCacheDirectory - A directory that exists
Returns:
this

pluginDescriptorFilename

public PluginsConfigurationBuilder pluginDescriptorFilename(java.lang.String pluginDescriptorFilename)
Sets the plugin descriptor file name to expect in a plugin JAR artifact

Parameters:
pluginDescriptorFilename - A valid file name
Returns:
this

moduleDescriptorFactory

public PluginsConfigurationBuilder moduleDescriptorFactory(ModuleDescriptorFactory moduleDescriptorFactory)
Sets the module descriptor factory that will be used to create instances of discovered module descriptors. Usually, the DefaultModuleDescriptorFactory is what is used, which takes class instances of module descriptors to instantiate.

Parameters:
moduleDescriptorFactory - A module descriptor factory instance
Returns:
this

pluginStateStore

public PluginsConfigurationBuilder pluginStateStore(PluginPersistentStateStore pluginStateStore)
Sets the plugin state store implementation used for persisting which plugins and modules are enabled or disabled across restarts.

Parameters:
pluginStateStore - The plugin state store implementation
Returns:
this

hotDeployPollingFrequency

public PluginsConfigurationBuilder hotDeployPollingFrequency(long hotDeployPollingFrequency,
                                                             java.util.concurrent.TimeUnit timeUnit)
Sets the polling frequency for scanning for new plugins

Parameters:
hotDeployPollingFrequency - The quantity of time periods
timeUnit - The units for the frequency
Returns:
this

useLegacyDynamicPluginDeployer

public PluginsConfigurationBuilder useLegacyDynamicPluginDeployer(boolean useLegacyDynamicPluginDeployer)
Defines whether ther legacy plugin deployer should be used or not.

Parameters:
useLegacyDynamicPluginDeployer - true if the legacy plugin deployer should be used.
Returns:
this

applicationKey

public PluginsConfigurationBuilder applicationKey(java.lang.String applicationKey)
Sets the current application key to use when filtering modules in a plugin

Parameters:
applicationKey - the current application identifier
Returns:
this

build

public PluginsConfiguration build()
Builds a PluginsConfiguration instance by processing the configuration that was previously set, validating the input, and setting any defaults where not explicitly specified.

Returns:
A valid PluginsConfiguration instance to pass to AtlassianPlugins


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.