usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject [32/38] usergrid git commit: Remove remaining traces of Astyanax from Unique Value serialization.
Date Wed, 17 Aug 2016 21:48:39 GMT
Remove remaining traces of Astyanax from Unique Value serialization.


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

Branch: refs/heads/master
Commit: 6efb5bad0106cdbe8b0e48843ee68fcfd1aa56d3
Parents: eccb4d5
Author: Michael Russo <mrusso@apigee.com>
Authored: Sun May 8 22:39:54 2016 +0800
Committer: Michael Russo <mrusso@apigee.com>
Committed: Sun May 8 22:39:54 2016 +0800

----------------------------------------------------------------------
 .../impl/EntityCollectionManagerImpl.java       | 95 +++++++++-----------
 .../mvcc/stage/write/WriteUniqueVerify.java     | 15 ++--
 .../UniqueValueSerializationStrategy.java       | 16 ++--
 .../UniqueValueSerializationStrategyImpl.java   | 71 +++------------
 ...iqueValueSerializationStrategyProxyImpl.java | 14 +--
 .../UniqueValueSerializationStrategyV1Impl.java | 85 ++----------------
 .../UniqueValueSerializationStrategyV2Impl.java | 67 +-------------
 7 files changed, 80 insertions(+), 283 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index 6d42fa2..291e5df 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -296,15 +296,11 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
     public Observable<Id> getIdField( final String type, final Field field ) {
         final List<Field> fields = Collections.singletonList( field );
         final Observable<Id> idObservable = Observable.from( fields ).map( field1 ->
{
-            try {
-                final UniqueValueSet set = uniqueValueSerializationStrategy.load( applicationScope,
type, fields );
-                final UniqueValue value = set.getValue( field1.getName() );
-                return value == null ? null : value.getEntityId();
-            }
-            catch ( ConnectionException e ) {
-                logger.error( "Failed to getIdField", e );
-                throw new RuntimeException( e );
-            }
+
+            final UniqueValueSet set = uniqueValueSerializationStrategy.load( applicationScope,
type, fields );
+            final UniqueValue value = set.getValue( field1.getName() );
+            return value == null ? null : value.getEntityId();
+
         } );
 
         return ObservableTimer.time( idObservable, fieldIdTimer );
@@ -317,68 +313,63 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
     @Override
     public Observable<FieldSet> getEntitiesFromFields( final String type, final Collection<Field>
fields ) {
         final Observable<FieldSet> fieldSetObservable = Observable.just( fields ).map(
fields1 -> {
-            try {
 
-                final UUID startTime = UUIDGenerator.newTimeUUID();
+            final UUID startTime = UUIDGenerator.newTimeUUID();
 
-                //Get back set of unique values that correspond to collection of fields
-                UniqueValueSet set = uniqueValueSerializationStrategy.load( applicationScope,
type, fields1 );
-
-                //Short circuit if we don't have any uniqueValues from the given fields.
-                if ( !set.iterator().hasNext() ) {
-                    return new MutableFieldSet( 0 );
-                }
+            //Get back set of unique values that correspond to collection of fields
+            UniqueValueSet set = uniqueValueSerializationStrategy.load( applicationScope,
type, fields1 );
 
+            //Short circuit if we don't have any uniqueValues from the given fields.
+            if ( !set.iterator().hasNext() ) {
+                return new MutableFieldSet( 0 );
+            }
 
-                //loop through each field, and construct an entity load
-                List<Id> entityIds = new ArrayList<>( fields1.size() );
-                List<UniqueValue> uniqueValues = new ArrayList<>( fields1.size()
);
 
-                for ( final Field expectedField : fields1 ) {
+            //loop through each field, and construct an entity load
+            List<Id> entityIds = new ArrayList<>( fields1.size() );
+            List<UniqueValue> uniqueValues = new ArrayList<>( fields1.size()
);
 
-                    UniqueValue value = set.getValue( expectedField.getName() );
+            for ( final Field expectedField : fields1 ) {
 
-                    if ( value == null ) {
-                        logger.debug( "Field does not correspond to a unique value" );
-                    }
+                UniqueValue value = set.getValue( expectedField.getName() );
 
-                    entityIds.add( value.getEntityId() );
-                    uniqueValues.add( value );
+                if ( value == null ) {
+                    logger.debug( "Field does not correspond to a unique value" );
                 }
 
-                //Load a entity for each entityId we retrieved.
-                final EntitySet entitySet = entitySerializationStrategy.load( applicationScope,
entityIds, startTime );
-
-                final BatchStatement uniqueDeleteBatch = new BatchStatement();
-
-                final MutableFieldSet response = new MutableFieldSet( fields1.size() );
+                entityIds.add( value.getEntityId() );
+                uniqueValues.add( value );
+            }
 
-                for ( final UniqueValue expectedUnique : uniqueValues ) {
-                    final MvccEntity entity = entitySet.getEntity( expectedUnique.getEntityId()
);
+            //Load a entity for each entityId we retrieved.
+            final EntitySet entitySet = entitySerializationStrategy.load( applicationScope,
entityIds, startTime );
 
-                    //bad unique value, delete this, it's inconsistent
-                    if ( entity == null || !entity.getEntity().isPresent() ) {
-                        uniqueDeleteBatch.add(
-                            uniqueValueSerializationStrategy.deleteCQL( applicationScope,
expectedUnique ));
-                        continue;
-                    }
+            final BatchStatement uniqueDeleteBatch = new BatchStatement();
 
-                    //TODO, we need to validate the property in the entity matches the property
in the unique value
+            final MutableFieldSet response = new MutableFieldSet( fields1.size() );
 
+            for ( final UniqueValue expectedUnique : uniqueValues ) {
+                final MvccEntity entity = entitySet.getEntity( expectedUnique.getEntityId()
);
 
-                    //else add it to our result set
-                    response.addEntity( expectedUnique.getField(), entity );
+                //bad unique value, delete this, it's inconsistent
+                if ( entity == null || !entity.getEntity().isPresent() ) {
+                    uniqueDeleteBatch.add(
+                        uniqueValueSerializationStrategy.deleteCQL( applicationScope, expectedUnique
));
+                    continue;
                 }
 
-                //TODO: explore making this an Async process
-                session.execute(uniqueDeleteBatch);
+                //TODO, we need to validate the property in the entity matches the property
in the unique value
 
-                return response;
-            }
-            catch ( ConnectionException e ) {
-                logger.error( "Failed to getIdField", e );
-                throw new RuntimeException( e );
+
+                //else add it to our result set
+                response.addEntity( expectedUnique.getField(), entity );
             }
+
+            //TODO: explore making this an Async process
+            session.execute(uniqueDeleteBatch);
+
+            return response;
+
         } );
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
index 501950a..5e99a05 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.datastax.driver.core.BatchStatement;
+import com.datastax.driver.core.ConsistencyLevel;
 import com.datastax.driver.core.Session;
 import com.netflix.hystrix.HystrixCommandProperties;
 import org.slf4j.Logger;
@@ -49,9 +50,7 @@ import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import com.netflix.astyanax.model.ConsistencyLevel;
 import com.netflix.hystrix.HystrixCommand;
 import com.netflix.hystrix.HystrixCommandGroupKey;
 import com.netflix.hystrix.HystrixThreadPoolProperties;
@@ -180,25 +179,21 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
 
         @Override
         protected Map<String, Field> run() throws Exception {
-            return executeStrategy(fig.getReadCL());
+            return executeStrategy(fig.getDataStaxReadCl());
         }
 
         @Override
         protected Map<String, Field> getFallback() {
             // fallback with same CL as there are many reasons the 1st execution failed,
not just due to consistency problems
-            return executeStrategy(fig.getReadCL());
+            return executeStrategy(fig.getDataStaxReadCl());
         }
 
         public Map<String, Field> executeStrategy(ConsistencyLevel consistencyLevel){
             //allocate our max size, worst case
             //now get the set of fields back
             final UniqueValueSet uniqueValues;
-            try {
-                uniqueValues = uniqueValueSerializationStrategy.load( scope, consistencyLevel,
type,  uniqueFields );
-            }
-            catch ( ConnectionException e ) {
-                throw new RuntimeException( "Unable to read from cassandra", e );
-            }
+
+            uniqueValues = uniqueValueSerializationStrategy.load( scope, consistencyLevel,
type,  uniqueFields );
 
             final Map<String, Field> uniquenessViolations = new HashMap<>( uniqueFields.size()
);
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/UniqueValueSerializationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/UniqueValueSerializationStrategy.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/UniqueValueSerializationStrategy.java
index bb6f5fe..eb43985 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/UniqueValueSerializationStrategy.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/UniqueValueSerializationStrategy.java
@@ -22,17 +22,13 @@ import java.util.Collection;
 import java.util.Iterator;
 
 import com.datastax.driver.core.BatchStatement;
-import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueSerializationStrategyImpl;
+import com.datastax.driver.core.ConsistencyLevel;
 import org.apache.usergrid.persistence.core.migration.data.VersionedData;
 import org.apache.usergrid.persistence.core.migration.schema.Migration;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.field.Field;
 
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import com.netflix.astyanax.model.ConsistencyLevel;
-
 
 /**
  * Reads and writes to UniqueValues column family.
@@ -60,9 +56,8 @@ public interface UniqueValueSerializationStrategy extends Migration, VersionedDa
      *
      * @return UniqueValueSet containing fields from the collection that exist in cassandra
      *
-     * @throws ConnectionException on error connecting to Cassandra
      */
-    UniqueValueSet load( ApplicationScope applicationScope, String type, Collection<Field>
fields ) throws ConnectionException;
+    UniqueValueSet load( ApplicationScope applicationScope, String type, Collection<Field>
fields );
 
     /**
     * Load UniqueValue that matches field from collection or null if that value does not
exist.
@@ -72,10 +67,9 @@ public interface UniqueValueSerializationStrategy extends Migration, VersionedDa
     * @param type The type the unique value exists within
     * @param fields Field name/value to search for
     * @return UniqueValueSet containing fields from the collection that exist in cassandra
-    * @throws ConnectionException on error connecting to Cassandra
     */
-    UniqueValueSet load( ApplicationScope applicationScope, ConsistencyLevel consistencyLevel,
String type,
-                         Collection<Field> fields ) throws ConnectionException;
+    UniqueValueSet load(ApplicationScope applicationScope, ConsistencyLevel consistencyLevel,
String type,
+                        Collection<Field> fields );
 
 
     /**
@@ -96,7 +90,7 @@ public interface UniqueValueSerializationStrategy extends Migration, VersionedDa
      * @param uniqueValue Object to be deleted.
      * @return BatchStatement that encapsulates the CQL statements, caller may or may not
execute.
      */
-    BatchStatement deleteCQL( ApplicationScope applicationScope, UniqueValue uniqueValue);
+    BatchStatement deleteCQL( ApplicationScope applicationScope, UniqueValue uniqueValue
);
 
 
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
index fe4e06f..5320152 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
@@ -33,26 +33,18 @@ import org.apache.usergrid.persistence.model.field.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.db.marshal.BytesType;
 
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
 import org.apache.usergrid.persistence.core.CassandraFig;
-import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
 import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.ValidationUtils;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.common.base.Preconditions;
-import com.netflix.astyanax.ColumnListMutation;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
 
 /**
@@ -66,28 +58,17 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey,
EntityKey>
     public static final String UUID_TYPE_REVERSED = "UUIDType(reversed=true)";
 
 
-
-    private final MultiTenantColumnFamily<ScopedRowKey<FieldKey>, EntityVersion>
-        CF_UNIQUE_VALUES;
-
-
-    private final MultiTenantColumnFamily<ScopedRowKey<EntityKey>, UniqueFieldEntry>
-        CF_ENTITY_UNIQUE_VALUE_LOG ;
-
     private final String TABLE_UNIQUE_VALUES;
     private final String TABLE_UNIQUE_VALUES_LOG;
 
-
     private final Map COLUMNS_UNIQUE_VALUES;
     private final Map COLUMNS_UNIQUE_VALUES_LOG;
 
 
-
     public static final int COL_VALUE = 0x0;
 
 
     private final SerializationFig serializationFig;
-    protected final Keyspace keyspace;
     private final CassandraFig cassandraFig;
 
     private final Session session;
@@ -97,23 +78,19 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey,
EntityKey>
     /**
      * Construct serialization strategy for keyspace.
      *
-     * @param keyspace Keyspace in which to store Unique Values.
      * @param cassandraFig The cassandra configuration
      * @param serializationFig The serialization configuration
      */
-    public UniqueValueSerializationStrategyImpl( final Keyspace keyspace, final CassandraFig
cassandraFig,
+    public UniqueValueSerializationStrategyImpl( final CassandraFig cassandraFig,
                                                  final SerializationFig serializationFig,
-                                                 final Session session, final CassandraConfig
cassandraConfig) {
-        this.keyspace = keyspace;
+                                                 final Session session,
+                                                 final CassandraConfig cassandraConfig) {
         this.cassandraFig = cassandraFig;
         this.serializationFig = serializationFig;
 
         this.session = session;
         this.cassandraConfig = cassandraConfig;
 
-        CF_UNIQUE_VALUES = getUniqueValuesCF();
-        CF_ENTITY_UNIQUE_VALUE_LOG = getEntityUniqueLogCF();
-
         TABLE_UNIQUE_VALUES = getUniqueValuesTable().getTableName();
         TABLE_UNIQUE_VALUES_LOG = getEntityUniqueLogTable().getTableName();
 
@@ -242,27 +219,27 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey,
EntityKey>
 
     @Override
     public UniqueValueSet load( final ApplicationScope colScope, final String type, final
Collection<Field> fields )
-        throws ConnectionException {
-        return load( colScope, com.netflix.astyanax.model.ConsistencyLevel.valueOf( cassandraFig.getAstyanaxReadCL()
), type, fields );
+         {
+        return load( colScope, ConsistencyLevel.valueOf( cassandraFig.getReadCl() ), type,
fields );
     }
 
 
     @Override
-    public UniqueValueSet load( final ApplicationScope appScope, final com.netflix.astyanax.model.ConsistencyLevel
consistencyLevel,
-                                final String type, final Collection<Field> fields )
throws ConnectionException {
+    public UniqueValueSet load( final ApplicationScope appScope,
+                                final ConsistencyLevel consistencyLevel,
+                                final String type, final Collection<Field> fields )
{
 
         Preconditions.checkNotNull( fields, "fields are required" );
         Preconditions.checkArgument( fields.size() > 0, "More than 1 field must be specified"
);
 
-        return loadCQL(appScope, com.datastax.driver.core.ConsistencyLevel.LOCAL_QUORUM,
type, fields);
-
-        //return loadLegacy( appScope, type, fields);
+        return loadCQL(appScope, consistencyLevel, type, fields);
 
     }
 
 
-    private UniqueValueSet loadCQL( final ApplicationScope appScope, final com.datastax.driver.core.ConsistencyLevel
consistencyLevel,
-                                final String type, final Collection<Field> fields )
throws ConnectionException {
+    private UniqueValueSet loadCQL( final ApplicationScope appScope,
+                                    final ConsistencyLevel consistencyLevel,
+                                    final String type, final Collection<Field> fields
) {
 
         Preconditions.checkNotNull( fields, "fields are required" );
         Preconditions.checkArgument( fields.size() > 0, "More than 1 field must be specified"
);
@@ -287,7 +264,7 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey,
EntityKey>
 
         final Statement statement = QueryBuilder.select().all().from(TABLE_UNIQUE_VALUES)
             .where(inKey)
-            .setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel.LOCAL_QUORUM);
+            .setConsistencyLevel(consistencyLevel);
 
         final ResultSet resultSet = session.execute(statement);
 
@@ -366,13 +343,6 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey,
EntityKey>
     @Override
     public abstract Collection<TableDefinition> getTables();
 
-
-    /**
-     * Get the column family for the unique fields
-     */
-    protected abstract MultiTenantColumnFamily<ScopedRowKey<FieldKey>, EntityVersion>
getUniqueValuesCF();
-
-
     /**
      * Get the CQL table definition for the unique values log table
      */
@@ -395,26 +365,11 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey,
EntityKey>
 
 
 
-
-
-        /**
-         * Get the column family for the unique field CF
-         */
-    protected abstract MultiTenantColumnFamily<ScopedRowKey<EntityKey>, UniqueFieldEntry>
getEntityUniqueLogCF();
-
     /**
      * Get the CQL table definition for the unique values log table
      */
     protected abstract TableDefinition getEntityUniqueLogTable();
 
-    /**
-     * Generate a key that is compatible with the column family
-     *
-     * @param applicationId The applicationId
-     * @param uniqueValueId The uniqueValue
-     */
-    protected abstract EntityKey createEntityUniqueLogKey(final Id applicationId,  final
Id uniqueValueId );
-
 
     public class AllUniqueFieldsIterator implements Iterable<UniqueValue>, Iterator<UniqueValue>
{
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
index dc5b48f..4b5653f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
@@ -25,6 +25,7 @@ import java.util.Collections;
 import java.util.Iterator;
 
 import com.datastax.driver.core.BatchStatement;
+import com.datastax.driver.core.ConsistencyLevel;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
@@ -40,28 +41,21 @@ import org.apache.usergrid.persistence.model.field.Field;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.MutationBatch;
-import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
-import com.netflix.astyanax.model.ConsistencyLevel;
 
 
 @Singleton
 public class UniqueValueSerializationStrategyProxyImpl implements UniqueValueSerializationStrategy
{
 
 
-    protected final Keyspace keyspace;
     private final VersionedMigrationSet<UniqueValueSerializationStrategy> versions;
     private final MigrationInfoCache migrationInfoCache;
 
 
     @Inject
-    public UniqueValueSerializationStrategyProxyImpl( final Keyspace keyspace,
-                                                      final VersionedMigrationSet<UniqueValueSerializationStrategy>
+    public UniqueValueSerializationStrategyProxyImpl( final VersionedMigrationSet<UniqueValueSerializationStrategy>
                                                           allVersions,
                                                       final MigrationInfoCache migrationInfoCache
) {
 
-        this.keyspace = keyspace;
         this.migrationInfoCache = migrationInfoCache;
         this.versions = allVersions;
     }
@@ -86,7 +80,7 @@ public class UniqueValueSerializationStrategyProxyImpl implements UniqueValueSer
 
     @Override
     public UniqueValueSet load( final ApplicationScope applicationScope, final String type,
-                                final Collection<Field> fields ) throws ConnectionException
{
+                                final Collection<Field> fields ) {
 
         final MigrationRelationship<UniqueValueSerializationStrategy> migration = getMigrationRelationShip();
 
@@ -100,7 +94,7 @@ public class UniqueValueSerializationStrategyProxyImpl implements UniqueValueSer
 
     @Override
     public UniqueValueSet load( final ApplicationScope applicationScope, final ConsistencyLevel
consistencyLevel,
-                                final String type, final Collection<Field> fields )
throws ConnectionException {
+                                final String type, final Collection<Field> fields )
{
 
         final MigrationRelationship<UniqueValueSerializationStrategy> migration = getMigrationRelationShip();
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
index 73df64a..6421869 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
@@ -26,17 +26,12 @@ import java.util.*;
 import com.datastax.driver.core.DataType;
 import com.datastax.driver.core.ProtocolVersion;
 import com.datastax.driver.core.Session;
-import org.apache.cassandra.db.marshal.BytesType;
 
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.impl.util.LegacyScopeUtils;
 import org.apache.usergrid.persistence.core.CassandraConfig;
 import org.apache.usergrid.persistence.core.CassandraFig;
-import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
 import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
 import org.apache.usergrid.persistence.core.datastax.CQLUtils;
 import org.apache.usergrid.persistence.core.datastax.TableDefinition;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -44,7 +39,6 @@ import org.apache.usergrid.persistence.model.field.Field;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import com.netflix.astyanax.Keyspace;
 
 
 /**
@@ -88,80 +82,40 @@ public class UniqueValueSerializationStrategyV1Impl  extends UniqueValueSerializ
             UNIQUE_VALUES_LOG_COLUMNS, TableDefinition.CacheOption.KEYS, UNIQUE_VALUES_LOG_CLUSTERING_ORDER);
 
 
-    private static final CollectionScopedRowKeySerializer<Field> ROW_KEY_SER =
-        new CollectionScopedRowKeySerializer<>( UniqueFieldRowKeySerializer.get() );
-
-    private static final EntityVersionSerializer ENTITY_VERSION_SER = new EntityVersionSerializer();
-
-    private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>,
EntityVersion>
-        CF_UNIQUE_VALUES = new MultiTenantColumnFamily<>( "Unique_Values", ROW_KEY_SER,
ENTITY_VERSION_SER );
-
-
-    private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
-
-
-    private static final CollectionScopedRowKeySerializer<Id> ENTITY_ROW_KEY_SER =
-        new CollectionScopedRowKeySerializer<>( ID_SER );
-
-
-    private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>,
UniqueFieldEntry>
-        CF_ENTITY_UNIQUE_VALUE_LOG =
-        new MultiTenantColumnFamily<>( "Entity_Unique_Values", ENTITY_ROW_KEY_SER,
UniqueFieldEntrySerializer.get() );
-
 
     /**
      * Construct serialization strategy for keyspace.
      *
-     * @param keyspace Keyspace in which to store Unique Values.
      * @param cassandraFig The cassandra configuration
      * @param serializationFig The serialization configuration
      */
     @Inject
-    public UniqueValueSerializationStrategyV1Impl(final Keyspace keyspace, final CassandraFig
cassandraFig,
-                                                  final SerializationFig serializationFig,
-                                                  final Session session,
-                                                  final CassandraConfig cassandraConfig)
{
-        super( keyspace, cassandraFig, serializationFig, session, cassandraConfig );
+    public UniqueValueSerializationStrategyV1Impl( final CassandraFig cassandraFig,
+                                                   final SerializationFig serializationFig,
+                                                   final Session session,
+                                                   final CassandraConfig cassandraConfig)
{
+        super( cassandraFig, serializationFig, session, cassandraConfig );
     }
 
 
     @Override
     public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
 
-        final MultiTenantColumnFamilyDefinition uniqueLookupCF =
-            new MultiTenantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
-                ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
-                MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
-
-        final MultiTenantColumnFamilyDefinition uniqueLogCF =
-            new MultiTenantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
-                ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
-                MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
-
-        //return Collections.emptyList();
+        return Collections.emptyList();
 
-        return Arrays.asList(uniqueLookupCF, uniqueLogCF);
     }
 
     @Override
     public Collection<TableDefinition> getTables() {
 
         final TableDefinition uniqueValues = getUniqueValuesTable();
-
         final TableDefinition uniqueValuesLog = getEntityUniqueLogTable();
 
-
-        //return Arrays.asList( uniqueValues, uniqueValuesLog );
-
-        return Collections.emptyList();
+        return Arrays.asList( uniqueValues, uniqueValuesLog );
 
     }
 
 
-    @Override
-    protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>,
EntityVersion> getUniqueValuesCF() {
-        return CF_UNIQUE_VALUES;
-    }
 
     @Override
     protected TableDefinition getUniqueValuesTable(){
@@ -171,13 +125,6 @@ public class UniqueValueSerializationStrategyV1Impl  extends UniqueValueSerializ
 
 
     @Override
-    protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>,
UniqueFieldEntry>
-    getEntityUniqueLogCF() {
-        return CF_ENTITY_UNIQUE_VALUE_LOG;
-    }
-
-
-    @Override
     protected TableDefinition getEntityUniqueLogTable(){
 
         return uniqueValuesLog;
@@ -463,24 +410,6 @@ public class UniqueValueSerializationStrategyV1Impl  extends UniqueValueSerializ
     }
 
 
-
-    @Override
-    protected CollectionPrefixedKey<Id> createEntityUniqueLogKey( final Id applicationId,
-                                                                  final Id uniqueValueId
) {
-
-
-        final String collectionName = LegacyScopeUtils.getCollectionScopeNameFromEntityType(
uniqueValueId.getType() );
-
-
-        final CollectionPrefixedKey<Id> collectionPrefixedEntityKey =
-            new CollectionPrefixedKey<>( collectionName, applicationId, uniqueValueId
);
-
-
-
-        return collectionPrefixedEntityKey;
-    }
-
-
     @Override
     public int getImplementationVersion() {
         return CollectionDataVersions.INITIAL.getVersion();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/6efb5bad/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
index 8e13f86..6ea5c1e 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
@@ -26,24 +26,17 @@ import java.util.*;
 import com.datastax.driver.core.DataType;
 import com.datastax.driver.core.ProtocolVersion;
 import com.datastax.driver.core.Session;
-import org.apache.cassandra.db.marshal.BytesType;
 
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.core.CassandraConfig;
 import org.apache.usergrid.persistence.core.CassandraFig;
-import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
 import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
 import org.apache.usergrid.persistence.core.datastax.CQLUtils;
 import org.apache.usergrid.persistence.core.datastax.TableDefinition;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import com.netflix.astyanax.Keyspace;
 
 
 /**
@@ -84,78 +77,37 @@ public class UniqueValueSerializationStrategyV2Impl  extends UniqueValueSerializ
             UNIQUE_VALUES_LOG_COLUMNS, TableDefinition.CacheOption.KEYS, UNIQUE_VALUES_LOG_CLUSTERING_ORDER);
 
 
-    private static final ScopedRowKeySerializer<TypeField>  ROW_KEY_SER = new ScopedRowKeySerializer<>(
UniqueTypeFieldRowKeySerializer.get() );
-
-
-    private static final EntityVersionSerializer ENTITY_VERSION_SER = new EntityVersionSerializer();
-
-    private static final MultiTenantColumnFamily<ScopedRowKey<TypeField>, EntityVersion>
-        CF_UNIQUE_VALUES = new MultiTenantColumnFamily<>( "Unique_Values_V2", ROW_KEY_SER,
ENTITY_VERSION_SER );
-
-
-    private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
-
-
-    private static final ScopedRowKeySerializer<Id> ENTITY_ROW_KEY_SER =
-        new ScopedRowKeySerializer<>( ID_SER );
-
-
-    private static final MultiTenantColumnFamily<ScopedRowKey<Id>, UniqueFieldEntry>
-        CF_ENTITY_UNIQUE_VALUE_LOG =
-        new MultiTenantColumnFamily<>( "Entity_Unique_Values_V2", ENTITY_ROW_KEY_SER,
UniqueFieldEntrySerializer.get() );
-
-
     /**
      * Construct serialization strategy for keyspace.
      *
-     * @param keyspace Keyspace in which to store Unique Values.
      * @param cassandraFig The cassandra configuration
      * @param serializationFig The serialization configuration
+     *
      */
     @Inject
-    public UniqueValueSerializationStrategyV2Impl( final Keyspace keyspace, final CassandraFig
cassandraFig,
+    public UniqueValueSerializationStrategyV2Impl( final CassandraFig cassandraFig,
                                                    final SerializationFig serializationFig,
                                                    final Session session,
                                                    final CassandraConfig cassandraConfig)
{
-        super( keyspace, cassandraFig, serializationFig, session, cassandraConfig );
+        super( cassandraFig, serializationFig, session, cassandraConfig );
     }
 
 
     @Override
     public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
 
-        final MultiTenantColumnFamilyDefinition uniqueLookupCF =
-            new MultiTenantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
-                ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
-                MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
-
-        final MultiTenantColumnFamilyDefinition uniqueLogCF =
-            new MultiTenantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
-                ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
-                MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
-
         return Collections.emptyList();
 
-        //return Arrays.asList(uniqueLookupCF, uniqueLogCF);
     }
 
     @Override
     public Collection<TableDefinition> getTables() {
 
         final TableDefinition uniqueValues = getUniqueValuesTable();
-
         final TableDefinition uniqueValuesLog = getEntityUniqueLogTable();
 
-
         return Arrays.asList( uniqueValues, uniqueValuesLog );
 
-        //return Collections.emptyList();
-
-    }
-
-    @Override
-    protected MultiTenantColumnFamily<ScopedRowKey<TypeField>, EntityVersion>
getUniqueValuesCF() {
-        return CF_UNIQUE_VALUES;
     }
 
 
@@ -166,13 +118,6 @@ public class UniqueValueSerializationStrategyV2Impl  extends UniqueValueSerializ
 
 
     @Override
-    protected MultiTenantColumnFamily<ScopedRowKey<Id>, UniqueFieldEntry>
-    getEntityUniqueLogCF() {
-        return CF_ENTITY_UNIQUE_VALUE_LOG;
-    }
-
-
-    @Override
     protected TableDefinition getEntityUniqueLogTable(){
         return uniqueValuesLog;
     }
@@ -454,12 +399,6 @@ public class UniqueValueSerializationStrategyV2Impl  extends UniqueValueSerializ
 
 
     @Override
-    protected Id createEntityUniqueLogKey( final Id applicationId, final Id uniqueValueId
) {
-       return uniqueValueId;
-    }
-
-
-    @Override
     public int getImplementationVersion() {
         return CollectionDataVersions.LOG_REMOVAL.getVersion();
     }


Mime
View raw message