play.plugins

## Class PluginCollection

- java.lang.Object
- - play.plugins.PluginCollection

    public class PluginCollection
    extends java.lang.Object

Class handling all plugins used by Play. Loading/reloading/enabling/disabling is handled here. This class also exposes many PlayPlugin-methods which when called, the method is executed on all enabled plugins. Since all the enabled-plugins-iteration is done here, the code elsewhere is cleaner.

### Field Summary

Fields
`protected java.util.List<PlayPlugin>` `allPlugins` List that holds all loaded plugins, enabled or disabled
`protected java.util.List<PlayPlugin>` `allPlugins_readOnlyCopy` Readonly copy of allPlugins - updated each time allPlugins is updated.
`protected java.util.List<PlayPlugin>` `enabledPlugins` List of all enabled plugins
`protected java.util.List<PlayPlugin>` `enabledPlugins_readOnlyCopy` Readonly copy of enabledPlugins - updated each time enabledPlugins is updated.
`protected java.util.List<PlayPlugin>` `enabledPluginsWithFilters` List of all enabled plugins with filters
`protected java.util.List<PlayPlugin>` `enabledPluginsWithFilters_readOnlyCopy` Readonly copy of enabledPluginsWithFilters - updated each time enabledPluginsWithFilters is updated.
`protected java.lang.String` `play_plugins_resourceName` Property holding the name of the play.plugins-resource-name.

### Constructor Summary

