{@inheritDoc}

Adapt a single HBase Operation to a single Bigtable generated message.
166414
@Override
  public void adapt(T operation, com.google.cloud.bigtable.data.v2.models.MutationApi<?> mutation) {
    throw new UnsupportedOperationException(
      String.format("The %s operation is unsupported.", operationDescription));
}
1222872
protected function transform($messages, $format, $messageKey)
    {
        return collect((array) $messages)
            ->map(function ($message) use ($format, $messageKey) {
                // We will simply spin through the given messages and transform each one
                // replacing the :message place holder with the real message allowing
                // the messages to be easily formatted to each developer's desires.
                return str_replace([':message', ':key'], [$message, $messageKey], $format);
            })->all();
    }
834278
private CompletableFuture<Void> modifyColumns(ModifyTableBuilder modifications) {
    return toCompletableFuture(bigtableTableAdminClient
        .modifyFamiliesAsync(modifications.build()))
        .thenApply(r -> null);
  }
577159
@Override
  protected void adapt(LogLevel logLevel, String message, Class clazz)
  {
    Logger logger = Logger.getLogger(clazz);
    Level level = convertToLog4jLevel(logLevel);
    logger.log(DebugLogTee.class.getName(), level, message, null);
  }
718060
public static Builder from(ServiceMessage message) {
    return ServiceMessage.builder().data(message.data()).headers(message.headers());
  }
1078461
public static <T> T run(HTablePool pool, byte[] tableName, HTableRunnable<T> runnable)
            throws IOException {
        HTableInterface hTable = null;
        try {
            hTable = pool.getTable(tableName);
            return runnable.runWith(hTable);
        } catch (Exception e) {
            if (e instanceof IOException) {
                throw (IOException) e;
            } else {
                throw new RuntimeException(e);
            }
        } finally {
            if (hTable != null) {
                pool.putTable(hTable);
            }
        }
    }
668726
function replace($table, $data, $stmt_key = null)
    {
        return $this->executeBySyntax(self::REPLACE, $table, $data, null, array(), $stmt_key);
    }
965315
public int updateGridToMessage(BaseMessage message, boolean bReReadMessage, boolean bAddIfNotFound)
    {
        Record record = this.getRecord(); // Record changed
        int iHandleType = DBConstants.BOOKMARK_HANDLE;  // OBJECT_ID_HANDLE;
        if (this.getNextTable() instanceof org.jbundle.base.db.shared.MultiTable)
            iHandleType = DBConstants.FULL_OBJECT_HANDLE;
        Object bookmark = ((RecordMessageHeader)message.getMessageHeader()).getBookmark(iHandleType);
        int iRecordMessageType = ((RecordMessageHeader)message.getMessageHeader()).getRecordMessageType();
        // See if this record is currently displayed or buffered, if so, refresh and display.
        GridTable table = (GridTable)record.getTable();
        int iIndex = -1;
        if (iRecordMessageType == -1)
        {
            iIndex = table.bookmarkToIndex(bookmark, iHandleType);  // Find this bookmark in the table
        }
        else if (iRecordMessageType == DBConstants.CACHE_UPDATE_TYPE)
        {   // No need to update anything as this is just a notification that the cache has been updaed already.
            iIndex = table.bookmarkToIndex(bookmark, iHandleType);  // Find this bookmark in the table
        }
        else if (iRecordMessageType == DBConstants.SELECT_TYPE)
        {   // A secondary record was selected, update the secondary field to the new value.
            // Don't need to update the table for a select
        }
        else if (iRecordMessageType == DBConstants.AFTER_ADD_TYPE)
        {
            iIndex = table.refreshBookmark(bookmark, iHandleType, false);  // Double-check to see if it has already been added
            if (iIndex == -1)
            {
                if (bAddIfNotFound)
                {   // Note: It might be nice to check this filter in the message on the server, then I don't change to read and check it.
                    try {
                        record = record.setHandle(bookmark, iHandleType);
                        // Fake the handleCriteria to think this is a slave. NOTE: This is not cool in a multitasked environment.
                        int iDBMasterSlave = record.getTable().getCurrentTable().getDatabase().getMasterSlave();
                        record.getTable().getCurrentTable().getDatabase().setMasterSlave(RecordOwner.MASTER | RecordOwner.SLAVE);
                        boolean bMatch = record.handleRemoteCriteria(null, false, null);
                        record.getTable().getCurrentTable().getDatabase().setMasterSlave(iDBMasterSlave);
                        if (bMatch)
                        {
                            iHandleType = DBConstants.DATA_SOURCE_HANDLE;
                            bookmark = this.getDataRecord(m_bCacheRecordData, BaseBuffer.SELECTED_FIELDS);
                        }
                        else
                            bookmark = null;
                    } catch (DBException e) {
                        e.printStackTrace();
                    }
                    if (bookmark != null)
                        iIndex = table.addNewBookmark(bookmark, iHandleType);   // Add this new record to the table
                }
            }
        }
        else
        {
            iIndex = table.refreshBookmark(bookmark, iHandleType, bReReadMessage);  // Refresh the data for this bookmark
        }
        return iIndex;
    }
