// 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/exception/DSiteException.java
// public class DSiteException extends Exception {
//     public DSiteException() {
//         super();
//     }
// 
//     public DSiteException(String s) {
//         super(s);
//     }
// 
//     public DSiteException(String s, Throwable throwable) {
//         super(s, throwable);
//     }
// 
//     public DSiteException(Throwable throwable) {
//         super(throwable);
//     }
// 
//     /**
//      * The error code is arbitrary by the caller which sets it.
//      */
//     private int errorCode = 0;
// 
//     public int getErrorCode() {
//         return errorCode;
//     }
// 
//     public void setErrorCode(int errorCode) {
//         this.errorCode = errorCode;
//     }
// 
// }


import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import org.apache.commons.lang3.StringUtils;
import org.drupal.project.computing.exception.DNotFoundException;
import org.drupal.project.computing.exception.DSiteException;
import javax.script.Bindings;
package org.drupal.project.computing;




/**
 * The Drupal site instance that can be accessed directly through drush.
 */
public class DDrushSite extends DSite implements DSiteExtended {

    private DDrush drush;

    public DDrushSite(DDrush drush) {
        this.drush = drush;
    }

    /**
     * Factory method. Create DDrushSite using default config.properties file.
     * @return Default DDrushSite object.
     */
    public static DDrushSite loadDefault() {
        return new DDrushSite(DDrush.loadDefault());
    }

    /**
     * each Drush site would be able to return a database connection.
     * although remote drupal site usually has "localhost" as host. If that's the case, remote site could use
     * $databases['computing']['default'] is settings.php to get a valid connection
     *
     * @return DDatabase connection. Caller is responsible to close it.
     */
//    @Deprecated
//    public DDatabase getDatabase() throws DSiteException {
//        DConfig config = new DConfig();
//        config.setProperty("drupal.drush", drush.getDrushExec());
//        try {
//            Properties dbProperties = config.getDbProperties();
//            DDatabase db = new DDatabase(dbProperties);
//            return db;
//        } catch (DConfigException e) {
//            throw new DSiteException("Cannot get database connection to Drupal with drush. Please read documentations.", e);
//        }
//    }


    public DDrush getDrush() {
        return drush;
    }


    @Override
// 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/exception/DSiteException.java
// public class DSiteException extends Exception {
//     public DSiteException() {
//         super();
//     }
// 
//     public DSiteException(String s) {
//         super(s);
//     }
// 
//     public DSiteException(String s, Throwable throwable) {
//         super(s, throwable);
//     }
// 
//     public DSiteException(Throwable throwable) {
//         super(throwable);
//     }
// 
//     /**
//      * The error code is arbitrary by the caller which sets it.
//      */
//     private int errorCode = 0;
// 
//     public int getErrorCode() {
//         return errorCode;
//     }
// 
//     public void setErrorCode(int errorCode) {
//         this.errorCode = errorCode;
//     }
// 
// }


// Path: java/src/org/drupal/project/computing/DDrushSite.java
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import org.apache.commons.lang3.StringUtils;
import org.drupal.project.computing.exception.DNotFoundException;
import org.drupal.project.computing.exception.DSiteException;
import javax.script.Bindings;

package org.drupal.project.computing;




/**
 * The Drupal site instance that can be accessed directly through drush.
 */
public class DDrushSite extends DSite implements DSiteExtended {

    private DDrush drush;

    public DDrushSite(DDrush drush) {
        this.drush = drush;
    }

    /**
     * Factory method. Create DDrushSite using default config.properties file.
     * @return Default DDrushSite object.
     */
    public static DDrushSite loadDefault() {
        return new DDrushSite(DDrush.loadDefault());
    }

    /**
     * each Drush site would be able to return a database connection.
     * although remote drupal site usually has "localhost" as host. If that's the case, remote site could use
     * $databases['computing']['default'] is settings.php to get a valid connection
     *
     * @return DDatabase connection. Caller is responsible to close it.
     */
//    @Deprecated
//    public DDatabase getDatabase() throws DSiteException {
//        DConfig config = new DConfig();
//        config.setProperty("drupal.drush", drush.getDrushExec());
//        try {
//            Properties dbProperties = config.getDbProperties();
//            DDatabase db = new DDatabase(dbProperties);
//            return db;
//        } catch (DConfigException e) {
//            throw new DSiteException("Cannot get database connection to Drupal with drush. Please read documentations.", e);
//        }
//    }


    public DDrush getDrush() {
        return drush;
    }


    @Override
    public String getDrupalVersion() throws DSiteException {