use of com.liferay.imex.core.service.configuration.model.ConfigurationOverrideProcessIdentifier 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