// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/api/SetSpaceResponse.java
// public class SetSpaceResponse {
// 
// 	public enum ResponseCode {
// 		OK, ERROR
// 	};
// 
// 	@JsonProperty("status")
// 	private final ResponseCode responseCode;
// 	@JsonProperty("message")
// 	private final String message;
// 
// 	public SetSpaceResponse(ResponseCode code, String message) {
// 		this.responseCode = code;
// 		this.message = message;
// 	}
// 
// 	public static SetSpaceResponse okResponse() {
// 		return new SetSpaceResponse(ResponseCode.OK, null);
// 	}
// 
// 	public ResponseCode getResponseCode() {
// 		return responseCode;
// 	}
// 
// 	public String getMessage() {
// 		return message;
// 	}
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/services/ClusterDiskSpaceManager.java
// public class ClusterDiskSpaceManager {
// 
// 	private final Set<String> servers;
// 	private final Map<String, DiskSpace> diskSpaceMap = new ConcurrentHashMap<>();
// 
// 	/**
// 	 * Construct the ClusterDiskSpaceManager.
// 	 * @param servers the set of valid servers for the cluster.
// 	 */
// 	public ClusterDiskSpaceManager(Set<String> servers) {
// 		this.servers = servers;
// 	}
// 
// 	/**
// 	 * Set the disk space for a server.
// 	 * @param server the server.
// 	 * @param space the DiskSpace object holding the disk space details.
// 	 * @throws DiskSpaceCheckerException if the server is not in the server list
// 	 * used to construct the manager.
// 	 */
// 	public void setDiskSpace(String server, DiskSpace space) throws DiskSpaceCheckerException {
// 		if (!servers.contains(server)) {
// 			throw new DiskSpaceCheckerException("Unrecognised server " + server);
// 		}
// 
// 		diskSpaceMap.put(server, space);
// 	}
// 
// 	/**
// 	 * Get the current map of server - disk space statuses.
// 	 * @return the map.
// 	 */
// 	public Map<String, DiskSpace> getDiskSpace() {
// 		return diskSpaceMap;
// 	}
// 
// 	/**
// 	 * Get the list of servers for which we should have disk space settings.
// 	 * @return the servers.
// 	 */
// 	public Set<String> getServers() {
// 		return servers;
// 	}
// 
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/services/DiskSpaceCheckerException.java
// public class DiskSpaceCheckerException extends Exception {
// 
// 	public DiskSpaceCheckerException() {
// 		super();
// 	}
// 
// 	public DiskSpaceCheckerException(String message) {
// 		super(message);
// 	}
// 
// 	public DiskSpaceCheckerException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public DiskSpaceCheckerException(Throwable cause) {
// 		super(cause);
// 	}
// 
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/services/data/DiskSpace.java
// public class DiskSpace {
// 
// 	private final long freeSpace;
// 	private final long maxSpace;
// 	private final Date creationDate = new Date();
// 
// 	public DiskSpace(long freeSpace, long maxSpace) {
// 		this.freeSpace = freeSpace;
// 		this.maxSpace = maxSpace;
// 	}
// 
// 	public long getFreeSpace() {
// 		return freeSpace;
// 	}
// 
// 	public long getMaxSpace() {
// 		return maxSpace;
// 	}
// 
// 	public Date getCreationDate() {
// 		return creationDate;
// 	}
// 
// }


import uk.co.flax.harahachibu.api.SetSpaceResponse;
import uk.co.flax.harahachibu.services.ClusterDiskSpaceManager;
import uk.co.flax.harahachibu.services.DiskSpaceCheckerException;
import uk.co.flax.harahachibu.services.data.DiskSpace;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
/**
 * Copyright (c) 2016 Lemur Consulting Ltd.
 * <p/>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package uk.co.flax.harahachibu.resources;



/**
 * Endpoint to allow disk space to be set for remote servers.
 *
 * Created by mlp on 14/04/16.
 */
@Path("/setSpace/{host}/{freeSpace}/{maxSpace}")
public class SetSpaceResource {

