Search in sources :

Example 6 with AdminProcessingException

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;
        }
    }
}
Also used : ConnectionType(org.teiid.adminapi.VDB.ConnectionType) AdminProcessingException(org.teiid.adminapi.AdminProcessingException)

Example 7 with AdminProcessingException

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;
        }
    }
}
Also used : DataPolicyMetadata(org.teiid.adminapi.impl.DataPolicyMetadata) AdminProcessingException(org.teiid.adminapi.AdminProcessingException)

Example 8 with AdminProcessingException

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;
        }
    }
}
Also used : DataPolicyMetadata(org.teiid.adminapi.impl.DataPolicyMetadata) AdminProcessingException(org.teiid.adminapi.AdminProcessingException)

Example 9 with AdminProcessingException

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);
            }
        }
    }
}
Also used : SourceMappingMetadata(org.teiid.adminapi.impl.SourceMappingMetadata) ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) AdminProcessingException(org.teiid.adminapi.AdminProcessingException) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Example 10 with AdminProcessingException

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;
        }
    }
}
Also used : DataPolicyMetadata(org.teiid.adminapi.impl.DataPolicyMetadata) AdminProcessingException(org.teiid.adminapi.AdminProcessingException)

Aggregations

AdminProcessingException (org.teiid.adminapi.AdminProcessingException)11 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)4 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)4 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)3 SourceMappingMetadata (org.teiid.adminapi.impl.SourceMappingMetadata)3 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 ConnectionType (org.teiid.adminapi.VDB.ConnectionType)1 VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)1 TeiidException (org.teiid.core.TeiidException)1