org.jenkinsci.lib.configprovider
Class AbstractConfigProviderImpl

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

public abstract class AbstractConfigProviderImpl
extends ConfigProvider

Partial default implementation of ConfigProvider. Subtype must call the load() method in the constructor.

Author:
Kohsuke Kawaguchi

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
protected  Map<String,Config> configs
           
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
AbstractConfigProviderImpl()
           
 
Method Summary
 Collection<Config> getAllConfigs()
          returns all the configs of this provider
 Config getConfigById(String configId)
          Returns the config item identified by this id.
<T extends Config>
T
getConfigByIdTyped(String configId)
          same as ConfigProvider.getConfigById(String), but wihout the need for cast
protected  hudson.XmlFile getConfigXml()
           
 String getProviderId()
          An ID uniquely identifying this provider, the id of each Config must start with this ID separated by a '.'!
protected  String getXmlFileName()
           
 boolean isResponsibleFor(String configId)
          Whether this provider is responsible for a Config with the given Id.
 void load()
          Overridden for backward compatibility to let subtype customize the file name.
 Config newConfig()
          Returns a new Config object with a unique id, starting with the id of this provider - separated by '.'.
 void remove(String configId)
          Removes/deletes the config with the given Id
 void save()
          Saves the configuration info to the disk.
 void save(Config config)
          save the content of the given config.
 
Methods inherited from class org.jenkinsci.lib.configprovider.ConfigProvider
all, getContentType
 
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, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, self, toArray, toList, toMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configs

protected Map<String,Config> configs
Constructor Detail

AbstractConfigProviderImpl

public AbstractConfigProviderImpl()
Method Detail

getAllConfigs

public Collection<Config> getAllConfigs()
Description copied from class: ConfigProvider
returns all the configs of this provider

Specified by:
getAllConfigs in class ConfigProvider
Returns:
collection of Configs

getConfigById

public Config getConfigById(String configId)
Description copied from class: ConfigProvider
Returns the config item identified by this id.

Specified by:
getConfigById in class ConfigProvider
Parameters:
configId - the id
Returns:
the config with the given id

getConfigByIdTyped

public <T extends Config> T getConfigByIdTyped(String configId)
Description copied from class: ConfigProvider
same as ConfigProvider.getConfigById(String), but wihout the need for cast

Specified by:
getConfigByIdTyped in class ConfigProvider
Parameters:
configId - the id
Returns:
the config with the given id

getProviderId

public String getProviderId()
Description copied from class: ConfigProvider
An ID uniquely identifying this provider, the id of each Config must start with this ID separated by a '.'!

Specified by:
getProviderId in class ConfigProvider
Returns:
the unique id for this provider.

isResponsibleFor

public boolean isResponsibleFor(String configId)
Description copied from class: ConfigProvider
Whether this provider is responsible for a Config with the given Id.

Specified by:
isResponsibleFor in class ConfigProvider
Parameters:
configId - the id to check
Returns:
true if the provider takes responsibility

newConfig

public Config newConfig()
Description copied from class: ConfigProvider
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.

Specified by:
newConfig in class ConfigProvider
Returns:
the new config object, ready for editing.

remove

public void remove(String configId)
Description copied from class: ConfigProvider
Removes/deletes the config with the given Id

Specified by:
remove in class ConfigProvider
Parameters:
configId - the id

save

public void save(Config config)
Description copied from class: ConfigProvider
save the content of the given config.

Specified by:
save in class ConfigProvider
Parameters:
config - the config to be saved

save

public void save()
Saves the configuration info to the disk.

Specified by:
save in interface hudson.model.Saveable
Overrides:
save in class hudson.model.Descriptor<Config>

load

public void load()
Overridden for backward compatibility to let subtype customize the file name.

Overrides:
load in class hudson.model.Descriptor<Config>

getConfigXml

protected hudson.XmlFile getConfigXml()

getXmlFileName

protected String getXmlFileName()


Copyright © 2004-2013. All Rights Reserved.