usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject git commit: Fix Lucene conflict, add Graph Module.
Date Thu, 27 Mar 2014 15:20:49 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/entity-manager 335044e0e -> 8adbe29c9


Fix Lucene conflict, add Graph Module.


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

Branch: refs/heads/entity-manager
Commit: 8adbe29c9f79a165e94f36f798361bbcee7127db
Parents: 335044e
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Thu Mar 27 11:15:21 2014 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Thu Mar 27 11:15:21 2014 -0400

----------------------------------------------------------------------
 stack/core/pom.xml                              |  19 +-
 .../corepersistence/CpEntityManagerImpl.java    | 567 +++++++++++++++++++
 .../usergrid/corepersistence/CpModule.java      | 124 ++++
 .../corepersistence/TimeServiceImpl.java        |  30 +
 .../cassandra/CpEntityManagerImpl.java          | 489 ----------------
 .../persistence/cassandra/CpModule.java         |  31 -
 .../org/apache/usergrid/utils/IndexUtils.java   |  15 +-
 .../main/resources/usergrid-core-context.xml    |   2 +-
 .../test/resources/core-persistence.properties  |  17 +
 .../persistence/CorePerformanceTest.java        |   4 +-
 stack/pom.xml                                   |   6 -
 11 files changed, 764 insertions(+), 540 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index b6869c6..bbc6f36 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -370,11 +370,6 @@
       <artifactId>zookeeper</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>org.apache.lucene</groupId>
-      <artifactId>lucene-core</artifactId>
-    </dependency>
-
     <!-- SUN, Javax Package, and Other Commercial Dependencies -->
 
     <dependency>
@@ -571,17 +566,25 @@
 
     <dependency>
 	    <groupId>org.apache.usergrid</groupId>
-	    <artifactId>collection</artifactId>
-	    <version>1.0-SNAPSHOT</version>
+	    <artifactId>graph</artifactId>
+	    <version>2.0.0-SNAPSHOT</version>
 	    <type>jar</type>
     </dependency>
 
     <dependency>
 	    <groupId>org.apache.usergrid</groupId>
 	    <artifactId>queryindex</artifactId>
-	    <version>1.0-SNAPSHOT</version>
+	    <version>2.0.0-SNAPSHOT</version>
 	    <type>jar</type>
     </dependency>
 
+    <dependency>
+      <artifactId>lucene-core</artifactId>
+      <groupId>org.apache.lucene</groupId>
+      <type>jar</type>
+      <version>4.6.0</version>
+    </dependency>
+
   </dependencies>
