com.technicolor.eloyente
Class ElOyente.DescriptorImpl

java.lang.Object
  extended by hudson.model.Descriptor<hudson.triggers.Trigger<?>>
      extended by hudson.triggers.TriggerDescriptor
          extended by com.technicolor.eloyente.ElOyente.DescriptorImpl
All Implemented Interfaces:
hudson.model.Saveable
Enclosing class:
ElOyente

@Extension
public static final class ElOyente.DescriptorImpl
extends hudson.triggers.TriggerDescriptor

Descriptor for ElOyente. Used as a singleton. The class is marked as public so that it can be accessed from views.

See src/main/resources/hudson/plugins/eloyente/elOyente/*.jelly for the actual HTML fragment for the configuration screen.


Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.model.Descriptor
hudson.model.Descriptor.FormException, hudson.model.Descriptor.PropertyType, hudson.model.Descriptor.Self
 
Field Summary
 boolean reloading
           
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
ElOyente.DescriptorImpl()
          Brings the persisted configuration in the main configuration.
 
Method Summary
 boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
          Invoked when the global configuration page is submitted..
 hudson.util.FormValidation doCheckPassword(String user, String password, String server)
          Performs on-the-fly validation of the form fields 'user' and 'password'.
 hudson.util.FormValidation doCheckServer(String server)
          Performs on-the-fly validation of the form field 'server'.
 hudson.util.ListBoxModel doFillNodeItems(String name)
          Fill the drop-down called "nodesAvailable" of the config.jelly
 hudson.util.ListBoxModel doFillNodesSubItems()
           
 String getDisplayName()
          Human readable name of this kind of configurable object.
 String getPassword()
          This method returns the password for the XMPP connection.
 boolean getReloading()
          Used for knowing if a job is using the start() method because it is loading or the configuration has changed and it is being reloaded.
 String getServer()
          This method returns the URL of the XMPP server.
 String getUser()
          This method returns the username for the XMPP connection.
 boolean isApplicable(hudson.model.Item item)
          Returns true if this task is applicable to the given project.
 void reloadJobs()
          This method reloads the jobs that are using ElOyente applying the new main configuration.
 void report()
          Used for logging to the log file.
 
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, getCheckUrl, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, 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
 

Field Detail

reloading

public boolean reloading
Constructor Detail

ElOyente.DescriptorImpl

public ElOyente.DescriptorImpl()
Brings the persisted configuration in the main configuration. Brings the persisted configuration in the main configuration.

Method Detail

isApplicable

public boolean isApplicable(hudson.model.Item item)
Returns true if this task is applicable to the given project. True to allow user to configure this post-promotion task for the given project.

Specified by:
isApplicable in class hudson.triggers.TriggerDescriptor
Parameters:
item -
Returns:
boolean

getDisplayName

public String getDisplayName()
Human readable name of this kind of configurable object.

Specified by:
getDisplayName in class hudson.model.Descriptor<hudson.triggers.Trigger<?>>
Returns:
String

configure

public boolean configure(org.kohsuke.stapler.StaplerRequest req,
                         net.sf.json.JSONObject formData)
                  throws hudson.model.Descriptor.FormException
Invoked when the global configuration page is submitted.. Overriden in order to persist the main configuration, reporting and and call the method reloadJobs, that we'll decide if it's necessary to reload or not.

Overrides:
configure in class hudson.model.Descriptor<hudson.triggers.Trigger<?>>
Parameters:
req -
formData// - public void listen(Node node, Trigger trigger) { // ItemEventCoordinator itemEventCoordinator = new ItemEventCoordinator(node.getId(), trigger); // node.addItemEventListener(itemEventCoordinator); // }
Returns:
boolean
Throws:
Descriptor.FormException

reloadJobs

public void reloadJobs()
This method reloads the jobs that are using ElOyente applying the new main configuration. Checks if the parameters username, password and server of the main configuration have changed, if so it calls the method start() of all those jobs that are using ElOyente in order to connect to the server with the new credentials and reset the subscriptions.


report

public void report()
Used for logging to the log file. This method reports information related to XMPPadmin events like "Available Nodes", connection information, etc. It creates a connection to take the required data for reporting and it closes it after. It is used in the main configuration every time the Save or Apply buttons are pressed.


getServer

public String getServer()
This method returns the URL of the XMPP server. global.jelly calls this method to obtain the value of field server.

Returns:
server

getUser

public String getUser()
This method returns the username for the XMPP connection. global.jelly calls this method to obtain the value of field user.

Returns:
user

getPassword

public String getPassword()
This method returns the password for the XMPP connection. global.jelly calls this method to obtain the value of field password.

Returns:
password

getReloading

public boolean getReloading()
Used for knowing if a job is using the start() method because it is loading or the configuration has changed and it is being reloaded.

Returns:
reloading

doCheckServer

public hudson.util.FormValidation doCheckServer(@QueryParameter
                                                String server)
Performs on-the-fly validation of the form field 'server'. This method checks if the connection to the XMPP server specified is available. It shows a notification describing the status of the server connection.

Parameters:
server -

doCheckPassword

public hudson.util.FormValidation doCheckPassword(@QueryParameter
                                                  String user,
                                                  @QueryParameter
                                                  String password,
                                                  @QueryParameter
                                                  String server)
Performs on-the-fly validation of the form fields 'user' and 'password'. This method checks if the user and password of the XMPP server specified are correct and valid. It shows a notification describing the status of the login.

Parameters:
user -
password -

doFillNodeItems

public hudson.util.ListBoxModel doFillNodeItems(@QueryParameter(value="name")
                                                String name)
                                         throws org.jivesoftware.smack.XMPPException,
                                                InterruptedException
Fill the drop-down called "nodesAvailable" of the config.jelly

Parameters:
name: - name of the job
Returns:
ListBoxModel: List of nodes available in the XMPP Server
Throws:
org.jivesoftware.smack.XMPPException
InterruptedException

doFillNodesSubItems

public hudson.util.ListBoxModel doFillNodesSubItems()
                                             throws org.jivesoftware.smack.XMPPException,
                                                    InterruptedException
Throws:
org.jivesoftware.smack.XMPPException
InterruptedException


Copyright © 2004-2012. All Rights Reserved.