usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [18/50] [abbrv] incubator-usergrid git commit: Refactored and added SNS as an option
Date Thu, 28 May 2015 12:53:23 GMT
Refactored and added SNS as an option


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

Branch: refs/heads/USERGRID-669
Commit: 0791916a8da79825b50bb5ff308012d498947259
Parents: be0e43c
Author: Jeff West <jwest@apigee.com>
Authored: Tue May 26 09:02:24 2015 -0700
Committer: Jeff West <jwest@apigee.com>
Committed: Tue May 26 09:02:24 2015 -0700

----------------------------------------------------------------------
 .../asyncevents/AsyncIndexProvider.java         | 38 +++++++++++---------
 1 file changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0791916a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
index ec968af..6484421 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
@@ -51,11 +51,14 @@ public class AsyncIndexProvider implements Provider<AsyncEventService>
{
 
 
     @Inject
-    public AsyncIndexProvider( final IndexProcessorFig indexProcessorFig, final QueueManagerFactory
queueManagerFactory,
-                               final MetricsFactory metricsFactory, final IndexService indexService,
-                               final RxTaskScheduler rxTaskScheduler,
-                               final EntityCollectionManagerFactory entityCollectionManagerFactory,
-                               final EventBuilder eventBuilder ) {
+    public AsyncIndexProvider(final IndexProcessorFig indexProcessorFig,
+                              final QueueManagerFactory queueManagerFactory,
+                              final MetricsFactory metricsFactory,
+                              final IndexService indexService,
+                              final RxTaskScheduler rxTaskScheduler,
+                              final EntityCollectionManagerFactory entityCollectionManagerFactory,
+                              final EventBuilder eventBuilder) {
+
         this.indexProcessorFig = indexProcessorFig;
         this.queueManagerFactory = queueManagerFactory;
         this.metricsFactory = metricsFactory;
@@ -69,11 +72,10 @@ public class AsyncIndexProvider implements Provider<AsyncEventService>
{
     @Override
     @Singleton
     public AsyncEventService get() {
-        if ( asyncEventService == null ) {
+        if (asyncEventService == null) {
             asyncEventService = getIndexService();
         }
 
-
         return asyncEventService;
     }
 
@@ -81,16 +83,19 @@ public class AsyncIndexProvider implements Provider<AsyncEventService>
{
     private AsyncEventService getIndexService() {
         final String value = indexProcessorFig.getQueueImplementation();
 
-        final Implementations impl = Implementations.valueOf( value );
+        final Implementations impl = Implementations.valueOf(value);
 
-        switch ( impl ) {
+        switch (impl) {
             case LOCAL:
-                return new InMemoryAsyncEventService( eventBuilder, rxTaskScheduler, indexProcessorFig.resolveSynchronously());
+                return new InMemoryAsyncEventService(eventBuilder, rxTaskScheduler, indexProcessorFig.resolveSynchronously());
             case SQS:
-                return new SQSAsyncEventService( queueManagerFactory, indexProcessorFig,
metricsFactory, indexService,
-                    entityCollectionManagerFactory, rxTaskScheduler );
+                return new AmazonAsyncEventService(queueManagerFactory, indexProcessorFig,
metricsFactory, indexService,
+                    entityCollectionManagerFactory, rxTaskScheduler);
+            case SNS:
+                return new AmazonAsyncEventService(queueManagerFactory, indexProcessorFig,
metricsFactory, indexService,
+                    entityCollectionManagerFactory, rxTaskScheduler);
             default:
-                throw new IllegalArgumentException( "Configuration value of " + getErrorValues()
+ " are allowed" );
+                throw new IllegalArgumentException("Configuration value of " + getErrorValues()
+ " are allowed");
         }
     }
 
@@ -98,11 +103,11 @@ public class AsyncIndexProvider implements Provider<AsyncEventService>
{
     private String getErrorValues() {
         String values = "";
 
-        for ( final Implementations impl : Implementations.values() ) {
+        for (final Implementations impl : Implementations.values()) {
             values += impl + ", ";
         }
 
-        values = values.substring( 0, values.length() - 2 );
+        values = values.substring(0, values.length() - 2);
 
         return values;
     }
@@ -114,7 +119,8 @@ public class AsyncIndexProvider implements Provider<AsyncEventService>
{
     public static enum Implementations {
         TEST,
         LOCAL,
-        SQS;
+        SQS,
+        SNS;
 
 
         public String asString() {


Mime
View raw message