usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [4/4] git commit: Fixed spelling. Changed factory to take in collectionScope. Fixed and added in wiring for EntityEvents. Added list support in the module.
Date Wed, 22 Oct 2014 21:05:49 GMT
Fixed spelling.
Changed factory to take in collectionScope.
Fixed and added in wiring for EntityEvents.
Added list support in the 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/4474ca91
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4474ca91
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4474ca91

Branch: refs/heads/two-dot-o-events
Commit: 4474ca91dace7c14d780986d02ea8c8ef0a90620
Parents: 31e2061
Author: grey <greyes@apigee.com>
Authored: Wed Oct 22 14:04:34 2014 -0700
Committer: grey <greyes@apigee.com>
Committed: Wed Oct 22 14:04:34 2014 -0700

----------------------------------------------------------------------
 .../collection/EntityDeletedFactory.java        |  2 +-
 .../collection/EntityVersionCleanupFactory.java |  6 ++--
 .../collection/guice/CollectionModule.java      | 36 +++++++++++++++++++-
 .../collection/impl/CollectionScopeImpl.java    |  4 ++-
 .../impl/EntityCollectionManagerImpl.java       |  2 +-
 .../collection/impl/EntityDeletedTask.java      |  2 +-
 .../impl/EntityVersionCleanupTask.java          |  4 ++-
 7 files changed, 46 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityDeletedFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityDeletedFactory.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityDeletedFactory.java
