@Override public boolean isSupportsMultiSourceBindings() { return this.isSource() && (this.sources.size() > 1 || Boolean.parseBoolean(getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY)) || Boolean.parseBoolean(getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY_OLD))); }
@Override public boolean isSupportsMultiSourceBindings() { return this.isSource() && (this.sources.size() > 1 || Boolean.parseBoolean(getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY)) || Boolean.parseBoolean(getPropertyValue(SUPPORTS_MULTI_SOURCE_BINDINGS_KEY_OLD))); }
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); }
if (m.isSource()) { replace = replaceMetadataTag(m, sourceName, schemaName, true);
void validateDataSources(VDBMetaData vdb) { ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class); for (ModelMetaData model:vdb.getModelMetaDatas().values()) { if (model.isSource()) { Collection<SourceMappingMetadata> mappings = model.getSourceMappings(); for (SourceMappingMetadata mapping:mappings) { ConnectorManager cm = cmr.getConnectorManager(mapping.getName()); if (cm != null) { String msg = cm.getStausMessage(); if (msg != null && msg.length() > 0) { model.addRuntimeError(msg); model.setMetadataStatus(Model.MetadataStatus.FAILED); LogManager.logInfo(LogConstants.CTX_RUNTIME, msg); } } } } } }
return defaultRepo; if (model.isSource()) { return new ChainingMetadataRepository(Arrays.asList(new NativeMetadataRepository(), new DirectQueryMetadataRepository()));
protected void assignMetadataRepositories(VDBMetaData deployment, MetadataRepository<?, ?> defaultRepo) throws VirtualDatabaseException { for (ModelMetaData model:deployment.getModelMetaDatas().values()) { if (model.getModelType() != Type.OTHER && (model.getName() == null || model.getName().indexOf('.') >= 0) || model.getName().equalsIgnoreCase(CoreConstants.SYSTEM_MODEL) || model.getName().equalsIgnoreCase(CoreConstants.SYSTEM_ADMIN_MODEL) || model.getName().equalsIgnoreCase(CoreConstants.ODBC_MODEL)) { throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40121, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40121, model.getName(), deployment.getName(), deployment.getVersion())); } if (model.isSource() && model.getSourceNames().isEmpty()) { throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40093, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40093, model.getName(), deployment.getName(), deployment.getVersion())); } if (model.getModelType() == Type.FUNCTION || model.getModelType() == Type.OTHER) { continue; } MetadataRepository<?, ?> repo = getMetadataRepository(deployment, model, defaultRepo); //handle multi-source column creation if (model.isSupportsMultiSourceBindings() && Boolean.valueOf(model.getPropertyValue("multisource.addColumn"))) { //$NON-NLS-1$ List<MetadataRepository<?, ?>> repos = new ArrayList<MetadataRepository<?, ?>>(2); repos.add(repo); String columnName = model.getPropertyValue(MultiSourceMetadataWrapper.MULTISOURCE_COLUMN_NAME); repos.add(new MultiSourceMetadataRepository(columnName==null?MultiSourceElement.DEFAULT_MULTI_SOURCE_ELEMENT_NAME:columnName)); repo = new ChainingMetadataRepository(repos); } model.addAttchment(MetadataRepository.class, repo); } }
protected MetadataFactory createMetadataFactory(VDBMetaData vdb, MetadataStore store, ModelMetaData model, Map<String, ? extends VDBResource> vdbResources) { Map<String, Datatype> datatypes = store.getDatatypes(); MetadataFactory factory = new MetadataFactory(vdb.getName(), vdb.getVersion(), datatypes, model); factory.getSchema().setPhysical(model.isSource()); factory.setParser(new QueryParser()); //for thread safety each factory gets it's own instance. factory.setVdbResources(vdbResources); factory.setVDBClassLoader(vdb.getAttachment(ClassLoader.class)); return factory; }
@Test public void testModelType() { ModelMetaData model = new ModelMetaData(); model.setModelType("physical"); assertTrue(model.getModelType() == Model.Type.PHYSICAL); assertTrue(model.isSource()); model.modelType = "VIRTUAL"; assertTrue(model.getModelType() == Model.Type.VIRTUAL); model.modelType = "TYPE"; assertTrue(model.getModelType() == Model.Type.OTHER); assertTrue(!model.isSource()); }
if (t.isPhysical() && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31075, t.getFullName(), model.getName())); if (!p.isVirtual() && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31077, p.getFullName(), model.getName())); if (func.getPushdown().equals(FunctionMethod.PushDown.MUST_PUSHDOWN) && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31078, func.getFullName(), model.getName()));
if (t.isPhysical() && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31075, t.getFullName(), model.getName())); if (!p.isVirtual() && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31077, p.getFullName(), model.getName())); if (func.getPushdown().equals(FunctionMethod.PushDown.MUST_PUSHDOWN) && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31078, func.getFullName(), model.getName()));
if (t.isPhysical() && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31075, t.getFullName(), model.getName())); if (!p.isVirtual() && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31077, p.getFullName(), model.getName())); if (func.getPushdown().equals(FunctionMethod.PushDown.MUST_PUSHDOWN) && !model.isSource()) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31078, func.getFullName(), model.getName()));
schema.setAnnotation(m.getDescription()); schema.setVisible(m.isVisible()); schema.setPhysical(m.isSource()); schema.setProperties(m.getPropertiesMap()); metadataStore.addSchema(schema);
CapabilitiesFinder capabiltiesFinder = this.context.getQueryProcessorFactory().getCapabiltiesFinder(); for (ModelMetaData mmd : vdb.getModelMetaDatas().values()) { if (!mmd.isSource()) { continue;
CapabilitiesFinder capabiltiesFinder = this.context.getQueryProcessorFactory().getCapabiltiesFinder(); for (ModelMetaData mmd : vdb.getModelMetaDatas().values()) { if (!mmd.isSource()) { continue;
CapabilitiesFinder capabiltiesFinder = this.context.getQueryProcessorFactory().getCapabiltiesFinder(); for (ModelMetaData mmd : vdb.getModelMetaDatas().values()) { if (!mmd.isSource()) { continue;
if (m.isSource()){ Collection<SourceMappingMetadata> sources = m.getSourceMappings();
if (m.isSource()){ Collection<SourceMappingMetadata> sources = m.getSourceMappings();
if (m.isSource()){ Collection<SourceMappingMetadata> sources = m.getSourceMappings();