Search in sources :

Example 1 with Modifiable

use of org.teiid.metadata.AbstractMetadataRecord.Modifiable in project teiid by teiid.

the class AccessInfo method restore.

/**
 * Restore reconnects to the live metadata objects
 * @throws TeiidComponentException
 * @throws TeiidProcessingException
 */
void restore() throws TeiidComponentException, TeiidProcessingException {
    if (this.objectsAccessed != null) {
        return;
    }
    VDBMetaData vdb = DQPWorkContext.getWorkContext().getVDB();
    TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
    GlobalTableStore globalStore = vdb.getAttachment(GlobalTableStore.class);
    if (!externalNames.isEmpty()) {
        this.objectsAccessed = new HashSet<Object>(externalNames.size());
        for (List<String> key : this.externalNames) {
            if (key.size() == 1) {
                String matTableName = key.get(0);
                TempMetadataID id = globalStore.getGlobalTempTableMetadataId(matTableName);
                if (id == null) {
                    // if the id is null, then create a local instance
                    String viewFullName = matTableName.substring(RelationalPlanner.MAT_PREFIX.length());
                    id = globalStore.getGlobalTempTableMetadataId(tm.getGroupID(viewFullName));
                }
                this.objectsAccessed.add(id);
            } else {
                Schema s = tm.getMetadataStore().getSchema(key.get(0));
                Modifiable m = s.getTables().get(key.get(1));
                if (m == null) {
                    m = s.getProcedures().get(key.get(1));
                }
                if (m != null) {
                    this.objectsAccessed.add(m);
                }
            }
        }
    } else {
        this.objectsAccessed = Collections.emptySet();
    }
    this.externalNames = null;
}
Also used : TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) GlobalTableStore(org.teiid.query.tempdata.GlobalTableStore) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) Schema(org.teiid.metadata.Schema) TempMetadataID(org.teiid.query.metadata.TempMetadataID) DataModifiable(org.teiid.metadata.AbstractMetadataRecord.DataModifiable) Modifiable(org.teiid.metadata.AbstractMetadataRecord.Modifiable)

Aggregations

VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)1 DataModifiable (org.teiid.metadata.AbstractMetadataRecord.DataModifiable)1 Modifiable (org.teiid.metadata.AbstractMetadataRecord.Modifiable)1 Schema (org.teiid.metadata.Schema)1 TempMetadataID (org.teiid.query.metadata.TempMetadataID)1 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)1 GlobalTableStore (org.teiid.query.tempdata.GlobalTableStore)1