public String generate(Object argument) {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);

    // this util class use by set log4j debug paramters
    class DefaultLog4jFileUtil {

      INode node = null;
      String cid = null;
      boolean isLog4jEnabled = false;
      String label = null;

      public DefaultLog4jFileUtil() {}

      public DefaultLog4jFileUtil(INode node) {
        this.node = node;
        this.cid = node.getUniqueName();
        this.label = cid;
        this.isLog4jEnabled =
            ("true")
                .equals(
                    org.talend.core.model.process.ElementParameterParser.getValue(
                        node.getProcess(), "__LOG4J_ACTIVATE__"));
      }

      public void setCid(String cid) {
        this.cid = cid;
      }

      // for all tFileinput* components
      public void startRetriveDataInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_2);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_3);
        }
      }

      public void retrievedDataNumberInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_4);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_5);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_6);
        }
      }

      public void retrievedDataNumberInfoFromGlobalMap(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_7);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_8);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_9);
        }
      }

      // for all tFileinput* components
      public void retrievedDataNumberInfo(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_10);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_11);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_12);
        }
      }

      public void writeDataFinishInfo(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_13);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_14);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_15);
        }
      }

      // TODO delete it and remove all log4jSb parameter from components
      public void componentStartInfo(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_16);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_17);
        }
      }

      // TODO rename or delete it
      public void debugRetriveData(INode node, boolean hasIncreased) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_18);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_19);
          stringBuffer.append(cid);
          stringBuffer.append(hasIncreased ? "" : "+1");
          stringBuffer.append(TEXT_20);
        }
      }

      // TODO rename or delete it
      public void debugRetriveData(INode node) {
        debugRetriveData(node, true);
      }

      // TODO rename or delete it
      public void debugWriteData(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_21);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_22);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_23);
        }
      }

      public void logCurrentRowNumberInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_24);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_25);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_26);
        }
      }

      public void logDataCountInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_27);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_28);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_29);
        }
      }
    }

    final DefaultLog4jFileUtil log4jFileUtil =
        new DefaultLog4jFileUtil(
            (INode)
                (((org.talend.designer.codegen.config.CodeGeneratorArgument) argument)
                    .getArgument()));

    stringBuffer.append(TEXT_30);

    CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
    INode node = (INode) codeGenArgument.getArgument();
    String cid = node.getUniqueName();
    String useExistingConn = ElementParameterParser.getValue(node, "__USE_EXISTING_CONNECTION__");
    List<IMetadataTable> metadatas = node.getMetadataList();
    if ((metadatas != null) && (metadatas.size() > 0)) {
      IMetadataTable metadata = metadatas.get(0);
      if (metadata != null) {
        List<? extends IConnection> conns = node.getOutgoingSortedConnections();
        if (conns != null) {
          if (conns.size() > 0) {

            stringBuffer.append(TEXT_31);
            stringBuffer.append(cid);
            stringBuffer.append(TEXT_32);
          }
        }
      }
    }

    stringBuffer.append(TEXT_33);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_34);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_35);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_36);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_37);

    // use local connection
    if (!"true".equals(useExistingConn)) {
      String distribution = ElementParameterParser.getValue(node, "__DISTRIBUTION__");
      String hbaseVersion = ElementParameterParser.getValue(node, "__HBASE_VERSION__");
      boolean isHadoop2 =
          "HADOOP_2".equals(ElementParameterParser.getValue(node, "__HADOOP_CUSTOM_VERSION__"));
      org.talend.hadoop.distribution.component.HBaseComponent hbaseDistrib = null;
      try {
        hbaseDistrib =
            (org.talend.hadoop.distribution.component.HBaseComponent)
                org.talend.hadoop.distribution.DistributionFactory.buildDistribution(
                    distribution, hbaseVersion);
      } catch (java.lang.Exception e) {
        e.printStackTrace();
        return "";
      }
      boolean isCustom =
          hbaseDistrib instanceof org.talend.hadoop.distribution.custom.CustomDistribution;

      stringBuffer.append(TEXT_38);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_39);
      stringBuffer.append(TEXT_40);

      if ((isCustom && isHadoop2) || (!isCustom && hbaseDistrib.doSupportNewHBaseAPI())) {
        stringBuffer.append(TEXT_41);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_42);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_43);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_44);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_45);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_46);
      } else {
        stringBuffer.append(TEXT_47);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_48);
      }
      stringBuffer.append(TEXT_49);
    }

    stringBuffer.append(TEXT_50);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_51);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_52);

    log4jFileUtil.retrievedDataNumberInfo(node);

    return stringBuffer.toString();
  }
  public String generate(Object argument) {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);

    // this util class use by set log4j debug paramters
    class DefaultLog4jFileUtil {

      INode node = null;
      String cid = null;
      boolean isLog4jEnabled = false;
      String label = null;

      public DefaultLog4jFileUtil() {}

      public DefaultLog4jFileUtil(INode node) {
        this.node = node;
        this.cid = node.getUniqueName();
        this.label = cid;
        this.isLog4jEnabled =
            ("true")
                .equals(
                    org.talend.core.model.process.ElementParameterParser.getValue(
                        node.getProcess(), "__LOG4J_ACTIVATE__"));
      }

      public void setCid(String cid) {
        this.cid = cid;
      }

      // for all tFileinput* components
      public void startRetriveDataInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_2);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_3);
        }
      }

      public void retrievedDataNumberInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_4);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_5);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_6);
        }
      }

      public void retrievedDataNumberInfoFromGlobalMap(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_7);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_8);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_9);
        }
      }

      // for all tFileinput* components
      public void retrievedDataNumberInfo(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_10);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_11);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_12);
        }
      }

      public void writeDataFinishInfo(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_13);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_14);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_15);
        }
      }

      // TODO delete it and remove all log4jSb parameter from components
      public void componentStartInfo(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_16);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_17);
        }
      }

      // TODO rename or delete it
      public void debugRetriveData(INode node, boolean hasIncreased) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_18);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_19);
          stringBuffer.append(cid);
          stringBuffer.append(hasIncreased ? "" : "+1");
          stringBuffer.append(TEXT_20);
        }
      }

      // TODO rename or delete it
      public void debugRetriveData(INode node) {
        debugRetriveData(node, true);
      }

      // TODO rename or delete it
      public void debugWriteData(INode node) {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_21);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_22);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_23);
        }
      }

      public void logCurrentRowNumberInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_24);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_25);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_26);
        }
      }

      public void logDataCountInfo() {
        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_27);
          stringBuffer.append(label);
          stringBuffer.append(TEXT_28);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_29);
        }
      }
    }

    final DefaultLog4jFileUtil log4jFileUtil =
        new DefaultLog4jFileUtil(
            (INode)
                (((org.talend.designer.codegen.config.CodeGeneratorArgument) argument)
                    .getArgument()));

    stringBuffer.append(TEXT_30);

    CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
    INode node = (INode) codeGenArgument.getArgument();
    String cid = node.getUniqueName();

    boolean customEncoding =
        "true".equals(ElementParameterParser.getValue(node, "__CUSTOM_ENCODING__"));
    String encoding = ElementParameterParser.getValue(node, "__ENCODING__");

    List<? extends IConnection> conns = node.getOutgoingSortedConnections();
    String firstConnName = "";
    if (conns != null) {
      if (conns.size() > 0) {
        IConnection conn = conns.get(0);
        if (conn != null && conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
          firstConnName = conn.getName();

          stringBuffer.append(TEXT_31);
          stringBuffer.append(firstConnName);
          stringBuffer.append(TEXT_32);
          stringBuffer.append(conn.getName());
          stringBuffer.append(TEXT_33);
        }
      }
    }

    List<IMetadataTable> metadatas = node.getMetadataList();
    if ((metadatas != null) && (metadatas.size() > 0) && firstConnName.length() > 0) {
      IMetadataTable metadata = metadatas.get(0);

      String typeFile = ElementParameterParser.getValue(node, "__TYPEFILE__");
      if (typeFile.equals("SEQUENCE")) {

        String keyColumn = ElementParameterParser.getValue(node, "__KEYCOLUMN__");
        String valueColumn = ElementParameterParser.getValue(node, "__VALUECOLUMN__");

        List<IMetadataColumn> listColumns = metadata.getListColumns();
        String talendKeyClass = "";
        String talendValueClass = "";
        for (IMetadataColumn column : listColumns) {
          if (column.getLabel().equals(keyColumn)) {
            talendKeyClass = column.getTalendType();
          }
          if (column.getLabel().equals(valueColumn)) {
            talendValueClass = column.getTalendType();
          }
        }

        String hadoopVersion = null;
        String distribution = null;
        boolean useExistingConnection =
            "true".equals(ElementParameterParser.getValue(node, "__USE_EXISTING_CONNECTION__"));
        if (!useExistingConnection) {
          distribution = ElementParameterParser.getValue(node, "__DISTRIBUTION__");
          hadoopVersion = ElementParameterParser.getValue(node, "__DB_VERSION__");
        } else {
          String connectionSid = ElementParameterParser.getValue(node, "__CONNECTION__");
          List<? extends INode> nodes = node.getProcess().getGeneratingNodes();
          for (INode targetNode : nodes) {
            if (targetNode.getUniqueName().equals(connectionSid)) {
              hadoopVersion = ElementParameterParser.getValue(targetNode, "__DB_VERSION__");
              distribution = ElementParameterParser.getValue(targetNode, "__DISTRIBUTION__");
              break;
            }
          }
        }

        org.talend.hadoop.distribution.component.HDFSComponent hdfsDistrib = null;
        try {
          hdfsDistrib =
              (org.talend.hadoop.distribution.component.HDFSComponent)
                  org.talend.hadoop.distribution.DistributionFactory.buildDistribution(
                      distribution, hadoopVersion);
        } catch (java.lang.Exception e) {
          e.printStackTrace();
          return "";
        }
        boolean isCustom =
            hdfsDistrib instanceof org.talend.hadoop.distribution.custom.CustomDistribution;

        stringBuffer.append(TEXT_34);

        String keyClass = "org.apache.hadoop.io.Text";
        if (talendKeyClass.equals("id_Boolean")) keyClass = "org.apache.hadoop.io.BooleanWritable";
        if (talendKeyClass.equals("id_Byte")) keyClass = "org.apache.hadoop.io.ByteWritable";
        if (talendKeyClass.equals("id_byte[]")) keyClass = "org.apache.hadoop.io.BytesWritable";
        if (talendKeyClass.equals("id_Double")) keyClass = "org.apache.hadoop.io.DoubleWritable";
        if (talendKeyClass.equals("id_Float")) keyClass = "org.apache.hadoop.io.FloatWritable";
        if (talendKeyClass.equals("id_Integer")) keyClass = "org.apache.hadoop.io.IntWritable";
        if (talendKeyClass.equals("id_Long")) keyClass = "org.apache.hadoop.io.LongWritable";
        if (talendKeyClass.equals("id_String")) keyClass = "org.apache.hadoop.io.Text";
        if (talendKeyClass.equals("id_Short")) {
          if (isCustom || hdfsDistrib.doSupportSequenceFileShortType()) {
            keyClass = "org.apache.hadoop.io.ShortWritable";
          } else {
            keyClass = "org.apache.hadoop.io.IntWritable";
          }
        }

        String valueClass = "org.apache.hadoop.io.Text";
        if (talendValueClass.equals("id_Boolean"))
          valueClass = "org.apache.hadoop.io.BooleanWritable";
        if (talendValueClass.equals("id_Byte")) valueClass = "org.apache.hadoop.io.ByteWritable";
        if (talendValueClass.equals("id_byte[]")) valueClass = "org.apache.hadoop.io.BytesWritable";
        if (talendValueClass.equals("id_Double"))
          valueClass = "org.apache.hadoop.io.DoubleWritable";
        if (talendValueClass.equals("id_Float")) valueClass = "org.apache.hadoop.io.FloatWritable";
        if (talendValueClass.equals("id_Integer")) valueClass = "org.apache.hadoop.io.IntWritable";
        if (talendValueClass.equals("id_Long")) valueClass = "org.apache.hadoop.io.LongWritable";
        if (talendValueClass.equals("id_String")) valueClass = "org.apache.hadoop.io.Text";
        if (talendValueClass.equals("id_Short")) {
          if (isCustom || hdfsDistrib.doSupportSequenceFileShortType()) {
            valueClass = "org.apache.hadoop.io.ShortWritable";
          } else {
            valueClass = "org.apache.hadoop.io.IntWritable";
          }
        }

        stringBuffer.append(TEXT_35);
        stringBuffer.append(firstConnName);
        stringBuffer.append(TEXT_36);
        stringBuffer.append(keyColumn);
        stringBuffer.append(TEXT_37);
        stringBuffer.append(talendKeyClass.equals("id_Short") ? "(short)" : "");
        stringBuffer.append(TEXT_38);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_39);
        stringBuffer.append(
            ((keyClass.equals("org.apache.hadoop.io.Text")) ? "toString()" : "get()"));
        stringBuffer.append(TEXT_40);
        stringBuffer.append(firstConnName);
        stringBuffer.append(TEXT_41);
        stringBuffer.append(valueColumn);
        stringBuffer.append(TEXT_42);
        stringBuffer.append(talendValueClass.equals("id_Short") ? "(short)" : "");
        stringBuffer.append(TEXT_43);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_44);
        stringBuffer.append(
            ((valueClass.equals("org.apache.hadoop.io.Text")) ? "toString()" : "get()"));
        stringBuffer.append(TEXT_45);

      } else {
        if (metadata != null) {
          List<IMetadataColumn> listColumns = metadata.getListColumns();
          for (int valueN = 0; valueN < listColumns.size(); valueN++) {
            IMetadataColumn column = listColumns.get(valueN);

            String typeToGenerate =
                JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
            JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
            String patternValue =
                column.getPattern() == null || column.getPattern().trim().length() == 0
                    ? null
                    : column.getPattern();
            if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) {

              stringBuffer.append(TEXT_46);
              stringBuffer.append(firstConnName);
              stringBuffer.append(TEXT_47);
              stringBuffer.append(column.getLabel());
              stringBuffer.append(TEXT_48);
              stringBuffer.append(cid);
              stringBuffer.append(TEXT_49);
              stringBuffer.append(valueN);
              stringBuffer.append(TEXT_50);

            } else {

              stringBuffer.append(TEXT_51);
              stringBuffer.append(cid);
              stringBuffer.append(TEXT_52);
              stringBuffer.append(valueN);
              stringBuffer.append(TEXT_53);
              stringBuffer.append(cid);
              stringBuffer.append(TEXT_54);
              stringBuffer.append(valueN);
              stringBuffer.append(TEXT_55);

              if (javaType == JavaTypesManager.DATE) {

                stringBuffer.append(TEXT_56);
                stringBuffer.append(firstConnName);
                stringBuffer.append(TEXT_57);
                stringBuffer.append(column.getLabel());
                stringBuffer.append(TEXT_58);
                stringBuffer.append(cid);
                stringBuffer.append(TEXT_59);
                stringBuffer.append(valueN);
                stringBuffer.append(TEXT_60);
                stringBuffer.append(patternValue);
                stringBuffer.append(TEXT_61);

              } else if (javaType == JavaTypesManager.BYTE_ARRAY) {

                stringBuffer.append(TEXT_62);
                stringBuffer.append(firstConnName);
                stringBuffer.append(TEXT_63);
                stringBuffer.append(column.getLabel());
                stringBuffer.append(TEXT_64);
                stringBuffer.append(cid);
                stringBuffer.append(TEXT_65);
                stringBuffer.append(valueN);
                stringBuffer.append(TEXT_66);
                stringBuffer.append((customEncoding ? encoding : "utf8Charset"));
                stringBuffer.append(TEXT_67);

              } else {

                stringBuffer.append(TEXT_68);
                stringBuffer.append(firstConnName);
                stringBuffer.append(TEXT_69);
                stringBuffer.append(column.getLabel());
                stringBuffer.append(TEXT_70);
                stringBuffer.append(typeToGenerate);
                stringBuffer.append(TEXT_71);
                stringBuffer.append(cid);
                stringBuffer.append(TEXT_72);
                stringBuffer.append(valueN);
                stringBuffer.append(TEXT_73);
              }

              stringBuffer.append(TEXT_74);
              stringBuffer.append(firstConnName);
              stringBuffer.append(TEXT_75);
              stringBuffer.append(column.getLabel());
              stringBuffer.append(TEXT_76);
              stringBuffer.append(JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate));
              stringBuffer.append(TEXT_77);
            }
          } // for
        }
      }

      stringBuffer.append(TEXT_78);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_79);

      log4jFileUtil.debugRetriveData(node);
    }

    stringBuffer.append(TEXT_80);
    return stringBuffer.toString();
  }
