72096d2199fc8d1879ee10f6dfcfda808687c595
[ccsdk/apps.git] / sdnr / wireless-transport / code-Carbon-SR1 / apps / helpServer / impl / src / main / java / com / highstreet / technologies / helpserver / data / Environment.java
1 package com.highstreet.technologies.helpserver.data;
2
3 import java.net.Inet4Address;
4 import java.net.UnknownHostException;
5 import java.util.Map;
6
7 public class Environment {
8
9         public static String getVar(String v)
10         {
11                 if(v.equals("$HOSTNAME"))
12                         try {
13                                 return Inet4Address.getLocalHost().getHostName();
14                         } catch (UnknownHostException e) {
15
16                         }
17                 Map<String, String> env = System.getenv();
18         for (String envName : env.keySet()) {
19            if(envName!=null && envName.equals(v))
20               return env.get(envName);
21         }
22         return null;
23         }
24 }