786710
public BulkRead createBulkRead(BigtableTableName tableName) {
    return new BulkRead(getDataClientWrapper(), tableName,
        options.getBulkOptions().getBulkMaxRowKeyCount(),
        BigtableSessionSharedThreadPools.getInstance().getBatchThreadPool()
    );
  }
80523
function BatchResult(tableService, table, operations) {
  this.tableService = tableService;
  this.table = table;
  this.operations = operations;
  this.batchBoundary = 'batch_' + BatchResult._getBoundary();
  this.changesetBoundary = 'changeset_' + BatchResult._getBoundary();
}
1193692
@Override
    public Operation prepareReplicationOperation(PartitionReplicationEvent event) {
        if (event.getReplicaIndex() > 1) {
            return null;
        }

        List<XATransactionDTO> migrationData = new ArrayList<XATransactionDTO>();
        InternalPartitionService partitionService = nodeEngine.getPartitionService();
        for (Map.Entry<SerializableXID, List<XATransaction>> entry : transactions.entrySet()) {
            SerializableXID xid = entry.getKey();
            int partitionId = partitionService.getPartitionId(xid);
            List<XATransaction> xaTransactionList = entry.getValue();
            for (XATransaction xaTransaction : xaTransactionList) {
                if (partitionId == event.getPartitionId()) {
                    migrationData.add(new XATransactionDTO(xaTransaction));
                }
            }
        }
        if (migrationData.isEmpty()) {
            return null;
        } else {
            return new XaReplicationOperation(migrationData, event.getPartitionId(), event.getReplicaIndex());
        }
    }
64928
private Put preparePut(String columnFamily, Object rowKey, Map<String, Attribute> columns, Map<String, Object> values)
            throws IOException
    {
        Put p = new Put(HBaseUtils.getBytes(rowKey));
        for (String columnName : columns.keySet())
        {
            Attribute column = columns.get(columnName);
            if (!column.isCollection() && !((SingularAttribute) column).isId())
            {
                String qualifier = columnName;
                try
                {
                    Object o = values.get(columnName);
                    byte[] value = HBaseUtils.getBytes(o);
                    if (value != null && columnFamily != null)
                    {
                        p.add(Bytes.toBytes(columnFamily), Bytes.toBytes(qualifier), value);
                    }
                }
                catch (PropertyAccessException e1)
                {
                    throw new IOException(e1);
                }
            }
        }
        return p;
    }
639992
@Override
    public void processPut(Record record, String tabName,
            String famName, String quaName) {
	logger.debug("NATIVE Begin processPut(" + record + ", " + tabName + ")");
        HTable hTable = getTable(tabName);
        try {
            Put op = createPut(record, tabName, famName, quaName);
            hTable.put(op);
        } catch (IOException e) {
            logger.error("Error while attempting to perform operations at HBaseDataTransactions.");
            logger.error(e.getMessage());
        }
    }
1305034
private Scanner getScanner(final byte[] table) throws HBaseException {
    short metric_width = TSDB.metrics_width();
    final byte[] start_row = 
      Arrays.copyOfRange(Bytes.fromLong(start_id), 8 - metric_width, 8);
    final byte[] end_row = 
      Arrays.copyOfRange(Bytes.fromLong(end_id), 8 - metric_width, 8);
    final Scanner scanner = tsdb.getClient().newScanner(table);
    scanner.setStartKey(start_row);
    scanner.setStopKey(end_row);
    scanner.setFamily(NAME_FAMILY);
    return scanner;
  }
