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);
applicationsPerDomain.put(application.getDomain().getArtifactName(), 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);
}