List of usage examples for java.lang System getenv
public static java.util.Map<String, String> getenv()
From source file:com.alibaba.datax.plugin.reader.odpsreader.util.IdAndKeyUtil.java
public static Configuration parseAccessIdAndKey(Configuration originalConfig) { String accessId = originalConfig.getString(Key.ACCESS_ID); String accessKey = originalConfig.getString(Key.ACCESS_KEY); // ?? accessId,accessKey ????? accessid/accessKey if (StringUtils.isNotBlank(accessId) || StringUtils.isNotBlank(accessKey)) { LOG.info("Try to get accessId/accessKey from your config."); //???//w w w. j a v a2s . c o m accessId = originalConfig.getNecessaryValue(Key.ACCESS_ID, OdpsReaderErrorCode.REQUIRED_VALUE); accessKey = originalConfig.getNecessaryValue(Key.ACCESS_KEY, OdpsReaderErrorCode.REQUIRED_VALUE); //?? return originalConfig; } else { Map<String, String> envProp = System.getenv(); return getAccessIdAndKeyFromEnv(originalConfig, envProp); } }
From source file:com.alibaba.datax.plugin.writer.odpswriter.util.IdAndKeyUtil.java
public static Configuration parseAccessIdAndKey(Configuration originalConfig) { String accessId = originalConfig.getString(Key.ACCESS_ID); String accessKey = originalConfig.getString(Key.ACCESS_KEY); // ?? accessId,accessKey ????? accessid/accessKey if (StringUtils.isNotBlank(accessId) || StringUtils.isNotBlank(accessKey)) { LOG.info("Try to get accessId/accessKey from your config."); //???//from w ww . j a va 2 s . c o m accessId = originalConfig.getNecessaryValue(Key.ACCESS_ID, OdpsWriterErrorCode.REQUIRED_VALUE); accessKey = originalConfig.getNecessaryValue(Key.ACCESS_KEY, OdpsWriterErrorCode.REQUIRED_VALUE); //?? return originalConfig; } else { Map<String, String> envProp = System.getenv(); return getAccessIdAndKeyFromEnv(originalConfig, envProp); } }
From source file:com.bstek.dorado.core.el.CoreContextVarsInitializer.java
public void initializeContext(Map<String, Object> vars) { try {/*from ww w.ja v a2s. c om*/ vars.put("null", null); vars.put("this", null); vars.put("env", System.getenv()); vars.put("system", System.getProperties()); vars.put("configure", Configure.getStore()); vars.put("context", Context.getCurrent()); vars.put("ctx", new ContextWrapperMap(Context.getCurrent())); vars.put("util", SingletonBeanFactory.getInstance(ExpressionUtilsObject.class)); } catch (Exception e) { logger.error(e, e); } }
From source file:com.mobilecashout.osprey.util.Substitutor.java
public Substitutor(HashMap<String, String> variables) { values.putAll(variables);/*from w w w .jav a 2 s. c o m*/ for (Map.Entry<String, String> env : System.getenv().entrySet()) { values.put(String.format("env_%s", env.getKey()).toLowerCase(), env.getValue()); } this.substitutor = new StrSubstitutor(values, "{", "}"); }
From source file:pl.edu.pwr.iiar.zak.thermalKit.parser.RcFileParser.java
public RcFileParser() throws IOException, InterruptedException { File rcFile = new File(String.format("/home/%s/.jgenerilorc", System.getenv().get("USER"))); ObjectMapper mapper = new ObjectMapper(); node = mapper.readValue(rcFile, JsonNode.class); }
From source file:com.netflix.spinnaker.clouddriver.jobs.JobRequest.java
public JobRequest(List<String> tokenizedCommand, InputStream inputStream) { this(tokenizedCommand, System.getenv(), inputStream); }
From source file:com.github.lukaszbudnik.dqueue.QueueClientPerformanceTest.java
@BeforeClass public static void beforeClass() throws Exception { // don't run on travis! Assume.assumeFalse(System.getenv().containsKey("TRAVIS")); injector = Guice.createInjector(/*from w ww. jav a2s . co m*/ new PropertiesElResolverModule(Arrays.asList("/dqueue.properties", "/cloudtag.properties"))); CloudTagEnsembleProvider cloudTagEnsembleProvider = injector.getInstance(CloudTagEnsembleProvider.class); RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); zookeeperClient = CuratorFrameworkFactory.builder().ensembleProvider(cloudTagEnsembleProvider) .retryPolicy(retryPolicy).build(); zookeeperClient.start(); // warm up zookeeper zookeeperClient - on my macbook pro takes even up to 10 seconds zookeeperClient.getChildren().forPath("/"); }
From source file:com.redhat.developers.containers.MyController.java
@CrossOrigin @RequestMapping(method = RequestMethod.GET, value = "/hello", produces = "text/plain") public String hello() { String hostname = System.getenv().getOrDefault("HOSTNAME", "Unknown"); return String.format("Hello world from %s", hostname); }
From source file:org.brekka.stillingar.spring.resource.dir.EnvironmentVariableDirectory.java
/** * @param var the name of the environment variable to load the location from *///from ww w .j a v a2 s .c om public EnvironmentVariableDirectory(String var) { this(var, System.getenv()); }
From source file:com.audaexplore.claimservices.listeners.FnolMessageListener.java
public FnolMessageListener() { // init messaging ConnectionFactory factory = null;/*from w ww.ja va2s . co m*/ String amqpURI = "amqp://localhost"; Connection connection = null; String BOUND_SERVICES_ENV_VARIABLE_NAME = "VCAP_SERVICES"; Map<String, String> env = System.getenv(); String boundServicesJson = env.get(BOUND_SERVICES_ENV_VARIABLE_NAME); // String // boundServicesJson="{\"staging_env_json\":{},\"running_env_json\":{},\"system_env_json\":{\"VCAP_SERVICES\":{\"cloudamqp\":[{\"name\":\"MQRabbit\",\"label\":\"cloudamqp\",\"tags\":[\"Web-based\",\"UserProvisioning\",\"MessagingandQueuing\",\"amqp\",\"Backup\",\"SingleSign-On\",\"NewProduct\",\"rabbitmq\",\"CertifiedApplications\",\"Android\",\"DeveloperTools\",\"DevelopmentandTestTools\",\"Buyable\",\"Messaging\",\"Importable\",\"ITManagement\"],\"plan\":\"lemur\",\"credentials\":{\"uri\":\"amqp://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/kujcbqju\",\"http_api_uri\":\"https://kujcbqju:xr-HKmBcq5Lv87CCrYlQ6NaVmunhU8cv@moose.rmq.cloudamqp.com/api/\"}}],\"newrelic\":[{\"name\":\"NewRelic\",\"label\":\"newrelic\",\"tags\":[\"Monitoring\"],\"plan\":\"standard\",\"credentials\":{\"licenseKey\":\"a8a96a124d1b58d708a2c4c07c6cff8938e2e2f4\"}}],\"mongolab\":[{\"name\":\"MongoDB\",\"label\":\"mongolab\",\"tags\":[\"DataStore\",\"document\",\"mongodb\"],\"plan\":\"sandbox\",\"credentials\":{\"uri\":\"mongodb://CloudFoundry_31lvrquo_j44bi0vu_3gjp7i4s:6RAtFVBfQUCe_DV7LAq5uCffOXaEXdly@ds047315.mongolab.com:47315/CloudFoundry_31lvrquo_j44bi0vu\"}}]}},\"application_env_json\":{\"VCAP_APPLICATION\":{\"limits\":{\"mem\":512,\"disk\":1024,\"fds\":16384},\"application_id\":\"87bdc475-83c4-4df9-92d1-40ff9bf82249\",\"application_version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"application_name\":\"vinservice\",\"application_uris\":[\"vinservice.cfapps.io\"],\"version\":\"52891578-5906-4846-9231-afe7048f29bf\",\"name\":\"vinservice\",\"space_name\":\"development\",\"space_id\":\"d33d438c-860a-46d3-ab33-4c2efac841be\",\"uris\":[\"vinservice.cfapps.io\"],\"users\":null}}}"; if (StringUtils.isNotBlank(boundServicesJson)) { // amqpURI = JsonPath.read(boundServicesJson, // "$..cloudamqp[0].credentials.uri",String.class); JSONArray jsonArray = JsonPath.read(boundServicesJson, "$..cloudamqp[0].credentials.uri"); amqpURI = jsonArray.get(0).toString(); } else { amqpURI = "amqp://localhost"; } System.out.println(amqpURI); try { factory = new ConnectionFactory(); factory.setUri(amqpURI); connection = factory.newConnection(); channel = connection.createChannel(); channel.queueDeclare("fnol", true, false, false, null); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (TimeoutException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (KeyManagementException e1) { e1.printStackTrace(); } catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); } catch (URISyntaxException e1) { e1.printStackTrace(); } }