activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r789377 [4/4] - in /activemq/sandbox/activemq-flow: activemq-broker/src/main/java/org/apache/activemq/apollo/broker/ activemq-broker/src/main/java/org/apache/activemq/apollo/broker/path/ activemq-broker/src/main/java/org/apache/activemq/apo...
Date Mon, 29 Jun 2009 16:28:56 GMT
Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/ObjectMarshaller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/ObjectMarshaller.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/ObjectMarshaller.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java?rev=789377&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java
Mon Jun 29 16:28:18 2009
@@ -0,0 +1,66 @@
+/**
+ * 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.util.marshaller;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+/**
+ * Implementation of a Marshaller for Strings
+ * 
+ * @version $Revision$
+ */
+public class StringMarshaller implements Marshaller<String> {
+    
+    public static final StringMarshaller INSTANCE = new StringMarshaller();
+    
+    /**
+     * Write the payload of this entry to the RawContainer
+     * 
+     * @param object
+     * @param dataOut
+     * @throws IOException
+     */
+    public void writePayload(String object, DataOutput dataOut) throws IOException {
+        dataOut.writeUTF(object);
+    }
+
+    /**
+     * Read the entry from the RawContainer
+     * 
+     * @param dataIn
+     * @return unmarshalled object
+     * @throws IOException
+     */
+    public String readPayload(DataInput dataIn) throws IOException {
+        return dataIn.readUTF();
+    }
+
+
+    public int getFixedSize() {
+        return -1;
+    }
+
+    public String deepCopy(String source) {
+        return source;
+    }
+
+    public boolean isDeepCopySupported() {
+        return true;
+    }
+}

Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/StringMarshaller.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/VariableMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/VariableMarshaller.java?rev=789377&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/VariableMarshaller.java
(added)
+++ activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/VariableMarshaller.java
Mon Jun 29 16:28:18 2009
@@ -0,0 +1,40 @@
+/**
+ * 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.util.marshaller;
+
+/**
+ * Convenience base class for Marshaller implementations which do not deepCopy and
+ * which use variable size encodings.
+ * 
+ * @author chirino
+ * @param <T>
+ */
+abstract public class VariableMarshaller<T> implements Marshaller<T> {
+
+    public int getFixedSize() {
+        return -1;
+    }
+
+    public boolean isDeepCopySupported() {
+        return false;
+    }
+
+    public T deepCopy(T source) {
+        throw new UnsupportedOperationException();
+    }
+
+}

Propchange: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/activemq/util/marshaller/VariableMarshaller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayInputStream.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayInputStream.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayInputStream.java
Mon Jun 29 16:28:18 2009
@@ -21,6 +21,8 @@
 import java.io.InputStream;
 import java.io.UTFDataFormatException;
 
+import org.apache.activemq.util.buffer.Buffer;
+
 /**
  * Optimized ByteArrayInputStream that can be used more than once
  * 
@@ -49,7 +51,7 @@
      * 
      * @param sequence the input buffer.
      */
