camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [16/28] camel git commit: Revert "Moved the child event listener to a separate class and also fixed the comment styles."
Date Fri, 25 Nov 2016 12:17:39 GMT
Revert "Moved the child event listener to a separate class and also fixed the comment styles."

This reverts commit 875740078b343a1aea66080657442ad9e3ae9e79.


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

Branch: refs/heads/master
Commit: 6b42082eef9b86303d306ee33b72f0ad84ee36c6
Parents: 13e3e12
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Fri Nov 25 12:50:05 2016 +0100
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Fri Nov 25 12:50:05 2016 +0100

----------------------------------------------------------------------
 .../component/firebase/FirebaseComponent.java   |  2 +-
 .../component/firebase/FirebaseConsumer.java    | 64 ++++++++++----------
 2 files changed, 32 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6b42082e/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
index f06e06d..0f62e16 100644
--- a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
+++ b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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.

http://git-wip-us.apache.org/repos/asf/camel/blob/6b42082e/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
index c8859eb..e85b307 100644
--- a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
+++ b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
@@ -47,7 +47,36 @@ public class FirebaseConsumer extends DefaultConsumer {
         FirebaseDatabase
                 .getInstance(endpoint.getFirebaseApp())
                 .getReference(firebaseConfig.getRootReference())
-                .addChildEventListener(new FirebaseConsumerEventListener());
+                .addChildEventListener(new ChildEventListener() {
+                    @Override
+                    public void onChildAdded(DataSnapshot dataSnapshot, String s) {
+                        forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_ADD, dataSnapshot)
+                                .setPreviousChildName(s).build());
+                    }
+
+                    @Override
+                    public void onChildChanged(DataSnapshot dataSnapshot, String s) {
+                        forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_CHANGED,
dataSnapshot)
+                                .setPreviousChildName(s).build());
+                    }
+
+                    @Override
+                    public void onChildRemoved(DataSnapshot dataSnapshot) {
+                        forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_REMOVED,
dataSnapshot).build());
+                    }
+
+                    @Override
+                    public void onChildMoved(DataSnapshot dataSnapshot, String s) {
+                        forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_MOVED,
dataSnapshot)
+                                .setPreviousChildName(s).build());
+                    }
+
+                    @Override
+                    public void onCancelled(DatabaseError databaseError) {
+                        forwardMessage(new FirebaseMessage.Builder(Operation.CANCELLED).setDatabaseError(databaseError)
+                                .build());
+                    }
+                });
     }
 
     private void forwardMessage(FirebaseMessage o) {
@@ -58,7 +87,7 @@ public class FirebaseConsumer extends DefaultConsumer {
             // send message to next processor in the route
             getProcessor().process(exchange);
         } catch (Exception e) {
-            exchange.setException(new RuntimeCamelException("Message forwarding failed",
e));
+            throw new RuntimeCamelException("Message forwarding failed", e);
         } finally {
             // log exception if an exception occurred and was not handled
             if (exchange.getException() != null) {
@@ -66,35 +95,4 @@ public class FirebaseConsumer extends DefaultConsumer {
             }
         }
     }
-
-    private class FirebaseConsumerEventListener implements ChildEventListener {
-        @Override
-        public void onChildAdded(DataSnapshot dataSnapshot, String s) {
-            forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_ADD, dataSnapshot)
-                    .setPreviousChildName(s).build());
-        }
-
-        @Override
-        public void onChildChanged(DataSnapshot dataSnapshot, String s) {
-            forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_CHANGED, dataSnapshot)
-                    .setPreviousChildName(s).build());
-        }
-
-        @Override
-        public void onChildRemoved(DataSnapshot dataSnapshot) {
-            forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_REMOVED, dataSnapshot).build());
-        }
-
-        @Override
-        public void onChildMoved(DataSnapshot dataSnapshot, String s) {
-            forwardMessage(new FirebaseMessage.Builder(Operation.CHILD_MOVED, dataSnapshot)
-                    .setPreviousChildName(s).build());
-        }
-
-        @Override
-        public void onCancelled(DatabaseError databaseError) {
-            forwardMessage(new FirebaseMessage.Builder(Operation.CANCELLED).setDatabaseError(databaseError)
-                    .build());
-        }
-    }
 }


Mime
View raw message