jenkinsci/jenkins.rb — pull request #75 by drnic (2013-04-19 05:25:15+00:00)
Title: Added Trigger class

WIP - @cowboyd thoughts on what this error means? It occurs when I visit the configuration page of a job/project.

```
javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/Users/drnic/Projects/ruby_jpi_plugins/build-change-trigger-plugin/work/war/WEB-INF/lib/jenkins-core-1.502.jar!/lib/hudson/project/config-trigger.jelly:31:84: method for_ threw exception: org.jruby.proxy.hudson.model.Descriptor$Proxy1 cannot be cast to hudson.triggers.TriggerDescriptor
at org.kohsuke.stapler.jelly.JellyFacet$1.dispatch(JellyFacet.java:103)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:573)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:658)
```

I have a subclass like this:

``` ruby
java_import Java.java.util.logging.Logger

class JobUpdatedTrigger < Jenkins::Triggers::Trigger

display_name "Job updated trigger"

attr_accessor :watching_job_name

def logger
@logger ||= Logger.getLogger(self.class.name)
end

# Invoked with the form parameters when this extension point
# is created from a configuration screen.
def initialize(attrs = {})
@watching_job_name = attrs['watching_job_name']
end

def run
logger.info "JobUpdatedTrigger#run"
end

def stop
logger.info "JobUpdatedTrigger#stop"
end
end
```

And a descriptor config.erb like this:

``` ruby
<%
f = taglib("/lib/form")
f.entry(:title => 'Job name to watch', :field => 'watching_job_name', :description => "Triggers based on any updates to job configuration") do
f.textbox
end
%>
```