/** * {@inheritDoc} */ @Override protected void configure() { this.bind(CassandraTypeConverter.class).toInstance(new CassandraTypeConverter()); this.bind(CassandraExceptionMapper.class).toInstance(new CassandraExceptionMapper()); this.bind(ConnectorDatabaseService.class) .to(ConnectorUtils.getDatabaseServiceClass(this.configuration, CassandraConnectorDatabaseService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorTableService.class) .to(ConnectorUtils.getTableServiceClass(this.configuration, CassandraConnectorTableService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorPartitionService.class) .to(ConnectorUtils.getPartitionServiceClass(this.configuration, CassandraConnectorPartitionService.class)) .in(Scopes.SINGLETON); }
/** * Get the table service class to use. * * @param configuration The connector configuration * @param defaultServiceClass The default class to use if an override is not found * @return The table service class to use. */ public static Class<? extends ConnectorTableService> getTableServiceClass( final Map<String, String> configuration, final Class<? extends ConnectorTableService> defaultServiceClass ) { if (configuration.containsKey(TABLE_SERVICE_CLASS_KEY)) { final String className = configuration.get(TABLE_SERVICE_CLASS_KEY); return getServiceClass(className, ConnectorTableService.class); } else { return defaultServiceClass; } }
return ConnectorUtils.paginate(filteredPartitionList, pageable); } catch (NoSuchObjectException exception) { throw new TableNotFoundException(tableName, exception);
return ConnectorUtils.paginate(filteredPartitionList, pageable); } catch (NoSuchObjectException exception) { throw new TableNotFoundException(tableName, exception);
/** * {@inheritDoc} */ @Override protected void configure() { this.bind(DataSource.class).toInstance(DataSourceManager.get() .load(this.catalogShardName, this.configuration).get(this.catalogShardName)); this.bind(JdbcTypeConverter.class).to(SnowflakeTypeConverter.class).in(Scopes.SINGLETON); this.bind(JdbcExceptionMapper.class).to(SnowflakeExceptionMapper.class).in(Scopes.SINGLETON); this.bind(ConnectorDatabaseService.class) .to(ConnectorUtils.getDatabaseServiceClass(this.configuration, JdbcConnectorDatabaseService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorTableService.class) .to(ConnectorUtils.getTableServiceClass(this.configuration, SnowflakeConnectorTableService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorPartitionService.class) .to(ConnectorUtils.getPartitionServiceClass(this.configuration, JdbcConnectorPartitionService.class)) .in(Scopes.SINGLETON); } }
/** * {@inheritDoc}. */ @Override public List<QualifiedName> listNames( final ConnectorRequestContext requestContext, final QualifiedName name, @Nullable final QualifiedName prefix, @Nullable final Sort sort, @Nullable final Pageable pageable ) { try { final List<QualifiedName> qualifiedNames = Lists.newArrayList(); final String tableFilter = (prefix != null && prefix.isTableDefinition()) ? prefix.getTableName() : null; for (String tableName : this.druidClient.getAllDataSources()) { final QualifiedName qualifiedName = QualifiedName.ofTable(name.getCatalogName(), name.getDatabaseName(), tableName); if (tableFilter == null || tableName.startsWith(tableFilter)) { qualifiedNames.add(qualifiedName); } } if (sort != null) { ConnectorUtils.sort(qualifiedNames, sort, Comparator.comparing(QualifiedName::toString)); } return ConnectorUtils.paginate(qualifiedNames, pageable); } catch (Exception exception) { throw new ConnectorException(String.format("Failed listNames druid table %s", name), exception); } } }
return ConnectorUtils.paginate(names, pageable);
/** * Get the partition service class to use. * * @param configuration The connector configuration * @param defaultServiceClass The default class to use if an override is not found * @return The partition service class to use. */ public static Class<? extends ConnectorPartitionService> getPartitionServiceClass( final Map<String, String> configuration, final Class<? extends ConnectorPartitionService> defaultServiceClass ) { if (configuration.containsKey(PARTITION_SERVICE_CLASS_KEY)) { final String className = configuration.get(PARTITION_SERVICE_CLASS_KEY); return getServiceClass(className, ConnectorPartitionService.class); } else { return defaultServiceClass; } }
/** * {@inheritDoc} */ @Override protected void configure() { this.bind(CassandraTypeConverter.class).toInstance(new CassandraTypeConverter()); this.bind(CassandraExceptionMapper.class).toInstance(new CassandraExceptionMapper()); this.bind(ConnectorDatabaseService.class) .to(ConnectorUtils.getDatabaseServiceClass(this.configuration, CassandraConnectorDatabaseService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorTableService.class) .to(ConnectorUtils.getTableServiceClass(this.configuration, CassandraConnectorTableService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorPartitionService.class) .to(ConnectorUtils.getPartitionServiceClass(this.configuration, CassandraConnectorPartitionService.class)) .in(Scopes.SINGLETON); }
return ConnectorUtils.paginate(names, pageable);
/** * Get the partition service class to use. * * @param configuration The connector configuration * @param defaultServiceClass The default class to use if an override is not found * @return The partition service class to use. */ public static Class<? extends ConnectorPartitionService> getPartitionServiceClass( final Map<String, String> configuration, final Class<? extends ConnectorPartitionService> defaultServiceClass ) { if (configuration.containsKey(PARTITION_SERVICE_CLASS_KEY)) { final String className = configuration.get(PARTITION_SERVICE_CLASS_KEY); return getServiceClass(className, ConnectorPartitionService.class); } else { return defaultServiceClass; } }
/** * {@inheritDoc} */ @Override protected void configure() { this.bind(DataSource.class).toInstance(DataSourceManager.get() .load(this.catalogShardName, this.configuration).get(this.catalogShardName)); this.bind(JdbcTypeConverter.class).to(PostgreSqlTypeConverter.class).in(Scopes.SINGLETON); this.bind(JdbcExceptionMapper.class).to(PostgreSqlExceptionMapper.class).in(Scopes.SINGLETON); this.bind(ConnectorDatabaseService.class) .to(ConnectorUtils.getDatabaseServiceClass(this.configuration, PostgreSqlConnectorDatabaseService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorTableService.class) .to(ConnectorUtils.getTableServiceClass(this.configuration, JdbcConnectorTableService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorPartitionService.class) .to(ConnectorUtils.getPartitionServiceClass(this.configuration, JdbcConnectorPartitionService.class)) .in(Scopes.SINGLETON); } }
/** * Get the table service class to use. * * @param configuration The connector configuration * @param defaultServiceClass The default class to use if an override is not found * @return The table service class to use. */ public static Class<? extends ConnectorTableService> getTableServiceClass( final Map<String, String> configuration, final Class<? extends ConnectorTableService> defaultServiceClass ) { if (configuration.containsKey(TABLE_SERVICE_CLASS_KEY)) { final String className = configuration.get(TABLE_SERVICE_CLASS_KEY); return getServiceClass(className, ConnectorTableService.class); } else { return defaultServiceClass; } }
/** * {@inheritDoc} */ @Override protected void configure() { this.bind(DataSource.class).toInstance(DataSourceManager.get() .load(this.catalogShardName, this.configuration).get(this.catalogShardName)); this.bind(JdbcTypeConverter.class).to(PostgreSqlTypeConverter.class).in(Scopes.SINGLETON); this.bind(JdbcExceptionMapper.class).to(PostgreSqlExceptionMapper.class).in(Scopes.SINGLETON); this.bind(ConnectorDatabaseService.class) .to(ConnectorUtils.getDatabaseServiceClass(this.configuration, PostgreSqlConnectorDatabaseService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorTableService.class) .to(ConnectorUtils.getTableServiceClass(this.configuration, JdbcConnectorTableService.class)) .in(Scopes.SINGLETON); this.bind(ConnectorPartitionService.class) .to(ConnectorUtils.getPartitionServiceClass(this.configuration, JdbcConnectorPartitionService.class)) .in(Scopes.SINGLETON); } }
/** * Get the database service class to use. * * @param configuration The connector configuration * @param defaultServiceClass The default class to use if an override is not found * @return The database service class to use. */ public static Class<? extends ConnectorDatabaseService> getDatabaseServiceClass( final Map<String, String> configuration, final Class<? extends ConnectorDatabaseService> defaultServiceClass ) { if (configuration.containsKey(DATABASE_SERVICE_CLASS_KEY)) { final String className = configuration.get(DATABASE_SERVICE_CLASS_KEY); return getServiceClass(className, ConnectorDatabaseService.class); } else { return defaultServiceClass; } }