index 13b1f1a..5d6cecb 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityDeletedFactory.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityDeletedFactory.java
@@ -26,7 +26,7 @@ import org.apache.usergrid.persistence.model.entity.Id;
 import java.util.UUID;
 
 /**
- * Creats EntityDeletedTask instances
+ * Creates EntityDeletedTask instances
  */
 public interface EntityDeletedFactory {
     public EntityDeletedTask getTask( final Id entityId, final UUID version );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityVersionCleanupFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityVersionCleanupFactory.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityVersionCleanupFactory.java
index 606f394..c349070 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityVersionCleanupFactory.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityVersionCleanupFactory.java
@@ -18,15 +18,13 @@
 package org.apache.usergrid.persistence.collection;
 
 
-import com.google.inject.assistedinject.Assisted;
-import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
+
 import org.apache.usergrid.persistence.collection.impl.EntityVersionCleanupTask;
 import org.apache.usergrid.persistence.model.entity.Id;
 
-import java.util.List;
 import java.util.UUID;
 
 public interface EntityVersionCleanupFactory {
-    public EntityVersionCleanupTask getTask( final Id entityId, final UUID version );
+    public EntityVersionCleanupTask getTask( final CollectionScope scope, final Id entityId,
final UUID version );
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
index 8015ca9..c2f5d0d 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
@@ -18,11 +18,22 @@
 package org.apache.usergrid.persistence.collection.guice;
 
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
 import org.safehaus.guicyfig.GuicyFigModule;
 
+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.EntityCollectionManagerSync;
+import org.apache.usergrid.persistence.collection.EntityVersionCleanupFactory;
+import org.apache.usergrid.persistence.collection.event.EntityDeleted;
+import org.apache.usergrid.persistence.collection.event.EntityVersionCreated;
+import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
+import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.collection.impl.EntityCollectionManagerImpl;
 import org.apache.usergrid.persistence.collection.impl.EntityCollectionManagerSyncImpl;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
@@ -30,11 +41,14 @@ import org.apache.usergrid.persistence.collection.mvcc.changelog.ChangeLogGenera
 import org.apache.usergrid.persistence.collection.mvcc.changelog.ChangeLogGeneratorImpl;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.impl.MvccEntitySerializationStrategyImpl;
+import org.apache.usergrid.persistence.collection.serialization.impl.MvccLogEntrySerializationStrategyImpl;
 import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueSerializationStrategyImpl;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteStart;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.impl.SerializationModule;
 import org.apache.usergrid.persistence.collection.service.impl.ServiceModule;
+import org.apache.usergrid.persistence.core.migration.Migration;
 import org.apache.usergrid.persistence.core.task.NamedTaskExecutorImpl;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
 
@@ -43,7 +57,9 @@ import com.google.inject.Inject;
 import com.google.inject.Provides;
 import com.google.inject.Singleton;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
-
+import com.google.inject.multibindings.Multibinder;
+import java.util.List;
+import com.sun.tracing.dtrace.ModuleAttributes;
 
 
 /**
@@ -63,18 +79,36 @@ public class CollectionModule extends AbstractModule {
         install( new SerializationModule() );
         install( new ServiceModule() );
 
+        install ( new FactoryModuleBuilder()
+                .build( EntityVersionCleanupFactory.class ));
+
+        //bind empty list.  including modules can add impelmentations
+        Multibinder.newSetBinder( binder(), EntityVersionDeleted.class );
+        Multibinder.newSetBinder( binder(), EntityVersionCreated.class );
+        Multibinder.newSetBinder( binder(), EntityDeleted.class );
+
+
         // create a guice factor for getting our collection manager
         install( new FactoryModuleBuilder()
             .implement( EntityCollectionManager.class, EntityCollectionManagerImpl.class
)
             .implement( EntityCollectionManagerSync.class, EntityCollectionManagerSyncImpl.class
)
             .build( EntityCollectionManagerFactory.class ) );
 
+
+        //bind( EntityVersionDeleted.class).to( org.apache.usergrid.corepersistence.events.EntityVersionDeletedImpl.class
);
         bind( UniqueValueSerializationStrategy.class ).to( UniqueValueSerializationStrategyImpl.class
);
 
         bind( ChangeLogGenerator.class).to( ChangeLogGeneratorImpl.class);
 
     }
 
+
+    @Provides
+    public List<EntityVersionDeleted> emptySetInitialization(){
+        return Collections.EMPTY_LIST;
+
+    }
+
     @Provides
     @Singleton
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/CollectionScopeImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/CollectionScopeImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/CollectionScopeImpl.java
index 9e96230..958cc70 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/CollectionScopeImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/CollectionScopeImpl.java
@@ -24,6 +24,8 @@ import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtil
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.model.entity.Id;
 
+import com.google.inject.Inject;
+
 
 /**
  * Simple impl of hte collection context
@@ -34,7 +36,7 @@ public class CollectionScopeImpl extends ApplicationScopeImpl implements
Collect
     private final Id ownerId;
     private final String name;
 
-
+    @Inject
     public CollectionScopeImpl( final Id applicationId, final Id ownerId, final String name
) {
         super( applicationId );
         this.ownerId = ownerId;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/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 4aaa1d8..baa13b7 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
@@ -171,7 +171,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
             @Override
             public void call(final Entity entity) {
                 //TODO fire a task here
-                taskExecutor.submit(entityVersionCleanupFactory.getTask(entityId,entity.getVersion()));
+                taskExecutor.submit(entityVersionCleanupFactory.getTask(collectionScope,
entityId,entity.getVersion()));
                 //post-processing to come later. leave it empty for now.
             }
         }).doOnError(rollback);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
index f113900..a082039 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
@@ -87,7 +87,7 @@ public class EntityDeletedTask implements Task<Void> {
 
     @Override
     public Void call() throws Exception {
-        entityVersionCleanupFactory.getTask(entityId,version).call();
+        entityVersionCleanupFactory.getTask(collectionScope,entityId,version).call();
         fireEvents();
         final MutationBatch entityDelete = entitySerializationStrategy.delete(collectionScope,
entityId, version);
         final MutationBatch logDelete = logEntrySerializationStrategy.delete(collectionScope,
entityId, version);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4474ca91/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
index e518fb5..0a46773 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.persistence.collection.impl;
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import java.util.UUID;
 
 import com.google.inject.Inject;
@@ -81,7 +82,7 @@ public class EntityVersionCleanupTask implements Task<Void> {
                                       final MvccEntitySerializationStrategy entitySerializationStrategy,
                                       final UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
                                       final Keyspace keyspace,
-                                      final CollectionScope scope,
+                                     @Assisted final CollectionScope scope,
                                       final List<EntityVersionDeleted> listeners,
                                       @Assisted final Id entityId,@Assisted final UUID version
) {
 
@@ -208,6 +209,7 @@ public class EntityVersionCleanupTask implements Task<Void> {
 
         if ( listenerSize == 1 ) {
             listeners.get( 0 ).versionDeleted( scope, entityId, versions );
+            //listeners.iterator().next().versionDeleted( scope,entityId,versions );
             return;
         }
 


Mime
View raw message