[KARAF-2833] Make jdbc independent of blueprint. Note that blueprint is still required to deploy the datasources
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/3fe68988 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/3fe68988 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/3fe68988 Branch: refs/heads/master Commit: 3fe68988b2bf41808cd7647ebc82ae4092b8191a Parents: ce0f75d Author: Guillaume Nodet <gno...@gmail.com> Authored: Mon Apr 14 11:06:40 2014 +0200 Committer: Guillaume Nodet <gno...@gmail.com> Committed: Mon Apr 14 11:06:40 2014 +0200 ---------------------------------------------------------------------- jdbc/pom.xml | 7 +++- .../karaf/jdbc/internal/osgi/Activator.java | 35 +++++++++++++++++ .../resources/OSGI-INF/blueprint/jdbc-core.xml | 41 -------------------- 3 files changed, 41 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/3fe68988/jdbc/pom.xml ---------------------------------------------------------------------- diff --git a/jdbc/pom.xml b/jdbc/pom.xml index a6dce66..be8ef62 100644 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -84,8 +84,13 @@ org.apache.karaf.jdbc.command, org.apache.karaf.jdbc.command.completers, org.apache.karaf.jdbc.internal, - org.apache.karaf.util + org.apache.karaf.jdbc.internal.osgi, + org.apache.karaf.util, + org.apache.karaf.util.tracker </Private-Package> + <Bundle-Activator> + org.apache.karaf.jdbc.internal.osgi.Activator + </Bundle-Activator> <Karaf-Commands>*</Karaf-Commands> </instructions> </configuration> http://git-wip-us.apache.org/repos/asf/karaf/blob/3fe68988/jdbc/src/main/java/org/apache/karaf/jdbc/internal/osgi/Activator.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/karaf/jdbc/internal/osgi/Activator.java b/jdbc/src/main/java/org/apache/karaf/jdbc/internal/osgi/Activator.java new file mode 100644 index 0000000..8ede97a --- /dev/null +++ b/jdbc/src/main/java/org/apache/karaf/jdbc/internal/osgi/Activator.java @@ -0,0 +1,35 @@ +/* + * 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.karaf.jdbc.internal.osgi; + +import org.apache.karaf.jdbc.JdbcService; +import org.apache.karaf.jdbc.internal.JdbcMBeanImpl; +import org.apache.karaf.jdbc.internal.JdbcServiceImpl; +import org.apache.karaf.util.tracker.BaseActivator; + +public class Activator extends BaseActivator { + @Override + protected void doStart() throws Exception { + JdbcServiceImpl service = new JdbcServiceImpl(); + service.setBundleContext(bundleContext); + register(JdbcService.class, service); + + JdbcMBeanImpl mbean = new JdbcMBeanImpl(); + mbean.setJdbcService(service); + registerMBean(mbean, "type=jdbc"); + } +} http://git-wip-us.apache.org/repos/asf/karaf/blob/3fe68988/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml ---------------------------------------------------------------------- diff --git a/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml b/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml deleted file mode 100644 index e961697..0000000 --- a/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?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. - 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. - --> -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" - xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0" - default-activation="lazy"> - - <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/> - - <bean id="jdbcService" class="org.apache.karaf.jdbc.internal.JdbcServiceImpl"> - <property name="bundleContext" ref="blueprintBundleContext"/> - </bean> - - <service ref="jdbcService" interface="org.apache.karaf.jdbc.JdbcService" /> - - <!-- Management --> - <bean id="jdbcMBeanImpl" class="org.apache.karaf.jdbc.internal.JdbcMBeanImpl"> - <property name="jdbcService" ref="jdbcService"/> - </bean> - - <service ref="jdbcMBeanImpl" auto-export="interfaces"> - <service-properties> - <entry key="jmx.objectname" value="org.apache.karaf:type=jdbc,name=$[karaf.name]"/> - </service-properties> - </service> - -</blueprint> \ No newline at end of file