Class SystemPropertyCatcher

java.lang.Object
org.jruby.embed.util.SystemPropertyCatcher

public class SystemPropertyCatcher extends Object
Utility methods to retrieve System properties or environment variables to get configuration parameters.
Author:
Yoko Harada <[email protected]>
  • Constructor Details

    • SystemPropertyCatcher

      public SystemPropertyCatcher()
  • Method Details

    • getScope

      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 - a default scope.
      Returns:
      one of three local context scopes.
    • getBehavior

      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 - a default local variable behavior
      Returns:
      a local variable behavior
    • isLazy

      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 - a default local variable behavior
      Returns:
      a local variable behavior
    • setClassLoader

      public static void setClassLoader(ScriptingContainer container)
      Sets classloader based on System property. This is only used from JRubyEgnineFactory.
      Parameters:
      container - ScriptingContainer to be set classloader
    • setConfiguration

      public static void setConfiguration(ScriptingContainer container)
      Sets configuration parameters given by System properties. Compile mode and Compat version can be set.
      Parameters:
      container - ScriptingContainer to be set configurations.
    • setJRubyHome

      @Deprecated 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 to be set jruby home.
    • findJRubyHome

      @Deprecated 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 - any instance to get a resource
      Returns:
      JRuby home path if exists, null when failed to find it.
    • findFromJar

      @Deprecated public static String findFromJar(Object instance)
      Deprecated.
    • findLoadPaths

      @Deprecated 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:
      a list of load paths.
    • getBaseDir

      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:
      a base directory.