Search in sources :

Example 1 with SimpleLoggingTable

use of org.mule.runtime.core.internal.util.splash.SimpleLoggingTable in project mule by mulesoft.

the class StartupSummaryDeploymentListener method onAfterStartup.

public void onAfterStartup() {
    if (!logger.isInfoEnabled()) {
        return;
    }
    Multimap<String, String> applicationsPerDomain = LinkedListMultimap.create();
    Map<String, ArtifactDeploymentStatusTracker.DeploymentState> domainDeploymentState = tracker.getDomainDeploymentStatusTracker().getDeploymentStates();
    SimpleLoggingTable domainTable = new SimpleLoggingTable();
    domainTable.addColumn(DOMAIN_OWNER_LABEL, ARTIFACT_NAME_LABEL_LENGTH);
    domainTable.addColumn(STATUS_LABEL, STATUS_LABEL_LENGTH);
    for (String domain : domainDeploymentState.keySet()) {
        String[] data = new String[] { domain, domainDeploymentState.get(domain).toString() };
        domainTable.addDataRow(data);
    }
    Map<String, ArtifactDeploymentStatusTracker.DeploymentState> applicationStates = tracker.getApplicationDeploymentStatusTracker().getDeploymentStates();
    for (String applicationName : applicationStates.keySet()) {
        Application application = deploymentService.findApplication(applicationName);
        String domainName = UNKNOWN_ARTIFACT_NAME;
        if (application != null) {
            domainName = application.getDomain().getArtifactName();
        }
        applicationsPerDomain.put(domainName, applicationName);
    }
    String message;
    if (!applicationsPerDomain.isEmpty()) {
        SimpleLoggingTable applicationTable = new SimpleLoggingTable();
        applicationTable.addColumn(APPLICATION_LABEL, ARTIFACT_NAME_LABEL_LENGTH);
        applicationTable.addColumn(DOMAIN_OWNER_LABEL, DOMAIN_OWNER_LABEL_LENGTH);
        applicationTable.addColumn(STATUS_LABEL, STATUS_LABEL_LENGTH);
        for (String domainName : applicationsPerDomain.keySet()) {
            for (String app : applicationsPerDomain.get(domainName)) {
                String[] data = new String[] { app, domainName, applicationStates.get(app).toString() };
                applicationTable.addDataRow(data);
            }
        }
        message = String.format("%n%s%n%s", domainTable, applicationTable);
    } else {
        message = String.format("%n%s", domainTable);
    }
    logger.info(message);
}
Also used : SimpleLoggingTable(org.mule.runtime.core.internal.util.splash.SimpleLoggingTable) Application(org.mule.runtime.deployment.model.api.application.Application)

Aggregations

SimpleLoggingTable (org.mule.runtime.core.internal.util.splash.SimpleLoggingTable)1 Application (org.mule.runtime.deployment.model.api.application.Application)1