@Override public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); // Send info relating to initial table creation i.e, create online or offline args.add(ByteBuffer.wrap(ntc.getInitialTableState().name().getBytes(UTF_8))); // Check for possible initial splits to be added at table creation // Always send number of initial splits to be created, even if zero. If greater than zero, // add the splits to the argument List which will be used by the FATE operations. int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(TextUtil.getByteBuffer(t)); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { // should not happen throw new AssertionError(e); } }
TableOperation tableOp = TableOperation.CREATE; String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM); TimeType timeType = TimeType.valueOf(ByteBufferUtil.toString(arguments.get(1))); InitialTableState initialTableState = InitialTableState .valueOf(ByteBufferUtil.toString(arguments.get(2)));
public void create(String tableName, boolean versioningIter, TimeType timeType) throws AccumuloException, AccumuloSecurityException, TableExistsException { org.apache.accumulo.proxy.thrift.TimeType ttype = org.apache.accumulo.proxy.thrift.TimeType.valueOf(timeType.toString()); try { client.createTable(token, tableName, versioningIter, ttype); } catch (org.apache.accumulo.proxy.thrift.TableExistsException tee) { throw ExceptionFactory.tableExistsException(tableName, tee); } catch (TException e) { throw ExceptionFactory.accumuloException(e); } }
synchronized void addMutation(Mutation m) { if (m.size() == 0) throw new IllegalArgumentException("Can not add empty mutations"); long now = System.currentTimeMillis(); mutationCount++; for (ColumnUpdate u : m.getUpdates()) { Key key = new Key(m.getRow(), 0, m.getRow().length, u.getColumnFamily(), 0, u.getColumnFamily().length, u.getColumnQualifier(), 0, u.getColumnQualifier().length, u.getColumnVisibility(), 0, u.getColumnVisibility().length, u.getTimestamp()); if (u.isDeleted()) key.setDeleted(true); if (!u.hasTimestamp()) if (timeType.equals(TimeType.LOGICAL)) key.setTimestamp(mutationCount); else key.setTimestamp(now); table.put(new MockMemKey(key, mutationCount), new Value(u.getValue())); } }
@Override public void createTable(ByteBuffer login, String tableName, boolean versioningIter, org.apache.accumulo.proxy.thrift.TimeType type) throws org.apache.accumulo.proxy.thrift.AccumuloException, org.apache.accumulo.proxy.thrift.AccumuloSecurityException, org.apache.accumulo.proxy.thrift.TableExistsException, TException { try { if (type == null) type = org.apache.accumulo.proxy.thrift.TimeType.MILLIS; NewTableConfiguration tConfig = new NewTableConfiguration() .setTimeType(TimeType.valueOf(type.toString())); if (!versioningIter) tConfig = tConfig.withoutDefaultIterators(); getConnector(login).tableOperations().create(tableName, tConfig); } catch (TableExistsException e) { throw new org.apache.accumulo.proxy.thrift.TableExistsException(e.toString()); } catch (Exception e) { handleException(e); } }
checkTableName(tableName, TableOperation.CREATE); org.apache.accumulo.core.client.admin.TimeType timeType = org.apache.accumulo.core.client.admin.TimeType.valueOf(ByteBufferUtil.toString(arguments .get(1)));
@Override public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(UTF_8)), ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { // should not happen throw new AssertionError(e); } }
TableOperation tableOp = TableOperation.CREATE; String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM); TimeType timeType = TimeType.valueOf(ByteBufferUtil.toString(arguments.get(1)));