EMMA Coverage Report (generated Sun Mar 01 22:06:14 CET 2015)
[all classes][org.h2.util]

COVERAGE SUMMARY FOR SOURCE FILE [DbDriverActivator.java]

nameclass, %method, %block, %line, %
DbDriverActivator.java100% (1/1)0%   (0/3)0%   (0/17)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DbDriverActivator100% (1/1)0%   (0/3)0%   (0/17)0%   (0/10)
DbDriverActivator (): void 0%   (0/1)0%   (0/3)0%   (0/1)
start (BundleContext): void 0%   (0/1)0%   (0/12)0%   (0/7)
stop (BundleContext): void 0%   (0/1)0%   (0/2)0%   (0/2)

1/*
2 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (http://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6package org.h2.util;
7 
8import org.osgi.framework.BundleActivator;
9import org.osgi.framework.BundleContext;
10 
11/**
12 * The driver activator loads the H2 driver when starting the bundle. The driver
13 * is unloaded when stopping the bundle.
14 */
15public class DbDriverActivator implements BundleActivator {
16 
17    private static final String DATASOURCE_FACTORY_CLASS =
18            "org.osgi.service.jdbc.DataSourceFactory";
19 
20    /**
21     * Start the bundle. If the 'org.osgi.service.jdbc.DataSourceFactory' class
22     * is available in the class path, this will load the database driver and
23     * register the DataSourceFactory service.
24     *
25     * @param bundleContext the bundle context
26     */
27    @Override
28    public void start(BundleContext bundleContext) {
29        org.h2.Driver driver = org.h2.Driver.load();
30        try {
31            JdbcUtils.loadUserClass(DATASOURCE_FACTORY_CLASS);
32        } catch (Exception e) {
33            // class not found - don't register
34            return;
35        }
36        // but don't ignore exceptions in this call
37        OsgiDataSourceFactory.registerService(bundleContext, driver);
38    }
39 
40    /**
41     * Stop the bundle. This will unload the database driver. The
42     * DataSourceFactory service is implicitly un-registered by the OSGi
43     * framework.
44     *
45     * @param bundleContext the bundle context
46     */
47    @Override
48    public void stop(BundleContext bundleContext) {
49        org.h2.Driver.unload();
50    }
51 
52}

[all classes][org.h2.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov