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/10/20 15:49:55 UTC

git commit: Move event handlers under corepersistence package

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-events 3551f3c63 -> cff9ee8c5


Move event handlers under corepersistence package


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

Branch: refs/heads/two-dot-o-events
Commit: cff9ee8c537e769ef93b12a11a9342a950e96f18
Parents: 3551f3c
Author: Dave Johnson <dm...@apigee.com>
Authored: Mon Oct 20 09:49:40 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Mon Oct 20 09:49:40 2014 -0400

----------------------------------------------------------------------
 .../usergrid/corepersistence/GuiceModule.java   |  4 +-
 .../events/EntityDeletedImpl.java               | 52 ++++++++++++++
 .../events/EntityVersionDeletedImpl.java        | 70 +++++++++++++++++++
 .../usergrid/event/EntityDeletedImpl.java       | 54 ---------------
 .../event/EntityVersionDeletedImpl.java         | 71 --------------------
 5 files changed, 124 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cff9ee8c/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
index 201d14b..890b08f 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
@@ -19,8 +19,8 @@ package org.apache.usergrid.corepersistence;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.multibindings.Multibinder;
-import org.apache.usergrid.event.EntityDeletedImpl;
-import org.apache.usergrid.event.EntityVersionDeletedImpl;
+import org.apache.usergrid.corepersistence.events.EntityDeletedImpl;
+import org.apache.usergrid.corepersistence.events.EntityVersionDeletedImpl;
 import org.apache.usergrid.persistence.collection.event.EntityDeleted;
 import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
 import org.apache.usergrid.persistence.collection.guice.CollectionModule;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cff9ee8c/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedImpl.java
new file mode 100644
index 0000000..befcc2e
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityDeletedImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.usergrid.corepersistence.events;
+
+import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.collection.event.EntityDeleted;
+import org.apache.usergrid.persistence.index.EntityIndexBatch;
+import org.apache.usergrid.persistence.index.IndexScope;
+import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
+
+import java.util.UUID;
+
+
+/**
+ * purge most current entity
+ */
+public class EntityDeletedImpl implements EntityDeleted {
+
+    private final EntityIndexBatch entityIndex;
+
+    public EntityDeletedImpl(EntityIndexBatch entityIndex){
+        this.entityIndex = entityIndex;
+    }
+
+    @Override
+    public void deleted(CollectionScope scope, Id entityId, UUID version) {
+        IndexScope indexScope = new IndexScopeImpl(
+                new SimpleId(scope.getOwner().getUuid(),scope.getOwner().getType()),
+                scope.getName()
+        );
+        entityIndex.deindex(indexScope,entityId,version);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cff9ee8c/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedImpl.java
new file mode 100644
index 0000000..b1edc62
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.usergrid.corepersistence.events;
+
+import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
+import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
+import org.apache.usergrid.persistence.index.EntityIndexBatch;
+import org.apache.usergrid.persistence.index.IndexScope;
+import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
+import rx.functions.Func1;
+import rx.schedulers.Schedulers;
+
+import java.util.List;
+
+
+/**
+ * Purge old entity versions
+ */
+public class EntityVersionDeletedImpl implements EntityVersionDeleted{
+
+    private final EntityIndexBatch entityIndexBatch;
+    private final SerializationFig serializationFig;
+
+    public EntityVersionDeletedImpl(EntityIndexBatch entityIndexBatch, SerializationFig fig){
+        this.entityIndexBatch = entityIndexBatch;
+        this.serializationFig = fig;
+    }
+
+    @Override
+    public void versionDeleted(
+            final CollectionScope scope, final Id entityId, final List<MvccEntity> entityVersions) {
+        final IndexScope indexScope = new IndexScopeImpl(
+                new SimpleId(scope.getOwner().getUuid(),scope.getOwner().getType()),
+                scope.getName()
+        );
+        rx.Observable.from(entityVersions)
+                .subscribeOn(Schedulers.io())
+                .buffer(serializationFig.getBufferSize())
+                .map(new Func1<List<MvccEntity>,List<MvccEntity>>() {
+                    @Override
+                    public List<MvccEntity> call(List<MvccEntity> entityList) {
+                        for(MvccEntity entity : entityList){
+                             entityIndexBatch.deindex(indexScope,entityId,entity.getVersion());
+                        }
+                        entityIndexBatch.execute();
+                        return entityList;
+                    }
+                }).toBlocking().last();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cff9ee8c/stack/core/src/main/java/org/apache/usergrid/event/EntityDeletedImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/event/EntityDeletedImpl.java b/stack/core/src/main/java/org/apache/usergrid/event/EntityDeletedImpl.java
deleted file mode 100644
index ce39c5d..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/event/EntityDeletedImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.event;
-
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.event.EntityDeleted;
-import org.apache.usergrid.persistence.index.EntityIndex;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.IndexScope;
-import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-
-import java.util.UUID;
-
-/**
- * purge most current entity
- */
-public class EntityDeletedImpl implements EntityDeleted {
-
-    private final EntityIndexBatch entityIndex;
-
-    public EntityDeletedImpl(EntityIndexBatch entityIndex){
-        this.entityIndex = entityIndex;
-    }
-
-    @Override
-    public void deleted(CollectionScope scope, Id entityId, UUID version) {
-        IndexScope indexScope = new IndexScopeImpl(
-                new SimpleId(scope.getOwner().getUuid(),scope.getOwner().getType()),
-                scope.getName()
-        );
-        entityIndex.deindex(indexScope,entityId,version);
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cff9ee8c/stack/core/src/main/java/org/apache/usergrid/event/EntityVersionDeletedImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/event/EntityVersionDeletedImpl.java b/stack/core/src/main/java/org/apache/usergrid/event/EntityVersionDeletedImpl.java
deleted file mode 100644
index a76e1c4..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/event/EntityVersionDeletedImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.event;
-
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.MvccEntity;
-import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
-import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.IndexScope;
-import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-import rx.functions.Func1;
-import rx.schedulers.Schedulers;
-
-import java.util.List;
-
-/**
- * Purge old entity versions
- */
-public class EntityVersionDeletedImpl implements EntityVersionDeleted{
-
-
-    private final EntityIndexBatch entityIndexBatch;
-    private final SerializationFig serializationFig;
-
-    public EntityVersionDeletedImpl(EntityIndexBatch entityIndexBatch, SerializationFig serializationFig){
-        this.entityIndexBatch = entityIndexBatch;
-        this.serializationFig = serializationFig;
-    }
-
-    @Override
-    public void versionDeleted(final CollectionScope scope, final Id entityId, final List<MvccEntity> entityVersions) {
-        final IndexScope indexScope = new IndexScopeImpl(
-                new SimpleId(scope.getOwner().getUuid(),scope.getOwner().getType()),
-                scope.getName()
-        );
-        rx.Observable.from(entityVersions)
-                .subscribeOn(Schedulers.io())
-                .buffer(serializationFig.getBufferSize())
-                .map(new Func1<List<MvccEntity>,List<MvccEntity>>() {
-                    @Override
-                    public List<MvccEntity> call(List<MvccEntity> entityList) {
-                        for(MvccEntity entity : entityList){
-                             entityIndexBatch.deindex(indexScope,entityId,entity.getVersion());
-                        }
-                        entityIndexBatch.execute();
-                        return entityList;
-                    }
-                }).toBlocking().last();
-    }
-}