Search in sources :

Example 36 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestReplication method deployTtlVDB.

private void deployTtlVDB(FakeServer server) throws ConnectorManagerException, VirtualDatabaseException, TranslatorException {
    ModelMetaData mmd = new ModelMetaData();
    mmd.setName("mv");
    mmd.setModelType(Type.VIRTUAL);
    mmd.addSourceMetadata("ddl", "create view c options (materialized true) as /*+ cache(ttl:1000) */ select 'hello world'");
    VDBMetaData vdb = new VDBMetaData();
    vdb.setXmlDeployment(true);
    vdb.setName("ttl");
    vdb.setModels(Arrays.asList(mmd));
    vdb.addProperty("lazy-invalidate", "true");
    server.deployVDB(vdb);
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Example 37 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class PlanToProcessConverter method aliasCommand.

private Command aliasCommand(AccessNode aNode, Command command, Object modelID) throws TeiidComponentException, QueryPlannerException {
    try {
        command = (Command) command.clone();
        boolean aliasGroups = modelID != null && (CapabilitiesUtil.supportsGroupAliases(modelID, metadata, capFinder) || CapabilitiesUtil.supports(Capability.QUERY_FROM_INLINE_VIEWS, modelID, metadata, capFinder));
        boolean aliasColumns = modelID != null && (CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelID, metadata, capFinder) || CapabilitiesUtil.supports(Capability.QUERY_FROM_INLINE_VIEWS, modelID, metadata, capFinder));
        AliasGenerator visitor = new AliasGenerator(aliasGroups, !aliasColumns);
        SourceHint sh = command.getSourceHint();
        if (sh != null && aliasGroups) {
            VDBMetaData vdb = context.getDQPWorkContext().getVDB();
            ModelMetaData model = vdb.getModel(aNode.getModelName());
            List<String> sourceNames = model.getSourceNames();
            SpecificHint sp = null;
            if (sourceNames.size() == 1) {
                sp = sh.getSpecificHint(sourceNames.get(0));
            }
            if (sh.isUseAliases() || (sp != null && sp.isUseAliases())) {
                visitor.setAliasMapping(context.getAliasMapping());
            }
        }
        List<Reference> references = ReferenceCollectorVisitor.getReferences(command);
        if (!references.isEmpty()) {
            Set<String> correleatedGroups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
            for (Reference ref : references) {
                if (ref.isCorrelated() && ref.getExpression().getGroupSymbol() != null) {
                    correleatedGroups.add(ref.getExpression().getGroupSymbol().getName());
                }
            }
            visitor.setCorrelationGroups(correleatedGroups);
        }
        command.acceptVisitor(visitor);
    } catch (QueryMetadataException err) {
        throw new TeiidComponentException(QueryPlugin.Event.TEIID30249, err);
    } catch (TeiidRuntimeException e) {
        if (e.getCause() instanceof QueryPlannerException) {
            throw (QueryPlannerException) e.getCause();
        }
        throw e;
    }
    return command;
}
Also used : Reference(org.teiid.query.sql.symbol.Reference) SpecificHint(org.teiid.query.sql.lang.SourceHint.SpecificHint) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) QueryMetadataException(org.teiid.api.exception.query.QueryMetadataException) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) TeiidComponentException(org.teiid.core.TeiidComponentException) QueryPlannerException(org.teiid.api.exception.query.QueryPlannerException)

Example 38 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class EmbeddedAdminImpl method undeploy.

@Override
public void undeploy(String deployedName) throws AdminException {
    VDBMetaData vdb = checkVDB(deployedName);
    if (null == vdb) {
        throw new AdminProcessingException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40134, deployedName));
    }
    this.embeddedServer.undeployVDB(deployedName);
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData)

Example 39 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class EmbeddedAdminImpl method updateSource.

@Override
public void updateSource(String vdbName, String vdbVersion, String sourceName, String translatorName, String dsName) throws AdminException {
    VDBMetaData vdb = checkVDB(vdbName, vdbVersion);
    synchronized (vdb) {
        for (ModelMetaData m : vdb.getModelMetaDatas().values()) {
            SourceMappingMetadata mapping = m.getSourceMapping(sourceName);
            if (mapping != null) {
                mapping.setTranslatorName(translatorName);
                mapping.setConnectionJndiName(dsName);
            }
        }
    }
}
Also used : SourceMappingMetadata(org.teiid.adminapi.impl.SourceMappingMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Example 40 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class EmbeddedAdminImpl method addDataRoleMapping.

@Override
public void addDataRoleMapping(String vdbName, String vdbVersion, String dataRole, String mappedRoleName) throws AdminException {
    VDBMetaData vdb = checkVDB(vdbName, vdbVersion);
    synchronized (vdb) {
        DataPolicyMetadata policy = getPolicy(vdb, dataRole);
        policy.addMappedRoleName(mappedRoleName);
    }
}
Also used : DataPolicyMetadata(org.teiid.adminapi.impl.DataPolicyMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData)

Aggregations

VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)121 Test (org.junit.Test)48 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)36 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)16 MetadataStore (org.teiid.metadata.MetadataStore)15 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)14 VDBRepository (org.teiid.deployers.VDBRepository)12 ArrayList (java.util.ArrayList)10 IOException (java.io.IOException)9 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)9 Properties (java.util.Properties)8 XMLStreamException (javax.xml.stream.XMLStreamException)8 VDBImportMetadata (org.teiid.adminapi.impl.VDBImportMetadata)8 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)7 TeiidComponentException (org.teiid.core.TeiidComponentException)7 VDBKey (org.teiid.vdb.runtime.VDBKey)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 VDBTranslatorMetaData (org.teiid.adminapi.impl.VDBTranslatorMetaData)6 Schema (org.teiid.metadata.Schema)6 SessionMetadata (org.teiid.adminapi.impl.SessionMetadata)5