Exemplo n.º 3
0
  public String generate(Object argument) {
    final StringBuffer stringBuffer = new StringBuffer();

    CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
    INode node = (INode) codeGenArgument.getArgument();
    String cid = node.getUniqueName();

    String distribution = ElementParameterParser.getValue(node, "__DISTRIBUTION__");
    String pigVersion = ElementParameterParser.getValue(node, "__PIG_VERSION__");

    boolean isLocal = "true".equals(ElementParameterParser.getValue(node, "__LOCAL__"));

    org.talend.hadoop.distribution.component.PigComponent pigDistrib = null;
    if (!isLocal) {
      try {
        pigDistrib =
            (org.talend.hadoop.distribution.component.PigComponent)
                org.talend.hadoop.distribution.DistributionFactory.buildDistribution(
                    distribution, pigVersion);
      } catch (java.lang.Exception e) {
        e.printStackTrace();
        return "";
      }
    }

    boolean isExecutedThroughWebHCat =
        !isLocal && pigDistrib != null && pigDistrib.isExecutedThroughWebHCat();

    boolean dieOnError = "true".equals(ElementParameterParser.getValue(node, "__DIE_ON_ERROR__"));
    final boolean isLog4jEnabled =
        ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));

    boolean inMain = true;

    if (node.getIncomingConnections() != null && node.getIncomingConnections().size() > 0) {
      INode loadNode = node.getDesignSubjobStartNode();
      inMain = loadNode.isSubtreeStart();
    }

    if (inMain && isExecutedThroughWebHCat) {

      stringBuffer.append(TEXT_1);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_2);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_3);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_4);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_5);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_6);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_7);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_8);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_9);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_10);

      if (dieOnError) {

        stringBuffer.append(TEXT_11);

      } else {

        stringBuffer.append(TEXT_12);

        if (isLog4jEnabled) {

          stringBuffer.append(TEXT_13);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_14);
        }
      }

      stringBuffer.append(TEXT_15);
    }

    stringBuffer.append(TEXT_16);

    if (!dieOnError) {

      stringBuffer.append(TEXT_17);

      if (isLog4jEnabled) {

        stringBuffer.append(TEXT_18);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_19);
      }
    } else {

      stringBuffer.append(TEXT_20);
    }

    stringBuffer.append(TEXT_21);
    stringBuffer.append(TEXT_22);
    return stringBuffer.toString();
  }