camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject camel git commit: [CAMEL-11551] Use base class for route events
Date Tue, 18 Jul 2017 10:40:50 GMT
Repository: camel
Updated Branches:
  refs/heads/master c15fa1e20 -> 4759bba2b


[CAMEL-11551] Use base class for route events


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

Branch: refs/heads/master
Commit: 4759bba2bf99897d7998986c3db41f43eb0cf149
Parents: c15fa1e
Author: Christian Schneider <chris@die-schneider.net>
Authored: Tue Jul 18 11:37:34 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Tue Jul 18 11:37:34 2017 +0200

----------------------------------------------------------------------
 .../management/event/AbstractRouteEvent.java    | 41 ++++++++++++++++++++
 .../camel/management/event/RouteAddedEvent.java | 12 +-----
 .../management/event/RouteRemovedEvent.java     | 12 +-----
 .../management/event/RouteStartedEvent.java     | 13 +------
 .../management/event/RouteStoppedEvent.java     | 13 +------
 5 files changed, 49 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
new file mode 100644
index 0000000..8de3be8
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/management/event/AbstractRouteEvent.java
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ * 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.
+ */
+package org.apache.camel.management.event;
+
+import java.util.EventObject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+
+/**
+ * Base class for {@link CamelContext} events.
+ *
+ * @version 
+ */
+public abstract class AbstractRouteEvent extends EventObject {
+    private static final long serialVersionUID = 1L;
+    private Route route;
+
+    public AbstractRouteEvent(Route source) {
+        super(source);
+        this.route = source;
+    }
+
+    public Route getRoute() {
+        return route;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
index 8e19394..52f67e9 100644
--- a/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/event/RouteAddedEvent.java
@@ -16,29 +16,21 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteAddedEvent extends EventObject {
+public class RouteAddedEvent extends AbstractRouteEvent {
 
     private static final long serialVersionUID = 9155960708789798708L;
-    private final Route route;
 
     public RouteAddedEvent(Route source) {
         super(source);
-        this.route = source;
-    }
-
-    public Route getRoute() {
-        return route;
     }
 
     @Override
     public String toString() {
-        return "Added route: " + route.getId();
+        return "Added route: " + getRoute().getId();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
index d08a6b3..f4f5c66 100644
--- a/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/event/RouteRemovedEvent.java
@@ -16,29 +16,21 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteRemovedEvent extends EventObject {
+public class RouteRemovedEvent extends AbstractRouteEvent {
 
     private static final long serialVersionUID = 7966471393751298719L;
-    private final Route route;
 
     public RouteRemovedEvent(Route source) {
         super(source);
-        this.route = source;
-    }
-
-    public Route getRoute() {
-        return route;
     }
 
     @Override
     public String toString() {
-        return "Removed route: " + route.getId();
+        return "Removed route: " + getRoute().getId();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/RouteStartedEvent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/event/RouteStartedEvent.java
b/camel-core/src/main/java/org/apache/camel/management/event/RouteStartedEvent.java
index 6cd2ed2..bafa273 100644
--- a/camel-core/src/main/java/org/apache/camel/management/event/RouteStartedEvent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/event/RouteStartedEvent.java
@@ -16,29 +16,20 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteStartedEvent extends EventObject {
+public class RouteStartedEvent extends AbstractRouteEvent {
     private static final long serialVersionUID = 1330257282431407329L;
 
-    private final Route route;
-
     public RouteStartedEvent(Route source) {
         super(source);
-        this.route = source;
-    }
-
-    public Route getRoute() {
-        return route;
     }
 
     @Override
     public String toString() {
-        return "Started route: " + route.getId();
+        return "Started route: " + getRoute().getId();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/4759bba2/camel-core/src/main/java/org/apache/camel/management/event/RouteStoppedEvent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/event/RouteStoppedEvent.java
b/camel-core/src/main/java/org/apache/camel/management/event/RouteStoppedEvent.java
index 850725b..4b1bc96 100644
--- a/camel-core/src/main/java/org/apache/camel/management/event/RouteStoppedEvent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/event/RouteStoppedEvent.java
@@ -16,29 +16,20 @@
  */
 package org.apache.camel.management.event;
 
-import java.util.EventObject;
-
 import org.apache.camel.Route;
 
 /**
  * @version 
  */
-public class RouteStoppedEvent extends EventObject {
+public class RouteStoppedEvent extends AbstractRouteEvent {
     private static final long serialVersionUID = -4466503512787398888L;
 
-    private final Route route;
-
     public RouteStoppedEvent(Route source) {
         super(source);
-        this.route = source;
-    }
-
-    public Route getRoute() {
-        return route;
     }
 
     @Override
     public String toString() {
-        return "Stopped route: " + route.getId();
+        return "Stopped route: " + getRoute().getId();
     }
 }


Mime
View raw message