Permalink
Browse files

[MOD] Adapted poms to point to sirixdb/sirix repository plus simple

changes.
  • Loading branch information...
1 parent 3df2715 commit 13d20f0086e63ef351557842091257562fa9119f @JohannesLichtenberger JohannesLichtenberger committed Aug 22, 2013
Showing with 512 additions and 449 deletions.
  1. +25 −10 bundles/sirix-core/src/main/java/org/sirix/cache/PageBinding.java
  2. +28 −15 bundles/sirix-core/src/main/java/org/sirix/cache/PageContainerBinding.java
  3. +17 −5 bundles/sirix-core/src/main/java/org/sirix/cache/RecordPageContainer.java
  4. +6 −3 bundles/sirix-core/src/main/java/org/sirix/index/bplustree/BPlusInnerNodePage.java
  5. +4 −2 bundles/sirix-core/src/main/java/org/sirix/index/bplustree/BPlusLeafNodePage.java
  6. +6 −5 bundles/sirix-core/src/main/java/org/sirix/index/name/Names.java
  7. +16 −15 bundles/sirix-core/src/main/java/org/sirix/io/berkeley/binding/PageBinding.java
  8. +11 −10 bundles/sirix-core/src/main/java/org/sirix/io/bytepipe/ByteHandlePipeline.java
  9. +7 −5 bundles/sirix-core/src/main/java/org/sirix/io/bytepipe/ByteHandler.java
  10. +12 −57 bundles/sirix-core/src/main/java/org/sirix/io/bytepipe/DeflateCompressor.java
  11. +19 −43 bundles/sirix-core/src/main/java/org/sirix/io/bytepipe/Encryptor.java
  12. +11 −21 bundles/sirix-core/src/main/java/org/sirix/io/bytepipe/SnappyCompressor.java
  13. +4 −5 bundles/sirix-core/src/main/java/org/sirix/io/file/FileReader.java
  14. +16 −9 bundles/sirix-core/src/main/java/org/sirix/io/file/FileWriter.java
  15. +86 −86 bundles/sirix-core/src/main/java/org/sirix/node/Kind.java
  16. +8 −7 bundles/sirix-core/src/main/java/org/sirix/node/NodePersistenter.java
  17. +6 −2 bundles/sirix-core/src/main/java/org/sirix/node/Utils.java
  18. +12 −4 bundles/sirix-core/src/main/java/org/sirix/node/interfaces/RecordPersistenter.java
  19. +4 −2 bundles/sirix-core/src/main/java/org/sirix/page/AbstractForwardingPage.java
  20. +5 −4 bundles/sirix-core/src/main/java/org/sirix/page/CASPage.java
  21. +4 −3 bundles/sirix-core/src/main/java/org/sirix/page/IndirectPage.java
  22. +5 −4 bundles/sirix-core/src/main/java/org/sirix/page/NamePage.java
  23. +6 −5 bundles/sirix-core/src/main/java/org/sirix/page/OverflowPage.java
  24. +48 −48 bundles/sirix-core/src/main/java/org/sirix/page/PageKind.java
  25. +12 −7 bundles/sirix-core/src/main/java/org/sirix/page/PagePersistenter.java
  26. +7 −4 bundles/sirix-core/src/main/java/org/sirix/page/PathPage.java
  27. +5 −4 bundles/sirix-core/src/main/java/org/sirix/page/PathSummaryPage.java
  28. +6 −4 bundles/sirix-core/src/main/java/org/sirix/page/RevisionRootPage.java
  29. +6 −4 bundles/sirix-core/src/main/java/org/sirix/page/UberPage.java
  30. +29 −18 bundles/sirix-core/src/main/java/org/sirix/page/UnorderedKeyValuePage.java
  31. +8 −4 bundles/sirix-core/src/main/java/org/sirix/page/delegates/PageDelegate.java
  32. +7 −4 bundles/sirix-core/src/main/java/org/sirix/page/interfaces/Page.java
  33. +2 −2 bundles/sirix-core/src/test/java/org/sirix/TestHelper.java
  34. +41 −8 bundles/sirix-core/src/test/java/org/sirix/io/bytepipe/ByteHandlerTest.java
  35. +11 −8 bundles/sirix-core/src/test/java/org/sirix/node/AttributeNodeTest.java
  36. +1 −1 bundles/sirix-core/src/test/java/org/sirix/page/NodePageTest.java
  37. +2 −2 bundles/sirix-distributed/pom.xml
  38. +2 −2 bundles/sirix-fs/pom.xml
  39. +2 −2 bundles/sirix-gui/pom.xml
  40. +1 −1 bundles/sirix-gui/src/main/java/org/sirix/gui/view/smallmultiple/SmallmultipleControl.java
  41. +1 −1 bundles/sirix-gui/src/main/java/org/sirix/gui/view/smallmultiple/SmallmultipleGUI.java
  42. +2 −2 bundles/sirix-jax-rx/pom.xml
  43. +1 −1 bundles/sirix-xquery/pom.xml
