use of com.liferay.imex.shell.client.util.TableBuilder in project liferay-imex by jpdacunha.
the class ListExporterCommand method le.
public void le() {
Map<String, ServiceReference<Exporter>> exporters = trackerService.getExporters();
if (exporters != null && exporters.size() > 0) {
TableBuilder tableBuilder = new TableBuilder();
tableBuilder.addHeaders(COLUMN_NAMES);
for (Map.Entry<String, ServiceReference<Exporter>> entry : exporters.entrySet()) {
ServiceReference<Exporter> serviceReference = entry.getValue();
String ranking = (Integer) serviceReference.getProperty(OSGIServicePropsKeys.SERVICE_RANKING) + "";
String description = (String) serviceReference.getProperty(OSGIServicePropsKeys.IMEX_COMPONENT_DESCRIPTION);
String priority = (String) serviceReference.getProperty(OSGIServicePropsKeys.IMEX_COMPONENT_EXECUTION_PRIORITY);
Bundle bundle = serviceReference.getBundle();
Exporter exporter = bundle.getBundleContext().getService(serviceReference);
boolean supportProfile = exporter.isProfiled();
if (bundle != null) {
tableBuilder.addRow(ranking, bundle.getSymbolicName(), description, priority, supportProfile + "");
}
}
tableBuilder.print();
} else {
System.out.println("No IMEX importers registered.");
}
}
use of com.liferay.imex.shell.client.util.TableBuilder in project liferay-imex by jpdacunha.
the class ListTriggerCommand method lt.
public void lt() {
Map<String, ServiceReference<Trigger>> triggers = trackerService.getTriggers();
if (triggers != null && triggers.size() > 0) {
TableBuilder tableBuilder = new TableBuilder();
tableBuilder.addHeaders(COLUMN_NAMES);
for (Map.Entry<String, ServiceReference<Trigger>> entry : triggers.entrySet()) {
ServiceReference<Trigger> serviceReference = entry.getValue();
String ranking = (Integer) serviceReference.getProperty(OSGIServicePropsKeys.SERVICE_RANKING) + "";
Bundle bundle = serviceReference.getBundle();
Trigger trigger = bundle.getBundleContext().getService(serviceReference);
String description = trigger.getTriggerDescription();
String descriptiveName = trigger.getTriggerName();
if (bundle != null) {
tableBuilder.addRow(ranking, bundle.getSymbolicName(), descriptiveName, description);
}
}
tableBuilder.print();
} else {
System.out.println("No IMEX triggers registered.");
}
}
use of com.liferay.imex.shell.client.util.TableBuilder in project liferay-imex by jpdacunha.
the class ListProfileCommand method lp.
public void lp() {
ImexProperties config = new ImexProperties();
configurationService.loadCoreConfiguration(config);
Properties configAsProperties = config.getProperties();
String[] supportedProfiles = CollectionUtil.getArray(configAsProperties.getProperty(ImExCorePropsKeys.MANAGES_PROFILES_LIST));
if (supportedProfiles != null && supportedProfiles.length > 0) {
TableBuilder tableBuilder = new TableBuilder();
tableBuilder.addHeaders(COLUMN_NAMES);
for (String profile : Arrays.asList(supportedProfiles)) {
tableBuilder.addRow(profile);
}
tableBuilder.print();
} else {
System.out.println("No supported profiles. Please see [" + ImExCorePropsKeys.MANAGES_PROFILES_LIST + "] paramater to configure profiles.");
}
}
use of com.liferay.imex.shell.client.util.TableBuilder in project liferay-imex by jpdacunha.
the class ListImporterCommand method li.
public void li() {
Map<String, ServiceReference<Importer>> importers = trackerService.getImporters();
if (importers != null && importers.size() > 0) {
TableBuilder tableBuilder = new TableBuilder();
tableBuilder.addHeaders(COLUMN_NAMES);
for (Map.Entry<String, ServiceReference<Importer>> entry : importers.entrySet()) {
ServiceReference<Importer> serviceReference = entry.getValue();
String ranking = (Integer) serviceReference.getProperty(OSGIServicePropsKeys.SERVICE_RANKING) + "";
String description = (String) serviceReference.getProperty(OSGIServicePropsKeys.IMEX_COMPONENT_DESCRIPTION);
String priority = (String) serviceReference.getProperty(OSGIServicePropsKeys.IMEX_COMPONENT_EXECUTION_PRIORITY);
Bundle bundle = serviceReference.getBundle();
Importer importer = bundle.getBundleContext().getService(serviceReference);
boolean supportProfile = importer.isProfiled();
if (bundle != null) {
tableBuilder.addRow(ranking, bundle.getSymbolicName(), description, priority, supportProfile + "");
}
}
tableBuilder.print();
} else {
System.out.println("No IMEX importers registered.");
}
}
Aggregations