use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.
the class DataSourceRuntimeManagerImpl method deployDataSource.
@Override
public synchronized DataSourceDeploymentInfo deployDataSource(DataSourceDef dataSourceDef, DeploymentOptions options) throws Exception {
try {
DataSourceDeploymentInfo dataSourceDeploymentInfo = dataSourceProvider.getDeploymentInfo(dataSourceDef.getUuid());
DriverDeploymentInfo driverDeploymentInfo = driverProvider.getDeploymentInfo(dataSourceDef.getDriverUuid());
if (dataSourceDeploymentInfo != null) {
if (options.isCreateOrResyncDeployment()) {
dataSourceDeploymentInfo = dataSourceProvider.resync(dataSourceDef, dataSourceDeploymentInfo);
} else {
throw new Exception("Data source: " + dataSourceDef + " is already deployed");
}
} else if (driverDeploymentInfo != null) {
dataSourceDeploymentInfo = dataSourceProvider.deploy(dataSourceDef);
} else {
throw new Exception("Required driver: " + dataSourceDef.getDriverUuid() + " is not deployed.");
}
if (driverDeploymentInfo != null && driverDeploymentCache.get(driverDeploymentInfo) != null) {
driverDeploymentCache.get(driverDeploymentInfo).addDependant(dataSourceDeploymentInfo);
}
return dataSourceDeploymentInfo;
} catch (Exception e) {
logger.error("Data source deployment failed for dataSourceDef: " + dataSourceDef, e);
throw e;
}
}
use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.
the class DataSourceRuntimeManagerImpl method deployDriver.
@Override
public synchronized DriverDeploymentInfo deployDriver(DriverDef driverDef, DeploymentOptions options) throws Exception {
try {
DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(driverDef.getUuid());
if (deploymentInfo != null) {
if (options.isCreateOrResyncDeployment()) {
deploymentInfo = driverProvider.resync(driverDef, deploymentInfo);
} else {
throw new Exception("Driver: " + driverDef + " is already deployed.");
}
} else {
deploymentInfo = driverProvider.deploy(driverDef);
}
driverDeploymentCache.put(deploymentInfo, driverDef);
return deploymentInfo;
} catch (Exception e) {
logger.error("Driver deployment failed for driverDef: " + driverDef, e);
throw e;
}
}
use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.
the class DBCPDriverProviderTest method testDeployDriver.
@Test
public void testDeployDriver() throws Exception {
super.testDeployDriver();
// additional verification
DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(driverDef1.getUuid());
DriverDeploymentInfo expectedDeploymentInfo = new DriverDeploymentInfo(DRIVER1_UUID, DRIVER1_UUID, true, DRIVER1_UUID, DRIVER1_CLASS);
assertEquals(expectedDeploymentInfo, deploymentInfo);
}
use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.
the class WildflyDriverProvider method resync.
@Override
public DriverDeploymentInfo resync(DriverDef driverDef, DriverDeploymentInfo deploymentInfo) throws Exception {
String deploymentId = DeploymentIdGenerator.generateDeploymentId(driverDef);
DriverDeploymentInfo currentDeploymentInfo = findDeploymentInfo(deploymentId, driverDef);
DriverDeploymentInfo result = new DriverDeploymentInfo(deploymentId, currentDeploymentInfo.getDriverDeploymentId(), true, driverDef.getUuid(), driverDef.getDriverClass());
managedDrivers.put(result.getDeploymentId(), result);
return result;
}
use of org.kie.workbench.common.screens.datasource.management.model.DriverDeploymentInfo in project kie-wb-common by kiegroup.
the class WildflyDriverProvider method getDeploymentsInfo.
/**
* Gets the deployment information for all the drivers currently deployed on the Wildfly server.
* @return a list with the deployment information for all the drivers.
* @throws Exception exceptions may be thrown if e.g. communication with the Wildfly server fails, etc.
*/
public List<DriverDeploymentInfo> getDeploymentsInfo() throws Exception {
List<DriverDeploymentInfo> deploymentsInfo = new ArrayList<>();
DriverDeploymentInfo deploymentInfo;
String uuid;
boolean managed;
for (WildflyDriverDef internalDef : driverMgmtClient.getDeployedDrivers()) {
try {
uuid = DeploymentIdGenerator.extractUuid(internalDef.getDriverName());
} catch (Exception e) {
uuid = internalDef.getDriverName();
}
managed = managedDrivers.containsKey(internalDef.getDriverName());
deploymentInfo = new DriverDeploymentInfo(internalDef.getDriverName(), internalDef.getDriverName(), managed, uuid, internalDef.getDriverClass());
deploymentsInfo.add(deploymentInfo);
}
return deploymentsInfo;
}
Aggregations