Constructors
Constructor and Description
`PluginCollection()`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`protected boolean` `addPlugin(PlayPlugin plugin)` Adds one plugin and enables it
`java.util.List<java.lang.String>` `addTemplateExtensions()`
`void` `afterActionInvocation()`
`void` `afterApplicationStart()`
`void` `afterFixtureLoad()`
`void` `afterInvocation()`
`void` `beforeActionInvocation(java.lang.reflect.Method actionMethod)`
`void` `beforeDetectingChanges()`
`void` `beforeInvocation()`
`java.lang.Object` `bind(RootParamNode rootParamNode, java.lang.String name, java.lang.Class<?> clazz, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)`
`java.lang.Object` `bindBean(RootParamNode rootParamNode, java.lang.String name, java.lang.Object bean)`
`void` `compileAll(java.util.List<ApplicationClasses.ApplicationClass> classes)` Deprecated.
`boolean` `compileSources()`
`<T> F.Option<PlayPlugin.Filter<T>>` `composeFilters()`
`protected java.util.List<PlayPlugin>` `createReadonlyCopy(java.util.List<PlayPlugin> list)` Using readonly list to crash if someone tries to modify the copy.
`void` `detectChange()`
`boolean` `detectClassesChange()`
`boolean` `disablePlugin(java.lang.Class<? extends PlayPlugin> pluginClazz)` Disable plugin of specified type
`boolean` `disablePlugin(PlayPlugin plugin)` disable plugin
`boolean` `enablePlugin(java.lang.Class<? extends PlayPlugin> pluginClazz)` enable plugin of specified type
`boolean` `enablePlugin(PlayPlugin plugin)` Enable plugin.
`void` `enhance(ApplicationClasses.ApplicationClass applicationClass)`
`java.util.List<PlayPlugin>` `getAllPlugins()` Returns new readonly list of all plugins
`java.util.List<PlayPlugin>` `getEnabledPlugins()` Returns new readonly list of all enabled plugins
`java.util.List<PlayPlugin>` `getEnabledPluginsWithFilters()` Returns new readonly list of all enabled plugins that define filters.
`java.util.Collection<java.lang.Class>` `getFunctionalTests()`
`java.lang.String` `getMessage(java.lang.String locale, java.lang.Object key, java.lang.Object... args)`
`<T extends PlayPlugin> T` `getPluginInstance(java.lang.Class<T> pluginClazz)` Returns the first instance of a loaded plugin of specified type
`java.util.Collection<PlayPlugin>` `getReversedEnabledPlugins()` Returns readonly view of all enabled plugins in reversed order
`java.util.Collection<java.lang.Class>` `getUnitTests()`
`protected void` `initializePlugin(PlayPlugin plugin)` Calls plugin.onLoad but detects if plugin removes other plugins from Play.plugins-list to detect if plugins disables a plugin the old hacked way..
`void` `invocationFinally()`
`boolean` `isEnabled(PlayPlugin plugin)` Indicate if a plugin is enabled
`protected boolean` `isLoadedByApplicationClassloader(PlayPlugin plugin)`
`void` `loadPlugins()`
`Template` `loadTemplate(VirtualFile file)`
`Model.Factory` `modelFactory(java.lang.Class<? extends Model> modelClass)`
`void` `onActionInvocationFinally()`
`void` `onActionInvocationResult(Result result)`
`void` `onApplicationReady()`
`void` `onApplicationStart()`
`void` `onApplicationStop()`
`java.util.List<ApplicationClasses.ApplicationClass>` `onClassesChange(java.util.List<ApplicationClasses.ApplicationClass> modified)` Deprecated.
`void` `onConfigurationRead()`
`void` `onEvent(java.lang.String message, java.lang.Object context)`
`void` `onInvocationException(java.lang.Throwable e)`
`void` `onInvocationSuccess()`
`void` `onRequestRouting(Router.Route route)`
`void` `onRoutesLoaded()`
`java.lang.String` `overrideTemplateSource(BaseTemplate template, java.lang.String source)`
`boolean` `rawInvocation(Http.Request request, Http.Response response)`
`void` `reloadApplicationPlugins()` Reloads all loaded plugins that is application-supplied.
`protected void` `replacePlugin(PlayPlugin oldPlugin, PlayPlugin newPlugin)`
`void` `routeRequest(Http.Request request)`
`TestEngine.TestResults` `runTest(java.lang.Class<BaseTest> clazz)`
`boolean` `serveStatic(VirtualFile file, Http.Request request, Http.Response response)`
`java.util.Map<java.lang.String,java.lang.Object>` `unBind(java.lang.Object src, java.lang.String name)`
`void` `updatePlayPluginsList()` Must update Play.plugins-list to be backward compatible
`java.lang.Object` `willBeValidated(java.lang.Object value)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### play_plugins_resourceName

    protected java.lang.String play_plugins_resourceName

Property holding the name of the play.plugins-resource-name. Can be modified in unittest to supply modifies plugin-list

#### allPlugins

    protected java.util.List<PlayPlugin> allPlugins

List that holds all loaded plugins, enabled or disabled

#### allPlugins_readOnlyCopy

    protected java.util.List<PlayPlugin> allPlugins_readOnlyCopy

Readonly copy of allPlugins - updated each time allPlugins is updated. Using this cached copy so we don't have to create it all the time..

#### enabledPlugins

    protected java.util.List<PlayPlugin> enabledPlugins

List of all enabled plugins

#### enabledPlugins_readOnlyCopy

    protected java.util.List<PlayPlugin> enabledPlugins_readOnlyCopy

Readonly copy of enabledPlugins - updated each time enabledPlugins is updated. Using this cached copy so we don't have to create it all the time

#### enabledPluginsWithFilters

    protected java.util.List<PlayPlugin> enabledPluginsWithFilters

List of all enabled plugins with filters

#### enabledPluginsWithFilters_readOnlyCopy

    protected java.util.List<PlayPlugin> enabledPluginsWithFilters_readOnlyCopy

Readonly copy of enabledPluginsWithFilters - updated each time enabledPluginsWithFilters is updated. Using this cached copy so we don't have to create it all the time

### Constructor Detail

#### PluginCollection

    public PluginCollection()

### Method Detail

#### createReadonlyCopy

    protected java.util.List<PlayPlugin> createReadonlyCopy(java.util.List<PlayPlugin> list)

Using readonly list to crash if someone tries to modify the copy.

Parameters:
  `list` - The list of plugins
Returns:
  Read only list of plugins

#### loadPlugins

    public void loadPlugins()

#### reloadApplicationPlugins

    public void reloadApplicationPlugins()
                                  throws java.lang.Exception

Reloads all loaded plugins that is application-supplied.

Throws:
  `java.lang.Exception` - If problem occurred during reload

#### isLoadedByApplicationClassloader

    protected boolean isLoadedByApplicationClassloader(PlayPlugin plugin)

#### initializePlugin

    protected void initializePlugin(PlayPlugin plugin)

Calls plugin.onLoad but detects if plugin removes other plugins from Play.plugins-list to detect if plugins disables a plugin the old hacked way..

Parameters:
  `plugin` - The given plugin

#### addPlugin

    protected boolean addPlugin(PlayPlugin plugin)

Adds one plugin and enables it

Parameters:
  `plugin` - The given plugin
Returns:
  true if plugin was new and was added

#### replacePlugin

    protected void replacePlugin(PlayPlugin oldPlugin,
                                 PlayPlugin newPlugin)

#### enablePlugin

    public boolean enablePlugin(PlayPlugin plugin)

Enable plugin.

Parameters:
  `plugin` - The given plugin
Returns:
  true if plugin exists and was enabled now

#### enablePlugin

    public boolean enablePlugin(java.lang.Class<? extends PlayPlugin> pluginClazz)

enable plugin of specified type

Parameters:
  `pluginClazz` - The plugin class
Returns:
  true if plugin was enabled

#### getPluginInstance

    public <T extends PlayPlugin> T getPluginInstance(java.lang.Class<T> pluginClazz)

Returns the first instance of a loaded plugin of specified type

Parameters:
  `pluginClazz` - The plugin class
Returns:
  PlayPlugin

#### disablePlugin

    public boolean disablePlugin(PlayPlugin plugin)

disable plugin

Parameters:
  `plugin` - The given plugin
Returns:
  true if plugin was enabled and now is disabled

#### disablePlugin

    public boolean disablePlugin(java.lang.Class<? extends PlayPlugin> pluginClazz)

Disable plugin of specified type

Parameters:
  `pluginClazz` - The plugin class
Returns:
  true if plugin was enabled and now is disabled

#### updatePlayPluginsList

    public void updatePlayPluginsList()

Must update Play.plugins-list to be backward compatible

#### getEnabledPlugins

    public java.util.List<PlayPlugin> getEnabledPlugins()

Returns new readonly list of all enabled plugins

Returns:
  List of plugins

#### getEnabledPluginsWithFilters

    public java.util.List<PlayPlugin> getEnabledPluginsWithFilters()

Returns new readonly list of all enabled plugins that define filters.

Returns:
  List of plugins

#### composeFilters

    public <T> F.Option<PlayPlugin.Filter<T>> composeFilters()

#### getReversedEnabledPlugins

    public java.util.Collection<PlayPlugin> getReversedEnabledPlugins()

Returns readonly view of all enabled plugins in reversed order

Returns:
  Collection of plugins

#### getAllPlugins

    public java.util.List<PlayPlugin> getAllPlugins()

Returns new readonly list of all plugins

Returns:
  List of plugins

#### isEnabled

    public boolean isEnabled(PlayPlugin plugin)

Indicate if a plugin is enabled

Parameters:
  `plugin` - The given plugin
Returns:
  true if plugin is enabled

#### compileSources

    public boolean compileSources()

#### detectClassesChange

    public boolean detectClassesChange()

#### invocationFinally

    public void invocationFinally()

#### beforeInvocation

    public void beforeInvocation()

#### afterInvocation

    public void afterInvocation()

#### onInvocationSuccess

    public void onInvocationSuccess()

#### onInvocationException

    public void onInvocationException(java.lang.Throwable e)

#### beforeDetectingChanges

    public void beforeDetectingChanges()

#### detectChange

    public void detectChange()

#### onApplicationReady

    public void onApplicationReady()

#### onConfigurationRead

    public void onConfigurationRead()

#### onApplicationStart

    public void onApplicationStart()

#### afterApplicationStart

    public void afterApplicationStart()

#### onApplicationStop

    public void onApplicationStop()

#### onEvent

    public void onEvent(java.lang.String message,
                        java.lang.Object context)

#### enhance

    public void enhance(ApplicationClasses.ApplicationClass applicationClass)

#### onClassesChange

    @Deprecated
    public java.util.List<ApplicationClasses.ApplicationClass> onClassesChange(java.util.List<ApplicationClasses.ApplicationClass> modified)

Deprecated.

#### compileAll

    @Deprecated
    public void compileAll(java.util.List<ApplicationClasses.ApplicationClass> classes)

Deprecated.

#### bind

    public java.lang.Object bind(RootParamNode rootParamNode,
                                 java.lang.String name,
                                 java.lang.Class<?> clazz,
                                 java.lang.reflect.Type type,
                                 java.lang.annotation.Annotation[] annotations)

#### bindBean

    public java.lang.Object bindBean(RootParamNode rootParamNode,
                                     java.lang.String name,
                                     java.lang.Object bean)

#### unBind

    public java.util.Map<java.lang.String,java.lang.Object> unBind(java.lang.Object src,
                                                                   java.lang.String name)

#### willBeValidated

    public java.lang.Object willBeValidated(java.lang.Object value)

#### modelFactory

    public Model.Factory modelFactory(java.lang.Class<? extends Model> modelClass)

#### getMessage

    public java.lang.String getMessage(java.lang.String locale,
                                       java.lang.Object key,
                                       java.lang.Object... args)

#### beforeActionInvocation

    public void beforeActionInvocation(java.lang.reflect.Method actionMethod)

#### onActionInvocationResult

    public void onActionInvocationResult(Result result)

#### afterActionInvocation

    public void afterActionInvocation()

#### onActionInvocationFinally

    public void onActionInvocationFinally()

#### routeRequest

    public void routeRequest(Http.Request request)

#### onRequestRouting

    public void onRequestRouting(Router.Route route)

#### onRoutesLoaded

    public void onRoutesLoaded()

#### rawInvocation

    public boolean rawInvocation(Http.Request request,
                                 Http.Response response)
                          throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### serveStatic

    public boolean serveStatic(VirtualFile file,
                               Http.Request request,
                               Http.Response response)

#### addTemplateExtensions

    public java.util.List<java.lang.String> addTemplateExtensions()

#### overrideTemplateSource

    public java.lang.String overrideTemplateSource(BaseTemplate template,
                                                   java.lang.String source)

#### loadTemplate

    public Template loadTemplate(VirtualFile file)

#### afterFixtureLoad

    public void afterFixtureLoad()

#### runTest

    public TestEngine.TestResults runTest(java.lang.Class<BaseTest> clazz)

#### getUnitTests

    public java.util.Collection<java.lang.Class> getUnitTests()

#### getFunctionalTests

    public java.util.Collection<java.lang.Class> getFunctionalTests()