org.codehaus.plexus.component.jruby
Interface JRubyInvoker

All Known Implementing Classes:
JRubyRuntimeInvoker

public interface JRubyInvoker

Configures and invokes the JRuby runtime. The "invoke" method executes a given script (set as a Reader) and returns the results as an IRuby object.

Author:
eredmond

Method Summary
 java.lang.Object invoke()
          Invokes the script after all other values are set.
 java.lang.Object invoke(java.io.OutputStream stdout, java.io.OutputStream stderr)
          Invokes the script after all other values are set.
 void putGlobal(java.lang.String key, java.lang.Object value)
          Appends an input value with the given key to the Ruby script bas a global...
 void setAssumeLoop(boolean assumeLoop)
          As per the Ruby command line arg -n.
 void setAssumePrintLoop(boolean assumePrintLoop)
          As per the Ruby command line arg -p.
 void setAutoSplit(boolean autoSplit)
          As per the Ruby command line arg -a.
 void setCurrentDirectory(java.lang.String currentDirectory)
          Sets the current working directory for the JRuby interpreter.
 void setDebug(boolean debug)
          As per the Ruby command line arg -d.
 void setLibraryPaths(java.lang.String[] libPaths)
          Adds a library as per the Ruby command line arg -I.
 void setProcessLineEnds(boolean processLineEnds)
          As per the Ruby command line arg -l.
 void setReader(java.io.Reader reader)
          The sole way of sending a script to this invoker object.
 void setRequires(java.lang.String[] reqLibs)
          Adds a 'require' file as per the Ruby command line arg -r.
 void setRuntime(org.jruby.Ruby runtime)
          Not required, however if set, the invoker will tear down the runtime before exiting Invoke.
 void setWarning(int warning)
          As per the Ruby command line arg -W#.
 

Method Detail

setReader

void setReader(java.io.Reader reader)
The sole way of sending a script to this invoker object. If not set, invoker will extract reader from the componentDescriptor.

Parameters:
reader -

setRuntime

void setRuntime(org.jruby.Ruby runtime)
Not required, however if set, the invoker will tear down the runtime before exiting Invoke. If you plan on changing the state of inkove-returned IRubyObjects, you should set this externally via Ruby.getDefaultInstance(), and tear it down when done via tearDown() method.

Parameters:
runtime -

setAssumeLoop

void setAssumeLoop(boolean assumeLoop)
As per the Ruby command line arg -n.

Parameters:
assumeLoop -

setAssumePrintLoop

void setAssumePrintLoop(boolean assumePrintLoop)
As per the Ruby command line arg -p.

Parameters:
assumePrintLoop -

setAutoSplit

void setAutoSplit(boolean autoSplit)
As per the Ruby command line arg -a.

Parameters:
autoSplit -

setWarning

void setWarning(int warning)
As per the Ruby command line arg -W#.

Parameters:
warning -

setDebug

void setDebug(boolean debug)
As per the Ruby command line arg -d. (sets $DEBUG to true)

Parameters:
debug -

setProcessLineEnds

void setProcessLineEnds(boolean processLineEnds)
As per the Ruby command line arg -l.

Parameters:
processLineEnds -

setLibraryPaths

void setLibraryPaths(java.lang.String[] libPaths)
Adds a library as per the Ruby command line arg -I.

Parameters:
libPaths -

setRequires

void setRequires(java.lang.String[] reqLibs)
Adds a 'require' file as per the Ruby command line arg -r.

Parameters:
reqLibs -

putGlobal

void putGlobal(java.lang.String key,
               java.lang.Object value)
Appends an input value with the given key to the Ruby script bas a global... similar to $key = value

Parameters:
key -
value -

setCurrentDirectory

void setCurrentDirectory(java.lang.String currentDirectory)
Sets the current working directory for the JRuby interpreter. NOTE: If the interpreter is created externally to this invoker instance, the current directory will not be set.

Parameters:
currentDirectory -

invoke

java.lang.Object invoke()
                        throws java.io.IOException,
                               org.codehaus.plexus.component.factory.ComponentInstantiationException
Invokes the script after all other values are set.

Returns:
an Object of possibly returned value
Throws:
java.io.IOException
org.codehaus.plexus.component.factory.ComponentInstantiationException

invoke

java.lang.Object invoke(java.io.OutputStream stdout,
                        java.io.OutputStream stderr)
                        throws java.io.IOException,
                               org.codehaus.plexus.component.factory.ComponentInstantiationException
Invokes the script after all other values are set.

Parameters:
stdout - stream where jruby output to
stderr - stream where jruby errors to
Returns:
an Object of possibly returned values
Throws:
java.io.IOException
org.codehaus.plexus.component.factory.ComponentInstantiationException


Copyright © 2001-2008 Codehaus. All Rights Reserved.