KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > EnvVars


1 package hudson;
2
3 import org.apache.tools.ant.taskdefs.Execute;
4
5 import java.util.Collections JavaDoc;
6 import java.util.HashMap JavaDoc;
7 import java.util.Map JavaDoc;
8 import java.util.Vector JavaDoc;
9
10 /**
11  * @author Kohsuke Kawaguchi
12  */

13 public class EnvVars {
14     /**
15      * Environmental variables that we've inherited.
16      */

17     public static final Map JavaDoc<String JavaDoc,String JavaDoc> masterEnvVars;
18
19     static {
20         @SuppressWarnings JavaDoc("unchecked") // Ant does not use JDK 5
21
Vector JavaDoc<String JavaDoc> envs = Execute.getProcEnvironment();
22         Map JavaDoc<String JavaDoc,String JavaDoc> m = new HashMap JavaDoc<String JavaDoc,String JavaDoc>();
23         for (String JavaDoc e : envs) {
24             int idx = e.indexOf('=');
25             m.put(e.substring(0, idx), e.substring(idx + 1));
26         }
27         masterEnvVars = Collections.unmodifiableMap(m);
28     }
29
30 }
31
Popular Tags