Search in sources :

Example 1 with DeploymentInfo

use of org.kie.workbench.common.screens.datasource.management.model.DeploymentInfo in project kie-wb-common by kiegroup.

the class DataSourceDefQueryServiceImpl method findGlobalDataSources.

@Override
public Collection<DataSourceDefInfo> findGlobalDataSources(boolean includeUnManaged) {
    Collection<DataSourceDefInfo> result = resolveDataSources(serviceHelper.getGlobalDataSourcesContext());
    if (includeUnManaged) {
        Map<String, DataSourceDefInfo> managedDataSources = new HashMap<>();
        for (DataSourceDefInfo dataSourceDefInfo : result) {
            managedDataSources.put(dataSourceDefInfo.getUuid(), dataSourceDefInfo);
        }
        try {
            List<DataSourceDef> allDeployments = providerFactory.getDataSourceProvider().getDeployments();
            DeploymentInfo deploymentInfo;
            for (DataSourceDef dataSourceDef : allDeployments) {
                deploymentInfo = runtimeManager.getDataSourceDeploymentInfo(dataSourceDef.getUuid());
                if (!managedDataSources.containsKey(dataSourceDef.getUuid()) && (deploymentInfo != null && !deploymentInfo.isManaged())) {
                    result.add(new DataSourceDefInfo(dataSourceDef.getUuid(), dataSourceDef.getName(), runtimeManager.getDataSourceDeploymentInfo(dataSourceDef.getUuid())));
                }
            }
        } catch (Exception e) {
            logger.warn("It was not possible to read all deployed data sources. ", e);
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) DataSourceDef(org.kie.workbench.common.screens.datasource.management.model.DataSourceDef) DataSourceDefInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo) DataSourceDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo) DeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DeploymentInfo) DriverDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo)

Aggregations

HashMap (java.util.HashMap)1 DataSourceDef (org.kie.workbench.common.screens.datasource.management.model.DataSourceDef)1 DataSourceDefInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo)1 DataSourceDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo)1 DeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DeploymentInfo)1 DriverDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo)1