activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andytay...@apache.org
Subject [49/51] [abbrv] [partial] activemq-6 git commit: ACTIVEMQ6-4 - Rename packages to ActiveMQ
Date Tue, 11 Nov 2014 18:42:19 GMT
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffer.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffer.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffer.java
new file mode 100644
index 0000000..97fd810
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffer.java
@@ -0,0 +1,1084 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import java.nio.ByteBuffer;
+
+import io.netty.buffer.ByteBuf;
+
+/**
+ * A HornetQBuffer wraps a Netty's ChannelBuffer and is used throughout HornetQ code base.
+ * <p>
+ * Instances of it can be obtained from {@link HornetQBuffers} factory.
+ * <p>
+ * Much of it derived from Netty ChannelBuffer by Trustin Lee
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @see HornetQBuffers
+ */
+public interface HornetQBuffer
+{
+   /**
+    * Returns the underlying Netty's ByteBuf
+    *
+    * @return the underlying Netty's ByteBuf
+    */
+   ByteBuf byteBuf();
+
+   /**
+    * Returns the number of bytes this buffer can contain.
+    */
+   int capacity();
+
+   /**
+    * Returns the {@code readerIndex} of this buffer.
+    */
+   int readerIndex();
+
+   /**
+    * Sets the {@code readerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code readerIndex} is
+    *            less than {@code 0} or
+    *            greater than {@code this.writerIndex}
+    */
+   void readerIndex(int readerIndex);
+
+   /**
+    * Returns the {@code writerIndex} of this buffer.
+    */
+   int writerIndex();
+
+   /**
+    * Sets the {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code writerIndex} is
+    *            less than {@code this.readerIndex} or
+    *            greater than {@code this.capacity}
+    */
+   void writerIndex(int writerIndex);
+
+   /**
+    * Sets the {@code readerIndex} and {@code writerIndex} of this buffer
+    * in one shot.  This method is useful when you have to worry about the
+    * invocation order of {@link #readerIndex(int)} and {@link #writerIndex(int)}
+    * methods.  For example, the following code will fail:
+    *
+    * <pre>
+    * // Create a buffer whose readerIndex, writerIndex and capacity are
+    * // 0, 0 and 8 respectively.
+    * ChannelBuffer buf = ChannelBuffers.buffer(8);
+    *
+    * // IndexOutOfBoundsException is thrown because the specified
+    * // readerIndex (2) cannot be greater than the current writerIndex (0).
+    * buf.readerIndex(2);
+    * buf.writerIndex(4);
+    * </pre>
+    *
+    * The following code will also fail:
+    *
+    * <pre>
+    * // Create a buffer whose readerIndex, writerIndex and capacity are
+    * // 0, 8 and 8 respectively.
+    * ChannelBuffer buf = ChannelBuffers.wrappedBuffer(new byte[8]);
+    *
+    * // readerIndex becomes 8.
+    * buf.readLong();
+    *
+    * // IndexOutOfBoundsException is thrown because the specified
+    * // writerIndex (4) cannot be less than the current readerIndex (8).
+    * buf.writerIndex(4);
+    * buf.readerIndex(2);
+    * </pre>
+    *
+    * By contrast, {@link #setIndex(int, int)} guarantees that it never
+    * throws an {@link IndexOutOfBoundsException} as long as the specified
+    * indexes meet basic constraints, regardless what the current index
+    * values of the buffer are:
+    *
+    * <pre>
+    * // No matter what the current state of the buffer is, the following
+    * // call always succeeds as long as the capacity of the buffer is not
+    * // less than 4.
+    * buf.setIndex(2, 4);
+    * </pre>
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code readerIndex} is less than 0,
+    *         if the specified {@code writerIndex} is less than the specified
+    *         {@code readerIndex} or if the specified {@code writerIndex} is
+    *         greater than {@code this.capacity}
+    */
+   void setIndex(int readerIndex, int writerIndex);
+
+   /**
+    * Returns the number of readable bytes which is equal to
+    * {@code (this.writerIndex - this.readerIndex)}.
+    */
+   int readableBytes();
+
+   /**
+    * Returns the number of writable bytes which is equal to
+    * {@code (this.capacity - this.writerIndex)}.
+    */
+   int writableBytes();
+
+   /**
+    * Returns {@code true}
+    * if and only if {@code (this.writerIndex - this.readerIndex)} is greater
+    * than {@code 0}.
+    */
+   boolean readable();
+
+   /**
+    * Returns {@code true}
+    * if and only if {@code (this.capacity - this.writerIndex)} is greater
+    * than {@code 0}.
+    */
+   boolean writable();
+
+   /**
+    * Sets the {@code readerIndex} and {@code writerIndex} of this buffer to
+    * {@code 0}.
+    * This method is identical to {@link #setIndex(int, int) setIndex(0, 0)}.
+    * <p>
+    * Please note that the behavior of this method is different
+    * from that of NIO buffer, which sets the {@code limit} to
+    * the {@code capacity} of the buffer.
+    */
+   void clear();
+
+   /**
+    * Marks the current {@code readerIndex} in this buffer.  You can
+    * reposition the current {@code readerIndex} to the marked
+    * {@code readerIndex} by calling {@link #resetReaderIndex()}.
+    * The initial value of the marked {@code readerIndex} is {@code 0}.
+    */
+   void markReaderIndex();
+
+   /**
+    * Repositions the current {@code readerIndex} to the marked
+    * {@code readerIndex} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the current {@code writerIndex} is less than the marked
+    *         {@code readerIndex}
+    */
+   void resetReaderIndex();
+
+   /**
+    * Marks the current {@code writerIndex} in this buffer.  You can
+    * reposition the current {@code writerIndex} to the marked
+    * {@code writerIndex} by calling {@link #resetWriterIndex()}.
+    * The initial value of the marked {@code writerIndex} is {@code 0}.
+    */
+   void markWriterIndex();
+
+   /**
+    * Repositions the current {@code writerIndex} to the marked
+    * {@code writerIndex} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the current {@code readerIndex} is greater than the marked
+    *         {@code writerIndex}
+    */
+   void resetWriterIndex();
+
+   /**
+    * Discards the bytes between the 0th index and {@code readerIndex}.
+    * It moves the bytes between {@code readerIndex} and {@code writerIndex}
+    * to the 0th index, and sets {@code readerIndex} and {@code writerIndex}
+    * to {@code 0} and {@code oldWriterIndex - oldReaderIndex} respectively.
+    * <p>
+    * Please refer to the class documentation for more detailed explanation.
+    */
+   void discardReadBytes();
+
+   /**
+    * Gets a byte at the specified absolute {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 1} is greater than {@code this.capacity}
+    */
+   byte  getByte(int index);
+
+   /**
+    * Gets an unsigned byte at the specified absolute {@code index} in this
+    * buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 1} is greater than {@code this.capacity}
+    */
+   short getUnsignedByte(int index);
+
+   /**
+    * Gets a 16-bit short integer at the specified absolute {@code index} in
+    * this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 2} is greater than {@code this.capacity}
+    */
+   short getShort(int index);
+
+   /**
+    * Gets an unsigned 16-bit short integer at the specified absolute
+    * {@code index} in this buffer.  This method does not modify
+    * {@code readerIndex} or {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 2} is greater than {@code this.capacity}
+    */
+   int getUnsignedShort(int index);
+
+   /**
+    * Gets a 32-bit integer at the specified absolute {@code index} in
+    * this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 4} is greater than {@code this.capacity}
+    */
+   int   getInt(int index);
+
+   /**
+    * Gets an unsigned 32-bit integer at the specified absolute {@code index}
+    * in this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 4} is greater than {@code this.capacity}
+    */
+   long  getUnsignedInt(int index);
+
+   /**
+    * Gets a 64-bit long integer at the specified absolute {@code index} in
+    * this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 8} is greater than {@code this.capacity}
+    */
+   long  getLong(int index);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the specified absolute {@code index} until the destination becomes
+    * non-writable.  This method is basically same with
+    * {@link #getBytes(int, HornetQBuffer, int, int)}, except that this
+    * method increases the {@code writerIndex} of the destination by the
+    * number of the transferred bytes while
+    * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * the source buffer (i.e. {@code this}).
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         if {@code index + dst.writableBytes} is greater than
+    *            {@code this.capacity}
+    */
+   void getBytes(int index, HornetQBuffer dst);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the specified absolute {@code index}.  This method is basically same
+    * with {@link #getBytes(int, HornetQBuffer, int, int)}, except that this
+    * method increases the {@code writerIndex} of the destination by the
+    * number of the transferred bytes while
+    * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * the source buffer (i.e. {@code this}).
+    *
+    * @param length the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0},
+    *         if {@code index + length} is greater than
+    *            {@code this.capacity}, or
+    *         if {@code length} is greater than {@code dst.writableBytes}
+    */
+   void getBytes(int index, HornetQBuffer dst, int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the specified absolute {@code index}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex}
+    * of both the source (i.e. {@code this}) and the destination.
+    *
+    * @param dstIndex the first index of the destination
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0},
+    *         if the specified {@code dstIndex} is less than {@code 0},
+    *         if {@code index + length} is greater than
+    *            {@code this.capacity}, or
+    *         if {@code dstIndex + length} is greater than
+    *            {@code dst.capacity}
+    */
+   void getBytes(int index, HornetQBuffer dst, int dstIndex, int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the specified absolute {@code index}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         if {@code index + dst.length} is greater than
+    *            {@code this.capacity}
+    */
+   void getBytes(int index, byte[] dst);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the specified absolute {@code index}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex}
+    * of this buffer.
+    *
+    * @param dstIndex the first index of the destination
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0},
+    *         if the specified {@code dstIndex} is less than {@code 0},
+    *         if {@code index + length} is greater than
+    *            {@code this.capacity}, or
+    *         if {@code dstIndex + length} is greater than
+    *            {@code dst.length}
+    */
+   void getBytes(int index, byte[] dst, int dstIndex, int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the specified absolute {@code index} until the destination's position
+    * reaches its limit.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer while the destination's {@code position} will be increased.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         if {@code index + dst.remaining()} is greater than
+    *            {@code this.capacity}
+    */
+   void getBytes(int index, ByteBuffer dst);
+
+   /**
+    * Gets a char at the specified absolute {@code index} in
+    * this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 2} is greater than {@code this.capacity}
+    */
+   char getChar(int index);
+
+   /**
+    * Gets a float at the specified absolute {@code index} in
+    * this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 4} is greater than {@code this.capacity}
+    */
+   float getFloat(int index);
+
+   /**
+    * Gets a double at the specified absolute {@code index} in
+    * this buffer.  This method does not modify {@code readerIndex} or
+    * {@code writerIndex} of this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 8} is greater than {@code this.capacity}
+    */
+   double getDouble(int index);
+
+   /**
+    * Sets the specified byte at the specified absolute {@code index} in this
+    * buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 1} is greater than {@code this.capacity}
+    */
+   void setByte(int index, byte value);
+
+   /**
+    * Sets the specified 16-bit short integer at the specified absolute
+    * {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 2} is greater than {@code this.capacity}
+    */
+   void setShort(int index, short value);
+
+   /**
+    * Sets the specified 32-bit integer at the specified absolute
+    * {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 4} is greater than {@code this.capacity}
+    */
+   void setInt(int index, int value);
+
+   /**
+    * Sets the specified 64-bit long integer at the specified absolute
+    * {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 8} is greater than {@code this.capacity}
+    */
+   void setLong(int index, long value);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the specified absolute {@code index} until the destination becomes
+    * unreadable.  This method is basically same with
+    * {@link #setBytes(int, HornetQBuffer, int, int)}, except that this
+    * method increases the {@code readerIndex} of the source buffer by
+    * the number of the transferred bytes while
+    * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * the source buffer (i.e. {@code this}).
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         if {@code index + src.readableBytes} is greater than
+    *            {@code this.capacity}
+    */
+   void setBytes(int index, HornetQBuffer src);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the specified absolute {@code index}.  This method is basically same
+    * with {@link #setBytes(int, HornetQBuffer, int, int)}, except that this
+    * method increases the {@code readerIndex} of the source buffer by
+    * the number of the transferred bytes while
+    * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * the source buffer (i.e. {@code this}).
+    *
+    * @param length the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0},
+    *         if {@code index + length} is greater than
+    *            {@code this.capacity}, or
+    *         if {@code length} is greater than {@code src.readableBytes}
+    */
+   void setBytes(int index, HornetQBuffer src, int length);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the specified absolute {@code index}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex}
+    * of both the source (i.e. {@code this}) and the destination.
+    *
+    * @param srcIndex the first index of the source
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0},
+    *         if the specified {@code srcIndex} is less than {@code 0},
+    *         if {@code index + length} is greater than
+    *            {@code this.capacity}, or
+    *         if {@code srcIndex + length} is greater than
+    *            {@code src.capacity}
+    */
+   void setBytes(int index, HornetQBuffer src, int srcIndex, int length);
+
+   /**
+    * Transfers the specified source array's data to this buffer starting at
+    * the specified absolute {@code index}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         if {@code index + src.length} is greater than
+    *            {@code this.capacity}
+    */
+   void setBytes(int index, byte[] src);
+
+   /**
+    * Transfers the specified source array's data to this buffer starting at
+    * the specified absolute {@code index}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0},
+    *         if the specified {@code srcIndex} is less than {@code 0},
+    *         if {@code index + length} is greater than
+    *            {@code this.capacity}, or
+    *         if {@code srcIndex + length} is greater than {@code src.length}
+    */
+   void setBytes(int index, byte[] src, int srcIndex, int length);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the specified absolute {@code index} until the source buffer's position
+    * reaches its limit.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         if {@code index + src.remaining()} is greater than
+    *            {@code this.capacity}
+    */
+   void setBytes(int index, ByteBuffer src);
+
+   /**
+    * Sets the specified char at the specified absolute
+    * {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 2} is greater than {@code this.capacity}
+    */
+   void setChar(int index, char value);
+
+   /**
+    * Sets the specified float at the specified absolute
+    * {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 4} is greater than {@code this.capacity}
+    */
+   void setFloat(int index, float value);
+
+   /**
+    * Sets the specified double at the specified absolute
+    * {@code index} in this buffer.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code index} is less than {@code 0} or
+    *         {@code index + 8} is greater than {@code this.capacity}
+    */
+   void setDouble(int index, double value);
+
+   /**
+    * Gets a byte at the current {@code readerIndex} and increases
+    * the {@code readerIndex} by {@code 1} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 1}
+    */
+   byte readByte();
+
+   /**
+    * Gets an unsigned byte at the current {@code readerIndex} and increases
+    * the {@code readerIndex} by {@code 1} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 1}
+    */
+   short readUnsignedByte();
+
+   /**
+    * Gets a 16-bit short integer at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 2} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 2}
+    */
+   short readShort();
+
+   /**
+    * Gets an unsigned 16-bit short integer at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 2} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 2}
+    */
+   int   readUnsignedShort();
+
+   /**
+    * Gets a 32-bit integer at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 4} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 4}
+    */
+   int   readInt();
+
+   /**
+    * Gets an unsigned 32-bit integer at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 4} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 4}
+    */
+   long  readUnsignedInt();
+
+   /**
+    * Gets a 64-bit integer at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 8} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 8}
+    */
+   long  readLong();
+
+   /**
+    * Gets a char at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 2} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 2}
+    */
+   char readChar();
+
+   /**
+    * Gets a float at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 4} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 4}
+    */
+   float readFloat();
+
+   /**
+    * Gets a double at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 8} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 8}
+    */
+   double readDouble();
+
+   /**
+    * Gets a boolean at the current {@code readerIndex}
+    * and increases the {@code readerIndex} by {@code 1} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.readableBytes} is less than {@code 1}
+    */
+   boolean readBoolean();
+
+   /**
+    * Gets a SimpleString (potentially {@code null}) at the current {@code readerIndex}
+    */
+   SimpleString readNullableSimpleString();
+
+   /**
+    * Gets a String (potentially {@code null}) at the current {@code readerIndex}
+    */
+   String readNullableString();
+
+   /**
+    * Gets a non-null SimpleString at the current {@code readerIndex}
+    */
+   SimpleString readSimpleString();
+
+   /**
+    * Gets a non-null String at the current {@code readerIndex}
+    */
+   String readString();
+
+   /**
+    * Gets a UTF-8 String at the current {@code readerIndex}
+    */
+   String readUTF();
+
+   /**
+    * Transfers this buffer's data to a newly created buffer starting at
+    * the current {@code readerIndex} and increases the {@code readerIndex}
+    * by the number of the transferred bytes (= {@code length}).
+    * The returned buffer's {@code readerIndex} and {@code writerIndex} are
+    * {@code 0} and {@code length} respectively.
+    *
+    * @param length the number of bytes to transfer
+    *
+    * @return the newly created buffer which contains the transferred bytes
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code length} is greater than {@code this.readableBytes}
+    */
+   HornetQBuffer readBytes(int length);
+
+   /**
+    * Returns a new slice of this buffer's sub-region starting at the current
+    * {@code readerIndex} and increases the {@code readerIndex} by the size
+    * of the new slice (= {@code length}).
+    *
+    * @param length the size of the new slice
+    *
+    * @return the newly created slice
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code length} is greater than {@code this.readableBytes}
+    */
+   HornetQBuffer readSlice(int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the current {@code readerIndex} until the destination becomes
+    * non-writable, and increases the {@code readerIndex} by the number of the
+    * transferred bytes.  This method is basically same with
+    * {@link #readBytes(HornetQBuffer, int, int)}, except that this method
+    * increases the {@code writerIndex} of the destination by the number of
+    * the transferred bytes while {@link #readBytes(HornetQBuffer, int, int)}
+    * does not.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code dst.writableBytes} is greater than
+    *            {@code this.readableBytes}
+    */
+   void readBytes(HornetQBuffer dst);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the current {@code readerIndex} and increases the {@code readerIndex}
+    * by the number of the transferred bytes (= {@code length}).  This method
+    * is basically same with {@link #readBytes(HornetQBuffer, int, int)},
+    * except that this method increases the {@code writerIndex} of the
+    * destination by the number of the transferred bytes (= {@code length})
+    * while {@link #readBytes(HornetQBuffer, int, int)} does not.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code length} is greater than {@code this.readableBytes} or
+    *         if {@code length} is greater than {@code dst.writableBytes}
+    */
+   void readBytes(HornetQBuffer dst, int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the current {@code readerIndex} and increases the {@code readerIndex}
+    * by the number of the transferred bytes (= {@code length}).
+    *
+    * @param dstIndex the first index of the destination
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code dstIndex} is less than {@code 0},
+    *         if {@code length} is greater than {@code this.readableBytes}, or
+    *         if {@code dstIndex + length} is greater than
+    *            {@code dst.capacity}
+    */
+   void readBytes(HornetQBuffer dst, int dstIndex, int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the current {@code readerIndex} and increases the {@code readerIndex}
+    * by the number of the transferred bytes (= {@code dst.length}).
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code dst.length} is greater than {@code this.readableBytes}
+    */
+   void readBytes(byte[] dst);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the current {@code readerIndex} and increases the {@code readerIndex}
+    * by the number of the transferred bytes (= {@code length}).
+    *
+    * @param dstIndex the first index of the destination
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code dstIndex} is less than {@code 0},
+    *         if {@code length} is greater than {@code this.readableBytes}, or
+    *         if {@code dstIndex + length} is greater than {@code dst.length}
+    */
+   void readBytes(byte[] dst, int dstIndex, int length);
+
+   /**
+    * Transfers this buffer's data to the specified destination starting at
+    * the current {@code readerIndex} until the destination's position
+    * reaches its limit, and increases the {@code readerIndex} by the
+    * number of the transferred bytes.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code dst.remaining()} is greater than
+    *            {@code this.readableBytes}
+    */
+   void readBytes(ByteBuffer dst);
+
+   /**
+    * Increases the current {@code readerIndex} by the specified
+    * {@code length} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code length} is greater than {@code this.readableBytes}
+    */
+   void skipBytes(int length);
+
+   /**
+    * Sets the specified byte at the current {@code writerIndex}
+    * and increases the {@code writerIndex} by {@code 1} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 1}
+    */
+   void writeByte(byte  value);
+
+   /**
+    * Sets the specified 16-bit short integer at the current
+    * {@code writerIndex} and increases the {@code writerIndex} by {@code 2}
+    * in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 2}
+    */
+   void writeShort(short value);
+
+   /**
+    * Sets the specified 32-bit integer at the current {@code writerIndex}
+    * and increases the {@code writerIndex} by {@code 4} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 4}
+    */
+   void writeInt(int   value);
+
+   /**
+    * Sets the specified 64-bit long integer at the current
+    * {@code writerIndex} and increases the {@code writerIndex} by {@code 8}
+    * in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 8}
+    */
+   void writeLong(long  value);
+
+   /**
+    * Sets the specified char at the current {@code writerIndex}
+    * and increases the {@code writerIndex} by {@code 2} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 2}
+    */
+   void writeChar(char chr);
+
+   /**
+    * Sets the specified float at the current {@code writerIndex}
+    * and increases the {@code writerIndex} by {@code 4} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 4}
+    */
+   void writeFloat(float value);
+
+   /**
+    * Sets the specified double at the current {@code writerIndex}
+    * and increases the {@code writerIndex} by {@code 8} in this buffer.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code this.writableBytes} is less than {@code 8}
+    */
+   void writeDouble(double value);
+
+   /**
+    * Sets the specified boolean at the current {@code writerIndex}
+    */
+   void writeBoolean(boolean val);
+
+   /**
+    * Sets the specified SimpleString (potentially {@code null}) at the current {@code writerIndex}
+    */
+   void writeNullableSimpleString(SimpleString val);
+
+   /**
+    * Sets the specified String (potentially {@code null}) at the current {@code writerIndex}
+    */
+   void writeNullableString(String val);
+
+   /**
+    * Sets the specified non-null SimpleString at the current {@code writerIndex}
+    */
+   void writeSimpleString(SimpleString val);
+
+   /**
+    * Sets the specified non-null String at the current {@code writerIndex}
+    */
+   void writeString(String val);
+
+   /**
+    * Sets the specified UTF-8 String at the current {@code writerIndex}
+    */
+
+   void writeUTF(String utf);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the current {@code writerIndex} and increases the {@code writerIndex}
+    * by the number of the transferred bytes (= {@code length}).  This method
+    * is basically same with {@link #writeBytes(HornetQBuffer, int, int)},
+    * except that this method increases the {@code readerIndex} of the source
+    * buffer by the number of the transferred bytes (= {@code length}) while
+    * {@link #writeBytes(HornetQBuffer, int, int)} does not.
+    *
+    * @param length the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code length} is greater than {@code this.writableBytes} or
+    *         if {@code length} is greater then {@code src.readableBytes}
+    */
+   void writeBytes(HornetQBuffer src, int length);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the current {@code writerIndex} and increases the {@code writerIndex}
+    * by the number of the transferred bytes (= {@code length}).
+    *
+    * @param srcIndex the first index of the source
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code srcIndex} is less than {@code 0},
+    *         if {@code srcIndex + length} is greater than
+    *            {@code src.capacity}, or
+    *         if {@code length} is greater than {@code this.writableBytes}
+    */
+   void writeBytes(HornetQBuffer src, int srcIndex, int length);
+
+   /**
+    * Transfers the specified source array's data to this buffer starting at
+    * the current {@code writerIndex} and increases the {@code writerIndex}
+    * by the number of the transferred bytes (= {@code src.length}).
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code src.length} is greater than {@code this.writableBytes}
+    */
+   void writeBytes(byte[] src);
+
+   /**
+    * Transfers the specified source array's data to this buffer starting at
+    * the current {@code writerIndex} and increases the {@code writerIndex}
+    * by the number of the transferred bytes (= {@code length}).
+    *
+    * @param srcIndex the first index of the source
+    * @param length   the number of bytes to transfer
+    *
+    * @throws IndexOutOfBoundsException
+    *         if the specified {@code srcIndex} is less than {@code 0},
+    *         if {@code srcIndex + length} is greater than
+    *            {@code src.length}, or
+    *         if {@code length} is greater than {@code this.writableBytes}
+    */
+   void writeBytes(byte[] src, int srcIndex, int length);
+
+   /**
+    * Transfers the specified source buffer's data to this buffer starting at
+    * the current {@code writerIndex} until the source buffer's position
+    * reaches its limit, and increases the {@code writerIndex} by the
+    * number of the transferred bytes.
+    *
+    * @throws IndexOutOfBoundsException
+    *         if {@code src.remaining()} is greater than
+    *            {@code this.writableBytes}
+    */
+   void writeBytes(ByteBuffer src);
+
+   /**
+    * Returns a copy of this buffer's readable bytes.  Modifying the content
+    * of the returned buffer or this buffer does not affect each other at all.
+    * This method is identical to {@code buf.copy(buf.readerIndex(), buf.readableBytes())}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    *
+    */
+   HornetQBuffer copy();
+
+   /**
+    * Returns a copy of this buffer's sub-region.  Modifying the content of
+    * the returned buffer or this buffer does not affect each other at all.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    */
+   HornetQBuffer copy(int index, int length);
+
+   /**
+    * Returns a slice of this buffer's readable bytes. Modifying the content
+    * of the returned buffer or this buffer affects each other's content
+    * while they maintain separate indexes and marks.  This method is
+    * identical to {@code buf.slice(buf.readerIndex(), buf.readableBytes())}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    */
+   HornetQBuffer slice();
+
+   /**
+    * Returns a slice of this buffer's sub-region. Modifying the content of
+    * the returned buffer or this buffer affects each other's content while
+    * they maintain separate indexes and marks.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    */
+   HornetQBuffer slice(int index, int length);
+
+   /**
+    * Returns a buffer which shares the whole region of this buffer.
+    * Modifying the content of the returned buffer or this buffer affects
+    * each other's content while they maintain separate indexes and marks.
+    * This method is identical to {@code buf.slice(0, buf.capacity())}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    */
+   HornetQBuffer duplicate();
+
+   /**
+    * Converts this buffer's readable bytes into a NIO buffer.  The returned
+    * buffer might or might not share the content with this buffer, while
+    * they have separate indexes and marks.  This method is identical to
+    * {@code buf.toByteBuffer(buf.readerIndex(), buf.readableBytes())}.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    */
+   ByteBuffer toByteBuffer();
+
+   /**
+    * Converts this buffer's sub-region into a NIO buffer.  The returned
+    * buffer might or might not share the content with this buffer, while
+    * they have separate indexes and marks.
+    * This method does not modify {@code readerIndex} or {@code writerIndex} of
+    * this buffer.
+    */
+   ByteBuffer toByteBuffer(int index, int length);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffers.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffers.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffers.java
new file mode 100644
index 0000000..18e3a6c
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQBuffers.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import java.nio.ByteBuffer;
+
+import io.netty.buffer.Unpooled;
+import org.apache.activemq6.core.buffers.impl.ChannelBufferWrapper;
+
+/**
+ * Factory class to create instances of {@link HornetQBuffer}.
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ */
+public final class HornetQBuffers
+{
+   /**
+    * Creates a <em>self-expanding</em> HornetQBuffer with the given initial size
+    *
+    * @param size the initial size of the created HornetQBuffer
+    * @return a self-expanding HornetQBuffer starting with the given size
+    */
+   public static HornetQBuffer dynamicBuffer(final int size)
+   {
+      return new ChannelBufferWrapper(Unpooled.buffer(size));
+   }
+
+   /**
+    * Creates a <em>self-expanding</em> HornetQBuffer filled with the given byte array
+    *
+    * @param bytes the created buffer will be initially filled with this byte array
+    * @return a self-expanding HornetQBuffer filled with the given byte array
+    */
+   public static HornetQBuffer dynamicBuffer(final byte[] bytes)
+   {
+      HornetQBuffer buff = dynamicBuffer(bytes.length);
+
+      buff.writeBytes(bytes);
+
+      return buff;
+   }
+
+   /**
+    * Creates a HornetQBuffer wrapping an underlying NIO ByteBuffer
+    *
+    * The position on this buffer won't affect the position on the inner buffer
+    *
+    * @param underlying the underlying NIO ByteBuffer
+    * @return a HornetQBuffer wrapping the underlying NIO ByteBuffer
+    */
+   public static HornetQBuffer wrappedBuffer(final ByteBuffer underlying)
+   {
+      HornetQBuffer buff = new ChannelBufferWrapper(Unpooled.wrappedBuffer(underlying));
+
+      buff.clear();
+
+      return buff;
+   }
+
+   /**
+    * Creates a HornetQBuffer wrapping an underlying byte array
+    *
+    * @param underlying the underlying byte array
+    * @return a HornetQBuffer wrapping the underlying byte array
+    */
+   public static HornetQBuffer wrappedBuffer(final byte[] underlying)
+   {
+      return new ChannelBufferWrapper(Unpooled.wrappedBuffer(underlying));
+   }
+
+   /**
+    * Creates a <em>fixed</em> HornetQBuffer of the given size
+    *
+    * @param size the size of the created HornetQBuffer
+    * @return a fixed HornetQBuffer with the given size
+    */
+   public static HornetQBuffer fixedBuffer(final int size)
+   {
+      return new ChannelBufferWrapper(Unpooled.buffer(size, size));
+   }
+
+   private HornetQBuffers()
+   {
+      // Utility class
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQClusterSecurityException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQClusterSecurityException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQClusterSecurityException.java
new file mode 100644
index 0000000..b75957a
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQClusterSecurityException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+/**
+ * Security exception thrown when the cluster user fails authentication.
+ */
+public final class HornetQClusterSecurityException extends HornetQException
+{
+   private static final long serialVersionUID = -5890578849781297933L;
+
+   public HornetQClusterSecurityException()
+   {
+      super(HornetQExceptionType.CLUSTER_SECURITY_EXCEPTION);
+   }
+
+   public HornetQClusterSecurityException(final String msg)
+   {
+      super(HornetQExceptionType.CLUSTER_SECURITY_EXCEPTION, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQConnectionTimedOutException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQConnectionTimedOutException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQConnectionTimedOutException.java
new file mode 100644
index 0000000..ff440da
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQConnectionTimedOutException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.CONNECTION_TIMEDOUT;
+
+/**
+ * A client timed out will connecting to HornetQ server.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQConnectionTimedOutException extends HornetQException
+{
+   private static final long serialVersionUID = 3244233758084830372L;
+
+   public HornetQConnectionTimedOutException()
+   {
+      super(CONNECTION_TIMEDOUT);
+   }
+
+   public HornetQConnectionTimedOutException(String msg)
+   {
+      super(CONNECTION_TIMEDOUT, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDisconnectedException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDisconnectedException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDisconnectedException.java
new file mode 100644
index 0000000..6c7d6d2
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDisconnectedException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.DISCONNECTED;
+
+/**
+ * A client was disconnected from HornetQ server when the server has shut down.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQDisconnectedException extends HornetQException
+{
+   private static final long serialVersionUID = 7414966383933311627L;
+
+   public HornetQDisconnectedException()
+   {
+      super(DISCONNECTED);
+   }
+
+   public HornetQDisconnectedException(String message)
+   {
+      super(DISCONNECTED, message);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateIdException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateIdException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateIdException.java
new file mode 100644
index 0000000..f4cc95d
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateIdException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.DUPLICATE_ID_REJECTED;
+
+/**
+ * A DuplicateID was rejected.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 5/2/12
+ */
+public final class HornetQDuplicateIdException extends HornetQException
+{
+   private static final long serialVersionUID = -4302979339865777119L;
+
+   public HornetQDuplicateIdException()
+   {
+      super(DUPLICATE_ID_REJECTED);
+   }
+
+   public HornetQDuplicateIdException(String message)
+   {
+      super(DUPLICATE_ID_REJECTED, message);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateMetaDataException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateMetaDataException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateMetaDataException.java
new file mode 100644
index 0000000..d1bdd83
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQDuplicateMetaDataException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.DUPLICATE_METADATA;
+
+/**
+ * A Session Metadata was set in duplication
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 5/2/12
+ */
+public final class HornetQDuplicateMetaDataException extends HornetQException
+{
+   private static final long serialVersionUID = 7877182872143004058L;
+
+   public HornetQDuplicateMetaDataException()
+   {
+      super(DUPLICATE_METADATA);
+   }
+
+   public HornetQDuplicateMetaDataException(String msg)
+   {
+      super(DUPLICATE_METADATA, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQException.java
new file mode 100644
index 0000000..ec93477
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQException.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core;
+
+/**
+ * HornetQException is the root exception for the HornetQ API.
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class HornetQException extends Exception
+{
+   private static final long serialVersionUID = -4802014152804997417L;
+
+   private final HornetQExceptionType type;
+
+   public HornetQException()
+   {
+      type = HornetQExceptionType.GENERIC_EXCEPTION;
+   }
+
+   public HornetQException(final String msg)
+   {
+      super(msg);
+      type = HornetQExceptionType.GENERIC_EXCEPTION;
+   }
+
+   /*
+   * This constructor is needed only for the native layer
+   */
+   public HornetQException(int code, String msg)
+   {
+      super(msg);
+
+      this.type = HornetQExceptionType.getType(code);
+   }
+
+   public HornetQException(HornetQExceptionType type, String msg)
+   {
+      super(msg);
+
+      this.type = type;
+   }
+
+   public HornetQException(HornetQExceptionType type)
+   {
+      this.type = type;
+   }
+
+   public HornetQException(HornetQExceptionType type, String message, Throwable t)
+   {
+      super(message, t);
+      this.type = type;
+   }
+
+   public HornetQExceptionType getType()
+   {
+      return type;
+   }
+
+   @Override
+   public String toString()
+   {
+      return this.getClass().getSimpleName() + "[errorType=" + type + " message=" + getMessage() + "]";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQExceptionType.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQExceptionType.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQExceptionType.java
new file mode 100644
index 0000000..c30890d
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQExceptionType.java
@@ -0,0 +1,298 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Defines all {@link HornetQException} types and their codes.
+ */
+public enum HornetQExceptionType
+{
+
+   // Error codes -------------------------------------------------
+
+   INTERNAL_ERROR(000)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQInternalErrorException(msg);
+      }
+   },
+   UNSUPPORTED_PACKET(001)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQUnsupportedPacketException(msg);
+      }
+   },
+   NOT_CONNECTED(002)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQNotConnectedException(msg);
+      }
+   },
+   CONNECTION_TIMEDOUT(003)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQConnectionTimedOutException(msg);
+      }
+   },
+   DISCONNECTED(004)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQDisconnectedException(msg);
+      }
+   },
+   UNBLOCKED(005)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQUnBlockedException(msg);
+      }
+   },
+   IO_ERROR(006)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQIOErrorException(msg);
+      }
+   },
+   QUEUE_DOES_NOT_EXIST(100)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQNonExistentQueueException(msg);
+      }
+   },
+   QUEUE_EXISTS(101)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQQueueExistsException(msg);
+      }
+   },
+   OBJECT_CLOSED(102)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQObjectClosedException(msg);
+      }
+   },
+   INVALID_FILTER_EXPRESSION(103)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQInvalidFilterExpressionException(msg);
+      }
+   },
+   ILLEGAL_STATE(104)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQIllegalStateException(msg);
+      }
+   },
+   SECURITY_EXCEPTION(105)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQSecurityException(msg);
+      }
+   },
+   ADDRESS_EXISTS(107)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQAddressExistsException(msg);
+      }
+   },
+   INCOMPATIBLE_CLIENT_SERVER_VERSIONS(108)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQIncompatibleClientServerException(msg);
+      }
+   },
+   LARGE_MESSAGE_ERROR_BODY(110)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQLargeMessageException(msg);
+      }
+   },
+   TRANSACTION_ROLLED_BACK(111)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQTransactionRolledBackException(msg);
+      }
+   },
+   SESSION_CREATION_REJECTED(112)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQSessionCreationException(msg);
+      }
+   },
+   DUPLICATE_ID_REJECTED(113)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQDuplicateIdException(msg);
+      }
+   },
+   DUPLICATE_METADATA(114)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQDuplicateMetaDataException(msg);
+      }
+   },
+   TRANSACTION_OUTCOME_UNKNOWN(115)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQTransactionOutcomeUnknownException(msg);
+      }
+   },
+   ALREADY_REPLICATING(116)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQAlreadyReplicatingException(msg);
+      }
+   },
+   INTERCEPTOR_REJECTED_PACKET(117)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQInterceptorRejectedPacketException(msg);
+      }
+   },
+   INVALID_TRANSIENT_QUEUE_USE(118)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQInvalidTransientQueueUseException(msg);
+      }
+   },
+
+   GENERIC_EXCEPTION(999),
+   NATIVE_ERROR_INTERNAL(200),
+   NATIVE_ERROR_INVALID_BUFFER(201),
+   NATIVE_ERROR_NOT_ALIGNED(202),
+   NATIVE_ERROR_CANT_INITIALIZE_AIO(203),
+   NATIVE_ERROR_CANT_RELEASE_AIO(204),
+   NATIVE_ERROR_CANT_OPEN_CLOSE_FILE(205),
+   NATIVE_ERROR_CANT_ALLOCATE_QUEUE(206),
+   NATIVE_ERROR_PREALLOCATE_FILE(208),
+   NATIVE_ERROR_ALLOCATE_MEMORY(209),
+   ADDRESS_FULL(210)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQAddressFullException(msg);
+      }
+   },
+   LARGE_MESSAGE_INTERRUPTED(211)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQLargeMessageInterruptedException(msg);
+      }
+   },
+   CLUSTER_SECURITY_EXCEPTION(212)
+   {
+      @Override
+      public HornetQException createException(String msg)
+      {
+         return new HornetQClusterSecurityException(msg);
+      }
+
+   };
+
+   private static final Map<Integer, HornetQExceptionType> TYPE_MAP;
+
+   static
+   {
+      HashMap<Integer, HornetQExceptionType> map = new HashMap<Integer, HornetQExceptionType>();
+      for (HornetQExceptionType type : EnumSet.allOf(HornetQExceptionType.class))
+      {
+         map.put(type.getCode(), type);
+      }
+      TYPE_MAP = Collections.unmodifiableMap(map);
+   }
+
+   private final int code;
+
+   HornetQExceptionType(int code)
+   {
+      this.code = code;
+   }
+
+   public int getCode()
+   {
+      return code;
+   }
+
+   public HornetQException createException(String msg)
+   {
+      return new HornetQException(msg + ", code:" + this);
+   }
+
+   public static HornetQException createException(int code, String msg)
+   {
+      return getType(code).createException(msg);
+   }
+
+   public static HornetQExceptionType getType(int code)
+   {
+      HornetQExceptionType type = TYPE_MAP.get(code);
+      if (type != null)
+         return type;
+      return HornetQExceptionType.GENERIC_EXCEPTION;
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIOErrorException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIOErrorException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIOErrorException.java
new file mode 100644
index 0000000..c68da1a
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIOErrorException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.IO_ERROR;
+
+/**
+ * Unexpected I/O error occurred on the server.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQIOErrorException extends HornetQException
+{
+   private static final long serialVersionUID = 797277117077787396L;
+
+   public HornetQIOErrorException()
+   {
+      super(IO_ERROR);
+   }
+
+   public HornetQIOErrorException(String msg)
+   {
+      super(IO_ERROR, msg);
+   }
+
+   public HornetQIOErrorException(String msg, Throwable cause)
+   {
+      super(IO_ERROR, msg, cause);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIllegalStateException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIllegalStateException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIllegalStateException.java
new file mode 100644
index 0000000..570a9d2
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIllegalStateException.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.ILLEGAL_STATE;
+
+/**
+ * A HornetQ resource is not in a legal state (e.g. calling ClientConsumer.receive() if a
+ * MessageHandler is set).
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 5/2/12
+ */
+public final class HornetQIllegalStateException extends HornetQException
+{
+   private static final long serialVersionUID = -4480125401057788511L;
+
+   public HornetQIllegalStateException()
+   {
+      super(ILLEGAL_STATE);
+   }
+
+   public HornetQIllegalStateException(String message)
+   {
+      super(ILLEGAL_STATE, message);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIncompatibleClientServerException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIncompatibleClientServerException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIncompatibleClientServerException.java
new file mode 100644
index 0000000..087c341
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQIncompatibleClientServerException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS;
+
+/**
+ * The server version and the client version are incompatible.
+ * <p>
+ * Normally this means you are trying to use a newer client on an older server.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public final class HornetQIncompatibleClientServerException extends HornetQException
+{
+   private static final long serialVersionUID = -1662999230291452298L;
+
+   public HornetQIncompatibleClientServerException()
+   {
+      super(INCOMPATIBLE_CLIENT_SERVER_VERSIONS);
+   }
+
+   public HornetQIncompatibleClientServerException(String msg)
+   {
+      super(INCOMPATIBLE_CLIENT_SERVER_VERSIONS, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterceptorRejectedPacketException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterceptorRejectedPacketException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterceptorRejectedPacketException.java
new file mode 100644
index 0000000..e426d63
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterceptorRejectedPacketException.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.INTERCEPTOR_REJECTED_PACKET;
+
+/**
+ * An outgoing interceptor returned false.
+ * @see org.apache.activemq6.api.core.client.ServerLocator#addOutgoingInterceptor(org.hornetq.api.core.Interceptor)
+ * @author Justin Bertram
+ */
+// XXX I doubt any reader will make much sense of this Javadoc's text.
+public final class HornetQInterceptorRejectedPacketException extends HornetQException
+{
+   private static final long serialVersionUID = -5798841227645281815L;
+
+   public HornetQInterceptorRejectedPacketException()
+   {
+      super(INTERCEPTOR_REJECTED_PACKET);
+   }
+
+   public HornetQInterceptorRejectedPacketException(String msg)
+   {
+      super(INTERCEPTOR_REJECTED_PACKET, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInternalErrorException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInternalErrorException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInternalErrorException.java
new file mode 100644
index 0000000..d52a5ff
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInternalErrorException.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.INTERNAL_ERROR;
+
+/**
+ * Internal error which prevented HornetQ from performing an important operation.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQInternalErrorException extends HornetQException
+{
+   private static final long serialVersionUID = -5987814047521530695L;
+
+   public HornetQInternalErrorException()
+   {
+      super(INTERNAL_ERROR);
+   }
+
+   public HornetQInternalErrorException(String msg)
+   {
+      super(INTERNAL_ERROR, msg);
+   }
+
+   public HornetQInternalErrorException(String message, Exception e)
+   {
+      super(INTERNAL_ERROR, message, e);
+   }
+
+   public HornetQInternalErrorException(String message, Throwable t)
+   {
+      super(INTERNAL_ERROR, message, t);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterruptedException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterruptedException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterruptedException.java
new file mode 100644
index 0000000..c6575cf
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInterruptedException.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core;
+
+/**
+ * When an interruption happens, we will just throw a non-checked exception.
+ * @author clebertsuconic
+ */
+public final class HornetQInterruptedException extends RuntimeException
+{
+   private static final long serialVersionUID = -5744690023549671221L;
+
+   public HornetQInterruptedException(Throwable cause)
+   {
+      super(cause);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidFilterExpressionException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidFilterExpressionException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidFilterExpressionException.java
new file mode 100644
index 0000000..fd8d44b
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidFilterExpressionException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.INVALID_FILTER_EXPRESSION;
+
+/**
+ * A filter expression was found to be invalid.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQInvalidFilterExpressionException extends HornetQException
+{
+   private static final long serialVersionUID = 7188625553939665128L;
+
+   public HornetQInvalidFilterExpressionException()
+   {
+      super(INVALID_FILTER_EXPRESSION);
+   }
+
+   public HornetQInvalidFilterExpressionException(String msg)
+   {
+      super(INVALID_FILTER_EXPRESSION, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidTransientQueueUseException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidTransientQueueUseException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidTransientQueueUseException.java
new file mode 100644
index 0000000..44c474a
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQInvalidTransientQueueUseException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.INVALID_TRANSIENT_QUEUE_USE;
+
+/**
+ * An operation failed because a queue exists on the server.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQInvalidTransientQueueUseException extends HornetQException
+{
+   private static final long serialVersionUID = -405552292451883063L;
+
+   public HornetQInvalidTransientQueueUseException()
+   {
+      super(INVALID_TRANSIENT_QUEUE_USE);
+   }
+
+   public HornetQInvalidTransientQueueUseException(String msg)
+   {
+      super(INVALID_TRANSIENT_QUEUE_USE, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageException.java
new file mode 100644
index 0000000..6735403
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.LARGE_MESSAGE_ERROR_BODY;
+
+/**
+ * A problem occurred while manipulating the body of a large message.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 5/2/12
+ */
+public final class HornetQLargeMessageException extends HornetQException
+{
+   private static final long serialVersionUID = 1087867463974768491L;
+
+   public HornetQLargeMessageException()
+   {
+      super(LARGE_MESSAGE_ERROR_BODY);
+   }
+
+   public HornetQLargeMessageException(String msg)
+   {
+      super(LARGE_MESSAGE_ERROR_BODY, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageInterruptedException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageInterruptedException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageInterruptedException.java
new file mode 100644
index 0000000..0c8334b
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQLargeMessageInterruptedException.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.LARGE_MESSAGE_INTERRUPTED;
+
+/**
+ * @author Clebert
+ */
+// XXX
+public class HornetQLargeMessageInterruptedException extends HornetQException
+{
+   private static final long serialVersionUID = 0;
+
+   public HornetQLargeMessageInterruptedException(String message)
+   {
+      super(LARGE_MESSAGE_INTERRUPTED, message);
+   }
+
+   public HornetQLargeMessageInterruptedException()
+   {
+      super(LARGE_MESSAGE_INTERRUPTED);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNativeIOError.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNativeIOError.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNativeIOError.java
new file mode 100644
index 0000000..eb821a2
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNativeIOError.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+
+/**
+ * An error has happened at HornetQ's native (non-Java) code used in reading and writing data.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 5/4/12
+ */
+// XXX
+public final class HornetQNativeIOError extends HornetQException
+{
+   private static final long serialVersionUID = 2355120980683293085L;
+
+   public HornetQNativeIOError()
+   {
+      super(HornetQExceptionType.NATIVE_ERROR_CANT_INITIALIZE_AIO);
+   }
+
+   public HornetQNativeIOError(String msg)
+   {
+      super(HornetQExceptionType.NATIVE_ERROR_CANT_INITIALIZE_AIO, msg);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNonExistentQueueException.java
----------------------------------------------------------------------
diff --git a/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNonExistentQueueException.java b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNonExistentQueueException.java
new file mode 100644
index 0000000..2b33353
--- /dev/null
+++ b/activemq6-commons/src/main/java/org/apache/activemq6/api/core/HornetQNonExistentQueueException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.apache.activemq6.api.core;
+
+import static org.apache.activemq6.api.core.HornetQExceptionType.QUEUE_DOES_NOT_EXIST;
+
+/**
+ * An operation failed because a queue does not exist on the server.
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a> 4/30/12
+ */
+public final class HornetQNonExistentQueueException extends HornetQException
+{
+   private static final long serialVersionUID = -8199298881947523607L;
+
+   public HornetQNonExistentQueueException()
+   {
+      super(QUEUE_DOES_NOT_EXIST);
+   }
+
+   public HornetQNonExistentQueueException(String msg)
+   {
+      super(QUEUE_DOES_NOT_EXIST, msg);
+   }
+}


Mime
View raw message