All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hyperic.sigar.vmware.VMControlLibrary Maven / Gradle / Ivy

There is a newer version: 1.6.6-rev002
Show newest version
/*
 * Copyright (c) 2006-2008 Hyperic, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.hyperic.sigar.vmware;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import java.util.ArrayList;
import java.util.List;

import org.hyperic.jni.ArchName;
import org.hyperic.sigar.SigarLoader;
import org.hyperic.sigar.win32.RegistryKey;
import org.hyperic.sigar.win32.Win32Exception;

public class VMControlLibrary {
    private static final boolean IS64 = ArchName.is64();

    public static final String REGISTRY_ROOT =
        "SOFTWARE\\VMware, Inc.";

    public static final String PROP_VMCONTROL_SHLIB =
        "vmcontrol.shlib";

    private static final String VMWARE_LIB =
        getProperty("lib.vmware", getVMwareLib().getPath());

    private static final String VMCONTROL_TAR =
        getProperty("control.tar", VMWARE_LIB + "/perl/control.tar");

    private static final String VMCONTROL =
        "vmcontrol" + (IS64 ? "64" : "");

    private static final String VMCONTROL_DLL =
        VMCONTROL + "lib.dll";

    private static final String VMCONTROL_SO =
        VMCONTROL + ".so";

    private static final String VMCONTROL_OBJ =
        getProperty("vmcontrol.o", "control-only/" + VMCONTROL + ".o");

    private static final String GCC =
        getProperty("bin.gcc", "/usr/bin/gcc");

    private static final String TAR =
        getProperty("bin.tar", "/bin/tar");

    private static final String LIBSSL =
        getProperty("libssl", "libssl.so.0.9.7");

    private static final String LIBCRYPTO =
        getProperty("libcrypto", "libcrypto.so.0.9.7");

    private static boolean isDebug = false;

    private static String getProperty(String key, String defval) {
        return System.getProperty("vmcontrol." + key, defval);
    }

    private static File getVMwareLib() {
        String[] locations = {
            "/usr/lib/vmware",
            "/usr/local/lib/vmware",
        };

        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy