// Path: java/src/org/drupal/project/computing/exception/DConfigException.java
// public class DConfigException extends Exception {
//     public DConfigException() {
//     }
// 
//     public DConfigException(String s) {
//         super(s);
//     }
// 
//     public DConfigException(String s, Throwable throwable) {
//         super(s, throwable);
//     }
// 
//     public DConfigException(Throwable throwable) {
//         super(throwable);
//     }
// }
// 
// Path: java/src/org/drupal/project/computing/exception/DNotFoundException.java
// public class DNotFoundException extends Exception {
//     public DNotFoundException() {}
// 
//     public DNotFoundException(String s) {
//         super(s);
//     }
// }


import org.apache.commons.lang3.StringUtils;
import org.drupal.project.computing.exception.DConfigException;
import org.drupal.project.computing.exception.DNotFoundException;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.logging.Logger;
    public String getDatabaseUrl() throws DConfigException {
        String url = getProperty("dcomp.database.url", "");
        if (StringUtils.isNotBlank(url)) {
            return url;
        } else {
            throw new DConfigException("Cannot find 'dcomp.database.url' settings.");
        }
    }


    /**
     * Try to read "dcomp.database.properties.*" in config.properties.
     * Requires to have "driver", "database", "username", "password" and "host" to be considered as valid.
     * See more about db settings in Drupal settings.php.
     * Extra parameters will be passed to database connection too.
     *
     * @return The database properties as defined in dcomp.database.properties.*. Or throws DNotFoundException.
     * @see <a href="http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html">Simple MySQL example</a>
     * @see <a href="http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html">MySQL connection properties</a>
     */
    public Properties getDatabaseProperties() throws DNotFoundException {
        Properties dbProperties = new Properties();
        for (String key : properties.stringPropertyNames()) {
            if (key.startsWith("dcomp.database.properties.")) {
                dbProperties.put(key.substring("dcomp.database.properties.".length()), properties.getProperty(key));
            }
        }
        if (!dbProperties.isEmpty()) {
            return dbProperties;
        } else {
// Path: java/src/org/drupal/project/computing/exception/DConfigException.java
// public class DConfigException extends Exception {
//     public DConfigException() {
//     }
// 
//     public DConfigException(String s) {
//         super(s);
//     }
// 
//     public DConfigException(String s, Throwable throwable) {
//         super(s, throwable);
//     }
// 
//     public DConfigException(Throwable throwable) {
//         super(throwable);
//     }
// }
// 
// Path: java/src/org/drupal/project/computing/exception/DNotFoundException.java
// public class DNotFoundException extends Exception {
//     public DNotFoundException() {}
// 
//     public DNotFoundException(String s) {
//         super(s);
//     }
// }


// Path: java/src/org/drupal/project/computing/DConfig.java
import org.apache.commons.lang3.StringUtils;
import org.drupal.project.computing.exception.DConfigException;
import org.drupal.project.computing.exception.DNotFoundException;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.logging.Logger;

    public String getDatabaseUrl() throws DConfigException {
        String url = getProperty("dcomp.database.url", "");
        if (StringUtils.isNotBlank(url)) {
            return url;
        } else {
            throw new DConfigException("Cannot find 'dcomp.database.url' settings.");
        }
    }


    /**
     * Try to read "dcomp.database.properties.*" in config.properties.
     * Requires to have "driver", "database", "username", "password" and "host" to be considered as valid.
     * See more about db settings in Drupal settings.php.
     * Extra parameters will be passed to database connection too.
     *
     * @return The database properties as defined in dcomp.database.properties.*. Or throws DNotFoundException.
     * @see <a href="http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html">Simple MySQL example</a>
     * @see <a href="http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html">MySQL connection properties</a>
     */
    public Properties getDatabaseProperties() throws DNotFoundException {
        Properties dbProperties = new Properties();
        for (String key : properties.stringPropertyNames()) {
            if (key.startsWith("dcomp.database.properties.")) {
                dbProperties.put(key.substring("dcomp.database.properties.".length()), properties.getProperty(key));
            }
        }
        if (!dbProperties.isEmpty()) {
            return dbProperties;
        } else {
            throw new DNotFoundException("Cannot find database configuration properties.");