/*******************************************************************************
 * Copyright (c) 
 ******************************************************************************/
package org.fossil_scm.libfossil;



/**
 * The wrapper for a Checkout
 */
public class Checkout {

	public static int NESTED = 1;
	public static int CREATE = 2;

	long handle;

	static {
	  System.loadLibrary("libfossil");
	}

	/**
	 * The constructor
	 * 
	 */
	public Checkout(String dir, int flags) {
		handle = open(dir, flags);
	}

	public synchronized void finalize() {
		if( handle != 0 ){
			dispose(handle);
		}
		handle = 0;
	}

	public synchronized void dispose() {
		if( handle != 0 ){
			dispose(handle);
		}
		handle = 0;
	}

	private static native long open(String dir, int flags);
	private static native void dispose(long handle);

}
