Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E7B119572 for ; Tue, 1 Mar 2016 23:15:53 +0000 (UTC) Received: (qmail 67420 invoked by uid 500); 1 Mar 2016 23:15:53 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 67271 invoked by uid 500); 1 Mar 2016 23:15:52 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 67077 invoked by uid 99); 1 Mar 2016 23:15:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Mar 2016 23:15:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8494CE01F4; Tue, 1 Mar 2016 23:15:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: misty@apache.org To: commits@hbase.apache.org Date: Tue, 01 Mar 2016 23:15:54 -0000 Message-Id: <7205d4b037844680b6bee22c1210e3be@git.apache.org> In-Reply-To: <1e0ae2639f5a425eb6a4567a059abddc@git.apache.org> References: <1e0ae2639f5a425eb6a4567a059abddc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/26] hbase-site git commit: Published site at 7c54525c89bbbe0c66401813433bfb957e461eac. http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/TestHelloHBase.html ---------------------------------------------------------------------- diff --git a/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/TestHelloHBase.html b/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/TestHelloHBase.html new file mode 100644 index 0000000..d7a533d --- /dev/null +++ b/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/TestHelloHBase.html @@ -0,0 +1,145 @@ + + + + +TestHelloHBase xref + + + +
+
+1   /**
+2    *
+3    * Licensed to the Apache Software Foundation (ASF) under one
+4    * or more contributor license agreements.  See the NOTICE file
+5    * distributed with this work for additional information
+6    * regarding copyright ownership.  The ASF licenses this file
+7    * to you under the Apache License, Version 2.0 (the
+8    * "License"); you may not use this file except in compliance
+9    * with the License.  You may obtain a copy of the License at
+10   *
+11   *     http://www.apache.org/licenses/LICENSE-2.0
+12   *
+13   * Unless required by applicable law or agreed to in writing, software
+14   * distributed under the License is distributed on an "AS IS" BASIS,
+15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+16   * See the License for the specific language governing permissions and
+17   * limitations under the License.
+18   */
+19  package org.apache.hbase.archetypes.exemplars.shaded_client;
+20  
+21  import java.io.IOException;
+22  import org.apache.hadoop.hbase.HBaseTestingUtility;
+23  import org.apache.hadoop.hbase.NamespaceDescriptor;
+24  import org.apache.hadoop.hbase.client.Admin;
+25  import org.apache.hadoop.hbase.client.Get;
+26  import org.apache.hadoop.hbase.client.Put;
+27  import org.apache.hadoop.hbase.client.Result;
+28  import org.apache.hadoop.hbase.client.Table;
+29  import org.apache.hadoop.hbase.testclassification.MediumTests;
+30  import org.apache.hadoop.hbase.util.Bytes;
+31  import org.junit.AfterClass;
+32  import static org.junit.Assert.assertEquals;
+33  import org.junit.BeforeClass;
+34  import org.junit.Test;
+35  import org.junit.experimental.categories.Category;
+36  
+37  /**
+38   * Unit testing for HelloHBase.
+39   */
+40  @Category(MediumTests.class)
+41  public class TestHelloHBase {
+42  
+43    private static final HBaseTestingUtility TEST_UTIL
+44            = new HBaseTestingUtility();
+45  
+46    @BeforeClass
+47    public static void beforeClass() throws Exception {
+48      TEST_UTIL.startMiniCluster(1);
+49    }
+50  
+51    @AfterClass
+52    public static void afterClass() throws Exception {
+53      TEST_UTIL.shutdownMiniCluster();
+54    }
+55  
+56    @Test
+57    public void testNamespaceExists() throws Exception {
+58      final String NONEXISTENT_NAMESPACE = "xyzpdq_nonexistent";
+59      final String EXISTING_NAMESPACE = "pdqxyz_myExistingNamespace";
+60      boolean exists;
+61      Admin admin = TEST_UTIL.getHBaseAdmin();
+62  
+63      exists = HelloHBase.namespaceExists(admin, NONEXISTENT_NAMESPACE);
+64      assertEquals("#namespaceExists failed: found nonexistent namespace.",
+65              false, exists);
+66  
+67      admin.createNamespace
+68          (NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
+69      exists = HelloHBase.namespaceExists(admin, EXISTING_NAMESPACE);
+70      assertEquals("#namespaceExists failed: did NOT find existing namespace.",
+71              true, exists);
+72      admin.deleteNamespace(EXISTING_NAMESPACE);
+73    }
+74  
+75    @Test
+76    public void testCreateNamespaceAndTable() throws Exception {
+77      Admin admin = TEST_UTIL.getHBaseAdmin();
+78      HelloHBase.createNamespaceAndTable(admin);
+79  
+80      boolean namespaceExists
+81              = HelloHBase.namespaceExists(admin, HelloHBase.MY_NAMESPACE_NAME);
+82      assertEquals("#createNamespaceAndTable failed to create namespace.",
+83              true, namespaceExists);
+84  
+85      boolean tableExists = admin.tableExists(HelloHBase.MY_TABLE_NAME);
+86      assertEquals("#createNamespaceAndTable failed to create table.",
+87              true, tableExists);
+88  
+89      admin.disableTable(HelloHBase.MY_TABLE_NAME);
+90      admin.deleteTable(HelloHBase.MY_TABLE_NAME);
+91      admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
+92    }
+93  
+94    @Test
+95    public void testPutRowToTable() throws IOException {
+96      Admin admin = TEST_UTIL.getAdmin();
+97      admin.createNamespace
+98          (NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
+99      Table table
+100             = TEST_UTIL.createTable
+101                 (HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
+102 
+103     HelloHBase.putRowToTable(table);
+104     Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
+105     assertEquals("#putRowToTable failed to store row.", false, row.isEmpty());
+106 
+107     TEST_UTIL.deleteTable(HelloHBase.MY_TABLE_NAME);
+108     admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
+109   }
+110 
+111   @Test
+112   public void testDeleteRow() throws IOException {
+113     Admin admin = TEST_UTIL.getAdmin();
+114     admin.createNamespace
+115         (NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
+116     Table table
+117             = TEST_UTIL.createTable
+118                 (HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
+119 
+120     table.put(new Put(HelloHBase.MY_ROW_ID).
+121             addColumn(HelloHBase.MY_COLUMN_FAMILY_NAME,
+122                     HelloHBase.MY_FIRST_COLUMN_QUALIFIER,
+123                     Bytes.toBytes("xyz")));
+124     HelloHBase.deleteRow(table);
+125     Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
+126     assertEquals("#deleteRow failed to delete row.", true, row.isEmpty());
+127 
+128     TEST_UTIL.deleteTable(HelloHBase.MY_TABLE_NAME);
+129     admin.deleteNamespace(HelloHBase.MY_NAMESPACE_NAME);
+130   }
+131 }
+
+
+ + http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-frame.html ---------------------------------------------------------------------- diff --git a/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-frame.html b/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-frame.html new file mode 100644 index 0000000..589e78d --- /dev/null +++ b/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-frame.html @@ -0,0 +1,24 @@ + + + + + + Apache HBase 2.0.0-SNAPSHOT Reference Package org.apache.hbase.archetypes.exemplars.shaded_client + + + + +

+ org.apache.hbase.archetypes.exemplars.shaded_client +

+ +

Classes

+ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-summary.html ---------------------------------------------------------------------- diff --git a/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-summary.html b/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-summary.html new file mode 100644 index 0000000..924da8c --- /dev/null +++ b/xref-test/org/apache/hbase/archetypes/exemplars/shaded_client/package-summary.html @@ -0,0 +1,67 @@ + + + + + + Apache HBase 2.0.0-SNAPSHOT Reference Package org.apache.hbase.archetypes.exemplars.shaded_client + + + +
+ +
+
+ +
+ +

Package org.apache.hbase.archetypes.exemplars.shaded_client

+ + + + + + + + + + + + +
Class Summary
+ TestHelloHBase +
+ +
+ +
+
+ +
+
+ Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref-test/overview-frame.html ---------------------------------------------------------------------- diff --git a/xref-test/overview-frame.html b/xref-test/overview-frame.html index b8aeb08..24b5d4f 100644 --- a/xref-test/overview-frame.html +++ b/xref-test/overview-frame.html @@ -324,6 +324,9 @@
  • org.apache.hbase.archetypes.exemplars.client
  • +
  • + org.apache.hbase.archetypes.exemplars.shaded_client +
  • http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref-test/overview-summary.html ---------------------------------------------------------------------- diff --git a/xref-test/overview-summary.html b/xref-test/overview-summary.html index 95e3048..f1dab6f 100644 --- a/xref-test/overview-summary.html +++ b/xref-test/overview-summary.html @@ -548,6 +548,11 @@ org.apache.hbase.archetypes.exemplars.client + + + org.apache.hbase.archetypes.exemplars.shaded_client + + http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref/org/apache/hadoop/hbase/rest/RowResource.html ---------------------------------------------------------------------- diff --git a/xref/org/apache/hadoop/hbase/rest/RowResource.html b/xref/org/apache/hadoop/hbase/rest/RowResource.html index 2f8c5c9..575d942 100644 --- a/xref/org/apache/hadoop/hbase/rest/RowResource.html +++ b/xref/org/apache/hadoop/hbase/rest/RowResource.html @@ -563,66 +563,106 @@ 553 .build(); 554 } 555 -556 delete = new Delete(key); -557 boolean retValue; -558 CellModel valueToDeleteCell = rowModel.getCells().get(0); -559 byte[] valueToDeleteColumn = valueToDeleteCell.getColumn(); -560 if (valueToDeleteColumn == null) { -561 try { -562 valueToDeleteColumn = rowspec.getColumns()[0]; -563 } catch (final ArrayIndexOutOfBoundsException e) { -564 servlet.getMetrics().incrementFailedDeleteRequests(1); -565 return Response.status(Response.Status.BAD_REQUEST) -566 .type(MIMETYPE_TEXT).entity("Bad request: Column not specified for check." + CRLF) -567 .build(); -568 } -569 } -570 byte[][] parts = KeyValue.parseColumn(valueToDeleteColumn); -571 if (parts.length == 2) { -572 if (parts[1].length != 0) { -573 delete.addColumns(parts[0], parts[1]); -574 retValue = table.checkAndDelete(key, parts[0], parts[1], -575 valueToDeleteCell.getValue(), delete); -576 } else { -577 // The case of empty qualifier. -578 delete.addColumns(parts[0], Bytes.toBytes(StringUtils.EMPTY)); -579 retValue = table.checkAndDelete(key, parts[0], Bytes.toBytes(StringUtils.EMPTY), -580 valueToDeleteCell.getValue(), delete); -581 } -582 } else { -583 servlet.getMetrics().incrementFailedDeleteRequests(1); -584 return Response.status(Response.Status.BAD_REQUEST) -585 .type(MIMETYPE_TEXT).entity("Bad request: Column incorrectly specified." + CRLF) -586 .build(); -587 } -588 delete.addColumns(parts[0], parts[1]); +556 List<CellModel> cellModels = rowModel.getCells(); +557 int cellModelCount = cellModels.size(); +558 +559 delete = new Delete(key); +560 boolean retValue; +561 CellModel valueToDeleteCell = rowModel.getCells().get(cellModelCount -1); +562 byte[] valueToDeleteColumn = valueToDeleteCell.getColumn(); +563 if (valueToDeleteColumn == null) { +564 try { +565 valueToDeleteColumn = rowspec.getColumns()[0]; +566 } catch (final ArrayIndexOutOfBoundsException e) { +567 servlet.getMetrics().incrementFailedDeleteRequests(1); +568 return Response.status(Response.Status.BAD_REQUEST) +569 .type(MIMETYPE_TEXT).entity("Bad request: Column not specified for check." + CRLF) +570 .build(); +571 } +572 } +573 +574 byte[][] parts ; +575 // Copy all the cells to the Delete request if extra cells are sent +576 if(cellModelCount > 1) { +577 for (int i = 0, n = cellModelCount - 1; i < n; i++) { +578 CellModel cell = cellModels.get(i); +579 byte[] col = cell.getColumn(); +580 +581 if (col == null) { +582 servlet.getMetrics().incrementFailedPutRequests(1); +583 return Response.status(Response.Status.BAD_REQUEST) +584 .type(MIMETYPE_TEXT).entity("Bad request: Column found to be null." + CRLF) +585 .build(); +586 } +587 +588 parts = KeyValue.parseColumn(col); 589 -590 if (LOG.isDebugEnabled()) { -591 LOG.debug("CHECK-AND-DELETE " + delete.toString() + ", returns " -592 + retValue); -593 } -594 -595 if (!retValue) { -596 servlet.getMetrics().incrementFailedDeleteRequests(1); -597 return Response.status(Response.Status.NOT_MODIFIED) -598 .type(MIMETYPE_TEXT).entity(" Delete check failed." + CRLF) -599 .build(); -600 } -601 ResponseBuilder response = Response.ok(); -602 servlet.getMetrics().incrementSucessfulDeleteRequests(1); -603 return response.build(); -604 } catch (Exception e) { -605 servlet.getMetrics().incrementFailedDeleteRequests(1); -606 return processException(e); -607 } finally { -608 if (table != null) try { -609 table.close(); -610 } catch (IOException ioe) { -611 LOG.debug("Exception received while closing the table", ioe); -612 } -613 } -614 } -615 } +590 if (parts.length == 1) { +591 // Only Column Family is specified +592 delete.addFamily(parts[0], cell.getTimestamp()); +593 } else if (parts.length == 2) { +594 delete.addColumn(parts[0], parts[1], cell.getTimestamp()); +595 } else { +596 servlet.getMetrics().incrementFailedDeleteRequests(1); +597 return Response.status(Response.Status.BAD_REQUEST) +598 .type(MIMETYPE_TEXT) +599 .entity("Bad request: Column to delete incorrectly specified." + CRLF) +600 .build(); +601 } +602 } +603 } +604 +605 parts = KeyValue.parseColumn(valueToDeleteColumn); +606 if (parts.length == 2) { +607 if (parts[1].length != 0) { +608 // To support backcompat of deleting a cell +609 // if that is the only cell passed to the rest api +610 if(cellModelCount == 1) { +611 delete.addColumns(parts[0], parts[1]); +612 } +613 retValue = table.checkAndDelete(key, parts[0], parts[1], +614 valueToDeleteCell.getValue(), delete); +615 } else { +616 // The case of empty qualifier. +617 if(cellModelCount == 1) { +618 delete.addColumns(parts[0], Bytes.toBytes(StringUtils.EMPTY)); +619 } +620 retValue = table.checkAndDelete(key, parts[0], Bytes.toBytes(StringUtils.EMPTY), +621 valueToDeleteCell.getValue(), delete); +622 } +623 } else { +624 servlet.getMetrics().incrementFailedDeleteRequests(1); +625 return Response.status(Response.Status.BAD_REQUEST) +626 .type(MIMETYPE_TEXT).entity("Bad request: Column to check incorrectly specified." + CRLF) +627 .build(); +628 } +629 +630 if (LOG.isDebugEnabled()) { +631 LOG.debug("CHECK-AND-DELETE " + delete.toString() + ", returns " +632 + retValue); +633 } +634 +635 if (!retValue) { +636 servlet.getMetrics().incrementFailedDeleteRequests(1); +637 return Response.status(Response.Status.NOT_MODIFIED) +638 .type(MIMETYPE_TEXT).entity(" Delete check failed." + CRLF) +639 .build(); +640 } +641 ResponseBuilder response = Response.ok(); +642 servlet.getMetrics().incrementSucessfulDeleteRequests(1); +643 return response.build(); +644 } catch (Exception e) { +645 servlet.getMetrics().incrementFailedDeleteRequests(1); +646 return processException(e); +647 } finally { +648 if (table != null) try { +649 table.close(); +650 } catch (IOException ioe) { +651 LOG.debug("Exception received while closing the table", ioe); +652 } +653 } +654 } +655 }
    http://git-wip-us.apache.org/repos/asf/hbase-site/blob/c115ab43/xref/org/apache/hadoop/hbase/rest/client/RemoteHTable.html ---------------------------------------------------------------------- diff --git a/xref/org/apache/hadoop/hbase/rest/client/RemoteHTable.html b/xref/org/apache/hadoop/hbase/rest/client/RemoteHTable.html index f326f2b..2a79fb1 100644 --- a/xref/org/apache/hadoop/hbase/rest/client/RemoteHTable.html +++ b/xref/org/apache/hadoop/hbase/rest/client/RemoteHTable.html @@ -732,132 +732,133 @@ 722 public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, 723 byte[] value, Delete delete) throws IOException { 724 Put put = new Put(row); -725 // column to check-the-value -726 put.add(new KeyValue(row, family, qualifier, value)); -727 CellSetModel model = buildModelFromPut(put); -728 StringBuilder sb = new StringBuilder(); -729 sb.append('/'); -730 sb.append(Bytes.toStringBinary(name)); -731 sb.append('/'); -732 sb.append(Bytes.toStringBinary(row)); -733 sb.append("?check=delete"); -734 -735 for (int i = 0; i < maxRetries; i++) { -736 Response response = client.put(sb.toString(), -737 Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput()); -738 int code = response.getCode(); -739 switch (code) { -740 case 200: -741 return true; -742 case 304: // NOT-MODIFIED -743 return false; -744 case 509: -745 try { -746 Thread.sleep(sleepTime); -747 } catch (final InterruptedException e) { -748 throw (InterruptedIOException)new InterruptedIOException().initCause(e); -749 } -750 break; -751 default: -752 throw new IOException("checkAndDelete request failed with " + code); -753 } -754 } -755 throw new IOException("checkAndDelete request timed out"); -756 } -757 -758 @Override -759 public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, -760 CompareOp compareOp, byte[] value, Delete delete) throws IOException { -761 throw new IOException("checkAndDelete for non-equal comparison not implemented"); -762 } -763 -764 @Override -765 public Result increment(Increment increment) throws IOException { -766 throw new IOException("Increment not supported"); -767 } -768 -769 @Override -770 public Result append(Append append) throws IOException { -771 throw new IOException("Append not supported"); -772 } -773 -774 @Override -775 public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, -776 long amount) throws IOException { -777 throw new IOException("incrementColumnValue not supported"); -778 } -779 -780 @Override -781 public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, -782 long amount, Durability durability) throws IOException { -783 throw new IOException("incrementColumnValue not supported"); -784 } -785 -786 @Override -787 public void batch(List<? extends Row> actions, Object[] results) throws IOException { -788 throw new IOException("batch not supported"); -789 } -790 -791 @Override -792 public <R> void batchCallback(List<? extends Row> actions, Object[] results, -793 Batch.Callback<R> callback) throws IOException, InterruptedException { -794 throw new IOException("batchCallback not supported"); -795 } -796 -797 @Override -798 public CoprocessorRpcChannel coprocessorService(byte[] row) { -799 throw new UnsupportedOperationException("coprocessorService not implemented"); -800 } -801 -802 @Override -803 public <T extends Service, R> Map<byte[], R> coprocessorService(Class<T> service, -804 byte[] startKey, byte[] endKey, Batch.Call<T, R> callable) -805 throws ServiceException, Throwable { -806 throw new UnsupportedOperationException("coprocessorService not implemented"); -807 } -808 -809 @Override -810 public <T extends Service, R> void coprocessorService(Class<T> service, -811 byte[] startKey, byte[] endKey, Batch.Call<T, R> callable, Batch.Callback<R> callback) -812 throws ServiceException, Throwable { -813 throw new UnsupportedOperationException("coprocessorService not implemented"); -814 } -815 -816 @Override -817 public void mutateRow(RowMutations rm) throws IOException { -818 throw new IOException("atomicMutation not supported"); -819 } -820 -821 @Override -822 public long getWriteBufferSize() { -823 throw new UnsupportedOperationException("getWriteBufferSize not implemented"); -824 } -825 -826 @Override -827 public void setWriteBufferSize(long writeBufferSize) throws IOException { -828 throw new IOException("setWriteBufferSize not supported"); -829 } -830 -831 @Override -832 public <R extends Message> Map<byte[], R> batchCoprocessorService( -833 Descriptors.MethodDescriptor method, Message request, -834 byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable { -835 throw new UnsupportedOperationException("batchCoprocessorService not implemented"); -836 } -837 -838 @Override -839 public <R extends Message> void batchCoprocessorService( -840 Descriptors.MethodDescriptor method, Message request, -841 byte[] startKey, byte[] endKey, R responsePrototype, Callback<R> callback) -842 throws ServiceException, Throwable { -843 throw new UnsupportedOperationException("batchCoprocessorService not implemented"); -844 } -845 -846 @Override public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, -847 CompareOp compareOp, byte[] value, RowMutations rm) throws IOException { -848 throw new UnsupportedOperationException("checkAndMutate not implemented"); -849 } -850 } +725 put.setFamilyCellMap(delete.getFamilyCellMap()); +726 // column to check-the-value +727 put.add(new KeyValue(row, family, qualifier, value)); +728 CellSetModel model = buildModelFromPut(put); +729 StringBuilder sb = new StringBuilder(); +730 sb.append('/'); +731 sb.append(Bytes.toStringBinary(name)); +732 sb.append('/'); +733 sb.append(Bytes.toStringBinary(row)); +734 sb.append("?check=delete"); +735 +736 for (int i = 0; i < maxRetries; i++) { +737 Response response = client.put(sb.toString(), +738 Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput()); +739 int code = response.getCode(); +740 switch (code) { +741 case 200: +742 return true; +743 case 304: // NOT-MODIFIED +744 return false; +745 case 509: +746 try { +747 Thread.sleep(sleepTime); +748 } catch (final InterruptedException e) { +749 throw (InterruptedIOException)new InterruptedIOException().initCause(e); +750 } +751 break; +752 default: +753 throw new IOException("checkAndDelete request failed with " + code); +754 } +755 } +756 throw new IOException("checkAndDelete request timed out"); +757 } +758 +759 @Override +760 public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, +761 CompareOp compareOp, byte[] value, Delete delete) throws IOException { +762 throw new IOException("checkAndDelete for non-equal comparison not implemented"); +763 } +764 +765 @Override +766 public Result increment(Increment increment) throws IOException { +767 throw new IOException("Increment not supported"); +768 } +769 +770 @Override +771 public Result append(Append append) throws IOException { +772 throw new IOException("Append not supported"); +773 } +774 +775 @Override +776 public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, +777 long amount) throws IOException { +778 throw new IOException("incrementColumnValue not supported"); +779 } +780 +781 @Override +782 public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, +783 long amount, Durability durability) throws IOException { +784 throw new IOException("incrementColumnValue not supported"); +785 } +786 +787 @Override +788 public void batch(List<? extends Row> actions, Object[] results) throws IOException { +789 throw new IOException("batch not supported"); +790 } +791 +792 @Override +793 public <R> void batchCallback(List<? extends Row> actions, Object[] results, +794 Batch.Callback<R> callback) throws IOException, InterruptedException { +795 throw new IOException("batchCallback not supported"); +796 } +797 +798 @Override +799 public CoprocessorRpcChannel coprocessorService(byte[] row) { +800 throw new UnsupportedOperationException("coprocessorService not implemented"); +801 } +802 +803 @Override +804 public <T extends Service, R> Map<byte[], R> coprocessorService(Class<T> service, +805 byte[] startKey, byte[] endKey, Batch.Call<T, R> callable) +806 throws ServiceException, Throwable { +807 throw new UnsupportedOperationException("coprocessorService not implemented"); +808 } +809 +810 @Override +811 public <T extends Service, R> void coprocessorService(Class<T> service, +812 byte[] startKey, byte[] endKey, Batch.Call<T, R> callable, Batch.Callback<R> callback) +813 throws ServiceException, Throwable { +814 throw new UnsupportedOperationException("coprocessorService not implemented"); +815 } +816 +817 @Override +818 public void mutateRow(RowMutations rm) throws IOException { +819 throw new IOException("atomicMutation not supported"); +820 } +821 +822 @Override +823 public long getWriteBufferSize() { +824 throw new UnsupportedOperationException("getWriteBufferSize not implemented"); +825 } +826 +827 @Override +828 public void setWriteBufferSize(long writeBufferSize) throws IOException { +829 throw new IOException("setWriteBufferSize not supported"); +830 } +831 +832 @Override +833 public <R extends Message> Map<byte[], R> batchCoprocessorService( +834 Descriptors.MethodDescriptor method, Message request, +835 byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable { +836 throw new UnsupportedOperationException("batchCoprocessorService not implemented"); +837 } +838 +839 @Override +840 public <R extends Message> void batchCoprocessorService( +841 Descriptors.MethodDescriptor method, Message request, +842 byte[] startKey, byte[] endKey, R responsePrototype, Callback<R> callback) +843 throws ServiceException, Throwable { +844 throw new UnsupportedOperationException("batchCoprocessorService not implemented"); +845 } +846 +847 @Override public boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier, +848 CompareOp compareOp, byte[] value, RowMutations rm) throws IOException { +849 throw new UnsupportedOperationException("checkAndMutate not implemented"); +850 } +851 }