From 03e1df8f98f50d19195e0c75c036ed94892c9112 Mon Sep 17 00:00:00 2001 From: Khai Do Date: Fri, 11 Jan 2013 11:52:45 -0800 Subject: [PATCH] setup skeleton GearmanPlugin. Change-Id: I9a69f8c4d396f5b0fdab192ec7c8d1d140950060 --- README.txt | 3 + install-fast | 1 + run-fast | 2 + .../hudson/plugins/gearman/GearmanPlugin.java | 73 ++++++++++++++++++- .../gearman/GearmanPlugin/config.jelly | 2 + .../gearman/GearmanPlugin/global.jelly | 4 + src/main/resources/index.jelly | 3 + src/main/webapp/help-globalConfig.html | 5 ++ 8 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 README.txt create mode 100755 install-fast create mode 100755 run-fast create mode 100644 src/main/resources/hudson/plugins/gearman/GearmanPlugin/config.jelly create mode 100644 src/main/resources/hudson/plugins/gearman/GearmanPlugin/global.jelly create mode 100644 src/main/resources/index.jelly create mode 100644 src/main/webapp/help-globalConfig.html diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8bfdb28 --- /dev/null +++ b/README.txt @@ -0,0 +1,3 @@ +This plugin attempts to integrate Gearman with Jenkins. + +http://wiki.jenkins-ci.org/display/JENKINS/Gearman+Plugin diff --git a/install-fast b/install-fast new file mode 100755 index 0000000..dd50baa --- /dev/null +++ b/install-fast @@ -0,0 +1 @@ +mvn -Dmaven.test.skip=true -DskipTests=true clean install diff --git a/run-fast b/run-fast new file mode 100755 index 0000000..4a22fcb --- /dev/null +++ b/run-fast @@ -0,0 +1,2 @@ +rm -rf work/plugins +mvn -Dmaven.test.skip=true -DskipTests=true clean hpi:run diff --git a/src/main/java/hudson/plugins/gearman/GearmanPlugin.java b/src/main/java/hudson/plugins/gearman/GearmanPlugin.java index 543f874..db21cbc 100644 --- a/src/main/java/hudson/plugins/gearman/GearmanPlugin.java +++ b/src/main/java/hudson/plugins/gearman/GearmanPlugin.java @@ -18,7 +18,78 @@ package hudson.plugins.gearman; +import hudson.Launcher; +import hudson.Extension; +import hudson.model.Build; +import hudson.model.BuildListener; +import hudson.model.AbstractBuild; +import hudson.tasks.Builder; +import hudson.tasks.BuildStepDescriptor; +import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.DataBoundConstructor; -public class GearmanPlugin { +import javax.management.Descriptor; +import net.sf.json.JSONObject; + +/** + * GearmanPlugin {@link Builder}. + * + *

+ * This sets up the gearman plugin as another plugin in Jenkins + * It will allow us to start and stop the gearman workers. + *

+ * + * @author Khai Do + */ +public class GearmanPlugin extends Builder { + + private final String name; + + @DataBoundConstructor + public GearmanPlugin(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) { + + return true; + } + + @Override + public DescriptorImpl getDescriptor() { + + return (DescriptorImpl)super.getDescriptor(); + } + + @Extension + public static final class DescriptorImpl extends BuildStepDescriptor { + + public DescriptorImpl() { + load(); + } + + @Override + public String getDisplayName() { + return "GearmanPlugin"; + } + + @Override + public boolean isApplicable(Class type) { + return true; + } + + @Override + public boolean configure(StaplerRequest staplerRequest, JSONObject json) throws FormException { + + save(); + return true; + } + + } } diff --git a/src/main/resources/hudson/plugins/gearman/GearmanPlugin/config.jelly b/src/main/resources/hudson/plugins/gearman/GearmanPlugin/config.jelly new file mode 100644 index 0000000..f984738 --- /dev/null +++ b/src/main/resources/hudson/plugins/gearman/GearmanPlugin/config.jelly @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/main/resources/hudson/plugins/gearman/GearmanPlugin/global.jelly b/src/main/resources/hudson/plugins/gearman/GearmanPlugin/global.jelly new file mode 100644 index 0000000..44ee3f3 --- /dev/null +++ b/src/main/resources/hudson/plugins/gearman/GearmanPlugin/global.jelly @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly new file mode 100644 index 0000000..1dbdb38 --- /dev/null +++ b/src/main/resources/index.jelly @@ -0,0 +1,3 @@ +

+ This plugin integrates Gearman with Jenkins. +
\ No newline at end of file diff --git a/src/main/webapp/help-globalConfig.html b/src/main/webapp/help-globalConfig.html new file mode 100644 index 0000000..2e4f376 --- /dev/null +++ b/src/main/webapp/help-globalConfig.html @@ -0,0 +1,5 @@ +
+

+ This plugin integrates Gearman with Jenkins. +

+
\ No newline at end of file