You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/26 20:20:54 UTC

[07/13] git commit: Beginnings of Core Persistence based EntityManager for USERGRID-104

Beginnings of Core Persistence based EntityManager for USERGRID-104


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

Branch: refs/heads/entity-manager
Commit: 335044e0e74625c358b4797bfe4b158c54aaf368
Parents: 2809a67
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Mar 26 15:16:43 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Wed Mar 26 15:16:43 2014 -0400

----------------------------------------------------------------------
 stack/README.md                                 |   2 +-
 stack/config/src/main/resources/log4j.xml       |   4 +
 .../config/src/test/resources/log4j.properties  |   1 +
 stack/core/README.txt                           |   2 +-
 stack/core/pom.xml                              |  24 +
 .../usergrid/persistence/EntityManager.java     |  72 +++
 .../persistence/EntityManagerFactory.java       |   2 +-
 .../cassandra/CpEntityManagerImpl.java          | 489 +++++++++++++++++++
 .../persistence/cassandra/CpModule.java         |  31 ++
 .../cassandra/EntityManagerFactoryImpl.java     |   1 +
 .../cassandra/EntityManagerImpl.java            |   6 +-
 .../persistence/cassandra/GeoIndexManager.java  |   5 +-
 .../cassandra/RelationManagerImpl.java          |   5 +-
 .../main/resources/usergrid-core-context.xml    |   4 +-
 stack/core/src/test/resources/log4j.properties  |   1 +
 stack/corepersistence/collection/pom.xml        |   2 +-
 stack/corepersistence/graph/pom.xml             |   2 +-
 stack/corepersistence/model/pom.xml             |   2 +-
 stack/corepersistence/perftest1/pom.xml         |   2 +-
 stack/corepersistence/perftest2/pom.xml         |   4 +-
 stack/corepersistence/pom.xml                   |   2 +-
 stack/pom.xml                                   |   6 +-
 stack/query-validator/pom.xml                   |   4 +-
 23 files changed, 650 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/README.md
----------------------------------------------------------------------
diff --git a/stack/README.md b/stack/README.md
index 7f00962..e5e5109 100644
--- a/stack/README.md
+++ b/stack/README.md
@@ -7,7 +7,7 @@ A highly-scalable data platform for mobile applications.
 
 ## Requirements
 
