summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2014-05-10 19:42:52 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2014-05-10 19:42:52 +0200
commit5384f28dfd66bdb1839935802aa6769ee55849d2 (patch)
treece0473da6c9f3460e8e12f7bf9587a9e9cfaf2ca
parent7cf971cfe478fc4a170ea17274f44b24eae97e2b (diff)
downloadactivemq-plugin-5384f28dfd66bdb1839935802aa6769ee55849d2.tar.gz
activemq-plugin-5384f28dfd66bdb1839935802aa6769ee55849d2.tar.bz2
activemq-plugin-5384f28dfd66bdb1839935802aa6769ee55849d2.tar.xz
activemq-plugin-5384f28dfd66bdb1839935802aa6769ee55849d2.zip
o Making sure that the MVEL expression is configured when starting.
-rw-r--r--src/main/java/org/jenkinsci/plugins/activemq/ActiveMqBuildTrigger.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqBuildTrigger.java b/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqBuildTrigger.java
index f3a2a79..9f9c6a6 100644
--- a/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqBuildTrigger.java
+++ b/src/main/java/org/jenkinsci/plugins/activemq/ActiveMqBuildTrigger.java
@@ -1,13 +1,12 @@
package org.jenkinsci.plugins.activemq;
import hudson.Extension;
+import hudson.model.AbstractProject;
import hudson.model.BuildableItem;
import hudson.model.Item;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;
-import hudson.util.FormValidation;
import org.kohsuke.stapler.DataBoundConstructor;
-import org.kohsuke.stapler.QueryParameter;
import org.mvel2.MVEL;
import org.slf4j.Logger;
@@ -20,7 +19,7 @@ import static org.jenkinsci.plugins.activemq.ActiveMqClient.BuildRequest;
import static org.mvel2.MVEL.compileExpression;
import static org.slf4j.LoggerFactory.getLogger;
-public class ActiveMqBuildTrigger extends Trigger<BuildableItem> {
+public class ActiveMqBuildTrigger extends Trigger<AbstractProject> {
private static final Logger log = getLogger(ActiveMqBuildTrigger.class);
@@ -28,10 +27,15 @@ public class ActiveMqBuildTrigger extends Trigger<BuildableItem> {
private transient Serializable compiledMvel;
- // parameters['jobName'] == 'fast-build'
@DataBoundConstructor
public ActiveMqBuildTrigger(String mvel) {
log.info("ActiveMqBuildTrigger.ActiveMqBuildTrigger");
+ }
+
+ @Override
+ public void start(AbstractProject project, boolean newInstance) {
+ super.start(project, newInstance);
+ log.info("ActiveMqBuildTrigger.start");
setMvel_(mvel);
}
@@ -43,6 +47,7 @@ public class ActiveMqBuildTrigger extends Trigger<BuildableItem> {
private void setMvel_(String mvel) {
mvel = trimToNull(mvel);
if (mvel == null) {
+ log.info("ActiveMqBuildTrigger.setMvel_: mvel is null");
this.mvel = null;
this.compiledMvel = null;
return;
@@ -51,6 +56,7 @@ public class ActiveMqBuildTrigger extends Trigger<BuildableItem> {
try {
compiledMvel = compileExpression(mvel);
this.mvel = mvel;
+ log.info("ActiveMqBuildTrigger.setMvel_: mvel={}", mvel);
} catch (Exception e) {
log.warn("Unable to compile MVEL", e);
}