use of com.sun.enterprise.util.ColumnFormatter in project Payara by payara.
the class GetJmsNotifierConfiguration method listConfiguration.
@Override
protected String listConfiguration(JmsNotifierConfiguration configuration) {
String[] headers = { "Enabled", "Context Factory Class", "Connection Factory Name", "Queue Name", "URL", "Username", "Password" };
ColumnFormatter columnFormatter = new ColumnFormatter(headers);
Object[] values = new Object[7];
values[0] = configuration.getEnabled();
values[1] = configuration.getContextFactoryClass();
values[2] = configuration.getConnectionFactoryName();
values[3] = configuration.getQueueName();
values[4] = configuration.getUrl();
values[5] = configuration.getUsername();
values[6] = configuration.getPassword();
columnFormatter.addRow(values);
return columnFormatter.toString();
}
use of com.sun.enterprise.util.ColumnFormatter in project Payara by payara.
the class GetNewRelicNotifierConfiguration method listConfiguration.
@Override
protected String listConfiguration(NewRelicNotifierConfiguration configuration) {
String[] headers = { "Enabled", "Key", "Account Id" };
ColumnFormatter columnFormatter = new ColumnFormatter(headers);
Object[] values = new Object[3];
values[0] = configuration.getEnabled();
values[1] = configuration.getKey();
values[2] = configuration.getAccountId();
columnFormatter.addRow(values);
return columnFormatter.toString();
}
use of com.sun.enterprise.util.ColumnFormatter in project Payara by payara.
the class GetXmppNotifierConfiguration method listConfiguration.
@Override
protected String listConfiguration(XmppNotifierConfiguration configuration) {
String[] headers = { "Enabled", "Host", "Port", "Service Name", "Username", "Password", "Security Disabled", "Room ID" };
ColumnFormatter columnFormatter = new ColumnFormatter(headers);
Object[] values = new Object[8];
values[0] = configuration.getEnabled();
values[1] = configuration.getHost();
values[2] = configuration.getPort();
values[3] = configuration.getServiceName();
values[4] = configuration.getUsername();
values[5] = configuration.getPassword();
values[6] = configuration.getSecurityDisabled();
values[7] = configuration.getRoomId();
columnFormatter.addRow(values);
return columnFormatter.toString();
}
use of com.sun.enterprise.util.ColumnFormatter in project Payara by payara.
the class GetCDIEventbusNotifierConfiguration method listConfiguration.
@Override
protected String listConfiguration(CDIEventbusNotifierConfiguration configuration) {
String[] headers = { "Enabled", "LoopBack" };
ColumnFormatter columnFormatter = new ColumnFormatter(headers);
Object[] values = new Object[2];
values[0] = configuration.getEnabled();
values[1] = configuration.getLoopBack();
columnFormatter.addRow(values);
return columnFormatter.toString();
}
use of com.sun.enterprise.util.ColumnFormatter in project Payara by payara.
the class GetNotificationConfiguration method execute.
@Override
public void execute(AdminCommandContext context) {
Config config = targetUtil.getConfig(target);
if (config == null) {
context.getActionReport().setMessage("No such config named: " + target);
context.getActionReport().setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
ActionReport mainActionReport = context.getActionReport();
final NotificationServiceConfiguration notificationServiceConfiguration = config.getExtensionByType(NotificationServiceConfiguration.class);
NotificationServiceConfiguration configuration = config.getExtensionByType(NotificationServiceConfiguration.class);
List<ServiceHandle<BaseNotifierService>> allServiceHandles = habitat.getAllServiceHandles(BaseNotifierService.class);
String[] headers = { "Enabled", "Notifier Enabled" };
ColumnFormatter columnFormatter = new ColumnFormatter(headers);
if (configuration.getNotifierConfigurationList().isEmpty()) {
mainActionReport.setMessage("No notifier defined");
} else {
List<Class<NotifierConfiguration>> notifierConfigurationClassList = Lists.transform(configuration.getNotifierConfigurationList(), new Function<NotifierConfiguration, Class<NotifierConfiguration>>() {
@Override
public Class<NotifierConfiguration> apply(NotifierConfiguration input) {
return resolveNotifierConfigurationClass(input);
}
});
Properties extraProps = new Properties();
for (ServiceHandle<BaseNotifierService> serviceHandle : allServiceHandles) {
NotifierConfiguration notifierConfiguration = configuration.getNotifierConfigurationByType(serviceHandle.getService().getNotifierConfigType());
if (notifierConfiguration != null) {
ConfigView view = ConfigSupport.getImpl(notifierConfiguration);
NotifierConfigurationType annotation = view.getProxyType().getAnnotation(NotifierConfigurationType.class);
if (notifierConfigurationClassList.contains(view.<NotifierConfiguration>getProxyType())) {
Object[] values = new Object[2];
values[0] = notificationServiceConfiguration.getEnabled();
values[1] = notifierConfiguration.getEnabled();
columnFormatter.addRow(values);
Map<String, Object> map;
if (NotifierType.LOG.equals(annotation.type())) {
map = new HashMap<>(3);
map.put("enabled", values[0]);
map.put("notifierEnabled", values[1]);
LogNotifierConfiguration logNotifierConfiguration = (LogNotifierConfiguration) notifierConfiguration;
map.put("useSeparateLogFile", logNotifierConfiguration.getUseSeparateLogFile());
} else {
map = new HashMap<>(2);
map.put("enabled", values[0]);
map.put("notifierEnabled", values[1]);
}
extraProps.put("getNotificationConfiguration" + annotation.type(), map);
}
}
}
mainActionReport.setExtraProperties(extraProps);
mainActionReport.setMessage(columnFormatter.toString());
}
mainActionReport.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Aggregations