Example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR

List of usage examples for org.apache.commons.lang SystemUtils LINE_SEPARATOR

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Prototype

String LINE_SEPARATOR

To view the source code for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Click Source Link

Document

The line.separator System Property.

Usage

From source file:org.pentaho.di.trans.steps.terafast.FastloadControlBuilder.java

/**
 * Append new line.// ww w . java 2 s  . c o  m
 *
 * @return this.
 */
public FastloadControlBuilder newline() {
    this.builder.append(';');
    this.builder.append(SystemUtils.LINE_SEPARATOR);
    return this;
}

From source file:org.pentaho.di.trans.steps.terafast.FastloadControlBuilder.java

/**
 * @param targetTableFields/*from  ww  w.j a va  2 s.  c  o m*/
 *          ...
 * @param dataFile
 *          ...
 * @return this
 */
public FastloadControlBuilder define(final RowMetaInterface targetTableFields,
        StringListPluginProperty tableFieldList, final String dataFile) {
    Assert.assertNotNull(targetTableFields, "fields cannot be null");
    Assert.assertNotNull(dataFile, "dataFile cannot be null");

    this.builder.append("DEFINE ");
    for (int i = 0; i < targetTableFields.size(); i++) {
        ValueMetaInterface value = targetTableFields.getValueMeta(i);
        int tableIndex = tableFieldList.getValue().indexOf(value.getName());
        if (tableIndex >= 0) {
            this.builder.append(value.getName());
            // all fields of type VARCHAR. converted by fastload if necessary
            int length = 0;
            if (value.getType() == ValueMetaInterface.TYPE_DATE) {
                length = DEFAULT_DATE_FORMAT.length();
            } else {
                length = value.getLength();
            }
            this.builder.append("(" + "VARCHAR(" + length + "), nullif = '"
                    + String.format("%1$" + length + "s", DEFAULT_NULL_VALUE) + "'), ");
            this.builder.append(SystemUtils.LINE_SEPARATOR);
        }
    }
    this.builder.append(" NEWLINECHAR(VARCHAR(" + SystemUtils.LINE_SEPARATOR.length() + "))");
    this.builder.append(" FILE=" + dataFile);
    return this.newline();
}

From source file:org.pentaho.di.trans.steps.terafast.FastloadControlBuilderIT.java

public void testErrorTablesBuilding() {

    FastloadControlBuilder fastloadControlBuilder = new FastloadControlBuilder();
    String expectedResult = "BEGIN LOADING myTable ERRORFILES MyDB.error1,MyDB.error2;"
            + SystemUtils.LINE_SEPARATOR;
    fastloadControlBuilder.beginLoading("MyDB", "myTable");
    assertEquals(expectedResult, fastloadControlBuilder.toString());

    // Create a new FastloadControlBuilder or we will be appending to the
    // fastloadControlBuilder's previous test
    fastloadControlBuilder = new FastloadControlBuilder();
    expectedResult = "BEGIN LOADING myTable ERRORFILES error1,error2;" + SystemUtils.LINE_SEPARATOR;
    fastloadControlBuilder.beginLoading(null, "myTable");
    assertEquals(expectedResult, fastloadControlBuilder.toString());

    // Create a new FastloadControlBuilder or we will be appending to the
    // fastloadControlBuilder's previous test
    fastloadControlBuilder = new FastloadControlBuilder();
    expectedResult = "BEGIN LOADING myTable ERRORFILES error1,error2;" + SystemUtils.LINE_SEPARATOR;
    fastloadControlBuilder.beginLoading("", "myTable");
    assertEquals(expectedResult, fastloadControlBuilder.toString());
}

From source file:org.qedeq.base.utility.StringUtility.java

/**
 * Get platform dependent line separator. (<code>&quot;\n&quot;</code> on UNIX).
 *
 * @return  Platform dependent line separator.
 *//*  w w  w.j a  va2 s . com*/
public static String getSystemLineSeparator() {
    return (SystemUtils.LINE_SEPARATOR != null ? SystemUtils.LINE_SEPARATOR : "\n");
}

From source file:org.sipfoundry.sipxconfig.snmp.SnmpConfig.java

