/*
 * Created on Sep 11, 2006
 * 
 * (C) Copyright TANDBERG Television Ltd.
 */

package com.tandbergtv.workflow.resourcemanager.mgmt.initialization;

import com.tandbergtv.workflow.message.WorkflowMessage;

/**
 * Initialization for Anystream.
 * 
 * @author Imran Naqvi
 */
public class AnystreamIS extends MessageSendingIS
{
	/**
	 * The Parameter that contains the response when an ACK Message is received
	 */
	public static final String ACK_RESPONSE_PARAM = "isEncoding";

	/**
	 * The Expected Response Value for initialization success when an ACK Message is received
	 */
	public static final String SUCCESS_RESPONSE = "false";

	/**
	 * Check if the Encoder is not currently busy encoding. If the encoder is not busy, the
	 * initialization is complete.
	 * 
	 * @see com.tandbergtv.workflow.resourcemanager.mgmt.initialization.MessageSendingIS#isInitializationComplete(com.tandbergtv.workflow.message.WorkflowMessage)
	 */
	@Override
	protected boolean isInitializationComplete(WorkflowMessage response)
	{
		boolean isReady = false;

		String responseVal = response.getValue(ACK_RESPONSE_PARAM);
		if (responseVal != null)
			responseVal = responseVal.trim();

		if (SUCCESS_RESPONSE.equalsIgnoreCase(responseVal))
			isReady = true;

		return isReady;
	}
}
