// 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/DRuntimeException.java
// public class DRuntimeException extends RuntimeException {
// 
//     public DRuntimeException() {
//         super();
//     }
// 
//     public DRuntimeException(String s) {
//         super(s);
//     }
// 
//     public DRuntimeException(String s, Throwable throwable) {
//         super(s, throwable);
//     }
// 
//     public DRuntimeException(Throwable throwable) {
//         super(throwable);
//     }
// }
// 
// 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 org.drupal.project.computing.exception.DNotFoundException;
import org.drupal.project.computing.exception.DRuntimeException;
import org.drupal.project.computing.exception.DSiteException;
import java.util.logging.Logger;
package org.drupal.project.computing;



/**
 * <p>This is the super class to model a Drupal site. A Drupal Computing application will use a DSite class to connect
 * to Drupal sites. The suggested way to pass data between applications and Drupal site is through the DRecord objects
 * (maps to a Computing Entity). You would have your Drupal module write input data to a record, and then your
 * application read it and write results back to the output field in the record, and your Drupal module can read data
 * back to the database.</p>
 *
 * <p>Here we don't require DSite to offer nodeLoad(), nodeSave(), or userLoad(), which might be defined in
 * DSiteExtended. If your application needs to read nodes, the Drupal part of your application will write the node info
 * into the "input" field of computing_record, and then your Java application can read it. However, we don't prevent
 * subclasses to provide a nodeLoad() method. If you use DDrushSite in particular, you can call any Drupal API with
 * drush. Also, you can use DDatabase to access Drupal database directly, but it's not recommended.</p>
 *
 * <p>Some sub-class implementations: DServicesSite, DDrushSite</p>
 */
abstract public class DSite {

    protected Logger logger = DUtils.getInstance().getPackageLogger();


    /**
     * Get one available computing record from Drupal to process. Drupal will handle the logic of providing the record.
     * If there's no record to return, throw DNotFoundException.
     *
     * @param appName the Application name to claim a record.
     * @return A computing record to handle, or NULL is none is found.
     */
// 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/DRuntimeException.java
// public class DRuntimeException extends RuntimeException {
// 
//     public DRuntimeException() {
//         super();
//     }
// 
//     public DRuntimeException(String s) {
//         super(s);
//     }
// 
//     public DRuntimeException(String s, Throwable throwable) {
//         super(s, throwable);
//     }
// 
//     public DRuntimeException(Throwable throwable) {
//         super(throwable);
//     }
// }
// 
// 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/DSite.java
import org.drupal.project.computing.exception.DNotFoundException;
import org.drupal.project.computing.exception.DRuntimeException;
import org.drupal.project.computing.exception.DSiteException;
import java.util.logging.Logger;

package org.drupal.project.computing;



/**
 * <p>This is the super class to model a Drupal site. A Drupal Computing application will use a DSite class to connect
 * to Drupal sites. The suggested way to pass data between applications and Drupal site is through the DRecord objects
 * (maps to a Computing Entity). You would have your Drupal module write input data to a record, and then your
 * application read it and write results back to the output field in the record, and your Drupal module can read data
 * back to the database.</p>
 *
 * <p>Here we don't require DSite to offer nodeLoad(), nodeSave(), or userLoad(), which might be defined in
 * DSiteExtended. If your application needs to read nodes, the Drupal part of your application will write the node info
 * into the "input" field of computing_record, and then your Java application can read it. However, we don't prevent
 * subclasses to provide a nodeLoad() method. If you use DDrushSite in particular, you can call any Drupal API with
 * drush. Also, you can use DDatabase to access Drupal database directly, but it's not recommended.</p>
 *
 * <p>Some sub-class implementations: DServicesSite, DDrushSite</p>
 */
abstract public class DSite {

    protected Logger logger = DUtils.getInstance().getPackageLogger();


    /**
     * Get one available computing record from Drupal to process. Drupal will handle the logic of providing the record.
     * If there's no record to return, throw DNotFoundException.
     *
     * @param appName the Application name to claim a record.
     * @return A computing record to handle, or NULL is none is found.
     */
    abstract public DRecord claimRecord(String appName) throws DSiteException, DNotFoundException;