Example usage for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE

List of usage examples for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE.

Prototype

ToStringStyle SHORT_PREFIX_STYLE

To view the source code for org.apache.commons.lang.builder ToStringStyle SHORT_PREFIX_STYLE.

Click Source Link

Document

The short prefix toString style.

Usage

From source file:com.adaptris.core.MleMarker.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getUniqueId())
            .append("name", getName()).append("qualifier", getQualifier())
            .append("creationTime", getCreationTime()).append("wasSuccessful", getWasSuccessful())
            .append("sequenceNumber", getSequenceNumber()).append("confirmationId", getConfirmationId())
            .append("isConfirmation", getIsConfirmation()).append("isTrackingEndpoint", getIsTrackingEndpoint())
            .toString();/*from w  ww  .  j  a  va 2  s  .c  o  m*/
}

From source file:acromusashi.stream.hook.AmLogServerAdapter.java

/**
 * Log emit info.//from ww  w  .  ja  v a 2s  . c  o m
 * 
 * @param componentInfo component info
 * @param info emit info
 */
public void emit(ComponentInfo componentInfo, EmitInfo info) {
    if (this.sessions.size() == 0) {
        return;
    }

    Date nowTime = new Date();
    DateFormat format = new SimpleDateFormat(DATE_PATTERN);
    String nowTimeStr = format.format(nowTime);

    Map<String, Object> objectMap = Maps.newHashMap();
    objectMap.put("time", nowTimeStr);
    objectMap.put("component", componentInfo);
    objectMap.put("emitinfo", info);

    String logInfo;
    try {
        logInfo = this.mapper.writeValueAsString(objectMap);
    } catch (JsonProcessingException ex) {
        String msgFormat = "Event convert failed. Skip log output. : ComponentInfo={0}, EmitInfo={1}";
        String message = MessageFormat.format(msgFormat, componentInfo,
                ToStringBuilder.reflectionToString(info, ToStringStyle.SHORT_PREFIX_STYLE));
        logger.warn(message, ex);
        return;
    }

    for (Entry<String, Session> entry : this.sessions.entrySet()) {
        entry.getValue().getAsyncRemote().sendText(logInfo, this.handler);
    }
}

From source file:com.datatorrent.stram.engine.StreamContext.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("sourceId", sourceId)
            .append("sinkId", sinkId).toString();
}

From source file:jp.primecloud.auto.zabbix.client.ItemClientTest.java

@Test
@Ignore/*from   w w  w.  j a va 2 s.c  o m*/
public void testGetFromApplication() {
    // ?
    ItemGetParam param = new ItemGetParam();

    List<String> hostids = new ArrayList<String>();
    hostids.add("10283");
    param.setHostids(hostids);
    param.setApplication("syslog-ng");
    param.setOutput("extend");
    List<Item> items = client.item().get(param);
    log.debug("item_size :" + items.size());
    for (Item item : items) {
        log.debug(ReflectionToStringBuilder.toString(item, ToStringStyle.SHORT_PREFIX_STYLE));

    }
}

From source file:com.adaptris.core.MessageLifecycleEvent.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getMessageUniqueId())
            .append("channelID", getChannelId()).append("workflowID", getWorkflowId())
            .append("messageEvents", getMleMarkers()).toString();
}

From source file:info.magnolia.cms.security.auth.PrincipalCollectionImpl.java

/**
 * @see java.lang.Object#toString()/*www. j a va 2s .  com*/
 */
@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("name", getName()).toString();
}

From source file:com.ibm.watson.app.qaclassifier.services.entities.tracking.ImpressionEntity.java

public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString())
            .append("referral", this.referral == null ? null : this.referral.getId())
            .append("prompt", this.prompt).append("class", this.classifiedClass).append("offset", this.offset)
            .append("action", this.action).append("location", this.location)
            .append("provenance", this.provenance).append("confidence", this.confidence).toString();
}

From source file:jp.primecloud.auto.puppet.PuppetClient.java