-* JDK 1.6 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
+* JDK 1.7 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
 * 3.0.0 <= Maven < 3.1.0 (http://maven.apache.org/)
 
 ## Building

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/config/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/stack/config/src/main/resources/log4j.xml b/stack/config/src/main/resources/log4j.xml
index cc9e9af..7b592af 100644
--- a/stack/config/src/main/resources/log4j.xml
+++ b/stack/config/src/main/resources/log4j.xml
@@ -63,6 +63,10 @@
         <level value="warn"/>
         <appender-ref ref="stdout"/>
     </logger>
+    <logger name="org.apache.usergrid.persistence.cassandra.CpEntityManagerImpl">
+        <level value="info"/>
+        <appender-ref ref="stdout"/>
+    </logger>
     <logger name="org.apache.usergrid.rest.security.AllowAjaxFilter">
         <level value="warn"/>
         <appender-ref ref="stdout"/>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/config/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/test/resources/log4j.properties b/stack/config/src/test/resources/log4j.properties
index 5527973..bfa665f 100644
--- a/stack/config/src/test/resources/log4j.properties
+++ b/stack/config/src/test/resources/log4j.properties
@@ -38,6 +38,7 @@ log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN, stdout
 log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
 log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
 
+log4j.logger.org.apache.usergrid.persistence.cassandra.CpEntityManagerImpl=INFO, stdout
 
 #log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG, stdout
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/README.txt
----------------------------------------------------------------------
diff --git a/stack/core/README.txt b/stack/core/README.txt
index 32445d8..997e279 100644
--- a/stack/core/README.txt
+++ b/stack/core/README.txt
@@ -2,7 +2,7 @@ Usergrid Core Repository
 
 Requirements
 
-JDK 1.6 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
+JDK 1.7 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
 Maven (http://maven.apache.org/)
 
 Building

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 7088e40..b6869c6 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -290,6 +290,15 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.2</version>
+        <configuration>
+          <source>1.7</source>
+          <target>1.7</target>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -559,5 +568,20 @@
       <artifactId>spring-test</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+	    <groupId>org.apache.usergrid</groupId>
+	    <artifactId>collection</artifactId>
+	    <version>1.0-SNAPSHOT</version>
+	    <type>jar</type>
+    </dependency>
+
+    <dependency>
+	    <groupId>org.apache.usergrid</groupId>
+	    <artifactId>queryindex</artifactId>
+	    <version>1.0-SNAPSHOT</version>
+	    <type>jar</type>
+    </dependency>
+
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
index 2a20b87..539bc4c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
@@ -17,13 +17,16 @@
 package org.apache.usergrid.persistence;
 
 
+import java.nio.ByteBuffer;
 import java.util.Collection;
 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.Results.Level;
+import org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.cassandra.GeoIndexManager;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.Role;
@@ -618,4 +621,73 @@ public interface EntityManager {
     public void grantGroupPermission( UUID groupId, String permission ) throws Exception;
 
     public void revokeGroupPermission( UUID groupId, String permission ) throws Exception;
+
+
+    <A extends Entity> A batchCreate(Mutator<ByteBuffer> m, String entityType, Class<A> entityClass, Map<String, Object> properties, UUID importId, UUID timestampUuid) throws Exception;
+
+    void batchCreateRole(Mutator<ByteBuffer> batch, UUID groupId, String roleName, String roleTitle, long inactivity, RoleRef roleRef, UUID timestampUuid) throws Exception;
+
+    /**
+     * Batch dictionary property.
+     *
+     * @param batch The batch to set the property into
+     * @param entity The entity that owns the property
+     * @param propertyName the property name
+     * @param propertyValue the property value
+     * @param timestampUuid The update timestamp as a uuid
+     *
+     * @return batch
+     *
+     * @throws Exception the exception
+     */
+    Mutator<ByteBuffer> batchSetProperty(Mutator<ByteBuffer> batch, EntityRef entity, String propertyName, Object propertyValue, UUID timestampUuid) throws Exception;
+
+    Mutator<ByteBuffer> batchSetProperty(Mutator<ByteBuffer> batch, EntityRef entity, String propertyName, Object propertyValue, boolean force, boolean noRead, UUID timestampUuid) throws Exception;
+
+    Mutator<ByteBuffer> batchUpdateDictionary(Mutator<ByteBuffer> batch, EntityRef entity, String dictionaryName, Object elementValue, Object elementCoValue, boolean removeFromDictionary, UUID timestampUuid) throws Exception;
+
+    /**
+     * Batch update set.
+     *
+     * @param batch the batch
+     * @param entity The owning entity
+     * @param dictionaryName the dictionary name
+     * @param elementValue the dictionary value
+     * @param removeFromDictionary True to delete from the dictionary
+     * @param timestampUuid the timestamp
+     *
+     * @return batch
+     *
+     * @throws Exception the exception
+     */
+    Mutator<ByteBuffer> batchUpdateDictionary(Mutator<ByteBuffer> batch, EntityRef entity, String dictionaryName, Object elementValue, boolean removeFromDictionary, UUID timestampUuid) throws Exception;
+
+    /**
+     * Batch update properties.
+     *
+     * @param batch the batch
+     * @param entity The owning entity reference
+     * @param properties the properties to set
+     * @param timestampUuid the timestamp of the update operation as a time uuid
+     *
+     * @return batch
+     *
+     * @throws Exception the exception
+     */
+    Mutator<ByteBuffer> batchUpdateProperties(Mutator<ByteBuffer> batch, EntityRef entity, Map<String, Object> properties, UUID timestampUuid) throws Exception;
+
+    Set<String> getDictionaryNames(EntityRef entity) throws Exception;
+
+    void insertEntity(String type, UUID entityId) throws Exception;
+
+    void deleteEntity(UUID entityId) throws Exception;
+
+    /** @return the applicationId */
+    UUID getApplicationId();
+
+    /** @return the indexBucketLocator */
+    IndexBucketLocator getIndexBucketLocator();
+
+    /** @return the cass */
+    CassandraService getCass();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
index 1233a73..b151eb0 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
@@ -46,7 +46,7 @@ public interface EntityManagerFactory {
      *
      * @param applicationId the application id
      *
-     * @return EntityDao for the specfied parameters
+     * @return EntityDao for the specified parameters
      */
     public abstract EntityManager getEntityManager( UUID applicationId );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/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
new file mode 100644
index 0000000..589b049
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpEntityManagerImpl.java
@@ -0,0 +1,489 @@
+/*
+ * 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/335044e0/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
new file mode 100644
index 0000000..4da8c4a
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CpModule.java
@@ -0,0 +1,31 @@
+/*
+ * 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/335044e0/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImpl.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImpl.java
index e378013..e2e645e 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImpl.java
@@ -409,4 +409,5 @@ public class EntityManagerFactoryImpl implements EntityManagerFactory, Applicati
     public void setCounterUtils( CounterUtils counterUtils ) {
         this.counterUtils = counterUtils;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
index fdff3ca..d38627f 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
@@ -213,8 +213,10 @@ public class EntityManagerImpl implements EntityManager {
     }
 
 
-    public EntityManagerImpl init( EntityManagerFactoryImpl emf, CassandraService cass, CounterUtils counterUtils,
-                                   UUID applicationId, boolean skipAggregateCounters ) {
+    public EntityManager init( 
+            EntityManagerFactoryImpl emf, CassandraService cass, CounterUtils counterUtils,
+            UUID applicationId, boolean skipAggregateCounters ) {
+
         this.emf = emf;
         this.cass = cass;
         this.counterUtils = counterUtils;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/GeoIndexManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/GeoIndexManager.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/GeoIndexManager.java
index f9b1262..ae9c550 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/GeoIndexManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/GeoIndexManager.java
@@ -38,6 +38,7 @@ import me.prettyprint.hector.api.mutation.Mutator;
 
 import static me.prettyprint.hector.api.factory.HFactory.createColumn;
 import static me.prettyprint.hector.api.factory.HFactory.createMutator;
+import org.apache.usergrid.persistence.EntityManager;
 import static org.apache.usergrid.persistence.Schema.DICTIONARY_GEOCELL;
 import static org.apache.usergrid.persistence.Schema.INDEX_CONNECTIONS;
 import static org.apache.usergrid.persistence.cassandra.ApplicationCF.ENTITY_INDEX;
@@ -61,7 +62,7 @@ public class GeoIndexManager {
     public static final int MAX_RESOLUTION = 9;
 
 
-    EntityManagerImpl em;
+    EntityManager em;
     CassandraService cass;
 
 
@@ -69,7 +70,7 @@ public class GeoIndexManager {
     }
 
 
-    public GeoIndexManager init( EntityManagerImpl em ) {
+    public GeoIndexManager init( EntityManager em ) {
         this.em = em;
         this.cass = em.getCass();
         return this;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java
index 3b07fd7..e96bc6b 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -94,6 +94,7 @@ import static java.lang.String.CASE_INSENSITIVE_ORDER;
 import static java.util.Arrays.asList;
 
 import static me.prettyprint.hector.api.factory.HFactory.createMutator;
+import org.apache.usergrid.persistence.EntityManager;
 import static org.apache.usergrid.persistence.Schema.COLLECTION_ROLES;
 import static org.apache.usergrid.persistence.Schema.DICTIONARY_COLLECTIONS;
 import static org.apache.usergrid.persistence.Schema.DICTIONARY_CONNECTED_ENTITIES;
@@ -145,7 +146,7 @@ public class RelationManagerImpl implements RelationManager {
 
     private static final Logger logger = LoggerFactory.getLogger( RelationManagerImpl.class );
 
-    private EntityManagerImpl em;
+    private EntityManager em;
     private CassandraService cass;
     private UUID applicationId;
     private EntityRef headEntity;
@@ -160,7 +161,7 @@ public class RelationManagerImpl implements RelationManager {
     }
 
 
-    public RelationManagerImpl init( EntityManagerImpl em, CassandraService cass, UUID applicationId,
+    public RelationManagerImpl init( EntityManager em, CassandraService cass, UUID applicationId,
                                      EntityRef headEntity, IndexBucketLocator indexBucketLocator ) {
 
         Assert.notNull( em, "Entity manager cannot be null" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/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 7e4e202..441b3d0 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.EntityManagerImpl" scope="prototype"/>
+    <bean id="entityManager" class="org.apache.usergrid.persistence.cassandra.CpEntityManagerImpl" scope="prototype"/>
 
     <bean id="relationManager" class="org.apache.usergrid.persistence.cassandra.RelationManagerImpl" scope="prototype"/>
 
@@ -166,7 +166,7 @@
       <aop:aspect id="traceParticipant" ref="traceTagAspect">
         <!-- pointcut on the prescense of the TraceParticipant annotation only -->
         <aop:pointcut id="emTraceParticipant"
-            expression="execution(* org.apache.usergrid.persistence.cassandra.EntityManagerImpl.*(..)) and
+            expression="execution(* org.apache.usergrid.persistence.cassandra.*EntityManagerImpl.*(..)) and
             @annotation(org.apache.usergrid.persistence.cassandra.util.TraceParticipant)"/>
         <aop:around
            pointcut-ref="emTraceParticipant"

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/log4j.properties b/stack/core/src/test/resources/log4j.properties
index fab8d7b..0c30ab3 100644
--- a/stack/core/src/test/resources/log4j.properties
+++ b/stack/core/src/test/resources/log4j.properties
@@ -39,6 +39,7 @@ log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
 log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
 #log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
 
+log4j.logger.org.apache.usergrid.persistence.cassandra.CpEntityManagerImpl=INFO, stdout
 
 #log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG, stdout
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/corepersistence/collection/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/pom.xml b/stack/corepersistence/collection/pom.xml
index 7b34b0b..8740160 100644
--- a/stack/corepersistence/collection/pom.xml
+++ b/stack/corepersistence/collection/pom.xml
@@ -6,7 +6,7 @@
     <parent>
         <artifactId>persistence</artifactId>
         <groupId>org.apache.usergrid</groupId>
-        <version>1.0-SNAPSHOT</version>
+        <version>2.0.0-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/corepersistence/graph/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/pom.xml b/stack/corepersistence/graph/pom.xml
index 069962d..5baefc2 100644
--- a/stack/corepersistence/graph/pom.xml
+++ b/stack/corepersistence/graph/pom.xml
@@ -24,7 +24,7 @@
   <parent>
     <artifactId>persistence</artifactId>
     <groupId>org.apache.usergrid</groupId>
-    <version>1.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/corepersistence/model/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/pom.xml b/stack/corepersistence/model/pom.xml
index 8a7af5b..42d64ec 100644
--- a/stack/corepersistence/model/pom.xml
+++ b/stack/corepersistence/model/pom.xml
@@ -5,7 +5,7 @@
     <parent>
         <artifactId>persistence</artifactId>
         <groupId>org.apache.usergrid</groupId>
-        <version>1.0-SNAPSHOT</version>
+        <version>2.0.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/corepersistence/perftest1/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/perftest1/pom.xml b/stack/corepersistence/perftest1/pom.xml
index 64e76f7..fd58f9a 100644
--- a/stack/corepersistence/perftest1/pom.xml
+++ b/stack/corepersistence/perftest1/pom.xml
@@ -6,7 +6,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>perftest1</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/corepersistence/perftest2/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/perftest2/pom.xml b/stack/corepersistence/perftest2/pom.xml
index 34ef45f..979f427 100644
--- a/stack/corepersistence/perftest2/pom.xml
+++ b/stack/corepersistence/perftest2/pom.xml
@@ -6,7 +6,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.usergrid</groupId>
     <artifactId>perftest2</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <properties>
@@ -20,7 +20,7 @@
         <dependency>
             <groupId>org.apache.usergrid</groupId>
             <artifactId>queryindex</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <version>2.0.0-SNAPSHOT</version>
             <type>jar</type>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/corepersistence/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/pom.xml b/stack/corepersistence/pom.xml
index f538d0e..2a9ada4 100644
--- a/stack/corepersistence/pom.xml
+++ b/stack/corepersistence/pom.xml
@@ -10,7 +10,7 @@
     <groupId>org.apache.usergrid</groupId>
     <artifactId>persistence</artifactId>
     <packaging>pom</packaging>
-    <version>1.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
 
     <properties>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 55f5059..9047bdc 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -1815,8 +1815,8 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>1.7</source>
+          <target>1.7</target>
           <optimize>true</optimize>
           <showDeprecation>true</showDeprecation>
           <debug>true</debug>
@@ -1847,7 +1847,7 @@
             <configuration>
               <rules>
                 <requireJavaVersion>
-                  <version>1.6.0</version>
+                  <version>1.7.0</version>
                 </requireJavaVersion>
                 <requireMavenVersion>
                   <version>[3.0,)</version>

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/335044e0/stack/query-validator/pom.xml
----------------------------------------------------------------------
diff --git a/stack/query-validator/pom.xml b/stack/query-validator/pom.xml
index ec04eda..003a99d 100644
--- a/stack/query-validator/pom.xml
+++ b/stack/query-validator/pom.xml
@@ -73,8 +73,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>2.3.2</version>
                 <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
+                    <source>1.7</source>
+                    <target>1.7</target>
                     <optimize>true</optimize>
                     <debug>true</debug>
                     <showDeprecation>true</showDeprecation>