64099
AutoBean<OperationMessage> makeOperationMessage(final SimpleProxyId<BaseProxy> stableId,
      final AutoBean<?> proxyBean, final boolean useDelta) {

    // The OperationMessages describes operations on exactly one entity
    final AutoBean<OperationMessage> toReturn = MessageFactoryHolder.FACTORY.operation();
    final OperationMessage operation = toReturn.as();
    operation.setTypeToken(this.state.requestFactory.getTypeToken(stableId.getProxyClass()));

    // Find the object to compare against
    AutoBean<?> parent;
    if (stableId.isEphemeral()) {
      // Newly-created object, use a blank object to compare against
      parent = this.createProxy(stableId.getProxyClass(), stableId, true);

      // Newly-created objects go into the persist operation bucket
      operation.setOperation(WriteOperation.PERSIST);
      // The ephemeral id is passed to the server
      operation.setClientId(stableId.getClientId());
      operation.setStrength(Strength.EPHEMERAL);
    } else if (stableId.isSynthetic()) {
      // Newly-created object, use a blank object to compare against
      parent = this.createProxy(stableId.getProxyClass(), stableId, true);

      // Newly-created objects go into the persist operation bucket
      operation.setOperation(WriteOperation.PERSIST);
      // The ephemeral id is passed to the server
      operation.setSyntheticId(stableId.getSyntheticId());
      operation.setStrength(Strength.SYNTHETIC);
    } else {
      parent = proxyBean.getTag(Constants.PARENT_OBJECT);
      // Requests involving existing objects use the persisted id
      operation.setServerId(stableId.getServerId());
      operation.setOperation(WriteOperation.UPDATE);
    }
    assert !useDelta || parent != null;

    // Send our version number to the server to cut down on future payloads
    final String version = proxyBean.getTag(Constants.VERSION_PROPERTY_B64);
    if (version != null) {
      operation.setVersion(version);
    }

    Map<String, Object> diff = Collections.emptyMap();
    if (this.isEntityType(stableId.getProxyClass())) {
      // Compute what's changed on the client
      diff = useDelta ? AutoBeanUtils.diff(parent, proxyBean)
          : AutoBeanUtils.getAllProperties(proxyBean);
    } else if (this.isValueType(stableId.getProxyClass())) {
      // Send everything
      diff = AutoBeanUtils.getAllProperties(proxyBean);
    }

    if (!diff.isEmpty()) {
      final Map<String, Splittable> propertyMap = new HashMap<>();
      for (final Map.Entry<String, Object> entry : diff.entrySet()) {
        propertyMap.put(entry.getKey(), EntityCodex.encode(this, entry.getValue()));
      }
      operation.setPropertyMap(propertyMap);
    }
    return toReturn;
  }
64870
def _to_base_type(self, msg):
    """"""
    ent = _message_to_entity(msg, self._modelclass)
    ent.blob_ = self._protocol_impl.encode_message(msg)
    return ent
1004721
@Override
    public int executeBatch()
    {
        Map<HTableInterface, List<HBaseDataWrapper>> data = new HashMap<HTableInterface, List<HBaseDataWrapper>>();

        try
        {
            for (Node node : nodes)
            {
                if (node.isDirty())
                {
                    node.handlePreEvent();
                    HTableInterface hTable = null;
                    Object rowKey = node.getEntityId();
                    Object entity = node.getData();
                    if (node.isInState(RemovedState.class))
                    {
                        delete(entity, rowKey);
                    }
                    else
                    {
                        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata,
                                node.getDataClass());

                        HBaseDataWrapper columnWrapper = new HBaseDataHandler.HBaseDataWrapper(rowKey,
                                new java.util.HashMap<String, Attribute>(), entity, metadata.getTableName());

                        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                                .getMetamodel(metadata.getPersistenceUnit());

                        EntityType entityType = metaModel.entity(node.getDataClass());

                        List<HBaseDataWrapper> embeddableData = new ArrayList<HBaseDataHandler.HBaseDataWrapper>();

                        hTable = ((HBaseDataHandler) handler).gethTable(metadata.getSchema());
                        ((HBaseDataHandler) handler).preparePersistentData(metadata.getSchema(),
                                metadata.getTableName(), entity, rowKey, metaModel, entityType.getAttributes(),
                                columnWrapper, embeddableData, showQuery);

                        List<HBaseDataWrapper> dataSet = null;
                        if (data.containsKey(hTable))
                        {
                            dataSet = data.get(metadata.getTableName());
                            addRecords(columnWrapper, embeddableData, dataSet);
                        }
                        else
                        {
                            dataSet = new ArrayList<HBaseDataHandler.HBaseDataWrapper>();
                            addRecords(columnWrapper, embeddableData, dataSet);
                            data.put(hTable, dataSet);
                        }
                    }
                    node.handlePostEvent();
                }
            }

            if (!data.isEmpty())
            {
                ((HBaseDataHandler) handler).batch_insert(data);
            }
            return data.size();
        }
        catch (IOException ioex)
        {
            log.error("Error while executing batch insert/update, Caused by: .", ioex);
            throw new KunderaException(ioex);
        }

    }