Package org.hyperic.sigar.win32

Examples of org.hyperic.sigar.win32.RegistryKey


    }

    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {

        String propertyBase = "\\Web Service(_Total)\\";
        Pdh pdh = new Pdh();

        for (MeasurementScheduleRequest request : metrics) {
            double value = pdh.getRawValue(propertyBase + request.getName());
            report.addData(new MeasurementDataNumeric(request, value));
        }
    }
View Full Code Here


    }

    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {

        String propertyBase = "\\Web Service(" + getSiteName() + ")\\";
        Pdh pdh = new Pdh();

        for (MeasurementScheduleRequest request : metrics) {
            if (request.getDataType() == DataType.CALLTIME) {
                log.debug("Calltime MeasurementScheduleRequest: " + request);
                CallTimeData callTimeData = new CallTimeData(request);
                this.responseTimeDelegate.parseLogs(callTimeData);
                report.addData(callTimeData);
            } else {
                double value = pdh.getRawValue(propertyBase + request.getName());
                report.addData(new MeasurementDataNumeric(request, value));
            }
        }
    }
View Full Code Here

    public TestPdh(String name) {
        super(name);
    }

    private void getValue(String key) throws Exception {
        Pdh pdh = new Pdh();

        traceln(key);
        assertGtEqZeroTrace("raw",
                            (long)pdh.getRawValue(key));
        assertGtEqZeroTrace("fmt",
                            (long)pdh.getFormattedValue(key));
    }
View Full Code Here

    private static boolean isCounter(long type) {
        return (type & Pdh.PERF_TYPE_COUNTER) == Pdh.PERF_TYPE_COUNTER;
    }

    private void getValue(String key) throws Exception {
        Pdh pdh = new Pdh();

        traceln(key + ": " + pdh.getDescription(key));
        traceln("counter=" + isCounter(pdh.getCounterType(key)));
        assertGtEqZeroTrace("raw",
                            (long)pdh.getRawValue(key));
        assertGtEqZeroTrace("fmt",
                            (long)pdh.getFormattedValue(key));
    }
View Full Code Here

     *
     * @throws SystemInfoException
     */
    public List<String> getRegistryChildKeys(Root root, String key) throws SystemInfoException {
        try {
            RegistryKey registry = null;

            switch (root) {
            case HKEY_CURRENT_USER: {
                registry = RegistryKey.CurrentUser.openSubKey(key);
                break;
            }

            case HKEY_LOCAL_MACHINE: {
                registry = RegistryKey.LocalMachine.openSubKey(key);
                break;
            }

            default: {
                throw new SystemInfoException("Invalid root: " + root);
            }
            }

            List<String> list = new ArrayList<String>();

            String[] values = registry.getSubKeyNames();
            if (values != null) {
                list.addAll(Arrays.asList(values));
            }

            return list;
View Full Code Here

     *
     * @throws SystemInfoException
     */
    public List<String> getRegistryValueNames(Root root, String key) throws SystemInfoException {
        try {
            RegistryKey registry = null;

            switch (root) {
            case HKEY_CURRENT_USER: {
                registry = RegistryKey.CurrentUser.openSubKey(key);
                break;
            }

            case HKEY_LOCAL_MACHINE: {
                registry = RegistryKey.LocalMachine.openSubKey(key);
                break;
            }

            default: {
                throw new SystemInfoException("Invalid root: " + root);
            }
            }

            List<String> list = new ArrayList<String>();

            String[] values = registry.getValueNames();
            if (values != null) {
                list.addAll(Arrays.asList(values));
            }

            return list;
View Full Code Here

     * @return the value of the registry entry
     *
     * @throws SystemInfoException
     */
    private RegistryValue getLocalMachineRegistryValue(String key, String name) throws SystemInfoException {
        RegistryKey registry;

        try {
            registry = RegistryKey.LocalMachine.openSubKey(key);
        } catch (Exception e) {
            throw new SystemInfoException(e);
View Full Code Here

     * @return the string value of the registry entry
     *
     * @throws SystemInfoException
     */
    private RegistryValue getCurrentUserRegistryValue(String key, String name) throws SystemInfoException {
        RegistryKey registry;

        try {
            registry = RegistryKey.CurrentUser.openSubKey(key);
        } catch (Exception e) {
            throw new SystemInfoException(e);
View Full Code Here

    public Set<ResourcePackageDetails> discoverInstalledSoftware(PackageType type) {
        Set<ResourcePackageDetails> installedSoftware = new HashSet<ResourcePackageDetails>();
        try {
            String uninstallList = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
            RegistryKey key = RegistryKey.LocalMachine;
            RegistryKey uninstall = key.openSubKey(uninstallList);
            String[] packages = uninstall.getSubKeyNames();

            for (String packageName : packages) {

                RegistryKey packageKey = uninstall.openSubKey(packageName);

                String installDateString = getStringValue(packageKey, "InstallDate");
                String displayName = getStringValue(packageKey, "DisplayName");
                String version = getStringValue(packageKey, "DisplayVersion");

                if (displayName != null && installDateString != null && version != null) {
                    if (version.length() == 0) {
                        version = "1";
                    }
                    try {
                        ResourcePackageDetails details = new ResourcePackageDetails(new PackageDetailsKey(displayName,
                            version, type.getName(), "noarch"));
                        details.setFileCreatedDate(getDate(installDateString));
                        details.setInstallationTimestamp(getDate(installDateString));
                        details.setFileSize((long) packageKey.getIntValue("EstimatedSize", 0));
                        details.setDeploymentTimeConfiguration(getConfigurations(packageKey));
                        installedSoftware.add(details);
                    } catch (IllegalArgumentException e) {
                        if (log.isDebugEnabled()) {
                            log.debug("Skipping windows package discovery for illegal entry [name=" + displayName
View Full Code Here

        String path = null;
        String imagePath = null;
        String version = null;

        try {
            RegistryKey w3svcKey = RegistryKey.LocalMachine.openSubKey(REG_INET_SERVICE);

            imagePath = w3svcKey.getStringValue("ImagePath").trim();
            path = imagePath.substring(0, imagePath.lastIndexOf(File.separator));

            RegistryKey versionInfo = RegistryKey.LocalMachine.openSubKey(REG_INET);
            int majorVersion = versionInfo.getIntValue(REG_INET_MAJORVER);
            int minorVersion = versionInfo.getIntValue(REG_INET_MINORVER);

            version = majorVersion + "." + minorVersion;
        } catch (Win32Exception w32e) {
            log.debug("Could not find a valid installation of IIS");
            return null;
View Full Code Here

TOP

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

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.