Package net.east301.keyring.osx

Source Code of net.east301.keyring.osx.NativeLibraryManager

/**
* @author  $Author$
* @date    $Date$
* @version $Revision$
*/

package net.east301.keyring.osx;

import com.sun.jna.Native;
import net.east301.keyring.BackendNotSupportedException;

/**
* Global native library manager
*/
class NativeLibraryManager {

    public static synchronized void loadNativeLibraries() throws BackendNotSupportedException {
        if (CoreFoundation != null && Security != null) { return; }

        try {
            CoreFoundation = (CoreFoundationLibrary)Native.loadLibrary(
                    "CoreFoundation", CoreFoundationLibrary.class);
            Security = (SecurityLibrary)Native.loadLibrary(
                    "Security", SecurityLibrary.class);
        } catch (UnsatisfiedLinkError ex) {
            throw new BackendNotSupportedException("Failed to load native library");
        }
    }

    /**
     * An instance of CoreFoundationLibrary
     */
    public static CoreFoundationLibrary CoreFoundation = null;

    /**
     * An instance of SecurityLibrary
     */
    public static SecurityLibrary Security = null;

} // class NativeLibraryManager
TOP

Related Classes of net.east301.keyring.osx.NativeLibraryManager

TOP
Copyright © 2018 www.massapi.com. 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.