From bd9ff47b7f5992a292e3e8a62504c2de9f72ca2f Mon Sep 17 00:00:00 2001 From: laa Date: Fri, 29 Dec 2017 13:04:29 +0700 Subject: [PATCH] Snappy library was removed --- core/pom.xml | 7 -- .../core/compression/OCompressionFactory.java | 2 - .../compression/impl/OSnappyCompression.java | 67 ------------------- .../core/config/OGlobalConfiguration.java | 2 +- .../orient/console/OConsoleDatabaseApp.java | 4 +- 5 files changed, 3 insertions(+), 79 deletions(-) mode change 100644 => 100755 core/src/main/java/com/orientechnologies/orient/core/compression/OCompressionFactory.java delete mode 100644 core/src/main/java/com/orientechnologies/orient/core/compression/impl/OSnappyCompression.java mode change 100644 => 100755 tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java diff --git a/core/pom.xml b/core/pom.xml index 07454304bf5..a85e469875b 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -37,7 +37,6 @@ javax.imageio.spi,sun.misc;resolution:=optional, com.orientechnologies.orient.client.remote;resolution:=optional, com.sun.jna;resolution:=optional, - org.xerial.snappy;resolution:=optional, sun.nio.ch;resolution:=optional, com.orientechnologies.orient.server.distributed.impl;resolution:=optional, com.orientechnologies.orient.server.distributed.impl.task;resolution:=optional, @@ -240,12 +239,6 @@ 4.5.0 - - org.xerial.snappy - snappy-java - 1.1.0.1 - - com.googlecode.concurrentlinkedhashmap concurrentlinkedhashmap-lru diff --git a/core/src/main/java/com/orientechnologies/orient/core/compression/OCompressionFactory.java b/core/src/main/java/com/orientechnologies/orient/core/compression/OCompressionFactory.java old mode 100644 new mode 100755 index e87168e174f..7bc8f78317c --- a/core/src/main/java/com/orientechnologies/orient/core/compression/OCompressionFactory.java +++ b/core/src/main/java/com/orientechnologies/orient/core/compression/OCompressionFactory.java @@ -26,7 +26,6 @@ import com.orientechnologies.orient.core.compression.impl.OHighZIPCompression; import com.orientechnologies.orient.core.compression.impl.OLowZIPCompression; import com.orientechnologies.orient.core.compression.impl.ONothingCompression; -import com.orientechnologies.orient.core.compression.impl.OSnappyCompression; import com.orientechnologies.orient.core.exception.OSecurityException; import java.util.HashMap; @@ -52,7 +51,6 @@ public OCompressionFactory() { register(new OHighZIPCompression()); register(new OLowZIPCompression()); register(new OGZIPCompression()); - register(new OSnappyCompression()); register(new ONothingCompression()); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OSnappyCompression.java b/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OSnappyCompression.java deleted file mode 100644 index c6bbb43f698..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/compression/impl/OSnappyCompression.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com) - * * - * * Licensed 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. - * * - * * For more information: http://www.orientechnologies.com - * - */ - -package com.orientechnologies.orient.core.compression.impl; - -import com.orientechnologies.common.exception.OException; -import com.orientechnologies.orient.core.exception.ODatabaseException; -import org.xerial.snappy.Snappy; - -import java.io.IOException; - -/** - * @author Andrey Lomakin - * @since 05.06.13 - */ -public class OSnappyCompression extends OAbstractCompression { - public static final String NAME = "snappy"; - - public static final OSnappyCompression INSTANCE = new OSnappyCompression(); - - @Override - public byte[] compress(byte[] content, final int offset, final int length) { - try { - final byte[] buf = new byte[Snappy.maxCompressedLength(length)]; - final int compressedByteSize = Snappy.rawCompress(content, offset, length, buf, 0); - final byte[] result = new byte[compressedByteSize]; - System.arraycopy(buf, 0, result, 0, compressedByteSize); - return result; - } catch (IOException e) { - throw OException.wrapException(new ODatabaseException("Error during data compression"), e); - } - } - - @Override - public byte[] uncompress(byte[] content, final int offset, final int length) { - try { - byte[] result = new byte[Snappy.uncompressedLength(content, offset, length)]; - int byteSize = Snappy.uncompress(content, offset, length, result, 0); - return result; - - } catch (IOException e) { - throw OException.wrapException(new ODatabaseException("Error during data decompression"), e); - } - } - - @Override - public String name() { - return NAME; - } -} \ No newline at end of file diff --git a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java index 0fe1971f234..48b535681c4 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java +++ b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java @@ -195,7 +195,7 @@ public void change(Object currentValue, Object newValue) { "Indicates a force sync should be performed for each update on the storage configuration", Boolean.class, true), STORAGE_COMPRESSION_METHOD("storage.compressionMethod", "Record compression method used in storage" - + " Possible values : gzip, nothing, snappy, snappy-native. Default is 'nothing' that means no compression", String.class, + + " Possible values : gzip, nothing. Default is 'nothing' that means no compression", String.class, "nothing"), STORAGE_ENCRYPTION_METHOD("storage.encryptionMethod", diff --git a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java old mode 100644 new mode 100755 index a72473e8c10..fad2cc6fb21 --- a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java +++ b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java @@ -268,7 +268,7 @@ public void createDatabase( @ConsoleParameter(name = "password", optional = true, description = "Server administrator password") String userPassword, @ConsoleParameter(name = "storage-type", optional = true, description = "The type of the storage: 'plocal' for disk-based databases and 'memory' for in-memory database") String storageType, @ConsoleParameter(name = "db-type", optional = true, description = "The type of the database used between 'document' and 'graph'. By default is graph.") String databaseType, - @ConsoleParameter(name = "[options]", optional = true, description = "Additional options, example: -encryption=aes -compression=snappy") final String options) + @ConsoleParameter(name = "[options]", optional = true, description = "Additional options, example: -encryption=aes -compression=nothing") final String options) throws IOException { disconnect(); @@ -321,7 +321,7 @@ else if ("-compression".equalsIgnoreCase(oentry.getKey())) } protected Map parseCommandOptions( - @ConsoleParameter(name = "[options]", optional = true, description = "Additional options, example: -encryption=aes -compression=snappy") String options) { + @ConsoleParameter(name = "[options]", optional = true, description = "Additional options, example: -encryption=aes -compression=nothing") String options) { final Map omap = new HashMap(); if (options != null) { final List kvOptions = OStringSerializerHelper.smartSplit(options, ',', false);