org.jenkinsci.lib.configprovider
Class ConfigProvider

java.lang.Object
  extended by hudson.model.Descriptor<Config>
      extended by org.jenkinsci.lib.configprovider.ConfigProvider
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Saveable
Direct Known Subclasses:
AbstractConfigProviderImpl

public abstract class ConfigProvider
extends hudson.model.Descriptor<Config>
implements hudson.ExtensionPoint

A ConfigProvider represents a configuration file (such as Maven's settings.xml) where the user can choose its actual content among several concrete contents that are pre-configured.

ConfigProvider is an extension point, and should be implemented and instantiated by each kind of configuration. This abstraction doesn't define where the configuration is placed, or how/when it's used — those semantics should be introduced by a specific instance of ConfigProvider.

Author:
Dominik Bartholdi (imod)

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.model.Descriptor
hudson.model.Descriptor.FormException, hudson.model.Descriptor.PropertyType, hudson.model.Descriptor.Self
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
ConfigProvider()
           
 
Method Summary
static hudson.ExtensionList<ConfigProvider> all()
          All registered ConfigProviders.
abstract  Collection<Config> getAllConfigs()
          returns all the configs of this provider
abstract  Config getConfigById(String configId)
          Returns the config item identified by this id.
abstract  ContentType getContentType()
          The content type of the configs this provider manages.
abstract  String getProviderId()
          An ID uniquely identifying this provider, the id of each Config must start with this ID separated by a '.'!
abstract  boolean isResponsibleFor(String configId)
          Whether this provider is responsible for a Config with the given Id.
abstract  Config newConfig()
          Returns a new Config object with a unique id, starting with the id of this provider - separated by '.'.
abstract  void remove(String configId)
          Removes/deletes the config with the given Id
abstract  void save(Config config)
          save the content of the given config.
 
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getDisplayName, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigProvider

public ConfigProvider()
Method Detail

all

public static hudson.ExtensionList<ConfigProvider> all()
All registered ConfigProviders.


getAllConfigs

public abstract Collection<Config> getAllConfigs()
returns all the configs of this provider

Returns:
collection of Configs

getContentType

public abstract ContentType getContentType()
The content type of the configs this provider manages. e.g. can be used to display the content in the UI (editor).

Returns:
the type. null if no specific formating should be supported.

getConfigById

public abstract Config getConfigById(String configId)
Returns the config item identified by this id.

Parameters:
configId - the id
Returns:
the config with the given id

isResponsibleFor

public abstract boolean isResponsibleFor(String configId)
Whether this provider is responsible for a Config with the given Id.

Parameters:
configId - the id to check
Returns:
true if the provider takes responsibility

save

public abstract void save(Config config)
save the content of the given config.

Parameters:
config - the config to be saved

remove

public abstract void remove(String configId)
Removes/deletes the config with the given Id

Parameters:
configId - the id

getProviderId

public abstract String getProviderId()
An ID uniquely identifying this provider, the id of each Config must start with this ID separated by a '.'!

Returns:
the unique id for this provider.

newConfig

public abstract Config newConfig()
Returns a new Config object with a unique id, starting with the id of this provider - separated by '.'. e.g. "MyCustomProvider.123456". This object is also used initialize the user interface.

Returns:
the new config object, ready for editing.


Copyright © 2004-2013. All Rights Reserved.