/*
 * Copyright 2011 Oliver B. Fischer
 *
 * 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
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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 de.fischer.thotti.core.configuration;

import com.amazonaws.services.elasticmapreduce.model.ActionOnFailure;

/**
 * A configuration writer is responsible for serializing
 * a {@link Configuration} to an external format.
 *
 * @author Oliver Fischer
 *
 * @see Configuration
 * @see ConfigDenormalizer
 */
public interface ConfigurationWriter<T extends ConfigurationWriter> {


    T withDenormalizer(ConfigDenormalizer denormalizer);

    void setDenormalizer(ConfigDenormalizer denormalizer);

    /**
     * @param configuration The configuration to serialize,
     *                      must not be {@code null}.
     */
    void write(Configuration configuration);

    T startNDTestSection();

    T withID(String id);

    T withDescription(String description);

    T finishNDTestSection();

    T withTargetClass(String fqcn);

    T withTargetMethod(String method);

    T withParameter(String name, String value);

    T finishTest();

    T startTest();

    T withTestID(String name);

    T withTestJVMArgs(String commandLineArguments);

    T withTestJVMArgsID(String id);

    void finishDistributedTestSuite();

    T startDistributedTestSuite();

    T finishTestStep();

    T startTestStep();

    T finishFlow();

    T startFlow();

    T withTestStepJobClass(String clazz);

    T withTestStepID(String id);

    T withActionOnFailure(ActionOnFailure actionOnFailure);

    T withFlowName(String id);

    T addTestStepArgument(String argument);
}
