You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/06/08 18:17:26 UTC

[5/5] incubator-usergrid git commit: remove index identifier

remove index identifier


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bfb5885a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bfb5885a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bfb5885a

Branch: refs/heads/USERGRID-652
Commit: bfb5885a0627b8c26ad6166a74fc042e7f9afb62
Parents: 72b816b
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Jun 8 10:16:26 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Jun 8 10:16:26 2015 -0600

----------------------------------------------------------------------
 .../usergrid/corepersistence/CoreModule.java    |  9 ++--
 .../corepersistence/CpEntityManagerFactory.java |  6 +--
 .../corepersistence/CpManagerCache.java         | 19 ++++++--
 .../corepersistence/CpRelationManager.java      |  6 +--
 .../usergrid/corepersistence/ManagerCache.java  |  9 ++--
 .../index/ApplicationIndexLocationStrategy.java | 44 +++++++++++++++++
 .../index/IndexLocationStrategyFactory.java     | 30 ++++++++++++
 .../index/IndexLocationStrategyFactoryImpl.java | 37 +++++++++++++++
 .../index/ManagementIndexLocationStrategy.java  | 38 +++++++++++++++
 .../persistence/index/IndexIdentifier.java      | 50 --------------------
 .../index/IndexLocationStrategy.java            | 23 +++++++--
 .../index/impl/EsEntityIndexBatchImpl.java      |  6 +--
 .../index/impl/EsEntityIndexImpl.java           | 12 ++---
 .../persistence/index/impl/EntityIndexTest.java |  9 +---
 .../persistence/index/impl/GeoPagingTest.java   |  9 +---
 .../index/impl/IndexLoadTestsIT.java            |  8 +---
 .../index/impl/TestIndexIdentifier.java         |  4 +-
 17 files changed, 210 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index b22a7cb..273e6bb 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@ -16,17 +16,13 @@
 package org.apache.usergrid.corepersistence;
 
 
+import org.apache.usergrid.corepersistence.index.*;
 import org.safehaus.guicyfig.GuicyFigModule;
 
 import org.apache.usergrid.corepersistence.asyncevents.AsyncEventService;
 import org.apache.usergrid.corepersistence.asyncevents.AsyncIndexProvider;
 import org.apache.usergrid.corepersistence.asyncevents.EventBuilder;
 import org.apache.usergrid.corepersistence.asyncevents.EventBuilderImpl;
-import org.apache.usergrid.corepersistence.index.IndexProcessorFig;
-import org.apache.usergrid.corepersistence.index.IndexService;
-import org.apache.usergrid.corepersistence.index.IndexServiceImpl;
-import org.apache.usergrid.corepersistence.index.ReIndexService;
-import org.apache.usergrid.corepersistence.index.ReIndexServiceImpl;
 import org.apache.usergrid.corepersistence.migration.AppInfoMigrationPlugin;
 import org.apache.usergrid.corepersistence.migration.CoreMigration;
 import org.apache.usergrid.corepersistence.migration.CoreMigrationPlugin;
@@ -146,8 +142,9 @@ public class CoreModule  extends AbstractModule {
 
         bind( ReIndexService.class).to( ReIndexServiceImpl.class );
 
+        bind( IndexLocationStrategyFactory.class ).to( IndexLocationStrategyFactoryImpl.class );
 
-        install( new GuicyFigModule( IndexProcessorFig.class ) );
+        install(new GuicyFigModule(IndexProcessorFig.class));
 
 
         install( new GuicyFigModule( ApplicationIdCacheFig.class ) );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 713a2da..c79ea4a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.usergrid.corepersistence.index.ReIndexRequestBuilder;
 import org.apache.usergrid.persistence.*;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdge;
+import org.apache.usergrid.persistence.index.AliasedEntityIndex;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeansException;
@@ -60,7 +61,6 @@ import org.apache.usergrid.persistence.graph.GraphManager;
 import org.apache.usergrid.persistence.graph.GraphManagerFactory;
 import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndexFactory;
 import org.apache.usergrid.persistence.index.IndexRefreshCommand;
@@ -383,7 +383,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         }
         final Id managementAppId = CpNamingUtils.getManagementApplicationId();
