/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2003 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
 
package org.gnu.gnomevfs;

/**
 * @author Luca De Rugeriis <piedamaro@fastwebnet.it>
 *
 * <p>This class provides initialization/shutdown for GnomeVfs
 */

public class GnomeVfs {
	
	/**
	 * If GnomeVFS is not already initialized, initialize it. This must be called prior to performing any other GnomeVFS
	 *  operations, and may be called multiple times without error.
	 * 
	 * @return true if GnomeVFS is successfully initialized (or was already initialized) 
	 */
	public static boolean init() {
		return gnome_vfs_init ();
	}
	
	/**
	 * Detects if GnomeVFS has already been initialized (GnomeVFS must be initialized
	 *  prior to using any methods or operations).
	 * 
	 * @return true if GnomeVFS has already been initialized
	 */
	public static boolean isInitialized() {
		return gnome_vfs_initialized();
	}
	
	/**
	 * Cease all active GnomeVFS operations and unload the MIME database from memory.
	 *
	 */
	public static void  shutdown() {
		gnome_vfs_shutdown();
	}
	
	// Load the library
	static {
		System.loadLibrary("gnomevfsjava@gnomevfsapiversion@");
	}

	/****************************************
	 * BEGINNING OF JNI CODE
	 ****************************************/
	native static final protected boolean gnome_vfs_init (); 
	native static final protected boolean gnome_vfs_initialized();
	native static final protected void gnome_vfs_shutdown();
	/****************************************
	 * END OF JNI CODE
	 ****************************************/
	
	private GnomeVfs() {
	// prevent instantiation
	}
	
}