Search in sources :

Example 1 with DataSourceDefInfo

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()));
}
Also used : DataSourceDefInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo) DataSourceDeploymentInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo) Before(org.junit.Before)

Example 2 with DataSourceDefInfo

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;
}
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)

Example 3 with DataSourceDefInfo

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));
}
Also used : DriverDefInfo(org.kie.workbench.common.screens.datasource.management.model.DriverDefInfo) DataSourceDefInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo)

Example 4 with DataSourceDefInfo

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();
}
Also used : DataSourceDefInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo)

Example 5 with DataSourceDefInfo

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;
}
Also used : SQLDataSourceDef(org.dashbuilder.dataset.def.SQLDataSourceDef) ArrayList(java.util.ArrayList) DataSourceDefInfo(org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo)

Aggregations

DataSourceDefInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDefInfo)8 DataSourceDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DataSourceDeploymentInfo)3 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 DataSourceDef (org.kie.workbench.common.screens.datasource.management.model.DataSourceDef)2 DriverDefInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDefInfo)2 HashMap (java.util.HashMap)1 SQLDataSourceDef (org.dashbuilder.dataset.def.SQLDataSourceDef)1 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1 Branch (org.guvnor.structure.repositories.Branch)1 DeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DeploymentInfo)1 DriverDeploymentInfo (org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo)1 Path (org.uberfire.backend.vfs.Path)1