use of com.liferay.imex.core.api.trigger.Trigger in project liferay-imex by jpdacunha.
the class TriggerTrackerService method addingService.
@Override
public Trigger addingService(ServiceReference<Trigger> serviceReference) {
_serviceReferences.addServiceReference(serviceReference);
Trigger trigger = _bundleContext.getService(serviceReference);
// Calling deploy method on custom service
trigger.deploy();
return trigger;
}
use of com.liferay.imex.core.api.trigger.Trigger 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.core.api.trigger.Trigger in project liferay-imex by jpdacunha.
the class ImexCoreServiceImpl method generateOverrideFileSystemConfigurationFiles.
@Override
public String generateOverrideFileSystemConfigurationFiles(List<String> bundleNames, boolean archive) {
Map<String, ServiceReference<Importer>> importers = importerTrackerService.getFilteredImporters(bundleNames);
Map<String, ServiceReference<Exporter>> exporters = exporterTrackerService.getFilteredExporters(bundleNames);
Map<String, ServiceReference<Trigger>> triggers = triggerTrackerService.getTriggers();
Map<String, Properties> props = configurationService.loadAllConfigurationMap(bundleNames, importers, exporters, triggers);
ProcessIdentifierGenerator processIdentifier = new ConfigurationOverrideProcessIdentifier();
String identifier = processIdentifier.getOrGenerateUniqueIdentifier();
LoggingContext.put(ImexExecutionReportService.IDENTIFIER_KEY, identifier);
reportService.getStartMessage(_log, "CFG_OVERRIDE process");
// Initialisation répertoire de configuration
initializeConfigurationtDirectories();
if (props != null) {
if (archive) {
ImexProperties coreConfig = new ImexProperties();
configurationService.loadCoreConfiguration(coreConfig);
imexArchiverService.archiveCfgDirectory(coreConfig.getProperties(), processIdentifier);
}
Bundle coreBundle = FrameworkUtil.getBundle(this.getClass());
String coreBundleName = coreBundle.getSymbolicName();
mergeConfiguration(props, coreBundleName, coreBundle);
// Merging importers
for (Map.Entry<String, ServiceReference<Importer>> entry : importers.entrySet()) {
ServiceReference<Importer> reference = entry.getValue();
Bundle bundle = reference.getBundle();
String key = entry.getKey();
mergeConfiguration(props, key, bundle);
}
// Merging exporters
for (Map.Entry<String, ServiceReference<Exporter>> entry : exporters.entrySet()) {
ServiceReference<Exporter> reference = entry.getValue();
Bundle bundle = reference.getBundle();
String key = entry.getKey();
mergeConfiguration(props, key, bundle);
}
// Merging triggers
for (Map.Entry<String, ServiceReference<Trigger>> entry : triggers.entrySet()) {
ServiceReference<Trigger> reference = entry.getValue();
Bundle bundle = reference.getBundle();
String key = entry.getKey();
mergeConfiguration(props, key, bundle);
}
}
reportService.getEndMessage(_log, "CFG_OVERRIDE process");
return identifier;
}
Aggregations