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

package org.apache.camel.component.msmq.native_support;

public class MsmqQueue {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected MsmqQueue(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

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

  protected void finalize() {
    delete();
  }

  public void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      msmq_native_supportJNI.delete_MsmqQueue(swigCPtr);
    }
    swigCPtr = 0;
  }

  public MsmqQueue() {
    this(msmq_native_supportJNI.new_MsmqQueue(), true);
  }

  public void open(String szMSMQQueuePath, int openmode) {
    msmq_native_supportJNI.MsmqQueue_open(swigCPtr, szMSMQQueuePath, openmode);
  }

  public void sendMessage(MsmqMessage msg) {
    msmq_native_supportJNI.MsmqQueue_sendMessage(swigCPtr, MsmqMessage.getCPtr(msg));
  }

  public boolean receiveMessage(MsmqMessage msg, int timeout) {
    return msmq_native_supportJNI.MsmqQueue_receiveMessage(swigCPtr, MsmqMessage.getCPtr(msg), timeout);
  }

  public void close() {
    msmq_native_supportJNI.MsmqQueue_close(swigCPtr);
  }

  public boolean isOpen() {
    return msmq_native_supportJNI.MsmqQueue_isOpen(swigCPtr);
  }

  public static void createQueue(String pathName) {
    msmq_native_supportJNI.MsmqQueue_createQueue(pathName);
  }

  public static void deleteQueue(String formatPathName) {
    msmq_native_supportJNI.MsmqQueue_deleteQueue(formatPathName);
  }

}
