예제 #1
0
 @Override
 public Map<String, String> getSystemProperties(CallingContext context, List<String> keys) {
   Map<String, String> ret = new TreeMap<String, String>();
   if (keys.isEmpty()) {
     ret.putAll(System.getenv());
     Properties p = System.getProperties();
     for (Map.Entry<Object, Object> prop : p.entrySet()) {
       ret.put(prop.getKey().toString(), prop.getValue().toString());
     }
   } else {
     for (String k : keys) {
       String val = System.getenv(k);
       if (val != null) {
         ret.put(k, System.getenv(k));
       } else {
         String prop = System.getProperty(k);
         if (prop != null) {
           ret.put(k, prop);
         }
       }
     }
   }
   return ret;
 }
예제 #2
0
  public AdminApiImpl(Kernel raptureKernel) {
    super(raptureKernel);
    // Update templates from the command line (Environment and Defines)
    for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
      if (entry.getKey().startsWith(TEMPLATE)) {
        String templateName = entry.getKey().substring(TEMPLATE.length() + 1);
        templates.put(templateName, entry.getValue());
      }
    }

    Enumeration<Object> e = System.getProperties().keys();
    while (e.hasMoreElements()) {
      String name = e.nextElement().toString();
      if (name.startsWith(TEMPLATE)) {
        String templateName = name.substring(TEMPLATE.length() + 1);
        templates.put(templateName, System.getProperty(name));
      }
    }
  }