Repository: activemq-artemis
Updated Branches:
  refs/heads/master aab09a77d -> a8c4ebd6a


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/GroupingEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/GroupingEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/GroupingEncoding.java
new file mode 100644
index 0000000..8db6037
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/GroupingEncoding.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.core.persistence.GroupingInfo;
+
+public class GroupingEncoding implements EncodingSupport, GroupingInfo {
+
+   public long id;
+
+   public SimpleString groupId;
+
+   public SimpleString clusterName;
+
+   public GroupingEncoding(final long id, final SimpleString groupId, final 
SimpleString clusterName) {
+      this.id = id;
+      this.groupId = groupId;
+      this.clusterName = clusterName;
+   }
+
+   public GroupingEncoding() {
+   }
+
+   public int getEncodeSize() {
+      return SimpleString.sizeofString(groupId) + 
SimpleString.sizeofString(clusterName);
+   }
+
+   public void encode(final ActiveMQBuffer buffer) {
+      buffer.writeSimpleString(groupId);
+      buffer.writeSimpleString(clusterName);
+   }
+
+   public void decode(final ActiveMQBuffer buffer) {
+      groupId = buffer.readSimpleString();
+      clusterName = buffer.readSimpleString();
+   }
+
+   public long getId() {
+      return id;
+   }
+
+   public void setId(final long id) {
+      this.id = id;
+   }
+
+   public SimpleString getGroupId() {
+      return groupId;
+   }
+
+   public SimpleString getClusterName() {
+      return clusterName;
+   }
+
+   @Override
+   public String toString() {
+      return "GroupingEncoding [id=" + id + ", groupId=" + groupId + ", 
clusterName=" + clusterName + "]";
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/HeuristicCompletionEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/HeuristicCompletionEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/HeuristicCompletionEncoding.java
new file mode 100644
index 0000000..4ef9c85
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/HeuristicCompletionEncoding.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.utils.DataConstants;
+import org.apache.activemq.artemis.utils.XidCodecSupport;
+
+public class HeuristicCompletionEncoding implements EncodingSupport {
+
+   public Xid xid;
+
+   public boolean isCommit;
+
+   @Override
+   public String toString() {
+      return "HeuristicCompletionEncoding [xid=" + xid + ", isCommit=" + 
isCommit + "]";
+   }
+
+   public HeuristicCompletionEncoding(final Xid xid, final boolean isCommit) {
+      this.xid = xid;
+      this.isCommit = isCommit;
+   }
+
+   public HeuristicCompletionEncoding() {
+   }
+
+   public void decode(final ActiveMQBuffer buffer) {
+      xid = XidCodecSupport.decodeXid(buffer);
+      isCommit = buffer.readBoolean();
+   }
+
+   public void encode(final ActiveMQBuffer buffer) {
+      XidCodecSupport.encodeXid(xid, buffer);
+      buffer.writeBoolean(isCommit);
+   }
+
+   public int getEncodeSize() {
+      return XidCodecSupport.getXidEncodeLength(xid) + 
DataConstants.SIZE_BOOLEAN;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/LargeMessageEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/LargeMessageEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/LargeMessageEncoding.java
new file mode 100644
index 0000000..0e32895
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/LargeMessageEncoding.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.core.server.LargeServerMessage;
+
+public class LargeMessageEncoding implements EncodingSupport {
+
+   public final LargeServerMessage message;
+
+   public LargeMessageEncoding(final LargeServerMessage message) {
+      this.message = message;
+   }
+
+   /* (non-Javadoc)
+    * @see 
org.apache.activemq.artemis.core.journal.EncodingSupport#decode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
+    */
+   public void decode(final ActiveMQBuffer buffer) {
+      message.decodeHeadersAndProperties(buffer);
+   }
+
+   /* (non-Javadoc)
+    * @see 
org.apache.activemq.artemis.core.journal.EncodingSupport#encode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
+    */
+   public void encode(final ActiveMQBuffer buffer) {
+      message.encode(buffer);
+   }
+
+   /* (non-Javadoc)
+    * @see 
org.apache.activemq.artemis.core.journal.EncodingSupport#getEncodeSize()
+    */
+   public int getEncodeSize() {
+      return message.getEncodeSize();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
new file mode 100644
index 0000000..98371e7
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountPendingImpl.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.core.persistence.impl.PageCountPending;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+public class PageCountPendingImpl implements EncodingSupport, PageCountPending 
{
+
+   @Override
+   public String toString() {
+      return "PageCountPending [queueID=" + queueID + ", pageID=" + pageID + 
"]";
+   }
+
+   public PageCountPendingImpl() {
+
+   }
+
+   public PageCountPendingImpl(long queueID, long pageID, int inc) {
+      this.queueID = queueID;
+      this.pageID = pageID;
+   }
+
+   long id;
+
+   long queueID;
+
+   long pageID;
+
+   public void setID(long id) {
+      this.id = id;
+   }
+
+   public long getID() {
+      return id;
+   }
+
+   public long getQueueID() {
+      return queueID;
+   }
+
+   public long getPageID() {
+      return pageID;
+   }
+
+   @Override
+   public int getEncodeSize() {
+      return DataConstants.SIZE_LONG * 2;
+   }
+
+   @Override
+   public void encode(ActiveMQBuffer buffer) {
+      buffer.writeLong(queueID);
+      buffer.writeLong(pageID);
+   }
+
+   @Override
+   public void decode(ActiveMQBuffer buffer) {
+      queueID = buffer.readLong();
+      pageID = buffer.readLong();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecord.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecord.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecord.java
new file mode 100644
index 0000000..642feb2
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecord.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+public class PageCountRecord implements EncodingSupport {
+
+   private long queueID;
+
+   private long value;
+
+   @Override
+   public String toString() {
+      return "PageCountRecord [queueID=" + queueID + ", value=" + value + "]";
+   }
+
+   public PageCountRecord() {
+
+   }
+
+   public PageCountRecord(long queueID, long value) {
+      this.queueID = queueID;
+      this.value = value;
+   }
+
+   public long getQueueID() {
+      return queueID;
+   }
+
+   public long getValue() {
+      return value;
+   }
+
+   @Override
+   public int getEncodeSize() {
+      return DataConstants.SIZE_LONG * 2;
+   }
+
+   @Override
+   public void encode(ActiveMQBuffer buffer) {
+      buffer.writeLong(queueID);
+      buffer.writeLong(value);
+   }
+
+   @Override
+   public void decode(ActiveMQBuffer buffer) {
+      queueID = buffer.readLong();
+      value = buffer.readLong();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecordInc.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecordInc.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecordInc.java
new file mode 100644
index 0000000..6e0f717
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageCountRecordInc.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+public class PageCountRecordInc implements EncodingSupport {
+
+   private long queueID;
+
+   private int value;
+
+   @Override
+   public String toString() {
+      return "PageCountRecordInc [queueID=" + queueID + ", value=" + value + 
"]";
+   }
+
+   public PageCountRecordInc() {
+   }
+
+   public PageCountRecordInc(long queueID, int value) {
+      this.queueID = queueID;
+      this.value = value;
+   }
+
+   public long getQueueID() {
+      return queueID;
+   }
+
+   public int getValue() {
+      return value;
+   }
+
+   public int getEncodeSize() {
+      return DataConstants.SIZE_LONG + DataConstants.SIZE_INT;
+   }
+
+   public void encode(ActiveMQBuffer buffer) {
+      buffer.writeLong(queueID);
+      buffer.writeInt(value);
+   }
+
+   public void decode(ActiveMQBuffer buffer) {
+      queueID = buffer.readLong();
+      value = buffer.readInt();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageUpdateTXEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageUpdateTXEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageUpdateTXEncoding.java
new file mode 100644
index 0000000..feae37b
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PageUpdateTXEncoding.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import java.util.List;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.core.server.MessageReference;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+public class PageUpdateTXEncoding implements EncodingSupport {
+
+   public long pageTX;
+
+   public int recods;
+
+   @Override
+   public String toString() {
+      return "PageUpdateTXEncoding [pageTX=" + pageTX + ", recods=" + recods + 
"]";
+   }
+
+   public PageUpdateTXEncoding() {
+   }
+
+   public PageUpdateTXEncoding(final long pageTX, final int records) {
+      this.pageTX = pageTX;
+      this.recods = records;
+   }
+
+   public void decode(ActiveMQBuffer buffer) {
+      this.pageTX = buffer.readLong();
+      this.recods = buffer.readInt();
+   }
+
+   @Override
+   public void encode(ActiveMQBuffer buffer) {
+      buffer.writeLong(pageTX);
+      buffer.writeInt(recods);
+   }
+
+   @Override
+   public int getEncodeSize() {
+      return DataConstants.SIZE_LONG + DataConstants.SIZE_INT;
+   }
+
+   public List<MessageReference> getRelatedMessageReferences() {
+      return null;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PendingLargeMessageEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PendingLargeMessageEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PendingLargeMessageEncoding.java
new file mode 100644
index 0000000..34fd9a4
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PendingLargeMessageEncoding.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+public class PendingLargeMessageEncoding implements EncodingSupport {
+
+   public long largeMessageID;
+
+   public PendingLargeMessageEncoding(final long pendingLargeMessageID) {
+      this.largeMessageID = pendingLargeMessageID;
+   }
+
+   public PendingLargeMessageEncoding() {
+   }
+
+   /* (non-Javadoc)
+    * @see 
org.apache.activemq.artemis.core.journal.EncodingSupport#decode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
+    */
+   public void decode(final ActiveMQBuffer buffer) {
+      largeMessageID = buffer.readLong();
+   }
+
+   /* (non-Javadoc)
+    * @see 
org.apache.activemq.artemis.core.journal.EncodingSupport#encode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
+    */
+   public void encode(final ActiveMQBuffer buffer) {
+      buffer.writeLong(largeMessageID);
+   }
+
+   /* (non-Javadoc)
+    * @see 
org.apache.activemq.artemis.core.journal.EncodingSupport#getEncodeSize()
+    */
+   public int getEncodeSize() {
+      return DataConstants.SIZE_LONG;
+   }
+
+   @Override
+   public String toString() {
+      return "PendingLargeMessageEncoding::MessageID=" + largeMessageID;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
new file mode 100644
index 0000000..bfbc7fd
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.core.persistence.QueueBindingInfo;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+public class PersistentQueueBindingEncoding implements EncodingSupport, 
QueueBindingInfo {
+
+   public long id;
+
+   public SimpleString name;
+
+   public SimpleString address;
+
+   public SimpleString filterString;
+
+   public boolean autoCreated;
+
+   public SimpleString user;
+
+   public PersistentQueueBindingEncoding() {
+   }
+
+   @Override
+   public String toString() {
+      return "PersistentQueueBindingEncoding [id=" + id +
+         ", name=" +
+         name +
+         ", address=" +
+         address +
+         ", filterString=" +
+         filterString +
+         ", user=" +
+         user +
+         ", autoCreated=" +
+         autoCreated +
+         "]";
+   }
+
+   public PersistentQueueBindingEncoding(final SimpleString name,
+                                         final SimpleString address,
+                                         final SimpleString filterString,
+                                         final SimpleString user,
+                                         final boolean autoCreated) {
+      this.name = name;
+      this.address = address;
+      this.filterString = filterString;
+      this.user = user;
+      this.autoCreated = autoCreated;
+   }
+
+   public long getId() {
+      return id;
+   }
+
+   public void setId(final long id) {
+      this.id = id;
+   }
+
+   public SimpleString getAddress() {
+      return address;
+   }
+
+   public void replaceQueueName(SimpleString newName) {
+      this.name = newName;
+   }
+
+   public SimpleString getFilterString() {
+      return filterString;
+   }
+
+   public SimpleString getQueueName() {
+      return name;
+   }
+
+   public SimpleString getUser() {
+      return user;
+   }
+
+   public boolean isAutoCreated() {
+      return autoCreated;
+   }
+
+   public void decode(final ActiveMQBuffer buffer) {
+      name = buffer.readSimpleString();
+      address = buffer.readSimpleString();
+      filterString = buffer.readNullableSimpleString();
+
+      String metadata = buffer.readNullableSimpleString().toString();
+      if (metadata != null) {
+         String[] elements = metadata.split(";");
+         for (String element : elements) {
+            String[] keyValuePair = element.split("=");
+            if (keyValuePair.length == 2) {
+               if (keyValuePair[0].equals("user")) {
+                  user = SimpleString.toSimpleString(keyValuePair[1]);
+               }
+            }
+         }
+      }
+
+      autoCreated = buffer.readBoolean();
+   }
+
+   public void encode(final ActiveMQBuffer buffer) {
+      buffer.writeSimpleString(name);
+      buffer.writeSimpleString(address);
+      buffer.writeNullableSimpleString(filterString);
+      buffer.writeNullableSimpleString(createMetadata());
+      buffer.writeBoolean(autoCreated);
+   }
+
+   public int getEncodeSize() {
+      return SimpleString.sizeofString(name) + 
SimpleString.sizeofString(address) +
+         SimpleString.sizeofNullableString(filterString) + 
DataConstants.SIZE_BOOLEAN +
+         SimpleString.sizeofNullableString(createMetadata());
+   }
+
+   private SimpleString createMetadata() {
+      StringBuilder metadata = new StringBuilder();
+      metadata.append("user=").append(user).append(";");
+      return SimpleString.toSimpleString(metadata.toString());
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/QueueEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/QueueEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/QueueEncoding.java
new file mode 100644
index 0000000..4b0dfb6
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/QueueEncoding.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+
+public class QueueEncoding implements EncodingSupport {
+
+   public long queueID;
+
+   public QueueEncoding(final long queueID) {
+      super();
+      this.queueID = queueID;
+   }
+
+   public QueueEncoding() {
+      super();
+   }
+
+   public void decode(final ActiveMQBuffer buffer) {
+      queueID = buffer.readLong();
+   }
+
+   public void encode(final ActiveMQBuffer buffer) {
+      buffer.writeLong(queueID);
+   }
+
+   public int getEncodeSize() {
+      return 8;
+   }
+
+   @Override
+   public String toString() {
+      return "QueueEncoding [queueID=" + queueID + "]";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/RefEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/RefEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/RefEncoding.java
new file mode 100644
index 0000000..f3da497
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/RefEncoding.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+public class RefEncoding extends QueueEncoding {
+
+   public RefEncoding() {
+      super();
+   }
+
+   public RefEncoding(final long queueID) {
+      super(queueID);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/ScheduledDeliveryEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/ScheduledDeliveryEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/ScheduledDeliveryEncoding.java
new file mode 100644
index 0000000..d0559ec
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/ScheduledDeliveryEncoding.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+
+public class ScheduledDeliveryEncoding extends QueueEncoding {
+
+   public long scheduledDeliveryTime;
+
+   @Override
+   public String toString() {
+      return "ScheduledDeliveryEncoding [scheduledDeliveryTime=" + 
scheduledDeliveryTime + "]";
+   }
+
+   public ScheduledDeliveryEncoding(final long scheduledDeliveryTime, final 
long queueID) {
+      super(queueID);
+      this.scheduledDeliveryTime = scheduledDeliveryTime;
+   }
+
+   public ScheduledDeliveryEncoding() {
+   }
+
+   @Override
+   public int getEncodeSize() {
+      return super.getEncodeSize() + 8;
+   }
+
+   @Override
+   public void encode(final ActiveMQBuffer buffer) {
+      super.encode(buffer);
+      buffer.writeLong(scheduledDeliveryTime);
+   }
+
+   @Override
+   public void decode(final ActiveMQBuffer buffer) {
+      super.decode(buffer);
+      scheduledDeliveryTime = buffer.readLong();
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/XidEncoding.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/XidEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/XidEncoding.java
new file mode 100644
index 0000000..5969ca2
--- /dev/null
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/XidEncoding.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.activemq.artemis.core.persistence.impl.journal.codec;
+
+import javax.transaction.xa.Xid;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
+import org.apache.activemq.artemis.core.journal.EncodingSupport;
+import org.apache.activemq.artemis.utils.XidCodecSupport;
+
+/**
+ * It's public as other classes may want to unparse data on tools
+ */
+public class XidEncoding implements EncodingSupport {
+
+   public final Xid xid;
+
+   public XidEncoding(final Xid xid) {
+      this.xid = xid;
+   }
+
+   public XidEncoding(final byte[] data) {
+      xid = XidCodecSupport.decodeXid(ActiveMQBuffers.wrappedBuffer(data));
+   }
+
+   public void decode(final ActiveMQBuffer buffer) {
+      throw new IllegalStateException("Non Supported Operation");
+   }
+
+   public void encode(final ActiveMQBuffer buffer) {
+      XidCodecSupport.encodeXid(xid, buffer);
+   }
+
+   public int getEncodeSize() {
+      return XidCodecSupport.getXidEncodeLength(xid);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java
----------------------------------------------------------------------
diff --git 
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java
 
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java
index 1872665..64558db 100644
--- 
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java
+++ 
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java
@@ -839,10 +839,10 @@ public class AlignedJournalImplTest extends 
ActiveMQTestBase {
       setupAndLoadJournal(JOURNAL_SIZE, 1);
 
       Assert.assertEquals(1, transactions.size());
-      Assert.assertEquals(1, transactions.get(0).recordsToDelete.size());
+      Assert.assertEquals(1, transactions.get(0).getRecordsToDelete().size());
       Assert.assertEquals(1, records.size());
 
-      for (RecordInfo record : transactions.get(0).recordsToDelete) {
+      for (RecordInfo record : transactions.get(0).getRecordsToDelete()) {
          byte[] data = record.data;
          Assert.assertEquals(100, data.length);
          for (byte element : data) {
@@ -850,10 +850,10 @@ public class AlignedJournalImplTest extends 
ActiveMQTestBase {
          }
       }
 
-      Assert.assertEquals(10, transactions.get(0).extraData.length);
+      Assert.assertEquals(10, transactions.get(0).getExtraData().length);
 
       for (int i = 0; i < 10; i++) {
-         Assert.assertEquals((byte) 1, transactions.get(0).extraData[i]);
+         Assert.assertEquals((byte) 1, transactions.get(0).getExtraData()[i]);
       }
 
       journalImpl.appendCommitRecord(1L, false);
@@ -894,9 +894,9 @@ public class AlignedJournalImplTest extends 
ActiveMQTestBase {
       Assert.assertEquals(0, records.size());
       Assert.assertEquals(1, transactions.size());
 
-      Assert.assertEquals(10, transactions.get(0).extraData.length);
+      Assert.assertEquals(10, transactions.get(0).getExtraData().length);
       for (int i = 0; i < 10; i++) {
-         Assert.assertEquals((byte) 1, transactions.get(0).extraData[i]);
+         Assert.assertEquals((byte) 1, transactions.get(0).getExtraData()[i]);
       }
 
       journalImpl.checkReclaimStatus();
@@ -925,9 +925,9 @@ public class AlignedJournalImplTest extends 
ActiveMQTestBase {
 
       Assert.assertEquals(1, transactions.size());
 
-      Assert.assertEquals(15, transactions.get(0).extraData.length);
+      Assert.assertEquals(15, transactions.get(0).getExtraData().length);
 
-      for (byte element : transactions.get(0).extraData) {
+      for (byte element : transactions.get(0).getExtraData()) {
          Assert.assertEquals(2, element);
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9b351d82/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
----------------------------------------------------------------------
diff --git 
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
 
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
index 6c0564a..524c1a8 100644
--- 
a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
+++ 
b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java
@@ -265,9 +265,9 @@ public abstract class JournalImplTestBase extends 
ActiveMQTestBase {
          if (entry.getValue().prepared) {
             PreparedTransactionInfo info = new 
PreparedTransactionInfo(entry.getKey(), null);
 
-            info.records.addAll(entry.getValue().records);
+            info.getRecords().addAll(entry.getValue().records);
 
-            info.recordsToDelete.addAll(entry.getValue().deletes);
+            info.getRecordsToDelete().addAll(entry.getValue().deletes);
 
             prepared.add(info);
          }
@@ -465,15 +465,15 @@ public abstract class JournalImplTestBase extends 
ActiveMQTestBase {
 
          PreparedTransactionInfo ractual = iterActual.next();
 
-         Assert.assertEquals("ids not same", rexpected.id, ractual.id);
+         Assert.assertEquals("ids not same", rexpected.getId(), 
ractual.getId());
 
-         checkRecordsEquivalent(rexpected.records, ractual.records);
+         checkRecordsEquivalent(rexpected.getRecords(), ractual.getRecords());
 
-         Assert.assertEquals("deletes size not same", 
rexpected.recordsToDelete.size(), ractual.recordsToDelete.size());
+         Assert.assertEquals("deletes size not same", 
rexpected.getRecordsToDelete().size(), ractual.getRecordsToDelete().size());
 
-         Iterator<RecordInfo> iterDeletesExpected = 
rexpected.recordsToDelete.iterator();
+         Iterator<RecordInfo> iterDeletesExpected = 
rexpected.getRecordsToDelete().iterator();
 
-         Iterator<RecordInfo> iterDeletesActual = 
ractual.recordsToDelete.iterator();
+         Iterator<RecordInfo> iterDeletesActual = 
ractual.getRecordsToDelete().iterator();
 
          while (iterDeletesExpected.hasNext()) {
             long lexpected = iterDeletesExpected.next().id;

Reply via email to