public static Map<String, String> getMultiSourceModels(VDBMetaData vdb) { HashMap<String, String> result = new HashMap<String, String>(); for (ModelMetaData mmd : vdb.getModelMetaDatas().values()) { if (!mmd.isSupportsMultiSourceBindings()) { continue; } String columnName = mmd.getPropertyValue(MULTISOURCE_COLUMN_NAME); if (columnName == null) { columnName = MultiSourceElement.DEFAULT_MULTI_SOURCE_ELEMENT_NAME; } result.put(mmd.getName(), columnName); } return result; }
public static Map<String, String> getMultiSourceModels(VDBMetaData vdb) { HashMap<String, String> result = new HashMap<String, String>(); for (ModelMetaData mmd : vdb.getModelMetaDatas().values()) { if (!mmd.isSupportsMultiSourceBindings()) { continue; } String columnName = mmd.getPropertyValue(MULTISOURCE_COLUMN_NAME); if (columnName == null) { columnName = MultiSourceElement.DEFAULT_MULTI_SOURCE_ELEMENT_NAME; } result.put(mmd.getName(), columnName); } return result; }
public static Map<String, String> getMultiSourceModels(VDBMetaData vdb) { HashMap<String, String> result = new HashMap<String, String>(); for (ModelMetaData mmd : vdb.getModelMetaDatas().values()) { if (!mmd.isSupportsMultiSourceBindings()) { continue; } String columnName = mmd.getPropertyValue(MULTISOURCE_COLUMN_NAME); if (columnName == null) { columnName = MultiSourceElement.DEFAULT_MULTI_SOURCE_ELEMENT_NAME; } result.put(mmd.getName(), columnName); } return result; }
public void createConnectorManagers(VDBMetaData deployment, ExecutionFactoryProvider provider) throws ConnectorManagerException { for (ModelMetaData model : deployment.getModelMetaDatas().values()) { List<String> sourceNames = model.getSourceNames(); if (sourceNames.size() != new HashSet<String>(sourceNames).size()) { throw new ConnectorManagerException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31101, model.getName(), deployment.getName(), deployment.getVersion())); } if (sourceNames.size() > 1 && !model.isSupportsMultiSourceBindings()) { throw new ConnectorManagerException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31102, model.getName(), deployment.getName(), deployment.getVersion())); } for (SourceMappingMetadata source : model.getSourceMappings()) { createConnectorManager(deployment, provider, source, false); } } }
public void createConnectorManagers(VDBMetaData deployment, ExecutionFactoryProvider provider) throws ConnectorManagerException { for (ModelMetaData model : deployment.getModelMetaDatas().values()) { List<String> sourceNames = model.getSourceNames(); if (sourceNames.size() != new HashSet<String>(sourceNames).size()) { throw new ConnectorManagerException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31101, model.getName(), deployment.getName(), deployment.getVersion())); } if (sourceNames.size() > 1 && !model.isSupportsMultiSourceBindings()) { throw new ConnectorManagerException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31102, model.getName(), deployment.getName(), deployment.getVersion())); } for (SourceMappingMetadata source : model.getSourceMappings()) { createConnectorManager(deployment, provider, source, false); } } }
public void createConnectorManagers(VDBMetaData deployment, ExecutionFactoryProvider provider) throws ConnectorManagerException { for (ModelMetaData model : deployment.getModelMetaDatas().values()) { List<String> sourceNames = model.getSourceNames(); if (sourceNames.size() != new HashSet<String>(sourceNames).size()) { throw new ConnectorManagerException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31101, model.getName(), deployment.getName(), deployment.getVersion())); } if (sourceNames.size() > 1 && !model.isSupportsMultiSourceBindings()) { throw new ConnectorManagerException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31102, model.getName(), deployment.getName(), deployment.getVersion())); } for (SourceMappingMetadata source : model.getSourceMappings()) { createConnectorManager(deployment, provider, source, false); } } }
@Test public void testSupportMultiSource() { ModelMetaData model = new ModelMetaData(); assertFalse(model.isSupportsMultiSourceBindings()); model.setSupportsMultiSourceBindings(true); assertTrue(model.isSupportsMultiSourceBindings()); model.setModelType(Type.VIRTUAL); assertFalse(model.isSupportsMultiSourceBindings()); assertTrue(!model.getProperties().isEmpty()); }
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); } }
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, this.vdb.getName(), this.vdb.getVersion())); if (!model.isSupportsMultiSourceBindings()) { throw new AdminProcessingException(RuntimePlugin.Event.TEIID40108, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40108, modelName, this.vdb.getName(), this.vdb.getVersion()));
@Override public void addSource(String vdbName, String vdbVersion, String modelName, String sourceName, String translatorName, String dsName) throws AdminException { VDBMetaData vdb = checkVDB(vdbName, vdbVersion); synchronized(vdb) { ModelMetaData model = vdb.getModel(modelName); if (model == null) { throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, vdb.getName(), vdb.getVersion())); } if (!model.isSupportsMultiSourceBindings()) { throw new AdminProcessingException(RuntimePlugin.Event.TEIID40108, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40108, modelName, vdb.getName(), vdb.getVersion())); } SourceMappingMetadata source = model.getSourceMapping(sourceName); if(source != null) { throw new AdminProcessingException(RuntimePlugin.Event.TEIID40107, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40107, sourceName, modelName, vdb.getName(), vdb.getVersion())); } SourceMappingMetadata mapping = new SourceMappingMetadata(sourceName, translatorName, dsName); model.addSourceMapping(mapping); } }
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40090, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40090, modelName, this.vdb.getName(), this.vdb.getVersion())); if (!model.isSupportsMultiSourceBindings()) { throw new AdminProcessingException(RuntimePlugin.Event.TEIID40108, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40108, modelName, this.vdb.getName(), this.vdb.getVersion()));