// Path: flexiblepower.ral/src/org/flexiblepower/ral/ResourceControlParameters.java
// public interface ResourceControlParameters {
// 
// }
// 
// Path: flexiblepower.ral/src/org/flexiblepower/ral/ResourceManager.java
// @Port(name = "controller")
// public interface ResourceManager extends Endpoint {
// }
// 
// Path: flexiblepower.ral/src/org/flexiblepower/ral/messages/AllocationStatusUpdate.java
// public final class AllocationStatusUpdate extends ResourceMessage {
//     private final UUID allocationId;
//     private final AllocationStatus status;
//     private final String additionalInfo;
// 
//     /**
//      * @param timestamp
//      *            The moment when this constructor is called
//      *
//      * @param allocation
//      *            the {@link Allocation} to which this update is the response
//      * @param status
//      *            This attribute indicates the current status of the {@link Allocation}. It assumes one of the values
//      *            specified in the {@link AllocationStatus} enumeration.
//      * @param additionalInfo
//      *            In addition to the status attribute additional and more specific information can be expressed in a
//      *            human readable format.
//      */
//     public AllocationStatusUpdate(Date timestamp, Allocation allocation, AllocationStatus status, String additionalInfo) {
//         this(allocation.getResourceId(), timestamp, allocation.getResourceMessageId(), status, additionalInfo);
//     }
// 
//     /**
//      * @param resourceId
//      *            The resource identifier
//      * @param timestamp
//      *            The moment when this constructor is called
//      * @param allocationId
//      *            An identifier that uniquely identifies the {@link Allocation} message that this update refers to (the
//      *            {@link Allocation#getResourceMessageId()}).
//      * @param status
//      *            This attribute indicates the current status of the {@link Allocation}. It assumes one of the values
//      *            specified in the {@link AllocationStatus} enumeration.
//      * @param additionalInfo
//      *            In addition to the status attribute additional and more specific information can be expressed in a
//      *            human readable format.
//      */
//     public AllocationStatusUpdate(String resourceId,
//                                   Date timestamp,
//                                   UUID allocationId,
//                                   AllocationStatus status,
//                                   String additionalInfo) {
//         super(resourceId, timestamp);
//         if (allocationId == null) {
//             throw new NullPointerException("allocationId");
//         } else if (status == null) {
//             throw new NullPointerException("status");
//         }
// 
//         this.allocationId = allocationId;
//         this.status = status;
//         this.additionalInfo = additionalInfo == null ? "No additional information" : additionalInfo;
//     }
// 
//     /**
//      * @return An identifier that uniquely identifies the {@link Allocation} message that this update refers to (the
//      *         {@link Allocation#getResourceMessageId()}).
//      */
//     public UUID getAllocationId() {
//         return allocationId;
//     }
// 
//     /**
//      * @return This attribute indicates the current status of the {@link Allocation}. It assumes one of the values
//      *         specified in the {@link AllocationStatus} enumeration.
//      */
//     public AllocationStatus getStatus() {
//         return status;
//     }
// 
//     /**
//      * @return In addition to the status attribute additional and more specific information can be expressed in a human
//      *         readable format.
//      */
//     public String getAdditionalInfo() {
//         return additionalInfo;
//     }
// 
//     @Override
//     public int hashCode() {
//         final int prime = 31;
//         int result = super.hashCode();
//         result = prime * result + allocationId.hashCode();
//         result = prime * result + status.hashCode();
//         result = prime * result + additionalInfo.hashCode();
//         return result;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (!super.equals(obj)) {
//             return false;
//         }
// 
//         AllocationStatusUpdate other = (AllocationStatusUpdate) obj;
//         if (!additionalInfo.equals(other.additionalInfo)) {
//             return false;
//         } else if (!allocationId.equals(other.allocationId)) {
//             return false;
//         } else if (status != other.status) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     protected void toString(StringBuilder sb) {
//         super.toString(sb);
//         sb.append("allocationId=").append(allocationId).append(", ");
//         sb.append("status=").append(status).append(", ");
//         sb.append("additionalInfo=").append(additionalInfo).append(", ");
//     }
// }
// 
// Path: flexiblepower.ral/src/org/flexiblepower/ral/messages/ControlSpaceRevoke.java
// public class ControlSpaceRevoke extends ResourceMessage {
//     /**
//      * Creates a new {@link ControlSpaceRevoke} message for a specific resource.
//      *
//      * @param resourceId
//      *            The resource identifier
//      * @param timestamp
//      *            The moment when this constructor is called
//      */
//     public ControlSpaceRevoke(String resourceId, Date timestamp) {
//         super(resourceId, timestamp);
//     }
// }