	private final ClusterDiskSpaceManager clusterManager;

// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/api/SetSpaceResponse.java
// public class SetSpaceResponse {
// 
// 	public enum ResponseCode {
// 		OK, ERROR
// 	};
// 
// 	@JsonProperty("status")
// 	private final ResponseCode responseCode;
// 	@JsonProperty("message")
// 	private final String message;
// 
// 	public SetSpaceResponse(ResponseCode code, String message) {
// 		this.responseCode = code;
// 		this.message = message;
// 	}
// 
// 	public static SetSpaceResponse okResponse() {
// 		return new SetSpaceResponse(ResponseCode.OK, null);
// 	}
// 
// 	public ResponseCode getResponseCode() {
// 		return responseCode;
// 	}
// 
// 	public String getMessage() {
// 		return message;
// 	}
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/services/ClusterDiskSpaceManager.java
// public class ClusterDiskSpaceManager {
// 
// 	private final Set<String> servers;
// 	private final Map<String, DiskSpace> diskSpaceMap = new ConcurrentHashMap<>();
// 
// 	/**
// 	 * Construct the ClusterDiskSpaceManager.
// 	 * @param servers the set of valid servers for the cluster.
// 	 */
// 	public ClusterDiskSpaceManager(Set<String> servers) {
// 		this.servers = servers;
// 	}
// 
// 	/**
// 	 * Set the disk space for a server.
// 	 * @param server the server.
// 	 * @param space the DiskSpace object holding the disk space details.
// 	 * @throws DiskSpaceCheckerException if the server is not in the server list
// 	 * used to construct the manager.
// 	 */
// 	public void setDiskSpace(String server, DiskSpace space) throws DiskSpaceCheckerException {
// 		if (!servers.contains(server)) {
// 			throw new DiskSpaceCheckerException("Unrecognised server " + server);
// 		}
// 
// 		diskSpaceMap.put(server, space);
// 	}
// 
// 	/**
// 	 * Get the current map of server - disk space statuses.
// 	 * @return the map.
// 	 */
// 	public Map<String, DiskSpace> getDiskSpace() {
// 		return diskSpaceMap;
// 	}
// 
// 	/**
// 	 * Get the list of servers for which we should have disk space settings.
// 	 * @return the servers.
// 	 */
// 	public Set<String> getServers() {
// 		return servers;
// 	}
// 
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/services/DiskSpaceCheckerException.java
// public class DiskSpaceCheckerException extends Exception {
// 
// 	public DiskSpaceCheckerException() {
// 		super();
// 	}
// 
// 	public DiskSpaceCheckerException(String message) {
// 		super(message);
// 	}
// 
// 	public DiskSpaceCheckerException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public DiskSpaceCheckerException(Throwable cause) {
// 		super(cause);
// 	}
// 
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/services/data/DiskSpace.java
// public class DiskSpace {
// 
// 	private final long freeSpace;
// 	private final long maxSpace;
// 	private final Date creationDate = new Date();
// 
// 	public DiskSpace(long freeSpace, long maxSpace) {
// 		this.freeSpace = freeSpace;
// 		this.maxSpace = maxSpace;
// 	}
// 
// 	public long getFreeSpace() {
// 		return freeSpace;
// 	}
// 
// 	public long getMaxSpace() {
// 		return maxSpace;
// 	}
// 
// 	public Date getCreationDate() {
// 		return creationDate;
// 	}
// 
// }


// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/resources/SetSpaceResource.java
import uk.co.flax.harahachibu.api.SetSpaceResponse;
import uk.co.flax.harahachibu.services.ClusterDiskSpaceManager;
import uk.co.flax.harahachibu.services.DiskSpaceCheckerException;
import uk.co.flax.harahachibu.services.data.DiskSpace;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

/**
 * Copyright (c) 2016 Lemur Consulting Ltd.
 * <p/>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package uk.co.flax.harahachibu.resources;



/**
 * Endpoint to allow disk space to be set for remote servers.
 *
 * Created by mlp on 14/04/16.
 */
@Path("/setSpace/{host}/{freeSpace}/{maxSpace}")
public class SetSpaceResource {

	private final ClusterDiskSpaceManager clusterManager;

	public SetSpaceResource(ClusterDiskSpaceManager clusterManager) {