OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 45... Line 45...
45
    static public enum Info {
45
    static public enum Info {
46
        JAVA, OS, USER, NETWORK
46
        JAVA, OS, USER, NETWORK
47
    }
47
    }
48
 
48
 
49
    public static final String CLASS_PROTOCOL = "class";
49
    public static final String CLASS_PROTOCOL = "class";
-
 
50
    public static final String PROPS_PROTOCOL = "props";
-
 
51
    public static final String ENV_PROTOCOL = "env";
50
 
52
 
51
    static public NavigableMap<Info, String> get(final boolean html, final Locale locale) {
53
    static public NavigableMap<Info, String> get(final boolean html, final Locale locale) {
52
        final TM tm = TM.getInstance(locale);
54
        final TM tm = TM.getInstance(locale);
53
        final NavigableMap<Info, String> res = new TreeMap<Info, String>();
55
        final NavigableMap<Info, String> res = new TreeMap<Info, String>();
54
 
56
 
Line 65... Line 67...
65
        } catch (URISyntaxException e1) {
67
        } catch (URISyntaxException e1) {
66
            // tant pis pas de lien
68
            // tant pis pas de lien
67
            e1.printStackTrace();
69
            e1.printStackTrace();
68
        }
70
        }
69
        final Runtime rt = Runtime.getRuntime();
71
        final Runtime rt = Runtime.getRuntime();
-
 
72
        final long totalMemory = rt.totalMemory();
70
        final String stats = "<i>" + tm.translate("memory") + " :</i> " + formatBytes(tm, rt.freeMemory()) + " / " + formatBytes(tm, rt.totalMemory()) + " ; "
73
        final String stats = "<i>" + tm.translate("memory.used") + " :</i> " + formatBytes(tm, totalMemory - rt.freeMemory()) + " / " + formatBytes(tm, totalMemory) + " ; "
71
                + tm.translate("processors", rt.availableProcessors());
74
                + tm.translate("processors", rt.availableProcessors());
72
        final String lafDesc = lookAndFeel == null ? tm.translate("no.laf") : getLink(lookAndFeel.getName(), lafURI, html) + ", " + lookAndFeel.getDescription();
75
        final String lafDesc = lookAndFeel == null ? tm.translate("no.laf") : getLink(lookAndFeel.getName(), lafURI, html) + ", " + lookAndFeel.getDescription();
-
 
76
        URI propsURI = null;
-
 
77
        URI envURI = null;
-
 
78
        try {
-
 
79
            propsURI = new URI(PROPS_PROTOCOL, "/", null);
-
 
80
            envURI = new URI(ENV_PROTOCOL, "/", null);
-
 
81
        } catch (URISyntaxException e1) {
-
 
82
            e1.printStackTrace();
-
 
83
        }
-
 
84
        final String propsDesc = envURI == null ? "" : lineBreak + getLink(tm.translate("properties.all"), propsURI, html) + ", " + getLink(tm.translate("env.all"), envURI, html);
73
 
85
 
74
        final String p = tm.translate("javaVersion", version, getLink(getProperty("java.vendor"), vendorURI, html)) + " ; "
86
        final String p = tm.translate("javaVersion", version, getLink(getProperty("java.vendor"), vendorURI, html)) + " ; "
75
                + getLink(tm.translate("javaHome"), new File(getProperty("java.home")).toURI(), html) + lineBreak + stats + lineBreak + lafDesc;
87
                + getLink(tm.translate("javaHome"), new File(getProperty("java.home")).toURI(), html) + lineBreak + stats + lineBreak + lafDesc + propsDesc;
76
 
88
 
77
        res.put(Info.JAVA, p);
89
        res.put(Info.JAVA, p);
78
 
90
 
79
        // * Windows XP 5.1 (x86)
91
        // * Windows XP 5.1 (x86)
80
        res.put(Info.OS, "<b>" + getProperty("os.name") + "</b> " + getProperty("os.version") + " (" + getProperty("os.arch") + ")");
92
        res.put(Info.OS, "<b>" + getProperty("os.name") + "</b> " + getProperty("os.version") + " (" + getProperty("os.arch") + ")");