Package org.hyperic.sigar.win32

Examples of org.hyperic.sigar.win32.Win32


            name = getSigar().getProcExe(pid).getName();
        } catch (SigarException e) {
            return;
        }

        FileVersion info = Win32.getFileVersion(name);
        if (info != null) {
            traceln("exe='" + name + "'");
            traceln("version=" + info.getProductVersion());
        }
    }
View Full Code Here


        sb.append(val);
        println(sb.toString());
    }

    public void output(String exe) throws SigarException {
        FileVersion info = Win32.getFileVersion(exe);
        if (info == null) {
            return;
        }
        println("Version info for file '" + exe + "':");
        output("FileVersion", info.getFileVersion());
        output("ProductVersion", info.getProductVersion());
        for (Iterator it = info.getInfo().entrySet().iterator();
             it.hasNext();)
        {
            Map.Entry entry = (Map.Entry)it.next();
            output((String)entry.getKey(), (String)entry.getValue());
        }
View Full Code Here

        sb.append(val);
        println(sb.toString());
    }

    public void output(String exe) throws SigarException {
        FileVersion info = Win32.getFileVersion(exe);
        if (info == null) {
            return;
        }
        println("Version info for file '" + exe + "':");
        output("FileVersion", info.getFileVersion());
        output("ProductVersion", info.getProductVersion());
        for (Iterator it = info.getInfo().entrySet().iterator();
             it.hasNext();)
        {
            Map.Entry entry = (Map.Entry)it.next();
            output((String)entry.getKey(), (String)entry.getValue());
        }
View Full Code Here

        if (!fqdn.equals(host)) {
            os.println("Hostname............" + host);
        }       

        if (SigarLoader.IS_WIN32) {
            LocaleInfo info = new LocaleInfo();
            os.println("Language............" + info);
            os.println("Perflib lang id....." +
                       info.getPerflibLangId());
        }
    }
View Full Code Here

        };

        for (int i=0; i<tests.length; i++) {
            Integer id = (Integer)tests[i][0];
            String lang = (String)tests[i][1];
            LocaleInfo info = new LocaleInfo(id);
            checkInfo(info, lang);
        }

        checkInfo(new LocaleInfo(), "");
    }
View Full Code Here

        };

        for (int i=0; i<tests.length; i++) {
            Integer id = (Integer)tests[i][0];
            String lang = (String)tests[i][1];
            LocaleInfo info = new LocaleInfo(id);
            checkInfo(info, lang);
        }

        checkInfo(new LocaleInfo(), "");
    }
View Full Code Here

        if (!fqdn.equals(host)) {
            os.println("Hostname............" + host);
        }       

        if (SigarLoader.IS_WIN32) {
            LocaleInfo info = new LocaleInfo();
            os.println("Language............" + info);
            os.println("Perflib lang id....." +
                       info.getPerflibLangId());
        }
    }
View Full Code Here

        if (!fqdn.equals(host)) {
            os.println("Hostname............" + host);
        }       

        if (SigarLoader.IS_WIN32) {
            LocaleInfo info = new LocaleInfo();
            os.println("Language............" + info);
            os.println("Perflib lang id....." +
                       info.getPerflibLangId());
        }
    }
View Full Code Here

        if (!fqdn.equals(host)) {
            os.println("Hostname............" + host);
        }       

        if (SigarLoader.IS_WIN32) {
            LocaleInfo info = new LocaleInfo();
            os.println("Language............" + info);
            os.println("Perflib lang id....." +
                       info.getPerflibLangId());
        }
    }
View Full Code Here

    public static Map<String, IISMetaBase> getWebSites() throws Win32Exception {

        String keys[];
        Map<String, IISMetaBase> websites = new HashMap<String, IISMetaBase>();
        MetaBase mb = new MetaBase();

        try {
            mb.OpenSubKey(IIS_MKEY);
            keys = mb.getSubKeyNames();
        } finally {
            mb.close();
        }

        for (String key : keys) {
            int id;
            if (!Character.isDigit(key.charAt(0))) {
                continue;
            }

            try {
                id = Integer.parseInt(key);
            } catch (NumberFormatException e) {
                continue;
            }

            String subkey = IIS_MKEY + "/" + id;
            MetaBase srv = null;
            try {
                srv = new MetaBase();
                srv.OpenSubKey(subkey);

                String[] bindings = null;

                IISMetaBase info = new IISMetaBase();

                //IIS 6.0+Windows 2003 has Administration website
                //that requires SSL by default.
                //Any Web Site can be configured to required ssl.
                try {
                    int flags = srv.getIntValue(MD_SSL_ACCESS_PERM);
                    info.requireSSL = (flags & MD_ACCESS_SSL) != 0;
                    if (info.requireSSL) {
                        bindings = srv.getMultiStringValue(MetaBase.MD_SECURE_BINDINGS);
                    }
                } catch (Win32Exception e) {
                }

                if (bindings == null) {
                    bindings = srv.getMultiStringValue(MetaBase.MD_SERVER_BINDINGS);
                }

                if (bindings.length == 0) {
                    continue;
                }

                String entry = bindings[0];
                int ix = entry.indexOf(":");
                if (ix == -1) {
                    continue;
                }

                info.id = key;
                //binding format:
                //"listen ip:port:host header"
                info.ip = entry.substring(0, ix);

                entry = entry.substring(ix + 1);
                ix = entry.indexOf(":");
                info.port = entry.substring(0, ix);

                //if host header is defined, URLMetric
                //will add Host: header with this value.
                info.hostname = entry.substring(ix + 1);
                if ((info.hostname != null) && (info.hostname.length() == 0)) {
                    info.hostname = null;
                }

                if ((info.ip == null) || (info.ip.length() == 0)) {
                    //not bound to a specific ip
                    info.ip = "localhost";
                }

                String name = srv.getStringValue(MetaBase.MD_SERVER_COMMENT);

                websites.put(name, info);

                //XXX this is bogus, else locks the metabase
                //because OpenSubKey does not close the key
                //thats already open.
                srv.close();
                srv = null;
                srv = new MetaBase();
                srv.OpenSubKey(subkey + "/ROOT");
                String docroot = srv.getStringValue(3001);
                info.path = docroot;
            } catch (Win32Exception e) {
            } finally {
                if (srv != null) {
                    srv.close();
                }
            }
        }

        return websites;
View Full Code Here

TOP

Related Classes of org.hyperic.sigar.win32.Win32

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.