-    public DataByteArrayInputStream(ByteSequence sequence) {
+    public DataByteArrayInputStream(Buffer sequence) {
         this.buf = sequence.getData();
         this.offset = sequence.getOffset();
         this.pos =  this.offset;
@@ -101,7 +103,7 @@
      * 
      * @param sequence
      */
-    public void restart(ByteSequence sequence) {
+    public void restart(Buffer sequence) {
         this.buf = sequence.getData();
         this.pos = sequence.getOffset();
         this.length = sequence.getLength();

Modified: activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayOutputStream.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayOutputStream.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-util/src/main/java/org/apache/kahadb/util/DataByteArrayOutputStream.java
Mon Jun 29 16:28:18 2009
@@ -21,6 +21,8 @@
 import java.io.OutputStream;
 import java.io.UTFDataFormatException;
 
+import org.apache.activemq.util.buffer.Buffer;
+
 /**
  * Optimized ByteArrayOutputStream
  * 
@@ -74,8 +76,8 @@
      * 
      * @return the byte sequence
      */
-    public ByteSequence toByteSequence() {
-        return new ByteSequence(buf, 0, pos);
+    public Buffer toByteSequence() {
+        return new Buffer(buf, 0, pos);
     }
 
     /**
@@ -278,7 +280,7 @@
         onWrite();
     }
 
-    public ByteSequence getByteSequence() {
-        return new ByteSequence(buf, 0, pos);
+    public Buffer getByteSequence() {
+        return new Buffer(buf, 0, pos);
     }
 }

Modified: activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java
Mon Jun 29 16:28:18 2009
@@ -16,6 +16,9 @@
  */
 package org.apache.activemq.util;
 
+import org.apache.activemq.util.buffer.DataByteArrayInputStream;
+import org.apache.activemq.util.buffer.DataByteArrayOutputStream;
+
 import junit.framework.TestCase;
 
 public class DataByteArrayInputStreamTest extends TestCase {

Modified: activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayOutputStreamTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayOutputStreamTest.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayOutputStreamTest.java
(original)
+++ activemq/sandbox/activemq-flow/activemq-util/src/test/java/org/apache/activemq/util/DataByteArrayOutputStreamTest.java
Mon Jun 29 16:28:18 2009
@@ -18,6 +18,8 @@
 
 import java.io.IOException;
 
+import org.apache.activemq.util.buffer.DataByteArrayOutputStream;
+
 import junit.framework.TestCase;
 
 public class DataByteArrayOutputStreamTest extends TestCase {

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java
Mon Jun 29 16:28:18 2009
@@ -23,12 +23,12 @@
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.activemq.util.marshaller.Marshaller;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.kahadb.page.Page;
 import org.apache.kahadb.page.PageFile;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.Marshaller;
 
 /**
  * BTreeIndex represents a Variable Magnitude B+Tree in a Page File.

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeNode.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeNode.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeNode.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/BTreeNode.java
Mon Jun 29 16:28:18 2009
@@ -26,10 +26,10 @@
 import java.util.NoSuchElementException;
 import java.util.Map.Entry;
 
+import org.apache.activemq.util.marshaller.VariableMarshaller;
 import org.apache.kahadb.index.BTreeIndex.Prefixer;
 import org.apache.kahadb.page.Page;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.VariableMarshaller;
 
 /**
  * The BTreeNode class represents a node in the BTree object graph. It is stored

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashBin.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashBin.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashBin.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashBin.java
Mon Jun 29 16:28:18 2009
@@ -22,9 +22,9 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.apache.activemq.util.marshaller.VariableMarshaller;
 import org.apache.kahadb.page.Page;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.VariableMarshaller;
 
 /**
  * Bin in a HashIndex

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashIndex.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashIndex.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashIndex.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/HashIndex.java
Mon Jun 29 16:28:18 2009
@@ -24,13 +24,13 @@
 import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.activemq.util.marshaller.Marshaller;
+import org.apache.activemq.util.marshaller.VariableMarshaller;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.kahadb.page.Page;
 import org.apache.kahadb.page.PageFile;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.Marshaller;
-import org.apache.kahadb.util.VariableMarshaller;
 
 /**
  * BTree implementation

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/Index.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/Index.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/Index.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/index/Index.java
Mon Jun 29 16:28:18 2009
@@ -20,8 +20,8 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.activemq.util.marshaller.Marshaller;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.Marshaller;
 
 /**
  * Simpler than a Map

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFile.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFile.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFile.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFile.java
Mon Jun 29 16:28:18 2009
@@ -20,8 +20,8 @@
 import java.io.IOException;
 import java.io.RandomAccessFile;
 
-import org.apache.kahadb.util.IOHelper;
-import org.apache.kahadb.util.LinkedNode;
+import org.apache.activemq.util.IOHelper;
+import org.apache.activemq.util.list.LinkedNode;
 
 /**
  * DataFile

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAccessor.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAccessor.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAccessor.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAccessor.java
Mon Jun 29 16:28:18 2009
@@ -20,9 +20,9 @@
 import java.io.RandomAccessFile;
 import java.util.Map;
 
+import org.apache.activemq.util.buffer.Buffer;
 import org.apache.kahadb.journal.DataFileAppender.WriteCommand;
 import org.apache.kahadb.journal.DataFileAppender.WriteKey;
-import org.apache.kahadb.util.ByteSequence;
 
 /**
  * Optimized Store reader and updater. Single threaded and synchronous. Use in
@@ -65,7 +65,7 @@
         }
     }
 
-    public ByteSequence readRecord(Location location) throws IOException {
+    public Buffer readRecord(Location location) throws IOException {
 
         if (!location.isValid()) {
             throw new IOException("Invalid location: " + location);
@@ -88,7 +88,7 @@
 
             byte[] data = new byte[location.getSize() - Journal.RECORD_HEAD_SPACE];
             file.readFully(data);
-            return new ByteSequence(data, 0, data.length);
+            return new Buffer(data, 0, data.length);
 
         } catch (RuntimeException e) {
             throw new IOException("Invalid location: " + location + ", : " + e);
@@ -145,7 +145,7 @@
 //        return true;
 //    }
 
-    public void updateRecord(Location location, ByteSequence data, boolean sync) throws IOException
{
+    public void updateRecord(Location location, Buffer data, boolean sync) throws IOException
{
 
         file.seek(location.getOffset() + Journal.RECORD_HEAD_SPACE);
         int size = Math.min(data.getLength(), location.getSize());

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/DataFileAppender.java
Mon Jun 29 16:28:18 2009
@@ -24,10 +24,10 @@
 import java.util.zip.Adler32;
 import java.util.zip.Checksum;
 
-import org.apache.kahadb.util.ByteSequence;
+import org.apache.activemq.util.buffer.Buffer;
+import org.apache.activemq.util.list.LinkedNode;
+import org.apache.activemq.util.list.LinkedNodeList;
 import org.apache.kahadb.util.DataByteArrayOutputStream;
-import org.apache.kahadb.util.LinkedNode;
-import org.apache.kahadb.util.LinkedNodeList;
 
 /**
  * An optimized writer to do batch appends to a data file. This object is thread
@@ -118,18 +118,18 @@
 
     public static class WriteCommand extends LinkedNode<WriteCommand> {
         public final Location location;
-        public final ByteSequence data;
+        public final Buffer data;
         final boolean sync;
         public final Runnable onComplete;
 
-        public WriteCommand(Location location, ByteSequence data, boolean sync) {
+        public WriteCommand(Location location, Buffer data, boolean sync) {
             this.location = location;
             this.data = data;
             this.sync = sync;
             this.onComplete = null;
         }
 
-        public WriteCommand(Location location, ByteSequence data, Runnable onComplete) {
+        public WriteCommand(Location location, Buffer data, Runnable onComplete) {
             this.location = location;
             this.data = data;
             this.onComplete = onComplete;
@@ -158,7 +158,7 @@
      * @throws
      * @throws
      */
-    public Location storeItem(ByteSequence data, byte type, boolean sync) throws IOException
{
+    public Location storeItem(Buffer data, byte type, boolean sync) throws IOException {
 
         // Write the packet our internal buffer.
         int size = data.getLength() + Journal.RECORD_HEAD_SPACE;
@@ -190,7 +190,7 @@
         return location;
     }
 
-    public Location storeItem(ByteSequence data, byte type, Runnable onComplete) throws IOException
{
+    public Location storeItem(Buffer data, byte type, Runnable onComplete) throws IOException
{
         // Write the packet our internal buffer.
         int size = data.getLength() + Journal.RECORD_HEAD_SPACE;
 
@@ -354,7 +354,7 @@
                     write = write.getNext();
                 }
 
-                ByteSequence sequence = buff.toByteSequence();
+                Buffer sequence = buff.toByteSequence();
                 
                 // Now we can fill in the batch control record properly. 
                 buff.reset();

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/Journal.java
Mon Jun 29 16:28:18 2009
@@ -35,14 +35,14 @@
 import java.util.zip.Adler32;
 import java.util.zip.Checksum;
 
+import org.apache.activemq.util.Scheduler;
+import org.apache.activemq.util.buffer.Buffer;
+import org.apache.activemq.util.list.LinkedNodeList;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.kahadb.journal.DataFileAppender.WriteCommand;
 import org.apache.kahadb.journal.DataFileAppender.WriteKey;
-import org.apache.kahadb.util.ByteSequence;
 import org.apache.kahadb.util.DataByteArrayInputStream;
-import org.apache.kahadb.util.LinkedNodeList;
-import org.apache.kahadb.util.Scheduler;
 
 /**
  * Manages DataFiles
@@ -504,10 +504,10 @@
         }
     }
 
-    public synchronized ByteSequence read(Location location) throws IOException, IllegalStateException
{
+    public synchronized Buffer read(Location location) throws IOException, IllegalStateException
{
         DataFile dataFile = getDataFile(location);
         DataFileAccessor reader = accessorPool.openDataFileAccessor(dataFile);
-        ByteSequence rc = null;
+        Buffer rc = null;
         try {
             rc = reader.readRecord(location);
         } finally {
@@ -516,17 +516,17 @@
         return rc;
     }
 
-    public synchronized Location write(ByteSequence data, boolean sync) throws IOException,
IllegalStateException {
+    public synchronized Location write(Buffer data, boolean sync) throws IOException, IllegalStateException
{
         Location loc = appender.storeItem(data, Location.USER_TYPE, sync);
         return loc;
     }
 
-    public synchronized Location write(ByteSequence data, Runnable onComplete) throws IOException,
IllegalStateException {
+    public synchronized Location write(Buffer data, Runnable onComplete) throws IOException,
IllegalStateException {
         Location loc = appender.storeItem(data, Location.USER_TYPE, onComplete);
         return loc;
     }
 
-    public void update(Location location, ByteSequence data, boolean sync) throws IOException
{
+    public void update(Location location, Buffer data, boolean sync) throws IOException {
         DataFile dataFile = getDataFile(location);
         DataFileAccessor updater = accessorPool.openDataFileAccessor(dataFile);
         try {

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/ReplicationTarget.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/ReplicationTarget.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/ReplicationTarget.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/journal/ReplicationTarget.java
Mon Jun 29 16:28:18 2009
@@ -16,10 +16,10 @@
  */
 package org.apache.kahadb.journal;
 
-import org.apache.kahadb.util.ByteSequence;
+import org.apache.activemq.util.buffer.Buffer;
 
 public interface ReplicationTarget {
 
-	void replicate(Location location, ByteSequence sequence, boolean sync);
+	void replicate(Location location, Buffer sequence, boolean sync);
 
 }

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Page.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Page.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Page.java (original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Page.java Mon
Jun 29 16:28:18 2009
@@ -19,14 +19,6 @@
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.kahadb.util.ByteSequence;
-import org.apache.kahadb.util.DataByteArrayInputStream;
-import org.apache.kahadb.util.DataByteArrayOutputStream;
-import org.apache.kahadb.util.Marshaller;
 
 /**
  * A Page within a file.

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/PageFile.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/PageFile.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/PageFile.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/PageFile.java
Mon Jun 29 16:28:18 2009
@@ -41,14 +41,14 @@
 import java.util.zip.Adler32;
 import java.util.zip.Checksum;
 
+import org.apache.activemq.util.IOHelper;
+import org.apache.activemq.util.LRUCache;
+import org.apache.activemq.util.list.Sequence;
+import org.apache.activemq.util.list.SequenceSet;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.kahadb.util.DataByteArrayOutputStream;
-import org.apache.kahadb.util.IOHelper;
 import org.apache.kahadb.util.IntrospectionSupport;
-import org.apache.kahadb.util.LRUCache;
-import org.apache.kahadb.util.Sequence;
-import org.apache.kahadb.util.SequenceSet;
 
 /**
  * A PageFile provides you random access to fixed sized disk pages. This object is not thread
safe and therefore access to it should 

Modified: activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java
Mon Jun 29 16:28:18 2009
@@ -25,13 +25,13 @@
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.apache.activemq.util.buffer.Buffer;
+import org.apache.activemq.util.list.Sequence;
+import org.apache.activemq.util.list.SequenceSet;
+import org.apache.activemq.util.marshaller.Marshaller;
 import org.apache.kahadb.page.PageFile.PageWrite;
-import org.apache.kahadb.util.ByteSequence;
 import org.apache.kahadb.util.DataByteArrayInputStream;
 import org.apache.kahadb.util.DataByteArrayOutputStream;
-import org.apache.kahadb.util.Marshaller;
-import org.apache.kahadb.util.Sequence;
-import org.apache.kahadb.util.SequenceSet;
 
 /**
  * The class used to read/update a PageFile object.  Using a transaction allows you to
@@ -421,33 +421,33 @@
 
     /**
      * @see org.apache.kahadb.page.Transaction#load(org.apache.kahadb.page.Page,
-     *      org.apache.kahadb.util.Marshaller)
+     *      org.apache.activemq.util.marshaller.Marshaller)
      */
     public InputStream openInputStream(final Page p) throws IOException {
 
         return new InputStream() {
 
-            private ByteSequence chunk = new ByteSequence(new byte[pageFile.getPageSize()]);
+            private Buffer chunk = new Buffer(new byte[pageFile.getPageSize()]);
             private Page page = readPage(p);
             private int pageCount = 1;
 
             private Page markPage;
-            private ByteSequence markChunk;
+            private Buffer markChunk;
 
             private Page readPage(Page page) throws IOException {
                 // Read the page data
                 
                 pageFile.readPage(page.getPageId(), chunk.getData());
                 
-                chunk.setOffset(0);
-                chunk.setLength(pageFile.getPageSize());
+                chunk.offset=0;
+                chunk.length = pageFile.getPageSize();
 
                 DataByteArrayInputStream in = new DataByteArrayInputStream(chunk);
                 page.read(in);
 
-                chunk.setOffset(Page.PAGE_HEADER_SIZE);
+                chunk.offset = Page.PAGE_HEADER_SIZE;
                 if (page.getType() == Page.PAGE_END_TYPE) {
-                    chunk.setLength((int)(page.getNext()));
+                    chunk.length = (int)(page.getNext());
                 }
 
                 if (page.getType() == Page.PAGE_FREE_TYPE) {
@@ -530,7 +530,7 @@
                 markPage = page;
                 byte data[] = new byte[pageFile.getPageSize()];
                 System.arraycopy(chunk.getData(), 0, data, 0, pageFile.getPageSize());
-                markChunk = new ByteSequence(data, chunk.getOffset(), chunk.getLength());
+                markChunk = new Buffer(data, chunk.getOffset(), chunk.getLength());
             }
 
             public void reset() {

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexBenchMark.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexBenchMark.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexBenchMark.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexBenchMark.java
Mon Jun 29 16:28:18 2009
@@ -19,9 +19,9 @@
 import java.io.IOException;
 import java.text.NumberFormat;
 
+import org.apache.activemq.util.marshaller.LongMarshaller;
+import org.apache.activemq.util.marshaller.StringMarshaller;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.LongMarshaller;
-import org.apache.kahadb.util.StringMarshaller;
 
 public class BTreeIndexBenchMark extends IndexBenchmark {
 

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexTest.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexTest.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/BTreeIndexTest.java
Mon Jun 29 16:28:18 2009
@@ -22,10 +22,10 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.activemq.util.marshaller.LongMarshaller;
+import org.apache.activemq.util.marshaller.StringMarshaller;
 import org.apache.kahadb.index.BTreeIndex;
 import org.apache.kahadb.index.Index;
-import org.apache.kahadb.util.LongMarshaller;
-import org.apache.kahadb.util.StringMarshaller;
 
 public class BTreeIndexTest extends IndexTestSupport {
 

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexBenchMark.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexBenchMark.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexBenchMark.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexBenchMark.java
Mon Jun 29 16:28:18 2009
@@ -16,9 +16,9 @@
  */
 package org.apache.kahadb.index;
 
+import org.apache.activemq.util.marshaller.LongMarshaller;
+import org.apache.activemq.util.marshaller.StringMarshaller;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.LongMarshaller;
-import org.apache.kahadb.util.StringMarshaller;
 
 public class HashIndexBenchMark extends IndexBenchmark {
 

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexTest.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexTest.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/HashIndexTest.java
Mon Jun 29 16:28:18 2009
@@ -16,10 +16,10 @@
  */
 package org.apache.kahadb.index;
 
+import org.apache.activemq.util.marshaller.LongMarshaller;
+import org.apache.activemq.util.marshaller.StringMarshaller;
 import org.apache.kahadb.index.HashIndex;
 import org.apache.kahadb.index.Index;
-import org.apache.kahadb.util.LongMarshaller;
-import org.apache.kahadb.util.StringMarshaller;
 
 public class HashIndexTest extends IndexTestSupport {
 

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexBenchmark.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexBenchmark.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexBenchmark.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexBenchmark.java
Mon Jun 29 16:28:18 2009
@@ -24,9 +24,10 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 import junit.framework.TestCase;
+
+import org.apache.activemq.util.IOHelper;
 import org.apache.kahadb.page.PageFile;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.IOHelper;
 
 /**
  * @author chirino

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexTestSupport.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexTestSupport.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/index/IndexTestSupport.java
Mon Jun 29 16:28:18 2009
@@ -20,9 +20,10 @@
 import java.io.IOException;
 
 import junit.framework.TestCase;
+
+import org.apache.activemq.util.IOHelper;
 import org.apache.kahadb.page.PageFile;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.util.IOHelper;
 
 /**
  * Test a HashIndex

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/journal/JournalTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/journal/JournalTest.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/journal/JournalTest.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/journal/JournalTest.java
Mon Jun 29 16:28:18 2009
@@ -21,8 +21,8 @@
 import java.util.concurrent.TimeUnit;
 
 import junit.framework.TestCase;
-import org.apache.kahadb.journal.Journal;
-import org.apache.kahadb.util.ByteSequence;
+
+import org.apache.activemq.util.buffer.Buffer;
 
 public class JournalTest extends TestCase {
     protected static final int DEFAULT_MAX_BATCH_SIZE = 1024 * 1024 * 4;
@@ -64,7 +64,7 @@
     public void testBatchWriteCallbackCompleteAfterTimeout() throws Exception {
         final int iterations = 10;
         final CountDownLatch latch = new CountDownLatch(iterations);
-        ByteSequence data = new ByteSequence("DATA".getBytes());
+        Buffer data = new Buffer("DATA".getBytes());
         for (int i=0; i < iterations; i++) {
             dataManager.write(data, new Runnable() {
                 public void run() {
@@ -80,7 +80,7 @@
     public void testBatchWriteCallbackCompleteAfterClose() throws Exception {
         final int iterations = 10;
         final CountDownLatch latch = new CountDownLatch(iterations);
-        ByteSequence data = new ByteSequence("DATA".getBytes());
+        Buffer data = new Buffer("DATA".getBytes());
         for (int i=0; i<iterations; i++) {
             dataManager.write(data, new Runnable() {
                 public void run() {
@@ -94,7 +94,7 @@
     }
     
     public void testBatchWriteCompleteAfterClose() throws Exception {
-        ByteSequence data = new ByteSequence("DATA".getBytes());
+        Buffer data = new Buffer("DATA".getBytes());
         final int iterations = 10;
         for (int i=0; i<iterations; i++) {
             dataManager.write(data, false);
@@ -113,7 +113,7 @@
         };
         int messageSize = DEFAULT_MAX_BATCH_SIZE / iterations;
         byte[] message = new byte[messageSize];
-        ByteSequence data = new ByteSequence(message);
+        Buffer data = new Buffer(message);
         
         for (int i=0; i< iterations; i++) {
             dataManager.write(data, done);
@@ -124,7 +124,7 @@
     }
     
     public void testNoBatchWriteWithSync() throws Exception {
-        ByteSequence data = new ByteSequence("DATA".getBytes());
+        Buffer data = new Buffer("DATA".getBytes());
         final int iterations = 10;
         for (int i=0; i<iterations; i++) {
             dataManager.write(data, true);

Modified: activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/page/PageFileTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/page/PageFileTest.java?rev=789377&r1=789376&r2=789377&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/page/PageFileTest.java
(original)
+++ activemq/sandbox/activemq-flow/kahadb/src/test/java/org/apache/kahadb/page/PageFileTest.java
Mon Jun 29 16:28:18 2009
@@ -24,7 +24,7 @@
 import java.io.OutputStream;
 import java.util.HashSet;
 
-import org.apache.kahadb.util.StringMarshaller;
+import org.apache.activemq.util.marshaller.StringMarshaller;
 
 import junit.framework.TestCase;
 



Mime
View raw message