Gearman configuration UI is setup in the jenkins config page

Change-Id: I46a03e51b9d2eafdc71a6cdbff46992b82a7c820
This commit is contained in:
Khai Do 2013-01-11 15:09:50 -08:00
parent 494680cdab
commit c5fb8b5e42
7 changed files with 425 additions and 299 deletions

3
debug Executable file
View File

@ -0,0 +1,3 @@
export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n"
rm -rf work/plugins
mvn -Dmaven.test.skip=true -DskipTests=true clean hpi:run

601
pom.xml
View File

@ -16,312 +16,323 @@
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.460</version><!-- which version of Jenkins is this plugin built against? -->
</parent>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.460</version><!-- which version of Jenkins is this plugin built against? -->
</parent>
<artifactId>gearman-plugin</artifactId>
<packaging>hpi</packaging>
<artifactId>gearman-plugin</artifactId>
<packaging>hpi</packaging>
<name>Gearman Plugin</name>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Gearman+Plugin</url>
<name>Gearman Plugin</name>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Gearman+Plugin</url>
<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>khaido</id>
<name>Khai Do</name>
<email>do.khai@gmail.com</email>
</developer>
</developers>
<developers>
<developer>
<id>khaido</id>
<name>Khai Do</name>
<email>do.khai@gmail.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/openstack-infra/gearman-plugin.git</connection>
<developerConnection>scm:git:git@github.com:openstack-infra/gearman-plugin.git</developerConnection>
<url>https://github.com/openstack-infra/gearman-plugin</url>
</scm>
<scm>
<connection>scm:git:git://github.com/openstack-infra/gearman-plugin.git</connection>
<developerConnection>scm:git:git@github.com:openstack-infra/gearman-plugin.git</developerConnection>
<url>https://github.com/openstack-infra/gearman-plugin</url>
</scm>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>java.net-m2-repository</id>
<url>http://maven.jenkins-ci.org/content/repositories/releases/</url>
</repository>
<site>
<id>github-project-site</id>
<url>gitsite:git@github.com/openstack-infra/gearman-plugin</url>
</site>
</distributionManagement>
<distributionManagement>
<repository>
<id>java.net-m2-repository</id>
<url>http://maven.jenkins-ci.org/content/repositories/releases/</url>
</repository>
<site>
<id>github-project-site</id>
<url>gitsite:git@github.com/openstack-infra/gearman-plugin</url>
</site>
</distributionManagement>
<properties>
<!-- http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compileTarget>1.6</compileTarget>
<!-- define all plugin versions -->
<maven.version>3.0.1</maven.version>
<maven-antrun-plugin.version>1.6</maven-antrun-plugin.version>
<maven-assembly-plugin.version>2.2</maven-assembly-plugin.version>
<maven-changelog-plugin.version>2.2</maven-changelog-plugin.version>
<maven-checkstyle-plugin.version>2.6</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-dependency-plugin.version>2.1</maven-dependency-plugin.version>
<maven-deploy-plugin.version>2.5</maven-deploy-plugin.version>
<maven-doap-plugin.version>1.0</maven-doap-plugin.version>
<maven-eclipse-plugin.version>2.8</maven-eclipse-plugin.version>
<maven-enforcer-plugin.version>1.0</maven-enforcer-plugin.version>
<maven-help-plugin.version>2.1.1</maven-help-plugin.version>
<maven-install-plugin.version>2.3.1</maven-install-plugin.version>
<maven-javadoc-plugin.version>2.7</maven-javadoc-plugin.version>
<maven-jar-plugin.version>2.3.1</maven-jar-plugin.version>
<maven-jetty-plugin.version>6.1.26</maven-jetty-plugin.version>
<maven-jxr-plugin.version>2.2</maven-jxr-plugin.version>
<maven-pmd-plugin.version>2.5</maven-pmd-plugin.version>
<maven-project-info-reports-plugin.version>2.3.1</maven-project-info-reports-plugin.version>
<maven-plugin-plugin.version>2.4.3</maven-plugin-plugin.version>
<maven-reactor-plugin.version>1.0</maven-reactor-plugin.version>
<maven-release-plugin.version>2.1</maven-release-plugin.version>
<maven-remote-resources-plugin.version>1.1</maven-remote-resources-plugin.version>
<maven-resources-plugin.version>2.4.3</maven-resources-plugin.version>
<maven-site-plugin.version>2.1.1</maven-site-plugin.version>
<maven-source-plugin.version>2.1.2</maven-source-plugin.version>
<maven-surefire-plugin.version>2.7.2</maven-surefire-plugin.version>
<maven-surefire-report-plugin.version>2.7.2</maven-surefire-report-plugin.version>
<maven-war-plugin.version>2.1.1</maven-war-plugin.version>
<apt-maven-plugin.version>1.0-alpha-4</apt-maven-plugin.version>
<axistools-maven-plugin.version>1.4</axistools-maven-plugin.version>
<buildnumber-maven-plugin.version>1.0-beta-4</buildnumber-maven-plugin.version>
<build-helper-maven-plugin.version>1.5</build-helper-maven-plugin.version>
<cargo-maven2-plugin.version>1.0.5</cargo-maven2-plugin.version>
<cobertura-maven-plugin.version>2.4</cobertura-maven-plugin.version>
<exec-maven-plugin.version>1.2</exec-maven-plugin.version>
<findbugs-maven-plugin.version>2.3.1</findbugs-maven-plugin.version>
<gwt-maven-plugin.version>2.1.0-1</gwt-maven-plugin.version>
<javancss-maven-plugin.version>2.0</javancss-maven-plugin.version>
<jdepend-maven-plugin.version>2.0-beta-2</jdepend-maven-plugin.version>
<openjpa-maven-plugin.version>1.2</openjpa-maven-plugin.version>
<taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
<versions-maven-plugin.version>1.2</versions-maven-plugin.version>
<xml-maven-plugin.version>1.0-beta-3</xml-maven-plugin.version>
</properties>
<properties>
<!-- http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compileTarget>1.6</compileTarget>
<!-- define all plugin versions -->
<maven.version>3.0.1</maven.version>
<maven-antrun-plugin.version>1.6</maven-antrun-plugin.version>
<maven-assembly-plugin.version>2.2</maven-assembly-plugin.version>
<maven-changelog-plugin.version>2.2</maven-changelog-plugin.version>
<maven-checkstyle-plugin.version>2.6</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-dependency-plugin.version>2.1</maven-dependency-plugin.version>
<maven-deploy-plugin.version>2.5</maven-deploy-plugin.version>
<maven-doap-plugin.version>1.0</maven-doap-plugin.version>
<maven-eclipse-plugin.version>2.8</maven-eclipse-plugin.version>
<maven-enforcer-plugin.version>1.0</maven-enforcer-plugin.version>
<maven-help-plugin.version>2.1.1</maven-help-plugin.version>
<maven-install-plugin.version>2.3.1</maven-install-plugin.version>
<maven-javadoc-plugin.version>2.7</maven-javadoc-plugin.version>
<maven-jar-plugin.version>2.3.1</maven-jar-plugin.version>
<maven-jetty-plugin.version>6.1.26</maven-jetty-plugin.version>
<maven-jxr-plugin.version>2.2</maven-jxr-plugin.version>
<maven-pmd-plugin.version>2.5</maven-pmd-plugin.version>
<maven-project-info-reports-plugin.version>2.3.1</maven-project-info-reports-plugin.version>
<maven-plugin-plugin.version>2.4.3</maven-plugin-plugin.version>
<maven-reactor-plugin.version>1.0</maven-reactor-plugin.version>
<maven-release-plugin.version>2.1</maven-release-plugin.version>
<maven-remote-resources-plugin.version>1.1</maven-remote-resources-plugin.version>
<maven-resources-plugin.version>2.4.3</maven-resources-plugin.version>
<maven-site-plugin.version>2.1.1</maven-site-plugin.version>
<maven-source-plugin.version>2.1.2</maven-source-plugin.version>
<maven-surefire-plugin.version>2.7.2</maven-surefire-plugin.version>
<maven-surefire-report-plugin.version>2.7.2</maven-surefire-report-plugin.version>
<maven-war-plugin.version>2.1.1</maven-war-plugin.version>
<apt-maven-plugin.version>1.0-alpha-4</apt-maven-plugin.version>
<axistools-maven-plugin.version>1.4</axistools-maven-plugin.version>
<buildnumber-maven-plugin.version>1.0-beta-4</buildnumber-maven-plugin.version>
<build-helper-maven-plugin.version>1.5</build-helper-maven-plugin.version>
<cargo-maven2-plugin.version>1.0.5</cargo-maven2-plugin.version>
<cobertura-maven-plugin.version>2.4</cobertura-maven-plugin.version>
<exec-maven-plugin.version>1.2</exec-maven-plugin.version>
<findbugs-maven-plugin.version>2.3.1</findbugs-maven-plugin.version>
<gwt-maven-plugin.version>2.1.0-1</gwt-maven-plugin.version>
<javancss-maven-plugin.version>2.0</javancss-maven-plugin.version>
<jdepend-maven-plugin.version>2.0-beta-2</jdepend-maven-plugin.version>
<openjpa-maven-plugin.version>1.2</openjpa-maven-plugin.version>
<taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
<versions-maven-plugin.version>1.2</versions-maven-plugin.version>
<xml-maven-plugin.version>1.0-beta-3</xml-maven-plugin.version>
</properties>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.3</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.3</version>
</extension>
<extension>
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.3.1</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${compileSource}</source>
<target>${compileTarget}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
<autoVersionSubmodules>true</autoVersionSubmodules>
<goals>clean deploy</goals>
<preparationGoals>clean deploy</preparationGoals>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>${maven-remote-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<parallel>methods</parallel>
<testFailureIgnore>true</testFailureIgnore>
<threadCount>4</threadCount>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-doap-plugin</artifactId>
<version>${maven-doap-plugin.version}</version>
<executions>
<execution>
<id>site</id>
<phase>pre-site</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<doapFile>${project.reporting.outputDirectory}/doap.rdf</doapFile>
<asfExtOptions>
<included>false</included>
</asfExtOptions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-changelog-plugin</artifactId>
<version>${maven-changelog-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>${maven-jxr-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven-plugin-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven-project-info-reports-plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>cim</report>
<report>distribution-management</report>
<report>index</report>
<report>issue-tracking</report>
<report>license</report>
<report>mailing-list</report>
<report>project-team</report>
<report>scm</report>
<report>summary</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-report-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>${javancss-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
<version>${jdepend-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<version>${taglist-maven-plugin.version}</version>
</plugin>
</plugins>
</reporting>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.3</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.3</version>
</extension>
<extension>
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.3.1</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${compileSource}</source>
<target>${compileTarget}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
<autoVersionSubmodules>true</autoVersionSubmodules>
<goals>clean deploy</goals>
<preparationGoals>clean deploy</preparationGoals>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>${maven-remote-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<parallel>methods</parallel>
<testFailureIgnore>true</testFailureIgnore>
<threadCount>4</threadCount>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-doap-plugin</artifactId>
<version>${maven-doap-plugin.version}</version>
<executions>
<execution>
<id>site</id>
<phase>pre-site</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<doapFile>${project.reporting.outputDirectory}/doap.rdf</doapFile>
<asfExtOptions>
<included>false</included>
</asfExtOptions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-changelog-plugin</artifactId>
<version>${maven-changelog-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>${maven-jxr-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven-plugin-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven-project-info-reports-plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>cim</report>
<report>distribution-management</report>
<report>index</report>
<report>issue-tracking</report>
<report>license</report>
<report>mailing-list</report>
<report>project-team</report>
<report>scm</report>
<report>summary</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-report-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>${javancss-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
<version>${jdepend-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<version>${taglist-maven-plugin.version}</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.2</version>
</dependency>
</dependencies>
</project>

View File

@ -25,8 +25,12 @@ import hudson.model.BuildListener;
import hudson.model.AbstractBuild;
import hudson.tasks.Builder;
import hudson.tasks.BuildStepDescriptor;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.DataBoundConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.management.Descriptor;
@ -44,10 +48,13 @@ import net.sf.json.JSONObject;
*/
public class GearmanPlugin extends Builder {
private static final Logger logger = LoggerFactory
.getLogger(GearmanPlugin.class);
private final String name;
@DataBoundConstructor
public GearmanPlugin(String name) {
logger.info("--- GearmanPlugin Constructor ---" + name);
this.name = name;
}
@ -68,10 +75,29 @@ public class GearmanPlugin extends Builder {
}
@Extension
public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
public static final class DescriptorImpl extends
BuildStepDescriptor<Builder> {
private static final Logger logger = LoggerFactory
.getLogger(DescriptorImpl.class);
private boolean launchWorker; // launchWorker state (from UI checkbox)
private String host; // gearman server host
private int port; // gearman server port
public DescriptorImpl() {
logger.info("--- DescriptorImpl Constructor ---");
logger.info("--- DescriptorImpl Constructor ---" + host);
logger.info("--- DescriptorImpl Constructor ---" + port);
load();
/*
* Not sure when to register gearman functions yet so for now always
* initialize the launch worker flag to disabled state at jenkins
* startup so we are always at a known state
*/
this.launchWorker = false;
save();
}
@Override
@ -85,11 +111,65 @@ public class GearmanPlugin extends Builder {
}
@Override
public boolean configure(StaplerRequest staplerRequest, JSONObject json) throws FormException {
public boolean configure(StaplerRequest staplerRequest, JSONObject json)
throws FormException {
launchWorker = json.getBoolean("launchWorker");
logger.info("--- DescriptorImpl Configure function ---"
+ this.launchWorker());
// set the gearman server host from value in jenkins config page
try {
host = json.getString("host");
} catch (Exception e) {
throw new RuntimeException(
"Error getting the gearman host name");
}
// user input vaerification
if (StringUtils.isEmpty(host) || StringUtils.isBlank(host))
throw new RuntimeException("Invalid gearman host name");
// set the gearman server port from value in jenkins config page
try {
port = Integer.parseInt(json.getString("port"));
} catch (Exception e) {
throw new RuntimeException("Invalid gearman port value");
}
// i believe gearman already checks for port range, just want to do
// basic verification here
if (port <= 0)
throw new RuntimeException("Invalid gearman port value");
logger.info("--- DescriptorImpl Configure function ---"
+ this.getHost());
logger.info("--- DescriptorImpl Configure function ---"
+ this.getPort());
save();
return true;
}
/**
* This method returns true if the global configuration says we should
* launch worker.
*/
public boolean launchWorker() {
return launchWorker;
}
/**
* This method returns the value from the server host text box
*/
public String getHost() {
return host;
}
/**
* This method returns the value from the server port text box
*/
public int getPort() {
return port;
}
}
}

View File

@ -1,4 +1,21 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:section title="Gearman Plugin Builder">
<f:section title="Gearman Plugin">
<f:entry title="Gearman Server Host" field="host"
description="Set the Gearman Server Host Name"
help="${rootURL}/plugin/gearman/help-serverHost.html">
<f:textbox name="gearman.host" value="${descriptor.host()}" />
</f:entry>
<f:entry title="Gearman Server Port" field="port"
description="Set the Gearman Server Port"
help="${rootURL}/plugin/gearman/help-serverPort.html">
<f:textbox name="gearman.port" value="${descriptor.port()}" />
</f:entry>
<f:entry title="Launch Worker"
description="Check to launch the Gearman worker(s)"
help="${rootURL}/plugin/gearman/help-globalConfig.html">
<f:checkbox name="gearman.launchWorker" checked="${descriptor.launchWorker()}" />
</f:entry>
</f:section>
</j:jelly>

View File

@ -0,0 +1,5 @@
<div>
<p>
Select then press save to start the Gearman workers.
</p>
</div>

View File

@ -0,0 +1,5 @@
<div>
<p>
Set the Gearman Server's host name, something like 'localhost', '127.0.0.1' or 'server.domain.com'
</p>
</div>

View File

@ -0,0 +1,5 @@
<div>
<p>
Set the Gearman server port. The Gearman server's port is typically set to 4730 by default.
</p>
</div>