public Update(Schema schema, String tableName) { this(schema.getTableByName(tableName)); }
public Update(Schema schema, String tableName) { this(schema.getTableByName(tableName)); }
private TableFromBuilder and(Schema schema, String tableName) { Table table = schema.getTableByName(tableName); return and(table); }
private TableFromBuilder and(Schema schema, String tableName) { Table table = schema.getTableByName(tableName); return and(table); }
@Override public TableFromBuilder from(Schema schema, String tableName) { Table table = schema.getTableByName(tableName); if (table == null) { throw new IllegalArgumentException("Nu such table '" + tableName + "' found in schema: " + schema + ". Available tables are: " + Arrays.toString(schema.getTableNames().toArray())); } return from(table); }
private Table getTable(String schemaName, String tableName) { final Schema schema = getSchema(schemaName); final Table table = schema.getTableByName(tableName); if (table == null) { throw new IllegalArgumentException("Nu such table '" + tableName + "' found in schema: " + schema + ". Available tables are: " + Arrays.toString(schema.getTableNames().toArray())); } return table; }
@Override public final TableDropBuilder dropTable(Schema schema, String tableName) throws IllegalArgumentException, IllegalStateException, UnsupportedOperationException { final Table table = schema.getTableByName(tableName); if (table == null) { throw new IllegalArgumentException("Nu such table '" + tableName + "' found in schema: " + schema + ". Available tables are: " + Arrays.toString(schema.getTableNames().toArray())); } return dropTable(table); }
private Table getTable(String schemaName, String tableName) { final Schema schema = getSchema(schemaName); final Table table = schema.getTableByName(tableName); if (table == null) { throw new IllegalArgumentException("Nu such table '" + tableName + "' found in schema: " + schema + ". Available tables are: " + Arrays.toString(schema.getTableNames().toArray())); } return table; }
@Override public TableFromBuilder from(Schema schema, String tableName) { Table table = schema.getTableByName(tableName); if (table == null) { throw new IllegalArgumentException("Nu such table '" + tableName + "' found in schema: " + schema + ". Available tables are: " + Arrays.toString(schema.getTableNames().toArray())); } return from(table); }
@Override public final TableDropBuilder dropTable(Schema schema, String tableName) throws IllegalArgumentException, IllegalStateException, UnsupportedOperationException { final Table table = schema.getTableByName(tableName); if (table == null) { throw new IllegalArgumentException("Nu such table '" + tableName + "' found in schema: " + schema + ". Available tables are: " + Arrays.toString(schema.getTableNames().toArray())); } return dropTable(table); }
public AbstractTableCreationBuilder(U updateCallback, Schema schema, String name) { if (schema != null && schema.getTableByName(name) != null) { throw new IllegalArgumentException("A table with the name '" + name + "' already exists in schema: " + schema); } _updateCallback = updateCallback; _schema = MetaModelHelper.resolveUnderlyingSchema(schema); _table = new MutableTable(name, TableType.TABLE, schema); }
public AbstractTableCreationBuilder(U updateCallback, Schema schema, String name) { if (schema != null && schema.getTableByName(name) != null) { throw new IllegalArgumentException("A table with the name '" + name + "' already exists in schema: " + schema); } _updateCallback = updateCallback; _schema = MetaModelHelper.resolveUnderlyingSchema(schema); _table = new MutableTable(name, TableType.TABLE, schema); }
public HBaseTableDropBuilder(final Table table, final HBaseUpdateCallback updateCallback) { super(table); if (updateCallback.getDataContext().getDefaultSchema().getTableByName(table.getName()) == null) { throw new MetaModelException("Trying to delete a table that doesn't exist in the datastore."); } _updateCallback = updateCallback; }
public HBaseTableDropBuilder(final Table table, final HBaseUpdateCallback updateCallback) { super(table); if (updateCallback.getDataContext().getDefaultSchema().getTableByName(table.getName()) == null) { throw new MetaModelException("Trying to delete a table that doesn't exist in the datastore."); } _updateCallback = updateCallback; }
@Override public Table execute() { Set<String> columnFamilies = getColumnFamilies(); if (columnFamilies == null || columnFamilies.isEmpty()) { throw new MetaModelException("Can't create a table without column families."); } final Table table = getTable(); // Add the table to the datastore ((HBaseDataContext) getUpdateCallback().getDataContext()).getHBaseClient().createTable(table.getName(), columnFamilies); // Update the schema addNewTableToSchema(table); return getSchema().getTableByName(table.getName()); }
@Override public Table execute() { Set<String> columnFamilies = getColumnFamilies(); if (columnFamilies == null || columnFamilies.isEmpty()) { throw new MetaModelException("Can't create a table without column families."); } final Table table = getTable(); // Add the table to the datastore ((HBaseDataContext) getUpdateCallback().getDataContext()).getHBaseClient().createTable(table.getName(), columnFamilies); // Update the schema addNewTableToSchema(table); return getSchema().getTableByName(table.getName()); }
public ExcelDataContextWriter(final File file, final String sheetName) { _dataContext = new ExcelDataContext(file); _sheetName = sheetName; _buffer = new WriteBuffer(2000, records -> _dataContext.executeUpdate(callback -> { final Table table = callback.getDataContext().getDefaultSchema().getTableByName(_sheetName); for (final Object[] objects : records) { final RowInsertionBuilder insert = callback.insertInto(table); for (int i = 0; i < objects.length; i++) { insert.value(i, objects[i]); } insert.execute(); } })); }
/** * Check if the table and it's columnFamilies exist in the schema * * @param updateCallback * @param tableGettingInserts * @throws MetaModelException If the table or the columnFamilies don't exist */ private void checkTable(final HBaseTable tableGettingInserts) { final HBaseTable tableInSchema = (HBaseTable) _updateCallback .getDataContext() .getDefaultSchema() .getTableByName( tableGettingInserts.getName()); if (tableInSchema == null) { throw new MetaModelException("Trying to insert data into table: " + tableGettingInserts.getName() + ", which doesn't exist yet"); } checkColumnFamilies(tableInSchema, tableGettingInserts.getColumnFamilies()); }
@Override protected void setValue(final String value) { if (getValue() == value) { return; } final Schema schema = _schemaRef.get(); final Table table; if (value == null) { table = null; } else if (schema == null) { table = new MutableTable(value); } else { table = schema.getTableByName(value); } _comboBox.setEditable(true); _comboBox.setSelectedItem(table); _comboBox.setEditable(false); fireValueChanged(); }
private static Table getTable(final UpdateableDataContext dataContext, final String sheetName, final String[] columnNames) { final Schema schema = dataContext.getDefaultSchema(); Table table = schema.getTableByName(sheetName); if (table == null) { final MutableRef<Table> tableRef = new MutableRef<>(); dataContext.executeUpdate(callback -> { final TableCreationBuilder tableBuilder = callback.createTable(schema, sheetName); for (final String columnName : columnNames) { tableBuilder.withColumn(columnName); } tableRef.set(tableBuilder.execute()); }); table = tableRef.get(); } return table; }