use of org.teiid.adminapi.impl.SourceMappingMetadata in project teiid by teiid.
the class AbstractVDBDeployer method getConnectorManagers.
protected List<ConnectorManager> getConnectorManagers(final ModelMetaData model, final ConnectorManagerRepository cmr) {
if (model.isSource()) {
Collection<SourceMappingMetadata> mappings = model.getSources().values();
List<ConnectorManager> result = new ArrayList<ConnectorManager>(mappings.size());
for (SourceMappingMetadata mapping : mappings) {
result.add(cmr.getConnectorManager(mapping.getName()));
}
return result;
}
// return a single null to give us something to loop over
return Collections.singletonList(null);
}
use of org.teiid.adminapi.impl.SourceMappingMetadata in project teiid by teiid.
the class EmbeddedAdminImpl method removeSource.
@Override
public void removeSource(String vdbName, String vdbVersion, String modelName, String sourceName) throws AdminException {
VDBMetaData vdb = checkVDB(vdbName, vdbVersion);
synchronized (vdb) {
ModelMetaData model = vdb.getModel(modelName);
if (model == null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, vdb.getName(), vdb.getVersion()));
}
SourceMappingMetadata source = model.getSourceMapping(sourceName);
if (source == null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40107, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40107, sourceName, modelName, vdb.getName(), vdb.getVersion()));
}
source = model.getSources().remove(sourceName);
if (source == null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40091, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40091, sourceName, modelName, vdb.getName(), vdb.getVersion()));
}
}
}
use of org.teiid.adminapi.impl.SourceMappingMetadata in project teiid by teiid.
the class EmbeddedAdminImpl method addSource.
@Override
public void addSource(String vdbName, String vdbVersion, String modelName, String sourceName, String translatorName, String dsName) throws AdminException {
VDBMetaData vdb = checkVDB(vdbName, vdbVersion);
synchronized (vdb) {
ModelMetaData model = vdb.getModel(modelName);
if (model == null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, vdb.getName(), vdb.getVersion()));
}
if (!model.isSupportsMultiSourceBindings()) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40108, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40108, modelName, vdb.getName(), vdb.getVersion()));
}
SourceMappingMetadata source = model.getSourceMapping(sourceName);
if (source != null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40107, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40107, sourceName, modelName, vdb.getName(), vdb.getVersion()));
}
SourceMappingMetadata mapping = new SourceMappingMetadata(sourceName, translatorName, dsName);
model.addSourceMapping(mapping);
}
}
Aggregations