public void runClient(String fqdn) {
    // siteFile?touch?
    touchFile(siteFile);//  w w w . j a  v a 2 s. c  o  m

    // ??touch?
    File manifestFile = new File(manifestDir, fqdn + ".pp");
    touchFile(manifestFile.getAbsolutePath());

    // ???
    if (delayTime != null) {
        try {
            Thread.sleep(delayTime.intValue() * 1000);
        } catch (InterruptedException ignore) {
        }
    }

    // puppetrun?????
    String beforeReportFile = reportLoader.getLatestReportFile(fqdn);
    Long beforeLastModified = null;
    if (beforeReportFile != null) {
        beforeLastModified = reportLoader.getLastModified(fqdn, beforeReportFile);
    }

    List<String> commands = new ArrayList<String>();
    commands.add("/usr/bin/sudo");
    commands.add(puppetrunPath);
    commands.add("--host");
    commands.add(fqdn);
    commands.add("--foreground"); // Puppet???
    commands.add("--ping");

    // puppetrun??
    if (configTimeout != null) {
        commands.add("--configtimeout=" + configTimeout.toString());
    }

    log.debug(commands);
    CommandResult result = executeRun(commands);

    int retryCount = 0;
    while (result.getExitValue() != 0 && retryCount < 6) {
        // ???????
        boolean retry = false;
        for (String stdout : result.getStdouts()) {
            log.warn(stdout);
            if (stdout.contains("Certificates were not trusted: ")) {
                retry = true;
                break;
            } else if (stdout.contains("Connection reset by peer")) {
                retry = true;
                break;
            } else if (stdout.contains("Could not contact")) {
                retry = true;
                break;
            }
        }

        if (!retry) {
            // ????
            break;
        }

        // ???
        log.warn(ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));

        // ??
        try {
            Thread.sleep(5 * 1000);
        } catch (InterruptedException ignore) {
        }
        result = executeRun(commands);

        retryCount++;
    }

    if (result.getExitValue() != 0) {
        // puppetrun??
        AutoException exception;

        if (result.getStdouts().size() > 0 && result.getStdouts().get(0).contains("Could not contact")) {
            // ??ping????????
            exception = new AutoException("EPUPPET-000002", fqdn);
        } else if (result.getStdouts().size() > 0 && result.getStdouts().get(0).contains("Could not connect")) {
            // ???????????????
            try {
                Thread.sleep(100000);
            } catch (InterruptedException ignore) {
            }
            //?
            exception = new AutoException("EPUPPET-000007", fqdn);
        } else if (result.getStdouts().size() > 0
                && result.getStdouts().get(0).contains("returned unknown answer")) {
            // ???????????????()
            try {
                Thread.sleep(100000);
            } catch (InterruptedException ignore) {
            }
            //?
            exception = new AutoException("EPUPPET-000007", fqdn);
        } else {
            exception = new AutoException("EPUPPET-000001", fqdn);
        }

        exception.addDetailInfo(
                "result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
        throw exception;
    }

    // ???
    String reportFile = null;
    for (int i = 0; i < 30; i++) {
        try {
            Thread.sleep(1 * 1000);
        } catch (InterruptedException ignore) {
        }

        String tmpReportFile = reportLoader.getLatestReportFile(fqdn);
        if (tmpReportFile != null) {
            if (beforeLastModified == null) {
                reportFile = tmpReportFile;
                break;
            } else {
                Long lastModified = reportLoader.getLastModified(fqdn, tmpReportFile);
                if (lastModified.longValue() != beforeLastModified.longValue()) {
                    reportFile = tmpReportFile;
                    break;
                }
            }
        }
    }

    if (reportFile != null) {
        // ?????
        Map<String, Object> report = reportLoader.loadReport(fqdn, reportFile);
        String status = reportAnalyzer.getStatus(report);
        if (status.equals("failed")) {
            // ????????()
            throw new AutoException("EPUPPET-000003", fqdn, reportFile);
        }
        List<MetricsResource> metricsResources = reportAnalyzer.getMetricsResources(report);
        for (MetricsResource metricsResource : metricsResources) {
            if (metricsResource.getName().startsWith("Failed") && metricsResource.getCount() > 0) {
                // ????????
                throw new AutoException("EPUPPET-000003", fqdn, reportFile);
            }
        }
    } else {
        // ????????
        throw new AutoException("EPUPPET-000007", fqdn);
    }
}

From source file:com.xtructure.xneat.genetics.link.impl.AbstractLinkGene.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)//
            .append("id", getId())//
            .append("source", getSourceId())//
            .append("target", getTargetId())//
            .append("inn", getInnovation())//
            .append("fields", getFieldMap())//
            .toString();//from   w w w  . j av a2  s  .c o m
}

From source file:edu.internet2.middleware.psp.spml.config.PsoAttribute.java

/** {@inheritDoc} */
public String toString() {
    ToStringBuilder toStringBuilder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
    toStringBuilder.append("name", name);
    toStringBuilder.append("ref", ref);
    toStringBuilder.append("retainAll", retainAll);
    toStringBuilder.append("isMultiValued", isMultiValued);
    return toStringBuilder.toString();
}