Top Description Constructors Methods
org.jruby.embed.util

public Class SystemPropertyCatcher

extends Object
Class Inheritance
Imports
java.io.File, java.net.URL, java.util.ArrayList, .List, java.util.regex.Matcher, .Pattern, org.jruby.RubyInstanceConfig, .RubyInstanceConfig.CompileMode, org.jruby.embed.internal.LocalContextProvider, org.jruby.embed.LocalContextScope, .LocalVariableBehavior, .PropertyName, .ScriptingContainer, org.jruby.util.SafePropertyAccessor

Utility methods to retrieve System properties or environment variables to get configuration parameters.
Author
Yoko Harada <[email protected]>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
findFromJar(Object instance)
Deprecated

public static String

Returns:

JRuby home path if exists, null when failed to find it.
findJRubyHome
(Object
any instance to get a resource
instance
)
Deprecated

Tries to find JRuby home from the order of JRUBY_HOME environment variable, jruby.home System property, then "/META-INF/jruby.home" if jruby-complete.jar is used.

public static List<String>

Returns:

a list of load paths.
findLoadPaths
()
Deprecated

Tries to find load paths for ruby files and/or libraries.

public static String

Returns:

a base directory.
getBaseDir
()

Returns a possible base directory.

public static LocalVariableBehavior

Returns:

a local variable behavior
getBehavior
(LocalVariableBehavior
a default local variable behavior
defaultBehavior
)

Gets a local variable behavior from System property.

public static LocalContextScope

Returns:

one of three local context scopes.
getScope
(LocalContextScope
a default scope.
defaultScope
)

Gets a local context scope from System property.

public static boolean

Returns:

a local variable behavior
isLazy
(boolean
a default local variable behavior
defaultLaziness
)

Gets a local variable behavior from System property.

private static boolean
matches(final String name, final String pattern)

public static void
setClassLoader(ScriptingContainer
ScriptingContainer to be set classloader
container
)

Sets classloader based on System property.

public static void
setConfiguration(ScriptingContainer
ScriptingContainer to be set configurations.
container
)

Sets configuration parameters given by System properties.

public static void
setJRubyHome(ScriptingContainer
ScriptingContainer to be set jruby home.
container
)
Deprecated

Sets JRuby home if it is given by a JRUBY_HOME environment variable, jruby.home system property, or jury.home in jruby-complete.jar

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SystemPropertyCatcherback to summary
public SystemPropertyCatcher()

Method Detail

findFromJarback to summary
public static String findFromJar(Object instance)

Deprecated

Annotations
@Deprecated
findJRubyHomeback to summary
public static String findJRubyHome(Object instance)

Deprecated

Tries to find JRuby home from the order of JRUBY_HOME environment variable, jruby.home System property, then "/META-INF/jruby.home" if jruby-complete.jar is used.

Parameters
instance:Object

any instance to get a resource

Returns:String

JRuby home path if exists, null when failed to find it.

Annotations
@Deprecated
findLoadPathsback to summary
public static List<String> findLoadPaths()

Deprecated

Tries to find load paths for ruby files and/or libraries. This methods sees org.jruby.embed.class.path system property first, then java.class.path.

Returns:List<String>

a list of load paths.

Annotations
@Deprecated
getBaseDirback to summary
public static String getBaseDir()

Returns a possible base directory. PWD environment variables is looked up first, then user.dir System property second. This directory is used as a default value when base directory is not given.

Returns:String

a base directory.

getBehaviorback to summary
public static LocalVariableBehavior getBehavior(LocalVariableBehavior defaultBehavior)

Gets a local variable behavior from System property. If no value is assigned to PropertyName.LOCALVARIABLE_BEHAVIOR, given default value is applied.

Parameters
defaultBehavior:LocalVariableBehavior

a default local variable behavior

Returns:LocalVariableBehavior

a local variable behavior

getScopeback to summary
public static LocalContextScope getScope(LocalContextScope defaultScope)

Gets a local context scope from System property. If no value is assigned to PropertyName.LOCALCONTEXT_SCOPE, given default value is applied.

Parameters
defaultScope:LocalContextScope

a default scope.

Returns:LocalContextScope

one of three local context scopes.

isLazyback to summary
public static boolean isLazy(boolean defaultLaziness)

Gets a local variable behavior from System property. If no value is assigned to PropertyName.LOCALVARIABLE_BEHAVIOR, given default value is applied.

Parameters
defaultLaziness:boolean

a default local variable behavior

Returns:boolean

a local variable behavior

matchesback to summary
private static boolean matches(final String name, final String pattern)
setClassLoaderback to summary
public static void setClassLoader(ScriptingContainer container)

Sets classloader based on System property. This is only used from JRubyEgnineFactory.

Parameters
container:ScriptingContainer

ScriptingContainer to be set classloader

setConfigurationback to summary
public static void setConfiguration(ScriptingContainer container)

Sets configuration parameters given by System properties. Compile mode and Compat version can be set.

Parameters
container:ScriptingContainer

ScriptingContainer to be set configurations.

setJRubyHomeback to summary
public static void setJRubyHome(ScriptingContainer container)

Deprecated

Sets JRuby home if it is given by a JRUBY_HOME environment variable, jruby.home system property, or jury.home in jruby-complete.jar

Parameters
container:ScriptingContainer

ScriptingContainer to be set jruby home.

Annotations
@Deprecated