/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.10
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.wiredtiger.db;

/**
  * @copydoc WT_SESSION
  * @ingroup wt_java
  */
public class Session {
 private long swigCPtr;
 protected boolean swigCMemOwn;

 protected Session(long cPtr, boolean cMemoryOwn) {
   swigCMemOwn = cMemoryOwn;
   swigCPtr = cPtr;
   wiredtigerJNI.Session__java_init(swigCPtr, this, this);
 }

 protected static long getCPtr(Session obj) {
   return (obj == null) ? 0 : obj.swigCPtr;
 }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        throw new UnsupportedOperationException("C++ destructor does not have public access");
      }
      swigCPtr = 0;
    }
  }

  public Connection getConnection() {
    long cPtr = wiredtigerJNI.Session_connection_get(swigCPtr, this);
    return (cPtr == 0) ? null : new Connection(cPtr, false);
  }

  
  /**
   * @copydoc WT_SESSION::close
   */
  public  int close(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_close(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::reconfigure
   */
  public  int reconfigure(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_reconfigure(swigCPtr, this, config);
  }

  public String strerror(int error) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_strerror(swigCPtr, this, error);
  }

  
  /**
   * @copydoc WT_SESSION::alter
   */
  public  int alter(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_alter(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::create
   */
  public  int create(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_create(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::compact
   */
  public  int compact(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_compact(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::drop
   */
  public  int drop(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_drop(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::join
   */
  public  int join(Cursor join_cursor, Cursor ref_cursor, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_join(swigCPtr, this, Cursor.getCPtr(join_cursor), join_cursor, Cursor.getCPtr(ref_cursor), ref_cursor, config);
  }

  
  /**
   * @copydoc WT_SESSION::log_flush
   */
  public  int log_flush(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_log_flush(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::log_printf
   */
  public  int log_printf(String format) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_log_printf(swigCPtr, this, format);
  }

  
  /**
   * @copydoc WT_SESSION::rebalance
   */
  public  int rebalance(String uri, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_rebalance(swigCPtr, this, uri, config);
  }

  
  /**
   * @copydoc WT_SESSION::rename
   */
  public  int rename(String uri, String newuri, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_rename(swigCPtr, this, uri, newuri, config);
  }

  
  /**
   * @copydoc WT_SESSION::reset
   */
  public  int reset() throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_reset(swigCPtr, this);
  }

  
  /**
   * @copydoc WT_SESSION::salvage
   */
  public  int salvage(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_salvage(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::truncate
   */
  public  int truncate(String name, Cursor start, Cursor stop, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_truncate(swigCPtr, this, name, Cursor.getCPtr(start), start, Cursor.getCPtr(stop), stop, config);
  }

  
  /**
   * @copydoc WT_SESSION::upgrade
   */
  public  int upgrade(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_upgrade(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::verify
   */
  public  int verify(String name, String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_verify(swigCPtr, this, name, config);
  }

  
  /**
   * @copydoc WT_SESSION::begin_transaction
   */
  public  int begin_transaction(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_begin_transaction(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::commit_transaction
   */
  public  int commit_transaction(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_commit_transaction(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::prepare_transaction
   */
  public  int prepare_transaction(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_prepare_transaction(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::rollback_transaction
   */
  public  int rollback_transaction(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_rollback_transaction(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::timestamp_transaction
   */
  public  int timestamp_transaction(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_timestamp_transaction(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::checkpoint
   */
  public  int checkpoint(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_checkpoint(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::snapshot
   */
  public  int snapshot(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_snapshot(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::transaction_sync
   */
  public  int transaction_sync(String config) throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_transaction_sync(swigCPtr, this, config);
  }

  
  /**
   * @copydoc WT_SESSION::breakpoint
   */
  public  int breakpoint() throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_breakpoint(swigCPtr, this);
  }

  protected int _java_init(Object jsess) {
    return wiredtigerJNI.Session__java_init(swigCPtr, this, jsess);
  }

  
  /**
   * @copydoc WT_SESSION::open_cursor
   */
  public  Cursor open_cursor(String uri, Cursor to_dup, String config) throws com.wiredtiger.db.WiredTigerException {
    long cPtr = wiredtigerJNI.Session_open_cursor(swigCPtr, this, uri, Cursor.getCPtr(to_dup), to_dup, config);
    return (cPtr == 0) ? null : new Cursor(cPtr, false);
  }

  
  /**
   * @copydoc WT_SESSION::transaction_pinned_range
   */
  public  int transaction_pinned_range() throws com.wiredtiger.db.WiredTigerException {
    return wiredtigerJNI.Session_transaction_pinned_range(swigCPtr, this);
  }

}
