Search in sources :

Example 11 with SourceMappingMetadata

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);
}
Also used : SourceMappingMetadata(org.teiid.adminapi.impl.SourceMappingMetadata) ArrayList(java.util.ArrayList) ConnectorManager(org.teiid.dqp.internal.datamgr.ConnectorManager)

Example 12 with SourceMappingMetadata

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

Example 13 with SourceMappingMetadata

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

Aggregations

SourceMappingMetadata (org.teiid.adminapi.impl.SourceMappingMetadata)13 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)11 VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)5 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)4 AdminProcessingException (org.teiid.adminapi.AdminProcessingException)3 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)3 ArrayList (java.util.ArrayList)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 DataPolicy (org.teiid.adminapi.DataPolicy)1 DataPermission (org.teiid.adminapi.DataPolicy.DataPermission)1 Translator (org.teiid.adminapi.Translator)1 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)1 InvalidServiceNameException (org.teiid.jboss.TeiidServiceNames.InvalidServiceNameException)1 Permission (org.teiid.metadata.Grant.Permission)1 EmbeddedConfiguration (org.teiid.runtime.EmbeddedConfiguration)1 EmbeddedServer (org.teiid.runtime.EmbeddedServer)1 LoopbackExecutionFactory (org.teiid.translator.loopback.LoopbackExecutionFactory)1