usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: new name strategy
Date Thu, 04 Jun 2015 16:22:42 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-556 17059d8e6 -> f4b67a961


new name strategy


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

Branch: refs/heads/USERGRID-556
Commit: f4b67a9614c6b26316aa42745688c5b183e0793b
Parents: 17059d8
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Jun 4 10:22:24 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Jun 4 10:22:24 2015 -0600

----------------------------------------------------------------------
 .../persistence/index/IndexIdentifier.java      | 48 +++++++++++
 .../persistence/index/guice/IndexModule.java    |  2 +-
 .../impl/EsApplicationEntityIndexImpl.java      | 10 +--
 .../index/impl/EsEntityIndexBatchImpl.java      |  7 +-
 .../index/impl/EsEntityIndexFactoryImpl.java    |  5 +-
 .../index/impl/EsEntityIndexImpl.java           | 13 ++-
 .../persistence/index/impl/IndexIdentifier.java | 46 -----------
 .../index/impl/IndexIdentifierImpl.java         | 67 ---------------
 .../index/impl/IndexIdentifierv1Impl.java       | 68 ++++++++++++++++
 .../index/impl/IndexIdentifierv2Impl.java       | 85 ++++++++++++++++++++
 .../index/impl/IndexRefreshCommandImpl.java     |  7 +-
 .../persistence/index/impl/EntityIndexTest.java | 35 +++++---
 12 files changed, 237 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/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
