Package com.adaptris.jruby
Class AdvancedBuilder
- java.lang.Object
-
- com.adaptris.jruby.ContainerBuilderImpl
-
- com.adaptris.jruby.AdvancedBuilder
-
- All Implemented Interfaces:
ContainerBuilder
public class AdvancedBuilder extends ContainerBuilderImpl
Build aScriptingContainer
that is configured with a list of directories from which to load gems / add to the load path.
-
-
Constructor Summary
Constructors Constructor Description AdvancedBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
addSubdirs()
protected org.jruby.embed.ScriptingContainer
configure(org.jruby.embed.ScriptingContainer container)
java.lang.Boolean
getAddSubdirs()
java.util.List<java.lang.String>
getGemdirs()
void
setAddSubdirs(java.lang.Boolean b)
Set whether or not sub directories will be added.void
setGemdirs(java.util.List<java.lang.String> gemdirs)
Set the directories from which to try and load gemsAdvancedBuilder
withAddSubdirs(java.lang.Boolean b)
AdvancedBuilder
withGemdirs(java.lang.String... strings)
-
Methods inherited from class com.adaptris.jruby.ContainerBuilderImpl
build, getCompileMode, getContextScope, getJrubyHome, getLoadPaths, getVariableBehaviour, setCompileMode, setContextScope, setJrubyHome, setLoadPaths, setVariableBehaviour, terminate, withCompileMode, withContextScope, withJrubyHome, withLoadPaths, withVariableBehaviour
-
-
-
-
Method Detail
-
configure
protected org.jruby.embed.ScriptingContainer configure(org.jruby.embed.ScriptingContainer container) throws CoreException
- Specified by:
configure
in classContainerBuilderImpl
- Throws:
CoreException
-
withGemdirs
public AdvancedBuilder withGemdirs(java.lang.String... strings)
-
getGemdirs
public java.util.List<java.lang.String> getGemdirs()
- Returns:
- the gemdirs
-
setGemdirs
public void setGemdirs(java.util.List<java.lang.String> gemdirs)
Set the directories from which to try and load gemsUnder the covers this effectively does
ScriptingContainer.addClassLoader()
with aURLClassLoader
built from the list of directories specified here (the actual directories might be affected bysetAddSubdirs(Boolean)
).- Parameters:
gemdirs
- the list of gemdirs to set
-
getAddSubdirs
public java.lang.Boolean getAddSubdirs()
-
setAddSubdirs
public void setAddSubdirs(java.lang.Boolean b)
Set whether or not sub directories will be added.This is really just a convenience so that if you specify a gemdir of
/home/vagrant/.rvm/gems/jruby-9.1.17.0/gems
then it will add the contents of that directory in addition to the directory itself. This is to avoid you having to manually specify all the possible gems that are required (e.g. a list containing/home/vagrant/.rvm/gems/jruby-9.1.17.0/gems/jsonpath-0.9.3, /home/vagrant/.rvm/gems/jruby-9.1.17.0/gems/multi-json-1.13.1
etc.- Parameters:
b
- true to additionally include the first level of sub-directories of any specified directory, default is true.
-
withAddSubdirs
public AdvancedBuilder withAddSubdirs(java.lang.Boolean b)
-
addSubdirs
protected boolean addSubdirs()
-
-