Class MQNotifierConfig
- java.lang.Object
-
- hudson.model.Descriptor<GlobalConfiguration>
-
- jenkins.model.GlobalConfiguration
-
- com.sonymobile.jenkins.plugins.mq.mqnotifier.MQNotifierConfig
-
- All Implemented Interfaces:
ExtensionPoint,Describable<GlobalConfiguration>,Saveable,OnMaster
@Extension @Symbol("mq-notifier") public final class MQNotifierConfig extends GlobalConfiguration
Adds the MQ notifier plugin configuration to the system config page.- Author:
- Örjan Percy <orjan.percy@sonymobile.com>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUTO_ROUTING_PROVIDERString representing the automatic routing provider.static StringMANUAL_ROUTING_PROVIDERString representing the manual routing provider.-
Fields inherited from class hudson.model.Descriptor
clazz
-
-
Constructor Summary
Constructors Constructor Description MQNotifierConfig()Load configuration on invoke.MQNotifierConfig(boolean enableNotifier, String serverUri, String userName, Secret userPassword, String exchangeName, String virtualHost, String routingKeyProvider, String routingKey, boolean persistentDelivery, String appId, Boolean enableVerboseLoggingBoolean)Creates an instance with specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)FormValidationdoTestConnection(String uri, String name, Secret pw)Tests connection to the server URI.StringgetAppId()Returns application id.protected XmlFilegetConfigFile()For backwards-compatibility with the previous Plugin derived version.StringgetDisplayName()booleangetEnableNotifier()Gets whether this plugin is enabled or not.BooleangetEnableVerboseLoggingBoolean()Gets whether verbose logging is enabled or not.StringgetExchangeName()Gets the exchange name.static MQNotifierConfiggetInstance()Gets this extension's instance.booleangetPersistentDelivery()Returns true if persistentDelivery is to be used.StringgetRoutingKey()Gets the routing key.StringgetRoutingKeyProvider()Gets the routing key provider, either "AUTO" or "MANUAL".StringgetServerUri()Gets URI for MQ server.StringgetUserName()Gets user name.SecretgetUserPassword()Gets user password.StringgetVirtualHost()Gets the virtual host name.protected ObjectreadResolve()Translates old configs to new.voidsetAppId(String appId)Sets application id.voidsetEnableNotifier(boolean enableNotifier)Sets flag whether this plugin is enabled or not.voidsetEnableVerboseLoggingBoolean(Boolean enableVerboseLoggingBoolean)Sets flag whether verbose logging is enabled or not.voidsetExchangeName(String exchangeName)Sets the exchange name.voidsetPersistentDelivery(boolean pd)Sets persistent delivery mode.voidsetRoutingKey(String routingKey)Sets the routing key.voidsetRoutingKeyProvider(String routingKeyProvider)Sets the routing key provider ("AUTO" or "MANUAL").voidsetServerUri(String serverUri)Sets URI for MQ server.voidsetUserName(String userName)Sets user name.voidsetUserPassword(Secret userPassword)Sets user password.voidsetVirtualHost(String virtualHost)Sets the virtual host name.-
Methods inherited from class jenkins.model.GlobalConfiguration
all, getDescriptor, getGlobalConfigPage
-
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
-
-
-
Field Detail
-
MANUAL_ROUTING_PROVIDER
public static final String MANUAL_ROUTING_PROVIDER
String representing the manual routing provider.- See Also:
- Constant Field Values
-
AUTO_ROUTING_PROVIDER
public static final String AUTO_ROUTING_PROVIDER
String representing the automatic routing provider.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MQNotifierConfig
@DataBoundConstructor public MQNotifierConfig(boolean enableNotifier, String serverUri, String userName, Secret userPassword, String exchangeName, String virtualHost, String routingKeyProvider, String routingKey, boolean persistentDelivery, String appId, Boolean enableVerboseLoggingBoolean)Creates an instance with specified parameters.- Parameters:
enableNotifier- if this plugin is enabledserverUri- the server uriuserName- the user nameuserPassword- the user passwordexchangeName- the name of the exchangevirtualHost- the name of the virtual hostroutingKey- the routing keypersistentDelivery- if using persistent delivery modeappId- the application idenableVerboseLoggingBoolean- if verbose logging is enabled
-
MQNotifierConfig
public MQNotifierConfig()
Load configuration on invoke.
-
-
Method Detail
-
configure
public boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData) throws Descriptor.FormException- Overrides:
configurein classGlobalConfiguration- Throws:
Descriptor.FormException
-
readResolve
protected Object readResolve()
Translates old configs to new. If the routing key has been set, turn on manual routing keys. If it hasn't, default to automatically setting routing keys.
-
getConfigFile
protected XmlFile getConfigFile()
For backwards-compatibility with the previous Plugin derived version.- Overrides:
getConfigFilein classDescriptor<GlobalConfiguration>- Returns:
- XmlFile representing the ConfigFile.
-
getEnableNotifier
public boolean getEnableNotifier()
Gets whether this plugin is enabled or not.- Returns:
- true if this plugin is enabled.
-
setEnableNotifier
public void setEnableNotifier(boolean enableNotifier)
Sets flag whether this plugin is enabled or not.- Parameters:
enableNotifier- true if this plugin is enabled.
-
getEnableVerboseLoggingBoolean
public Boolean getEnableVerboseLoggingBoolean()
Gets whether verbose logging is enabled or not.- Returns:
- true if verbose logging is enabled.
-
setEnableVerboseLoggingBoolean
public void setEnableVerboseLoggingBoolean(Boolean enableVerboseLoggingBoolean)
Sets flag whether verbose logging is enabled or not.- Parameters:
enableVerboseLoggingBoolean- true if verbose logging is enabled.
-
getServerUri
public String getServerUri()
Gets URI for MQ server.- Returns:
- the URI.
-
setServerUri
public void setServerUri(String serverUri)
Sets URI for MQ server.- Parameters:
serverUri- the URI.
-
getUserName
public String getUserName()
Gets user name.- Returns:
- the user name.
-
setUserName
public void setUserName(String userName)
Sets user name.- Parameters:
userName- the user name.
-
getUserPassword
public Secret getUserPassword()
Gets user password.- Returns:
- the user password.
-
setUserPassword
public void setUserPassword(Secret userPassword)
Sets user password.- Parameters:
userPassword- the user password.
-
getInstance
public static MQNotifierConfig getInstance()
Gets this extension's instance.If
Jenkins.getInstance()isn't available or the plugin class isn't registered null will be returned.- Returns:
- the instance of this extension.
-
getExchangeName
public String getExchangeName()
Gets the exchange name.- Returns:
- the exchange name.
-
setExchangeName
public void setExchangeName(String exchangeName)
Sets the exchange name.- Parameters:
exchangeName- the exchange name.
-
getVirtualHost
public String getVirtualHost()
Gets the virtual host name.- Returns:
- the virtual host name.
-
setVirtualHost
public void setVirtualHost(String virtualHost)
Sets the virtual host name.- Parameters:
virtualHost- the exchange name.
-
setRoutingKeyProvider
public void setRoutingKeyProvider(String routingKeyProvider)
Sets the routing key provider ("AUTO" or "MANUAL").- Parameters:
routingKeyProvider- the routing key provider.
-
getRoutingKeyProvider
public String getRoutingKeyProvider()
Gets the routing key provider, either "AUTO" or "MANUAL".- Returns:
- the routing key provider.
-
getRoutingKey
public String getRoutingKey()
Gets the routing key.- Returns:
- the routing key.
-
setRoutingKey
public void setRoutingKey(String routingKey)
Sets the routing key.- Parameters:
routingKey- the routing key.
-
getPersistentDelivery
public boolean getPersistentDelivery()
Returns true if persistentDelivery is to be used.- Returns:
- if persistentDelivery is to be used.
-
setPersistentDelivery
public void setPersistentDelivery(boolean pd)
Sets persistent delivery mode.- Parameters:
pd- if persistentDelivery is to be used.
-
getAppId
public String getAppId()
Returns application id.- Returns:
- application id.
-
setAppId
public void setAppId(String appId)
Sets application id.- Parameters:
appId- Application id to use
-
getDisplayName
public String getDisplayName()
- Overrides:
getDisplayNamein classDescriptor<GlobalConfiguration>
-
doTestConnection
public FormValidation doTestConnection(@QueryParameter("serverUri") String uri, @QueryParameter("userName") String name, @QueryParameter("userPassword") Secret pw) throws javax.servlet.ServletException
Tests connection to the server URI.- Parameters:
uri- the URI.name- the user name.pw- the user password.- Returns:
- FormValidation object that indicates ok or error.
- Throws:
javax.servlet.ServletException- Exception for servlet.
-
-