Search in sources :

Example 1 with GenericMetaModel

use of org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel in project dbeaver by serge-rider.

the class GenericDataSourceProvider method openDataSource.

@NotNull
@Override
public DBPDataSource openDataSource(@NotNull DBRProgressMonitor monitor, @NotNull DBPDataSourceContainer container) throws DBException {
    GenericMetaModelDescriptor metaModel = null;
    Object metaModelId = container.getDriver().getDriverParameter(GenericConstants.PARAM_META_MODEL);
    if (metaModelId != null && !GenericConstants.META_MODEL_STANDARD.equals(metaModelId)) {
        metaModel = metaModels.get(metaModelId.toString());
        if (metaModel == null) {
            log.warn("Meta model '" + metaModelId + "' not recognized. Default one will be used");
        }
    }
    if (metaModel == null) {
        // Try to get model by driver class
        metaModel = metaModels.get(container.getDriver().getDriverClassName());
    }
    if (metaModel == null) {
        metaModel = getStandardMetaModel();
    }
    GenericMetaModel metaModelInstance = metaModel.getInstance();
    return metaModelInstance.createDataSource(monitor, container);
}
Also used : GenericMetaModelDescriptor(org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModelDescriptor) GenericMetaModel(org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel) NotNull(org.jkiss.code.NotNull)

Aggregations

NotNull (org.jkiss.code.NotNull)1 GenericMetaModel (org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel)1 GenericMetaModelDescriptor (org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModelDescriptor)1