use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.
the class VDBStatusChecker method updateSource.
/**
* @return true if the datasource is new to the vdb
* @throws AdminProcessingException
*/
public boolean updateSource(String vdbName, String vdbVersion, SourceMappingMetadata mapping, boolean replace) throws AdminProcessingException {
String dsName = stripContext(mapping.getConnectionJndiName());
VDBMetaData vdb = getVDBRepository().getLiveVDB(vdbName, vdbVersion);
if (vdb == null || vdb.getStatus() == Status.FAILED) {
return false;
}
synchronized (vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
ConnectorManager existing = cmr.getConnectorManager(mapping.getName());
try {
cmr.createConnectorManager(vdb, cmr.getProvider(), mapping, replace);
} catch (TeiidException e) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40033, e);
}
if (mapping.getConnectionJndiName() != null && (existing == null || !dsName.equals(existing.getConnectionName()))) {
List<Runnable> runnables = new ArrayList<Runnable>();
resourceAdded(dsName, runnables, vdb);
return true;
}
return false;
}
}
Aggregations