@Override public void undeploy(final DataSourceDeploymentInfo deploymentInfo) throws Exception { DataSourceDeploymentInfo currentDeploymentInfo = getDeploymentInfo(deploymentInfo.getUuid()); if (currentDeploymentInfo == null) { throw new Exception("DataSource: " + deploymentInfo.getUuid() + " is not deployed"); } dataSourceMgmtClient.deleteDataSource(currentDeploymentInfo.getDeploymentId()); managedDataSources.remove(currentDeploymentInfo.getDeploymentId()); }
public DataSourceDeploymentInfo resync(DataSourceDef dataSourceDef, DataSourceDeploymentInfo deploymentInfo) throws Exception { javax.sql.DataSource dataSource = (javax.sql.DataSource) jndiLookupDataSource(deploymentInfo.getJndi()); WildlfyDataSource wfDataSource = new WildlfyDataSource(dataSource, deploymentInfo.getJndi()); managedDataSources.put(deploymentInfo.getDeploymentId(), wfDataSource); return deploymentInfo; }
@Override public DataSource lookupDataSource(DataSourceDeploymentInfo deploymentInfo) throws Exception { WildlfyDataSource dataSource = managedDataSources.get(deploymentInfo.getDeploymentId()); if (dataSource == null) { dataSource = unManagedDataSources.get(deploymentInfo.getDeploymentId()); } if (dataSource == null) { DataSourceDeploymentInfo refreshedDeploymentInfo = getDeploymentInfo(deploymentInfo.getUuid()); if (refreshedDeploymentInfo != null && refreshedDeploymentInfo.getJndi() != null) { javax.sql.DataSource sqlDataSource = (javax.sql.DataSource) jndiLookupDataSource(refreshedDeploymentInfo.getJndi()); if (sqlDataSource != null) { dataSource = new WildlfyDataSource(sqlDataSource, refreshedDeploymentInfo.getJndi()); unManagedDataSources.put(deploymentInfo.getDeploymentId(), dataSource); return dataSource; } } } if (dataSource != null) { if (dataSource.isNew()) { //first access to the data source dataSource.setStatus(DataSourceStatus.REFERENCED); } return dataSource; } else { throw new Exception("Data source for: " + deploymentInfo + " is not deployed in current system."); } }