~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/jdrmaa/test/com/sun/grid/Settings.java

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Settings.java
 
3
 *
 
4
 * Created on September 7, 2005, 4:01 PM
 
5
 */
 
6
 
 
7
package com.sun.grid;
 
8
 
 
9
import java.util.HashMap;
 
10
import java.util.Map;
 
11
 
 
12
/**
 
13
 *
 
14
 * @author  dan.templeton@sun.com
 
15
 */
 
16
public class Settings {
 
17
    private static Map settings = new HashMap();
 
18
    public static final String USER = "user";
 
19
    public static final String TEST_PATH = "test_path";
 
20
    public static final String SGE_ROOT = "sge_root";
 
21
    public static final String ARCH = "arch";
 
22
    public static final String HOSTNAME = "hostname";
 
23
    public static final String GETS_ROOT = "gets_root";
 
24
    public static final String CWD = "cwd";
 
25
    public static final String SCRIPTS_DIR = "scripts_dir";
 
26
    public static final String CHECKTREE_ROOT = "checktree_root";
 
27
    public static final String PID = "pid";
 
28
    public static final String HOME_DIR = "home_dir";
 
29
    public static final String VERSION = "version";
 
30
    
 
31
   /* The first time this class is used, it will initialize all of the values
 
32
    * automatically. */
 
33
    static {
 
34
        try {
 
35
            settings.put(USER, System.getProperty("gets.user", "/"));
 
36
            settings.put(TEST_PATH, System.getProperty("gets.test_path", "/"));
 
37
            settings.put(SGE_ROOT, System.getProperty("gets.sge_root", "/"));
 
38
            settings.put(ARCH, System.getProperty("gets.arch", ""));
 
39
            settings.put(HOSTNAME, System.getProperty("gets.hostname", "unknown"));
 
40
            settings.put(GETS_ROOT, System.getProperty("gets.gets_root", "/"));
 
41
            settings.put(CWD, System.getProperty("gets.cwd", "/"));
 
42
            settings.put(SCRIPTS_DIR, System.getProperty("gets.scripts_dir", "/"));
 
43
            settings.put(CHECKTREE_ROOT, System.getProperty("gets.checktree_root", "/"));
 
44
            settings.put(PID, System.getProperty("gets.pid", "-1"));
 
45
            settings.put(HOME_DIR, System.getProperty("gets.home_dir", "/"));
 
46
            settings.put(VERSION, System.getProperty("gets.version", "maintrunk"));
 
47
        } catch (SecurityException e) {
 
48
            System.err.println("Not allowed to access system properties");
 
49
            System.exit(1);
 
50
        }
 
51
    }
 
52
    
 
53
    public static String get(String setting) {
 
54
        return (String)settings.get(setting);
 
55
    }
 
56
    
 
57
    public static void put(String setting, String value) {
 
58
        settings.put(setting, value);
 
59
    }
 
60
    
 
61
    public String toString() {
 
62
        return settings.toString();
 
63
    }
 
64
}