geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [14/21] geode git commit: GEODE-2449: Moved Redis out of core with minimal Extension work added
Date Fri, 10 Feb 2017 21:34:17 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
deleted file mode 100755
index 493cc12..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SMoveExecutor.java
+++ /dev/null
@@ -1,74 +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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class SMoveExecutor extends SetExecutor {
-
-  private final int MOVED = 1;
-
-  private final int NOT_MOVED = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SMOVE));
-      return;
-    }
-
-    ByteArrayWrapper source = command.getKey();
-    ByteArrayWrapper destination = new ByteArrayWrapper(commandElems.get(2));
-    ByteArrayWrapper mem = new ByteArrayWrapper(commandElems.get(3));
-
-    checkDataType(source, RedisDataType.REDIS_SET, context);
-    checkDataType(destination, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> sourceRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(source);
-
-    if (sourceRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_MOVED));
-      return;
-    }
-
-    Object oldVal = sourceRegion.get(mem);
-    sourceRegion.remove(mem);
-
-    if (oldVal == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_MOVED));
-      return;
-    }
-
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> destinationRegion =
-        (Region<ByteArrayWrapper, Boolean>) getOrCreateRegion(context, destination,
-            RedisDataType.REDIS_SET);
-    destinationRegion.put(mem, true);
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), MOVED));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.java
deleted file mode 100755
index e383538..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SPopExecutor.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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-import java.util.Random;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SPopExecutor extends SetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SPOP));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-    if (keyRegion == null || keyRegion.isEmpty()) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    Random rand = new Random();
-
-    ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[keyRegion.size()]);
-
-    ByteArrayWrapper pop = entries[rand.nextInt(entries.length)];
-
-    keyRegion.remove(pop);
-    if (keyRegion.isEmpty()) {
-      context.getRegionProvider().removeKey(key);
-    }
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), pop.toBytes()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
deleted file mode 100755
index 4594022..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRandMemberExecutor.java
+++ /dev/null
@@ -1,101 +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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SRandMemberExecutor extends SetExecutor {
-
-  private final static String ERROR_NOT_NUMERIC = "The count provided must be numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SRANDMEMBER));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    int count = 1;
-
-    if (commandElems.size() > 2) {
-      try {
-        count = Coder.bytesToInt(commandElems.get(2));
-      } catch (NumberFormatException e) {
-        command
-            .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-        return;
-      }
-    }
-
-    if (keyRegion == null || count == 0) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int members = keyRegion.size();
-
-    if (members <= count && count != 1) {
-      command.setResponse(Coder.getBulkStringArrayResponse(context.getByteBufAllocator(),
-          new HashSet<ByteArrayWrapper>(keyRegion.keySet())));
-      return;
-    }
-
-    Random rand = new Random();
-
-    ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[members]);
-
-    if (count == 1) {
-      ByteArrayWrapper randEntry = entries[rand.nextInt(entries.length)];
-      command.setResponse(
-          Coder.getBulkStringResponse(context.getByteBufAllocator(), randEntry.toBytes()));
-    } else if (count > 0) {
-      Set<ByteArrayWrapper> randEntries = new HashSet<ByteArrayWrapper>();
-      do {
-        ByteArrayWrapper s = entries[rand.nextInt(entries.length)];
-        randEntries.add(s);
-      } while (randEntries.size() < count);
-      command.setResponse(
-          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), randEntries));
-    } else {
-      count = -count;
-      List<ByteArrayWrapper> randEntries = new ArrayList<ByteArrayWrapper>();
-      for (int i = 0; i < count; i++) {
-        ByteArrayWrapper s = entries[rand.nextInt(entries.length)];
-        randEntries.add(s);
-      }
-      command.setResponse(
-          Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), randEntries));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
deleted file mode 100755
index 18d46ee..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SRemExecutor.java
+++ /dev/null
@@ -1,62 +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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SRemExecutor extends SetExecutor {
-
-  private final int NONE_REMOVED = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SREM));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NONE_REMOVED));
-      return;
-    }
-
-    int numRemoved = 0;
-
-    for (int i = 2; i < commandElems.size(); i++) {
-      Object oldVal;
-      oldVal = keyRegion.remove(new ByteArrayWrapper(commandElems.get(i)));
-      if (oldVal != null)
-        numRemoved++;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numRemoved));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
deleted file mode 100755
index b1a3835..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SScanExecutor.java
+++ /dev/null
@@ -1,157 +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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractScanExecutor;
-
-public class SScanExecutor extends AbstractScanExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SSCAN));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    checkDataType(key, RedisDataType.REDIS_SET, context);
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, Boolean> keyRegion =
-        (Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
-    if (keyRegion == null) {
-      command.setResponse(
-          Coder.getScanResponse(context.getByteBufAllocator(), new ArrayList<String>()));
-      return;
-    }
-    byte[] cAr = commandElems.get(2);
-    String cursorString = Coder.bytesToString(cAr);
-    int cursor = 0;
-    Pattern matchPattern = null;
-    String globMatchPattern = null;
-    int count = DEFUALT_COUNT;
-    try {
-      cursor = Integer.parseInt(cursorString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-    if (cursor < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_CURSOR));
-      return;
-    }
-
-    if (commandElems.size() > 4) {
-      try {
-        byte[] bytes = commandElems.get(3);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("MATCH")) {
-          bytes = commandElems.get(4);
-          globMatchPattern = Coder.bytesToString(bytes);
-        } else if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(4);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (commandElems.size() > 6) {
-      try {
-        byte[] bytes = commandElems.get(5);
-        String tmp = Coder.bytesToString(bytes);
-        if (tmp.equalsIgnoreCase("COUNT")) {
-          bytes = commandElems.get(6);
-          count = Coder.bytesToInt(bytes);
-        }
-      } catch (NumberFormatException e) {
-        command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-        return;
-      }
-    }
-
-    if (count < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_COUNT));
-      return;
-    }
-
-    try {
-      matchPattern = convertGlobToRegex(globMatchPattern);
-    } catch (PatternSyntaxException e) {
-      command.setResponse(
-          Coder.getErrorResponse(context.getByteBufAllocator(), RedisConstants.ERROR_ILLEGAL_GLOB));
-      return;
-    }
-
-    @SuppressWarnings("unchecked")
-    List<ByteArrayWrapper> returnList =
-        (List<ByteArrayWrapper>) getIteration(new ArrayList(keyRegion.keySet()), matchPattern,
-            count, cursor);
-
-    command.setResponse(Coder.getScanResponse(context.getByteBufAllocator(), returnList));
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  protected List<?> getIteration(Collection<?> list, Pattern matchPattern, int count, int cursor) {
-    List<Object> returnList = new ArrayList<Object>();
-    int size = list.size();
-    int beforeCursor = 0;
-    int numElements = 0;
-    int i = -1;
-    for (ByteArrayWrapper value : (Collection<ByteArrayWrapper>) list) {
-      String key = Coder.bytesToString(value.toBytes());
-      i++;
-      if (beforeCursor < cursor) {
-        beforeCursor++;
-        continue;
-      } else if (numElements < count) {
-        if (matchPattern != null) {
-          if (matchPattern.matcher(key).matches()) {
-            returnList.add(value);
-            numElements++;
-          }
-        } else {
-          returnList.add(value);
-          numElements++;
-        }
-      } else
-        break;
-    }
-
-    if (i == size - 1)
-      returnList.add(0, String.valueOf(0));
-    else
-      returnList.add(0, String.valueOf(i));
-    return returnList;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
deleted file mode 100755
index 02e879b..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionExecutor.java
+++ /dev/null
@@ -1,50 +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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class SUnionExecutor extends SetOpExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return false;
-  }
-
-  @Override
-  protected Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
-      List<Set<ByteArrayWrapper>> setList) {
-    Set<ByteArrayWrapper> addSet = firstSet;
-    for (Set<ByteArrayWrapper> set : setList) {
-      if (addSet == null) {
-        addSet = new HashSet<ByteArrayWrapper>(set);
-        continue;
-      }
-      addSet.addAll(set);
-    }
-    return addSet;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SUNION;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
deleted file mode 100755
index 96b07e0..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SUnionStoreExecutor.java
+++ /dev/null
@@ -1,32 +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 org.apache.geode.redis.internal.executor.set;
-
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-
-public class SUnionStoreExecutor extends SUnionExecutor {
-
-  @Override
-  protected boolean isStorage() {
-    return true;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.SUNIONSTORE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
deleted file mode 100755
index 0227e88..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetExecutor.java
+++ /dev/null
@@ -1,21 +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 org.apache.geode.redis.internal.executor.set;
-
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class SetExecutor extends AbstractExecutor {
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
deleted file mode 100755
index 7ca72a5..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/set/SetOpExecutor.java
+++ /dev/null
@@ -1,114 +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 org.apache.geode.redis.internal.executor.set;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
-public abstract class SetOpExecutor extends SetExecutor implements Extendable {
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-    int setsStartIndex = isStorage() ? 2 : 1;
-    if (commandElems.size() < setsStartIndex + 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-    RegionProvider rC = context.getRegionProvider();
-    ByteArrayWrapper destination = null;
-    if (isStorage())
-      destination = command.getKey();
-
-    ByteArrayWrapper firstSetKey = new ByteArrayWrapper(commandElems.get(setsStartIndex++));
-    if (!isStorage())
-      checkDataType(firstSetKey, RedisDataType.REDIS_SET, context);
-    Region<ByteArrayWrapper, Boolean> region =
-        (Region<ByteArrayWrapper, Boolean>) rC.getRegion(firstSetKey);
-    Set<ByteArrayWrapper> firstSet = null;
-    if (region != null) {
-      firstSet = new HashSet<ByteArrayWrapper>(region.keySet());
-    }
-    ArrayList<Set<ByteArrayWrapper>> setList = new ArrayList<Set<ByteArrayWrapper>>();
-    for (int i = setsStartIndex; i < commandElems.size(); i++) {
-      ByteArrayWrapper key = new ByteArrayWrapper(commandElems.get(i));
-      checkDataType(key, RedisDataType.REDIS_SET, context);
-      region = (Region<ByteArrayWrapper, Boolean>) rC.getRegion(key);
-      if (region != null)
-        setList.add(region.keySet());
-      else if (this instanceof SInterExecutor)
-        setList.add(null);
-    }
-    if (setList.isEmpty()) {
-      if (isStorage()) {
-        command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-        context.getRegionProvider().removeKey(destination);
-      } else {
-        if (firstSet == null)
-          command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-        else
-          command.setResponse(
-              Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), firstSet));
-      }
-      return;
-    }
-
-    Set<ByteArrayWrapper> resultSet = setOp(firstSet, setList);
-    if (isStorage()) {
-      Region<ByteArrayWrapper, Boolean> newRegion = null; // (Region<ByteArrayWrapper, Boolean>)
-                                                          // rC.getRegion(destination);
-      rC.removeKey(destination);
-      if (resultSet != null) {
-        Map<ByteArrayWrapper, Boolean> map = new HashMap<ByteArrayWrapper, Boolean>();
-        for (ByteArrayWrapper entry : resultSet)
-          map.put(entry, Boolean.TRUE);
-        if (!map.isEmpty()) {
-          newRegion = (Region<ByteArrayWrapper, Boolean>) rC.getOrCreateRegion(destination,
-              RedisDataType.REDIS_SET, context);
-          newRegion.putAll(map);
-        }
-        command
-            .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), resultSet.size()));
-      } else {
-        command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      }
-    } else {
-      if (resultSet == null || resultSet.isEmpty())
-        command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      else
-        command.setResponse(
-            Coder.getBulkStringArrayResponse(context.getByteBufAllocator(), resultSet));
-    }
-  }
-
-  protected abstract boolean isStorage();
-
-  protected abstract Set<ByteArrayWrapper> setOp(Set<ByteArrayWrapper> firstSet,
-      List<Set<ByteArrayWrapper>> setList);
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
deleted file mode 100755
index 5330c80..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/SortedSetExecutor.java
+++ /dev/null
@@ -1,43 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.AbstractExecutor;
-
-public abstract class SortedSetExecutor extends AbstractExecutor {
-
-  @Override
-  protected Region<ByteArrayWrapper, DoubleWrapper> getOrCreateRegion(
-      ExecutionHandlerContext context, ByteArrayWrapper key, RedisDataType type) {
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, DoubleWrapper> r = (Region<ByteArrayWrapper, DoubleWrapper>) context
-        .getRegionProvider().getOrCreateRegion(key, type, context);
-    return r;
-  }
-
-  protected Region<ByteArrayWrapper, DoubleWrapper> getRegion(ExecutionHandlerContext context,
-      ByteArrayWrapper key) {
-    @SuppressWarnings("unchecked")
-    Region<ByteArrayWrapper, DoubleWrapper> r =
-        (Region<ByteArrayWrapper, DoubleWrapper>) context.getRegionProvider().getRegion(key);
-    return r;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
deleted file mode 100755
index a5bbebc..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
+++ /dev/null
@@ -1,90 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZAddExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERICAL = "The inteded score is not a float";
-
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4 || commandElems.size() % 2 == 1) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZADD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    int numberOfAdds = 0;
-
-    if (commandElems.size() > 4) {
-      Map<ByteArrayWrapper, DoubleWrapper> map = new HashMap<ByteArrayWrapper, DoubleWrapper>();
-      for (int i = 2; i < commandElems.size(); i++) {
-        byte[] scoreArray = commandElems.get(i++);
-        byte[] memberArray = commandElems.get(i);
-
-        Double score;
-        try {
-          score = Coder.bytesToDouble(scoreArray);
-        } catch (NumberFormatException e) {
-          command.setResponse(
-              Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERICAL));
-          return;
-        }
-
-        map.put(new ByteArrayWrapper(memberArray), new DoubleWrapper(score));
-        numberOfAdds++;
-      }
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-          getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-      keyRegion.putAll(map);
-    } else {
-      byte[] scoreArray = commandElems.get(2);
-      byte[] memberArray = commandElems.get(3);
-      Double score;
-      try {
-        score = Coder.bytesToDouble(scoreArray);
-      } catch (NumberFormatException e) {
-        command.setResponse(
-            Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERICAL));
-        return;
-      }
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-          getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-      Object oldVal = keyRegion.put(new ByteArrayWrapper(memberArray), new DoubleWrapper(score));
-
-      if (oldVal == null)
-        numberOfAdds = 1;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numberOfAdds));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
deleted file mode 100755
index 2294e4e..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCardExecutor.java
+++ /dev/null
@@ -1,53 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-
-public class ZCardExecutor extends SortedSetExecutor {
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 2) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCARD));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-
-    if (keyRegion == null)
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-    else
-      command
-          .setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), keyRegion.size()));
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
deleted file mode 100755
index 72eae68..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZCountExecutor.java
+++ /dev/null
@@ -1,146 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZCountExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZCOUNT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    boolean startInclusive = true;
-    boolean stopInclusive = true;
-    double start;
-    double stop;
-
-    byte[] startArray = commandElems.get(2);
-    byte[] stopArray = commandElems.get(3);
-    String startString = Coder.bytesToString(startArray);
-    String stopString = Coder.bytesToString(stopArray);
-
-    if (startArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      startInclusive = false;
-    }
-    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      stopInclusive = false;
-    }
-
-    try {
-      start = Coder.stringToDouble(startString);
-      stop = Coder.stringToDouble(stopString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-
-    int count;
-    try {
-      count = getCount(key, keyRegion, context, start, stop, startInclusive, stopInclusive);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), count));
-  }
-
-  private int getCount(ByteArrayWrapper key, Region<ByteArrayWrapper, DoubleWrapper> keyRegion,
-      ExecutionHandlerContext context, double start, double stop, boolean startInclusive,
-      boolean stopInclusive) throws FunctionDomainException, TypeMismatchException,
-      NameResolutionException, QueryInvocationTargetException {
-    if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY)
-      return keyRegion.size();
-    else if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY)
-      return 0;
-
-    Query query;
-    Object[] params;
-    if (start == Double.NEGATIVE_INFINITY) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZCOUNTNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZCOUNTNINF, context);
-      }
-      params = new Object[] {stop};
-    } else if (stop == Double.POSITIVE_INFINITY) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZCOUNTPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZCOUNTPINF, context);
-      }
-      params = new Object[] {start};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZCOUNTSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZCOUNTSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZCOUNTSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZCOUNT, context);
-        }
-      }
-      params = new Object[] {start, stop};
-    }
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Integer) results.asList().get(0);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
deleted file mode 100755
index 6c35720..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZIncrByExecutor.java
+++ /dev/null
@@ -1,76 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZIncrByExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-  private final String ERROR_NAN = "This increment is illegal because it would result in a NaN";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() != 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZINCRBY));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-
-    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(3));
-
-    double incr;
-
-    try {
-      byte[] incrArray = commandElems.get(2);
-      incr = Coder.bytesToDouble(incrArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    DoubleWrapper score = keyRegion.get(member);
-
-    if (score == null) {
-      keyRegion.put(member, new DoubleWrapper(incr));
-      command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), incr));
-      return;
-    }
-    double result = score.score + incr;
-    if (Double.isNaN(result)) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NAN));
-      return;
-    }
-    score.score = result;
-    keyRegion.put(member, score);
-    command.setResponse(Coder.getBulkStringResponse(context.getByteBufAllocator(), score.score));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
deleted file mode 100755
index 42791e2..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZLexCountExecutor.java
+++ /dev/null
@@ -1,148 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZLexCountExecutor extends SortedSetExecutor {
-
-  private final String ERROR_ILLEGAL_SYNTAX =
-      "The min and max strings must either start with a (, [ or be - or +";
-
-  private final int NOT_EXISTS = 0;
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZLEXCOUNT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), NOT_EXISTS));
-      return;
-    }
-
-    boolean minInclusive = false;
-    boolean maxInclusive = false;
-
-    byte[] minArray = commandElems.get(2);
-    byte[] maxArray = commandElems.get(3);
-    String startString = Coder.bytesToString(minArray);
-    String stopString = Coder.bytesToString(maxArray);
-
-    if (minArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      minInclusive = false;
-    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
-      startString = startString.substring(1);
-      minInclusive = true;
-    } else if (minArray[0] != Coder.HYPHEN_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = false;
-    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = true;
-    } else if (maxArray[0] != Coder.PLUS_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-
-    int count;
-    try {
-      count = getCount(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
-          Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive);
-    } catch (Exception e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), e.toString()));
-      return;
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), count));
-  }
-
-  private int getCount(ByteArrayWrapper key, Region<ByteArrayWrapper, DoubleWrapper> keyRegion,
-      ExecutionHandlerContext context, ByteArrayWrapper start, ByteArrayWrapper stop,
-      boolean startInclusive, boolean stopInclusive) throws Exception {
-    if (start.equals("-") && stop.equals("+"))
-      return keyRegion.size();
-    else if (start.equals("+") || stop.equals("-"))
-      return 0;
-
-    Query query;
-    Object[] params;
-    if (start.equals("-")) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTNINF, context);
-      }
-      params = new Object[] {stop};
-    } else if (stop.equals("+")) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZLEXCOUNTPINF, context);
-      }
-      params = new Object[] {start};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNTSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZLEXCOUNT, context);
-        }
-      }
-      params = new Object[] {start, stop};
-    }
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Integer) results.asList().get(0);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
deleted file mode 100755
index 4466521..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByLexExecutor.java
+++ /dev/null
@@ -1,221 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import io.netty.buffer.ByteBuf;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRangeByLexExecutor extends SortedSetExecutor {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  private final String ERROR_ILLEGAL_SYNTAX =
-      "The min and max strings must either start with a (, [ or be - or +";
-
-  private final String ERROR_LIMIT = "The offset and count cannot be negative";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZRANGEBYLEX));
-      return;
-    }
-
-    boolean existsLimit = false;
-
-    if (commandElems.size() >= 7) {
-      byte[] fifthElem = commandElems.get(4);
-      existsLimit = Coder.bytesToString(fifthElem).equalsIgnoreCase("LIMIT");
-    }
-
-    int offset = 0;
-    int limit = 0;
-
-    if (existsLimit) {
-      try {
-        byte[] offsetArray = commandElems.get(5);
-        byte[] limitArray = commandElems.get(6);
-        offset = Coder.bytesToInt(offsetArray);
-        limit = Coder.bytesToInt(limitArray);
-      } catch (NumberFormatException e) {
-        command
-            .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-        return;
-      }
-    }
-
-    if (offset < 0 || limit < 0) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_LIMIT));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion =
-        getOrCreateRegion(context, key, RedisDataType.REDIS_SORTEDSET);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    boolean minInclusive = false;
-    boolean maxInclusive = false;
-
-    byte[] minArray = commandElems.get(2);
-    byte[] maxArray = commandElems.get(3);
-    String startString = Coder.bytesToString(minArray);
-    String stopString = Coder.bytesToString(maxArray);
-    if (minArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      minInclusive = false;
-    } else if (minArray[0] == Coder.OPEN_BRACKET_ID) {
-      startString = startString.substring(1);
-      minInclusive = true;
-    } else if (minArray[0] != Coder.HYPHEN_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-
-    if (maxArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = false;
-    } else if (maxArray[0] == Coder.OPEN_BRACKET_ID) {
-      stopString = stopString.substring(1);
-      maxInclusive = true;
-    } else if (maxArray[0] != Coder.PLUS_ID) {
-      command
-          .setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_ILLEGAL_SYNTAX));
-      return;
-    }
-    Collection<ByteArrayWrapper> list = null;
-    if (!(existsLimit && limit == 0)) {
-      try {
-        list = getRange(key, keyRegion, context, Coder.stringToByteArrayWrapper(startString),
-            Coder.stringToByteArrayWrapper(stopString), minInclusive, maxInclusive, offset, limit);
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    }
-    if (list == null)
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-    else
-      command.setResponse(getCustomBulkStringArrayResponse(list, context));
-  }
-
-  private List<ByteArrayWrapper> getRange(ByteArrayWrapper key,
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
-      ByteArrayWrapper start, ByteArrayWrapper stop, boolean startInclusive, boolean stopInclusive,
-      int offset, int limit) throws FunctionDomainException, TypeMismatchException,
-      NameResolutionException, QueryInvocationTargetException {
-    if (start.equals("-") && stop.equals("+")) {
-      List<ByteArrayWrapper> l = new ArrayList<ByteArrayWrapper>(keyRegion.keySet());
-      int size = l.size();
-      Collections.sort(l);
-      if (limit == 0)
-        limit += size;
-      l = l.subList(Math.min(size, offset), Math.min(offset + limit, size));
-      return l;
-    } else if (start.equals("+") || stop.equals("-"))
-      return null;
-
-    Query query;
-    Object[] params;
-    if (start.equals("-")) {
-      if (stopInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXNINF, context);
-      }
-      params = new Object[] {stop, INFINITY_LIMIT};
-    } else if (stop.equals("+")) {
-      if (startInclusive) {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINFI, context);
-      } else {
-        query = getQuery(key, SortedSetQuery.ZRANGEBYLEXPINF, context);
-      }
-      params = new Object[] {start, INFINITY_LIMIT};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEXSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRANGEBYLEX, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    }
-    if (limit > 0)
-      params[params.length - 1] = (limit + offset);
-    SelectResults<ByteArrayWrapper> results =
-        (SelectResults<ByteArrayWrapper>) query.execute(params);
-    List<ByteArrayWrapper> list = results.asList();
-    int size = list.size();
-    return list.subList(Math.min(size, offset), size);
-
-  }
-
-  private final ByteBuf getCustomBulkStringArrayResponse(Collection<ByteArrayWrapper> items,
-      ExecutionHandlerContext context) {
-    Iterator<ByteArrayWrapper> it = items.iterator();
-    ByteBuf response = context.getByteBufAllocator().buffer();
-    response.writeByte(Coder.ARRAY_ID);
-    response.writeBytes(Coder.intToBytes(items.size()));
-    response.writeBytes(Coder.CRLFar);
-
-    while (it.hasNext()) {
-      ByteArrayWrapper next = it.next();
-      byte[] byteAr = next.toBytes();
-      response.writeByte(Coder.BULK_STRING_ID);
-      response.writeBytes(Coder.intToBytes(byteAr.length));
-      response.writeBytes(Coder.CRLFar);
-      response.writeBytes(byteAr);
-      response.writeBytes(Coder.CRLFar);
-    }
-
-    return response;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
deleted file mode 100755
index 454d281..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeByScoreExecutor.java
+++ /dev/null
@@ -1,214 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRangeByScoreExecutor extends SortedSetExecutor implements Extendable {
-
-  private final String ERROR_NOT_NUMERIC = "The number provided is not numeric";
-
-  private final String ERROR_LIMIT = "The offset and count cannot be negative";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    boolean withScores = false;
-    byte[] elem4Array = null;
-    int offset = 0;
-    int limit = -1;
-    if (commandElems.size() >= 5) {
-      elem4Array = commandElems.get(4);
-      String elem4 = Coder.bytesToString(elem4Array);
-      int limitIndex = 4;
-      if (elem4.equalsIgnoreCase("WITHSCORES")) {
-        withScores = true;
-        limitIndex++;
-      }
-
-      if (commandElems.size() >= limitIndex + 2) {
-        String limitString = Coder.bytesToString(commandElems.get(limitIndex));
-        if (limitString.equalsIgnoreCase("LIMIT")) {
-          try {
-            byte[] offsetArray = commandElems.get(limitIndex + 1);
-            byte[] limitArray = commandElems.get(limitIndex + 2);
-            offset = Coder.bytesToInt(offsetArray);
-            limit = Coder.bytesToInt(limitArray);
-          } catch (NumberFormatException e) {
-            command.setResponse(
-                Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-            return;
-          }
-        }
-
-        if (offset < 0 || limit < 0) {
-          command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_LIMIT));
-          return;
-        }
-
-        if (limitIndex == 4 && commandElems.size() >= 8) {
-          byte[] lastElemArray = commandElems.get(7);
-          String lastString = Coder.bytesToString(lastElemArray);
-          if (lastString.equalsIgnoreCase("WITHSCORES")) {
-            withScores = true;
-          }
-        }
-      }
-
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int startIndex = isReverse() ? 3 : 2;
-    int stopIndex = isReverse() ? 2 : 3;
-    boolean startInclusive = true;
-    boolean stopInclusive = true;
-    double start;
-    double stop;
-
-    byte[] startArray = commandElems.get(startIndex);
-    byte[] stopArray = commandElems.get(stopIndex);
-    String startString = Coder.bytesToString(startArray);
-    String stopString = Coder.bytesToString(stopArray);
-
-    if (startArray[0] == Coder.OPEN_BRACE_ID) {
-      startString = startString.substring(1);
-      startInclusive = false;
-    }
-    if (stopArray[0] == Coder.OPEN_BRACE_ID) {
-      stopString = stopString.substring(1);
-      stopInclusive = false;
-    }
-
-    try {
-      start = Coder.stringToDouble(startString);
-      stop = Coder.stringToDouble(stopString);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    Collection<?> list;
-    try {
-      list = getKeys(key, keyRegion, context, start, stop, startInclusive, stopInclusive, offset,
-          limit);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    if (list == null)
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-    else
-      command.setResponse(Coder.zRangeResponse(context.getByteBufAllocator(), list, withScores));
-  }
-
-  private Collection<?> getKeys(ByteArrayWrapper key,
-      Region<ByteArrayWrapper, DoubleWrapper> keyRegion, ExecutionHandlerContext context,
-      double start, double stop, boolean startInclusive, boolean stopInclusive, int offset,
-      int limit) throws FunctionDomainException, TypeMismatchException, NameResolutionException,
-      QueryInvocationTargetException {
-    if (start == Double.POSITIVE_INFINITY || stop == Double.NEGATIVE_INFINITY || start > stop
-        || (start == stop && (!startInclusive || !stopInclusive)))
-      return null;
-    if (start == Double.NEGATIVE_INFINITY && stop == Double.POSITIVE_INFINITY)
-      return new HashSet(keyRegion.entrySet());
-
-    Query query;
-    Object[] params;
-    if (isReverse()) {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZREVRBSSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZREVRBSSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZREVRBSSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZREVRBS, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    } else {
-      if (startInclusive) {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRBSSTISI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRBSSTI, context);
-        }
-      } else {
-        if (stopInclusive) {
-          query = getQuery(key, SortedSetQuery.ZRBSSI, context);
-        } else {
-          query = getQuery(key, SortedSetQuery.ZRBS, context);
-        }
-      }
-      params = new Object[] {start, stop, INFINITY_LIMIT};
-    }
-    if (limit > 0)
-      params[params.length - 1] = (limit + offset);
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-    if (offset < results.size())
-      return (Collection<Struct>) results.asList().subList(offset, results.size());
-    else
-      return null;
-  }
-
-  protected boolean isReverse() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZRANGEBYSCORE;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
deleted file mode 100755
index 0058da0..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRangeExecutor.java
+++ /dev/null
@@ -1,124 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRangeExecutor extends SortedSetExecutor implements Extendable {
-
-  private final String ERROR_NOT_NUMERIC = "The index provided is not numeric";
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 4) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    boolean withScores = false;
-
-    if (commandElems.size() >= 5) {
-      byte[] fifthElem = commandElems.get(4);
-      withScores = Coder.bytesToString(fifthElem).equalsIgnoreCase("WITHSCORES");
-
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-
-    int start;
-    int stop;
-    int sSetSize = keyRegion.size();
-
-    try {
-      byte[] startArray = commandElems.get(2);
-      byte[] stopArray = commandElems.get(3);
-      start = Coder.bytesToInt(startArray);
-      stop = Coder.bytesToInt(stopArray);
-    } catch (NumberFormatException e) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_NUMERIC));
-      return;
-    }
-
-    start = getBoundedStartIndex(start, sSetSize);
-    stop = getBoundedEndIndex(stop, sSetSize);
-
-    if (start > stop || start == sSetSize) {
-      command.setResponse(Coder.getEmptyArrayResponse(context.getByteBufAllocator()));
-      return;
-    }
-    if (stop == sSetSize)
-      stop--;
-    List<?> list;
-    try {
-      list = getRange(context, key, start, stop);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    command.setResponse(Coder.zRangeResponse(context.getByteBufAllocator(), list, withScores));
-  }
-
-  private List<?> getRange(ExecutionHandlerContext context, ByteArrayWrapper key, int start,
-      int stop) throws Exception {
-    Query query;
-
-    if (isReverse())
-      query = getQuery(key, SortedSetQuery.ZRANGE, context);
-    else
-      query = getQuery(key, SortedSetQuery.ZREVRANGE, context);
-
-    Object[] params = {stop + 1};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    List<?> list = results.asList();
-
-    return list.subList(start, stop + 1);
-
-  }
-
-  protected boolean isReverse() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZRANGE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
deleted file mode 100755
index 5fadcaf..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRankExecutor.java
+++ /dev/null
@@ -1,97 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.SelectResults;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.Extendable;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.executor.SortedSetQuery;
-
-public class ZRankExecutor extends SortedSetExecutor implements Extendable {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), getArgsError()));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    ByteArrayWrapper member = new ByteArrayWrapper(commandElems.get(2));
-
-    DoubleWrapper value = keyRegion.get(member);
-
-    if (value == null) {
-      command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
-      return;
-    }
-
-    int rank;
-    try {
-      rank = getRange(context, key, member, value);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), rank));
-  }
-
-  private int getRange(ExecutionHandlerContext context, ByteArrayWrapper key,
-      ByteArrayWrapper member, DoubleWrapper valueWrapper) throws Exception {
-    Query query;
-    if (isReverse())
-      query = getQuery(key, SortedSetQuery.ZREVRANK, context);
-    else
-      query = getQuery(key, SortedSetQuery.ZRANK, context);
-
-    Object[] params = {valueWrapper.score, valueWrapper.score, member};
-
-    SelectResults<?> results = (SelectResults<?>) query.execute(params);
-
-    return (Integer) results.asList().get(0);
-
-  }
-
-  protected boolean isReverse() {
-    return false;
-  }
-
-  @Override
-  public String getArgsError() {
-    return ArityDef.ZRANK;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/c6dbc6d4/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
deleted file mode 100755
index 5cbc7e4..0000000
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZRemExecutor.java
+++ /dev/null
@@ -1,62 +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 org.apache.geode.redis.internal.executor.sortedset;
-
-import java.util.List;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.Command;
-import org.apache.geode.redis.internal.DoubleWrapper;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RedisConstants.ArityDef;
-
-public class ZRemExecutor extends SortedSetExecutor {
-
-  @Override
-  public void executeCommand(Command command, ExecutionHandlerContext context) {
-    List<byte[]> commandElems = command.getProcessedCommand();
-
-    if (commandElems.size() < 3) {
-      command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.ZREM));
-      return;
-    }
-
-    ByteArrayWrapper key = command.getKey();
-
-    checkDataType(key, RedisDataType.REDIS_SORTEDSET, context);
-    Region<ByteArrayWrapper, DoubleWrapper> keyRegion = getRegion(context, key);
-
-    if (keyRegion == null) {
-      command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
-      return;
-    }
-
-    int numDeletedMembers = 0;
-
-    for (int i = 2; i < commandElems.size(); i++) {
-      byte[] memberArray = commandElems.get(i);
-      ByteArrayWrapper member = new ByteArrayWrapper(memberArray);
-      Object oldVal = keyRegion.remove(member);
-      if (oldVal != null)
-        numDeletedMembers++;
-    }
-    if (keyRegion.isEmpty())
-      context.getRegionProvider().removeKey(key);
-    command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeletedMembers));
-  }
-}


Mime
View raw message