Search in sources :

Example 51 with VDBMetaData

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

the class EventDistributorImpl method setTableStats.

@Override
public void setTableStats(String vdbName, String vdbVersion, String schemaName, String tableName, TableStats stats) {
    VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
    Table t = getTable(vdbName, vdbVersion, schemaName, tableName);
    if (t == null) {
        return;
    }
    DdlPlan.setTableStats(vdb, t, stats);
}
Also used : Table(org.teiid.metadata.Table) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData)

Example 52 with VDBMetaData

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

the class EventDistributorImpl method setProperty.

@Override
public void setProperty(String vdbName, String vdbVersion, String uuid, String name, String value) {
    VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
    if (vdb == null) {
        return;
    }
    TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
    if (tm == null) {
        return;
    }
    AbstractMetadataRecord record = DataTierManagerImpl.getByUuid(tm.getMetadataStore(), uuid);
    if (record != null) {
        DdlPlan.setProperty(vdb, record, name, value);
    }
}
Also used : TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) AbstractMetadataRecord(org.teiid.metadata.AbstractMetadataRecord)

Example 53 with VDBMetaData

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

the class EventDistributorImpl method setColumnStats.

@Override
public void setColumnStats(String vdbName, String vdbVersion, String schemaName, String tableName, String columnName, ColumnStats stats) {
    VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
    Table t = getTable(vdbName, vdbVersion, schemaName, tableName);
    if (t == null) {
        return;
    }
    Column c = t.getColumnByName(columnName);
    if (c != null) {
        DdlPlan.setColumnStats(vdb, c, stats);
    }
}
Also used : Table(org.teiid.metadata.Table) Column(org.teiid.metadata.Column) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData)

Example 54 with VDBMetaData

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

the class DeploymentBasedDatabaseStore method getVDBMetadata.

public VDBMetaData getVDBMetadata(String contents) {
    StringReader reader = new StringReader(contents);
    try {
        startEditing(false);
        this.setMode(Mode.DATABASE_STRUCTURE);
        QueryParser.getQueryParser().parseDDL(this, new BufferedReader(reader));
    } finally {
        reader.close();
        stopEditing();
    }
    Database database = getDatabases().get(0);
    VDBMetaData vdb = DatabaseUtil.convert(database);
    for (ModelMetaData model : vdb.getModelMetaDatas().values()) {
        // $NON-NLS-1$
        model.addSourceMetadata("DDL", null);
    }
    for (VDBImportMetadata vid : this.importedVDBs) {
        vdb.getVDBImports().add(vid);
    }
    vdb.addProperty(VDBMetaData.TEIID_DDL, contents);
    return vdb;
}
Also used : VDBImportMetadata(org.teiid.adminapi.impl.VDBImportMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) Database(org.teiid.metadata.Database) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Example 55 with VDBMetaData

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

the class TestCompositeVDB method testRoleInherit.

@Test
public void testRoleInherit() throws Exception {
    VDBRepository repo = new VDBRepository();
    repo.setSystemStore(RealMetadataFactory.example1Cached().getMetadataStore());
    repo.setSystemFunctionManager(RealMetadataFactory.SFM);
    MetadataStore metadataStore = new MetadataStore();
    RealMetadataFactory.createPhysicalModel("x", metadataStore);
    VDBMetaData vdb = createVDBMetadata(metadataStore, "bqt");
    DataPolicyMetadata dpm = new DataPolicyMetadata();
    dpm.setName("x");
    dpm.setGrantAll(true);
    vdb.addDataPolicy(dpm);
    ConnectorManagerRepository cmr = new ConnectorManagerRepository();
    cmr.addConnectorManager("x", new ConnectorManager("y", "z"));
    repo.addVDB(vdb, metadataStore, null, null, cmr);
    metadataStore = new MetadataStore();
    RealMetadataFactory.createPhysicalModel("y", metadataStore);
    vdb = createVDBMetadata(metadataStore, "ex");
    VDBImportMetadata vdbImport = new VDBImportMetadata();
    vdbImport.setName("bqt");
    vdbImport.setVersion("1");
    vdbImport.setImportDataPolicies(true);
    vdb.getVDBImports().add(vdbImport);
    repo.addVDB(vdb, metadataStore, null, null, new ConnectorManagerRepository());
    vdb = repo.getLiveVDB("ex");
    assertEquals(1, vdb.getDataPolicyMap().get("x").getSchemas().size());
}
Also used : MetadataStore(org.teiid.metadata.MetadataStore) VDBImportMetadata(org.teiid.adminapi.impl.VDBImportMetadata) ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) DataPolicyMetadata(org.teiid.adminapi.impl.DataPolicyMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ConnectorManager(org.teiid.dqp.internal.datamgr.ConnectorManager) Test(org.junit.Test)

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