You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/07/08 18:21:22 UTC
[14/21] incubator-geode git commit: GEODE-1566: rename
GeodeRedisServer and repackage redis code into org.apache.geode
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
deleted file mode 100755
index b45f1b8..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetRangeExecutor.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisDataType;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class GetRangeExecutor extends StringExecutor {
-
- private final String ERROR_NOT_INT = "The indexes provided must be numeric values";
-
- private final int startIndex = 2;
-
- private final int stopIndex = 3;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 4) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETRANGE));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkDataType(key, RedisDataType.REDIS_STRING, context);
- ByteArrayWrapper valueWrapper = r.get(key);
-
- if (valueWrapper == null) {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- return;
- }
-
- byte[] value = valueWrapper.toBytes();
- int length = value.length;
-
- long start;
- long end;
-
-
- try {
- byte[] startI = commandElems.get(startIndex);
- byte[] stopI = commandElems.get(stopIndex);
- start = Coder.bytesToLong(startI);
- end = Coder.bytesToLong(stopI);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
- return;
- }
- start = getBoundedStartIndex(start, length);
- end = getBoundedEndIndex(end, length);
-
- /*
- * If the properly formatted indexes are illegal, send nil
- */
- if (start > end || start == length) {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- return;
- }
- /*
- * 1 is added to end because the end in copyOfRange is exclusive
- * but in Redis it is inclusive
- */
- if (end != length) end++;
- byte[] returnRange = Arrays.copyOfRange(value, (int) start, (int) end);
- if (returnRange == null || returnRange.length == 0) {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- return;
- }
-
- command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), returnRange));
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
deleted file mode 100755
index 4abfdeb..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/GetSetExecutor.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class GetSetExecutor extends StringExecutor {
-
- private final int VALUE_INDEX = 2;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 3) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.GETSET));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
-
- byte[] newCharValue = commandElems.get(VALUE_INDEX);
- ByteArrayWrapper newValueWrapper = new ByteArrayWrapper(newCharValue);
-
- ByteArrayWrapper oldValueWrapper = r.get(key);
- r.put(key, newValueWrapper);
-
- if (oldValueWrapper == null) {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- } else {
- command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), oldValueWrapper.toBytes()));
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
deleted file mode 100755
index c7c46af..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByExecutor.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class IncrByExecutor extends StringExecutor {
-
- private final String ERROR_VALUE_NOT_USABLE = "The value at this key cannot be incremented numerically";
-
- private final String ERROR_INCREMENT_NOT_USABLE = "The increment on this key must be numeric";
-
- private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
- private final int INCREMENT_INDEX = 2;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 3) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBY));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
- ByteArrayWrapper valueWrapper = r.get(key);
-
- /*
- * Try increment
- */
-
- byte[] incrArray = commandElems.get(INCREMENT_INDEX);
- Long increment;
-
- try {
- increment = Coder.bytesToLong(incrArray);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
- return;
- }
-
- /*
- * Value does not exist
- */
-
- if (valueWrapper == null) {
- r.put(key, new ByteArrayWrapper(incrArray));
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), increment));
- return;
- }
-
- /*
- * Value exists
- */
-
- String stringValue = Coder.bytesToString(valueWrapper.toBytes());
- Long value;
- try {
- value = Long.parseLong(stringValue);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
- return;
- }
-
- /*
- * Check for overflow
- */
- if (value >= 0 && increment > (Long.MAX_VALUE - value)) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
- return;
- }
-
- value += increment;
-
- stringValue = "" + value;
- r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
deleted file mode 100755
index d1082d0..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrByFloatExecutor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class IncrByFloatExecutor extends StringExecutor {
-
- private final String ERROR_VALUE_NOT_USABLE = "Invalid value at this key and cannot be incremented numerically";
-
- private final String ERROR_INCREMENT_NOT_USABLE = "The increment on this key must be a valid floating point numeric";
-
- private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
- private final int INCREMENT_INDEX = 2;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
- if (commandElems.size() < 3) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCRBYFLOAT));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
- ByteArrayWrapper valueWrapper = r.get(key);
-
- /*
- * Try increment
- */
-
- byte[] incrArray = commandElems.get(INCREMENT_INDEX);
- String doub = Coder.bytesToString(incrArray).toLowerCase();
- if (doub.contains("inf") || doub.contains("nan")) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), "Increment would produce NaN or infinity"));
- return;
- } else if (valueWrapper != null && valueWrapper.toString().contains(" ")) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
- return;
- }
-
-
- Double increment;
-
- try {
- increment = Coder.stringToDouble(doub);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_INCREMENT_NOT_USABLE));
- return;
- }
-
- /*
- * Value does not exist
- */
-
- if (valueWrapper == null) {
- r.put(key, new ByteArrayWrapper(incrArray));
- command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), increment));
- return;
- }
-
- /*
- * Value exists
- */
-
- String stringValue = Coder.bytesToString(valueWrapper.toBytes());
-
- Double value;
- try {
- value = Coder.stringToDouble(stringValue);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
- return;
- }
-
- /*
- * Check for overflow
- */
- if (value >= 0 && increment > (Double.MAX_VALUE - value)) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
- return;
- }
-
- double result = value + increment;
- if (Double.isNaN(result) || Double.isInfinite(result)) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_NAN_INF_INCR));
- return;
- }
- value += increment;
-
- stringValue = "" + value;
- r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
- command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), value));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
deleted file mode 100755
index 417bd5b..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/IncrExecutor.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class IncrExecutor extends StringExecutor {
-
- private final String ERROR_VALUE_NOT_USABLE = "The value at this key cannot be incremented numerically";
-
- private final String ERROR_OVERFLOW = "This incrementation cannot be performed due to overflow";
-
- private final int INIT_VALUE_INT = 1;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 2) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.INCR));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
- ByteArrayWrapper valueWrapper = r.get(key);
-
- /*
- * Value does not exist
- */
-
- if (valueWrapper == null) {
- byte[] newValue = {Coder.NUMBER_1_BYTE};
- r.put(key, new ByteArrayWrapper(newValue));
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), INIT_VALUE_INT));
- return;
- }
-
- /*
- * Value exists
- */
-
- String stringValue = valueWrapper.toString();
-
- Long value;
- try {
- value = Long.parseLong(stringValue);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE_NOT_USABLE));
- return;
- }
-
- if (value == Long.MAX_VALUE) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_OVERFLOW));
- return;
- }
-
- value++;
-
- stringValue = "" + value;
- r.put(key, new ByteArrayWrapper(Coder.stringToBytes(stringValue)));
-
-
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), value));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
deleted file mode 100755
index 1a93d3e..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MGetExecutor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class MGetExecutor extends StringExecutor {
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 2) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MGET));
- return;
- }
-
- Collection<ByteArrayWrapper> keys = new ArrayList<ByteArrayWrapper>();
- for (int i = 1; i < commandElems.size(); i++) {
- byte[] keyArray = commandElems.get(i);
- ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
- /*
- try {
- checkDataType(key, RedisDataType.REDIS_STRING, context);
- } catch (RedisDataTypeMismatchException e) {
- keys.ad
- continue;
- }
- */
- keys.add(key);
- }
-
- Map<ByteArrayWrapper, ByteArrayWrapper> results = r.getAll(keys);
-
- Collection<ByteArrayWrapper> values = new ArrayList<ByteArrayWrapper>();
-
- /*
- * This is done to preserve order in the output
- */
- for (ByteArrayWrapper key : keys)
- values.add(results.get(key));
-
- command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), values));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
deleted file mode 100755
index 56d85f5..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetExecutor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-import com.gemstone.gemfire.internal.redis.RedisDataTypeMismatchException;
-import com.gemstone.gemfire.internal.redis.Coder;
-
-public class MSetExecutor extends StringExecutor {
-
- private final String SUCCESS = "OK";
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSET));
- return;
- }
-
- Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
- for (int i = 1; i < commandElems.size(); i += 2) {
- byte[] keyArray = commandElems.get(i);
- ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
- try {
- checkAndSetDataType(key, context);
- } catch (RedisDataTypeMismatchException e) {
- continue;
- }
- byte[] value = commandElems.get(i + 1);
- map.put(key, new ByteArrayWrapper(value));
- }
- r.putAll(map);
-
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
deleted file mode 100755
index 996a7f1..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/MSetNXExecutor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-import com.gemstone.gemfire.internal.redis.RedisDataTypeMismatchException;
-import com.gemstone.gemfire.internal.redis.Coder;
-
-public class MSetNXExecutor extends StringExecutor {
-
- private final int SET = 1;
-
- private final int NOT_SET = 0;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSETNX));
- return;
- }
-
- boolean hasEntry = false;
-
- Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
- for (int i = 1; i < commandElems.size(); i += 2) {
- byte[] keyArray = commandElems.get(i);
- ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
- try {
- checkDataType(key, context);
- } catch (RedisDataTypeMismatchException e) {
- hasEntry = true;
- break;
- }
- byte[] value = commandElems.get(i + 1);
- map.put(key, new ByteArrayWrapper(value));
- if (r.containsKey(key)) {
- hasEntry = true;
- break;
- }
- }
- boolean successful = false;
- if (!hasEntry) {
- successful = true;
- for (ByteArrayWrapper k : map.keySet()) {
- try {
- checkAndSetDataType(k, context);
- } catch (RedisDataTypeMismatchException e) {
- successful = false;
- break;
- }
- }
- r.putAll(map);
- }
- if (successful) {
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
- } else {
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/PSetEXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/PSetEXExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/PSetEXExecutor.java
deleted file mode 100755
index bfdbe74..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/PSetEXExecutor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-
-public class PSetEXExecutor extends SetEXExecutor {
-
- @Override
- public boolean timeUnitMillis() {
- return true;
- }
-
- @Override
- public String getArgsError() {
- return ArityDef.PSETEX;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
deleted file mode 100755
index bb1dafa..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetBitExecutor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class SetBitExecutor extends StringExecutor {
-
- private final String ERROR_NOT_INT = "The number provided must be numeric";
-
- private final String ERROR_VALUE = "The value is out of range, must be 0 or 1";
-
- private final String ERROR_ILLEGAL_OFFSET = "The offset is out of range, must be greater than or equal to 0 and at most 4294967295 (512MB)";
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 4) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETBIT));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
- ByteArrayWrapper wrapper = r.get(key);
-
- long offset;
- int value;
- int returnBit = 0;
- try {
- byte[] offAr = commandElems.get(2);
- byte[] valAr = commandElems.get(3);
- offset = Coder.bytesToLong(offAr);
- value = Coder.bytesToInt(valAr);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
- return;
- }
-
- if (value != 0 && value != 1) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_VALUE));
- return;
- }
-
- if (offset < 0 || offset > 4294967295L) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_OFFSET));
- return;
- }
-
- int byteIndex = (int) (offset / 8);
- offset %= 8;
-
- if (wrapper == null) {
- byte[] bytes = new byte[byteIndex + 1];
- if (value == 1)
- bytes[byteIndex] = (byte) (0x80 >> offset);
- r.put(key, new ByteArrayWrapper(bytes));
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
- } else {
-
- byte[] bytes = wrapper.toBytes();
- if (byteIndex < bytes.length)
- returnBit = (bytes[byteIndex] & (0x80 >> offset)) >> (7 - offset);
- else
- returnBit = 0;
-
- if (byteIndex < bytes.length) {
- bytes[byteIndex] = value == 1 ? (byte) (bytes[byteIndex] | (0x80 >> offset)) : (byte) (bytes[byteIndex] & ~(0x80 >> offset));
- r.put(key, new ByteArrayWrapper(bytes));
- } else {
- byte[] newBytes = new byte[byteIndex + 1];
- System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
- newBytes[byteIndex] = value == 1 ? (byte) (newBytes[byteIndex] | (0x80 >> offset)) : (byte) (newBytes[byteIndex] & ~(0x80 >> offset));
- r.put(key, new ByteArrayWrapper(newBytes));
- }
-
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), returnBit));
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
deleted file mode 100755
index cbe6e04..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetEXExecutor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.Extendable;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class SetEXExecutor extends StringExecutor implements Extendable {
-
- private final String ERROR_SECONDS_NOT_A_NUMBER = "The expiration argument provided was not a number";
-
- private final String ERROR_SECONDS_NOT_LEGAL = "The expiration argument must be greater than 0";
-
- private final String SUCCESS = "OK";
-
- private final int VALUE_INDEX = 3;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 4) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- byte[] value = commandElems.get(VALUE_INDEX);
-
- byte[] expirationArray = commandElems.get(2);
- long expiration;
- try {
- expiration = Coder.bytesToLong(expirationArray);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_A_NUMBER));
- return;
- }
-
- if (expiration <= 0) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_SECONDS_NOT_LEGAL));
- return;
- }
-
- if (!timeUnitMillis())
- expiration *= millisInSecond;
-
- checkAndSetDataType(key, context);
- r.put(key, new ByteArrayWrapper(value));
-
- context.getRegionProvider().setExpiration(key, expiration);
-
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
-
- }
-
- protected boolean timeUnitMillis() {
- return false;
- }
-
- @Override
- public String getArgsError() {
- return ArityDef.SETEX;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
deleted file mode 100755
index d8d0d9a..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetExecutor.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class SetExecutor extends StringExecutor {
-
- private final String SUCCESS = "OK";
-
- private final int VALUE_INDEX = 2;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 3) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SET));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkDataType(key, context);
- byte[] value = commandElems.get(VALUE_INDEX);
- ByteArrayWrapper valueWrapper = new ByteArrayWrapper(value);
-
- boolean NX = false; // Set only if not exists
- boolean XX = false; // Set only if exists
- long expiration = 0L;
-
- if (commandElems.size() >= 6) {
- String elem4;
- String elem5;
- String elem6;
-
- elem4 = Coder.bytesToString(commandElems.get(3));
- elem5 = Coder.bytesToString(commandElems.get(4));
- elem6 = Coder.bytesToString(commandElems.get(5));
-
- if (elem4.equalsIgnoreCase("XX") || elem6.equalsIgnoreCase("XX"))
- XX = true;
- else if (elem4.equalsIgnoreCase("NX") || elem6.equalsIgnoreCase("NX"))
- NX = true;
-
- if (elem4.equalsIgnoreCase("PX"))
- expiration = getExpirationMillis(elem4, elem5);
- else if (elem5.equalsIgnoreCase("PX"))
- expiration = getExpirationMillis(elem5, elem6);
- else if (elem4.equalsIgnoreCase("EX"))
- expiration = getExpirationMillis(elem4, elem5);
- else if (elem5.equalsIgnoreCase("EX"))
- expiration = getExpirationMillis(elem5, elem6);
-
- } else if (commandElems.size() >= 5) {
- String elem4;
- String expiry;
-
- elem4 = Coder.bytesToString(commandElems.get(3));
- expiry = Coder.bytesToString(commandElems.get(4));
-
- expiration = getExpirationMillis(elem4, expiry);
- } else if (commandElems.size() >= 4) {
- byte[] elem4 = commandElems.get(3);
- if (elem4.length == 2 && Character.toUpperCase(elem4[1]) == 'X') {
- if (Character.toUpperCase(elem4[0]) == 'N')
- NX = true;
- else if (Character.toUpperCase(elem4[0]) == 'X')
- XX = true;
- }
- }
-
- boolean keyWasSet = false;
-
- if (NX)
- keyWasSet = setNX(r, command, key, valueWrapper, context);
- else if (XX)
- keyWasSet = setXX(r, command, key, valueWrapper, context);
- else {
- checkAndSetDataType(key, context);
- r.put(key, valueWrapper);
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
- keyWasSet = true;
- }
-
- if (keyWasSet && expiration > 0L) {
- context.getRegionProvider().setExpiration(key, expiration);
- }
-
- }
-
- private boolean setNX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command, ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) {
- checkAndSetDataType(key, context);
- Object oldValue = r.putIfAbsent(key, valueWrapper);
- if (oldValue != null) {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- return false;
- } else {
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
- return true;
- }
- }
-
- private boolean setXX(Region<ByteArrayWrapper, ByteArrayWrapper> r, Command command, ByteArrayWrapper key, ByteArrayWrapper valueWrapper, ExecutionHandlerContext context) {
- if(r.containsKey(key)) {
- checkAndSetDataType(key, context);
- r.put(key, valueWrapper);
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
- return true;
- } else {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- return false;
- }
- }
-
- private long getExpirationMillis(String expx, String expirationString) {
- long expiration = 0L;
- try {
- expiration = Long.parseLong(expirationString);
- } catch (NumberFormatException e) {
- return 0L;
- }
-
- if (expx.equalsIgnoreCase("EX"))
- return expiration * millisInSecond;
- else if (expx.equalsIgnoreCase("PX"))
- return expiration;
- else
- return 0L;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
deleted file mode 100755
index b91b997..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetNXExecutor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class SetNXExecutor extends StringExecutor {
-
- private final int SET = 1;
-
- private final int NOT_SET = 0;
-
- private final int VALUE_INDEX = 2;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 3) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETNX));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
- byte[] value = commandElems.get(VALUE_INDEX);
-
- Object oldValue = r.putIfAbsent(key, new ByteArrayWrapper(value));
-
- if (oldValue != null)
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_SET));
- else
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), SET));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
deleted file mode 100755
index 7adedb9..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/SetRangeExecutor.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class SetRangeExecutor extends StringExecutor {
-
- private final String ERROR_NOT_INT = "The number provided must be numeric";
-
- private final String ERROR_ILLEGAL_OFFSET = "The offset is out of range, must be greater than or equal to 0 and the offset added to the length of the value must be less than 536870911 (512MB), the maximum allowed size";
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 4) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETRANGE));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkAndSetDataType(key, context);
- ByteArrayWrapper wrapper = r.get(key);
-
- int offset;
- byte[] value = commandElems.get(3);
- try {
- byte[] offAr = commandElems.get(2);
- offset = Coder.bytesToInt(offAr);
- } catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
- return;
- }
-
- int totalLength = offset + value.length;
- if (offset < 0 || totalLength > 536870911) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_OFFSET));
- return;
- } else if (value.length == 0) {
- int length = wrapper == null ? 0 : wrapper.toBytes().length;
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), length));
- if (wrapper == null)
- context.getRegionProvider().removeKey(key);
- return;
- }
-
- if (wrapper == null) {
- byte[] bytes = new byte[totalLength];
- System.arraycopy(value, 0, bytes, offset, value.length);
- r.put(key, new ByteArrayWrapper(bytes));
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), bytes.length));
- } else {
-
- byte[] bytes = wrapper.toBytes();
- int returnLength;
- if (totalLength < bytes.length) {
- System.arraycopy(value, 0, bytes, offset, value.length);
- r.put(key, new ByteArrayWrapper(bytes));
- returnLength = bytes.length;
- } else {
- byte[] newBytes = new byte[totalLength];
- System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
- System.arraycopy(value, 0, newBytes, offset, value.length);
- returnLength = newBytes.length;
- r.put(key, new ByteArrayWrapper(newBytes));
- }
-
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), returnLength));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
deleted file mode 100755
index 3bf6dba..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StringExecutor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisDataType;
-import com.gemstone.gemfire.internal.redis.RedisDataTypeMismatchException;
-import com.gemstone.gemfire.internal.redis.executor.AbstractExecutor;
-
-public abstract class StringExecutor extends AbstractExecutor {
-
- protected final void checkAndSetDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
- Object oldVal = context.getRegionProvider().metaPutIfAbsent(key, RedisDataType.REDIS_STRING);
- if (oldVal == RedisDataType.REDIS_PROTECTED)
- throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
- if (oldVal != null && oldVal != RedisDataType.REDIS_STRING)
- throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is already used by a " + oldVal.toString());
- }
-
- protected void checkDataType(ByteArrayWrapper key, ExecutionHandlerContext context) {
- RedisDataType currentType = context.getRegionProvider().getRedisDataType(key);
- if (currentType == null)
- return;
- if (currentType == RedisDataType.REDIS_PROTECTED)
- throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is protected");
- if (currentType != RedisDataType.REDIS_STRING)
- throw new RedisDataTypeMismatchException("The key name \"" + key + "\" is already used by a " + currentType.toString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
deleted file mode 100755
index ac51903..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/string/StrlenExecutor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.string;
-
-import java.util.List;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.internal.redis.ByteArrayWrapper;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisDataType;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.RedisConstants.ArityDef;
-
-public class StrlenExecutor extends StringExecutor {
-
- private final int KEY_DOES_NOT_EXIST = 0;
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- List<byte[]> commandElems = command.getProcessedCommand();
-
- Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
-
- if (commandElems.size() < 2) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.STRLEN));
- return;
- }
-
- ByteArrayWrapper key = command.getKey();
- checkDataType(key, RedisDataType.REDIS_STRING, context);
- ByteArrayWrapper valueWrapper = r.get(key);
-
-
- if (valueWrapper == null)
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), KEY_DOES_NOT_EXIST));
- else
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), valueWrapper.toBytes().length));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/DiscardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/DiscardExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/DiscardExecutor.java
deleted file mode 100755
index bcbd153..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/DiscardExecutor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.transactions;
-
-import com.gemstone.gemfire.cache.CacheTransactionManager;
-import com.gemstone.gemfire.cache.TransactionId;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-
-public class DiscardExecutor extends TransactionExecutor {
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
-
- CacheTransactionManager txm = context.getCacheTransactionManager();
-
- if (context.hasTransaction()) {
- TransactionId transactionId = context.getTransactionID();
- txm.resume(transactionId);
- txm.rollback();
- context.clearTransaction();
- }
-
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/ExecExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/ExecExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/ExecExecutor.java
deleted file mode 100755
index 7a02d30..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/ExecExecutor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.transactions;
-
-import io.netty.buffer.ByteBuf;
-
-import java.util.Queue;
-
-import com.gemstone.gemfire.cache.CacheTransactionManager;
-import com.gemstone.gemfire.cache.CommitConflictException;
-import com.gemstone.gemfire.cache.TransactionId;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants;
-
-public class ExecExecutor extends TransactionExecutor {
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
-
- CacheTransactionManager txm = context.getCacheTransactionManager();
-
- if (!context.hasTransaction()) {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
- return;
- }
-
- TransactionId transactionId = context.getTransactionID();
-
- txm.resume(transactionId);
-
- boolean hasError = hasError(context.getTransactionQueue());
-
- if (hasError)
- txm.rollback();
- else {
- try {
- txm.commit();
- } catch (CommitConflictException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_COMMIT_CONFLICT));
- context.clearTransaction();
- return;
- }
- }
-
- ByteBuf response = constructResponseExec(context);
- command.setResponse(response);
-
- context.clearTransaction();
- }
-
- private ByteBuf constructResponseExec(ExecutionHandlerContext context) {
- Queue<Command> cQ = context.getTransactionQueue();
- ByteBuf response = context.getByteBufAllocator().buffer();
- response.writeByte(Coder.ARRAY_ID);
- response.writeBytes(Coder.intToBytes(cQ.size()));
- response.writeBytes(Coder.CRLFar);
-
- for (Command c: cQ) {
- ByteBuf r = c.getResponse();
- response.writeBytes(r);
- }
- return response;
- }
-
- private boolean hasError(Queue<Command> queue) {
- for (Command c: queue) {
- if (c.hasError())
- return true;
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/MultiExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/MultiExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/MultiExecutor.java
deleted file mode 100755
index d834ca6..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/MultiExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.transactions;
-
-import com.gemstone.gemfire.cache.CacheTransactionManager;
-import com.gemstone.gemfire.cache.TransactionId;
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants;
-
-public class MultiExecutor extends TransactionExecutor {
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
-
- CacheTransactionManager txm = context.getCacheTransactionManager();
-
- command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), "OK"));
-
- if (context.hasTransaction()) {
- throw new IllegalStateException(RedisConstants.ERROR_NESTED_MULTI);
- }
-
- txm.begin();
-
- TransactionId id = txm.suspend();
-
- context.setTransactionID(id);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/TransactionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/TransactionExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/TransactionExecutor.java
deleted file mode 100755
index b2a58a8..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/TransactionExecutor.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.transactions;
-
-import com.gemstone.gemfire.internal.redis.executor.AbstractExecutor;
-
-public abstract class TransactionExecutor extends AbstractExecutor {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/UnwatchExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/UnwatchExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/UnwatchExecutor.java
deleted file mode 100755
index 5646968..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/UnwatchExecutor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.transactions;
-
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants;
-
-public class UnwatchExecutor extends TransactionExecutor {
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_UNWATCH));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/WatchExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/WatchExecutor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/WatchExecutor.java
deleted file mode 100755
index 35765a7..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/executor/transactions/WatchExecutor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 com.gemstone.gemfire.internal.redis.executor.transactions;
-
-import com.gemstone.gemfire.internal.redis.Command;
-import com.gemstone.gemfire.internal.redis.Coder;
-import com.gemstone.gemfire.internal.redis.ExecutionHandlerContext;
-import com.gemstone.gemfire.internal.redis.RedisConstants;
-
-public class WatchExecutor extends TransactionExecutor {
-
- @Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_WATCH));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java
deleted file mode 100644
index 64a2b6b..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/redis/org/apache/hadoop/fs/GlobPattern.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * 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 com.gemstone.gemfire.internal.redis.org.apache.hadoop.fs;
-
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-/**
- * A class for POSIX glob pattern with brace expansions.
- */
-public class GlobPattern {
- private static final char BACKSLASH = '\\';
- private Pattern compiled;
- private boolean hasWildcard = false;
-
- /**
- * Construct the glob pattern object with a glob pattern string
- * @param globPattern the glob pattern string
- */
- public GlobPattern(String globPattern) {
- set(globPattern);
- }
-
- /**
- * @return the compiled pattern
- */
- public Pattern compiled() {
- return compiled;
- }
-
- /**
- * Compile glob pattern string
- * @param globPattern the glob pattern
- * @return the pattern object
- */
- public static Pattern compile(String globPattern) {
- return new GlobPattern(globPattern).compiled();
- }
-
- /**
- * Match input against the compiled glob pattern
- * @param s input chars
- * @return true for successful matches
- */
- public boolean matches(CharSequence s) {
- return compiled.matcher(s).matches();
- }
-
- /**
- * Set and compile a glob pattern
- * @param glob the glob pattern string
- */
- public void set(String glob) {
- StringBuilder regex = new StringBuilder();
- int setOpen = 0;
- int curlyOpen = 0;
- int len = glob.length();
- hasWildcard = false;
-
- for (int i = 0; i < len; i++) {
- char c = glob.charAt(i);
-
- switch (c) {
- case BACKSLASH:
- if (++i >= len) {
- error("Missing escaped character", glob, i);
- }
- regex.append(c).append(glob.charAt(i));
- continue;
- case '.':
- case '$':
- case '(':
- case ')':
- case '|':
- case '+':
- // escape regex special chars that are not glob special chars
- regex.append(BACKSLASH);
- break;
- case '*':
- regex.append('.');
- hasWildcard = true;
- break;
- case '?':
- regex.append('.');
- hasWildcard = true;
- continue;
- case '{': // start of a group
- regex.append("(?:"); // non-capturing
- curlyOpen++;
- hasWildcard = true;
- continue;
- case ',':
- regex.append(curlyOpen > 0 ? '|' : c);
- continue;
- case '}':
- if (curlyOpen > 0) {
- // end of a group
- curlyOpen--;
- regex.append(")");
- continue;
- }
- break;
- case '[':
- if (setOpen > 0) {
- error("Unclosed character class", glob, i);
- }
- setOpen++;
- hasWildcard = true;
- break;
- case '^': // ^ inside [...] can be unescaped
- if (setOpen == 0) {
- regex.append(BACKSLASH);
- }
- break;
- case '!': // [! needs to be translated to [^
- regex.append(setOpen > 0 && '[' == glob.charAt(i - 1) ? '^' : '!');
- continue;
- case ']':
- // Many set errors like [][] could not be easily detected here,
- // as []], []-] and [-] are all valid POSIX glob and java regex.
- // We'll just let the regex compiler do the real work.
- setOpen = 0;
- break;
- default:
- }
- regex.append(c);
- }
-
- if (setOpen > 0) {
- error("Unclosed character class", glob, len);
- }
- if (curlyOpen > 0) {
- error("Unclosed group", glob, len);
- }
- compiled = Pattern.compile(regex.toString());
- }
-
- /**
- * @return true if this is a wildcard pattern (with special chars)
- */
- public boolean hasWildcard() {
- return hasWildcard;
- }
-
- private static void error(String message, String pattern, int pos) {
- throw new PatternSyntaxException(message, pattern, pos);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/dfd481e0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
index 9b38fac..120c4e2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
@@ -1742,7 +1742,7 @@ public class CliStrings {
public static final String START_SERVER__REDIS_BIND_ADDRESS = ConfigurationProperties.REDIS_BIND_ADDRESS;
public static final String START_SERVER__REDIS_BIND_ADDRESS__HELP = "Sets the IP address the Geode Redis service listens on for Redis clients. The default is to bind to the first non-loopback address for this machine.";
public static final String START_SERVER__REDIS_PASSWORD = ConfigurationProperties.REDIS_PASSWORD;
- public static final String START_SERVER__REDIS_PASSWORD__HELP = "Sets the authentication password for GemFireRedisServer"; // TODO:GEODE-1566: update golden file to GeodeRedisServer
+ public static final String START_SERVER__REDIS_PASSWORD__HELP = "Sets the authentication password for GeodeRedisServer"; // TODO:GEODE-1566: update golden file to GeodeRedisServer
public static final String START_SERVER__SECURITY_PROPERTIES = "security-properties-file";
public static final String START_SERVER__SECURITY_PROPERTIES__HELP = "The gfsecurity.properties file for configuring the Server's security configuration in the distributed system. The file's path can be absolute or relative to gfsh directory.";
public static final String START_SERVER__REBALANCE = "rebalance";