public Schema getSchema(String schemaName) { return this.store.getSchema(schemaName); }
public void merge(MetadataStore store) { if (store != null) { for (Schema s:store.getSchemaList()) { addSchema(s); } addDataTypes(store.getDatatypes()); addGrants(store.grants.values()); roles.putAll(store.roles); } }
public MetadataStore asMetadataStore() { MetadataStore store = new MetadataStore(); mergeInto(store); return store; }
public void mergeInto (MetadataStore store) { store.addSchema(this.schema); store.addDataTypes(this.dataTypes); if (this.grants != null) { store.addGrants(this.grants.values()); } }
private static Table findTableByName(MetadataStore store, String name) { Table table = null; int index = name.indexOf(Table.NAME_DELIM_CHAR); if(index == -1) { for(Schema schema : store.getSchemaList()) { table = schema.getTable(name); if(table != null) { break; } } } else { String schemaName = name.substring(0, index); Schema schema = store.getSchema(schemaName); if(schema != null) { table = schema.getTable(name.substring(index+1)); } } return table; }
db.getMetadataStore().addDataTypes(metadataStore.getDatatypes()); Schema schema = metadataStore.getSchema(m.getName());
public List<Schema> getSchemas() { return new ArrayList<Schema>(this.store.getSchemaList()); }
List<Schema> schemas = mergedStore.getSchemaList(); schemas.clear(); for (ModelMetaData model : this.vdb.getModelMetaDatas().values()) { Schema s = mergedStore.getSchema(model.getName()); if (s != null) { schemas.add(s); } else { mergedStore.getSchemas().remove(model.getName()); MetadataStore childStore = child.getMetadataStore(); if ( childStore != null) { mergedStore.merge(childStore);
@Override public void execute(VDBMetaData vdb, MetadataStore store, ValidatorReport report, MetadataValidator metadataValidator) { for (Schema schema:store.getSchemaList()) { if (vdb.getImportedModels().contains(schema.getName())) { continue; FunctionMetadataValidator.validateFunctionMethods(schema.getFunctions().values(),report, store.getDatatypes()); if(report.hasItems()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31073, funcReport));
@Override public Map<String, Datatype> getRuntimeTypes() { return vdbRepo.getSystemStore().getDatatypes(); }
public MetadataStore load(Collection<Datatype> systemDatatypes, VDBResources vdbResources) throws IOException { MetadataStore store = new MetadataStore(); loadAll(systemDatatypes, vdbResources.getEntriesPlusVisibilities()); // the index map below is keyed by uuid not modelname, so map lookup is not possible Collection<AbstractMetadataRecord> modelRecords = getByType(MetadataConstants.RECORD_TYPE.MODEL).values(); for (AbstractMetadataRecord modelRecord:modelRecords) { Schema s = (Schema) modelRecord; store.addSchema(s); getTables(s); getProcedures(s); } return store; }
public void databaseCreated(Database db) { if (!assertInEditMode(Mode.DATABASE_STRUCTURE)) { return; } assertGrant(Grant.Permission.Privilege.CREATE, Database.ResourceType.DATABASE, db); Database database = this.databases.get(vdbKey(db)); if ( database != null) { throw new DuplicateRecordException(QueryPlugin.Event.TEIID31232, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31232, db.getName())); } if (this.currentDatabase != null) { throw new MetadataException(QueryPlugin.Event.TEIID31242, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31242)); } db.getMetadataStore().addDataTypes(getRuntimeTypes()); this.databases.put(vdbKey(db), db); }
protected void loadMetadata(VDBMetaData vdb, ConnectorManagerRepository cmr, MetadataStore store, VDBResources vdbResources) throws TranslatorException { store.addDataTypes(SystemMetadata.getInstance().getRuntimeTypeMap()); QueryParser.getQueryParser().parseDDL(dbStore, new StringReader(value)); dbStore.stopEditing(); store.addDataTypes(dbStore.getDatabase("x", "1").getMetadataStore().getDatatypes()); //$NON-NLS-1$ //$NON-NLS-2$
for (Schema schema:store.getSchemas().values()) { if (!schema.getProcedures().isEmpty()) { FunctionTree ft = FunctionTree.getFunctionProcedures(schema); for (MetadataStore s:additionalStores) { compositeStore.merge(s); for (Schema schema:s.getSchemas().values()) { if (!schema.getFunctions().isEmpty()) { UDFSource source = new UDFSource(schema.getFunctions().values());
Datatype base = store.getDatatypes().get(baseType); if (base == null || !base.isBuiltin()) { throw new MetadataException(DataPlugin.Event.TEIID60032, DataPlugin.Util.gs(DataPlugin.Event.TEIID60032, baseType)); Datatype existing = store.getDatatypes().get(name); if (existing != null) { throw new DuplicateRecordException(DataPlugin.Event.TEIID60034, DataPlugin.Util.gs(DataPlugin.Event.TEIID60032, existing)); store.addDatatype(name, dataType); return dataType;
public Collection<Grant> getGrants(){ return this.store.getGrants(); }
/** * Create a physical model with default settings. */ public static Schema createPhysicalModel(String name, MetadataStore metadataStore) { Schema schema = new Schema(); schema.setName(name); metadataStore.addSchema(schema); return schema; }
public void removeRole(String roleName) { Role r = this.store.getRole(roleName); if (r == null) { throw new MetadataException(DataPlugin.Event.TEIID60029, DataPlugin.Util.gs(DataPlugin.Event.TEIID60029, roleName)); } else { // make sure it is not used in any grants for (Grant g:this.store.getGrants()) { if (g.getRole().equalsIgnoreCase(roleName)) { throw new MetadataException(DataPlugin.Event.TEIID60030, DataPlugin.Util.gs(DataPlugin.Event.TEIID60030, roleName, g.getPermissions().iterator().next().getResourceName(), g.getPermissions().iterator().next().getResourceType().name())); } } this.store.removeRole(roleName); } }
db.getMetadataStore().addDataTypes(metadataStore.getDatatypes()); Schema schema = metadataStore.getSchema(m.getName());