import java.util.List;
import org.flexiblepower.messaging.Connection;
import org.flexiblepower.messaging.MessageHandler;
import org.flexiblepower.ral.ControllerManager;
import org.flexiblepower.ral.ResourceControlParameters;
import org.flexiblepower.ral.ResourceDriver;
import org.flexiblepower.ral.ResourceManager;
import org.flexiblepower.ral.ResourceState;
import org.flexiblepower.ral.messages.Allocation;
import org.flexiblepower.ral.messages.AllocationStatusUpdate;
import org.flexiblepower.ral.messages.ControlSpaceRevoke;
import org.flexiblepower.ral.messages.ResourceMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
                }
            };
        }
        return null;
    }

    /**
     * Indicate if this {@link ResourceManager} is currently connected to a {@link ControllerManager}.
     *
     * @return boolean indicating if this {@link ResourceManager} is currently connected to a {@link ControllerManager}
     */
    protected boolean isConnectedWithResourceController() {
        return controllerConnection != null;
    }

    /**
     * Indicate if this {@link ResourceManager} is currently connected to a {@link ResourceDriver}.
     *
     * @return boolean indicating if this {@link ResourceManager} is currently connected to a {@link ResourceDriver}
     */
    protected boolean isConnectedWithResourceDriver() {
        return driverConnection != null;
    }

    /**
     * Send status update to attached controller.
     *
     * @param allocationStatusUpdate
     *            The {@link AllocationStatusUpdate} that is to be sent to the controller.
     */
