{
+
+ public ZapRunnerDescriptor() {
+ load();
+ }
+
+ /**
+ * Performs on-the-fly validation of the form field 'host'.
+ *
+ * @param value This parameter receives the value that the user has typed.
+ * @return Indicates the outcome of the validation. This is sent to the browser.
+ *
+ * Note that returning {@link FormValidation#error(String)} does not
+ * prevent the form from being saved. It just means that a message
+ * will be displayed to the user.
+ */
+ public FormValidation doCheckHost(@QueryParameter("host") String value)
+ throws IOException, ServletException {
+ if (value.length() == 0)
+ return FormValidation.error("Please set a name such as localhost or localhost:8090");
+ if (value.split(":").length > 2)
+ return FormValidation.error("Acceptable format include localhost or localhost:8090");
+ return FormValidation.ok();
+ }
+
+ public boolean isApplicable(Class extends AbstractProject> aClass) {
+ return true;
+ }
+
+ /**
+ * This human readable name is used in the configuration screen.
+ */
+ public String getDisplayName() {
+ return "Run OWASP ZAP";
+ }
+
+ @Override
+ public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
+ save();
+ return super.configure(req, formData);
+ }
+
+
+ public String getDefaultHost() {
+ return "localhost:8090";
+ }
+
+ public String getDefaultRepository() {
+ return "http://zaproxy.googlecode.com/svn/trunk/";
+ }
+
+ public String getDefaultPath() {
+ return System.getProperty("user.dir");
+ }
+
+ }
+}
+
+class SVNEventHandler extends SVNAdminEventAdapter {
+ private final PrintStream logger;
+
+ public SVNEventHandler(PrintStream logger) {
+ this.logger = logger;
+ }
+
+ @Override
+ public void handleAdminEvent(SVNAdminEvent event, double progress) throws SVNException {
+ super.handleAdminEvent(event, progress);
+ logger.println(event.toString());
+ }
+
+ @Override
+ public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ super.handleEvent(event, progress);
+ logger.println(event.toString());
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/config.jelly b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/config.jelly
new file mode 100755
index 0000000..782ce12
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/config.jelly
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/global.jelly b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/global.jelly
new file mode 100755
index 0000000..a7e9295
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/global.jelly
@@ -0,0 +1,2 @@
+
+
diff --git a/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-host.html b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-host.html
new file mode 100755
index 0000000..90ac447
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-host.html
@@ -0,0 +1,6 @@
+
+ The hostname:port configuration. Please specify a hostname (or IP address) and an
+ optional port from which to run ZAP. For example, a value of localhost will launch ZAP on this server
+ with the default port of 8090. Specify myhost:9876 or 10.7.7.7:9876 to bind ZAP to
+ the port 9876 on the host with the hostname myhost or with the IP address of 10.7.7.7.
+
diff --git a/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-path.html b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-path.html
new file mode 100755
index 0000000..3628304
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-path.html
@@ -0,0 +1,4 @@
+
+ Specify the filesystem path where you have installed ZAP, and Zapper will use your existing installation.
+ This should be the path to the directory where the zap.sh and zap.bat script is installed.
+
diff --git a/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-repositoryurl.html b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-repositoryurl.html
new file mode 100755
index 0000000..9096c26
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help-repositoryurl.html
@@ -0,0 +1,6 @@
+
+ Specify the SVN repository to retrieve OWASP ZAP from, and Zapper will automatically download (check out) the
+ repository, build it, and run it for you. Zapper will track the SVN HEAD. This means that Zapper
+ will automatically check for the latest and greatest version of ZAP and build it whenever new ZAP code is developed
+ and added to the repository.
+
diff --git a/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help.jelly b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help.jelly
new file mode 100755
index 0000000..9a6d4b0
--- /dev/null
+++ b/src/main/resources/org/jenkinsci/plugins/zapper/ZapRunner/help.jelly
@@ -0,0 +1,5 @@
+
+ The Zapper plugin helps to run OWASP ZAP as part of your automated security assessment regime in the Jenkins continuous
+ integration system. The plugin can use a pre-installed version of ZAP when given the path to the ZAP installation.
+ Alternatively, it can automatically download and build a version of ZAP to be used by your security tests.
+