Clean up error handling to make things slightly friendlier on an initial install.
[cfb.git] / prod / net / jaekl / cfb / util / Env.java
diff --git a/prod/net/jaekl/cfb/util/Env.java b/prod/net/jaekl/cfb/util/Env.java
new file mode 100644 (file)
index 0000000..bda8405
--- /dev/null
@@ -0,0 +1,27 @@
+package net.jaekl.cfb.util;
+
+public class Env {
+       static volatile Env m_inst = null;
+       
+       Env() {}
+       
+       private static Env getInstance() 
+       {
+               Env inst = m_inst;
+               if (null == inst) {
+                       synchronized(Env.class) {
+                               if (null == m_inst) {
+                                       m_inst = new Env();
+                               }
+                               inst = m_inst;
+                       }
+               }
+               return inst;
+       }
+       
+       String getEnv(String variableName) { return System.getenv(variableName); }
+       
+       public static String get(String variableName) {
+               return getInstance().getEnv(variableName);
+       }
+}