+
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerImpl.java
new file mode 100644
index 0000000..cdbbd01
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerImpl.java
@@ -0,0 +1,567 @@
+/*
+ * 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.corepersistence;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.netflix.config.ConfigurationManager;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.UUID;
+import me.prettyprint.hector.api.mutation.Mutator;
+import org.apache.usergrid.persistence.Entity;
+import org.apache.usergrid.persistence.EntityManager;
+import org.apache.usergrid.persistence.EntityRef;
+import org.apache.usergrid.persistence.Query;
+import org.apache.usergrid.persistence.Results;
+import org.apache.usergrid.persistence.TypedEntity;
+import org.apache.usergrid.persistence.cassandra.CassandraService;
+import org.apache.usergrid.persistence.cassandra.CounterUtils;
+import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl;
+import org.apache.usergrid.persistence.cassandra.EntityManagerImpl;
+import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.collection.EntityCollectionManager;
+import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
+import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
+import org.apache.usergrid.persistence.collection.migration.MigrationException;
+import org.apache.usergrid.persistence.collection.migration.MigrationManager;
+import org.apache.usergrid.persistence.entities.Application;
+import org.apache.usergrid.persistence.index.EntityCollectionIndex;
+import org.apache.usergrid.persistence.index.EntityCollectionIndexFactory;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
+import org.apache.usergrid.persistence.model.field.StringField;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Hybrid Core Persistence implementation of EntityManager.
+ */
+public class CpEntityManagerImpl extends EntityManagerImpl {
+    private static final Logger logger = LoggerFactory.getLogger(CpEntityManagerImpl.class);
+
+    private static EntityCollectionManagerFactory ecmf;
+    private static EntityCollectionIndexFactory ecif ;
+    static {
+
+        try {
+            ConfigurationManager.loadCascadedPropertiesFromResources("core-persistence");
+
+            // TODO: make CpEntityManager work in non-test environment
+            Properties testProps = new Properties() {{
+                put("cassandra.hosts", "localhost:" + System.getProperty("cassandra.rpc_port"));
+            }};
+
+            ConfigurationManager.loadProperties( testProps );
+
+        } catch (IOException ex) {
+            throw new RuntimeException("Error loading Core Persistence proprties", ex);
+        }
+
+        Injector injector = Guice.createInjector( new CpModule() );
+
+        MigrationManager m = injector.getInstance( MigrationManager.class );
+        try {
+            m.migrate();
+        } catch (MigrationException ex) {
+            throw new RuntimeException("Error migrating Core Persistence", ex);
+        }
+
+        ecmf = injector.getInstance( EntityCollectionManagerFactory.class );
+        ecif = injector.getInstance( EntityCollectionIndexFactory.class );
+    }
+    private final Map<CollectionScope, EntityCollectionManager> managers = new HashMap<>();
+    private final Map<CollectionScope, EntityCollectionIndex> indexes = new HashMap<>();
+
+    private CollectionScope applicationScope = null;
+
+    @Override
+    public EntityManager init( 
+            EntityManagerFactoryImpl emf, 
+            CassandraService cass, 
+            CounterUtils counterUtils,
+            UUID applicationId, 
+            boolean skipAggregateCounters ) {
+
+        super.init( emf, cass, counterUtils, applicationId, skipAggregateCounters );
+        setApplicationId(applicationId);
+        return this;
+    }
+
+    @Override
+    public void setApplicationId( UUID applicationId ) {
+        super.setApplicationId( applicationId );
+        try {
+            Application app = getApplication();
+
+            Id orgId = getOrganizationId( app );
+            Id appId = new SimpleId( applicationId, "application");
+
+            applicationScope = 
+                new CollectionScopeImpl(orgId, appId, "applicationScope");
+
+        } catch (Exception ex) {
+            logger.error("Error getting applicationScope", ex);
+        }
+    }
+
+    private static final String SYSTEM_ORG_TYPE = "zzz_defaultorg_zzz";
+    private static final String SYSTEM_APP_TYPE = "zzz_defaultapp_zzz";
+    private static final String SYSTEM_SCOPE_TYPE = "zzz_default_zzz";
+
+    private static final Id defaultOrgId = new SimpleId( SYSTEM_ORG_TYPE );
+    private static final Id defaultAppId = new SimpleId( SYSTEM_APP_TYPE );
+    private static final CollectionScope systemScope = new CollectionScopeImpl(
+        defaultOrgId, defaultAppId, SYSTEM_SCOPE_TYPE );
+
+    private Id getOrganizationId( Application app ) {
+
+
+
+        EntityCollectionManager ecm = getManager( systemScope );
+        EntityCollectionIndex eci = getIndex( systemScope );
+
+        String orgName = (app == null) ? SYSTEM_ORG_TYPE : app.getOrganizationName();
+
+        org.apache.usergrid.persistence.index.query.Query q = 
+            org.apache.usergrid.persistence.index.query.Query.fromQL(
+                "name = '" + orgName + "'");
+
+        org.apache.usergrid.persistence.index.query.Results execute = eci.execute(q);
+
+        if ( execute.isEmpty() ) { // create if does not exist 
+
+            org.apache.usergrid.persistence.model.entity.Entity entity =
+                new org.apache.usergrid.persistence.model.entity.Entity(
+                    new SimpleId(UUIDGenerator.newTimeUUID(), "organization" ));
+
+            entity.setField( new StringField( "name", orgName ));
+            entity = ecm.write( entity ).toBlockingObservable().last();
+
+            Id orgId = entity.getId();
+            return orgId;
+        } 
+
+        org.apache.usergrid.persistence.model.entity.Entity entity =
+            execute.getEntities().get(0);
+
+        Id orgId = entity.getId();
+        return orgId;
+    }
+
+    private Id getApplicationId( Application app ) {
+
+        Id defaultOrgId = new SimpleId("zzz_default_zzz");
+        Id defaultAppId = new SimpleId("zzz_default_zzz");
+        CollectionScope defaultScope = new CollectionScopeImpl(
+                defaultOrgId, defaultAppId, "organizations" );
+
+        EntityCollectionManager ecm = getManager( defaultScope );
+        EntityCollectionIndex eci = getIndex( defaultScope );
+
+        String orgName = (app == null) ? "zzz_default_zzz" : app.getOrganizationName();
+
+        org.apache.usergrid.persistence.index.query.Query q = 
+            org.apache.usergrid.persistence.index.query.Query.fromQL(
+                "name = '" + orgName + "'");
+
+        org.apache.usergrid.persistence.index.query.Results execute = eci.execute(q);
+
+        if ( execute.isEmpty() ) { // create if does not exist 
+
+            org.apache.usergrid.persistence.model.entity.Entity entity =
+                new org.apache.usergrid.persistence.model.entity.Entity(
+                    new SimpleId(UUIDGenerator.newTimeUUID(), "organization" ));
+
+            entity.setField( new StringField( "name", orgName ));
+            entity = ecm.write( entity ).toBlockingObservable().last();
+
+            Id orgId = entity.getId();
+            return orgId;
+        } 
+
+        org.apache.usergrid.persistence.model.entity.Entity entity =
+            execute.getEntities().get(0);
+
+        Id orgId = entity.getId();
+        return orgId;
+    }
+
+
+    private EntityCollectionIndex getIndex( CollectionScope scope ) { 
+        EntityCollectionIndex eci = indexes.get( scope );
+        if ( eci == null ) {
+            eci = ecif.createCollectionIndex( scope );
+            indexes.put( scope, eci );
+        }
+        return eci;
+    }
+
+    private EntityCollectionManager getManager( CollectionScope scope ) { 
+        EntityCollectionManager ecm = managers.get( scope );
+        if ( ecm == null ) {
+            ecm = ecmf.createCollectionManager( scope );
+            managers.put( scope, ecm);
+        }
+        return ecm;
+    }
+
+
+    @Override
+    public Set<String> getCollectionIndexes(
+            EntityRef entity, String collectionName) throws Exception {
+        return super.getCollectionIndexes(entity, collectionName); 
+    }
+
+    @Override
+    public Results searchCollection(
+            EntityRef entityRef, String collectionName, Query query) throws Exception {
+        return super.searchCollection(entityRef, collectionName, query); 
+    }
+
+    @Override
+    public Entity createItemInCollection(
+            EntityRef entityRef, 
+            String collectionName, 
+            String itemType, 
+            Map<String, Object> properties) throws Exception {
+        return super.createItemInCollection(entityRef, collectionName, itemType, properties); 
+    }
+
+    @Override
+    public Results getCollection(
+            UUID entityId, 
+            String collectionName, 
+            Query query, 
+            Results.Level resultsLevel) throws Exception {
+        return super.getCollection(entityId, collectionName, query, resultsLevel); 
+    }
+
+    @Override
+    public Results getCollection(
+            EntityRef entityRef, 
+            String collectionName, 
+            UUID startResult, 
+            int count, 
+            Results.Level resultsLevel, 
+            boolean reversed) throws Exception {
+        return super.getCollection(entityRef, 
+                collectionName, 
+                startResult, 
+                count, 
+                resultsLevel, 
+                reversed); 
+    }
+
+    @Override
+    public Set<String> getCollections(
+            EntityRef entityRef) throws Exception {
+        return super.getCollections(entityRef); 
+    }
+
+    @Override
+    public boolean isPropertyValueUniqueForEntity(
+            String entityType, 
+            String propertyName, 
+            Object propertyValue) throws Exception {
+        return super.isPropertyValueUniqueForEntity(
+                entityType, propertyName, propertyValue); 
+    }
+
+    @Override
+    public void updateProperties(
+            EntityRef entityRef, Map<String, Object> properties) throws Exception {
+        super.updateProperties(entityRef, properties); 
+    }
+
+    @Override
+    public void setProperty(
+            EntityRef entityRef, 
+            String propertyName, 
+            Object propertyValue, 
+            boolean override) throws Exception {
+        super.setProperty(entityRef, 
+                propertyName, propertyValue, override); 
+    }
+
+    @Override
+    public void setProperty(
+            EntityRef entityRef, String propertyName, Object propertyValue) throws Exception {
+        super.setProperty(entityRef, propertyName, propertyValue); 
+    }
+
+    @Override
+    public List<Entity> getPartialEntities(
+            Collection<UUID> ids, Collection<String> fields) throws Exception {
+        return super.getPartialEntities(ids, fields); 
+    }
+
+    @Override
+    public Map<String, Object> getProperties(
+            EntityRef entityRef) throws Exception {
+        return super.getProperties(entityRef); 
+    }
+
+    @Override
+    public Object getProperty(
+            EntityRef entityRef, String propertyName) throws Exception {
+        return super.getProperty(entityRef, propertyName); 
+    }
+
+    @Override
+    public void update(
+            Entity entity) throws Exception {
+        super.update(entity); 
+    }
+
+    @Override
+    public Results loadEntities(
+            Results results, 
+            Results.Level resultsLevel, 
+            Map<UUID, UUID> associatedMap, 
+            int count) throws Exception {
+        return super.loadEntities(results, resultsLevel, associatedMap, count); 
+    }
+
+    @Override
+    public Results loadEntities(
+            Results results, Results.Level resultsLevel, int count) throws Exception {
+        return super.loadEntities(results, resultsLevel, count); 
+    }
+
+    @Override
+    public Results get(
+            Collection<UUID> entityIds, 
+            String entityType, 
+            Class<? extends Entity> entityClass, 
+            Results.Level resultsLevel) throws Exception {
+        return super.get(entityIds, entityType, entityClass, resultsLevel); 
+    }
+
+    @Override
+    public Results get(
+            Collection<UUID> entityIds, 
+            Class<? extends Entity> entityClass, 
+            Results.Level resultsLevel) throws Exception {
+        return super.get(entityIds, entityClass, resultsLevel); 
+    }
+
+    @Override
+    public Results get(
+            Collection<UUID> entityIds) throws Exception {
+        return super.get(entityIds); 
+    }
+
+    @Override
+    public Results get(
+            Collection<UUID> entityIds, 
+            Results.Level resultsLevel) throws Exception {
+        return super.get(entityIds, resultsLevel); 
+    }
+
+    @Override
+    public <A extends Entity> A get(
+            UUID entityId, Class<A> entityClass) throws Exception {
+        return super.get(entityId, entityClass); 
+    }
+
+    @Override
+    public <A extends Entity> A get(
+            EntityRef entityRef, Class<A> entityClass) throws Exception {
+        return super.get(entityRef, entityClass); 
+    }
+
+    @Override
+    public Entity get(
+            EntityRef entityRef) throws Exception {
+        return super.get(entityRef); 
+    }
+
+    @Override
+    public Entity get(
+            UUID entityid) throws Exception {
+        return super.get(entityid); 
+    }
+
+    @Override
+    public EntityRef validate(
+            EntityRef entityRef, boolean verify) throws Exception {
+        return super.validate(entityRef, verify); 
+    }
+
+    @Override
+    public EntityRef validate(
+            EntityRef entityRef) throws Exception {
+        return super.validate(entityRef); 
+    }
+
+    @Override
+    public void delete(
+            EntityRef entityRef) throws Exception {
+        super.delete(entityRef); 
+    }
+
+    @Override
+    public void deleteEntity(
+            UUID entityId) throws Exception {
+        super.deleteEntity(entityId); 
+    }
+
+    @Override
+    public void updateProperties(
+            UUID entityId, Map<String, Object> properties) throws Exception {
+        super.updateProperties(entityId, properties); 
+    }
+
+    @Override
+    public Set<String> getPropertyNames(
+            EntityRef entity) throws Exception {
+        return super.getPropertyNames(entity); 
+    }
+
+    @Override
+    public <A extends Entity> List<A> getEntities(
+            Collection<UUID> entityIds, Class<A> entityClass) throws Exception {
+        return super.getEntities(entityIds, entityClass); 
+    }
+
+    @Override
+    public <A extends Entity> A getEntity(
+            UUID entityId, Class<A> entityClass) throws Exception {
+        return super.getEntity(entityId, entityClass); 
+    }
+
+    @Override
+    public String getEntityType(
+            UUID entityId) throws Exception {
+        return super.getEntityType(entityId); 
+    }
+
+    @Override
+    public <A extends Entity> A batchCreate(
+            Mutator<ByteBuffer> m, 
+            String entityType, 
+            Class<A> entityClass, 
+            Map<String, Object> properties, 
+            UUID importId, 
+            UUID timestampUuid) throws Exception {
+        return super.batchCreate(m, 
+                entityType, 
+                entityClass, 
+                properties, 
+                importId, 
+                timestampUuid); 
+    }
+
+    @Override
+    public <A extends Entity> A create(
+            String entityType, 
+            Class<A> entityClass, 
+            Map<String, Object> properties, 
+            UUID importId) throws Exception {
+        return super.create(entityType, entityClass, properties, importId); 
+    }
+
+    @Override
+    public Entity create(
+            String entityType, Map<String, Object> properties) throws Exception {
+        return super.create(entityType, properties); 
+    }
+
+    @Override
+    public Entity create(
+            UUID importId, 
+            String entityType, 
+            Map<String, Object> properties) throws Exception {
+        return super.create(importId, entityType, properties); 
+    }
+
+    @Override
+    public <A extends Entity> A create(
+            String entityType, 
+            Class<A> entityClass, 
+            Map<String, Object> properties) throws Exception {
+        return super.create(entityType, entityClass, properties); 
+    }
+
+    @Override
+    public boolean isPropertyValueUniqueForEntity(
+            UUID ownerEntityId, 
+            String entityType, 
+            String propertyName, 
+            Object propertyValue) throws Exception {
+        return super.isPropertyValueUniqueForEntity(ownerEntityId, 
+                entityType, 
+                propertyName, 
+                propertyValue); 
+    }
+
+    @Override
+    public Mutator<ByteBuffer> batchUpdateProperties(
+            Mutator<ByteBuffer> batch, 
+            EntityRef entity, 
+            Map<String, Object> properties, 
+            UUID timestampUuid) throws Exception {
+        return super.batchUpdateProperties(batch, entity, properties, timestampUuid); 
+    }
+
+    @Override
+    public Mutator<ByteBuffer> batchSetProperty(
+            Mutator<ByteBuffer> batch, 
+            EntityRef entity, 
+            String propertyName, 
+            Object propertyValue, 
+            boolean force, 
+            boolean noRead, 
+            UUID timestampUuid) throws Exception {
+        return super.batchSetProperty(batch, 
+                entity, 
+                propertyName, 
+                propertyValue, 
+                force, 
+                noRead, 
+                timestampUuid); 
+    }
+
+    @Override
+    public Mutator<ByteBuffer> batchSetProperty(
+            Mutator<ByteBuffer> batch, 
+            EntityRef entity, 
+            String propertyName, 
+            Object propertyValue, 
+            UUID timestampUuid) throws Exception {
+        return super.batchSetProperty(batch, 
+                entity, 
+                propertyName, 
+                propertyValue, 
+                timestampUuid); 
+    }
+
+    @Override
+    public <A extends TypedEntity> A create(
+            A entity) throws Exception {
+        return super.create(entity);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpModule.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpModule.java
new file mode 100644
index 0000000..7388a8a
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpModule.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.corepersistence;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.usergrid.persistence.collection.guice.CollectionModule;
+import org.apache.usergrid.persistence.collection.migration.Migration;
+import org.apache.usergrid.persistence.collection.mvcc.event.PostProcessObserver;
+import org.apache.usergrid.persistence.graph.EdgeManager;
+import org.apache.usergrid.persistence.graph.EdgeManagerFactory;
+import org.apache.usergrid.persistence.graph.GraphFig;
+import org.apache.usergrid.persistence.graph.consistency.AsyncProcessor;
+import org.apache.usergrid.persistence.graph.consistency.AsyncProcessorImpl;
+import org.apache.usergrid.persistence.graph.consistency.LocalTimeoutQueue;
+import org.apache.usergrid.persistence.graph.consistency.TimeService;
+import org.apache.usergrid.persistence.graph.consistency.TimeoutQueue;
+import org.apache.usergrid.persistence.graph.guice.EdgeDelete;
+import org.apache.usergrid.persistence.graph.guice.EdgeWrite;
+import org.apache.usergrid.persistence.graph.guice.NodeDelete;
+import org.apache.usergrid.persistence.graph.impl.CollectionIndexObserver;
+import org.apache.usergrid.persistence.graph.impl.EdgeManagerImpl;
+import org.apache.usergrid.persistence.graph.impl.stage.EdgeDeleteRepair;
+import org.apache.usergrid.persistence.graph.impl.stage.EdgeDeleteRepairImpl;
+import org.apache.usergrid.persistence.graph.impl.stage.EdgeMetaRepair;
+import org.apache.usergrid.persistence.graph.impl.stage.EdgeMetaRepairImpl;
+import org.apache.usergrid.persistence.graph.impl.stage.EdgeWriteRepair;
+import org.apache.usergrid.persistence.graph.impl.stage.EdgeWriteRepairImpl;
+import org.apache.usergrid.persistence.graph.serialization.CassandraConfig;
+import org.apache.usergrid.persistence.graph.serialization.EdgeMetadataSerialization;
+import org.apache.usergrid.persistence.graph.serialization.EdgeSerialization;
+import org.apache.usergrid.persistence.graph.serialization.NodeSerialization;
+import org.apache.usergrid.persistence.graph.serialization.impl.CassandraConfigImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeMetadataSerializationImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.EdgeSerializationImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.NodeSerializationImpl;
+import org.apache.usergrid.persistence.index.EntityCollectionIndex;
+import org.apache.usergrid.persistence.index.EntityCollectionIndexFactory;
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.impl.EsEntityCollectionIndex;
+import org.safehaus.guicyfig.GuicyFigModule;
+
+/**
+ * Guice Module that encapsulates Core Persistence.
+ */
+public class CpModule  extends AbstractModule {
+
+    @Override
+    protected void configure() {
+
+        //------------
+        // COLLECTION
+        //
+
+        // configure collections and our core astyanax framework
+        install(new CollectionModule());
+
+        //------------
+        // INDEX 
+        //
+
+        install (new GuicyFigModule( IndexFig.class ));
+
+        install( new FactoryModuleBuilder()
+            .implement( EntityCollectionIndex.class, EsEntityCollectionIndex.class )
+            .build( EntityCollectionIndexFactory.class ) );
+
+        //------------
+        // GRAPH 
+        //
+
+        install (new GuicyFigModule( GraphFig.class ));
+        
+        bind( PostProcessObserver.class ).to( CollectionIndexObserver.class );
+
+        bind( EdgeMetadataSerialization.class).to( EdgeMetadataSerializationImpl.class);
+        bind( EdgeSerialization.class).to( EdgeSerializationImpl.class );
+        bind( NodeSerialization.class).to( NodeSerializationImpl.class );
+
+        bind( CassandraConfig.class).to( CassandraConfigImpl.class );
+
+         // create a guice factory for getting our collection manager
+        install( new FactoryModuleBuilder()
+                .implement( EdgeManager.class, EdgeManagerImpl.class )
+                .build( EdgeManagerFactory.class ) );
+        
+        Multibinder<Migration> migrationBinding = 
+            Multibinder.newSetBinder( binder(), Migration.class );
+
+        migrationBinding.addBinding().to( EdgeMetadataSerializationImpl.class );
+        migrationBinding.addBinding().to( EdgeSerializationImpl.class );
+        migrationBinding.addBinding().to( NodeSerializationImpl.class );
+
+        // local queue
+        bind(TimeoutQueue.class).to( LocalTimeoutQueue.class );
+
+
+        bind( AsyncProcessor.class).annotatedWith( EdgeDelete.class ).to( AsyncProcessorImpl.class );
+        bind( AsyncProcessor.class).annotatedWith( EdgeWrite.class ).to( AsyncProcessorImpl.class );
+        bind( AsyncProcessor.class).annotatedWith( NodeDelete.class ).to( AsyncProcessorImpl.class );
+
+        // Repair/cleanup classes
+        bind( EdgeMetaRepair.class).to( EdgeMetaRepairImpl.class );
+        bind( EdgeWriteRepair.class).to( EdgeWriteRepairImpl.class );
+        bind( EdgeDeleteRepair.class).to( EdgeDeleteRepairImpl.class );
+
+        bind( TimeService.class).to( TimeServiceImpl.class );
+    }    
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/java/org/apache/usergrid/corepersistence/TimeServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/TimeServiceImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/TimeServiceImpl.java
new file mode 100644
index 0000000..fc99606
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/TimeServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.corepersistence;
+
+import org.apache.usergrid.persistence.graph.consistency.TimeService;
+
+/**
+ * TODO: this should be in the Graph module. 
+ */
+public class TimeServiceImpl implements TimeService {
+
+    @Override
+    public long getCurrentTime() {
+        return System.currentTimeMillis();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpEntityManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpEntityManagerImpl.java
deleted file mode 100644
index 589b049..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpEntityManagerImpl.java
+++ /dev/null
@@ -1,489 +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.cassandra;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import java.nio.ByteBuffer;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import me.prettyprint.hector.api.mutation.Mutator;
-import org.apache.usergrid.persistence.Entity;
-import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.EntityRef;
-import org.apache.usergrid.persistence.Query;
-import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.TypedEntity;
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.EntityCollectionManager;
-import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
-import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
-import org.apache.usergrid.persistence.entities.Application;
-import org.apache.usergrid.persistence.index.EntityCollectionIndex;
-import org.apache.usergrid.persistence.index.EntityCollectionIndexFactory;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-import org.apache.usergrid.persistence.model.field.StringField;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Hybrid Core Persistence implementation of EntityManager.
- */
-public class CpEntityManagerImpl extends EntityManagerImpl {
-    private static final Logger logger = LoggerFactory.getLogger(CpEntityManagerImpl.class);
-
-    private static EntityCollectionManagerFactory ecmf;
-    private static EntityCollectionIndexFactory ecif ;
-    static {
-        Injector injector = Guice.createInjector( new CpModule() );
-        ecmf = injector.getInstance( EntityCollectionManagerFactory.class );
-        ecif = injector.getInstance( EntityCollectionIndexFactory.class );
-    }
-    private final Map<CollectionScope, EntityCollectionManager> managers = new HashMap<>();
-    private final Map<CollectionScope, EntityCollectionIndex> indexes = new HashMap<>();
-
-    private CollectionScope applicationScope = null;
-
-    @Override
-    public EntityManager init( 
-            EntityManagerFactoryImpl emf, 
-            CassandraService cass, 
-            CounterUtils counterUtils,
-            UUID applicationId, 
-            boolean skipAggregateCounters ) {
-
-        super.init( emf, cass, counterUtils, applicationId, skipAggregateCounters );
-        setApplicationId(applicationId);
-        return this;
-    }
-
-    @Override
-    public void setApplicationId( UUID applicationId ) {
-        super.setApplicationId( applicationId );
-        try {
-            Application app = getApplication();
-
-            Id orgId = getOrganizationId( app );
-            Id appId = new SimpleId( applicationId, "application");
-
-            applicationScope = 
-                new CollectionScopeImpl(orgId, appId, "applicationScope");
-
-        } catch (Exception ex) {
-            logger.error("Error getting applicationScope", ex);
-        }
-    }
-
-    private Id getOrganizationId( Application app ) {
-
-        Id defaultOrgId = new SimpleId("zzz_default_zzz");
-        Id defaultAppId = new SimpleId("zzz_default_zzz");
-        CollectionScope defaultScope = new CollectionScopeImpl(
-                defaultOrgId, defaultAppId, "organizations" );
-
-        EntityCollectionManager ecm = getManager( defaultScope );
-        EntityCollectionIndex eci = getIndex( defaultScope );
-
-        org.apache.usergrid.persistence.query.Query q = 
-            org.apache.usergrid.persistence.query.Query.fromQL(
-                "name = '" + app.getOrganizationName() + "'");
-
-        org.apache.usergrid.persistence.query.Results execute = eci.execute(q);
-
-        if ( execute.isEmpty() ) { // create if does not exist 
-
-            org.apache.usergrid.persistence.model.entity.Entity entity =
-                new org.apache.usergrid.persistence.model.entity.Entity(
-                    new SimpleId(UUIDGenerator.newTimeUUID(), "organization" ));
-
-            entity.setField(new StringField("name", app.getOrganizationName()));
-            entity = ecm.write( entity ).toBlockingObservable().last();
-
-            Id orgId = entity.getId();
-            return orgId;
-        } 
-
-        org.apache.usergrid.persistence.model.entity.Entity entity =
-            execute.getEntities().get(0);
-
-        Id orgId = entity.getId();
-        return orgId;
-    }
-
-
-    private EntityCollectionIndex getIndex( CollectionScope scope ) { 
-        EntityCollectionIndex eci = indexes.get( scope );
-        if ( eci == null ) {
-            eci = ecif.createCollectionIndex( scope );
-            indexes.put( scope, eci );
-        }
-        return eci;
-    }
-
-    private EntityCollectionManager getManager( CollectionScope scope ) { 
-        EntityCollectionManager ecm = managers.get( scope );
-        if ( ecm == null ) {
-            ecm = ecmf.createCollectionManager( scope );
-            managers.put( scope, ecm);
-        }
-        return ecm;
-    }
-
-
-    @Override
-    public Set<String> getCollectionIndexes(
-            EntityRef entity, String collectionName) throws Exception {
-        return super.getCollectionIndexes(entity, collectionName); 
-    }
-
-    @Override
-    public Results searchCollection(
-            EntityRef entityRef, String collectionName, Query query) throws Exception {
-        return super.searchCollection(entityRef, collectionName, query); 
-    }
-
-    @Override
-    public Entity createItemInCollection(
-            EntityRef entityRef, 
-            String collectionName, 
-            String itemType, 
-            Map<String, Object> properties) throws Exception {
-        return super.createItemInCollection(entityRef, collectionName, itemType, properties); 
-    }
-
-    @Override
-    public Results getCollection(
-            UUID entityId, 
-            String collectionName, 
-            Query query, 
-            Results.Level resultsLevel) throws Exception {
-        return super.getCollection(entityId, collectionName, query, resultsLevel); 
-    }
-
-    @Override
-    public Results getCollection(
-            EntityRef entityRef, 
-            String collectionName, 
-            UUID startResult, 
-            int count, 
-            Results.Level resultsLevel, 
-            boolean reversed) throws Exception {
-        return super.getCollection(entityRef, 
-                collectionName, 
-                startResult, 
-                count, 
-                resultsLevel, 
-                reversed); 
-    }
-
-    @Override
-    public Set<String> getCollections(
-            EntityRef entityRef) throws Exception {
-        return super.getCollections(entityRef); 
-    }
-
-    @Override
-    public boolean isPropertyValueUniqueForEntity(
-            String entityType, 
-            String propertyName, 
-            Object propertyValue) throws Exception {
-        return super.isPropertyValueUniqueForEntity(
-                entityType, propertyName, propertyValue); 
-    }
-
-    @Override
-    public void updateProperties(
-            EntityRef entityRef, Map<String, Object> properties) throws Exception {
-        super.updateProperties(entityRef, properties); 
-    }
-
-    @Override
-    public void setProperty(
-            EntityRef entityRef, 
-            String propertyName, 
-            Object propertyValue, 
-            boolean override) throws Exception {
-        super.setProperty(entityRef, 
-                propertyName, propertyValue, override); 
-    }
-
-    @Override
-    public void setProperty(
-            EntityRef entityRef, String propertyName, Object propertyValue) throws Exception {
-        super.setProperty(entityRef, propertyName, propertyValue); 
-    }
-
-    @Override
-    public List<Entity> getPartialEntities(
-            Collection<UUID> ids, Collection<String> fields) throws Exception {
-        return super.getPartialEntities(ids, fields); 
-    }
-
-    @Override
-    public Map<String, Object> getProperties(
-            EntityRef entityRef) throws Exception {
-        return super.getProperties(entityRef); 
-    }
-
-    @Override
-    public Object getProperty(
-            EntityRef entityRef, String propertyName) throws Exception {
-        return super.getProperty(entityRef, propertyName); 
-    }
-
-    @Override
-    public void update(
-            Entity entity) throws Exception {
-        super.update(entity); 
-    }
-
-    @Override
-    public Results loadEntities(
-            Results results, 
-            Results.Level resultsLevel, 
-            Map<UUID, UUID> associatedMap, 
-            int count) throws Exception {
-        return super.loadEntities(results, resultsLevel, associatedMap, count); 
-    }
-
-    @Override
-    public Results loadEntities(
-            Results results, Results.Level resultsLevel, int count) throws Exception {
-        return super.loadEntities(results, resultsLevel, count); 
-    }
-
-    @Override
-    public Results get(
-            Collection<UUID> entityIds, 
-            String entityType, 
-            Class<? extends Entity> entityClass, 
-            Results.Level resultsLevel) throws Exception {
-        return super.get(entityIds, entityType, entityClass, resultsLevel); 
-    }
-
-    @Override
-    public Results get(
-            Collection<UUID> entityIds, 
-            Class<? extends Entity> entityClass, 
-            Results.Level resultsLevel) throws Exception {
-        return super.get(entityIds, entityClass, resultsLevel); 
-    }
-
-    @Override
-    public Results get(
-            Collection<UUID> entityIds) throws Exception {
-        return super.get(entityIds); 
-    }
-
-    @Override
-    public Results get(
-            Collection<UUID> entityIds, 
-            Results.Level resultsLevel) throws Exception {
-        return super.get(entityIds, resultsLevel); 
-    }
-
-    @Override
-    public <A extends Entity> A get(
-            UUID entityId, Class<A> entityClass) throws Exception {
-        return super.get(entityId, entityClass); 
-    }
-
-    @Override
-    public <A extends Entity> A get(
-            EntityRef entityRef, Class<A> entityClass) throws Exception {
-        return super.get(entityRef, entityClass); 
-    }
-
-    @Override
-    public Entity get(
-            EntityRef entityRef) throws Exception {
-        return super.get(entityRef); 
-    }
-
-    @Override
-    public Entity get(
-            UUID entityid) throws Exception {
-        return super.get(entityid); 
-    }
-
-    @Override
-    public EntityRef validate(
-            EntityRef entityRef, boolean verify) throws Exception {
-        return super.validate(entityRef, verify); 
-    }
-
-    @Override
-    public EntityRef validate(
-            EntityRef entityRef) throws Exception {
-        return super.validate(entityRef); 
-    }
-
-    @Override
-    public void delete(
-            EntityRef entityRef) throws Exception {
-        super.delete(entityRef); 
-    }
-
-    @Override
-    public void deleteEntity(
-            UUID entityId) throws Exception {
-        super.deleteEntity(entityId); 
-    }
-
-    @Override
-    public void updateProperties(
-            UUID entityId, Map<String, Object> properties) throws Exception {
-        super.updateProperties(entityId, properties); 
-    }
-
-    @Override
-    public Set<String> getPropertyNames(
-            EntityRef entity) throws Exception {
-        return super.getPropertyNames(entity); 
-    }
-
-    @Override
-    public <A extends Entity> List<A> getEntities(
-            Collection<UUID> entityIds, Class<A> entityClass) throws Exception {
-        return super.getEntities(entityIds, entityClass); 
-    }
-
-    @Override
-    public <A extends Entity> A getEntity(
-            UUID entityId, Class<A> entityClass) throws Exception {
-        return super.getEntity(entityId, entityClass); 
-    }
-
-    @Override
-    public String getEntityType(
-            UUID entityId) throws Exception {
-        return super.getEntityType(entityId); 
-    }
-
-    @Override
-    public <A extends Entity> A batchCreate(
-            Mutator<ByteBuffer> m, 
-            String entityType, 
-            Class<A> entityClass, 
-            Map<String, Object> properties, 
-            UUID importId, 
-            UUID timestampUuid) throws Exception {
-        return super.batchCreate(m, 
-                entityType, 
-                entityClass, 
-                properties, 
-                importId, 
-                timestampUuid); 
-    }
-
-    @Override
-    public <A extends Entity> A create(
-            String entityType, 
-            Class<A> entityClass, 
-            Map<String, Object> properties, 
-            UUID importId) throws Exception {
-        return super.create(entityType, entityClass, properties, importId); 
-    }
-
-    @Override
-    public Entity create(
-            String entityType, Map<String, Object> properties) throws Exception {
-        return super.create(entityType, properties); 
-    }
-
-    @Override
-    public Entity create(
-            UUID importId, 
-            String entityType, 
-            Map<String, Object> properties) throws Exception {
-        return super.create(importId, entityType, properties); 
-    }
-
-    @Override
-    public <A extends Entity> A create(
-            String entityType, 
-            Class<A> entityClass, 
-            Map<String, Object> properties) throws Exception {
-        return super.create(entityType, entityClass, properties); 
-    }
-
-    @Override
-    public boolean isPropertyValueUniqueForEntity(
-            UUID ownerEntityId, 
-            String entityType, 
-            String propertyName, 
-            Object propertyValue) throws Exception {
-        return super.isPropertyValueUniqueForEntity(ownerEntityId, 
-                entityType, 
-                propertyName, 
-                propertyValue); 
-    }
-
-    @Override
-    public Mutator<ByteBuffer> batchUpdateProperties(
-            Mutator<ByteBuffer> batch, 
-            EntityRef entity, 
-            Map<String, Object> properties, 
-            UUID timestampUuid) throws Exception {
-        return super.batchUpdateProperties(batch, entity, properties, timestampUuid); 
-    }
-
-    @Override
-    public Mutator<ByteBuffer> batchSetProperty(
-            Mutator<ByteBuffer> batch, 
-            EntityRef entity, 
-            String propertyName, 
-            Object propertyValue, 
-            boolean force, 
-            boolean noRead, 
-            UUID timestampUuid) throws Exception {
-        return super.batchSetProperty(batch, 
-                entity, 
-                propertyName, 
-                propertyValue, 
-                force, 
-                noRead, 
-                timestampUuid); 
-    }
-
-    @Override
-    public Mutator<ByteBuffer> batchSetProperty(
-            Mutator<ByteBuffer> batch, 
-            EntityRef entity, 
-            String propertyName, 
-            Object propertyValue, 
-            UUID timestampUuid) throws Exception {
-        return super.batchSetProperty(batch, 
-                entity, 
-                propertyName, 
-                propertyValue, 
-                timestampUuid); 
-    }
-
-    @Override
-    public <A extends TypedEntity> A create(
-            A entity) throws Exception {
-        return super.create(entity);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpModule.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpModule.java
deleted file mode 100644
index 4da8c4a..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpModule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2014 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.persistence.cassandra;
-
-import com.google.inject.AbstractModule;
-import org.apache.usergrid.persistence.index.guice.IndexModule;
-
-/**
- * Guice Module that encapsulates Core Persistence.
- */
-public class CpModule  extends AbstractModule {
-
-    @Override
-    protected void configure() {
-        install(new IndexModule());
-    }    
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java b/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
index ffc2ba7..982e67c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
+++ b/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
@@ -29,11 +29,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.UUID;
+import java.util.logging.Level;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.analysis.tokenattributes.TermAttribute;
+import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.util.Version;
 
 import static org.apache.usergrid.utils.ClassUtils.cast;
@@ -203,16 +204,24 @@ public class IndexUtils {
 
 
     public static List<String> keywords( String source ) {
-        TokenStream ts = analyzer.tokenStream( "keywords", new StringReader( source ) );
         List<String> keywords = new ArrayList<String>();
+        TokenStream ts = null;
         try {
+            ts = analyzer.tokenStream( "keywords", new StringReader( source ) );
+            ts.reset();
             while ( ts.incrementToken() ) {
-                keywords.add( ts.getAttribute( TermAttribute.class ).term() );
+                keywords.add( ts.getAttribute( CharTermAttribute.class ).toString() );
             }
+            ts.end();
         }
         catch ( IOException e ) {
             LOG.error( "Error getting keywords ", e );
         }
+        finally {
+            try {
+                 ts.close();
+            } catch (IOException ignored) {}
+        }
         return keywords;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/main/resources/usergrid-core-context.xml
----------------------------------------------------------------------
diff --git a/stack/core/src/main/resources/usergrid-core-context.xml b/stack/core/src/main/resources/usergrid-core-context.xml
index 441b3d0..f9e0eb8 100644
--- a/stack/core/src/main/resources/usergrid-core-context.xml
+++ b/stack/core/src/main/resources/usergrid-core-context.xml
@@ -156,7 +156,7 @@
     
     <bean id="mailUtils" class="org.apache.usergrid.utils.MailUtils" />
 
-    <bean id="entityManager" class="org.apache.usergrid.persistence.cassandra.CpEntityManagerImpl" scope="prototype"/>
+    <bean id="entityManager" class="org.apache.usergrid.corepersistence.CpEntityManagerImpl" scope="prototype"/>
 
     <bean id="relationManager" class="org.apache.usergrid.persistence.cassandra.RelationManagerImpl" scope="prototype"/>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/core/src/test/resources/core-persistence.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/core-persistence.properties b/stack/core/src/test/resources/core-persistence.properties
new file mode 100644
index 0000000..6ce9c22
--- /dev/null
+++ b/stack/core/src/test/resources/core-persistence.properties
@@ -0,0 +1,17 @@
+# The properties are not the actual configuration properties but
+# safe dynamic property defaults for our testing via IDE or Maven
+cassandra.connections=10
+cassandra.port=9160
+cassandra.version=1.2
+cassandra.hosts=localhost
+cassandra.cluster_name=Usergrid
+collections.keyspace=Usergrid_Collections
+cassandra.timeout=5000
+
+index.query.limit.default=10
+elasticsearch.indexname=Usergrid
+elasticsearch.embedded=true
+elasticsearch.force-refresh=false
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/corepersistence/perftest2/src/test/java/org/apache/usergrid/persistence/CorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/perftest2/src/test/java/org/apache/usergrid/persistence/CorePerformanceTest.java b/stack/corepersistence/perftest2/src/test/java/org/apache/usergrid/persistence/CorePerformanceTest.java
index 1e69167..2d23239 100644
--- a/stack/corepersistence/perftest2/src/test/java/org/apache/usergrid/persistence/CorePerformanceTest.java
+++ b/stack/corepersistence/perftest2/src/test/java/org/apache/usergrid/persistence/CorePerformanceTest.java
@@ -34,6 +34,8 @@ import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.index.EntityCollectionIndex;
 import org.apache.usergrid.persistence.index.EntityCollectionIndexFactory;
 import org.apache.usergrid.persistence.index.guice.TestIndexModule;
+import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.index.query.Results;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
@@ -41,8 +43,6 @@ import org.apache.usergrid.persistence.model.field.DoubleField;
 import org.apache.usergrid.persistence.model.field.LongField;
 import org.apache.usergrid.persistence.model.field.StringField;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import org.apache.usergrid.persistence.query.Query;
-import org.apache.usergrid.persistence.query.Results;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8adbe29c/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 9047bdc..5202fee 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -435,12 +435,6 @@
       </dependency>
 
       <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-core</artifactId>
-        <version>3.0.3</version>
-      </dependency>
-
-      <dependency>
         <groupId>org.apache.cassandra</groupId>
         <artifactId>cassandra-thrift</artifactId>
         <version>${cassandra-version}</version>


Mime
View raw message