/**
  * Create a COBOl CICS HTTP Client program to use for testing.
  *
  * @param service the JBoss ESB service description
  * @param operation the operation for which a program is to be generated
  * @param parameters the set of parameters to pass to template engine
  * @param cobolFilesDir location where COBOL code should be generated
  * @param cobolHttpClientType the type of cobol http client to generate
  * @throws CodeGenMakeException if generation fails
  */
 protected static void generateCobolSampleHttpClient(
     final CixsJbossEsbService service,
     final CixsOperation operation,
     final Map<String, Object> parameters,
     final File cobolFilesDir,
     final CobolHttpClientType cobolHttpClientType)
     throws CodeGenMakeException {
   String template;
   switch (cobolHttpClientType) {
     case DFHWBCLI:
       template = Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_DFHWBCLI_CLIENT_VLC_TEMPLATE;
       break;
     case WEBAPI:
       template = Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_WEBAPI_CLIENT_VLC_TEMPLATE;
       break;
     default:
       template = Cixs2JaxwsGenerator.OPERATION_COBOL_CICS_LSHTTAPI_CLIENT_VLC_TEMPLATE;
   }
   generateFile(
       CIXS_JBOSSESB_GENERATOR_NAME,
       template,
       SERVICE_MODEL_NAME,
       service,
       parameters,
       cobolFilesDir,
       operation.getCicsProgramName() + ".cbl");
 }
 /**
  * Create a COBOl CICS WMQ Client program to use for testing.
  *
  * @param service the JBoss ESB service description
  * @param operation the operation for which a program is to be generated
  * @param parameters the set of parameters to pass to template engine
  * @param cobolFilesDir location where COBOL code should be generated
  * @throws CodeGenMakeException if generation fails
  */
 protected static void generateCobolSampleWmqClient(
     final CixsJbossEsbService service,
     final CixsOperation operation,
     final Map<String, Object> parameters,
     final File cobolFilesDir)
     throws CodeGenMakeException {
   generateFile(
       CIXS_JBOSSESB_GENERATOR_NAME,
       OPERATION_COBOL_CICS_WMQ_CLIENT_VLC_TEMPLATE,
       SERVICE_MODEL_NAME,
       service,
       parameters,
       cobolFilesDir,
       operation.getCicsProgramName() + ".cbl");
 }
  /**
   * Check input values that are common to all derived classes. Check that we are provided with
   * valid locations to generate in.
   *
   * @throws CodeGenMakeException if input is invalid
   */
  public void checkExtendedInput() throws CodeGenMakeException {
    CodeGenUtil.checkDirectory(getTargetSrcDir(), true, "TargetSrcDir");
    CodeGenUtil.checkDirectory(getTargetAntDir(), true, "TargetAntDir");
    CodeGenUtil.checkDirectory(getTargetJbossEsbConfigDir(), true, "TargetJbossEsbConfigDir");
    CodeGenUtil.checkDirectory(
        new File(getTargetJbossEsbConfigDir(), "META-INF"),
        true,
        "TargetJbossEsbConfigDir/META-INF");
    CodeGenUtil.checkDirectory(getTargetDistDir(), true, "TargetDistDir");

    /* Check that we are provided with valid locations to
     * reference.*/
    if (getTargetBinDir() == null) {
      throw (new IllegalArgumentException("TargetBinDir: No directory name was specified"));
    }
    if (getTargetEsbDir() == null) {
      throw (new IllegalArgumentException("TargetEsbDir: No directory name was specified"));
    }
    /* Check that we have at least one operation. */
    if (getCixsJbossEsbService().getCixsOperations().size() == 0) {
      throw new CodeGenMakeException("No operation was specified");
    }

    /* Check that we have CICS program names mapped to operations */
    for (CixsOperation operation : getCixsJbossEsbService().getCixsOperations()) {
      String cicsProgramName = operation.getCicsProgramName();
      if (cicsProgramName == null || cicsProgramName.length() == 0) {
        throw new CodeGenMakeException("Operation must specify a CICS program name");
      }
    }

    /* For HTTP transport check that the protocol is supported.*/
    if (getSampleConfigurationTransport().equalsIgnoreCase("http")) {
      /* Check that we have a URI to expose to mainframe programs */
      /* Set a sensible path using the service name. */
      if (getHttpTransportParameters().getPath() == null
          || getHttpTransportParameters().getPath().length() == 0) {
        getHttpTransportParameters().setPath(getDefaultServicePath());
      }
      /* Since we moved from JBR to Tomcat, there is a minor glitch where the
       * request URL needs to end with a slash otherwise an unhandled 302
       * is returned. */
      String path = getHttpTransportParameters().getPath();
      if (path.charAt(path.length() - 1) != '/') {
        path += '/';
        getHttpTransportParameters().setPath(path);
      }
      getHttpTransportParameters().check();
    }

    /* For WMQ transport check parameters.*/
    if (getSampleConfigurationTransport().equalsIgnoreCase("wmq")) {
      getWmqTransportParameters().check();
    }

    /* For JBM transport check parameters.*/
    if (getSampleConfigurationTransport().equalsIgnoreCase("jbm")) {
      getJbmTransportParameters().initialize(getCixsService().getName());
      getJbmTransportParameters().check();
    }

    checkExtendedExtendedInput();
  }