com.sonyericsson.jenkins.plugins.bfa
Class PluginImpl

java.lang.Object
  extended by hudson.Plugin
      extended by com.sonyericsson.jenkins.plugins.bfa.PluginImpl
All Implemented Interfaces:
hudson.model.Saveable

public class PluginImpl
extends hudson.Plugin

The main thing.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.Plugin
hudson.Plugin.DummyImpl
 
Field Summary
static String DEFAULT_ICON_NAME
          Convenience constant for the default icon size.
static String DEFAULT_ICON_SIZE
          Convenience constant for the 24x24 icon size.
static int DEFAULT_NR_OF_SCAN_THREADS
          Default number of concurrent scan threads.
protected static int MINIMUM_NR_OF_SCAN_THREADS
          Minimum allowed value for nrOfScanThreads.
static hudson.security.PermissionGroup PERMISSION_GROUP
          The permission group for all permissions related to this plugin.
static hudson.security.Permission REMOVE_PERMISSION
          Permission to remove causes.
static hudson.security.Permission UPDATE_PERMISSION
          Permission to update the causes.
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
PluginImpl()
           
 
Method Summary
 void configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject o)
           
static String getDefaultIcon()
          The default icon to be used throughout this plugin.
static String getFullImageUrl(String size, String name)
          Get the full url to an image, including rootUrl and context path.
static String getImageUrl(String name)
          Provides a Jenkins relative url to a plugin internal image of DEFAULT_ICON_SIZE size.
static String getImageUrl(String size, String name)
          Provides a Jenkins relative url to a plugin internal image.
static PluginImpl getInstance()
          Returns the singleton instance.
 KnowledgeBase getKnowledgeBase()
          The knowledge base containing all causes.
 KnowledgeBase.KnowledgeBaseDescriptor getKnowledgeBaseDescriptor(String descString)
          Gets the KnowledgeBaseDescriptor that matches the name descString.
 hudson.ExtensionList<KnowledgeBase.KnowledgeBaseDescriptor> getKnowledgeBaseDescriptors()
          Convenience method to reach the list from jelly.
 String getNoCausesMessage()
          Getter for the no causes message.
 int getNrOfScanThreads()
          The number of threads to have in the pool for each build.
 ScanOnDemandVariables getSodVariables()
          Getter sodVariable.
static String getStaticImagesBase()
          Returns the base relative URI for static images packaged in webapp.
static String getStaticResourcesBase()
          Returns the base relative URI for static resources packaged in webapp.
 boolean isGerritTriggerEnabled()
          Send notifications to Gerrit-Trigger-plugin.
 boolean isGlobalEnabled()
          If this feature is enabled or not.
 boolean isGraphsEnabled()
          If graphs are enabled or not.
 void setGerritTriggerEnabled(Boolean gerritTriggerEnabled)
          Sets if this feature is enabled or not.
 void setGlobalEnabled(Boolean globalEnabled)
          Sets if this feature is enabled or not.
 void setNrOfScanThreads(int nrOfScanThreads)
          The number of threads to have in the pool for each build.
static boolean shouldScan(hudson.model.AbstractBuild build)
          Checks if the specified build should be scanned or not.
static boolean shouldScan(hudson.model.AbstractProject project)
          Checks if the specified project should be scanned or not.
 void start()
           
 void stop()
           
 
Methods inherited from class hudson.Plugin
configure, doDynamic, getConfigXml, getWrapper, load, postInitialize, save, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ICON_SIZE

public static final String DEFAULT_ICON_SIZE
Convenience constant for the 24x24 icon size. used for getImageUrl(String, String).

See Also:
Constant Field Values

DEFAULT_ICON_NAME

public static final String DEFAULT_ICON_NAME
Convenience constant for the default icon size. used for getImageUrl(String, String).

See Also:
Constant Field Values

DEFAULT_NR_OF_SCAN_THREADS

public static final int DEFAULT_NR_OF_SCAN_THREADS
Default number of concurrent scan threads.

See Also:
Constant Field Values

PERMISSION_GROUP

public static final hudson.security.PermissionGroup PERMISSION_GROUP
The permission group for all permissions related to this plugin.


UPDATE_PERMISSION

public static final hudson.security.Permission UPDATE_PERMISSION
Permission to update the causes. E.e. Access CauseManagement.


REMOVE_PERMISSION

public static final hudson.security.Permission REMOVE_PERMISSION
Permission to remove causes.


MINIMUM_NR_OF_SCAN_THREADS

protected static final int MINIMUM_NR_OF_SCAN_THREADS
Minimum allowed value for nrOfScanThreads.

See Also:
Constant Field Values
Constructor Detail

PluginImpl

public PluginImpl()
Method Detail

start

public void start()
           throws Exception
Overrides:
start in class hudson.Plugin
Throws:
Exception

stop

public void stop()
          throws Exception
Overrides:
stop in class hudson.Plugin
Throws:
Exception

getStaticResourcesBase

