use of org.teiid.metadata.MetadataRepository in project teiid by teiid.
the class AbstractVDBDeployer method assignMetadataRepositories.
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);
}
}
Aggregations