use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.
the class RuntimeVDB method changeConnectionType.
public void changeConnectionType(ConnectionType type) throws AdminProcessingException {
synchronized (this.vdb) {
ConnectionType previous = this.vdb.getConnectionType();
this.vdb.setConnectionType(type);
try {
this.listener.connectionTypeChanged();
} catch (AdminProcessingException e) {
this.vdb.setConnectionType(previous);
throw e;
}
}
}
use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.
the class RuntimeVDB method addDataRole.
public void addDataRole(String policyName, String mappedRole) throws AdminProcessingException {
synchronized (this.vdb) {
DataPolicyMetadata policy = getPolicy(policyName);
List<String> previous = policy.getMappedRoleNames();
policy.addMappedRoleName(mappedRole);
try {
this.listener.dataRoleChanged(policyName);
} catch (AdminProcessingException e) {
policy.setMappedRoleNames(previous);
throw e;
}
}
}
use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.
the class RuntimeVDB method remoteDataRole.
public void remoteDataRole(String policyName, String mappedRole) throws AdminProcessingException {
synchronized (this.vdb) {
DataPolicyMetadata policy = getPolicy(policyName);
List<String> previous = policy.getMappedRoleNames();
policy.removeMappedRoleName(mappedRole);
try {
this.listener.dataRoleChanged(policyName);
} catch (AdminProcessingException e) {
policy.setMappedRoleNames(previous);
throw e;
}
}
}
use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.
the class RuntimeVDB method addSource.
public ReplaceResult addSource(String modelName, String sourceName, String translatorName, String dsName) throws AdminProcessingException {
synchronized (this.vdb) {
ModelMetaData model = this.vdb.getModel(modelName);
if (model == null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, this.vdb.getName(), this.vdb.getVersion()));
}
if (!model.isSupportsMultiSourceBindings()) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40108, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40108, modelName, this.vdb.getName(), this.vdb.getVersion()));
}
SourceMappingMetadata source = model.getSourceMapping(sourceName);
if (source != null) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40107, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40107, sourceName, modelName, this.vdb.getName(), this.vdb.getVersion()));
}
boolean success = false;
try {
SourceMappingMetadata mapping = new SourceMappingMetadata(sourceName, translatorName, dsName);
boolean updated = getVDBStatusChecker().updateSource(vdb.getName(), vdb.getVersion(), mapping, false);
model.addSourceMapping(mapping);
this.listener.dataSourceChanged(modelName, sourceName, translatorName, dsName);
ReplaceResult rr = new ReplaceResult();
if (dsName != null && updated) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
rr.isNew = !dsExists(dsName, cmr);
}
success = true;
return rr;
} finally {
if (!success) {
model.getSources().remove(sourceName);
}
}
}
}
use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.
the class RuntimeVDB method removeAnyAuthenticated.
public void removeAnyAuthenticated(String policyName) throws AdminProcessingException {
synchronized (this.vdb) {
DataPolicyMetadata policy = getPolicy(policyName);
boolean previous = policy.isAnyAuthenticated();
policy.setAnyAuthenticated(false);
try {
this.listener.dataRoleChanged(policyName);
} catch (AdminProcessingException e) {
policy.setAnyAuthenticated(previous);
throw e;
}
}
}
Aggregations