Skip to content
Permalink
Browse files

Fix JENKINS-18667

  • Loading branch information...
gboissinot committed Aug 1, 2013
1 parent 44ddb72 commit 86b61ffef908cb43dadd8f6d58e213a8e1bc4fcb

This file was deleted.

@@ -3,14 +3,18 @@
import antlr.ANTLRException;
import hudson.Extension;
import hudson.Util;
import hudson.console.AnnotatedLargeText;
import hudson.model.*;
import org.apache.commons.jelly.XMLOutput;
import org.jenkinsci.lib.envinject.EnvInjectException;
import org.jenkinsci.lib.envinject.service.EnvVarsResolver;
import org.jenkinsci.lib.xtrigger.XTriggerDescriptor;
import org.jenkinsci.lib.xtrigger.XTriggerLog;
import org.kohsuke.stapler.DataBoundConstructor;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
@@ -26,7 +30,6 @@

private String exitCode;


@DataBoundConstructor
public ScriptTrigger(String cronTabSpec, LabelRestrictionClass labelRestriction, boolean enableConcurrentBuild, String script, String scriptFilePath, String exitCode) throws ANTLRException {
super(cronTabSpec, (labelRestriction == null) ? false : true, (labelRestriction == null) ? null : labelRestriction.getTriggerLabel(), enableConcurrentBuild);
@@ -52,10 +55,54 @@ public String getExitCode() {

@Override
public Collection<? extends Action> getProjectActions() {
ScriptTriggerAction action = new ScriptTriggerAction((AbstractProject) job, getLogFile(), getDescriptor().getDisplayName());
ScriptTriggerAction action = new InternalScriptTriggerAction(getDescriptor().getDisplayName());
return Collections.singleton(action);
}

public final class InternalScriptTriggerAction extends ScriptTriggerAction {

private transient String actionTitle;

public InternalScriptTriggerAction(String actionTitle) {
this.actionTitle = actionTitle;
}

@SuppressWarnings("unused")
public AbstractProject<?, ?> getOwner() {
return (AbstractProject) job;
}

@Override
public String getDisplayName() {
return "ScriptTrigger Log";
}

@Override
public String getUrlName() {
return "scripttriggerPollLog";
}

@Override
public String getIconFileName() {
return "clipboard.gif";
}

@SuppressWarnings("unused")
public String getLabel() {
return actionTitle;
}

@SuppressWarnings("unused")
public String getLog() throws IOException {
return Util.loadFile(getLogFile());
}

@SuppressWarnings("unused")
public void writeLogTo(XMLOutput out) throws IOException {
new AnnotatedLargeText<InternalScriptTriggerAction>(getLogFile(), Charset.defaultCharset(), true, this).writeHtmlTo(0, out.asWriter());
}
}

@Override
public ScriptTrigger.ScriptTriggerDescriptor getDescriptor() {
return (ScriptTrigger.ScriptTriggerDescriptor) Hudson.getInstance().getDescriptorOrDie(getClass());
@@ -1,30 +1,11 @@
package org.jenkinsci.plugins.scripttrigger;

import hudson.model.AbstractProject;

import java.io.File;
import hudson.model.Action;

/**
* Marked Action class
*
* @author Gregory Boissinot
*/
public class ScriptTriggerAction extends AbstractTriggerAction {

public ScriptTriggerAction(AbstractProject<?, ?> job, File logFile, String label) {
super(job, logFile, label);
}

@SuppressWarnings("unused")
public String getIconFileName() {
return "clipboard.gif";
}

public String getDisplayName() {
return "ScriptTrigger Log";
}

@SuppressWarnings("unused")
public String getUrlName() {
return "scripttriggerPollLog";
}

public abstract class ScriptTriggerAction implements Action {
}
@@ -4,11 +4,13 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
import hudson.console.AnnotatedLargeText;
import hudson.model.*;
import hudson.remoting.VirtualChannel;
import hudson.security.ACL;
import org.acegisecurity.Authentication;
import org.acegisecurity.context.SecurityContextHolder;
import org.apache.commons.jelly.XMLOutput;
import org.jenkinsci.lib.envinject.EnvInjectException;
import org.jenkinsci.lib.envinject.service.EnvVarsResolver;
import org.jenkinsci.lib.xtrigger.XTriggerDescriptor;
@@ -21,6 +23,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.*;


@@ -68,10 +71,55 @@ public boolean isGroovySystemScript() {

@Override
public Collection<? extends Action> getProjectActions() {
GroovyScriptTriggerAction action = new GroovyScriptTriggerAction((AbstractProject) job, getLogFile(), getDescriptor().getDisplayName());
GroovyScriptTriggerAction action = new InternalGroovyScriptTriggerAction(getDescriptor().getDisplayName());
return Collections.singleton(action);
}

public final class InternalGroovyScriptTriggerAction extends GroovyScriptTriggerAction {

private transient String actionTitle;

public InternalGroovyScriptTriggerAction(String actionTitle) {
this.actionTitle = actionTitle;
}

@SuppressWarnings("unused")
public AbstractProject<?, ?> getOwner() {
return (AbstractProject) job;
}

@Override
public String getDisplayName() {
return "GroovyScriptTrigger Log";
}

@Override
public String getUrlName() {
return "groovyScripttriggerPollLog";
}

@Override
public String getIconFileName() {
return "clipboard.gif";
}

@SuppressWarnings("unused")
public String getLabel() {
return actionTitle;
}

@SuppressWarnings("unused")
public String getLog() throws IOException {
return Util.loadFile(getLogFile());
}

@SuppressWarnings("unused")
public void writeLogTo(XMLOutput out) throws IOException {
new AnnotatedLargeText<InternalGroovyScriptTriggerAction>(getLogFile(), Charset.defaultCharset(), true, this).writeHtmlTo(0, out.asWriter());
}
}


@Override
protected File getLogFile() {
return new File(job.getRootDir(), "groovyScriptTrigger-polling.log");
@@ -1,31 +1,10 @@
package org.jenkinsci.plugins.scripttrigger.groovy;

import hudson.model.AbstractProject;
import org.jenkinsci.plugins.scripttrigger.AbstractTriggerAction;

import java.io.File;
import hudson.model.Action;

/**
* @author Gregory Boissinot
*/
public class GroovyScriptTriggerAction extends AbstractTriggerAction {

public GroovyScriptTriggerAction(AbstractProject<?, ?> job, File logFile, String label) {
super(job, logFile, label);
}

@SuppressWarnings("unused")
public String getIconFileName() {
return "clipboard.gif";
}

public String getDisplayName() {
return "GroovyScriptTrigger Log";
}

@SuppressWarnings("unused")
public String getUrlName() {
return "groovyScripttriggerPollLog";
}
public abstract class GroovyScriptTriggerAction implements Action {

}
@@ -1,3 +1,3 @@
<div>
This plugin makes it possible to poll changes of an environment with a script.
This plugin makes it possible to poll changes of an environment with a script.
</div>
@@ -22,23 +22,24 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<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">
<l:layout>
<st:include it="${it.owner}" page="sidepanel.jelly" />
<l:main-panel>
<h1>${it.label}</h1>
<j:set var="log" value="${it.log}" />
<j:choose>
<j:when test="${empty(log)}">
${%Polling has not run yet.}
</j:when>
<j:otherwise>
<pre>
<st:getOutput var="output" />
<j:whitespace>${it.writeLogTo(output)}</j:whitespace>
</pre>
</j:otherwise>
</j:choose>
</l:main-panel>
</l:layout>
<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">
<l:layout>
<st:include it="${it.owner}" page="sidepanel.jelly"/>
<l:main-panel>
<h1>${it.label}</h1>
<j:set var="log" value="${it.log}"/>
<j:choose>
<j:when test="${empty(log)}">
${%Polling has not run yet.}
</j:when>
<j:otherwise>
<pre>
<st:getOutput var="output"/>
<j:whitespace>${it.writeLogTo(output)}</j:whitespace>
</pre>
</j:otherwise>
</j:choose>
</l:main-panel>
</l:layout>
</j:jelly>
@@ -22,23 +22,24 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<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">
<l:layout>
<st:include it="${it.owner}" page="sidepanel.jelly" />
<l:main-panel>
<h1>${it.label}</h1>
<j:set var="log" value="${it.log}" />
<j:choose>
<j:when test="${empty(log)}">
${%Polling has not run yet.}
</j:when>
<j:otherwise>
<pre>
<st:getOutput var="output" />
<j:whitespace>${it.writeLogTo(output)}</j:whitespace>
</pre>
</j:otherwise>
</j:choose>
</l:main-panel>
</l:layout>
<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">
<l:layout>
<st:include it="${it.owner}" page="sidepanel.jelly"/>
<l:main-panel>
<h1>${it.label}</h1>
<j:set var="log" value="${it.log}"/>
<j:choose>
<j:when test="${empty(log)}">
${%Polling has not run yet.}
</j:when>
<j:otherwise>
<pre>
<st:getOutput var="output"/>
<j:whitespace>${it.writeLogTo(output)}</j:whitespace>
</pre>
</j:otherwise>
</j:choose>
</l:main-panel>
</l:layout>
</j:jelly>

0 comments on commit 86b61ff

Please sign in to comment.
You can’t perform that action at this time.