// Path: src/main/java/com/headwire/aemdc/runner/BasisRunner.java
// public abstract class BasisRunner {
// 
//   private static final Logger LOG = LoggerFactory.getLogger(BasisRunner.class);
// 
//   protected Resource resource;
// 
//   /**
//    * Invoker invokes commands here
//    *
//    * @throws IOException
//    */
//   public abstract void run() throws IOException;
// 
//   /**
//    * Get help folder name for template type.
//    * Help folders files are under /resources/types/<type>/help/..
//    * or /aemdc-files/<type>/help/..
//    *
//    * @return help folder path
//    */
//   public abstract String getHelpFolder();
// 
//   /**
//    * Get help folder name for template name.
//    * Help folders files are under /aemdc-files/<type>/<template name>/help/..
//    *
//    * @return help folder path
//    */
//   public abstract String getTemplateHelpFolder();
// 
//   /**
//    * Get template type source folder path.
//    *
//    * @return
//    */
//   public abstract String getSourceFolder();
// 
//   /**
//    * Get place holder replacer.
//    *
//    * @return place holder replacer
//    */
//   public abstract Replacer getPlaceHolderReplacer();
// 
//   /**
//    * Get resource
//    *
//    * @return resource
//    */
//   public Resource getResource() {
//     return resource;
//   }
// 
//   /**
//    * Set global config properties in the resource
//    *
//    * @param config
//    *          - properties config
//    */
//   public void setGlobalConfigProperties(final Config config) {
//     // Set extensions from config file
//     final String[] extensions = config.getFileExtensions();
//     getResource().setExtensions(extensions);
// 
//     // Set overwriting methods from config file
//     if (Constants.EXISTING_DESTINATION_RESOURCES_WARN
//         .equals(config.getProperty(Constants.CONFIGPROP_EXISTING_DESTINATION_RESOURCES_REPLACEMENT))) {
//       getResource().setToWarnDestDir(true);
//     } else if (Constants.EXISTING_DESTINATION_RESOURCES_DELETE
//         .equals(config.getProperty(Constants.CONFIGPROP_EXISTING_DESTINATION_RESOURCES_REPLACEMENT))) {
//       getResource().setToDeleteDestDir(true);
//     }
//   }
// }
// 
// Path: src/main/java/com/headwire/aemdc/runner/HelpRunner.java
// public class HelpRunner extends BasisRunner {
// 
//   private static final Logger LOG = LoggerFactory.getLogger(HelpRunner.class);
//   private static final String HELP_FOLDER = "help";
// 
//   /**
//    * Invoker
//    */
//   private final CommandMenu menu = new CommandMenu();
//   private final Config config;
// 
//   /**
//    * Constructor
//    *
//    * @param resource
//    *          - resource object
//    */
//   public HelpRunner(final Resource resource, final Config config) {
//     this.resource = resource;
//     this.config = config;
// 
//     LOG.debug("Help runner starting...");
// 
//     // Creates Invoker object, command object and configure them
//     menu.setCommand(1, new HelpCommand(resource, config));
//   }
// 
//   /**
//    * Run commands
//    *
//    * @throws IOException
//    */
//   @Override
//   public void run() throws IOException {
//     // Invoker invokes command
//     menu.runCommand(1);
//   }
// 
//   @Override
//   public String getHelpFolder() {
//     return Constants.TYPES_STATIC_FOLDER + "/" + HELP_FOLDER;
//   }
// 
//   @Override
//   public String getTemplateHelpFolder() {
//     return getHelpFolder();
//   }
// 
//   @Override
//   public String getSourceFolder() {
//     return resource.getSourceFolderPath();
//   }
// 
//   @Override
//   public Replacer getPlaceHolderReplacer() {
//     return null;
//   }
// }


import java.io.IOException;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.headwire.aemdc.runner.BasisRunner;
import com.headwire.aemdc.runner.HelpRunner;
import ch.qos.logback.classic.Level;
package com.headwire.aemdc.companion;






/**
 * Runnable Companion Main Class
 *
 * @author Marat Saitov, 25.10.2016
 */
public class RunnableCompanion {