// Path: flexiblepower.ral/src/org/flexiblepower/ral/ResourceControlParameters.java
// public interface ResourceControlParameters {
// 
// }
// 
// Path: flexiblepower.ral/src/org/flexiblepower/ral/ResourceManager.java
// @Port(name = "controller")
// public interface ResourceManager extends Endpoint {
// }
// 
// Path: flexiblepower.ral/src/org/flexiblepower/ral/messages/AllocationStatusUpdate.java
// public final class AllocationStatusUpdate extends ResourceMessage {
//     private final UUID allocationId;
//     private final AllocationStatus status;
//     private final String additionalInfo;
// 
//     /**
//      * @param timestamp
//      *            The moment when this constructor is called
//      *
//      * @param allocation
//      *            the {@link Allocation} to which this update is the response
//      * @param status
//      *            This attribute indicates the current status of the {@link Allocation}. It assumes one of the values
//      *            specified in the {@link AllocationStatus} enumeration.
//      * @param additionalInfo
//      *            In addition to the status attribute additional and more specific information can be expressed in a
//      *            human readable format.
//      */
//     public AllocationStatusUpdate(Date timestamp, Allocation allocation, AllocationStatus status, String additionalInfo) {
//         this(allocation.getResourceId(), timestamp, allocation.getResourceMessageId(), status, additionalInfo);
//     }
// 
//     /**
//      * @param resourceId
//      *            The resource identifier
//      * @param timestamp
//      *            The moment when this constructor is called
//      * @param allocationId
//      *            An identifier that uniquely identifies the {@link Allocation} message that this update refers to (the
//      *            {@link Allocation#getResourceMessageId()}).
//      * @param status
//      *            This attribute indicates the current status of the {@link Allocation}. It assumes one of the values
//      *            specified in the {@link AllocationStatus} enumeration.
//      * @param additionalInfo
//      *            In addition to the status attribute additional and more specific information can be expressed in a
//      *            human readable format.
//      */
//     public AllocationStatusUpdate(String resourceId,
//                                   Date timestamp,
//                                   UUID allocationId,
//                                   AllocationStatus status,
//                                   String additionalInfo) {
//         super(resourceId, timestamp);
//         if (allocationId == null) {
//             throw new NullPointerException("allocationId");
//         } else if (status == null) {
//             throw new NullPointerException("status");
//         }
// 
//         this.allocationId = allocationId;
//         this.status = status;
//         this.additionalInfo = additionalInfo == null ? "No additional information" : additionalInfo;
//     }
// 
//     /**
//      * @return An identifier that uniquely identifies the {@link Allocation} message that this update refers to (the
//      *         {@link Allocation#getResourceMessageId()}).
//      */
//     public UUID getAllocationId() {
//         return allocationId;
//     }
// 
//     /**
//      * @return This attribute indicates the current status of the {@link Allocation}. It assumes one of the values
//      *         specified in the {@link AllocationStatus} enumeration.
//      */
//     public AllocationStatus getStatus() {
//         return status;
//     }
// 
//     /**
//      * @return In addition to the status attribute additional and more specific information can be expressed in a human
//      *         readable format.
//      */
//     public String getAdditionalInfo() {
//         return additionalInfo;
//     }
// 
//     @Override
//     public int hashCode() {
//         final int prime = 31;
//         int result = super.hashCode();
//         result = prime * result + allocationId.hashCode();
//         result = prime * result + status.hashCode();
//         result = prime * result + additionalInfo.hashCode();
//         return result;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (!super.equals(obj)) {
//             return false;
//         }
// 
//         AllocationStatusUpdate other = (AllocationStatusUpdate) obj;
//         if (!additionalInfo.equals(other.additionalInfo)) {
//             return false;
//         } else if (!allocationId.equals(other.allocationId)) {
//             return false;
//         } else if (status != other.status) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     protected void toString(StringBuilder sb) {
//         super.toString(sb);
//         sb.append("allocationId=").append(allocationId).append(", ");
//         sb.append("status=").append(status).append(", ");
//         sb.append("additionalInfo=").append(additionalInfo).append(", ");
//     }
// }
// 
// Path: flexiblepower.ral/src/org/flexiblepower/ral/messages/ControlSpaceRevoke.java
// public class ControlSpaceRevoke extends ResourceMessage {
//     /**
//      * Creates a new {@link ControlSpaceRevoke} message for a specific resource.
//      *
//      * @param resourceId
//      *            The resource identifier
//      * @param timestamp
//      *            The moment when this constructor is called
//      */
//     public ControlSpaceRevoke(String resourceId, Date timestamp) {
//         super(resourceId, timestamp);
//     }
// }


// Path: flexiblepower.ral.ext/src/org/flexiblepower/ral/ext/AbstractResourceManager.java
import java.util.List;
import org.flexiblepower.messaging.Connection;
import org.flexiblepower.messaging.MessageHandler;
import org.flexiblepower.ral.ControllerManager;
import org.flexiblepower.ral.ResourceControlParameters;
import org.flexiblepower.ral.ResourceDriver;
import org.flexiblepower.ral.ResourceManager;
import org.flexiblepower.ral.ResourceState;
import org.flexiblepower.ral.messages.Allocation;
import org.flexiblepower.ral.messages.AllocationStatusUpdate;
import org.flexiblepower.ral.messages.ControlSpaceRevoke;
import org.flexiblepower.ral.messages.ResourceMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

                }
            };
        }
        return null;
    }

    /**
     * Indicate if this {@link ResourceManager} is currently connected to a {@link ControllerManager}.
     *
     * @return boolean indicating if this {@link ResourceManager} is currently connected to a {@link ControllerManager}
     */
    protected boolean isConnectedWithResourceController() {
        return controllerConnection != null;
    }

    /**
     * Indicate if this {@link ResourceManager} is currently connected to a {@link ResourceDriver}.
     *
     * @return boolean indicating if this {@link ResourceManager} is currently connected to a {@link ResourceDriver}
     */
    protected boolean isConnectedWithResourceDriver() {
        return driverConnection != null;
    }

    /**
     * Send status update to attached controller.
     *
     * @param allocationStatusUpdate
     *            The {@link AllocationStatusUpdate} that is to be sent to the controller.
     */
    protected void allocationStatusUpdate(AllocationStatusUpdate allocationStatusUpdate) {