You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2014/05/14 02:27:04 UTC
svn commit: r1594423 [3/17] - in /hbase/branches/0.89-fb: ./ bin/
src/main/java/org/apache/hadoop/hbase/rest/
src/main/java/org/apache/hadoop/hbase/rest/client/
src/main/java/org/apache/hadoop/hbase/rest/metrics/
src/main/java/org/apache/hadoop/hbase/r...
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java Wed May 14 00:26:57 2014
@@ -1,458 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.client;
-
-import java.io.IOException;
-
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.URI;
-import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.HeadMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.params.HttpClientParams;
-import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * A wrapper around HttpClient which provides some useful function and
- * semantics for interacting with the REST gateway.
- */
-public class Client {
- public static final Header[] EMPTY_HEADER_ARRAY = new Header[0];
-
- private static final Log LOG = LogFactory.getLog(Client.class);
-
- private HttpClient httpClient;
- private Cluster cluster;
-
- /**
- * Default Constructor
- */
- public Client() {
- this(null);
- }
-
- /**
- * Constructor
- * @param cluster the cluster definition
- */
- public Client(Cluster cluster) {
- this.cluster = cluster;
- MultiThreadedHttpConnectionManager manager =
- new MultiThreadedHttpConnectionManager();
- HttpConnectionManagerParams managerParams = manager.getParams();
- managerParams.setConnectionTimeout(2000); // 2 s
- managerParams.setDefaultMaxConnectionsPerHost(10);
- managerParams.setMaxTotalConnections(100);
- this.httpClient = new HttpClient(manager);
- HttpClientParams clientParams = httpClient.getParams();
- clientParams.setVersion(HttpVersion.HTTP_1_1);
- }
-
- /**
- * Shut down the client. Close any open persistent connections.
- */
- public void shutdown() {
- MultiThreadedHttpConnectionManager manager =
- (MultiThreadedHttpConnectionManager) httpClient.getHttpConnectionManager();
- manager.shutdown();
- }
-
- /**
- * Execute a transaction method given only the path. Will select at random
- * one of the members of the supplied cluster definition and iterate through
- * the list until a transaction can be successfully completed. The
- * definition of success here is a complete HTTP transaction, irrespective
- * of result code.
- * @param cluster the cluster definition
- * @param method the transaction method
- * @param headers HTTP header values to send
- * @param path the path
- * @return the HTTP response code
- * @throws IOException
- */
- @SuppressWarnings("deprecation")
- public int executePathOnly(Cluster cluster, HttpMethod method,
- Header[] headers, String path) throws IOException {
- IOException lastException;
- if (cluster.nodes.size() < 1) {
- throw new IOException("Cluster is empty");
- }
- int start = (int)Math.round((cluster.nodes.size() - 1) * Math.random());
- int i = start;
- do {
- cluster.lastHost = cluster.nodes.get(i);
- try {
- StringBuilder sb = new StringBuilder();
- sb.append("http://");
- sb.append(cluster.lastHost);
- sb.append(path);
- URI uri = new URI(sb.toString());
- return executeURI(method, headers, uri.toString());
- } catch (IOException e) {
- lastException = e;
- }
- } while (++i != start && i < cluster.nodes.size());
- throw lastException;
- }
-
- /**
- * Execute a transaction method given a complete URI.
- * @param method the transaction method
- * @param headers HTTP header values to send
- * @param uri the URI
- * @return the HTTP response code
- * @throws IOException
- */
- @SuppressWarnings("deprecation")
- public int executeURI(HttpMethod method, Header[] headers, String uri)
- throws IOException {
- method.setURI(new URI(uri));
- if (headers != null) {
- for (Header header: headers) {
- method.addRequestHeader(header);
- }
- }
- long startTime = System.currentTimeMillis();
- int code = httpClient.executeMethod(method);
- long endTime = System.currentTimeMillis();
- if (LOG.isDebugEnabled()) {
- LOG.debug(method.getName() + " " + uri + ": " + code + " " +
- method.getStatusText() + " in " + (endTime - startTime) + " ms");
- }
- return code;
- }
-
- /**
- * Execute a transaction method. Will call either <tt>executePathOnly</tt>
- * or <tt>executeURI</tt> depending on whether a path only is supplied in
- * 'path', or if a complete URI is passed instead, respectively.
- * @param cluster the cluster definition
- * @param method the HTTP method
- * @param headers HTTP header values to send
- * @param path the path or URI
- * @return the HTTP response code
- * @throws IOException
- */
- public int execute(Cluster cluster, HttpMethod method, Header[] headers,
- String path) throws IOException {
- if (path.startsWith("/")) {
- return executePathOnly(cluster, method, headers, path);
- }
- return executeURI(method, headers, path);
- }
-
- /**
- * @return the cluster definition
- */
- public Cluster getCluster() {
- return cluster;
- }
-
- /**
- * @param cluster the cluster definition
- */
- public void setCluster(Cluster cluster) {
- this.cluster = cluster;
- }
-
- /**
- * Send a HEAD request
- * @param path the path or URI
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response head(String path) throws IOException {
- return head(cluster, path, null);
- }
-
- /**
- * Send a HEAD request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @param headers the HTTP headers to include in the request
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response head(Cluster cluster, String path, Header[] headers)
- throws IOException {
- HeadMethod method = new HeadMethod();
- try {
- int code = execute(cluster, method, null, path);
- headers = method.getResponseHeaders();
- return new Response(code, headers, null);
- } finally {
- method.releaseConnection();
- }
- }
-
- /**
- * Send a GET request
- * @param path the path or URI
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response get(String path) throws IOException {
- return get(cluster, path);
- }
-
- /**
- * Send a GET request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response get(Cluster cluster, String path) throws IOException {
- return get(cluster, path, EMPTY_HEADER_ARRAY);
- }
-
- /**
- * Send a GET request
- * @param path the path or URI
- * @param accept Accept header value
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response get(String path, String accept) throws IOException {
- return get(cluster, path, accept);
- }
-
- /**
- * Send a GET request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @param accept Accept header value
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response get(Cluster cluster, String path, String accept)
- throws IOException {
- Header[] headers = new Header[1];
- headers[0] = new Header("Accept", accept);
- return get(cluster, path, headers);
- }
-
- /**
- * Send a GET request
- * @param path the path or URI
- * @param headers the HTTP headers to include in the request,
- * <tt>Accept</tt> must be supplied
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response get(String path, Header[] headers) throws IOException {
- return get(cluster, path, headers);
- }
-
- /**
- * Send a GET request
- * @param c the cluster definition
- * @param path the path or URI
- * @param headers the HTTP headers to include in the request
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response get(Cluster c, String path, Header[] headers)
- throws IOException {
- GetMethod method = new GetMethod();
- try {
- int code = execute(c, method, headers, path);
- headers = method.getResponseHeaders();
- byte[] body = method.getResponseBody();
- return new Response(code, headers, body);
- } finally {
- method.releaseConnection();
- }
- }
-
- /**
- * Send a PUT request
- * @param path the path or URI
- * @param contentType the content MIME type
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response put(String path, String contentType, byte[] content)
- throws IOException {
- return put(cluster, path, contentType, content);
- }
-
- /**
- * Send a PUT request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @param contentType the content MIME type
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response put(Cluster cluster, String path, String contentType,
- byte[] content) throws IOException {
- Header[] headers = new Header[1];
- headers[0] = new Header("Content-Type", contentType);
- return put(cluster, path, headers, content);
- }
-
- /**
- * Send a PUT request
- * @param path the path or URI
- * @param headers the HTTP headers to include, <tt>Content-Type</tt> must be
- * supplied
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response put(String path, Header[] headers, byte[] content)
- throws IOException {
- return put(cluster, path, headers, content);
- }
-
- /**
- * Send a PUT request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @param headers the HTTP headers to include, <tt>Content-Type</tt> must be
- * supplied
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response put(Cluster cluster, String path, Header[] headers,
- byte[] content) throws IOException {
- PutMethod method = new PutMethod();
- try {
- method.setRequestEntity(new ByteArrayRequestEntity(content));
- int code = execute(cluster, method, headers, path);
- headers = method.getResponseHeaders();
- content = method.getResponseBody();
- return new Response(code, headers, content);
- } finally {
- method.releaseConnection();
- }
- }
-
- /**
- * Send a POST request
- * @param path the path or URI
- * @param contentType the content MIME type
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response post(String path, String contentType, byte[] content)
- throws IOException {
- return post(cluster, path, contentType, content);
- }
-
- /**
- * Send a POST request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @param contentType the content MIME type
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response post(Cluster cluster, String path, String contentType,
- byte[] content) throws IOException {
- Header[] headers = new Header[1];
- headers[0] = new Header("Content-Type", contentType);
- return post(cluster, path, headers, content);
- }
-
- /**
- * Send a POST request
- * @param path the path or URI
- * @param headers the HTTP headers to include, <tt>Content-Type</tt> must be
- * supplied
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response post(String path, Header[] headers, byte[] content)
- throws IOException {
- return post(cluster, path, headers, content);
- }
-
- /**
- * Send a POST request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @param headers the HTTP headers to include, <tt>Content-Type</tt> must be
- * supplied
- * @param content the content bytes
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response post(Cluster cluster, String path, Header[] headers,
- byte[] content) throws IOException {
- PostMethod method = new PostMethod();
- try {
- method.setRequestEntity(new ByteArrayRequestEntity(content));
- int code = execute(cluster, method, headers, path);
- headers = method.getResponseHeaders();
- content = method.getResponseBody();
- return new Response(code, headers, content);
- } finally {
- method.releaseConnection();
- }
- }
-
- /**
- * Send a DELETE request
- * @param path the path or URI
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response delete(String path) throws IOException {
- return delete(cluster, path);
- }
-
- /**
- * Send a DELETE request
- * @param cluster the cluster definition
- * @param path the path or URI
- * @return a Response object with response detail
- * @throws IOException
- */
- public Response delete(Cluster cluster, String path) throws IOException {
- DeleteMethod method = new DeleteMethod();
- try {
- int code = execute(cluster, method, null, path);
- Header[] headers = method.getResponseHeaders();
- byte[] content = method.getResponseBody();
- return new Response(code, headers, content);
- } finally {
- method.releaseConnection();
- }
- }
-
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Cluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Cluster.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Cluster.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Cluster.java Wed May 14 00:26:57 2014
@@ -1,99 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.client;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A list of 'host:port' addresses of HTTP servers operating as a single
- * entity, for example multiple redundant web service gateways.
- */
-public class Cluster {
- protected List<String> nodes =
- Collections.synchronizedList(new ArrayList<String>());
- protected String lastHost;
-
- /**
- * Constructor
- */
- public Cluster() {}
-
- /**
- * Constructor
- * @param nodes a list of service locations, in 'host:port' format
- */
- public Cluster(List<String> nodes) {
- nodes.addAll(nodes);
- }
-
- /**
- * @return true if no locations have been added, false otherwise
- */
- public boolean isEmpty() {
- return nodes.isEmpty();
- }
-
- /**
- * Add a node to the cluster
- * @param node the service location in 'host:port' format
- */
- public Cluster add(String node) {
- nodes.add(node);
- return this;
- }
-
- /**
- * Add a node to the cluster
- * @param name host name
- * @param port service port
- */
- public Cluster add(String name, int port) {
- StringBuilder sb = new StringBuilder();
- sb.append(name);
- sb.append(':');
- sb.append(port);
- return add(sb.toString());
- }
-
- /**
- * Remove a node from the cluster
- * @param node the service location in 'host:port' format
- */
- public Cluster remove(String node) {
- nodes.remove(node);
- return this;
- }
-
- /**
- * Remove a node from the cluster
- * @param name host name
- * @param port service port
- */
- public Cluster remove(String name, int port) {
- StringBuilder sb = new StringBuilder();
- sb.append(name);
- sb.append(':');
- sb.append(port);
- return remove(sb.toString());
- }
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteAdmin.java Wed May 14 00:26:57 2014
@@ -1,188 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.client;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.rest.Constants;
-import org.apache.hadoop.hbase.rest.model.TableSchemaModel;
-import org.apache.hadoop.hbase.util.Bytes;
-
-public class RemoteAdmin {
-
- final Client client;
- final Configuration conf;
- final String accessToken;
- final int maxRetries;
- final long sleepTime;
-
- /**
- * Constructor
- * @param client
- * @param conf
- */
- public RemoteAdmin(Client client, Configuration conf) {
- this(client, conf, null);
- }
-
- /**
- * Constructor
- * @param client
- * @param conf
- * @param accessToken
- */
- public RemoteAdmin(Client client, Configuration conf, String accessToken) {
- this.client = client;
- this.conf = conf;
- this.accessToken = accessToken;
- this.maxRetries = conf.getInt("hbase.rest.client.max.retries", 10);
- this.sleepTime = conf.getLong("hbase.rest.client.sleep", 1000);
- }
-
- /**
- * @param tableName name of table to check
- * @return true if all regions of the table are available
- * @throws IOException if a remote or network exception occurs
- */
- public boolean isTableAvailable(String tableName) throws IOException {
- return isTableAvailable(Bytes.toBytes(tableName));
- }
-
- /**
- * @param tableName name of table to check
- * @return true if all regions of the table are available
- * @throws IOException if a remote or network exception occurs
- */
- public boolean isTableAvailable(byte[] tableName) throws IOException {
- StringBuilder sb = new StringBuilder();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(tableName));
- sb.append('/');
- sb.append("exists");
- int code = 0;
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.get(sb.toString());
- code = response.getCode();
- switch (code) {
- case 200:
- return true;
- case 404:
- return false;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("exists request returned " + code);
- }
- }
- throw new IOException("exists request timed out");
- }
-
- /**
- * Creates a new table.
- * @param desc table descriptor for table
- * @throws IOException if a remote or network exception occurs
- */
- public void createTable(HTableDescriptor desc)
- throws IOException {
- TableSchemaModel model = new TableSchemaModel(desc);
- StringBuilder sb = new StringBuilder();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(desc.getName()));
- sb.append('/');
- sb.append("schema");
- int code = 0;
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
- model.createProtobufOutput());
- code = response.getCode();
- switch (code) {
- case 201:
- return;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("create request returned " + code);
- }
- }
- throw new IOException("create request timed out");
- }
-
- /**
- * Deletes a table.
- * @param tableName name of table to delete
- * @throws IOException if a remote or network exception occurs
- */
- public void deleteTable(final String tableName) throws IOException {
- deleteTable(Bytes.toBytes(tableName));
- }
-
- /**
- * Deletes a table.
- * @param tableName name of table to delete
- * @throws IOException if a remote or network exception occurs
- */
- public void deleteTable(final byte [] tableName) throws IOException {
- StringBuilder sb = new StringBuilder();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(tableName));
- sb.append('/');
- sb.append("schema");
- int code = 0;
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.delete(sb.toString());
- code = response.getCode();
- switch (code) {
- case 200:
- return;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("delete request returned " + code);
- }
- }
- throw new IOException("delete request timed out");
- }
-
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java Wed May 14 00:26:57 2014
@@ -1,644 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.client;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionLocation;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.HTableInterface;
-import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.ResultScannerIterator;
-import org.apache.hadoop.hbase.client.RowLock;
-import org.apache.hadoop.hbase.client.RowMutations;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.io.TimeRange;
-import org.apache.hadoop.hbase.rest.Constants;
-import org.apache.hadoop.hbase.rest.model.CellModel;
-import org.apache.hadoop.hbase.rest.model.CellSetModel;
-import org.apache.hadoop.hbase.rest.model.RowModel;
-import org.apache.hadoop.hbase.rest.model.ScannerModel;
-import org.apache.hadoop.hbase.rest.model.TableSchemaModel;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.util.StringUtils;
-
-/**
- * HTable interface to remote tables accessed via REST gateway
- */
-public class RemoteHTable implements HTableInterface {
-
- private static final Log LOG = LogFactory.getLog(RemoteHTable.class);
-
- final Client client;
- final Configuration conf;
- final byte[] name;
- final String accessToken;
- final int maxRetries;
- final long sleepTime;
-
- @SuppressWarnings("unchecked")
- protected String buildRowSpec(final byte[] row, final Map familyMap,
- final long startTime, final long endTime, final int maxVersions) {
- StringBuffer sb = new StringBuffer();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(name));
- sb.append('/');
- sb.append(Bytes.toStringBinary(row));
- Set families = familyMap.entrySet();
- if (families != null) {
- Iterator i = familyMap.entrySet().iterator();
- if (i.hasNext()) {
- sb.append('/');
- }
- while (i.hasNext()) {
- Map.Entry e = (Map.Entry)i.next();
- Collection quals = (Collection)e.getValue();
- if (quals != null && !quals.isEmpty()) {
- Iterator ii = quals.iterator();
- while (ii.hasNext()) {
- sb.append(Bytes.toStringBinary((byte[])e.getKey()));
- sb.append(':');
- Object o = ii.next();
- // Puts use byte[] but Deletes use KeyValue
- if (o instanceof byte[]) {
- sb.append(Bytes.toStringBinary((byte[])o));
- } else if (o instanceof KeyValue) {
- sb.append(Bytes.toStringBinary(((KeyValue)o).getQualifier()));
- } else {
- throw new RuntimeException("object type not handled");
- }
- if (ii.hasNext()) {
- sb.append(',');
- }
- }
- } else {
- sb.append(Bytes.toStringBinary((byte[])e.getKey()));
- sb.append(':');
- }
- if (i.hasNext()) {
- sb.append(',');
- }
- }
- }
- if (startTime != 0 && endTime != Long.MAX_VALUE) {
- sb.append('/');
- sb.append(startTime);
- if (startTime != endTime) {
- sb.append(',');
- sb.append(endTime);
- }
- } else if (endTime != Long.MAX_VALUE) {
- sb.append('/');
- sb.append(endTime);
- }
- if (maxVersions > 1) {
- sb.append("?v=");
- sb.append(maxVersions);
- }
- return sb.toString();
- }
-
- protected Result[] buildResultFromModel(final CellSetModel model) {
- List<Result> results = new ArrayList<Result>();
- for (RowModel row: model.getRows()) {
- List<KeyValue> kvs = new ArrayList<KeyValue>();
- for (CellModel cell: row.getCells()) {
- byte[][] split = KeyValue.parseColumn(cell.getColumn());
- byte[] column = split[0];
- byte[] qualifier = split.length > 1 ? split[1] : null;
- kvs.add(new KeyValue(row.getKey(), column, qualifier,
- cell.getTimestamp(), cell.getValue()));
- }
- results.add(new Result(kvs));
- }
- return results.toArray(new Result[results.size()]);
- }
-
- protected CellSetModel buildModelFromPut(Put put) {
- RowModel row = new RowModel(put.getRow());
- long ts = put.getTimeStamp();
- for (List<KeyValue> kvs: put.getFamilyMap().values()) {
- for (KeyValue kv: kvs) {
- row.addCell(new CellModel(kv.getFamily(), kv.getQualifier(),
- ts != HConstants.LATEST_TIMESTAMP ? ts : kv.getTimestamp(),
- kv.getValue()));
- }
- }
- CellSetModel model = new CellSetModel();
- model.addRow(row);
- return model;
- }
-
- /**
- * Constructor
- * @param client
- * @param name
- */
- public RemoteHTable(Client client, String name) {
- this(client, HBaseConfiguration.create(), Bytes.toBytes(name), null);
- }
-
- /**
- * Constructor
- * @param client
- * @param name
- * @param accessToken
- */
- public RemoteHTable(Client client, String name, String accessToken) {
- this(client, HBaseConfiguration.create(), Bytes.toBytes(name), accessToken);
- }
-
- /**
- * Constructor
- * @param client
- * @param conf
- * @param name
- * @param accessToken
- */
- public RemoteHTable(Client client, Configuration conf, String name,
- String accessToken) {
- this(client, conf, Bytes.toBytes(name), accessToken);
- }
-
- /**
- * Constructor
- * @param conf
- */
- public RemoteHTable(Client client, Configuration conf, byte[] name,
- String accessToken) {
- this.client = client;
- this.conf = conf;
- this.name = name;
- this.accessToken = accessToken;
- this.maxRetries = conf.getInt("hbase.rest.client.max.retries", 10);
- this.sleepTime = conf.getLong("hbase.rest.client.sleep", 1000);
- }
-
- @Override
- public byte[] getTableName() {
- return name.clone();
- }
-
- @Override
- public Configuration getConfiguration() {
- return conf;
- }
-
- @Override
- public HTableDescriptor getTableDescriptor() throws IOException {
- StringBuilder sb = new StringBuilder();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(name));
- sb.append('/');
- sb.append("schema");
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.get(sb.toString(), Constants.MIMETYPE_PROTOBUF);
- int code = response.getCode();
- switch (code) {
- case 200:
- TableSchemaModel schema = new TableSchemaModel();
- schema.getObjectFromMessage(response.getBody());
- return schema.getTableDescriptor();
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("schema request returned " + code);
- }
- }
- throw new IOException("schema request timed out");
- }
-
- @Override
- public void close() throws IOException {
- client.shutdown();
- }
-
- @Override
- public Result[] get(List<Get> gets) throws IOException {
- throw new IOException("multi get is not supported here");
- }
-
- @Override
- public Result get(Get get) throws IOException {
- TimeRange range = get.getTimeRange();
- String spec = buildRowSpec(get.getRow(), get.getFamilyMap(),
- range.getMin(), range.getMax(), get.getMaxVersions());
- if (get.getFilter() != null) {
- LOG.warn("filters not supported on gets");
- }
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.get(spec, Constants.MIMETYPE_PROTOBUF);
- int code = response.getCode();
- switch (code) {
- case 200:
- CellSetModel model = new CellSetModel();
- model.getObjectFromMessage(response.getBody());
- Result[] results = buildResultFromModel(model);
- if (results.length > 0) {
- if (results.length > 1) {
- LOG.warn("too many results for get (" + results.length + ")");
- }
- return results[0];
- }
- // fall through
- case 404:
- return new Result();
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("get request returned " + code);
- }
- }
- throw new IOException("get request timed out");
- }
-
- @Override
- public boolean exists(Get get) throws IOException {
- LOG.warn("exists() is really get(), just use get()");
- Result result = get(get);
- return (result != null && !(result.isEmpty()));
- }
-
- @Override
- public void put(Put put) throws IOException {
- CellSetModel model = buildModelFromPut(put);
- StringBuilder sb = new StringBuilder();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(name));
- sb.append('/');
- sb.append(Bytes.toStringBinary(put.getRow()));
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
- model.createProtobufOutput());
- int code = response.getCode();
- switch (code) {
- case 200:
- return;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("put request failed with " + code);
- }
- }
- throw new IOException("put request timed out");
- }
-
- @Override
- public void put(List<Put> puts) throws IOException {
- // this is a trick: The gateway accepts multiple rows in a cell set and
- // ignores the row specification in the URI
-
- // separate puts by row
- TreeMap<byte[],List<KeyValue>> map =
- new TreeMap<byte[],List<KeyValue>>(Bytes.BYTES_COMPARATOR);
- for (Put put: puts) {
- byte[] row = put.getRow();
- List<KeyValue> kvs = map.get(row);
- if (kvs == null) {
- kvs = new ArrayList<KeyValue>();
- map.put(row, kvs);
- }
- for (List<KeyValue> l: put.getFamilyMap().values()) {
- kvs.addAll(l);
- }
- }
-
- // build the cell set
- CellSetModel model = new CellSetModel();
- for (Map.Entry<byte[], List<KeyValue>> e: map.entrySet()) {
- RowModel row = new RowModel(e.getKey());
- for (KeyValue kv: e.getValue()) {
- row.addCell(new CellModel(kv));
- }
- model.addRow(row);
- }
-
- // build path for multiput
- StringBuilder sb = new StringBuilder();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(name));
- sb.append("/$multiput"); // can be any nonexistent row
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
- model.createProtobufOutput());
- int code = response.getCode();
- switch (code) {
- case 200:
- return;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("multiput request failed with " + code);
- }
- }
- throw new IOException("multiput request timed out");
- }
-
- @Override
- public void delete(Delete delete) throws IOException {
- String spec = buildRowSpec(delete.getRow(), delete.getFamilyMap(),
- delete.getTimeStamp(), delete.getTimeStamp(), 1);
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.delete(spec);
- int code = response.getCode();
- switch (code) {
- case 200:
- return;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("delete request failed with " + code);
- }
- }
- throw new IOException("delete request timed out");
- }
-
- @Override
- public void delete(List<Delete> deletes) throws IOException {
- for (Delete delete: deletes) {
- delete(delete);
- }
- }
-
- @Override
- public void flushCommits() throws IOException {
- // no-op
- }
-
- class Scanner implements ResultScanner {
-
- String uri;
- boolean isClosed = false;
-
- public Scanner(Scan scan) throws IOException {
- ScannerModel model;
- try {
- model = ScannerModel.fromScan(scan);
- } catch (Exception e) {
- throw new IOException(e);
- }
- StringBuffer sb = new StringBuffer();
- sb.append('/');
- if (accessToken != null) {
- sb.append(accessToken);
- sb.append('/');
- }
- sb.append(Bytes.toStringBinary(name));
- sb.append('/');
- sb.append("scanner");
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.post(sb.toString(),
- Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
- int code = response.getCode();
- switch (code) {
- case 201:
- uri = response.getLocation();
- return;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("scan request failed with " + code);
- }
- }
- throw new IOException("scan request timed out");
- }
-
- @Override
- public Result[] next(int nbRows) throws IOException {
- StringBuilder sb = new StringBuilder(uri);
- sb.append("?n=");
- sb.append(nbRows);
- for (int i = 0; i < maxRetries; i++) {
- Response response = client.get(sb.toString(),
- Constants.MIMETYPE_PROTOBUF);
- int code = response.getCode();
- switch (code) {
- case 200:
- CellSetModel model = new CellSetModel();
- model.getObjectFromMessage(response.getBody());
- return buildResultFromModel(model);
- case 204:
- case 206:
- return null;
- case 509:
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) { }
- break;
- default:
- throw new IOException("scanner.next request failed with " + code);
- }
- }
- throw new IOException("scanner.next request timed out");
- }
-
- @Override
- public Result next() throws IOException {
- Result[] results = next(1);
- if (results == null || results.length < 1) {
- return null;
- }
- return results[0];
- }
-
- @Override
- public Iterator<Result> iterator() {
- return new ResultScannerIterator(this);
- }
-
- @Override
- public void close() {
- try {
- client.delete(uri);
- } catch (IOException e) {
- LOG.warn(StringUtils.stringifyException(e));
- }
- isClosed = true;
- }
-
- @Override
- public boolean isClosed() {
- return isClosed;
- }
-
- }
-
- @Override
- public ResultScanner getScanner(Scan scan) throws IOException {
- return new Scanner(scan);
- }
-
- @Override
- public ResultScanner getScanner(byte[] family) throws IOException {
- Scan scan = new Scan();
- scan.addFamily(family);
- return new Scanner(scan);
- }
-
- @Override
- public ResultScanner getScanner(byte[] family, byte[] qualifier)
- throws IOException {
- Scan scan = new Scan();
- scan.addColumn(family, qualifier);
- return new Scanner(scan);
- }
-
- @Override
- public boolean isAutoFlush() {
- return true;
- }
-
- @Override
- public Result getRowOrBefore(byte[] row, byte[] family) throws IOException {
- throw new IOException("getRowOrBefore not supported");
- }
-
- @Override
- public RowLock lockRow(byte[] row) throws IOException {
- throw new IOException("lockRow not implemented");
- }
-
- @Override
- public void unlockRow(RowLock rl) throws IOException {
- throw new IOException("unlockRow not implemented");
- }
-
- @Override
- public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
- byte[] value, Put put) throws IOException {
- throw new IOException("checkAndPut not supported");
- }
-
- @Override
- public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
- byte[] value, Delete delete) throws IOException {
- throw new IOException("checkAndDelete not supported");
- }
-
-
- @Override
- public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
- long amount) throws IOException {
- throw new IOException("incrementColumnValue not supported");
- }
-
- @Override
- public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
- long amount, boolean writeToWAL) throws IOException {
- throw new IOException("incrementColumnValue not supported");
- }
-
- @Override
- public void mutateRow(RowMutations arm) throws IOException {
- throw new IOException("atomicMutation not supported");
- }
-
- @Override
- public void mutateRow(List<RowMutations> armList)
- throws IOException {
- throw new IOException("atomicMutation not supported");
- }
-
- @Override
- public void setProfiling(boolean prof) {}
-
- @Override
- public boolean getProfiling() {
- return false;
- }
-
- @Override
- public void setTag (String tag) {}
-
- @Override
- public String getTag () {
- return null;
- }
-
- @Override
- public Result[] batchGet(List<Get> actions) throws IOException {
- // TODO Auto-generated method stub
- throw new IOException("batchGet not supported");
- }
-
- @Override
- public void batchMutate(List<Mutation> actions) throws IOException {
- throw new IOException("batchMutate not supported");
- }
-
- @Override
- public Collection<HRegionLocation> getCachedHRegionLocations(boolean forceRefresh)
- throws IOException {
- throw new IOException("atomicMutation not supported");
- }
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Response.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Response.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Response.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/client/Response.java Wed May 14 00:26:57 2014
@@ -1,122 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.client;
-
-import org.apache.commons.httpclient.Header;
-
-/**
- * The HTTP result code, response headers, and body of a HTTP response.
- */
-public class Response {
- private int code;
- private Header[] headers;
- private byte[] body;
-
- /**
- * Constructor
- * @param code the HTTP response code
- */
- public Response(int code) {
- this(code, null, null);
- }
-
- /**
- * Constructor
- * @param code the HTTP response code
- * @param headers the HTTP response headers
- */
- public Response(int code, Header[] headers) {
- this(code, headers, null);
- }
-
- /**
- * Constructor
- * @param code the HTTP response code
- * @param headers the HTTP response headers
- * @param body the response body, can be null
- */
- public Response(int code, Header[] headers, byte[] body) {
- this.code = code;
- this.headers = headers;
- this.body = body;
- }
-
- /**
- * @return the HTTP response code
- */
- public int getCode() {
- return code;
- }
-
- /**
- * @return the HTTP response headers
- */
- public Header[] getHeaders() {
- return headers;
- }
-
- /**
- * @return the value of the Location header
- */
- public String getLocation() {
- for (Header header: headers) {
- if (header.getName().equals("Location")) {
- return header.getValue();
- }
- }
- return null;
- }
-
- /**
- * @return true if a response body was sent
- */
- public boolean hasBody() {
- return body != null;
- }
-
- /**
- * @return the HTTP response body
- */
- public byte[] getBody() {
- return body;
- }
-
- /**
- * @param code the HTTP response code
- */
- public void setCode(int code) {
- this.code = code;
- }
-
- /**
- * @param headers the HTTP response headers
- */
- public void setHeaders(Header[] headers) {
- this.headers = headers;
- }
-
- /**
- * @param body the response body
- */
- public void setBody(byte[] body) {
- this.body = body;
- }
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTMetrics.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTMetrics.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTMetrics.java Wed May 14 00:26:57 2014
@@ -1,87 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.metrics;
-
-import org.apache.hadoop.hbase.metrics.MetricsRate;
-
-import org.apache.hadoop.metrics.MetricsContext;
-import org.apache.hadoop.metrics.MetricsRecord;
-import org.apache.hadoop.metrics.MetricsUtil;
-import org.apache.hadoop.metrics.Updater;
-import org.apache.hadoop.metrics.jvm.JvmMetrics;
-import org.apache.hadoop.metrics.util.MetricsRegistry;
-
-public class RESTMetrics implements Updater {
- private final MetricsRecord metricsRecord;
- private final MetricsRegistry registry = new MetricsRegistry();
- private final RESTStatistics restStatistics;
-
- private MetricsRate requests = new MetricsRate("requests", registry);
-
- public RESTMetrics() {
- MetricsContext context = MetricsUtil.getContext("rest");
- metricsRecord = MetricsUtil.createRecord(context, "rest");
- String name = Thread.currentThread().getName();
- metricsRecord.setTag("REST", name);
- context.registerUpdater(this);
- JvmMetrics.init("rest", name);
- // expose the MBean for metrics
- restStatistics = new RESTStatistics(registry);
-
- }
-
- public void shutdown() {
- if (restStatistics != null) {
- restStatistics.shutdown();
- }
- }
-
- /**
- * Since this object is a registered updater, this method will be called
- * periodically, e.g. every 5 seconds.
- * @param unused
- */
- public void doUpdates(MetricsContext unused) {
- synchronized (this) {
- requests.pushMetric(metricsRecord);
- }
- this.metricsRecord.update();
- }
-
- public void resetAllMinMax() {
- // Nothing to do
- }
-
- /**
- * @return Count of requests.
- */
- public float getRequests() {
- return requests.getPreviousIntervalValue();
- }
-
- /**
- * @param inc How much to add to requests.
- */
- public void incrementRequests(final int inc) {
- requests.inc(inc);
- }
-
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTStatistics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTStatistics.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTStatistics.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTStatistics.java Wed May 14 00:26:57 2014
@@ -1,44 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.metrics;
-
-import javax.management.ObjectName;
-
-import org.apache.hadoop.hbase.metrics.MetricsMBeanBase;
-
-import org.apache.hadoop.metrics.util.MBeanUtil;
-import org.apache.hadoop.metrics.util.MetricsRegistry;
-
-public class RESTStatistics extends MetricsMBeanBase {
- private final ObjectName mbeanName;
-
- public RESTStatistics(MetricsRegistry registry) {
- super(registry, "restStatistics");
- mbeanName = MBeanUtil.registerMBean("rest", "restStatistics", this);
- }
-
- public void shutdown() {
- if (mbeanName != null) {
- MBeanUtil.unregisterMBean(mbeanName);
- }
- }
-
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellModel.java Wed May 14 00:26:57 2014
@@ -1,198 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlValue;
-
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.rest.ProtobufMessageHandler;
-import org.apache.hadoop.hbase.rest.protobuf.generated.CellMessage.Cell;
-
-import com.google.protobuf.ByteString;
-
-/**
- * Representation of a cell. A cell is a single value associated a column and
- * optional qualifier, and either the timestamp when it was stored or the user-
- * provided timestamp if one was explicitly supplied.
- *
- * <pre>
- * <complexType name="Cell">
- * <sequence>
- * <element name="value" maxOccurs="1" minOccurs="1">
- * <simpleType>
- * <restriction base="base64Binary"/>
- * </simpleType>
- * </element>
- * </sequence>
- * <attribute name="column" type="base64Binary" />
- * <attribute name="timestamp" type="int" />
- * </complexType>
- * </pre>
- */
-@XmlRootElement(name="Cell")
-public class CellModel implements ProtobufMessageHandler, Serializable {
- private static final long serialVersionUID = 1L;
-
- private long timestamp = HConstants.LATEST_TIMESTAMP;
- private byte[] column;
- private byte[] value;
-
- /**
- * Default constructor
- */
- public CellModel() {}
-
- /**
- * Constructor
- * @param column
- * @param value
- */
- public CellModel(byte[] column, byte[] value) {
- this(column, HConstants.LATEST_TIMESTAMP, value);
- }
-
- /**
- * Constructor
- * @param column
- * @param qualifier
- * @param value
- */
- public CellModel(byte[] column, byte[] qualifier, byte[] value) {
- this(column, qualifier, HConstants.LATEST_TIMESTAMP, value);
- }
-
- /**
- * Constructor from KeyValue
- * @param kv
- */
- public CellModel(KeyValue kv) {
- this(kv.getFamily(), kv.getQualifier(), kv.getTimestamp(), kv.getValue());
- }
-
- /**
- * Constructor
- * @param column
- * @param timestamp
- * @param value
- */
- public CellModel(byte[] column, long timestamp, byte[] value) {
- this.column = column;
- this.timestamp = timestamp;
- this.value = value;
- }
-
- /**
- * Constructor
- * @param column
- * @param qualifier
- * @param timestamp
- * @param value
- */
- public CellModel(byte[] column, byte[] qualifier, long timestamp,
- byte[] value) {
- this.column = KeyValue.makeColumn(column, qualifier);
- this.timestamp = timestamp;
- this.value = value;
- }
-
- /**
- * @return the column
- */
- @XmlAttribute
- public byte[] getColumn() {
- return column;
- }
-
- /**
- * @param column the column to set
- */
- public void setColumn(byte[] column) {
- this.column = column;
- }
-
- /**
- * @return true if the timestamp property has been specified by the
- * user
- */
- public boolean hasUserTimestamp() {
- return timestamp != HConstants.LATEST_TIMESTAMP;
- }
-
- /**
- * @return the timestamp
- */
- @XmlAttribute
- public long getTimestamp() {
- return timestamp;
- }
-
- /**
- * @param timestamp the timestamp to set
- */
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * @return the value
- */
- @XmlValue
- public byte[] getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(byte[] value) {
- this.value = value;
- }
-
- @Override
- public byte[] createProtobufOutput() {
- Cell.Builder builder = Cell.newBuilder();
- builder.setColumn(ByteString.copyFrom(getColumn()));
- builder.setData(ByteString.copyFrom(getValue()));
- if (hasUserTimestamp()) {
- builder.setTimestamp(getTimestamp());
- }
- return builder.build().toByteArray();
- }
-
- @Override
- public ProtobufMessageHandler getObjectFromMessage(byte[] message)
- throws IOException {
- Cell.Builder builder = Cell.newBuilder();
- builder.mergeFrom(message);
- setColumn(builder.getColumn().toByteArray());
- setValue(builder.getData().toByteArray());
- if (builder.hasTimestamp()) {
- setTimestamp(builder.getTimestamp());
- }
- return this;
- }
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/CellSetModel.java Wed May 14 00:26:57 2014
@@ -1,149 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlElement;
-
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.rest.ProtobufMessageHandler;
-import org.apache.hadoop.hbase.rest.protobuf.generated.CellMessage.Cell;
-import org.apache.hadoop.hbase.rest.protobuf.generated.CellSetMessage.CellSet;
-
-import com.google.protobuf.ByteString;
-
-/**
- * Representation of a grouping of cells. May contain cells from more than
- * one row. Encapsulates RowModel and CellModel models.
- *
- * <pre>
- * <complexType name="CellSet">
- * <sequence>
- * <element name="row" type="tns:Row" maxOccurs="unbounded"
- * minOccurs="1"></element>
- * </sequence>
- * </complexType>
- *
- * <complexType name="Row">
- * <sequence>
- * <element name="key" type="base64Binary"></element>
- * <element name="cell" type="tns:Cell"
- * maxOccurs="unbounded" minOccurs="1"></element>
- * </sequence>
- * </complexType>
- *
- * <complexType name="Cell">
- * <sequence>
- * <element name="value" maxOccurs="1" minOccurs="1">
- * <simpleType>
- * <restriction base="base64Binary"/>
- * </simpleType>
- * </element>
- * </sequence>
- * <attribute name="column" type="base64Binary" />
- * <attribute name="timestamp" type="int" />
- * </complexType>
- * </pre>
- */
-@XmlRootElement(name="CellSet")
-public class CellSetModel implements Serializable, ProtobufMessageHandler {
-
- private static final long serialVersionUID = 1L;
-
- private List<RowModel> rows;
-
- /**
- * Constructor
- */
- public CellSetModel() {
- this.rows = new ArrayList<RowModel>();
- }
-
- /**
- * @param rows the rows
- */
- public CellSetModel(List<RowModel> rows) {
- super();
- this.rows = rows;
- }
-
- /**
- * Add a row to this cell set
- * @param row the row
- */
- public void addRow(RowModel row) {
- rows.add(row);
- }
-
- /**
- * @return the rows
- */
- @XmlElement(name="Row")
- public List<RowModel> getRows() {
- return rows;
- }
-
- @Override
- public byte[] createProtobufOutput() {
- CellSet.Builder builder = CellSet.newBuilder();
- for (RowModel row: getRows()) {
- CellSet.Row.Builder rowBuilder = CellSet.Row.newBuilder();
- rowBuilder.setKey(ByteString.copyFrom(row.getKey()));
- for (CellModel cell: row.getCells()) {
- Cell.Builder cellBuilder = Cell.newBuilder();
- cellBuilder.setColumn(ByteString.copyFrom(cell.getColumn()));
- cellBuilder.setData(ByteString.copyFrom(cell.getValue()));
- if (cell.hasUserTimestamp()) {
- cellBuilder.setTimestamp(cell.getTimestamp());
- }
- rowBuilder.addValues(cellBuilder);
- }
- builder.addRows(rowBuilder);
- }
- return builder.build().toByteArray();
- }
-
- @Override
- public ProtobufMessageHandler getObjectFromMessage(byte[] message)
- throws IOException {
- CellSet.Builder builder = CellSet.newBuilder();
- builder.mergeFrom(message);
- for (CellSet.Row row: builder.getRowsList()) {
- RowModel rowModel = new RowModel(row.getKey().toByteArray());
- for (Cell cell: row.getValuesList()) {
- long timestamp = HConstants.LATEST_TIMESTAMP;
- if (cell.hasTimestamp()) {
- timestamp = cell.getTimestamp();
- }
- rowModel.addCell(
- new CellModel(cell.getColumn().toByteArray(), timestamp,
- cell.getData().toByteArray()));
- }
- addRow(rowModel);
- }
- return this;
- }
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/ColumnSchemaModel.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/ColumnSchemaModel.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/ColumnSchemaModel.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/ColumnSchemaModel.java Wed May 14 00:26:57 2014
@@ -1,236 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.bind.annotation.XmlAnyAttribute;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.namespace.QName;
-
-import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HConstants;
-
-/**
- * Representation of a column family schema.
- *
- * <pre>
- * <complexType name="ColumnSchema">
- * <attribute name="name" type="string"></attribute>
- * <anyAttribute></anyAttribute>
- * </complexType>
- * </pre>
- */
-@XmlRootElement(name="ColumnSchema")
-public class ColumnSchemaModel implements Serializable {
- private static final long serialVersionUID = 1L;
- private static QName BLOCKCACHE = new QName(HColumnDescriptor.BLOCKCACHE);
- private static QName BLOCKSIZE = new QName(HColumnDescriptor.BLOCKSIZE);
- private static QName BLOOMFILTER = new QName(HColumnDescriptor.BLOOMFILTER);
- private static QName COMPRESSION = new QName(HColumnDescriptor.COMPRESSION);
- private static QName IN_MEMORY = new QName(HConstants.IN_MEMORY);
- private static QName TTL = new QName(HColumnDescriptor.TTL);
- private static QName VERSIONS = new QName(HConstants.VERSIONS);
-
- private String name;
- private Map<QName,Object> attrs = new HashMap<QName,Object>();
-
- /**
- * Default constructor
- */
- public ColumnSchemaModel() {}
-
- /**
- * Add an attribute to the column family schema
- * @param name the attribute name
- * @param value the attribute value
- */
- public void addAttribute(String name, Object value) {
- attrs.put(new QName(name), value);
- }
-
- /**
- * @param name the attribute name
- * @return the attribute value
- */
- public String getAttribute(String name) {
- Object o = attrs.get(new QName(name));
- return o != null ? o.toString(): null;
- }
-
- /**
- * @return the column name
- */
- @XmlAttribute
- public String getName() {
- return name;
- }
-
- /**
- * @return the map for holding unspecified (user) attributes
- */
- @XmlAnyAttribute
- public Map<QName,Object> getAny() {
- return attrs;
- }
-
- /**
- * @param name the table name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("{ NAME => '");
- sb.append(name);
- sb.append('\'');
- for (Map.Entry<QName,Object> e: attrs.entrySet()) {
- sb.append(", ");
- sb.append(e.getKey().getLocalPart());
- sb.append(" => '");
- sb.append(e.getValue().toString());
- sb.append('\'');
- }
- sb.append(" }");
- return sb.toString();
- }
-
- // getters and setters for common schema attributes
-
- // cannot be standard bean type getters and setters, otherwise this would
- // confuse JAXB
-
- /**
- * @return true if the BLOCKCACHE attribute is present and true
- */
- public boolean __getBlockcache() {
- Object o = attrs.get(BLOCKCACHE);
- return o != null ?
- Boolean.valueOf(o.toString()) : HColumnDescriptor.DEFAULT_BLOCKCACHE;
- }
-
- /**
- * @return the value of the BLOCKSIZE attribute or its default if it is unset
- */
- public int __getBlocksize() {
- Object o = attrs.get(BLOCKSIZE);
- return o != null ?
- Integer.valueOf(o.toString()) : HColumnDescriptor.DEFAULT_BLOCKSIZE;
- }
-
- /**
- * @return the value of the BLOOMFILTER attribute or its default if unset
- */
- public String __getBloomfilter() {
- Object o = attrs.get(BLOOMFILTER);
- return o != null ? o.toString() : HColumnDescriptor.DEFAULT_BLOOMFILTER;
- }
-
- /**
- * @return the value of the COMPRESSION attribute or its default if unset
- */
- public String __getCompression() {
- Object o = attrs.get(COMPRESSION);
- return o != null ? o.toString() : HColumnDescriptor.DEFAULT_COMPRESSION;
- }
-
- /**
- * @return true if the IN_MEMORY attribute is present and true
- */
- public boolean __getInMemory() {
- Object o = attrs.get(IN_MEMORY);
- return o != null ?
- Boolean.valueOf(o.toString()) : HColumnDescriptor.DEFAULT_IN_MEMORY;
- }
-
- /**
- * @return the value of the TTL attribute or its default if it is unset
- */
- public int __getTTL() {
- Object o = attrs.get(TTL);
- return o != null ?
- Integer.valueOf(o.toString()) : HColumnDescriptor.DEFAULT_TTL;
- }
-
- /**
- * @return the value of the VERSIONS attribute or its default if it is unset
- */
- public int __getVersions() {
- Object o = attrs.get(VERSIONS);
- return o != null ?
- Integer.valueOf(o.toString()) : HColumnDescriptor.DEFAULT_VERSIONS;
- }
-
- /**
- * @param value the desired value of the BLOCKSIZE attribute
- */
- public void __setBlocksize(int value) {
- attrs.put(BLOCKSIZE, Integer.toString(value));
- }
-
- /**
- * @param value the desired value of the BLOCKCACHE attribute
- */
- public void __setBlockcache(boolean value) {
- attrs.put(BLOCKCACHE, Boolean.toString(value));
- }
-
- public void __setBloomfilter(String value) {
- attrs.put(BLOOMFILTER, value);
- }
-
- /**
- * @param value the desired value of the COMPRESSION attribute
- */
- public void __setCompression(String value) {
- attrs.put(COMPRESSION, value);
- }
-
- /**
- * @param value the desired value of the IN_MEMORY attribute
- */
- public void __setInMemory(boolean value) {
- attrs.put(IN_MEMORY, Boolean.toString(value));
- }
-
- /**
- * @param value the desired value of the TTL attribute
- */
- public void __setTTL(int value) {
- attrs.put(TTL, Integer.toString(value));
- }
-
- /**
- * @param value the desired value of the VERSIONS attribute
- */
- public void __setVersions(int value) {
- attrs.put(VERSIONS, Integer.toString(value));
- }
-}
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/RowModel.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/RowModel.java?rev=1594423&r1=1594422&r2=1594423&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/RowModel.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/rest/model/RowModel.java Wed May 14 00:26:57 2014
@@ -1,142 +0,0 @@
-/*
- * Copyright 2010 The Apache Software Foundation
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.hadoop.hbase.rest.ProtobufMessageHandler;
-
-/**
- * Representation of a row. A row is a related set of cells, grouped by common
- * row key. RowModels do not appear in results by themselves. They are always
- * encapsulated within CellSetModels.
- *
- * <pre>
- * <complexType name="Row">
- * <sequence>
- * <element name="key" type="base64Binary"></element>
- * <element name="cell" type="tns:Cell"
- * maxOccurs="unbounded" minOccurs="1"></element>
- * </sequence>
- * </complexType>
- * </pre>
- */
-@XmlRootElement(name="Row")
-public class RowModel implements ProtobufMessageHandler, Serializable {
- private static final long serialVersionUID = 1L;
-
- private byte[] key;
- private List<CellModel> cells = new ArrayList<CellModel>();
-
- /**
- * Default constructor
- */
- public RowModel() { }
-
- /**
- * Constructor
- * @param key the row key
- */
- public RowModel(final String key) {
- this(key.getBytes());
- }
-
- /**
- * Constructor
- * @param key the row key
- */
- public RowModel(final byte[] key) {
- this.key = key;
- cells = new ArrayList<CellModel>();
- }
-
- /**
- * Constructor
- * @param key the row key
- * @param cells the cells
- */
- public RowModel(final String key, final List<CellModel> cells) {
- this(key.getBytes(), cells);
- }
-
- /**
- * Constructor
- * @param key the row key
- * @param cells the cells
- */
- public RowModel(final byte[] key, final List<CellModel> cells) {
- this.key = key;
- this.cells = cells;
- }
-
- /**
- * Adds a cell to the list of cells for this row
- * @param cell the cell
- */
- public void addCell(CellModel cell) {
- cells.add(cell);
- }
-
- /**
- * @return the row key
- */
- @XmlAttribute
- public byte[] getKey() {
- return key;
- }
-
- /**
- * @param key the row key
- */
- public void setKey(byte[] key) {
- this.key = key;
- }
-
- /**
- * @return the cells
- */
- @XmlElement(name="Cell")
- public List<CellModel> getCells() {
- return cells;
- }
-
- @Override
- public byte[] createProtobufOutput() {
- // there is no standalone row protobuf message
- throw new UnsupportedOperationException(
- "no protobuf equivalent to RowModel");
- }
-
- @Override
- public ProtobufMessageHandler getObjectFromMessage(byte[] message)
- throws IOException {
- // there is no standalone row protobuf message
- throw new UnsupportedOperationException(
- "no protobuf equivalent to RowModel");
- }
-}