TorqueBox 3.1.2

org.torquebox.core.runtime
Class RubyRuntimeFactory

java.lang.Object
  extended by org.torquebox.core.runtime.RubyRuntimeFactory
All Implemented Interfaces:
InstanceFactory<org.jruby.Ruby>

public class RubyRuntimeFactory
extends Object
implements InstanceFactory<org.jruby.Ruby>

Default Ruby runtime interpreter factory implementation.

Author:
Bob McWhirter

Constructor Summary
RubyRuntimeFactory()
          Construct.
RubyRuntimeFactory(RuntimeInitializer initializer)
           
RubyRuntimeFactory(RuntimeInitializer initializer, RuntimePreparer preparer)
          Construct with an initializer and a preparer.
 
Method Summary
 void create()
           
protected  Map<String,String> createEnvironment()
           
 org.jruby.Ruby createInstance(String contextInfo)
          Create a new instance of a fully-initialized runtime.
 org.jruby.Ruby createInstance(String contextInfo, boolean initialize)
           
 void destroy()
           
 void destroyInstance(org.jruby.Ruby instance)
           
 Map<String,String> getApplicationEnvironment()
          Retrieve the application-specific environment additions.
 String getApplicationName()
           
 org.jruby.util.ClassCache getClassCache()
           
 ClassLoader getClassLoader()
          Retrieve the interpreter classloader.
 org.jruby.RubyInstanceConfig.CompileMode getCompileMode()
          Retrieve the compile mode.
 PrintStream getError()
          Retrieve the interpreter error stream.
protected  String getFullContext(String contextInfo)
           
 String getGemPath()
           
 org.jboss.msc.inject.Injector<Object> getInjector(String key)
           
 InputStream getInput()
          Retrieve the interpreter input stream.
 String getJRubyHome()
           
 List<String> getLoadPaths()
          Retrieve the interpreter load paths.
 PrintStream getOutput()
          Retrieve the interpreter output stream.
 org.jruby.CompatVersion getRubyVersion()
          Retrieve the Ruby compatibility version.
 org.jboss.msc.service.ServiceRegistry getServiceRegistry()
           
 boolean isDebug()
          Retrieve the debug mode
 boolean isInteractive()
          Retrieve the interactive mode
 boolean isProfileApi()
          Retrieve the profile.api mode
protected  List<String> prepareJRubyOpts(Map<String,String> environment)
           
 void setApplicationEnvironment(Map<String,String> applicationEnvironment)
          Set the application-specific environment additions.
 void setApplicationName(String applicationName)
           
 void setClassLoader(ClassLoader classLoader)
          Set the interpreter classloader.
 void setCompileMode(org.jruby.RubyInstanceConfig.CompileMode compileMode)
          Set the compile mode.
 void setDebug(boolean debug)
           
 void setError(PrintStream errorStream)
          Set the interpreter error stream.
 void setGemPath(String gemPath)
           
 void setInput(InputStream inputStream)
          Set the interpreter input stream.
 void setInteractive(boolean interactive)
           
 void setJRubyHome(String jrubyHome)
           
 void setLoadPaths(List<String> loadPaths)
          Set the interpreter load paths.
 void setOutput(PrintStream outputStream)
          Set the interpreter output stream.
 void setProfileApi(boolean profileApi)
          Sets the profile.api value for the JRuby environment.
 void setRubyVersion(org.jruby.CompatVersion rubyVersion)
          Set the Ruby compatibility version.
 void setServiceRegistry(org.jboss.msc.service.ServiceRegistry serviceRegistry)
           
 void setUseJRubyHomeEnvVar(boolean useJRubyEnvVar)
           
 boolean useJRubyHomeEnvVar()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RubyRuntimeFactory

public RubyRuntimeFactory()
Construct.


RubyRuntimeFactory

public RubyRuntimeFactory(RuntimeInitializer initializer)

RubyRuntimeFactory

public RubyRuntimeFactory(RuntimeInitializer initializer,
                          RuntimePreparer preparer)
Construct with an initializer and a preparer.

Parameters:
initializer - The initializer (or null) to use for each created runtime.
preparer - The preparer (or null) to use for each created runtime.
Method Detail

setApplicationName

public void setApplicationName(String applicationName)

getApplicationName

public String getApplicationName()

setGemPath

public void setGemPath(String gemPath)

getGemPath

public String getGemPath()

setJRubyHome

public void setJRubyHome(String jrubyHome)

getJRubyHome

public String getJRubyHome()