  private static final Logger LOG = LoggerFactory.getLogger(RunnableCompanion.class);
  private static final ch.qos.logback.classic.Logger ROOT_LOGGER = (ch.qos.logback.classic.Logger) LoggerFactory
      .getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);

  private static Config config;

  /**
   * Main start method.
   *
   * @param args
   *          - arguments
   * @throws IOException
   *           - IOException
   */
  public static void main(final String[] args) throws IOException {

    // set default INFO log level to avoid logging from ConfigUtil
    ROOT_LOGGER.setLevel(Level.INFO);

    // Get Properties Config from config file
    config = new Config(args);

    // setup custom log level
    if (setupCustomLogLevel()) {
      // Check configuration from configuration properties file
      config.checkConfiguration();
    }

    // set mandatories from arguments
    final Resource resource = new Resource(args);

    // Get Runner
// Path: src/main/java/com/headwire/aemdc/runner/BasisRunner.java
// public abstract class BasisRunner {
// 
//   private static final Logger LOG = LoggerFactory.getLogger(BasisRunner.class);
// 
//   protected Resource resource;
// 
//   /**
//    * Invoker invokes commands here
//    *
//    * @throws IOException
//    */
//   public abstract void run() throws IOException;
// 
//   /**
//    * Get help folder name for template type.
//    * Help folders files are under /resources/types/<type>/help/..
//    * or /aemdc-files/<type>/help/..
//    *
//    * @return help folder path
//    */
//   public abstract String getHelpFolder();
// 
//   /**
//    * Get help folder name for template name.
//    * Help folders files are under /aemdc-files/<type>/<template name>/help/..
//    *
//    * @return help folder path
//    */
//   public abstract String getTemplateHelpFolder();
// 
//   /**
//    * Get template type source folder path.
//    *
//    * @return
//    */
//   public abstract String getSourceFolder();
// 
//   /**
//    * Get place holder replacer.
//    *
//    * @return place holder replacer
//    */
//   public abstract Replacer getPlaceHolderReplacer();
// 
//   /**
//    * Get resource
//    *
//    * @return resource
//    */
//   public Resource getResource() {
//     return resource;
//   }
// 
//   /**
//    * Set global config properties in the resource
//    *
//    * @param config
//    *          - properties config
//    */
//   public void setGlobalConfigProperties(final Config config) {
//     // Set extensions from config file
//     final String[] extensions = config.getFileExtensions();
//     getResource().setExtensions(extensions);
// 
//     // Set overwriting methods from config file
//     if (Constants.EXISTING_DESTINATION_RESOURCES_WARN
//         .equals(config.getProperty(Constants.CONFIGPROP_EXISTING_DESTINATION_RESOURCES_REPLACEMENT))) {
//       getResource().setToWarnDestDir(true);
//     } else if (Constants.EXISTING_DESTINATION_RESOURCES_DELETE
//         .equals(config.getProperty(Constants.CONFIGPROP_EXISTING_DESTINATION_RESOURCES_REPLACEMENT))) {
//       getResource().setToDeleteDestDir(true);
//     }
//   }
// }
// 
// Path: src/main/java/com/headwire/aemdc/runner/HelpRunner.java
// public class HelpRunner extends BasisRunner {
// 
//   private static final Logger LOG = LoggerFactory.getLogger(HelpRunner.class);
//   private static final String HELP_FOLDER = "help";
// 
//   /**
//    * Invoker
//    */
//   private final CommandMenu menu = new CommandMenu();
//   private final Config config;
// 
//   /**
//    * Constructor
//    *
//    * @param resource
//    *          - resource object
//    */
//   public HelpRunner(final Resource resource, final Config config) {
//     this.resource = resource;
//     this.config = config;
// 
//     LOG.debug("Help runner starting...");
// 
//     // Creates Invoker object, command object and configure them
//     menu.setCommand(1, new HelpCommand(resource, config));
//   }
// 
//   /**
//    * Run commands
//    *
//    * @throws IOException
//    */
//   @Override
//   public void run() throws IOException {
//     // Invoker invokes command
//     menu.runCommand(1);
//   }
// 
//   @Override
//   public String getHelpFolder() {
//     return Constants.TYPES_STATIC_FOLDER + "/" + HELP_FOLDER;
//   }
// 
//   @Override
//   public String getTemplateHelpFolder() {
//     return getHelpFolder();
//   }
// 
//   @Override
//   public String getSourceFolder() {
//     return resource.getSourceFolderPath();
//   }
// 
//   @Override
//   public Replacer getPlaceHolderReplacer() {
//     return null;
//   }
// }


// Path: src/main/java/com/headwire/aemdc/companion/RunnableCompanion.java
import java.io.IOException;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.headwire.aemdc.runner.BasisRunner;
import com.headwire.aemdc.runner.HelpRunner;
import ch.qos.logback.classic.Level;

package com.headwire.aemdc.companion;






/**
 * Runnable Companion Main Class
 *
 * @author Marat Saitov, 25.10.2016
 */
public class RunnableCompanion {

  private static final Logger LOG = LoggerFactory.getLogger(RunnableCompanion.class);
  private static final ch.qos.logback.classic.Logger ROOT_LOGGER = (ch.qos.logback.classic.Logger) LoggerFactory
      .getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);

  private static Config config;

  /**
   * Main start method.
   *
   * @param args
   *          - arguments
   * @throws IOException
   *           - IOException
   */
  public static void main(final String[] args) throws IOException {

    // set default INFO log level to avoid logging from ConfigUtil
    ROOT_LOGGER.setLevel(Level.INFO);

    // Get Properties Config from config file
    config = new Config(args);

    // setup custom log level
    if (setupCustomLogLevel()) {
      // Check configuration from configuration properties file
      config.checkConfiguration();
    }

    // set mandatories from arguments
    final Resource resource = new Resource(args);

    // Get Runner
    BasisRunner runner = new HelpRunner(resource, config);