@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; }
@Override public synchronized DriverDeploymentInfo getDriverDeploymentInfo(String uuid) throws Exception { try { DriverDeploymentInfo deploymentInfo = driverProvider.getDeploymentInfo(uuid); if (deploymentInfo != null && driverDeploymentCache.get(deploymentInfo) != null) { DriverDeploymentInfo updatedInfo = new DriverDeploymentInfo(deploymentInfo.getDeploymentId(), deploymentInfo.getDriverDeploymentId(), deploymentInfo.isManaged(), deploymentInfo.getUuid(), deploymentInfo.getDriverClass()); updatedInfo.getDependants().addAll(driverDeploymentCache.get(deploymentInfo).getDependants()); deploymentInfo = updatedInfo; } return deploymentInfo; } catch (Exception e) { logger.error("It was not possible to read the deploymentInfo for driver: " + uuid); throw e; } }
/** * Creates a data source in the Wildfly server. * @param dataSourceDef Data source definition to be created. * @param jndi jndi name to be use the Wildly server to bound the data source in the jndi context. * @return returns the deployment information for the created data source. * @throws Exception exceptions may be thrown if the data source couldn't be created. */ private DataSourceDeploymentInfo deploy(final DataSourceDef dataSourceDef, final String jndi, String deploymentId) throws Exception { DriverDeploymentInfo driverDeploymentInfo = driverProvider.getDeploymentInfo(dataSourceDef.getDriverUuid()); if (driverDeploymentInfo == null) { throw new Exception("Required driver: " + dataSourceDef.getDriverUuid() + " is not deployed."); } WildflyDataSourceDef wfDataSourceDef = buildWFDataSource(deploymentId, jndi, dataSourceDef, driverDeploymentInfo.getDriverDeploymentId()); dataSourceMgmtClient.createDataSource(wfDataSourceDef); return new DataSourceDeploymentInfo(deploymentId, true, dataSourceDef.getUuid(), jndi, false); }