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 2016/12/04 13:35:55 UTC
[1/6] camel git commit: CAMEL-10513: Update camel-example-mybatis to
break initialization dependency on Camel Context being started"
Repository: camel
Updated Branches:
refs/heads/master dd4b3236b -> b79471c7d
CAMEL-10513: Update camel-example-mybatis to break initialization dependency on Camel Context being started"
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/36178cdd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/36178cdd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/36178cdd
Branch: refs/heads/master
Commit: 36178cddd36c977a1118298749c6c8978a6d1223
Parents: dd8063e
Author: Quinn Stevenson <qu...@pronoia-solutions.com>
Authored: Fri Nov 25 10:36:18 2016 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Dec 4 13:17:55 2016 +0100
----------------------------------------------------------------------
.../camel/example/mybatis/DatabaseBean.java | 86 -----------------
.../mybatis/DatabaseInitializationBean.java | 98 ++++++++++++++++++++
.../OSGI-INF/blueprint/camel-mybatis.xml | 7 +-
.../src/main/resources/SqlMapConfig.xml | 2 +-
4 files changed, 102 insertions(+), 91 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/36178cdd/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseBean.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseBean.java b/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseBean.java
deleted file mode 100644
index 302d492..0000000
--- a/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseBean.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * 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.example.mybatis;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.component.mybatis.MyBatisComponent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Bean that creates the database table
- */
-public class DatabaseBean implements CamelContextAware {
-
- private static final Logger LOG = LoggerFactory.getLogger(DatabaseBean.class);
- private CamelContext camelContext;
-
- public CamelContext getCamelContext() {
- return camelContext;
- }
-
- public void setCamelContext(CamelContext camelContext) {
- this.camelContext = camelContext;
- }
-
- public void create() throws Exception {
- String sql = "create table ORDERS (\n"
- + " ORD_ID integer primary key,\n"
- + " ITEM varchar(10),\n"
- + " ITEM_COUNT varchar(5),\n"
- + " ITEM_DESC varchar(30),\n"
- + " ORD_DELETED boolean\n"
- + ")";
-
- LOG.info("Creating table orders ...");
-
- try {
- execute("drop table orders");
- } catch (Throwable e) {
- // ignore
- }
-
- execute(sql);
-
- LOG.info("... created table orders");
- }
-
- public void destroy() throws Exception {
- try {
- execute("drop table orders");
- } catch (Throwable e) {
- // ignore
- }
- }
-
- private void execute(String sql) throws SQLException {
- MyBatisComponent component = camelContext.getComponent("mybatis", MyBatisComponent.class);
- Connection con = component.getSqlSessionFactory().getConfiguration().getEnvironment().getDataSource().getConnection();
- Statement stm = con.createStatement();
- stm.execute(sql);
- // must commit connection
- con.commit();
- stm.close();
- con.close();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/36178cdd/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseInitializationBean.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseInitializationBean.java b/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseInitializationBean.java
new file mode 100644
index 0000000..873d8fa
--- /dev/null
+++ b/examples/camel-example-mybatis/src/main/java/org/apache/camel/example/mybatis/DatabaseInitializationBean.java
@@ -0,0 +1,98 @@
+/**
+ * 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.example.mybatis;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.apache.derby.jdbc.EmbeddedDriver;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * Bean that creates the database table
+ */
+public class DatabaseInitializationBean {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DatabaseInitializationBean.class);
+
+ String url;
+
+ Connection connection;
+
+ public DatabaseInitializationBean() {
+ }
+
+ public void create() throws Exception {
+ LOG.info("Creating database tables ...");
+ if (connection == null) {
+ EmbeddedDriver driver = new EmbeddedDriver();
+ connection = driver.connect(url + ";create=true", null);
+ }
+
+ String sql = "create table ORDERS (\n"
+ + " ORD_ID integer primary key,\n"
+ + " ITEM varchar(10),\n"
+ + " ITEM_COUNT varchar(5),\n"
+ + " ITEM_DESC varchar(30),\n"
+ + " ORD_DELETED boolean\n"
+ + ")";
+
+ try {
+ execute("drop table orders");
+ } catch (Throwable e) {
+ // ignore
+ }
+
+ execute(sql);
+
+ LOG.info("Database tables created");
+ }
+
+ public void drop() throws Exception {
+ LOG.info("Dropping database tables ...");
+
+ try {
+ execute("drop table orders");
+ } catch (Throwable e) {
+ // ignore
+ }
+ connection.close();
+
+ LOG.info("Database tables dropped");
+ }
+
+ private void execute(String sql) throws SQLException {
+ Statement stm = connection.createStatement();
+ stm.execute(sql);
+ // must commit connection
+ connection.commit();
+ stm.close();
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/36178cdd/examples/camel-example-mybatis/src/main/resources/OSGI-INF/blueprint/camel-mybatis.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-mybatis/src/main/resources/OSGI-INF/blueprint/camel-mybatis.xml b/examples/camel-example-mybatis/src/main/resources/OSGI-INF/blueprint/camel-mybatis.xml
index 23742d7..8f74000 100644
--- a/examples/camel-example-mybatis/src/main/resources/OSGI-INF/blueprint/camel-mybatis.xml
+++ b/examples/camel-example-mybatis/src/main/resources/OSGI-INF/blueprint/camel-mybatis.xml
@@ -22,9 +22,8 @@
<!-- START SNIPPET: e1 -->
<!-- bean which creates/destroys the database table for this example -->
- <bean id="initDatabase" class="org.apache.camel.example.mybatis.DatabaseBean"
- init-method="create" destroy-method="destroy">
- <property name="camelContext" ref="myBatisAndCamel"/>
+ <bean id="database-initializer" class="org.apache.camel.example.mybatis.DatabaseInitializationBean" init-method="create" destroy-method="drop">
+ <property name="url" value="jdbc:derby:memory:mybatis" />
</bean>
<!-- END SNIPPET: e1 -->
@@ -33,7 +32,7 @@
<bean id="orderService" class="org.apache.camel.example.mybatis.OrderService"/>
<!-- here is Camel configured with a number of routes -->
- <camelContext id="myBatisAndCamel" xmlns="http://camel.apache.org/schema/blueprint">
+ <camelContext id="myBatisAndCamel" xmlns="http://camel.apache.org/schema/blueprint" depends-on="database-initializer">
<!-- route that generate new orders and insert them in the database -->
<route id="generateOrder-route">
http://git-wip-us.apache.org/repos/asf/camel/blob/36178cdd/examples/camel-example-mybatis/src/main/resources/SqlMapConfig.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-mybatis/src/main/resources/SqlMapConfig.xml b/examples/camel-example-mybatis/src/main/resources/SqlMapConfig.xml
index 9683925..796c2fc 100644
--- a/examples/camel-example-mybatis/src/main/resources/SqlMapConfig.xml
+++ b/examples/camel-example-mybatis/src/main/resources/SqlMapConfig.xml
@@ -37,7 +37,7 @@
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
- <property name="url" value="jdbc:derby:memory:mybatis;create=true"/>
+ <property name="url" value="jdbc:derby:memory:mybatis"/>
</dataSource>
</environment>
</environments>
[6/6] camel git commit: CAMEL-10556: camel-websocket to load static
resources from osgi. Fixed example also.
Posted by da...@apache.org.
CAMEL-10556: camel-websocket to load static resources from osgi. Fixed example also.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b79471c7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b79471c7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b79471c7
Branch: refs/heads/master
Commit: b79471c7debb647ac97f538a1339b8ebb4eaf5a7
Parents: 1b012c5
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Dec 4 14:32:45 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Dec 4 14:32:45 2016 +0100
----------------------------------------------------------------------
.../apache/camel/component/websocket/WebsocketComponent.java | 5 +----
.../src/main/resources/webapp/index.html | 4 ----
2 files changed, 1 insertion(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/b79471c7/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
index 54ff62b..ab0a0f0 100644
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
+++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
@@ -393,10 +393,7 @@ public class WebsocketComponent extends UriEndpointComponent {
}
if (resources[0].equals("classpath")) {
- // Does not work when deployed as a bundle
- // context.setBaseResource(new JettyClassPathResource(getCamelContext().getClassResolver(), resources[1]));
- URL url = this.getCamelContext().getClassResolver().loadResourceAsURL(resources[1]);
- context.setBaseResource(Resource.newResource(url));
+ context.setBaseResource(new JettyClassPathResource(getCamelContext().getClassResolver(), resources[1]));
} else if (resources[0].equals("file")) {
context.setBaseResource(Resource.newResource(resources[1]));
}
http://git-wip-us.apache.org/repos/asf/camel/blob/b79471c7/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 48b0176..10a0006 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
@@ -1,7 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
<!--
-
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.
@@ -18,7 +15,6 @@
limitations under the License.
-->
-
<html>
<head>
[5/6] camel git commit: Update delay
Posted by da...@apache.org.
Update delay
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1b012c5f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1b012c5f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1b012c5f
Branch: refs/heads/master
Commit: 1b012c5f8c5487a2e3ea574caf9e5b7a8ac16c37
Parents: 3eb318d
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Dec 4 14:14:43 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Dec 4 14:14:43 2016 +0100
----------------------------------------------------------------------
.../src/main/resources/OSGI-INF/blueprint/camel-twitter.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1b012c5f/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 0fefd41..51400be 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
@@ -28,7 +28,7 @@
<route id="twitter-route">
<!-- consume from twitter search to get new tweets about gaga every 5th second -->
- <from uri="twitter://search?type=polling&delay=5&keywords=gaga
+ <from uri="twitter://search?type=polling&delay=6000&keywords=gaga
&accessToken={{access.token}}&accessTokenSecret={{access.token-secret}}&consumerKey={{consumer.key}}&consumerSecret={{consumer.secret}}"/>
<!-- log tweet to the log -->
[4/6] camel git commit: Polish
Posted by da...@apache.org.
Polish
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3eb318d7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3eb318d7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3eb318d7
Branch: refs/heads/master
Commit: 3eb318d7880d47c86d6e35820bc5488c64af2bfb
Parents: 757127c
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Dec 4 14:09:04 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Dec 4 14:09:04 2016 +0100
----------------------------------------------------------------------
examples/camel-example-twitter-websocket-blueprint/README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3eb318d7/examples/camel-example-twitter-websocket-blueprint/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-twitter-websocket-blueprint/README.md b/examples/camel-example-twitter-websocket-blueprint/README.md
index b670270..57e285e 100644
--- a/examples/camel-example-twitter-websocket-blueprint/README.md
+++ b/examples/camel-example-twitter-websocket-blueprint/README.md
@@ -20,19 +20,19 @@ This example requires running in Apache Karaf / ServiceMix
karaf
To install Apache Camel in Karaf you type in the shell (as an example here we make use of
-Camel version 2.12.0):
+Camel version 2.18.1):
- feature:repo-add camel 2.12.0
+ feature:repo-add camel 2.18.1
First you need to install the following features in Karaf/ServiceMix with:
- feature:install camel-blueprint
+ feature:install camel
feature:install camel-twitter
feature:install camel-websocket
Then you can install the Camel example:
- install -s mvn:org.apache.camel/camel-example-twitter-websocket-blueprint/2.12.0
+ install -s mvn:org.apache.camel/camel-example-twitter-websocket-blueprint/2.18.1
Then open a browser to see live twitter updates in the web page
[3/6] camel git commit: Fixed readme
Posted by da...@apache.org.
Fixed readme
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/757127c3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/757127c3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/757127c3
Branch: refs/heads/master
Commit: 757127c3d9d565a1c81ab90d6a1e472a17e21a20
Parents: 36178cd
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Dec 4 14:05:51 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Dec 4 14:05:51 2016 +0100
----------------------------------------------------------------------
examples/camel-example-transformer-blueprint/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/757127c3/examples/camel-example-transformer-blueprint/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-transformer-blueprint/README.md b/examples/camel-example-transformer-blueprint/README.md
index 9907c9c..663bfdc 100644
--- a/examples/camel-example-transformer-blueprint/README.md
+++ b/examples/camel-example-transformer-blueprint/README.md
@@ -29,7 +29,7 @@ To run the example on the karaf container
#### Step 2: Deploy
- feature:repo-add feature:repo-add mvn:org.apache.camel/camel-example-transformer-blueprint/${version}/xml/features
+ feature:repo-add mvn:org.apache.camel/camel-example-transformer-blueprint/${version}/xml/features
feature:install camel-example-transformer-blueprint
#### Step 3: Check the output
[2/6] camel git commit: CAMEL-10513: Start BlueprintCamelContext on
BlueprintEvent.CREATED
Posted by da...@apache.org.
CAMEL-10513: Start BlueprintCamelContext on BlueprintEvent.CREATED
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dd8063ef
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dd8063ef
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dd8063ef
Branch: refs/heads/master
Commit: dd8063efafa72d86d6187357e5a0d62944013166
Parents: dd4b323
Author: Quinn Stevenson <qu...@pronoia-solutions.com>
Authored: Tue Nov 22 14:15:53 2016 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Dec 4 13:17:55 2016 +0100
----------------------------------------------------------------------
.../camel/blueprint/BlueprintCamelContext.java | 83 +++++++++++++++++---
.../blueprint/CamelContextFactoryBean.java | 2 +-
2 files changed, 73 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/dd8063ef/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
index dd87dae..9b2a861 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
@@ -143,23 +143,84 @@ public class BlueprintCamelContext extends DefaultCamelContext implements Servic
@Override
public void blueprintEvent(BlueprintEvent event) {
- // noop as we just needed to enlist the BlueprintListener to have events triggered to serviceChanged method
+ if (LOG.isDebugEnabled()) {
+ String eventTypeString;
+
+ switch (event.getType()) {
+ case BlueprintEvent.CREATING:
+ eventTypeString = "CREATING";
+ break;
+ case BlueprintEvent.CREATED:
+ eventTypeString = "CREATED";
+ break;
+ case BlueprintEvent.DESTROYING:
+ eventTypeString = "DESTROYING";
+ break;
+ case BlueprintEvent.DESTROYED:
+ eventTypeString = "DESTROYED";
+ break;
+ case BlueprintEvent.GRACE_PERIOD:
+ eventTypeString = "GRACE_PERIOD";
+ break;
+ case BlueprintEvent.WAITING:
+ eventTypeString = "WAITING";
+ break;
+ case BlueprintEvent.FAILURE:
+ eventTypeString = "FAILURE";
+ break;
+ default:
+ eventTypeString = "UNKNOWN";
+ break;
+ }
+
+ LOG.debug("Received BlueprintEvent[ replay={} type={} bundle={}] %s", event.isReplay(), eventTypeString, event.getBundle().getSymbolicName(), event.toString());
+ }
+
+ if (!event.isReplay() && this.getBundleContext().getBundle().getBundleId() == event.getBundle().getBundleId()) {
+ if (event.getType() == BlueprintEvent.CREATED) {
+ try {
+ LOG.info("Attempting to start Camel Context {}", this.getName());
+ this.maybeStart();
+ } catch (Exception startEx) {
+ LOG.error("Error occurred during starting Camel Context " + this.getName(), startEx);
+ }
+ } else if (event.getType() == BlueprintEvent.DESTROYING) {
+ try {
+ LOG.info("Stopping Camel Context {}", this.getName());
+ this.stop();
+ } catch (Exception stopEx) {
+ LOG.error("Error occurred during stopping Camel Context " + this.getName(), stopEx);
+ }
+
+ }
+ }
+
}
@Override
public void serviceChanged(ServiceEvent event) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Service {} changed to {}", event, event.getType());
- }
- // look for blueprint container to be registered, and then we can start the CamelContext
- if (event.getType() == ServiceEvent.REGISTERED
- && event.getServiceReference().isAssignableTo(bundleContext.getBundle(), "org.osgi.service.blueprint.container.BlueprintContainer")
- && bundleContext.getBundle().equals(event.getServiceReference().getBundle())) {
- try {
- maybeStart();
- } catch (Exception e) {
- LOG.error("Error occurred during starting Camel: " + this + " due " + e.getMessage(), e);
+ String eventTypeString;
+
+ switch (event.getType()) {
+ case ServiceEvent.REGISTERED:
+ eventTypeString = "REGISTERED";
+ break;
+ case ServiceEvent.MODIFIED:
+ eventTypeString = "MODIFIED";
+ break;
+ case ServiceEvent.UNREGISTERING:
+ eventTypeString = "UNREGISTERING";
+ break;
+ case ServiceEvent.MODIFIED_ENDMATCH:
+ eventTypeString = "MODIFIED_ENDMATCH";
+ break;
+ default:
+ eventTypeString = "UNKNOWN";
+ break;
}
+
+ LOG.debug("Service {} changed to {}", event.toString(), eventTypeString);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/dd8063ef/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
index 59e9f38..41da245 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -275,7 +275,7 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
if (pc.getLocations() == null) {
String[] ids = parser.lookupPropertyPlaceholderIds();
for (int i = 0; i < ids.length; i++) {
- if (!ids[i].startsWith( "blueprint:")) {
+ if (!ids[i].startsWith("blueprint:")) {
ids[i] = "blueprint:" + ids[i];
}
}