You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/06/29 12:53:45 UTC
[1/2] git commit: Added blueprint example of our twitter example.
Updated Branches:
refs/heads/master 05967ac7f -> 18f8d29f9
Added blueprint example of our twitter example.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/131d39bc
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/131d39bc
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/131d39bc
Branch: refs/heads/master
Commit: 131d39bc51051343ddeda277a433a84f21a4c825
Parents: 05967ac
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jun 29 14:06:20 2013 +0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jun 29 14:38:25 2013 +0400
----------------------------------------------------------------------
.../README.txt | 34 ++++++--
.../pom.xml | 7 +-
.../OSGI-INF/blueprint/camel-twitter.xml | 8 +-
.../src/main/resources/webapp/index.html | 84 +++++++++++---------
examples/pom.xml | 1 +
5 files changed, 88 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/131d39bc/examples/camel-example-twitter-websocket-blueprint/README.txt
----------------------------------------------------------------------
diff --git a/examples/camel-example-twitter-websocket-blueprint/README.txt b/examples/camel-example-twitter-websocket-blueprint/README.txt
index 6b6352b..4d7433b 100644
--- a/examples/camel-example-twitter-websocket-blueprint/README.txt
+++ b/examples/camel-example-twitter-websocket-blueprint/README.txt
@@ -1,5 +1,5 @@
-Twitter and Websocket Example
-=============================
+Twitter and Websocket Blueprint Example
+=======================================
The example is demonstrating how to poll a constant feed of twitter searches
and publish results in real time using web socket to a web page.
@@ -13,18 +13,38 @@ For that you need to setup and use your own twitter account.
We have described this in more details at the Camel twitter documentation:
http://camel.apache.org/twitter
-You will need to compile this example first:
- mvn compile
+You will need to install this example first to your local maven repository with:
+ mvn install
-To run the example type
- mvn exec:java
+This example requires running in Apache Karaf / ServiceMix
+
+To install Apache Camel in Karaf you type in the shell (we use version 2.12.0):
+
+ features:chooseurl camel 2.12.0
+ features:install camel
+
+First you need to install the following features in Karaf/ServiceMix with:
+
+ features:install camel-twitter
+ features:install camel-websocket
+
+Then you can install the Camel example:
+
+ osgi:install -s mvn:org.apache.camel/camel-example-twitter-websocket-blueprint/2.12.0
Then open a browser to see live twitter updates in the web page
http://localhost:9090
-To stop the example hit ctrl + c
+To stop the example run from Karaf/ServiceMix shell:
+ stop <bundle id>
+
+eg if the bundle id is 99 then type:
+ stop 99
This example is documented at
+ http://camel.apache.org/twitter-websocket-blueprint-example.html
+
+There is a regular (non OSGi Blueprint) example as well documented at:
http://camel.apache.org/twitter-websocket-example.html
If you hit any problems please let us know on the Camel Forums
http://git-wip-us.apache.org/repos/asf/camel/blob/131d39bc/examples/camel-example-twitter-websocket-blueprint/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-twitter-websocket-blueprint/pom.xml b/examples/camel-example-twitter-websocket-blueprint/pom.xml
index 4ce9d90..9265535 100644
--- a/examples/camel-example-twitter-websocket-blueprint/pom.xml
+++ b/examples/camel-example-twitter-websocket-blueprint/pom.xml
@@ -31,6 +31,9 @@
<description>An example that pushes new tweets to a web page using web-socket</description>
<packaging>bundle</packaging>
+ <!-- there is no maven dependencies needed as the Camel application has no Java code,
+ and its all defined in the src/main/resources/OSGI-INF/blueprint/camel-twitter.xml file -->
+
<build>
<plugins>
@@ -43,9 +46,9 @@
<manifestLocation>target/META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Export-Package>org.apache.camel.example.twitter*</Export-Package>
<Import-Package>
- org.apache.camel.component.twitter,
- org.apache.camel.component.websocket
+ *
</Import-Package>
</instructions>
</configuration>
http://git-wip-us.apache.org/repos/asf/camel/blob/131d39bc/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml b/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml
index 495bb64..47fef37 100644
--- a/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml
+++ b/examples/camel-example-twitter-websocket-blueprint/src/main/resources/OSGI-INF/blueprint/camel-twitter.xml
@@ -20,15 +20,21 @@
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+ <!-- CamelContext with the twitter websocket example -->
<camelContext id="twitter-camel" xmlns="http://camel.apache.org/schema/blueprint">
<!-- use properties files for twitter codes -->
<propertyPlaceholder id="placeholder" location="classpath:twitter.properties"/>
<route id="twitter-route">
- <from uri="twitter://search?type=polling&delay=5s&keywords=gaga
+ <!-- consume from twitter search to get new tweets about gaga every 5th second -->
+ <from uri="twitter://search?type=polling&delay=5&keywords=gaga
&accessToken={{access.token}}&accessTokenSecret={{access.token-secret}}&consumerKey={{consumer.key}}&consumerSecret={{consumer.secret}}"/>
+
+ <!-- log tweet to the log -->
<to uri="log:tweet"/>
+
+ <!-- and send tweet to the websocket component so its viewable in the web page -->
<to uri="websocket://localhost:9090/camel-tweet?sendToAll=true&staticResources=classpath:webapp"/>
</route>
http://git-wip-us.apache.org/repos/asf/camel/blob/131d39bc/examples/camel-example-twitter-websocket-blueprint/src/main/resources/webapp/index.html
----------------------------------------------------------------------
diff --git a/examples/camel-example-twitter-websocket-blueprint/src/main/resources/webapp/index.html b/examples/camel-example-twitter-websocket-blueprint/src/main/resources/webapp/index.html
index fc01b8e..48b0176 100644
--- a/examples/camel-example-twitter-websocket-blueprint/src/main/resources/webapp/index.html
+++ b/examples/camel-example-twitter-websocket-blueprint/src/main/resources/webapp/index.html
@@ -20,54 +20,66 @@
-->
<html>
-<head>
- <title>Camel Twitter WebSocket Example</title>
- <script type='text/javascript'>
- if (!window.WebSocket) {
- alert("WebSocket not supported by this browser");
- }
+<head>
+ <title>Camel Twitter WebSocket Blueprint Example</title>
+ <script type='text/javascript'>
- function $() { return document.getElementById(arguments[0]); }
+ if (!window.WebSocket) {
+ alert("WebSocket not supported by this browser");
+ }
- var room = {
- join: function(name) {
- this._username=name;
+ var room = {
+ join: function (name) {
+ this._username = name;
var location = "ws://localhost:9090/camel-tweet";
- this._ws=new WebSocket(location);
- this._ws.onmessage=this._onmessage;
- this._ws.onclose=this._onclose;
- },
-
- _onmessage: function(m) {
- if (m.data){
- var chat=$('chat');
- var spanText = document.createElement('span');
- spanText.className='text';
- spanText.innerHTML=m.data;
- var lineBreak = document.createElement('br');
- chat.appendChild(spanText);
- chat.appendChild(lineBreak);
- chat.scrollTop = chat.scrollHeight - chat.clientHeight;
- }
- },
+ this._ws = new WebSocket(location);
+ this._ws.onmessage = this._onmessage;
+ this._ws.onclose = this._onclose;
+ },
- _onclose: function(m) {
- this._ws=null;
+ _onmessage: function (m) {
+ if (m.data) {
+ var chat = document.getElementById('chat')
+ var spanText = document.createElement('span');
+ spanText.className = 'text';
+ spanText.innerHTML = m.data;
+ var lineBreak = document.createElement('br');
+ chat.appendChild(spanText);
+ chat.appendChild(lineBreak);
+ chat.scrollTop = chat.scrollHeight - chat.clientHeight;
}
+ },
- };
+ _onclose: function (m) {
+ this._ws = null;
+ }
- </script>
- <style type='text/css'>
- div { border: 0px solid black; }
- div#chat { clear: both; width: 80em; height: 60ex; overflow: auto; background-color: #f0f0f0; padding: 4px; border: 1px solid black; }
- </style>
+ };
+
+ </script>
+ <style type='text/css'>
+ div {
+ border: 0px solid black;
+ }
+
+ div#chat {
+ clear: both;
+ width: 80em;
+ height: 60ex;
+ overflow: auto;
+ background-color: #f0f0f0;
+ padding: 4px;
+ border: 1px solid black;
+ }
+ </style>
</head>
+
<body>
<div id='chat'></div>
<script type='text/javascript'>
- room.join("Testing");
+ room.join("Testing");
</script>
</body>
+
</html>
http://git-wip-us.apache.org/repos/asf/camel/blob/131d39bc/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 1acb3cb..30b9b06 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -74,6 +74,7 @@
<module>camel-example-sql</module>
<module>camel-example-tracer</module>
<module>camel-example-twitter-websocket</module>
+ <module>camel-example-twitter-websocket-blueprint</module>
</modules>
<properties>
[2/2] git commit: Fixed potential NPE
Posted by da...@apache.org.
Fixed potential NPE
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/18f8d29f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/18f8d29f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/18f8d29f
Branch: refs/heads/master
Commit: 18f8d29f985746e5b5afa7f7b26564c5be564d5c
Parents: 131d39b
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jun 29 14:48:45 2013 +0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jun 29 14:48:45 2013 +0400
----------------------------------------------------------------------
.../java/org/apache/camel/util/EventHelper.java | 199 +++++++++++++++----
1 file changed, 155 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/18f8d29f/camel-core/src/main/java/org/apache/camel/util/EventHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/EventHelper.java b/camel-core/src/main/java/org/apache/camel/util/EventHelper.java
index 12084ec..c5206af 100644
--- a/camel-core/src/main/java/org/apache/camel/util/EventHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/EventHelper.java
@@ -27,6 +27,7 @@ import org.apache.camel.Route;
import org.apache.camel.StatefulService;
import org.apache.camel.spi.EventFactory;
import org.apache.camel.spi.EventNotifier;
+import org.apache.camel.spi.ManagementStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +44,12 @@ public final class EventHelper {
}
public static void notifyCamelContextStarting(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -53,7 +59,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -66,7 +72,12 @@ public final class EventHelper {
}
public static void notifyCamelContextStarted(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -76,7 +87,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -89,7 +100,12 @@ public final class EventHelper {
}
public static void notifyCamelContextStartupFailed(CamelContext context, Throwable cause) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -99,7 +115,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -112,7 +128,12 @@ public final class EventHelper {
}
public static void notifyCamelContextStopping(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -122,7 +143,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -135,7 +156,12 @@ public final class EventHelper {
}
public static void notifyCamelContextStopped(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -145,7 +171,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -158,7 +184,12 @@ public final class EventHelper {
}
public static void notifyCamelContextStopFailed(CamelContext context, Throwable cause) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -168,7 +199,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -181,7 +212,12 @@ public final class EventHelper {
}
public static void notifyServiceStopFailure(CamelContext context, Object service, Throwable cause) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -191,7 +227,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -204,7 +240,12 @@ public final class EventHelper {
}
public static void notifyServiceStartupFailure(CamelContext context, Object service, Throwable cause) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -214,7 +255,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -227,7 +268,12 @@ public final class EventHelper {
}
public static void notifyRouteStarted(CamelContext context, Route route) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -237,7 +283,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -250,7 +296,12 @@ public final class EventHelper {
}
public static void notifyRouteStopped(CamelContext context, Route route) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -260,7 +311,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -278,7 +329,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -288,7 +344,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -306,7 +362,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -316,7 +377,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -334,7 +395,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -344,7 +410,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -363,7 +429,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -373,7 +444,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -391,7 +462,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -401,7 +477,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -419,7 +495,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -429,7 +510,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -447,7 +528,12 @@ public final class EventHelper {
return;
}
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -457,7 +543,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -470,7 +556,12 @@ public final class EventHelper {
}
public static void notifyCamelContextSuspending(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -480,7 +571,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -493,7 +584,12 @@ public final class EventHelper {
}
public static void notifyCamelContextSuspended(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -503,7 +599,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -516,7 +612,12 @@ public final class EventHelper {
}
public static void notifyCamelContextResuming(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -526,7 +627,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -539,7 +640,12 @@ public final class EventHelper {
}
public static void notifyCamelContextResumed(CamelContext context) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -549,7 +655,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
@@ -562,7 +668,12 @@ public final class EventHelper {
}
public static void notifyCamelContextResumeFailed(CamelContext context, Throwable cause) {
- List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+ ManagementStrategy management = context.getManagementStrategy();
+ if (management == null) {
+ return;
+ }
+
+ List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
@@ -572,7 +683,7 @@ public final class EventHelper {
continue;
}
- EventFactory factory = context.getManagementStrategy().getEventFactory();
+ EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}