@Override
    public void start() {
        final Path databaseDir = JiveGlobals.getHomePath().resolve("embedded-db");
        try {
            // If the database doesn't exist, create it.
            if (!Files.exists(databaseDir)) {
                Files.createDirectory(databaseDir);
            }
        } catch (IOException e) {
            Log.error("Unable to create 'embedded-db' directory", e);
        }

        serverURL = "jdbc:hsqldb:" + databaseDir.resolve("openfire");
        final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(serverURL, "sa", "");
        final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null);
        poolableConnectionFactory.setMaxConnLifetimeMillis(Duration.ofHours(12).toMillis());

        final GenericObjectPoolConfig<PoolableConnection> poolConfig = new GenericObjectPoolConfig<>();
        poolConfig.setMinIdle(3);
        poolConfig.setMaxTotal(25);
        final GenericObjectPool<PoolableConnection> connectionPool = new GenericObjectPool<>(poolableConnectionFactory, poolConfig);
        poolableConnectionFactory.setPool(connectionPool);
        dataSource = new PoolingDataSource<>(connectionPool);
    }
A connection provider for the embedded hsqlDB database. The database file is stored at
{@code home/database}. The log file for this connection provider is stored at
{@code [home]/logs/EmbeddedConnectionProvider.log}, so you should ensure
that the {@code [home]/logs} directory exists.

@author Matt Tucker
xmppserver/src/main/java/org/jivesoftware/database/EmbeddedConnectionProvider.java