public static String getStaticResourcesBase()
Returns the base relative URI for static resources packaged in webapp.

Returns:
the base URI.

getSodVariables

public ScanOnDemandVariables getSodVariables()
Getter sodVariable.

Returns:
the message.

getStaticImagesBase

public static String getStaticImagesBase()
Returns the base relative URI for static images packaged in webapp.

Returns:
the images directory.
See Also:
getStaticResourcesBase()

getImageUrl

public static String getImageUrl(String size,
                                 String name)
Provides a Jenkins relative url to a plugin internal image.

Parameters:
size - the size of the image (the sub directory of images).
name - the name of the image file.
Returns:
a URL to the image.

getFullImageUrl

public static String getFullImageUrl(String size,
                                     String name)
Get the full url to an image, including rootUrl and context path.

Parameters:
size - the size of the image (the sub directory of images).
name - the name of the image file.
Returns:
a URL to the image.

getImageUrl

public static String getImageUrl(String name)
Provides a Jenkins relative url to a plugin internal image of DEFAULT_ICON_SIZE size.

Parameters:
name - the name of the image.
Returns:
a URL to the image.
See Also:
getImageUrl(String, String)

getDefaultIcon

public static String getDefaultIcon()
The default icon to be used throughout this plugin.

Returns:
the relative URL to the image.
See Also:
getImageUrl(String), getImageUrl(String, String)

getInstance

public static PluginImpl getInstance()
Returns the singleton instance.

Returns:
the one.

getNoCausesMessage

public String getNoCausesMessage()
Getter for the no causes message.

Returns:
the message.

isGlobalEnabled

public boolean isGlobalEnabled()
If this feature is enabled or not. When on all unsuccessful builds will be scanned. None when off.

Returns:
true if on.

isGraphsEnabled

public boolean isGraphsEnabled()
If graphs are enabled or not. Links to graphs and graphs will not be displayed when disabled. It can be enabled only if the knowledgeBase has support for it.

Returns:
True if enabled.

setGlobalEnabled

public void setGlobalEnabled(Boolean globalEnabled)
Sets if this feature is enabled or not. When on all unsuccessful builds will be scanned. None when off.

Parameters:
globalEnabled - on or off. null == on.

isGerritTriggerEnabled

public boolean isGerritTriggerEnabled()
Send notifications to Gerrit-Trigger-plugin.

Returns:
true if on.

setGerritTriggerEnabled

public void setGerritTriggerEnabled(Boolean gerritTriggerEnabled)
Sets if this feature is enabled or not. When on, cause descriptions will be forwarded to Gerrit-Trigger-Plugin.

Parameters:
gerritTriggerEnabled - on or off. null == on.

getNrOfScanThreads

public int getNrOfScanThreads()
The number of threads to have in the pool for each build. Used by the BuildFailureScanner. Will return nothing less than MINIMUM_NR_OF_SCAN_THREADS.

Returns:
the number of scan threads.

setNrOfScanThreads

public void setNrOfScanThreads(int nrOfScanThreads)
The number of threads to have in the pool for each build. Used by the BuildFailureScanner. Will throw an IllegalArgumentException if the parameter is less than MINIMUM_NR_OF_SCAN_THREADS.

Parameters:
nrOfScanThreads - the number of scan threads.

shouldScan

public static boolean shouldScan(hudson.model.AbstractBuild build)
Checks if the specified build should be scanned or not.

Parameters:
build - the build
Returns:
true if it should be scanned.
See Also:
#shouldScan(AbstractProject)}

shouldScan

public static boolean shouldScan(hudson.model.AbstractProject project)
Checks if the specified project should be scanned or not. Determined by isGlobalEnabled() and if the project has ScannerJobProperty.isDoNotScan().

Parameters:
project - the project
Returns:
true if it should be scanned.

getKnowledgeBase

public KnowledgeBase getKnowledgeBase()
The knowledge base containing all causes.

Returns:
all the base.

getKnowledgeBaseDescriptors

public hudson.ExtensionList<KnowledgeBase.KnowledgeBaseDescriptor> getKnowledgeBaseDescriptors()
Convenience method to reach the list from jelly.

Returns:
the list of registered KnowledgeBaseDescriptors

getKnowledgeBaseDescriptor

public KnowledgeBase.KnowledgeBaseDescriptor getKnowledgeBaseDescriptor(String descString)
Gets the KnowledgeBaseDescriptor that matches the name descString.

Parameters:
descString - either name of a KnowledgeBaseDescriptor or the fully qualified name.
Returns:
The matching KnowledgeBaseDescriptor or null if none is found.

configure

public void configure(org.kohsuke.stapler.StaplerRequest req,
                      net.sf.json.JSONObject o)
               throws hudson.model.Descriptor.FormException,
                      IOException
Overrides:
configure in class hudson.Plugin
Throws:
hudson.model.Descriptor.FormException
IOException


Copyright © 2004-2014. All Rights Reserved.