Class PluginConfigFactory
- java.lang.Object
-
- com.google.gerrit.server.config.PluginConfigFactory
-
- All Implemented Interfaces:
ReloadPluginListener
public class PluginConfigFactory extends Object implements ReloadPluginListener
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PluginConfig
getFromGerritConfig(String pluginName)
Returns the configuration for the specified plugin that is stored in the 'gerrit.config' file.PluginConfig
getFromGerritConfig(String pluginName, boolean refresh)
Returns the configuration for the specified plugin that is stored in the 'gerrit.config' file.PluginConfig
getFromProjectConfig(Project.NameKey projectName, String pluginName)
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project.PluginConfig
getFromProjectConfig(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project.PluginConfig
getFromProjectConfigWithInheritance(Project.NameKey projectName, String pluginName)
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project.PluginConfig
getFromProjectConfigWithInheritance(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project.org.eclipse.jgit.lib.Config
getGlobalPluginConfig(String pluginName)
Returns the configuration for the specified plugin that is stored in the plugin configuration file 'etc/<plugin-name>.config
'.org.eclipse.jgit.lib.Config
getProjectPluginConfig(Project.NameKey projectName, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.org.eclipse.jgit.lib.Config
getProjectPluginConfig(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.org.eclipse.jgit.lib.Config
getProjectPluginConfigWithInheritance(Project.NameKey projectName, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.org.eclipse.jgit.lib.Config
getProjectPluginConfigWithInheritance(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.org.eclipse.jgit.lib.Config
getProjectPluginConfigWithMergedInheritance(Project.NameKey projectName, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.org.eclipse.jgit.lib.Config
getProjectPluginConfigWithMergedInheritance(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.void
onReloadPlugin(Plugin oldPlugin, Plugin newPlugin)
-
-
-
Method Detail
-
getFromGerritConfig
public PluginConfig getFromGerritConfig(String pluginName)
Returns the configuration for the specified plugin that is stored in the 'gerrit.config' file.The returned plugin configuration provides access to all parameters of the 'gerrit.config' file that are set in the 'plugin' subsection of the specified plugin.
E.g.: [plugin "my-plugin"] myKey = myValue
- Parameters:
pluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the 'gerrit.config' file
-
getFromGerritConfig
public PluginConfig getFromGerritConfig(String pluginName, boolean refresh)
Returns the configuration for the specified plugin that is stored in the 'gerrit.config' file.The returned plugin configuration provides access to all parameters of the 'gerrit.config' file that are set in the 'plugin' subsection of the specified plugin.
E.g.: [plugin "my-plugin"] myKey = myValue
- Parameters:
pluginName
- the name of the plugin for which the configuration should be returnedrefresh
- iftrue
it is checked if the 'gerrit.config' file was modified and if yes the Gerrit configuration is reloaded, iffalse
the cached Gerrit configuration is used- Returns:
- the plugin configuration from the 'gerrit.config' file
-
getFromProjectConfig
public PluginConfig getFromProjectConfig(Project.NameKey projectName, String pluginName) throws NoSuchProjectException
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project.The returned plugin configuration provides access to all parameters of the 'project.config' file that are set in the 'plugin' subsection of the specified plugin.
E.g.: [plugin "my-plugin"] myKey = myValue
- Parameters:
projectName
- the name of the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the 'project.config' file of the specified project
- Throws:
NoSuchProjectException
- thrown if the specified project does not exist
-
getFromProjectConfig
public PluginConfig getFromProjectConfig(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project.The returned plugin configuration provides access to all parameters of the 'project.config' file that are set in the 'plugin' subsection of the specified plugin.
E.g.: [plugin "my-plugin"] myKey = myValue
- Parameters:
projectState
- the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the 'project.config' file of the specified project
-
getFromProjectConfigWithInheritance
public PluginConfig getFromProjectConfigWithInheritance(Project.NameKey projectName, String pluginName) throws NoSuchProjectException
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project. Parameters which are not set in the 'project.config' of this project are inherited from the parent project's 'project.config' files.The returned plugin configuration provides access to all parameters of the 'project.config' file that are set in the 'plugin' subsection of the specified plugin.
E.g.: child project: [plugin "my-plugin"] myKey = childValue
parent project: [plugin "my-plugin"] myKey = parentValue anotherKey = someValue
return: [plugin "my-plugin"] myKey = childValue anotherKey = someValue
- Parameters:
projectName
- the name of the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the 'project.config' file of the specified project with inherited non-set parameters from the parent projects
- Throws:
NoSuchProjectException
- thrown if the specified project does not exist
-
getFromProjectConfigWithInheritance
public PluginConfig getFromProjectConfigWithInheritance(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the 'project.config' file of the specified project. Parameters which are not set in the 'project.config' of this project are inherited from the parent project's 'project.config' files.The returned plugin configuration provides access to all parameters of the 'project.config' file that are set in the 'plugin' subsection of the specified plugin.
E.g.: child project: [plugin "my-plugin"] myKey = childValue
parent project: [plugin "my-plugin"] myKey = parentValue anotherKey = someValue
return: [plugin "my-plugin"] myKey = childValue anotherKey = someValue
- Parameters:
projectState
- the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the 'project.config' file of the specified project with inherited non-set parameters from the parent projects
-
getGlobalPluginConfig
public org.eclipse.jgit.lib.Config getGlobalPluginConfig(String pluginName)
Returns the configuration for the specified plugin that is stored in the plugin configuration file 'etc/<plugin-name>.config
'.The plugin configuration is only loaded once and is then cached.
- Parameters:
pluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
etc/<plugin-name>.config
' file
-
getProjectPluginConfig
public org.eclipse.jgit.lib.Config getProjectPluginConfig(Project.NameKey projectName, String pluginName) throws NoSuchProjectException
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.- Parameters:
projectName
- the name of the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
<plugin-name>.config
' file of the specified project - Throws:
NoSuchProjectException
- thrown if the specified project does not exist
-
getProjectPluginConfig
public org.eclipse.jgit.lib.Config getProjectPluginConfig(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project.- Parameters:
projectState
- the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
<plugin-name>.config
' file of the specified project
-
getProjectPluginConfigWithInheritance
public org.eclipse.jgit.lib.Config getProjectPluginConfigWithInheritance(Project.NameKey projectName, String pluginName) throws NoSuchProjectException
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project. Parameters which are not set in the '<plugin-name>.config
' of this project are inherited from the parent project's '<plugin-name>.config
' files.E.g.: child project: [mySection "mySubsection"] myKey = childValue
parent project: [mySection "mySubsection"] myKey = parentValue anotherKey = someValue
return: [mySection "mySubsection"] myKey = childValue anotherKey = someValue
- Parameters:
projectName
- the name of the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
<plugin-name>.config
' file of the specified project with inheriting non-set parameters from the parent projects - Throws:
NoSuchProjectException
- thrown if the specified project does not exist
-
getProjectPluginConfigWithInheritance
public org.eclipse.jgit.lib.Config getProjectPluginConfigWithInheritance(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project. Parameters which are not set in the '<plugin-name>.config
' of this project are inherited from the parent project's '<plugin-name>.config
' files.E.g.: child project: [mySection "mySubsection"] myKey = childValue
parent project: [mySection "mySubsection"] myKey = parentValue anotherKey = someValue
return: [mySection "mySubsection"] myKey = childValue anotherKey = someValue
- Parameters:
projectState
- the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
<plugin-name>.config
' file of the specified project with inheriting non-set parameters from the parent projects
-
getProjectPluginConfigWithMergedInheritance
public org.eclipse.jgit.lib.Config getProjectPluginConfigWithMergedInheritance(Project.NameKey projectName, String pluginName) throws NoSuchProjectException
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project. Parameters from the '<plugin-name>.config
' of the parent project are appended to this project's '<plugin-name>.config
' files.E.g.: child project: [mySection "mySubsection"] myKey = childValue
parent project: [mySection "mySubsection"] myKey = parentValue anotherKey = someValue
return: [mySection "mySubsection"] myKey = childValue myKey = parentValue anotherKey = someValue
- Parameters:
projectName
- the name of the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
<plugin-name>.config
' file of the specified project with parameters from the parent projects appended to the project values - Throws:
NoSuchProjectException
- thrown if the specified project does not exist
-
getProjectPluginConfigWithMergedInheritance
public org.eclipse.jgit.lib.Config getProjectPluginConfigWithMergedInheritance(ProjectState projectState, String pluginName)
Returns the configuration for the specified plugin that is stored in the '<plugin-name>.config
' file in the 'refs/meta/config' branch of the specified project. Parameters from the '<plugin-name>.config
' of the parent project are appended to this project's '<plugin-name>.config
' files.E.g.: child project: [mySection "mySubsection"] myKey = childValue
parent project: [mySection "mySubsection"] myKey = parentValue anotherKey = someValue
return: [mySection "mySubsection"] myKey = childValue myKey = parentValue anotherKey = someValue
- Parameters:
projectState
- the project for which the plugin configuration should be returnedpluginName
- the name of the plugin for which the configuration should be returned- Returns:
- the plugin configuration from the '
<plugin-name>.config
' file of the specified project with inheriting non-set parameters from the parent projects
-
onReloadPlugin
public void onReloadPlugin(Plugin oldPlugin, Plugin newPlugin)
- Specified by:
onReloadPlugin
in interfaceReloadPluginListener
-
-