new file mode 100644
index 0000000..52c7fea
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
@@ -0,0 +1,48 @@
+/*
+ * 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.index.impl.IndexAlias;
+
+/**
+ * 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();
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
index b6a1f09..92f1c9b 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
@@ -52,7 +52,7 @@ public abstract class IndexModule extends AbstractModule {
         bind(EntityIndex.class).to(EsEntityIndexImpl.class).asEagerSingleton();
         bind(IndexCache.class).to(EsIndexCacheImpl.class);
         bind(IndexRefreshCommand.class).to(IndexRefreshCommandImpl.class);
-        bind(IndexIdentifier.class).to(IndexIdentifierImpl.class);
+        bind(IndexIdentifier.class).to(IndexIdentifierv2Impl.class);
 
 
         bind(IndexBufferConsumer.class).to(EsIndexBufferConsumerImpl.class).asEagerSingleton();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
index fb2dc86..ed35838 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsApplicationEntityIndexImpl.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
+import org.apache.usergrid.persistence.index.*;
 import org.elasticsearch.action.ActionListener;
 import org.elasticsearch.action.ListenableActionFuture;
 import org.elasticsearch.action.ShardOperationFailedException;
@@ -46,16 +47,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.ValidationUtils;
-import org.apache.usergrid.persistence.index.AliasedEntityIndex;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
-import org.apache.usergrid.persistence.index.CandidateResult;
-import org.apache.usergrid.persistence.index.CandidateResults;
 import org.apache.usergrid.persistence.index.ElasticSearchQueryBuilder.SearchRequestBuilderStrategyV2;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.IndexEdge;
-import org.apache.usergrid.persistence.index.IndexFig;
-import org.apache.usergrid.persistence.index.SearchEdge;
-import org.apache.usergrid.persistence.index.SearchTypes;
 import org.apache.usergrid.persistence.index.query.ParsedQuery;
 import org.apache.usergrid.persistence.index.query.ParsedQueryBuilder;
 import org.apache.usergrid.persistence.index.utils.IndexValidationUtils;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/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 956f1d5..972a43c 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
@@ -21,17 +21,12 @@ package org.apache.usergrid.persistence.index.impl;
 
 import java.util.UUID;
 
+import org.apache.usergrid.persistence.index.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.persistence.core.future.FutureObservable;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.ValidationUtils;
-import org.apache.usergrid.persistence.index.AliasedEntityIndex;
-import org.apache.usergrid.persistence.index.CandidateResult;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.IndexEdge;
-import org.apache.usergrid.persistence.index.SearchEdge;
 import org.apache.usergrid.persistence.index.utils.IndexValidationUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
index e41bcf8..b32fec4 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
@@ -24,10 +24,7 @@ import java.util.concurrent.ExecutionException;
 
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.index.AliasedEntityIndex;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
-import org.apache.usergrid.persistence.index.EntityIndexFactory;
-import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.*;
 import org.apache.usergrid.persistence.map.MapManagerFactory;
 
 import com.google.common.cache.CacheBuilder;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/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 904f58b..7fb3b85 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
@@ -26,7 +26,6 @@ import com.google.common.io.Resources;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
-import org.apache.usergrid.persistence.core.future.FutureObservable;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.migration.data.VersionedData;
 import org.apache.usergrid.persistence.core.util.Health;
@@ -63,7 +62,6 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData
{
     private static final Logger logger = LoggerFactory.getLogger( EsEntityIndexImpl.class
);
 
     private final IndexAlias alias;
-    private final IndexBufferConsumer producer;
     private final IndexFig indexFig;
     private final Timer addTimer;
     private final Timer updateAliasTimer;
@@ -91,21 +89,20 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData
{
     private Timer mappingTimer;
     private Meter refreshIndexMeter;
 
-//    private final Timer indexTimer;
-
 
     @Inject
     public EsEntityIndexImpl( final EsProvider provider,
                               final IndexCache indexCache,
-                              final IndexFig indexFig, final IndexIdentifier indexIdentifier,
-                             final IndexBufferConsumer producer, final IndexRefreshCommand
indexRefreshCommand,
-                              final MetricsFactory metricsFactory) {
+                              final IndexFig indexFig,
+                              final IndexIdentifier indexIdentifier,
+                              final IndexRefreshCommand indexRefreshCommand,
+                              final MetricsFactory metricsFactory
+    ) {
 
         this.indexFig = indexFig;
         this.indexIdentifier = indexIdentifier;
 
         this.esProvider = provider;
-        this.producer = producer;
         this.indexRefreshCommand = indexRefreshCommand;
         this.alias = indexIdentifier.getAlias();
         this.aliasCache = indexCache;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifier.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifier.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifier.java
deleted file mode 100644
index 332c7b7..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifier.java
+++ /dev/null
@@ -1,46 +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.impl;
-
-
-/**
- * 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();
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierImpl.java
deleted file mode 100644
index 782625b..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- *  * 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.persistence.index.impl;
-
-import com.google.inject.Inject;
-
-import org.apache.usergrid.persistence.index.IndexFig;
-
-
-/**
- * Class is used to generate an index name and alias name
- */
-public class IndexIdentifierImpl implements IndexIdentifier {
-    private final IndexFig config;
-
-    @Inject
-    public IndexIdentifierImpl(IndexFig config) {
-        this.config = config;
-    }
-
-    /**
-     * Get the alias name
-     * @return
-     */
-    @Override
-    public IndexAlias getAlias() {
-        return new IndexAlias(config,config.getIndexPrefix());
-    }
-
-    /**
-     * Get index name, send in additional parameter to add incremental indexes
-     * @param suffix
-     * @return
-     */
-    @Override
-    public String getIndex(String suffix) {
-        if (suffix != null) {
-            return config.getIndexPrefix() + "_" + suffix;
-        } else {
-            return config.getIndexPrefix();
-        }
-    }
-
-
-    @Override
-    public String toString() {
-        return "index id"+config.getIndexPrefix();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv1Impl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv1Impl.java
new file mode 100644
index 0000000..34130ce
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv1Impl.java
@@ -0,0 +1,68 @@
+/*
+ *
+ *  * 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.persistence.index.impl;
+
+import com.google.inject.Inject;
+
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.IndexIdentifier;
+
+
+/**
+ * Class is used to generate an index name and alias name
+ */
+public class IndexIdentifierv1Impl implements IndexIdentifier {
+    private final IndexFig config;
+
+    @Inject
+    public IndexIdentifierv1Impl(IndexFig config) {
+        this.config = config;
+    }
+
+    /**
+     * Get the alias name
+     * @return
+     */
+    @Override
+    public IndexAlias getAlias() {
+        return new IndexAlias(config,config.getIndexPrefix());
+    }
+
+    /**
+     * Get index name, send in additional parameter to add incremental indexes
+     * @param suffix
+     * @return
+     */
+    @Override
+    public String getIndex(String suffix) {
+        if (suffix != null) {
+            return config.getIndexPrefix() + "_" + suffix;
+        } else {
+            return config.getIndexPrefix();
+        }
+    }
+
+
+    @Override
+    public String toString() {
+        return "index id"+config.getIndexPrefix();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
new file mode 100644
index 0000000..cb84ffe
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
@@ -0,0 +1,85 @@
+/*
+ *
+ *  * 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.persistence.index.impl;
+
+import com.google.inject.Inject;
+
+import com.netflix.astyanax.Keyspace;
+import org.apache.usergrid.persistence.core.util.StringUtils;
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.IndexIdentifier;
+
+
+/**
+ * Class is used to generate an index name and alias name
+ */
+public class IndexIdentifierv2Impl implements IndexIdentifier {
+    private final IndexFig config;
+    private final String prefix;
+
+    @Inject
+    public IndexIdentifierv2Impl(final Keyspace keyspace, final IndexFig config) {
+        this.config = config;
+        this.prefix = getPrefix(keyspace, config);
+    }
+
+    private String getPrefix(Keyspace keyspace, IndexFig config) {
+        //remove usergrid
+        final String indexPrefixConfig = StringUtils.isNotEmpty(config.getIndexPrefix())
+            ? config.getIndexPrefix().toLowerCase()  ////use lowercase value
+            : "usergrid"; // default to something so its not null
+        final String keyspaceName = keyspace.getKeyspaceName().toLowerCase();
+        //check for repetition
+        final boolean removePrefix = indexPrefixConfig.contains("usergrid") && keyspaceName.contains("usergrid");
+        return !removePrefix
+            ? indexPrefixConfig + "_" + keyspaceName
+            : keyspaceName;
+    }
+
+    /**
+     * Get the alias name
+     * @return
+     */
+    @Override
+    public IndexAlias getAlias() {
+        return new IndexAlias(config,prefix);
+    }
+
+    /**
+     * Get index name, send in additional parameter to add incremental indexes
+     * @param suffix
+     * @return
+     */
+    @Override
+    public String getIndex(String suffix) {
+        if (suffix != null) {
+            return prefix + "_" + suffix;
+        } else {
+            return prefix;
+        }
+    }
+
+
+    @Override
+    public String toString() {
+        return "index id: "+prefix;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
index e7ae241..28bd73d 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
@@ -23,6 +23,7 @@ package org.apache.usergrid.persistence.index.impl;
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.usergrid.persistence.index.*;
 import org.elasticsearch.action.ShardOperationFailedException;
 import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
 import org.elasticsearch.action.search.SearchRequestBuilder;
@@ -35,11 +36,6 @@ import org.apache.usergrid.persistence.core.metrics.ObservableTimer;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.core.util.StringUtils;
-import org.apache.usergrid.persistence.index.AliasedEntityIndex;
-import org.apache.usergrid.persistence.index.IndexEdge;
-import org.apache.usergrid.persistence.index.IndexFig;
-import org.apache.usergrid.persistence.index.IndexRefreshCommand;
-import org.apache.usergrid.persistence.index.SearchEdge;
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -51,7 +47,6 @@ import com.codahale.metrics.Timer;
 import com.google.inject.Inject;
 
 import rx.Observable;
-import rx.util.async.Async;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f4b67a96/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 00ddc17..dfa8f04 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
@@ -29,6 +29,8 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicLong;
 
 import com.google.common.base.Optional;
+import com.netflix.astyanax.Keyspace;
+import org.apache.usergrid.persistence.index.*;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -41,15 +43,6 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.core.test.UseModules;
 import org.apache.usergrid.persistence.core.util.Health;
-import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
-import org.apache.usergrid.persistence.index.CandidateResult;
-import org.apache.usergrid.persistence.index.CandidateResults;
-import org.apache.usergrid.persistence.index.EntityIndex;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.EntityIndexFactory;
-import org.apache.usergrid.persistence.index.IndexEdge;
-import org.apache.usergrid.persistence.index.SearchEdge;
-import org.apache.usergrid.persistence.index.SearchTypes;
 import org.apache.usergrid.persistence.index.guice.TestIndexModule;
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
@@ -88,6 +81,18 @@ public class EntityIndexTest extends BaseIT {
     public EntityIndex ei;
 
     @Inject
+    public IndexIdentifierv1Impl identifierv1;
+
+    @Inject
+    public IndexIdentifierv2Impl identifierv2;
+
+    @Inject
+    public IndexFig fig;
+
+    @Inject
+    public Keyspace keyspace;
+
+    @Inject
     @Rule
     public ElasticSearchRule elasticSearchRule;
 
@@ -1257,6 +1262,18 @@ public class EntityIndexTest extends BaseIT {
 
         assertEquals( 0, noMatchesContainsOrResults.size() );
     }
+
+    @Test
+    public void testIndexIdentifier(){
+        String indexv1Name = identifierv1.getIndex("somesuffixv1");
+        String indexv2Name = identifierv2.getIndex("somesuffixv2");
+        assertFalse(indexv1Name.equals(indexv2Name));
+        assertFalse(indexv1Name.contains(keyspace.getKeyspaceName().toLowerCase()));
+        assertTrue(indexv2Name.contains(keyspace.getKeyspaceName().toLowerCase()));
+        assertTrue(indexv1Name.contains(fig.getIndexPrefix()));
+        assertTrue(indexv2Name.contains(fig.getIndexPrefix()));
+
+    }
 }
 
 


Mime
View raw message