use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo in project kie-wb-common by kiegroup.
the class KieSQLDataSourceLocatorTest method setup.
@Before
public void setup() {
dataSourceLocator = new KieSQLDataSourceLocator(queryService, runtimeManager);
// initialize the list of existing data sources
dataSourceDefInfos.add(new DataSourceDefInfo("uuid1", "DS1", new DataSourceDeploymentInfo()));
dataSourceDefInfos.add(new DataSourceDefInfo("uuid2", "DS2", new DataSourceDeploymentInfo()));
dataSourceDefInfos.add(new DataSourceDefInfo("uuid3", "DS3", new DataSourceDeploymentInfo()));
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo 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;
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo in project kie-wb-common by kiegroup.
the class DataSourceDefQueryServiceTest method setupExpectedResults.
private void setupExpectedResults() {
expectedDataSources = new ArrayList<>();
expectedDataSources.add(new DataSourceDefInfo("ds1Id", "DS1", Paths.convert(nioDataSourcesPath.resolve("DS1.datasource")), null));
expectedDataSources.add(new DataSourceDefInfo("ds2Id", "DS2", Paths.convert(nioDataSourcesPath.resolve("DS2.datasource")), null));
expectedDrivers = new ArrayList<>();
expectedDrivers.add(new DriverDefInfo("driver1Id", "Driver1", Paths.convert(nioDataSourcesPath.resolve("Driver1.driver")), null));
expectedDrivers.add(new DriverDefInfo("driver2Id", "Driver2", Paths.convert(nioDataSourcesPath.resolve("Driver2.driver")), null));
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo in project kie-wb-common by kiegroup.
the class DataSourceSelector method loadDataSources.
private void loadDataSources(Collection<DataSourceDefInfo> dataSourceDefInfos) {
dataProvider.getList().clear();
for (DataSourceDefInfo defInfo : dataSourceDefInfos) {
dataProvider.getList().add(new DataSourceSelectorPageRow(defInfo));
}
dataProvider.flush();
view.show();
}
use of org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo in project kie-wb-common by kiegroup.
the class KieSQLDataSourceLocator method list.
@Override
public List<SQLDataSourceDef> list() {
Collection<DataSourceDefInfo> dataSourceDefInfos = queryService.findGlobalDataSources(true);
List<SQLDataSourceDef> result = new ArrayList<>();
for (DataSourceDefInfo dataSourceDefInfo : dataSourceDefInfos) {
result.add(new SQLDataSourceDef(dataSourceDefInfo.getUuid(), dataSourceDefInfo.getName()));
}
return result;
}
Aggregations