{
+
+ /**
+ * This human readable name is used in the configuration screen.
+ */
+ @Override
+ public String getDisplayName() {
+ return "Check Disk Space";
+ }
+
+ public DescriptorImpl() {
load();
}
-
- }
-
-
- class NoopEnv extends Environment {
- }
+ }
+
+ class NoopEnv extends Environment {
+ }
}
diff --git a/src/main/java/org/jenkinsci/plugin/PluginImpl.java b/src/main/java/org/jenkinsci/plugin/PluginImpl.java
index f8c44cd..51fb6dc 100755
--- a/src/main/java/org/jenkinsci/plugin/PluginImpl.java
+++ b/src/main/java/org/jenkinsci/plugin/PluginImpl.java
@@ -1,75 +1,86 @@
package org.jenkinsci.plugin;
+import hudson.AbortException;
import hudson.Plugin;
-import hudson.model.*;
-import hudson.model.AbstractBuild;
-import hudson.model.AbstractProject;
import hudson.model.Descriptor.FormException;
-import hudson.model.Hudson;
import java.io.IOException;
import javax.servlet.ServletException;
+import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
-//import com.innorium.crystalline.plugins.model.ScannerJobProperty;
+public class PluginImpl extends Plugin {
-public class PluginImpl extends Plugin{
- private boolean diskrecyclerenabled;
- private int spacecheck;
-
- /**
+ private boolean diskrecyclerenabled;
+ private int spacecheck;
+ private int clearuntil;
+
+ /**
* Returns the singleton instance.
*
* @return the one.
+ * @throws hudson.AbortException
+ * If Jenkins instance is not ready
*/
- public static PluginImpl getInstance() {
- return Hudson.getInstance().getPlugin(PluginImpl.class);
+ public static PluginImpl getInstance() throws AbortException {
+ // To remove warning. I don't think this would ever be null in our case.
+ Jenkins instance = Jenkins.getInstance();
+ if (instance == null) {
+ throw new AbortException(
+ "Can't access Jenkins instance, it may not be ready.");
+ }
+ return instance.getPlugin(PluginImpl.class);
}
-
- @Override
- public void start() throws Exception {
- super.start();
- load();
- }
-
- @Override
- public void stop() throws Exception {
- super.stop();
- }
-
- @Override
- public void configure(StaplerRequest req, JSONObject formData)
- throws IOException, ServletException, FormException {
- formData=formData.getJSONObject("disk-check");
- spacecheck=formData.getInt("spacecheck");
- diskrecyclerenabled=formData.getBoolean("diskrecyclerenabled");
-
- save();
- super.configure(req, formData);
-
- }
-
-
-
- public void setDiskrecyclerenabled(boolean diskrecyclerenabled) {
- this.diskrecyclerenabled = diskrecyclerenabled;
-}
-
- public int getSpacecheck()
- {
- return spacecheck;
- }
-
- public void setSpacecheck(int spaceheck)
- {
- this.spacecheck = spacecheck;
-}
- public boolean isDiskrecyclerenabled() {
- return diskrecyclerenabled;
- }
-}
\ No newline at end of file
+ @Override
+ public void start() throws Exception {
+ super.start();
+ load();
+ }
+
+ @Override
+ public void stop() throws Exception {
+ super.stop();
+ }
+
+ @Override
+ public void configure(StaplerRequest req, JSONObject formData)
+ throws IOException, ServletException, FormException {
+ formData = formData.getJSONObject("disk-check");
+ spacecheck = formData.getInt("spacecheck");
+ clearuntil = formData.getInt("clearuntil");
+ diskrecyclerenabled = formData.getBoolean("diskrecyclerenabled");
+
+ save();
+ super.configure(req, formData);
+
+ }
+
+ public void setDiskrecyclerenabled(boolean diskrecyclerenabled) {
+ this.diskrecyclerenabled = diskrecyclerenabled;
+ }
+
+ public int getSpacecheck() {
+ return spacecheck;
+ }
+
+ public void setSpacecheck(int spaceCheck) {
+ this.spacecheck = spaceCheck;
+ }
+
+ public int getClearuntil() {
+ return clearuntil;
+ }
+
+ public void setClearuntil(int clearUntil) {
+ this.clearuntil = clearUntil;
+ }
+
+ public boolean isDiskrecyclerenabled() {
+ return diskrecyclerenabled;
+ }
+}
diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly
index b620b55..ddee10b 100755
--- a/src/main/resources/index.jelly
+++ b/src/main/resources/index.jelly
@@ -1,6 +1,7 @@
+
This plugin is to check the disk usage of your node
diff --git a/src/main/resources/org/jenkinsci/plugin/PluginImpl/config.jelly b/src/main/resources/org/jenkinsci/plugin/PluginImpl/config.jelly
index 50391e0..2b70d78 100755
--- a/src/main/resources/org/jenkinsci/plugin/PluginImpl/config.jelly
+++ b/src/main/resources/org/jenkinsci/plugin/PluginImpl/config.jelly
@@ -1,3 +1,4 @@
+