// Path: src/main/java/com/turn/sorcerer/status/Status.java
// public enum Status {
// 
// 	/**
// 	 * Represents a task that is a part of a scheduled pipeline but is not yet
// 	 * eligible for execution, or more specifically the previous tasks in the
// 	 * workflow have not completed or one of
// 	 * {@link com.turn.sorcerer.task.Task#getDependencies(int)} is returning
// 	 * false
// 	 */
// 	PENDING("PENDING"),
// 
// 	/**
// 	 * Represents either:
// 	 *
// 	 * <li>A task that is in-progress, or more specifically
// 	 * {@link com.turn.sorcerer.task.Task#exec} method is running
// 	 * </li>
// 	 *
// 	 * <li>
// 	 * A pipeline whose initial task has been launched but the pipeline is not
// 	 * complete, or more specifically all of its memeber tasks have not
// 	 * completed successfully.
// 	 * </li>
// 	 */
// 	IN_PROGRESS("RUNNING"),
// 
// 	/**
// 	 * Represents either:
// 	 *
// 	 * <li>
// 	 * A successfully completed task, or more specifically
// 	 * {@link com.turn.sorcerer.task.Task#exec} has completed with no
// 	 * exceptions
// 	 * </li>
// 	 *
// 	 * <li>
// 	 * A successfully completed pipeline, or more specifically a pipeline
// 	 * with all member tasks successfully completed.
// 	 * </li>
// 	 */
// 	SUCCESS("SUCCESS"),
// 
// 	/**
// 	 * Represents a task with a previous iteration run that resulted in an
// 	 * error state, or more specifically
// 	 * {@link com.turn.sorcerer.task.Task#exec} was executed with an exception
// 	 * thrown
// 	 */
// 	ERROR("ERROR"),
// 	;
// 
// 	// String representation of status
// 	private String string;
// 
// 	private Status(String string) {
// 		this.string = string;
// 	}
// 
// 	/**
// 	 * Returns string representation of state.
// 	 */
// 	public String getString() {
// 		return string;
// 	}
// }
// 
// Path: src/main/java/com/turn/sorcerer/status/StatusStorage.java
// public interface StatusStorage {
// 
// 	String toString();
// 
// 	void init() throws IOException;
// 
// 	StatusStorage setType(String type);
// 
// 	DateTime getLastUpdateTime(String identifier, int id) throws IOException;
// 
// 	DateTime getStatusUpdateTime(String identifier, int id, Status status) throws IOException;
// 
// 	int getCurrentIterNo(String identifier) throws IOException;
// 
// 	Status checkStatus(String identifier, int id) throws IOException;
// 
// 	void clearAllStatuses(String identifier, int jobId) throws IOException;
// 
// 	void removeStatus(String identifier, int jobId, Status status) throws IOException;
// 
// 	void commitStatus(String identifier, int jobId, Status status, DateTime time, boolean overwrite) throws IOException;
// 
// }


import com.turn.sorcerer.status.Status;
import com.turn.sorcerer.status.StatusStorage;
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.joda.time.DateTime;
/*
 * Copyright (c) 2015, Turn Inc. All Rights Reserved.
 * Use of this source code is governed by a BSD-style license that can be found
 * in the LICENSE file.
 */

package com.turn.sorcerer.status.impl;




/**
 * Class Description Here
 *
 * @author tshiou
 */
public class MemoryStatusStorage implements StatusStorage {

	private static final Logger logger =
			LoggerFactory.getLogger(MemoryStatusStorage.class);

	private final Table<String, Integer, ConcurrentMap<Status, DateTime>> store;

	public MemoryStatusStorage() {
		logger.debug("New instance of memory status storage");
		store =	HashBasedTable.create();
	}

	@Override
	public void init() throws IOException {

	}

	@Override
// Path: src/main/java/com/turn/sorcerer/status/Status.java
// public enum Status {
// 
// 	/**
// 	 * Represents a task that is a part of a scheduled pipeline but is not yet
// 	 * eligible for execution, or more specifically the previous tasks in the
// 	 * workflow have not completed or one of
// 	 * {@link com.turn.sorcerer.task.Task#getDependencies(int)} is returning
// 	 * false
// 	 */
// 	PENDING("PENDING"),
// 
// 	/**
// 	 * Represents either:
// 	 *
// 	 * <li>A task that is in-progress, or more specifically
// 	 * {@link com.turn.sorcerer.task.Task#exec} method is running
// 	 * </li>
// 	 *
// 	 * <li>
// 	 * A pipeline whose initial task has been launched but the pipeline is not
// 	 * complete, or more specifically all of its memeber tasks have not
// 	 * completed successfully.
// 	 * </li>
// 	 */
// 	IN_PROGRESS("RUNNING"),
// 
// 	/**
// 	 * Represents either:
// 	 *
// 	 * <li>
// 	 * A successfully completed task, or more specifically
// 	 * {@link com.turn.sorcerer.task.Task#exec} has completed with no
// 	 * exceptions
// 	 * </li>
// 	 *
// 	 * <li>
// 	 * A successfully completed pipeline, or more specifically a pipeline
// 	 * with all member tasks successfully completed.
// 	 * </li>
// 	 */
// 	SUCCESS("SUCCESS"),
// 
// 	/**
// 	 * Represents a task with a previous iteration run that resulted in an
// 	 * error state, or more specifically
// 	 * {@link com.turn.sorcerer.task.Task#exec} was executed with an exception
// 	 * thrown
// 	 */
// 	ERROR("ERROR"),
// 	;
// 
// 	// String representation of status
// 	private String string;
// 
// 	private Status(String string) {
// 		this.string = string;
// 	}
// 
// 	/**
// 	 * Returns string representation of state.
// 	 */
// 	public String getString() {
// 		return string;
// 	}
// }
// 
// Path: src/main/java/com/turn/sorcerer/status/StatusStorage.java
// public interface StatusStorage {
// 
// 	String toString();
// 
// 	void init() throws IOException;
// 
// 	StatusStorage setType(String type);
// 
// 	DateTime getLastUpdateTime(String identifier, int id) throws IOException;
// 
// 	DateTime getStatusUpdateTime(String identifier, int id, Status status) throws IOException;
// 
// 	int getCurrentIterNo(String identifier) throws IOException;
// 
// 	Status checkStatus(String identifier, int id) throws IOException;
// 
// 	void clearAllStatuses(String identifier, int jobId) throws IOException;
// 
// 	void removeStatus(String identifier, int jobId, Status status) throws IOException;
// 
// 	void commitStatus(String identifier, int jobId, Status status, DateTime time, boolean overwrite) throws IOException;
// 
// }


// Path: src/main/java/com/turn/sorcerer/status/impl/MemoryStatusStorage.java
import com.turn.sorcerer.status.Status;
import com.turn.sorcerer.status.StatusStorage;
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.joda.time.DateTime;

/*
 * Copyright (c) 2015, Turn Inc. All Rights Reserved.
 * Use of this source code is governed by a BSD-style license that can be found
 * in the LICENSE file.
 */

package com.turn.sorcerer.status.impl;




/**
 * Class Description Here
 *
 * @author tshiou
 */
public class MemoryStatusStorage implements StatusStorage {

	private static final Logger logger =
			LoggerFactory.getLogger(MemoryStatusStorage.class);

	private final Table<String, Integer, ConcurrentMap<Status, DateTime>> store;

	public MemoryStatusStorage() {
		logger.debug("New instance of memory status storage");
		store =	HashBasedTable.create();
	}

	@Override
	public void init() throws IOException {

	}

	@Override
	public StatusStorage setType(String type) {