// Path: src/main/java/com/turn/sorcerer/pipeline/Pipeline.java
// public interface Pipeline {
// 
// 	/**
// 	 * Provides the current iteration number of a pipeline
// 	 *
// 	 * <p>
// 	 * This method should be implemented to trigger the scheduling of a
// 	 * pipeline based on the iteration number. Sorcerer will use the value
// 	 * returned by this method to schedule pipelines. Each time a new iteration
// 	 * number is provided by this method, Sorcerer will instantiate and
// 	 * schedule a new pipeline.
// 	 * </p>
// 	 *
// 	 * <p>
// 	 * Note: This method will be called periodically (as defined by the
// 	 * {@code interval} field of a pipeline configuration) and so it should
// 	 * be stateless. Sorcerer instantiates a Pipeline instance using its
// 	 * injector and then calls this method to generate the current iteration
// 	 * number.
// 	 * </p>
// 	 *
// 	 * @return Current iteration number
// 	 */
// 	Integer getCurrentIterationNumber();
// 
// 	Integer getPreviousIterationNumber(int curr, int prev);
// }
// 
// Path: src/main/java/com/turn/sorcerer/util/CronExpression.java
// public class CronExpression {
// 
// 	private org.quartz.CronExpression cronExpression;
// 
// 	public CronExpression(String cronString) {
// 		try {
// 			cronExpression = new org.quartz.CronExpression(cronString);
// 		} catch (ParseException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public DateTime getNextTimeAfter(DateTime dt) {
// 		return new DateTime(cronExpression.getNextValidTimeAfter(dt.toDate()));
// 	}
// }


import com.turn.sorcerer.pipeline.Pipeline;
import com.turn.sorcerer.util.CronExpression;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
/*
 * 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.pipeline.impl;



/**
 * Cron implementation of Pipeline
 *
 * @author tshiou
 */
public class CronPipeline implements Pipeline {

	private static final DateTimeFormatter dtf = DateTimeFormat.forPattern("yyMMdd");

// Path: src/main/java/com/turn/sorcerer/pipeline/Pipeline.java
// public interface Pipeline {
// 
// 	/**
// 	 * Provides the current iteration number of a pipeline
// 	 *
// 	 * <p>
// 	 * This method should be implemented to trigger the scheduling of a
// 	 * pipeline based on the iteration number. Sorcerer will use the value
// 	 * returned by this method to schedule pipelines. Each time a new iteration
// 	 * number is provided by this method, Sorcerer will instantiate and
// 	 * schedule a new pipeline.
// 	 * </p>
// 	 *
// 	 * <p>
// 	 * Note: This method will be called periodically (as defined by the
// 	 * {@code interval} field of a pipeline configuration) and so it should
// 	 * be stateless. Sorcerer instantiates a Pipeline instance using its
// 	 * injector and then calls this method to generate the current iteration
// 	 * number.
// 	 * </p>
// 	 *
// 	 * @return Current iteration number
// 	 */
// 	Integer getCurrentIterationNumber();
// 
// 	Integer getPreviousIterationNumber(int curr, int prev);
// }
// 
// Path: src/main/java/com/turn/sorcerer/util/CronExpression.java
// public class CronExpression {
// 
// 	private org.quartz.CronExpression cronExpression;
// 
// 	public CronExpression(String cronString) {
// 		try {
// 			cronExpression = new org.quartz.CronExpression(cronString);
// 		} catch (ParseException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public DateTime getNextTimeAfter(DateTime dt) {
// 		return new DateTime(cronExpression.getNextValidTimeAfter(dt.toDate()));
// 	}
// }


// Path: src/main/java/com/turn/sorcerer/pipeline/impl/CronPipeline.java
import com.turn.sorcerer.pipeline.Pipeline;
import com.turn.sorcerer.util.CronExpression;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

/*
 * 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.pipeline.impl;



/**
 * Cron implementation of Pipeline
 *
 * @author tshiou
 */
public class CronPipeline implements Pipeline {

	private static final DateTimeFormatter dtf = DateTimeFormat.forPattern("yyMMdd");

	private final CronExpression cronExp;