You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/12/16 15:43:48 UTC

svn commit: r1551219 [1/2] - in /karaf/trunk: ./ assemblies/features/enterprise/src/main/feature/ jdbc/ jdbc/command/ jdbc/command/src/ jdbc/command/src/main/ jdbc/command/src/main/java/ jdbc/command/src/main/java/org/ jdbc/command/src/main/java/org/ap...

Author: jbonofre
Date: Mon Dec 16 14:43:47 2013
New Revision: 1551219

URL: http://svn.apache.org/r1551219
Log:
[KARAF-2549] Add new JDBC enterprise feature

Added:
    karaf/trunk/jdbc/
    karaf/trunk/jdbc/command/
    karaf/trunk/jdbc/command/NOTICE
    karaf/trunk/jdbc/command/pom.xml
    karaf/trunk/jdbc/command/src/
    karaf/trunk/jdbc/command/src/main/
    karaf/trunk/jdbc/command/src/main/java/
    karaf/trunk/jdbc/command/src/main/java/org/
    karaf/trunk/jdbc/command/src/main/java/org/apache/
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/CreateCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DataSourcesCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DeleteCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/ExecuteCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/InfoCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/JdbcCommandSupport.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/QueryCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/TablesCommand.java
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/completers/
    karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/completers/DataSourcesCompleter.java
    karaf/trunk/jdbc/command/src/main/resources/
    karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/
    karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/blueprint/
    karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/blueprint/jdbc-command.xml
    karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/bundle.info
    karaf/trunk/jdbc/core/
    karaf/trunk/jdbc/core/NOTICE
    karaf/trunk/jdbc/core/pom.xml
    karaf/trunk/jdbc/core/src/
    karaf/trunk/jdbc/core/src/main/
    karaf/trunk/jdbc/core/src/main/java/
    karaf/trunk/jdbc/core/src/main/java/org/
    karaf/trunk/jdbc/core/src/main/java/org/apache/
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcService.java
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java
    karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java
    karaf/trunk/jdbc/core/src/main/resources/
    karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/
    karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/blueprint/
    karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml
    karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/bundle.info
    karaf/trunk/jdbc/core/src/main/resources/org/
    karaf/trunk/jdbc/core/src/main/resources/org/apache/
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-db2.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-derby.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-generic.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-h2.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-hsql.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-mysql.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-oracle.xml
    karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-postgres.xml
    karaf/trunk/jdbc/pom.xml
    karaf/trunk/manual/src/main/webapp/users-guide/jdbc.conf
Modified:
    karaf/trunk/assemblies/features/enterprise/src/main/feature/feature.xml
    karaf/trunk/manual/src/main/webapp/_navigation.conf
    karaf/trunk/manual/src/main/webapp/manual.conf
    karaf/trunk/manual/src/main/webapp/users-guide/enterprise.conf
    karaf/trunk/manual/src/main/webapp/users-guide/index.conf
    karaf/trunk/pom.xml

Modified: karaf/trunk/assemblies/features/enterprise/src/main/feature/feature.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assemblies/features/enterprise/src/main/feature/feature.xml?rev=1551219&r1=1551218&r2=1551219&view=diff
==============================================================================
--- karaf/trunk/assemblies/features/enterprise/src/main/feature/feature.xml (original)
+++ karaf/trunk/assemblies/features/enterprise/src/main/feature/feature.xml Mon Dec 16 14:43:47 2013
@@ -59,6 +59,15 @@
         <bundle>mvn:org.apache.karaf.jndi/org.apache.karaf.jndi.command/${project.version}</bundle>
     </feature>
 
+    <feature name='jdbc' description='JDBC service and commands' version='${project.version}' resolver='(obr)'>
+        <details>JDBC support providing service, commands, and MBean.</details>
+        <feature>transaction</feature>
+        <bundle>mvn:commons-pool/commons-pool/1.6</bundle>
+        <bundle>mvn:commons-dbcp/commons-dbcp/1.4</bundle>
+        <bundle>mvn:org.apache.karaf.jdbc/org.apache.karaf.jdbc.core/${project.version}</bundle>
+        <bundle>mvn:org.apache.karaf.jdbc/org.apache.karaf.jdbc.command/${project.version}</bundle>
+    </feature>
+
     <feature name='application-without-isolation' description='Provide EBA archive support' version='${aries.application.version}'>
         <details>Support of the Aries EBA archives</details>
         <!-- pre-requisites-->