@@ -27,25 +27,32 @@
package org.sirix.cache;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
import javax.annotation.Nullable;
import org.sirix.access.conf.ResourceConfiguration;
import org.sirix.api.PageReadTrx;
import org.sirix.page.PagePersistenter;
import org.sirix.page.interfaces.Page;
+import org.sirix.utils.LogWrapper;
+import org.slf4j.LoggerFactory;
-import com.google.common.io.ByteArrayDataInput;
-import com.google.common.io.ByteArrayDataOutput;
-import com.google.common.io.ByteStreams;
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
/**
* Binding for {@link RecordPageContainer} reference.
*/
-public class PageBinding extends TupleBinding<Page> {
+public final class PageBinding extends TupleBinding<Page> {
+ private static final LogWrapper LOGGER = new LogWrapper(LoggerFactory.getLogger(PageBinding.class));
+
/** {@link ResourceConfiguration} instance. */
private final PageReadTrx mPageReadTrx;
@@ -65,19 +72,27 @@ public Page entryToObject(final @Nullable TupleInput input) {
if (input == null) {
return null;
}
- final ByteArrayDataInput source = ByteStreams.newDataInput(input
- .getBufferBytes());
- return PagePersistenter.deserializePage(source, mPageReadTrx);
+ try {
+ return PagePersistenter.deserializePage(new DataInputStream(input),
+ mPageReadTrx);
+ } catch (final IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ return null;
+ }
}
@Override
public void objectToEntry(final @Nullable Page page,
final @Nullable TupleOutput output) {
if (page != null && output != null) {
- final ByteArrayDataOutput target = ByteStreams.newDataOutput();
+ final OutputStream target = new ByteArrayOutputStream();
final byte[] bytes = output.getBufferBytes();
- target.write(bytes, 0, bytes.length);
- page.serialize(target);
+ try {
+ target.write(bytes, 0, bytes.length);
+ page.serialize(new DataOutputStream(target));
+ } catch (final IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
}
}
}
@@ -27,25 +27,33 @@
package org.sirix.cache;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+
import javax.annotation.Nullable;
import org.sirix.access.conf.ResourceConfiguration;
import org.sirix.api.PageReadTrx;
import org.sirix.page.PagePersistenter;
import org.sirix.page.interfaces.KeyValuePage;
+import org.sirix.utils.LogWrapper;
+import org.slf4j.LoggerFactory;
-import com.google.common.io.ByteArrayDataInput;
-import com.google.common.io.ByteStreams;
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
/**
* Binding for {@link RecordPageContainer} reference.
*/
-public class PageContainerBinding<T extends KeyValuePage<?, ?>> extends
+public final class PageContainerBinding<T extends KeyValuePage<?, ?>> extends
TupleBinding<RecordPageContainer<T>> {
+ /** Logger. */
+ private static final LogWrapper LOGGER = new LogWrapper(
+ LoggerFactory.getLogger(PageContainerBinding.class));
+
/** {@link ResourceConfiguration} instance. */
private final PageReadTrx mPageReadTrx;
@@ -60,24 +68,29 @@ public PageContainerBinding(final PageReadTrx pageReadTrx) {
mPageReadTrx = pageReadTrx;
}
-
@Override
- public RecordPageContainer<T> entryToObject(
- final @Nullable TupleInput input) {
+ public RecordPageContainer<T> entryToObject(final @Nullable TupleInput input) {
if (input == null) {
@SuppressWarnings("unchecked")
final RecordPageContainer<T> emptyInstance = (RecordPageContainer<T>) RecordPageContainer.EMPTY_INSTANCE;
return emptyInstance;
}
- final ByteArrayDataInput source = ByteStreams.newDataInput(input
- .getBufferBytes());
- @SuppressWarnings("unchecked")
- final T current = (T) PagePersistenter
- .deserializePage(source, mPageReadTrx);
- @SuppressWarnings("unchecked")
- final T modified = (T) PagePersistenter
- .deserializePage(source, mPageReadTrx);
- return new RecordPageContainer<T>(current, modified);
+ final DataInputStream source = new DataInputStream(
+ new ByteArrayInputStream(input.getBufferBytes()));
+ try {
+ @SuppressWarnings("unchecked")
+ final T current = (T) PagePersistenter.deserializePage(source,
+ mPageReadTrx);
+ @SuppressWarnings("unchecked")
+ final T modified = (T) PagePersistenter.deserializePage(source,
+ mPageReadTrx);
+ return new RecordPageContainer<T>(current, modified);
+ } catch (final IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ @SuppressWarnings("unchecked")
+ final RecordPageContainer<T> emptyInstance = (RecordPageContainer<T>) RecordPageContainer.EMPTY_INSTANCE;
+ return emptyInstance;
+ }
}
@Override
@@ -27,15 +27,19 @@
package org.sirix.cache;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
import javax.annotation.Nullable;
import org.sirix.page.PagePersistenter;
import org.sirix.page.UnorderedKeyValuePage;
import org.sirix.page.interfaces.KeyValuePage;
+import org.sirix.utils.LogWrapper;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Objects;
-import com.google.common.io.ByteArrayDataOutput;
-import com.google.common.io.ByteStreams;
import com.sleepycat.bind.tuple.TupleOutput;
/**
@@ -61,6 +65,9 @@
*/
public final class RecordPageContainer<T extends KeyValuePage<?, ?>> {
+ /** Logger. */
+ private static final LogWrapper LOGGER = new LogWrapper(LoggerFactory.getLogger(RecordPageContainer.class));
+
/**
* {@link UnorderedKeyValuePage} reference, which references the complete
* key/value page.
@@ -149,9 +156,14 @@ public T getModified() {
* for serialization
*/
public void serialize(final TupleOutput out) {
- final ByteArrayDataOutput sink = ByteStreams.newDataOutput();
- PagePersistenter.serializePage(sink, mComplete);
- PagePersistenter.serializePage(sink, mModified);
+ final ByteArrayOutputStream sink = new ByteArrayOutputStream();
+ final DataOutputStream dataOut = new DataOutputStream(sink);
+ try {
+ PagePersistenter.serializePage(dataOut, mComplete);
+ PagePersistenter.serializePage(dataOut, mModified);
+ } catch (final IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
out.write(sink.toByteArray());
}
@@ -1,5 +1,7 @@
package org.sirix.index.bplustree;
+import java.io.DataOutputStream;
+import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
@@ -103,7 +105,8 @@ public BPlusInnerNodePage(final @Nonnegative long recordPageKey,
*/
protected BPlusInnerNodePage(final ByteArrayDataInput in,
final PageReadTrx pageReadTrx) {
- mDelegate = new PageDelegate(Constants.INP_REFERENCE_COUNT, in);
+ mDelegate = null;
+// mDelegate = new PageDelegate(Constants.INP_REFERENCE_COUNT, in);
mRecordPageKey = in.readLong();
final int size = in.readInt();
mRecords = new TreeMap<>();
@@ -132,7 +135,7 @@ public void setRightPage(final Optional<PageReference> rightPage) {
}
@Override
- public void serialize(final ByteArrayDataOutput out) {
+ public void serialize(final DataOutputStream out) throws IOException {
super.serialize(out);
out.writeLong(mRecordPageKey);
out.writeInt(mRecords.size());
@@ -147,7 +150,7 @@ public void serialize(final ByteArrayDataOutput out) {
}
private void serializePointer(final Optional<PageReference> page,
- final ByteArrayDataOutput out) {
+ final DataOutputStream out) throws IOException {
if (page.isPresent()) {
out.writeBoolean(page.get().getKey() == org.sirix.settings.Constants.NULL_ID ? false
: true);
@@ -1,5 +1,7 @@
package org.sirix.index.bplustree;
+import java.io.DataOutputStream;
+import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
@@ -131,7 +133,7 @@ public void setRightPage(final Optional<PageReference> rightPage) {
}
@Override
- public void serialize(final ByteArrayDataOutput out) {
+ public void serialize(final DataOutputStream out) throws IOException {
out.writeLong(mRecordPageKey);
serializePointer(mLeftPage, out);
serializePointer(mRightPage, out);
@@ -144,7 +146,7 @@ public void serialize(final ByteArrayDataOutput out) {
}
private void serializePointer(final Optional<PageReference> page,
- final ByteArrayDataOutput out) {
+ final DataOutputStream out) throws IOException {
if (page.isPresent()) {
out.writeBoolean(page.get().getKey() == org.sirix.settings.Constants.NULL_ID ? false
: true);
@@ -2,15 +2,16 @@
import static com.google.common.base.Preconditions.checkNotNull;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.sirix.settings.Constants;
import com.google.common.collect.HashBiMap;
-import com.google.common.io.ByteArrayDataInput;
-import com.google.common.io.ByteArrayDataOutput;
/**
* Names index structure.
@@ -40,7 +41,7 @@ private Names() {
* @param in
* the persistent storage
*/
- private Names(final ByteArrayDataInput in) {
+ private Names(final DataInputStream in) throws IOException {
final int mapSize = in.readInt();
mNameMap = HashBiMap.create(mapSize);
mCountNameMapping = new HashMap<>(mapSize);
@@ -62,7 +63,7 @@ private Names(final ByteArrayDataInput in) {
* @param out
* the persistent storage
*/
- public void serialize(final ByteArrayDataOutput out) {
+ public void serialize(final DataOutputStream out) throws IOException {
out.writeInt(mNameMap.size());
for (final Entry<Integer, byte[]> entry : mNameMap.entrySet()) {
out.writeInt(entry.getKey());
@@ -179,7 +180,7 @@ public static Names getInstance() {
* input source, the persistent storage
* @return cloned index
*/
- public static Names clone(final ByteArrayDataInput in) {
+ public static Names clone(final DataInputStream in) throws IOException {
return new Names(in);
}
}
@@ -27,17 +27,18 @@
package org.sirix.io.berkeley.binding;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
import org.sirix.api.PageReadTrx;
-import org.sirix.exception.SirixIOException;
import org.sirix.io.bytepipe.ByteHandlePipeline;
import org.sirix.page.PagePersistenter;
import org.sirix.page.delegates.PageDelegate;
import org.sirix.page.interfaces.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.io.ByteArrayDataOutput;
-import com.google.common.io.ByteStreams;
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
@@ -71,7 +72,7 @@ public PageBinding(final PageBinding pageBinding) {
mByteHandler = new ByteHandlePipeline(pageBinding.mByteHandler);
mPageReadTrx = pageBinding.mPageReadTrx;
}
-
+
/**
* Constructor.
*
@@ -89,7 +90,7 @@ public PageBinding(final ByteHandlePipeline byteHandler) {
* @param byteHandler
* byte handler pipleine
* @param pageReadTrx
- * page reading transaction
+ * page reading transaction
*/
public PageBinding(final ByteHandlePipeline byteHandler,
final PageReadTrx pageReadTrx) {
@@ -100,23 +101,23 @@ public PageBinding(final ByteHandlePipeline byteHandler,
@Override
public Page entryToObject(final TupleInput input) {
- byte[] deserialized = new byte[0];
try {
- deserialized = mByteHandler.deserialize(input.getBufferBytes());
- } catch (final SirixIOException e) {
+ return PagePersistenter.deserializePage(
+ new DataInputStream(mByteHandler.deserialize(input)), mPageReadTrx);
+ } catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
+ return null;
}
- return PagePersistenter.deserializePage(
- ByteStreams.newDataInput(deserialized), mPageReadTrx);
- }
+ }
@Override
public void objectToEntry(final Page page, final TupleOutput output) {
- final ByteArrayDataOutput outputData = ByteStreams.newDataOutput();
- PagePersistenter.serializePage(outputData, page);
try {
- output.write(mByteHandler.serialize(outputData.toByteArray()));
- } catch (final SirixIOException e) {
+ final DataOutputStream outputData = new DataOutputStream(output);
+ PagePersistenter.serializePage(outputData, page);
+ mByteHandler.serialize(outputData);
+ output.close();
+ } catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
Oops, something went wrong.

0 comments on commit 13d20f0

Please sign in to comment.