void writeActiveAlarms(Writer w, Collection<Alarm> alarms, Location location) throws IOException {
    for (String config : m_alarmServerManager.getActiveMonitorConfiguration(m_snmp, alarms, location)) {
        w.write(config);//from   w w  w .  j ava2  s. c o m
        w.write(SystemUtils.LINE_SEPARATOR);
    }
}

From source file:org.sipfoundry.sipxconfig.snmp.SnmpConfig.java

void writeProcesses(Writer w, List<ProcessDefinition> defs) throws IOException {
    String eol = SystemUtils.LINE_SEPARATOR;
    for (ProcessDefinition def : defs) {
        w.write("proc ");
        w.write(def.getProcess());/* w w  w. j ava2 s  . c  o  m*/
        String regexp = def.getRegexp();
        if (StringUtils.isNotBlank(regexp)) {
            // max min (max of 0 means unlimited)
            w.write(" 0 1 ");
            w.write(regexp);
        }
        w.write(eol);
        if (StringUtils.isNotBlank(def.getRestartCommand())) {
            String fix = format("procfix %s $(sipx.SIPX_LIBEXECDIR)/snmp-fix-process %s %s\n", def.getProcess(),
                    def.getProcess(), def.getRestartCommand());
            w.write(fix);
        }
    }
}

From source file:org.sonar.api.utils.command.CommandExecutorTest.java

@Test
public void should_consume_StdOut_and_StdErr() throws Exception {
    final StringBuilder stdOutBuilder = new StringBuilder();
    StreamConsumer stdOutConsumer = new StreamConsumer() {
        public void consumeLine(String line) {
            stdOutBuilder.append(line).append(SystemUtils.LINE_SEPARATOR);
        }/*from   w w w . jav a 2s . com*/
    };
    final StringBuilder stdErrBuilder = new StringBuilder();
    StreamConsumer stdErrConsumer = new StreamConsumer() {
        public void consumeLine(String line) {
            stdErrBuilder.append(line).append(SystemUtils.LINE_SEPARATOR);
        }
    };
    Command command = Command.create(getScript("output")).setDirectory(workDir);
    int exitCode = CommandExecutor.create().execute(command, stdOutConsumer, stdErrConsumer, 1000L);
    assertThat(exitCode).isEqualTo(0);

    String stdOut = stdOutBuilder.toString();
    String stdErr = stdErrBuilder.toString();
    assertThat(stdOut).contains("stdOut: first line");
    assertThat(stdOut).contains("stdOut: second line");
    assertThat(stdErr).contains("stdErr: first line");
    assertThat(stdErr).contains("stdErr: second line");
}

From source file:org.sonar.batch.scan.filesystem.WhiteListFileFilter.java

@Override
public String toString() {
    return StringUtils.capitalize(fileType.name().toLowerCase()) + " files: " + SystemUtils.LINE_SEPARATOR
            + Joiner.on(SystemUtils.LINE_SEPARATOR).join(files);
}

From source file:org.sonar.core.measure.MeasureFilterEngine.java

private void log(MeasureFilterContext context, MeasureFilterResult result, Logger logger) {
    if (logger.isDebugEnabled()) {
        StringBuilder log = new StringBuilder();
        log.append(SystemUtils.LINE_SEPARATOR);
        log.append("request: ").append(context.getData()).append(SystemUtils.LINE_SEPARATOR);
        log.append(" result: ").append(result.toString()).append(SystemUtils.LINE_SEPARATOR);
        log.append("    sql: ").append(context.getSql()).append(SystemUtils.LINE_SEPARATOR);
        logger.debug(log.toString());//from w  w w. j  a va 2s .c o m
    }
}

From source file:org.sonar.plugins.scmactivity.Blame.java

BlameScmResult retrieveBlame(File file) {
    try {//from  w ww .j  a va2s. c om
        Logs.INFO.info("Retrieve SCM info for " + file);
        BlameScmResult result = scmManager.blame(repositoryBuilder.getScmRepository(),
                new ScmFileSet(file.getParentFile()), file.getName());
        if (!result.isSuccess()) {
            LOG.warn("Fail to retrieve SCM info of: " + file + ". Reason: " + result.getProviderMessage()
                    + SystemUtils.LINE_SEPARATOR + result.getCommandOutput());
            return null;
        }
        return result;

    } catch (ScmException e) {
        // See SONARPLUGINS-368. Can occur on generated source
        LOG.warn("Fail to retrieve SCM info of: " + file, e);
        return null;
    }
}