Added: karaf/trunk/jdbc/command/NOTICE
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/NOTICE?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/NOTICE (added)
+++ karaf/trunk/jdbc/command/NOTICE Mon Dec 16 14:43:47 2013
@@ -0,0 +1,71 @@
+Apache Karaf
+Copyright 2010-2013 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+OW2 (http://www.ow2.org/).
+Licensed under the BSD License.
+
+This product includes software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Eclipse Foundation (http://www.eclipse.org/).
+Licensed under the EPL.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+AOP Alliance (http://aopalliance.sourceforge.net/).
+Licensed under the Public Domain.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Jasypt (http://jasypt.sourceforge.net/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product uses software developed at
+SpringSource (http://www.springsource.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
+- EPL License
+- MIT License

Added: karaf/trunk/jdbc/command/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/pom.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/pom.xml (added)
+++ karaf/trunk/jdbc/command/pom.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.jdbc</groupId>
+        <artifactId>jdbc</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.karaf.jdbc.command</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: JDBC :: Command</name>
+    <description>This bundle provides shell commands to manipulate the JDBC service</description>
+
+    <properties>
+        <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.jdbc</groupId>
+            <artifactId>org.apache.karaf.jdbc.core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.table</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.info</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>!*</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/CreateCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/CreateCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/CreateCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/CreateCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,55 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+
+@Command(scope = "jdbc", name = "create", description = "Create a JDBC datasource")
+public class CreateCommand extends JdbcCommandSupport {
+
+    @Argument(index = 0, name = "name", description = "The JDBC datasource name", required = true, multiValued = false)
+    String name;
+
+    @Option(name = "-t", aliases = { "--type" }, description = "The JDBC datasource type (generic, MySQL, Oracle, Postgres, H2, HSQL, Derby)", required = false, multiValued = false)
+    String type;
+
+    @Option(name = "-d", aliases = { "--driver" }, description = "The classname of the JDBC driver to use. NB: this option is used only the type generic", required = false, multiValued = false)
+    String driver;
+
+    @Option(name = "-v", aliases = { "--version" }, description = "The version of the driver to use", required = false, multiValued = false)
+    String version;
+
+    @Option(name = "-url", description = "The JDBC URL to use", required = false, multiValued = false)
+    String url;
+
+    @Option(name = "-u", aliases = { "--username" }, description = "The database username", required = false, multiValued = false)
+    String username;
+
+    @Option(name = "-p", aliases = { "--password" }, description = "The database password", required = false, multiValued = false)
+    String password;
+
+    @Option(name = "-i", aliases = { "--install-bundles" }, description = "Try to install the bundles providing the JDBC driver", required = false, multiValued = false)
+    boolean installBundles = false;
+
+    public Object doExecute() throws Exception {
+        this.getJdbcService().create(name, type, driver, version, url, username, password, installBundles);
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DataSourcesCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DataSourcesCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DataSourcesCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DataSourcesCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.List;
+import java.util.Map;
+
+@Command(scope = "jdbc", name = "datasources", description = "List the JDBC datasources")
+public class DataSourcesCommand extends JdbcCommandSupport {
+
+    public Object doExecute() throws Exception {
+        ShellTable table = new ShellTable();
+
+        table.column("Name");
+        table.column("Product");
+        table.column("Version");
+        table.column("URL");
+
+        List<String> datasources = this.getJdbcService().datasources();
+        for (String datasource : datasources) {
+            Map<String, String> info = this.getJdbcService().info(datasource);
+            table.addRow().addContent(datasource, info.get("db.product"), info.get("db.version"), info.get("url"));
+        }
+
+        table.print(System.out);
+
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DeleteCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DeleteCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DeleteCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/DeleteCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,33 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+
+@Command(scope = "jdbc", name = "delete", description = "Delete a JDBC datasource")
+public class DeleteCommand extends JdbcCommandSupport {
+
+    @Argument(index = 0, name = "name", description = "The JDBC datasource name (the one used at creation time)", required = true, multiValued = false)
+    String name;
+
+    public Object doExecute() throws Exception {
+        this.getJdbcService().delete(name);
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/ExecuteCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/ExecuteCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/ExecuteCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/ExecuteCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,36 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+
+@Command(scope = "jdbc", name = "execute", description = "Execute a SQL command on a given JDBC datasource")
+public class ExecuteCommand extends JdbcCommandSupport {
+
+    @Argument(index = 0, name = "datasource", description = "The JDBC datasource", required = true, multiValued = false)
+    String datasource;
+
+    @Argument(index = 1, name = "command", description = "The SQL command to execute", required = true, multiValued = false)
+    String command;
+
+    public Object doExecute() throws Exception {
+        this.getJdbcService().execute(datasource, command);
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/InfoCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/InfoCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/InfoCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/InfoCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.Map;
+
+@Command(scope = "jdbc", name = "info", description = "Display details about a JDBC datasource")
+public class InfoCommand extends JdbcCommandSupport {
+
+    @Argument(index = 0, name = "datasource", description = "The JDBC datasource name", required = true, multiValued = false)
+    String datasource;
+
+    public Object doExecute() throws Exception {
+        ShellTable table = new ShellTable();
+
+        table.column("Property");
+        table.column("Value");
+
+        Map<String, String> info = this.getJdbcService().info(datasource);
+        for (String property : info.keySet()) {
+            table.addRow().addContent(property, info.get(property));
+        }
+
+        table.print(System.out);
+
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/JdbcCommandSupport.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/JdbcCommandSupport.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/JdbcCommandSupport.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/JdbcCommandSupport.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,36 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.jdbc.JdbcService;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+
+public abstract class JdbcCommandSupport extends OsgiCommandSupport {
+
+    private JdbcService jdbcService;
+
+    public abstract Object doExecute() throws Exception;
+
+    public JdbcService getJdbcService() {
+        return jdbcService;
+    }
+
+    public void setJdbcService(JdbcService jdbcService) {
+        this.jdbcService = jdbcService;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/QueryCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/QueryCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/QueryCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/QueryCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,58 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.Row;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.List;
+import java.util.Map;
+
+@Command(scope = "jdbc", name = "query", description = "Execute a SQL query on a JDBC datasource")
+public class QueryCommand extends JdbcCommandSupport {
+
+    @Argument(index = 0, name = "datasource", description = "The JDBC datasource to use", required = true, multiValued = false)
+    String datasource;
+
+    @Argument(index = 1, name = "query", description = "The SQL query to execute", required = true, multiValued = false)
+    String query;
+
+    public Object doExecute() throws Exception {
+        ShellTable table = new ShellTable();
+
+        Map<String, List<String>> map = this.getJdbcService().query(datasource, query);
+        int rowCount = 0;
+        for (String column : map.keySet()) {
+            table.column(column);
+            rowCount = map.get(column).size();
+        }
+
+        for (int i = 0; i < rowCount; i++) {
+            Row row = table.addRow();
+            for (String column : map.keySet()) {
+                row.addContent(map.get(column).get(i));
+            }
+        }
+
+        table.print(System.out);
+
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/TablesCommand.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/TablesCommand.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/TablesCommand.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/TablesCommand.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,55 @@
+/*
+ * 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.command;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.table.Row;
+import org.apache.karaf.shell.table.ShellTable;
+
+import java.util.List;
+import java.util.Map;
+
+@Command(scope = "jdbc", name = "tables", description = "List the tables on a given JDBC datasource")
+public class TablesCommand extends JdbcCommandSupport {
+
+    @Argument(index = 0, name = "datasource", description = "The JDBC datasource to use", required = true, multiValued = false)
+    String datasource;
+
+    public Object doExecute() throws Exception {
+        ShellTable table = new ShellTable();
+
+        Map<String, List<String>> map = this.getJdbcService().tables(datasource);
+        int rowCount = 0;
+        for (String column : map.keySet()) {
+            table.column(column);
+            rowCount = map.get(column).size();
+        }
+
+        for (int i = 0; i < rowCount; i++) {
+            Row row = table.addRow();
+            for (String column : map.keySet()) {
+                row.addContent(map.get(column).get(i));
+            }
+        }
+
+        table.print(System.out);
+
+        return null;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/completers/DataSourcesCompleter.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/completers/DataSourcesCompleter.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/completers/DataSourcesCompleter.java (added)
+++ karaf/trunk/jdbc/command/src/main/java/org/apache/karaf/jdbc/command/completers/DataSourcesCompleter.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,53 @@
+/*
+ * 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.command.completers;
+
+import org.apache.karaf.jdbc.JdbcService;
+import org.apache.karaf.shell.console.Completer;
+import org.apache.karaf.shell.console.completer.StringsCompleter;
+
+import java.util.List;
+
+/**
+ * Completer on the JDBC datasources name/identifier
+ */
+public class DataSourcesCompleter implements Completer {
+
+    private JdbcService jdbcService;
+
+    @Override
+    public int complete(String buffer, int cursor, List<String> candidates) {
+        StringsCompleter delegate = new StringsCompleter();
+        try {
+            for (String datasource : jdbcService.datasources()) {
+                delegate.getStrings().add(datasource);
+            }
+        } catch (Exception e) {
+            // nothing to do
+        }
+        return delegate.complete(buffer, cursor, candidates);
+    }
+
+    public JdbcService getJdbcService() {
+        return jdbcService;
+    }
+
+    public void setJdbcService(JdbcService jdbcService) {
+        this.jdbcService = jdbcService;
+    }
+
+}

Added: karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/blueprint/jdbc-command.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/blueprint/jdbc-command.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/blueprint/jdbc-command.xml (added)
+++ karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/blueprint/jdbc-command.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,84 @@
+<?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" default-activation="lazy">
+
+    <reference id="jdbcService" interface="org.apache.karaf.jdbc.JdbcService" />
+
+    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+        <command>
+            <action class="org.apache.karaf.jdbc.command.CreateCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+        </command>
+        <command>
+            <action class="org.apache.karaf.jdbc.command.DeleteCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+            <completers>
+                <ref component-id="datasourcesCompleter"/>
+                <null/>
+            </completers>
+        </command>
+        <command>
+            <action class="org.apache.karaf.jdbc.command.DataSourcesCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+        </command>
+        <command>
+            <action class="org.apache.karaf.jdbc.command.QueryCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+            <completers>
+                <ref component-id="datasourcesCompleter"/>
+                <null/>
+            </completers>
+        </command>
+        <command>
+            <action class="org.apache.karaf.jdbc.command.ExecuteCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+            <completers>
+                <ref component-id="datasourcesCompleter"/>
+                <null/>
+            </completers>
+        </command>
+        <command>
+            <action class="org.apache.karaf.jdbc.command.InfoCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+            <completers>
+                <ref component-id="datasourcesCompleter"/>
+                <null/>
+            </completers>
+        </command>
+        <command>
+            <action class="org.apache.karaf.jdbc.command.TablesCommand">
+                <property name="jdbcService" ref="jdbcService"/>
+            </action>
+            <completers>
+                <ref component-id="datasourcesCompleter"/>
+                <null/>
+            </completers>
+        </command>
+    </command-bundle>
+
+    <bean id="datasourcesCompleter" class="org.apache.karaf.jdbc.command.completers.DataSourcesCompleter">
+        <property name="jdbcService" ref="jdbcService" />
+    </bean>
+
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/bundle.info
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/bundle.info?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/bundle.info (added)
+++ karaf/trunk/jdbc/command/src/main/resources/OSGI-INF/bundle.info Mon Dec 16 14:43:47 2013
@@ -0,0 +1,26 @@
+h1. Synopsis
+
+${project.name}
+
+${project.description}
+
+Maven URL:
+[mvn:${project.groupId}/${project.artifactId}/${project.version}]
+
+h1. Description
+
+This bundle provides the shell commands to manipulate the JDBC service.
+
+The following commands are available:
+
+* jdbc:datasource-create
+* jdbc:datasource-delete
+* jdbc:datasources
+* jdbc:command
+* jdbc:query
+* jdbc:tables
+* jdbc:info
+
+h1. See also
+
+JDBC - section of the Karaf User Guide
\ No newline at end of file

Added: karaf/trunk/jdbc/core/NOTICE
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/NOTICE?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/NOTICE (added)
+++ karaf/trunk/jdbc/core/NOTICE Mon Dec 16 14:43:47 2013
@@ -0,0 +1,71 @@
+Apache Karaf
+Copyright 2010-2013 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+OW2 (http://www.ow2.org/).
+Licensed under the BSD License.
+
+This product includes software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Eclipse Foundation (http://www.eclipse.org/).
+Licensed under the EPL.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+AOP Alliance (http://aopalliance.sourceforge.net/).
+Licensed under the Public Domain.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Jasypt (http://jasypt.sourceforge.net/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product uses software developed at
+SpringSource (http://www.springsource.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
+- EPL License
+- MIT License

Added: karaf/trunk/jdbc/core/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/pom.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/pom.xml (added)
+++ karaf/trunk/jdbc/core/pom.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.jdbc</groupId>
+        <artifactId>jdbc</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.karaf.jdbc.core</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: JDBC :: Core</name>
+    <description>This bundle provides core implement of the JDBC management service.</description>
+
+    <properties>
+        <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.info</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.apache.karaf.jdbc
+                        </Export-Package>
+                        <Private-Package>
+                            org.apache.karaf.jdbc.internal
+                        </Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java (added)
+++ karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcMBean.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,96 @@
+/*
+ * 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;
+
+import javax.management.MBeanException;
+import javax.management.openmbean.TabularData;
+import java.util.Map;
+
+/**
+ * JDBC MBean
+ */
+public interface JdbcMBean {
+
+    /**
+     * Get the list of JDBC datasources.
+     *
+     * @return a tabular data containing the list of JDBC datasources.
+     * @throws MBeanException
+     */
+    TabularData getDatasources() throws MBeanException;
+
+    /**
+     * Create a JDBC datasource.
+     *
+     * @param name the JDBC datasource name.
+     * @param type the JDBC datasource type (generic, MySQL, Oracle, Postgres, H2, HSQL, Derby).
+     * @param driver the JDBC datasource driver class name (can be null).
+     * @param version the target JDBC driver version (can be null).
+     * @param url the JDBC URL.
+     * @param user the database username.
+     * @param password the database password.
+     * @param installBundles true to install the bundles providing the JDBC driver, false to not install.
+     * @throws MBeanException
+     */
+    void create(String name, String type, String driver, String version, String url, String user, String password, boolean installBundles) throws MBeanException;
+
+    /**
+     * Delete a JDBC datasource.
+     *
+     * @param name the JDBC datasource name (the one used at creation time).
+     * @throws MBeanException
+     */
+    void delete(String name) throws MBeanException;
+
+    /**
+     * Get details about a JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @return a map (property/value) containing JDBC datasource details.
+     * @throws MBeanException
+     */
+    Map<String, String> info(String datasource) throws MBeanException;
+
+    /**
+     * Get the tables available on a JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @return a tabular data containg datasource tables.
+     * @throws MBeanException
+     */
+    TabularData tables(String datasource) throws MBeanException;
+
+    /**
+     * Execute a SQL command on a JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @param command the SQL command to execute.
+     * @throws MBeanException
+     */
+    void execute(String datasource, String command) throws MBeanException;
+
+    /**
+     * Execute a SQL query on a JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @param query the SQL query to execute.
+     * @return a tabular data with the result of execute (columns/values).
+     * @throws MBeanException
+     */
+    TabularData query(String datasource, String query) throws MBeanException;
+
+}

Added: karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcService.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcService.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcService.java (added)
+++ karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/JdbcService.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,88 @@
+/*
+ * 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;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JDBC Service.
+ */
+public interface JdbcService {
+
+    /**
+     * Create a JDBC datasource (using a default template).
+     *
+     * @param name the JDBC datasource name.
+     * @param type the backend database type (generic, Oracle, MySQL, ...)
+     * @param driverClassName the JDBC driver classname.
+     * @param version the JDBC driver version to use.
+     * @param url the JDBC URL.
+     * @param user the database user name.
+     * @param password the database password.
+     * @param tryToInstallBundles true to try to automatically install the required bundles (JDBC driver, etc) when possible, false else.
+     */
+    void create(String name, String type, String driverClassName, String version, String url, String user, String password, boolean tryToInstallBundles) throws Exception;
+
+    /**
+     * Delete a JDBC datasource identified by a name.
+     *
+     * @param name the JDBC datasource name.
+     */
+    void delete(String name) throws Exception;
+
+    /**
+     * List the JDBC datasources available.
+     *
+     * @return a list of datasources name.
+     */
+    List<String> datasources() throws Exception;
+
+    /**
+     * Execute a SQL query on a given JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @param query the SQL query to execute.
+     * @return the SQL query result (as a String).
+     */
+    Map<String, List<String>> query(String datasource, String query) throws Exception;
+
+    /**
+     * Execute a SQL command on a given JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @param command the SQL command to execute.
+     */
+    void execute(String datasource, String command) throws Exception;
+
+    /**
+     * List the tables available on a given JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @return the list of table names.
+     */
+    Map<String, List<String>> tables(String datasource) throws Exception;
+
+    /**
+     * Get detailed info about a JDBC datasource.
+     *
+     * @param datasource the JDBC datasource name.
+     * @return a map of info (name/value).
+     */
+    Map<String, String> info(String datasource) throws Exception;
+
+}

Added: karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java (added)
+++ karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcMBeanImpl.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,168 @@
+/*
+ * 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;
+
+import org.apache.karaf.jdbc.JdbcMBean;
+import org.apache.karaf.jdbc.JdbcService;
+
+import javax.management.MBeanException;
+import javax.management.openmbean.*;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Default implementation of the JDBC MBean.
+ */
+public class JdbcMBeanImpl implements JdbcMBean {
+
+    private JdbcService jdbcService;
+
+    @Override
+    public TabularData getDatasources() throws MBeanException {
+        try {
+            CompositeType type = new CompositeType("DataSource", "JDBC DataSource",
+                    new String[]{ "name", "product", "version", "url "},
+                    new String[]{ "JDBC DataSource Name", "Database product", "Database version", "JDBC URL" },
+                    new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING });
+            TabularType tableType = new TabularType("JDBC DataSources", "Table of the JDBC DataSources",
+                    type, new String[]{ "name" });
+            TabularData table = new TabularDataSupport(tableType);
+
+            for (String datasource : jdbcService.datasources()) {
+                Map<String, String> info = jdbcService.info(datasource);
+                CompositeData data = new CompositeDataSupport(type,
+                        new String[]{ "name", "product", "version", "url" },
+                        new Object[]{ datasource, info.get("db.product"), info.get("db.version"), info.get("url") });
+                table.put(data);
+            }
+
+            return table;
+        } catch (Exception e) {
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    @Override
+    public void create(String name, String type, String driver, String version, String url, String user, String password, boolean installBundles) throws MBeanException {
+        try {
+            jdbcService.create(name, type, driver, version, url, user, password, installBundles);
+        } catch (Exception e) {
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    @Override
+    public void delete(String name) throws MBeanException {
+        try {
+            jdbcService.delete(name);
+        } catch (Exception e) {
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    @Override
+    public Map<String, String> info(String datasource) throws MBeanException {
+        try {
+            return jdbcService.info(datasource);
+        } catch (Exception e) {
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    @Override
+    public TabularData tables(String datasource) throws MBeanException {
+        try {
+            Map<String, List<String>> result = jdbcService.tables(datasource);
+            OpenType[] stringTypes = new OpenType[result.keySet().size()];
+            for (int i = 0; i < stringTypes.length; i++) {
+                stringTypes[i] = SimpleType.STRING;
+            }
+            String[] columns = result.keySet().toArray(new String[result.keySet().size()]);
+
+            CompositeType type = new CompositeType("Columns", "Columns",
+                    columns, columns, stringTypes);
+            TabularType rows = new TabularType("Result", "Result Rows", type, columns);
+            TabularData table = new TabularDataSupport(rows);
+
+            int rowCount = result.get(result.keySet().iterator().next()).size();
+
+            for (int i = 0; i < rowCount; i++) {
+                Object[] row = new Object[columns.length];
+                for (int j = 0; j < columns.length; j++) {
+                    row[j] = result.get(columns[j]).get(i);
+                }
+                CompositeData data = new CompositeDataSupport(type, columns, row);
+                table.put(data);
+            }
+
+            return table;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    @Override
+    public void execute(String datasource, String command) throws MBeanException {
+        try {
+            jdbcService.execute(datasource, command);
+        } catch (Exception e) {
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    @Override
+    public TabularData query(String datasource, String query) throws MBeanException {
+        try {
+            Map<String, List<String>> result = jdbcService.query(datasource, query);
+            OpenType[] stringTypes = new OpenType[result.keySet().size()];
+            for (int i = 0; i < stringTypes.length; i++) {
+                stringTypes[i] = SimpleType.STRING;
+            }
+            String[] columns = result.keySet().toArray(new String[result.keySet().size()]);
+
+            CompositeType type = new CompositeType("Columns", "Columns",
+                    columns, columns, stringTypes);
+            TabularType rows = new TabularType("Result", "Result Rows", type, columns);
+            TabularData table = new TabularDataSupport(rows);
+
+            int rowCount = result.get(result.keySet().iterator().next()).size();
+
+            for (int i = 0; i < rowCount; i++) {
+                Object[] row = new Object[columns.length];
+                for (int j = 0; j < columns.length; j++) {
+                    row[j] = result.get(columns[j]).get(i);
+                }
+                CompositeData data = new CompositeDataSupport(type, columns, row);
+                table.put(data);
+            }
+
+            return table;
+        } catch (Exception e) {
+            throw new MBeanException(null, e.getMessage());
+        }
+    }
+
+    public JdbcService getJdbcService() {
+        return jdbcService;
+    }
+
+    public void setJdbcService(JdbcService jdbcService) {
+        this.jdbcService = jdbcService;
+    }
+
+}

Added: karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java (added)
+++ karaf/trunk/jdbc/core/src/main/java/org/apache/karaf/jdbc/internal/JdbcServiceImpl.java Mon Dec 16 14:43:47 2013
@@ -0,0 +1,309 @@
+/*
+ * 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;
+
+import org.apache.karaf.jdbc.JdbcService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+import javax.sql.DataSource;
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+
+/**
+ * Default implementation of the JDBC Service.
+ */
+public class JdbcServiceImpl implements JdbcService {
+
+    public static enum TYPES {
+        DB2("wrap:mvn:com.ibm.db2.jdbc/db2jcc/", "9.7", "datasource-db2.xml"),
+        DERBY("mvn:org.apache.derby/derby/", "10.8.2.2", "datasource-derby.xml"),
+        GENERIC(null, null, "datasource-generic.xml"),
+        H2("mvn:com.h2database/h2/", "1.3.163", "datasource-h2.xml"),
+        HSQL("mvn:com.h2database/h2/", "1.3.163", "datasource-hsql.xml"),
+        MYSQL("mvn:mysql/mysql-connector-java/", "5.1.18", "datasource-mysql.xml"),
+        ORACLE("wrap:mvn:ojdbc/ojdbc/", "11.2.0.2.0", "datasource-oracle.xml"),
+        POSTGRES("wrap:mvn:postgresql/postgresql/", "9.1-901.jdbc4", "datasource-postgres.xml");
+
+        private final String bundleUrl;
+        private final String defaultVersion;
+        private final String templateFile;
+
+        TYPES(String bundleUrl, String defaultVersion, String templateFile) {
+            this.bundleUrl = bundleUrl;
+            this.defaultVersion = defaultVersion;
+            this.templateFile = templateFile;
+        }
+
+        public void installBundle(BundleContext bundleContext, String version) throws Exception {
+            if (version != null) {
+                bundleContext.installBundle(this.bundleUrl + version, null).start();
+            } else {
+                bundleContext.installBundle(this.bundleUrl + this.defaultVersion, null).start();
+            }
+        }
+
+        public void copyDataSourceFile(File outFile, HashMap<String, String> properties) throws Exception {
+            if (!outFile.exists()) {
+                InputStream is = JdbcServiceImpl.class.getResourceAsStream(this.templateFile);
+                if (is == null) {
+                    throw new IllegalArgumentException("Resource " + this.templateFile + " doesn't exist");
+                }
+                try {
+                    // read it line at a time so that we can use the platform line ending when we write it out
+                    PrintStream out = new PrintStream(new FileOutputStream(outFile));
+                    try {
+                        Scanner scanner = new Scanner(is);
+                        while (scanner.hasNextLine()) {
+                            String line = scanner.nextLine();
+                            line = filter(line, properties);
+                            out.println(line);
+                        }
+                    } finally {
+                        safeClose(out);
+                    }
+                } finally {
+                    safeClose(is);
+                }
+            } else {
+                throw new IllegalArgumentException("File " + outFile.getPath() + " already exists. Remove it if you wish to recreate it.");
+            }
+        }
+
+        private void safeClose(InputStream is) throws IOException {
+            if (is == null)
+                return;
+            try {
+                is.close();
+            } catch (Throwable ignore) {
+                // nothing to do
+            }
+        }
+
+        private void safeClose(OutputStream is) throws IOException {
+            if (is == null)
+                return;
+            try {
+                is.close();
+            } catch (Throwable ignore) {
+                // nothing to do
+            }
+        }
+
+        private String filter(String line, HashMap<String, String> props) {
+            for (Map.Entry<String, String> i : props.entrySet()) {
+                int p1 = line.indexOf(i.getKey());
+                if (p1 >= 0) {
+                    String l1 = line.substring(0, p1);
+                    String l2 = line.substring(p1 + i.getKey().length());
+                    line = l1 + i.getValue() + l2;
+                }
+            }
+            return line;
+        }
+    }
+
+    private BundleContext bundleContext;
+
+    @Override
+    public void create(String name, String type, String driverClassName, String version, String url, String user, String password, boolean tryToInstallBundles) throws Exception {
+        if (tryToInstallBundles) {
+            TYPES.valueOf(type.toUpperCase()).installBundle(bundleContext, version);
+        }
+
+        File karafBase = new File(System.getProperty("karaf.base"));
+        File deployFolder = new File(karafBase, "deploy");
+        File outFile = new File(deployFolder, "datasource-" + name + ".xml");
+
+        HashMap<String, String> properties = new HashMap<String, String>();
+        properties.put("${name}", name);
+        properties.put("${driver}", driverClassName);
+        properties.put("${url}", url);
+        properties.put("${user}", user);
+        properties.put("${password}", password);
+
+        TYPES.valueOf(type.toUpperCase()).copyDataSourceFile(outFile, properties);
+    }
+
+    @Override
+    public void delete(String name) throws Exception {
+        File karafBase = new File(System.getProperty("karaf.base"));
+        File deployFolder = new File(karafBase, "deploy");
+        File datasourceFile = new File(deployFolder, "datasource-" + name + ".xml");
+        if (!datasourceFile.exists()) {
+            throw new IllegalArgumentException("The JDBC datasource file "+ datasourceFile.getPath() + " doesn't exist");
+        }
+        datasourceFile.delete();
+    }
+
+    @Override
+    public List<String> datasources() throws Exception {
+        List<String> datasources = new ArrayList<String>();
+        ServiceReference[] references = bundleContext.getServiceReferences(DataSource.class.getName(), null);
+        if (references != null) {
+            for (ServiceReference reference : references) {
+                if (reference.getProperty("osgi.jndi.service.name") != null) {
+                    datasources.add((String) reference.getProperty("osgi.jndi.service.name"));
+                } else if (reference.getProperty("datasource") != null) {
+                    datasources.add((String) reference.getProperty("datasource"));
+                } else if (reference.getProperty("name") != null) {
+                    datasources.add((String) reference.getProperty("name"));
+                } else {
+                    datasources.add(reference.getProperty(Constants.SERVICE_ID).toString());
+                }
+            }
+        }
+        return datasources;
+    }
+
+    @Override
+    public Map<String, List<String>> query(String datasource, String query) throws Exception {
+        Map<String, List<String>> map = new HashMap<String, List<String>>();
+        ServiceReference reference = this.lookupDataSource(datasource);
+        Connection connection = null;
+        Statement statement = null;
+        try {
+            DataSource ds = (DataSource) bundleContext.getService(reference);
+            connection = ds.getConnection();
+            statement = connection.createStatement();
+            ResultSet resultSet = statement.executeQuery(query);
+            ResultSetMetaData metaData = resultSet.getMetaData();
+            for (int c = 1; c <= metaData.getColumnCount(); c++) {
+                map.put(metaData.getColumnLabel(c), new ArrayList<String>());
+            }
+            while (resultSet.next()) {
+                for (int c = 1; c <= metaData.getColumnCount(); c++) {
+                    map.get(metaData.getColumnLabel(c)).add(resultSet.getString(c));
+                }
+            }
+            resultSet.close();
+        } finally {
+            if (statement != null) {
+                statement.close();
+            }
+            if (connection != null) {
+                connection.close();
+            }
+            if (reference != null) {
+                bundleContext.ungetService(reference);
+            }
+        }
+        return map;
+    }
+
+    @Override
+    public void execute(String datasource, String command) throws Exception {
+        ServiceReference reference = this.lookupDataSource(datasource);
+        Connection connection = null;
+        Statement statement = null;
+        try {
+            DataSource ds = (DataSource) bundleContext.getService(reference);
+            connection = ds.getConnection();
+            statement = connection.createStatement();
+            statement.execute(command);
+        } finally {
+            if (statement != null) {
+                statement.close();
+            }
+            if (connection != null) {
+                connection.close();
+            }
+            if (reference != null) {
+                bundleContext.ungetService(reference);
+            }
+        }
+    }
+
+    @Override
+    public Map<String, List<String>> tables(String datasource) throws Exception {
+        Map<String, List<String>> map = new HashMap<String, List<String>>();
+        ServiceReference reference = this.lookupDataSource(datasource);
+        Connection connection = null;
+        try {
+            DataSource ds = (DataSource) bundleContext.getService(reference);
+            connection = ds.getConnection();
+            DatabaseMetaData dbMetaData = connection.getMetaData();
+            ResultSet resultSet = dbMetaData.getTables(null, null, null, null);
+            ResultSetMetaData metaData = resultSet.getMetaData();
+            for (int c = 1; c <= metaData.getColumnCount(); c++) {
+                map.put(metaData.getColumnLabel(c), new ArrayList<String>());
+            }
+            while (resultSet.next()) {
+                for (int c = 1; c <= metaData.getColumnCount(); c++) {
+                    map.get(metaData.getColumnLabel(c)).add(resultSet.getString(c));
+                }
+            }
+            resultSet.close();
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+            if (reference != null) {
+                bundleContext.ungetService(reference);
+            }
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, String> info(String datasource) throws Exception {
+        Map<String, String> map = new HashMap<String, String>();
+        ServiceReference reference = this.lookupDataSource(datasource);
+        Connection connection = null;
+        try {
+            DataSource ds = (DataSource) bundleContext.getService(reference);
+            connection = ds.getConnection();
+            DatabaseMetaData dbMetaData = connection.getMetaData();
+            map.put("db.product", dbMetaData.getDatabaseProductName());
+            map.put("db.version", dbMetaData.getDatabaseProductVersion());
+            map.put("url", dbMetaData.getURL());
+            map.put("username", dbMetaData.getUserName());
+            map.put("driver.name", dbMetaData.getDriverName());
+            map.put("driver.version", dbMetaData.getDriverVersion());
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+            if (reference != null) {
+                bundleContext.ungetService(reference);
+            }
+        }
+        return map;
+    }
+
+    private ServiceReference lookupDataSource(String name) throws Exception {
+        ServiceReference[] references = bundleContext.getServiceReferences(DataSource.class.getName(), "(|(osgi.jndi.service.name=" + name + ")(datasource=" + name + ")(name=" + name + ")(service.id=" + name + "))");
+        if (references == null || references.length == 0) {
+            throw new IllegalArgumentException("No JDBC datasource found for " + name);
+        }
+        if (references.length > 1) {
+            throw new IllegalArgumentException("Multiple JDBC datasource found for " + name);
+        }
+        return references[0];
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+}

Added: karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/blueprint/jdbc-core.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,41 @@
+<?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

Added: karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/bundle.info
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/bundle.info?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/bundle.info (added)
+++ karaf/trunk/jdbc/core/src/main/resources/OSGI-INF/bundle.info Mon Dec 16 14:43:47 2013
@@ -0,0 +1,18 @@
+h1. Synopsis
+
+${project.name}
+
+${project.description}
+
+Maven URL:
+[mvn:${project.groupId}/${project.artifactId}/${project.version}]
+
+h1. Description
+
+This bundle is the core implementation of the JDBC service support.
+
+The JDBC service allows you to create datasources, see the defined datasources, execute query on a datasource, etc.
+
+h1. See also
+
+JDBC - section of the Karaf User Guide

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-db2.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-db2.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-db2.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-db2.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" class="com.ibm.db2.jcc.DB2DataSource">
+        <property name="url" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${password}"/>
+    </bean>
+
+    <service interface="javax.sql.DataSource" ref="dataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="/jdbc/${name}"/>
+        </service-properties>
+    </service>
+
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-derby.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-derby.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-derby.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-derby.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           default-activation="eager">
+
+    <bean id="dataSource" class="org.apache.derby.jdbc.EmbeddedXADataSource">
+        <property name="databaseName" value="${name}"/>
+        <property name="createDatabase" value="create" />
+    </bean>
+
+    <service ref="dataSource" interface="javax.sql.DataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="/jdbc/${name}"/>
+        </service-properties>
+    </service>
+
+    <service ref="dataSource" interface="javax.sql.XADataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="/jdbc/${name}xa"/>
+        </service-properties>
+    </service>
+
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-generic.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-generic.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-generic.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-generic.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
+        <property name="driverClassName" value="${driver}"/>
+        <property name="url" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${password}"/>
+    </bean>
+
+    <service ref="dataSource" interface="javax.sql.DataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="/jdbc/${name}"/>
+        </service-properties>
+    </service>
+
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-h2.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-h2.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-h2.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-h2.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
+        <property name="URL" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${password}"/>
+    </bean>
+
+    <service interface="javax.sql.DataSource" ref="dataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="jdbc/${name}"/>
+        </service-properties>
+    </service>
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-hsql.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-hsql.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-hsql.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-hsql.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" class="org.hsqldb.jdbc.JDBCDataSource">
+        <property name="URL" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${password}"/>
+    </bean>
+
+    <service interface="javax.sql.DataSource" ref="dataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="jdbc/${name}"/>
+        </service-properties>
+    </service>
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-mysql.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-mysql.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-mysql.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-mysql.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
+        <property name="url" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${test}"/>
+    </bean>
+
+    <service interface="javax.sql.DataSource" ref="dataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="jdbc/${name}"/>
+        </service-properties>
+    </service>
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-oracle.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-oracle.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-oracle.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-oracle.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource">
+        <property name="URL" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${password}"/>
+    </bean>
+
+    <service interface="javax.sql.DataSource" ref="dataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="jdbc/${name}"/>
+        </service-properties>
+    </service>
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-postgres.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-postgres.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-postgres.xml (added)
+++ karaf/trunk/jdbc/core/src/main/resources/org/apache/karaf/jdbc/internal/datasource-postgres.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="dataSource" class="org.postgresql.ds.PGPoolingDataSource" destroy-method="close">
+        <property name="serverName" value="${url}"/>
+        <property name="user" value="${user}"/>
+        <property name="password" value="${password}"/>
+        <property name="dataSourceName" value="${name}"/>
+        <property name="initialConnections" value="2"/>
+        <property name="maxConnections" value="4" />
+    </bean>
+
+    <service interface="javax.sql.DataSource" ref="dataSource">
+        <service-properties>
+            <entry key="osgi.jndi.service.name" value="jdbc/${name}"/>
+        </service-properties>
+    </service>
+</blueprint>
\ No newline at end of file

Added: karaf/trunk/jdbc/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jdbc/pom.xml?rev=1551219&view=auto
==============================================================================
--- karaf/trunk/jdbc/pom.xml (added)
+++ karaf/trunk/jdbc/pom.xml Mon Dec 16 14:43:47 2013
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf</groupId>
+        <artifactId>karaf</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.apache.karaf.jdbc</groupId>
+    <artifactId>jdbc</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Karaf :: JDBC</name>
+
+    <modules>
+        <module>core</module>
+        <module>command</module>
+    </modules>
+
+</project>
\ No newline at end of file

Modified: karaf/trunk/manual/src/main/webapp/_navigation.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/_navigation.conf?rev=1551219&r1=1551218&r2=1551219&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/_navigation.conf (original)
+++ karaf/trunk/manual/src/main/webapp/_navigation.conf Mon Dec 16 14:43:47 2013
@@ -22,9 +22,9 @@ h3. [Users Guide|/users-guide/index]
 - [OBR|/users-guide/obr]
 - [Enterprise|/users-guide/enterprise]
 -- [WebContainer (JSP/Servlet)|/users-guide/webcontainer]
--- Naming (JNDI)
+-- [Naming (JNDI)|/users-guide/jndi]
 -- Transaction (JTA)
--- DataSource (JDBC)
+-- [DataSource (JDBC)|/users-guide/jdbc]
 -- MOM (JMS)
 -- Persistence (JPA)
 -- OpenEJB