TorqueBox 3.1.2

org.torquebox.core
Class GlobalRuby

java.lang.Object
  extended by org.projectodd.polyglot.core.AsyncService<GlobalRuby>
      extended by org.torquebox.core.GlobalRuby
All Implemented Interfaces:
org.jboss.msc.service.Service<GlobalRuby>, org.jboss.msc.value.Value<GlobalRuby>, GlobalRubyMBean

public class GlobalRuby
extends org.projectodd.polyglot.core.AsyncService<GlobalRuby>
implements GlobalRubyMBean

A singleton (per-AS) service providing a "global" Ruby interpreter.

At the current time, the primary use of the global ruby service is simply to set JRuby's notion of a global interpreter to one of our choosing, instead of the first-created application-specific interpreter.

Author:
Bob McWhirter

Field Summary
 
Fields inherited from interface org.jboss.msc.service.Service
NULL, NULL_VALUE
 
Constructor Summary
GlobalRuby()
           
 
Method Summary
 Object evaluate(String script)
          Evaluate a script.
 Map<String,Object> evaluateErb(Map<String,Object> data)
          Evaluate key values using ERB
 String evaluateToString(String script)
          Evaluate a script, convert the result to a string.
 GlobalRuby getValue()
           
 void startAsync(org.jboss.msc.service.StartContext context)
           
 void stop(org.jboss.msc.service.StopContext context)
           
 
Methods inherited from class org.projectodd.polyglot.core.AsyncService
start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalRuby

public GlobalRuby()
Method Detail

getValue

public GlobalRuby getValue()
                    throws IllegalStateException,
                           IllegalArgumentException
Specified by:
getValue in interface org.jboss.msc.value.Value<GlobalRuby>
Throws:
IllegalStateException
IllegalArgumentException

startAsync

public void startAsync(org.jboss.msc.service.StartContext context)
                throws Exception
Specified by:
startAsync in class org.projectodd.polyglot.core.AsyncService<GlobalRuby>
Throws:
Exception

stop

public void stop(org.jboss.msc.service.StopContext context)
Specified by:
stop in interface org.jboss.msc.service.Service<GlobalRuby>

evaluate

public Object evaluate(String script)
                throws Exception
Evaluate a script.

Specified by:
evaluate in interface GlobalRubyMBean
Parameters:
script - The script to evaluate
Returns:
The result of evaluating the script, in its native form.
Throws:
Exception

evaluateToString

public String evaluateToString(String script)
                        throws Exception
Evaluate a script, convert the result to a string.

Specified by:
evaluateToString in interface GlobalRubyMBean
Parameters:
script - The script to evaluate.
Returns:
The result of evaluating the script, converted to a string if non-nil. If the result is nil, a Java null is returned.
Throws:
Exception

evaluateErb

public Map<String,Object> evaluateErb(Map<String,Object> data)
                               throws Exception
Evaluate key values using ERB

Throws:
Exception

TorqueBox 3.1.2

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.