ruby
Class RubyPlugin

java.lang.Object
  extended by hudson.Plugin
      extended by ruby.PluginImpl
          extended by ruby.RubyPlugin
All Implemented Interfaces:
hudson.model.Saveable

public class RubyPlugin
extends PluginImpl

The primary Java interface to a plugin which is implemented in Ruby. One instance is created per each Ruby plugin.

When this plugin initializes, it will instantiate a Jenkins::Plugin object which acts as the gateway for Ruby to interact with the java side.

When the RubyPlugin is loaded, it will discover, load and provide a mechanism for extensions written in Ruby that it contains to register themselves.

These Extensions are presented to Jenkins via the RubyExtensionFinder

Each plugin has its own JRuby environment


Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.Plugin
hudson.Plugin.DummyImpl
 
Field Summary
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
RubyPlugin()
           
 
Method Summary
 void addExtension(java.lang.Object extension)
          Registers an extension with this Ruby plugin so that it will be found later on

This method is generally called from inside Ruby, as objects that implement extension points register themselves.

 java.lang.Object callMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object... args)
          invokes a Ruby method on the specified object in the context of this plugin's ScriptingContainer
static RubyPlugin from(org.jruby.Ruby r)
          Gets the plugin that owns the container.
 java.util.Collection<hudson.ExtensionComponent> getExtensions()
           
 java.io.File getLibPath()
           
 java.io.File getModelsPath()
           
 java.lang.Object getNativeRubyPlugin()
           
 java.lang.String getResourceURI(java.lang.String relativePathFormat, java.lang.Object... args)
           
 java.io.File getScriptDir()
          Returns a directory that stores all the Ruby scripts.
 org.jruby.embed.ScriptingContainer getScriptingContainer()
           
 java.lang.String loadBootScript()
          Loads the models.rb
 void start()
          Jenkins will call this method whenever the plugin is initialized The plugin will in turn delegate to its instance of Jenkins::Plugin which can take action on the Ruby side.
 void stop()
          Jenkins will call this method whenever the plugin is shut down The plugin will in turn delegate to its instance of Jenkins::Plugin which can take action on the Ruby side
 
Methods inherited from class hudson.Plugin
configure, configure, doDynamic, getConfigXml, getWrapper, load, postInitialize, save, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RubyPlugin

public RubyPlugin()
Method Detail

callMethod

public java.lang.Object callMethod(java.lang.Object object,
                                   java.lang.String methodName,
                                   java.lang.Object... args)
invokes a Ruby method on the specified object in the context of this plugin's ScriptingContainer

Parameters:
object - JRuby object to use as invocant
methodName - the method to end
args - arguments to the method
Returns:
the return value of the method call.

addExtension

public void addExtension(java.lang.Object extension)
Registers an extension with this Ruby plugin so that it will be found later on

This method is generally called from inside Ruby, as objects that implement extension points register themselves.

Parameters:
extension -

getExtensions

public java.util.Collection<hudson.ExtensionComponent> getExtensions()
Returns:
the list of extensions registered with this Plugin. this is used by the RubyExtensionFinder to present extension points to Jenkins

loadBootScript

public java.lang.String loadBootScript()
                                throws java.io.IOException
Loads the models.rb

Throws:
java.io.IOException

start

public void start()
           throws java.lang.Exception
Jenkins will call this method whenever the plugin is initialized The plugin will in turn delegate to its instance of Jenkins::Plugin which can take action on the Ruby side.

Overrides:
start in class hudson.Plugin
Throws:
java.lang.Exception

from

public static RubyPlugin from(org.jruby.Ruby r)
Gets the plugin that owns the container.


stop

public void stop()
          throws java.lang.Exception
Jenkins will call this method whenever the plugin is shut down The plugin will in turn delegate to its instance of Jenkins::Plugin which can take action on the Ruby side

Overrides:
stop in class hudson.Plugin
Throws:
java.lang.Exception

getResourceURI

public java.lang.String getResourceURI(java.lang.String relativePathFormat,
                                       java.lang.Object... args)

getScriptDir

public java.io.File getScriptDir()
Returns a directory that stores all the Ruby scripts.


getLibPath

public java.io.File getLibPath()

getModelsPath

public java.io.File getModelsPath()

getScriptingContainer

public org.jruby.embed.ScriptingContainer getScriptingContainer()

getNativeRubyPlugin

public java.lang.Object getNativeRubyPlugin()


Copyright © 2004-2011. All Rights Reserved.