-        final ApplicationEntityIndex aei = entityIndexFactory.createApplicationEntityIndex(applicationScope);
+        final AliasedEntityIndex aei = managerCache.getEntityIndex(applicationScope);
         final GraphManager managementGraphManager = managerCache.getGraphManager(managementAppScope);
         final Edge createEdge = CpNamingUtils.createCollectionEdge(managementAppId, collectionToName, applicationId);
 
@@ -687,7 +687,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
     }
 
 
-    private List<ApplicationEntityIndex> getManagementIndexes() {
+    private List<AliasedEntityIndex> getManagementIndexes() {
 
         return Arrays.asList(
             managerCache.getEntityIndex( // management app

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpManagerCache.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpManagerCache.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpManagerCache.java
index f4fee0c..bb02449 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpManagerCache.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpManagerCache.java
@@ -16,13 +16,16 @@
 package org.apache.usergrid.corepersistence;
 
 
+import org.apache.usergrid.corepersistence.index.IndexLocationStrategyFactory;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphManager;
 import org.apache.usergrid.persistence.graph.GraphManagerFactory;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
+import org.apache.usergrid.persistence.index.AliasedEntityIndex;
+import org.apache.usergrid.persistence.index.EntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndexFactory;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
 import org.apache.usergrid.persistence.map.MapManager;
 import org.apache.usergrid.persistence.map.MapManagerFactory;
 import org.apache.usergrid.persistence.map.MapScope;
@@ -39,18 +42,23 @@ public class CpManagerCache implements ManagerCache {
     private final EntityIndexFactory eif;
     private final GraphManagerFactory gmf;
     private final MapManagerFactory mmf;
+    private final IndexLocationStrategyFactory indexLocationStrategyFactory;
 
     // TODO: consider making these cache sizes and timeouts configurable
 
 
     @Inject
-    public CpManagerCache( final EntityCollectionManagerFactory ecmf, final EntityIndexFactory eif,
-                           final GraphManagerFactory gmf, final MapManagerFactory mmf ) {
+    public CpManagerCache( final EntityCollectionManagerFactory ecmf,
+                           final EntityIndexFactory eif,
+                           final GraphManagerFactory gmf,
+                           final MapManagerFactory mmf,
+                           final IndexLocationStrategyFactory indexLocationStrategyFactory) {
 
         this.ecmf = ecmf;
         this.eif = eif;
         this.gmf = gmf;
         this.mmf = mmf;
+        this.indexLocationStrategyFactory = indexLocationStrategyFactory;
     }
 
 
@@ -62,8 +70,9 @@ public class CpManagerCache implements ManagerCache {
 
 
     @Override
-    public ApplicationEntityIndex getEntityIndex( ApplicationScope appScope ) {
-        return eif.createApplicationEntityIndex( appScope );
+    public AliasedEntityIndex getEntityIndex( ApplicationScope applicationScope) {
+        IndexLocationStrategy indexLocationStrategy = indexLocationStrategyFactory.getIndexLocationStrategy(applicationScope);
+        return eif.createEntityIndex( indexLocationStrategy );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index c717c5b..96c792c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.usergrid.persistence.index.AliasedEntityIndex;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.util.Assert;
@@ -64,7 +65,6 @@ import org.apache.usergrid.persistence.graph.impl.SimpleEdge;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdge;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchEdgeType;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndexBatch;
 import org.apache.usergrid.persistence.index.IndexEdge;
 import org.apache.usergrid.persistence.index.SearchEdge;
@@ -530,7 +530,7 @@ public class CpRelationManager implements RelationManager {
          *
          */
 
-        final ApplicationEntityIndex ei = managerCache.getEntityIndex( applicationScope );
+        final AliasedEntityIndex ei = managerCache.getEntityIndex( applicationScope );
         final EntityIndexBatch batch = ei.createBatch();
 
         // remove item from collection index
@@ -699,7 +699,7 @@ public class CpRelationManager implements RelationManager {
         GraphManager gm = managerCache.getGraphManager( applicationScope );
         gm.writeEdge( edge ).toBlocking().last();
 
-        ApplicationEntityIndex ei = managerCache.getEntityIndex( applicationScope );
+        AliasedEntityIndex ei = managerCache.getEntityIndex( applicationScope );
         EntityIndexBatch batch = ei.createBatch();
 
         // Index the new connection in app|source|type context

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ManagerCache.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ManagerCache.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ManagerCache.java
index dfa62fb..0bd198b 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ManagerCache.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ManagerCache.java
@@ -23,7 +23,8 @@ package org.apache.usergrid.corepersistence;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphManager;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
+import org.apache.usergrid.persistence.index.AliasedEntityIndex;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
 import org.apache.usergrid.persistence.map.MapManager;
 import org.apache.usergrid.persistence.map.MapScope;
 
@@ -41,12 +42,12 @@ public interface ManagerCache {
     EntityCollectionManager getEntityCollectionManager( ApplicationScope scope );
 
     /**
-     * Get the entity index for the specified app scope
+     * Get the entity index for the specified location strategy
      *
-     * @param appScope
+     * @param applicationScope
      * @return
      */
-    ApplicationEntityIndex getEntityIndex( ApplicationScope appScope );
+    AliasedEntityIndex getEntityIndex( ApplicationScope applicationScope );
 
     /**
      * Get the graph manager for the graph scope

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
new file mode 100644
index 0000000..b459f31
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
@@ -0,0 +1,44 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+package org.apache.usergrid.corepersistence.index;
+
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.index.IndexAlias;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
+
+/**
+ * Classy class class.
+ */
+class ApplicationIndexLocationStrategy implements IndexLocationStrategy {
+    @Override
+    public IndexAlias getAlias() {
+        return null;
+    }
+
+    @Override
+    public String getIndex(String suffix) {
+        return null;
+    }
+
+    @Override
+    public ApplicationScope getApplicationScope() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactory.java
new file mode 100644
index 0000000..d30dc6b
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactory.java
@@ -0,0 +1,30 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+package org.apache.usergrid.corepersistence.index;
+
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
+
+/**
+ * Retrieve index locations by app scope
+ */
+public interface IndexLocationStrategyFactory {
+    IndexLocationStrategy getIndexLocationStrategy(ApplicationScope applicationScope);
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactoryImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactoryImpl.java
new file mode 100644
index 0000000..c462966
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexLocationStrategyFactoryImpl.java
@@ -0,0 +1,37 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+package org.apache.usergrid.corepersistence.index;
+
+import org.apache.usergrid.corepersistence.util.CpNamingUtils;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
+
+/**
+ * Parse app id and get the correct strategy
+ */
+public class IndexLocationStrategyFactoryImpl implements IndexLocationStrategyFactory {
+    public IndexLocationStrategy getIndexLocationStrategy(ApplicationScope applicationScope){
+        if(CpNamingUtils.getManagementApplicationId().equals(applicationScope.getApplication())){
+            return new ManagementIndexLocationStrategy();
+        }
+        return new ApplicationIndexLocationStrategy();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ManagementIndexLocationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ManagementIndexLocationStrategy.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ManagementIndexLocationStrategy.java
new file mode 100644
index 0000000..7854d1d
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ManagementIndexLocationStrategy.java
@@ -0,0 +1,38 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  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.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+package org.apache.usergrid.corepersistence.index;
+
+import org.apache.usergrid.persistence.index.IndexAlias;
+
+/**
+ * Classy class class.
+ */
+class ManagementIndexLocationStrategy extends ApplicationIndexLocationStrategy {
+    @Override
+    public IndexAlias getAlias() {
+        return null;
+    }
+
+    @Override
+    public String getIndex(String suffix) {
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
deleted file mode 100644
index 0fe7452..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.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.usergrid.persistence.index;
-
-
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-
-/**
- * Identifier for where an index is in underlying server
- */
-public interface IndexIdentifier {
-
-    /**
-     * get the alias name
-     * @return
-     */
-    IndexAlias getAlias();
-
-    /**
-     * get index name from suffix
-     * @param suffix
-     * @return
-     */
-    String getIndex( String suffix );
-
-    /**
-     * return unique string
-     * @return
-     */
-    String toString();
-
-    ApplicationScope getApplicationScope();
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexLocationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexLocationStrategy.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexLocationStrategy.java
index 54432db..b779ae9 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexLocationStrategy.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexLocationStrategy.java
@@ -20,11 +20,28 @@
 package org.apache.usergrid.persistence.index;
 
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.index.IndexIdentifier;
-
 /**
  * Classy class class.
  */
 public interface IndexLocationStrategy {
-    IndexIdentifier getIndexIdentifier();
+    /**
+     * get the alias name
+     * @return
+     */
+    IndexAlias getAlias();
+
+    /**
+     * get index name from suffix
+     * @param suffix
+     * @return
+     */
+    String getIndex( String suffix );
+
+    /**
+     * return unique string
+     * @return
+     */
+    String toString();
+
+    ApplicationScope getApplicationScope();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index c7ac1c1..dc2813d 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -39,9 +39,8 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
 
     private final IndexAlias alias;
-    private final IndexIdentifier indexIdentifier;
 
-    private final IndexLocationStrategy locationStrategy;
+    private final IndexLocationStrategy indexIdentifier;
     private final IndexBufferConsumer indexBatchBufferProducer;
 
     private final AliasedEntityIndex entityIndex;
@@ -53,11 +52,10 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
                                    final IndexBufferConsumer indexBatchBufferProducer,
                                    final AliasedEntityIndex entityIndex
     ) {
-        this.locationStrategy = locationStrategy;
+        this.indexIdentifier = locationStrategy;
 
         this.indexBatchBufferProducer = indexBatchBufferProducer;
         this.entityIndex = entityIndex;
-        this.indexIdentifier = locationStrategy.getIndexIdentifier();
         this.applicationScope = indexIdentifier.getApplicationScope();
 
         this.alias = indexIdentifier.getAlias();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 7806081..9b39069 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -109,7 +109,6 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData {
             ImmutableMap.<String, Object>builder().put(IndexingUtils.ENTITY_ID_FIELDNAME, UUIDGenerator.newTimeUUID().toString()).build();
 
 
-    private final IndexIdentifier indexIdentifier;
     private final Timer deleteApplicationTimer;
     private final Meter deleteApplicationMeter;
     private final ApplicationScope applicationScope;
@@ -138,14 +137,13 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData {
 
         this.indexFig = indexFig;
         this.indexLocationStrategy = indexLocationStrategy;
-        this.indexIdentifier = indexLocationStrategy.getIndexIdentifier();
         this.indexBatchBufferProducer = indexBatchBufferProducer;
         this.failureMonitor = new FailureMonitorImpl( indexFig, provider );
         this.esProvider = provider;
         this.indexRefreshCommand = indexRefreshCommand;
-        this.alias = indexIdentifier.getAlias();
+        this.alias = indexLocationStrategy.getAlias();
         this.aliasCache = indexCache;
-        this.applicationScope = indexLocationStrategy.getIndexIdentifier().getApplicationScope();
+        this.applicationScope = indexLocationStrategy.getApplicationScope();
         this.cursorTimeout = indexFig.getQueryCursorTimeout();
         this.queryTimeout = indexFig.getWriteTimeout();
         this.searchRequest = new SearchRequestBuilderStrategy( esProvider, applicationScope, alias, cursorTimeout );
@@ -188,7 +186,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData {
     public void addIndex(final String indexSuffix,final int numberOfShards, final int numberOfReplicas, final String writeConsistency) {
         try {
             //get index name with suffix attached
-            String indexName = indexIdentifier.getIndex(indexSuffix);
+            String indexName = indexLocationStrategy.getIndex(indexSuffix);
 
             //Create index
             try {
@@ -247,7 +245,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData {
         Timer.Context timer = updateAliasTimer.time();
         try {
             Boolean isAck;
-            String indexName = indexIdentifier.getIndex(indexSuffix);
+            String indexName = indexLocationStrategy.getIndex(indexSuffix);
             final AdminClient adminClient = esProvider.getClient().admin();
 
             String[] indexNames = getIndexes(AliasType.Write);
@@ -736,7 +734,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData {
 
         try {
            final ActionFuture<ClusterHealthResponse> future =  esProvider.getClient().admin().cluster().health(
-               new ClusterHealthRequest( new String[] { indexIdentifier.getIndex( null ) } ) );
+               new ClusterHealthRequest( new String[] { indexLocationStrategy.getIndex( null ) } ) );
 
             //only wait 2 seconds max
             ClusterHealthResponse chr = future.actionGet(2000);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 6acf9a7..bbd248e 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@ -94,13 +94,8 @@ public class EntityIndexTest extends BaseIT {
     public void setup(){
         appId = new SimpleId(UUID.randomUUID(), "application" );
 
-        IndexLocationStrategy strategy = new IndexLocationStrategy() {
-            @Override
-            public IndexIdentifier getIndexIdentifier() {
-                return new TestIndexIdentifier(cassandraFig,fig,new ApplicationScopeImpl(appId));
-            }
+        IndexLocationStrategy strategy =  new TestIndexIdentifier(cassandraFig,fig,new ApplicationScopeImpl(appId));
 
-        };
 
 
         entityIndex = eif.createEntityIndex( strategy );
@@ -1220,7 +1215,7 @@ public class EntityIndexTest extends BaseIT {
         assertEquals( 0, noMatchesContainsOrResults.size() );
     }
 
-    
+
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoPagingTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoPagingTest.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoPagingTest.java
index 6c1d67e..19e143e 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoPagingTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/GeoPagingTest.java
@@ -92,14 +92,7 @@ public class GeoPagingTest extends BaseIT {
     public void setup(){
         appId = new SimpleId(UUID.randomUUID(), "application" );
 
-        IndexLocationStrategy strategy = new IndexLocationStrategy() {
-            @Override
-            public IndexIdentifier getIndexIdentifier() {
-                return new TestIndexIdentifier(cassandraFig,fig,new ApplicationScopeImpl(appId));
-            }
-
-        };
-
+        IndexLocationStrategy strategy =new TestIndexIdentifier(cassandraFig,fig,new ApplicationScopeImpl(appId));
 
         entityIndex = eif.createEntityIndex( strategy );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexLoadTestsIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexLoadTestsIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexLoadTestsIT.java
index c8935f3..a59a49d 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexLoadTestsIT.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/IndexLoadTestsIT.java
@@ -123,13 +123,7 @@ public class IndexLoadTestsIT extends BaseIT {
     public void before(){
         appId = new SimpleId(UUID.randomUUID(), "application" );
 
-        IndexLocationStrategy strategy = new IndexLocationStrategy() {
-            @Override
-            public IndexIdentifier getIndexIdentifier() {
-                return new TestIndexIdentifier(cassandraFig,fig,new ApplicationScopeImpl(appId));
-            }
-
-        };
+        IndexLocationStrategy strategy = new TestIndexIdentifier(cassandraFig,fig,new ApplicationScopeImpl(appId));
 
 
         entityIndex = eif.createEntityIndex( strategy );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bfb5885a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/TestIndexIdentifier.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/TestIndexIdentifier.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/TestIndexIdentifier.java
index 609a10c..adbdfbe 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/TestIndexIdentifier.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/TestIndexIdentifier.java
@@ -25,13 +25,13 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.StringUtils;
 import org.apache.usergrid.persistence.index.IndexAlias;
 import org.apache.usergrid.persistence.index.IndexFig;
-import org.apache.usergrid.persistence.index.IndexIdentifier;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
 
 
 /**
  * Class is used to generate an index name and alias name
  */
-public class TestIndexIdentifier implements IndexIdentifier {
+public class TestIndexIdentifier implements IndexLocationStrategy {
     private final CassandraFig cassandraFig;
     private final IndexFig indexFig;
     private final ApplicationScope applicationScope;