Gets the scripting environment given the environment name.

@param environmentName the scripting environment name
@return the scripting environment
976686
public ScriptEnvironment getEnvironment(String environmentName) {
      Preconditions.checkArgument(StringUtils.isNotNullOrBlank(environmentName),
                                  "Environment name cannot be null or empty"
                                 );
      ScriptEngine engine = engineManager.getEngineByName(environmentName);
      Preconditions.checkArgument(engine != null, environmentName + " is an unknown.");
      environmentName = engine.getFactory().getEngineName();
      if (!environments.containsKey(environmentName)) {
         environments.put(environmentName, new ScriptEnvironment(engine));
      }
      return environments.get(environmentName);
   }
1083612
public static String getEnv(){
        if(ENV == null){
            if(!blank(System.getenv("ACTIVE_ENV"))) {
                ENV = System.getenv("ACTIVE_ENV");
            }

            if(!blank(System.getProperty("ACTIVE_ENV"))) {
                ENV = System.getProperty("ACTIVE_ENV");
            }

            if(!blank(System.getProperty("active_env"))) {
                ENV = System.getProperty("active_env");
            }

            if(blank(ENV)){
                ENV = "development";
                LogFilter.log(LOGGER, LogLevel.INFO, "Environment variable ACTIVE_ENV not provided, defaulting to '" + ENV + "'");
            }
        }
        return ENV;
    }
26253
def get_compute_environment(self, identifier):
        
        env = self.get_compute_environment_by_arn(identifier)
        if env is None:
            env = self.get_compute_environment_by_name(identifier)
        return env
224262
public java.lang.String getEnvVariablesOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetEnvVariables().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }
716866
protected Stage stageNamed(final String name) {
    return lifeCycle.environment.stage.world().stageNamed(name);
  }
436584
public static List<String> get(final Environment env, final String propName) {
		final List<String> list = new ArrayList<>();

		final String singleProp = env.getProperty(propName);
		if (singleProp != null) {
			list.add(singleProp);
			return list;
		}

		int counter = 0;
		String prop = env.getProperty(propName + "[" + counter + "]");
		while (prop != null) {
			list.add(prop);
			counter++;
			prop = env.getProperty(propName + "[" + counter + "]");
		}

		return list;
	}
1140229
public EnvVars getCharacteristicEnvVars() {
        EnvVars env = new EnvVars();
        env.put("JENKINS_SERVER_COOKIE",SERVER_COOKIE.get());
        env.put("HUDSON_SERVER_COOKIE",SERVER_COOKIE.get()); // Legacy compatibility
        env.put("JOB_NAME",getFullName());
        env.put("JOB_BASE_NAME", getName());
        return env;
    }
845217
private static String getScriptVarImpl(String scriptName, String key) {
		Map<String, String> scVars = scriptVars.get(scriptName);
		if (scVars == null) {
			// No vars have been associated with this script
			return null;
		}
		
		return scVars.get(key);
	}
165461
private ScriptEngine getScriptEngine(String value) {
        String engineName = value.substring(0, value.indexOf(":"));
        if (engines.containsKey(engineName)) {
            return engines.get(engineName);
        } else {
            ScriptEngine engine = manager.getEngineByName(engineName);
            if (engine != null) {
                engines.put(engineName, engine);
            } else {
                log.warning(String.format("Could not find script engine by name '%s'", engineName));
            }
            return engine;
        }
    }
1367205
public static EnvironmentDetail getEnvironmentDetail(final String application, final String environment) {
		
		// lookup the host name

		String hostName = getHostName();
		
		// lookup the current path
		
		String currentPath = System.getProperty("user.dir");
		
		// build the environment details
		
		EnvironmentDetail.Builder environmentBuilder = EnvironmentDetail.newBuilder();
		environmentBuilder.deviceName(hostName);
		environmentBuilder.appLocation(currentPath);
		environmentBuilder.configuredAppName(application);
		environmentBuilder.configuredEnvironmentName(environment);
		
		return environmentBuilder.build();
	}
271913
private static NameSpace getEngineNameSpace(ScriptContext scriptContext) {
        Map<String, Object> engineView = new ScriptContextEngineView(scriptContext);
        NameSpace ns = (NameSpace) engineView.get(engineNameSpaceKey);

        if (!engineView.containsKey(engineNameSpaceKey)) {
            // Create a global namespace for the interpreter
            ns = new ExternalNameSpace(null/*parent*/, "javax_script_context", engineView);
            engineView.put(engineNameSpaceKey, ns);
        }

        return ns;
    }
1291781
public String getJavascriptEngineName(String defaultJsEnginePropName) {

		String jsEngineName = null;
		if (StringUtils.isEmpty(defaultJsEnginePropName)) {
			jsEngineName = getJavascriptEngineName();
		} else {
			jsEngineName = getProperty(defaultJsEnginePropName);
			if (StringUtils.isEmpty(jsEngineName)) {
				jsEngineName = getJavascriptEngineName();
			}
		}

		return jsEngineName;
	}
315720
public static function getEnvNameByHost(string $defaultEnv = null, string $hostname = null): string
    {
        $hostname = $hostname ?: gethostname();

        if (!$hostname) {
            return $defaultEnv;
        }

        foreach (self::$host2env as $kw => $env) {
            if (false !== strpos($hostname, $kw)) {
                return $env;
            }
        }

        return $defaultEnv;
    }
61106
@Override
    public String lookup(String key) {
        final String value = System.getenv(key);

        if (value == null && strict) {
            throw new UndefinedEnvironmentVariableException("The environment variable '" + key
                    + "' is not defined; could not substitute the expression '${"
                    + key + "}'.");
        }

        return value;
    }
1089780
public ServiceCall<Environment> getEnvironment(GetEnvironmentOptions getEnvironmentOptions) {
    Validator.notNull(getEnvironmentOptions, "getEnvironmentOptions cannot be null");
    String[] pathSegments = { "v1/environments" };
    String[] pathParameters = { getEnvironmentOptions.environmentId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
        pathParameters));
    builder.query("version", versionDate);
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getEnvironment");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
      builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Environment.class));
  }
55622
private Properties getEnvVars()
    {
        Process p = null;
        Properties envVars = new Properties();

        try
        {
            Runtime r = Runtime.getRuntime();
            String OS = System.getProperty("os.name").toLowerCase();

            if (OS.indexOf("windows 9") > -1)
            {
                p = r.exec("command.com /c set");
            }
            else if ((OS.indexOf("nt") > -1) ||
                     (OS.indexOf("windows 2000") > -1) ||
                     (OS.indexOf("windows xp") > -1))
            {
                p = r.exec("cmd.exe /c set");
            }
            else
            {
                // our last hope, we assume Unix (thanks to H. Ware for the fix)
                p = r.exec("env");
            }
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while((line = br.readLine()) != null)
            {
                int idx = line.indexOf('=');
                String key = line.substring(0, idx);
                String value = line.substring(idx + 1);
                envVars.setProperty(key, value);
            }
        }
        catch (Exception ExIgnore)
        {
        }
        return envVars;
    }
980396
def get_environment_var(varstr):
    """"""
    mo=_get_env_var.match(to_String(varstr))
    if mo:
        var = mo.group(1)
        if var[0] == '{':
            return var[1:-1]
        else:
            return var
    else:
        return None