setUseJRubyHomeEnvVar

public void setUseJRubyHomeEnvVar(boolean useJRubyEnvVar)

useJRubyHomeEnvVar

public boolean useJRubyHomeEnvVar()

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Set the interpreter classloader.

Parameters:
classLoader - The classloader.

getClassLoader

public ClassLoader getClassLoader()
Retrieve the interpreter classloader.

Returns:
The classloader.

setRubyVersion

public void setRubyVersion(org.jruby.CompatVersion rubyVersion)
Set the Ruby compatibility version.

Parameters:
rubyVersion - The version.

getRubyVersion

public org.jruby.CompatVersion getRubyVersion()
Retrieve the Ruby compatibility version.

Returns:
The version.

setCompileMode

public void setCompileMode(org.jruby.RubyInstanceConfig.CompileMode compileMode)
Set the compile mode.

Parameters:
compileMode - The mode.

getCompileMode

public org.jruby.RubyInstanceConfig.CompileMode getCompileMode()
Retrieve the compile mode.

Returns:
The mode.

setDebug

public void setDebug(boolean debug)
Parameters:
debug - Whether JRuby debug logging should be enabled or not

isDebug

public boolean isDebug()
Retrieve the debug mode

Returns:
Whether debug logging is enabled or not

setInteractive

public void setInteractive(boolean interactive)
Parameters:
interactive - Whether the runtime is marked as interactive or not

isInteractive

public boolean isInteractive()
Retrieve the interactive mode

Returns:
Whether the runtime is marked as interactive or not

isProfileApi

public boolean isProfileApi()
Retrieve the profile.api mode

Returns:
Whether the JRuby profile.api flag is enabled or not

setProfileApi

public void setProfileApi(boolean profileApi)
Sets the profile.api value for the JRuby environment.

Parameters:
profileApi - Whether the JRuby profile.api flag is enabled or not.

setApplicationEnvironment

public void setApplicationEnvironment(Map<String,String> applicationEnvironment)
Set the application-specific environment additions.

Parameters:
applicationEnvironment - The environment.

getApplicationEnvironment

public Map<String,String> getApplicationEnvironment()
Retrieve the application-specific environment additions.

Returns:
The environment.

createInstance

public org.jruby.Ruby createInstance(String contextInfo)
                              throws Exception
Create a new instance of a fully-initialized runtime.

Specified by:
createInstance in interface InstanceFactory<org.jruby.Ruby>
Returns:
The newly-created instance.
Throws:
Exception - if an error occurred attempting to create the instance.

createInstance

public org.jruby.Ruby createInstance(String contextInfo,
                                     boolean initialize)
                              throws Exception
Throws:
Exception

getFullContext

protected String getFullContext(String contextInfo)

destroyInstance

public void destroyInstance(org.jruby.Ruby instance)
Specified by:
destroyInstance in interface InstanceFactory<org.jruby.Ruby>

createEnvironment

protected Map<String,String> createEnvironment()

prepareJRubyOpts

protected List<String> prepareJRubyOpts(Map<String,String> environment)

setInput

public void setInput(InputStream inputStream)
Set the interpreter input stream.

Parameters:
inputStream - The input stream.

getInput

public InputStream getInput()
Retrieve the interpreter input stream.

Returns:
The input stream.

setOutput

public void setOutput(PrintStream outputStream)
Set the interpreter output stream.

Parameters:
outputStream - The output stream.

getOutput

public PrintStream getOutput()
Retrieve the interpreter output stream.

Returns:
The output stream.

setError

public void setError(PrintStream errorStream)
Set the interpreter error stream.

Parameters:
errorStream - The error stream.

getError

public PrintStream getError()
Retrieve the interpreter error stream.

Returns:
The error stream.

setLoadPaths

public void setLoadPaths(List<String> loadPaths)
Set the interpreter load paths.

Load paths may be either real filesystem paths or VFS URLs

Parameters:
loadPaths - The list of load paths.

getLoadPaths

public List<String> getLoadPaths()
Retrieve the interpreter load paths.

Returns:
The list of load paths.

create

public void create()

destroy

public void destroy()

getClassCache

public org.jruby.util.ClassCache getClassCache()

setServiceRegistry

public void setServiceRegistry(org.jboss.msc.service.ServiceRegistry serviceRegistry)

getServiceRegistry

public org.jboss.msc.service.ServiceRegistry getServiceRegistry()

getInjector

public org.jboss.msc.inject.Injector<Object> getInjector(String key)

TorqueBox 3.1.2

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