diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml
index 02dad902e15..75320dabd84 100644
--- a/hbase-rest/pom.xml
+++ b/hbase-rest/pom.xml
@@ -366,6 +366,8 @@
+ * /namespaces/{namespace} GET: get namespace properties. + * /namespaces/{namespace} POST: create namespace. + * /namespaces/{namespace} PUT: alter namespace. + * /namespaces/{namespace} DELETE: drop namespace. + * /namespaces/{namespace}/tables GET: list namespace's tables. + *
+ */ +@InterfaceAudience.Private +public class NamespacesInstanceResource extends ResourceBase { + + private static final Log LOG = LogFactory.getLog(NamespacesInstanceResource.class); + String namespace; + boolean queryTables = false; + + /** + * Constructor for standard NamespaceInstanceResource. + * @throws IOException + */ + public NamespacesInstanceResource(String namespace) throws IOException { + this(namespace, false); + } + + /** + * Constructor for querying namespace table list via NamespaceInstanceResource. + * @throws IOException + */ + public NamespacesInstanceResource(String namespace, boolean queryTables) throws IOException { + super(); + this.namespace = namespace; + this.queryTables = queryTables; + } + + /** + * Build a response for GET namespace description or GET list of namespace tables. + * @param context servlet context + * @param uriInfo (JAX-RS context variable) request URL + * @return A response containing NamespacesInstanceModel for a namespace descriptions and + * TableListModel for a list of namespace tables. + */ + @GET + @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, + MIMETYPE_PROTOBUF_IETF}) + public Response get(final @Context ServletContext context, + final @Context UriInfo uriInfo) { + if (LOG.isDebugEnabled()) { + LOG.debug("GET " + uriInfo.getAbsolutePath()); + } + servlet.getMetrics().incrementRequests(1); + + // Respond to list of namespace tables requests. + if(queryTables){ + TableListModel tableModel = new TableListModel(); + try{ + HTableDescriptor[] tables = servlet.getAdmin().listTableDescriptorsByNamespace(namespace); + for(int i = 0; i < tables.length; i++){ + tableModel.add(new TableModel(tables[i].getTableName().getQualifierAsString())); + } + + servlet.getMetrics().incrementSucessfulGetRequests(1); + return Response.ok(tableModel).build(); + }catch(IOException e) { + servlet.getMetrics().incrementFailedGetRequests(1); + throw new RuntimeException("Cannot retrieve table list for '" + namespace + "'."); + } + } + + // Respond to namespace description requests. + try { + NamespacesInstanceModel rowModel = + new NamespacesInstanceModel(servlet.getAdmin(), namespace); + servlet.getMetrics().incrementSucessfulGetRequests(1); + return Response.ok(rowModel).build(); + } catch (IOException e) { + servlet.getMetrics().incrementFailedGetRequests(1); + throw new RuntimeException("Cannot retrieve info for '" + namespace + "'."); + } + } + + /** + * Build a response for PUT alter namespace with properties specified. + * @param model properties used for alter. + * @param uriInfo (JAX-RS context variable) request URL + * @return response code. + */ + @PUT + @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, + MIMETYPE_PROTOBUF_IETF}) + public Response put(final NamespacesInstanceModel model, final @Context UriInfo uriInfo) { + if (LOG.isDebugEnabled()) { + LOG.debug("PUT " + uriInfo.getAbsolutePath()); + } + servlet.getMetrics().incrementRequests(1); + return processUpdate(model, true, uriInfo); + } + + /** + * Build a response for PUT alter namespace with no properties specified. + * @param message value not used. + * @param headers value not used. + * @return response code. + */ + @PUT + public Response putNoBody(final byte[] message, + final @Context UriInfo uriInfo, final @Context HttpHeaders headers) { + if (LOG.isDebugEnabled()) { + LOG.debug("PUT " + uriInfo.getAbsolutePath()); + } + servlet.getMetrics().incrementRequests(1); + try{ + NamespacesInstanceModel model = new NamespacesInstanceModel(namespace); + return processUpdate(model, true, uriInfo); + }catch(IOException ioe){ + servlet.getMetrics().incrementFailedPutRequests(1); + throw new RuntimeException("Cannot retrieve info for '" + namespace + "'."); + } + } + + /** + * Build a response for POST create namespace with properties specified. + * @param model properties used for create. + * @param uriInfo (JAX-RS context variable) request URL + * @return response code. + */ + @POST + @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, + MIMETYPE_PROTOBUF_IETF}) + public Response post(final NamespacesInstanceModel model, + final @Context UriInfo uriInfo) { + + if (LOG.isDebugEnabled()) { + LOG.debug("POST " + uriInfo.getAbsolutePath()); + } + servlet.getMetrics().incrementRequests(1); + return processUpdate(model, false, uriInfo); + } + + /** + * Build a response for POST create namespace with no properties specified. + * @param message value not used. + * @param headers value not used. + * @return response code. + */ + @POST + public Response postNoBody(final byte[] message, + final @Context UriInfo uriInfo, final @Context HttpHeaders headers) { + if (LOG.isDebugEnabled()) { + LOG.debug("POST " + uriInfo.getAbsolutePath()); + } + servlet.getMetrics().incrementRequests(1); + try{ + NamespacesInstanceModel model = new NamespacesInstanceModel(namespace); + return processUpdate(model, false, uriInfo); + }catch(IOException ioe){ + servlet.getMetrics().incrementFailedPutRequests(1); + throw new RuntimeException("Cannot retrieve info for '" + namespace + "'."); + } + } + + // Check that POST or PUT is valid and then update namespace. + private Response processUpdate(final NamespacesInstanceModel model, final boolean updateExisting, + final UriInfo uriInfo) { + if (servlet.isReadOnly()) { + servlet.getMetrics().incrementFailedPutRequests(1); + return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT) + .entity("Forbidden" + CRLF).build(); + } + + Admin admin = null; + boolean namespaceExists = false; + try { + admin = servlet.getAdmin(); + namespaceExists = doesNamespaceExist(admin, namespace); + }catch (IOException e) { + servlet.getMetrics().incrementFailedPutRequests(1); + return processException(e); + } + + // Do not allow creation if namespace already exists. + if(!updateExisting && namespaceExists){ + servlet.getMetrics().incrementFailedPutRequests(1); + return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT). + entity("Namespace '" + namespace + "' already exists. Use REST PUT " + + "to alter the existing namespace.").build(); + } + + // Do not allow altering if namespace does not exist. + if (updateExisting && !namespaceExists){ + servlet.getMetrics().incrementFailedPutRequests(1); + return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT). + entity("Namespace '" + namespace + "' does not exist. Use " + + "REST POST to create the namespace.").build(); + } + + return createOrUpdate(model, uriInfo, admin, updateExisting); + } + + // Do the actual namespace create or alter. + private Response createOrUpdate(final NamespacesInstanceModel model, final UriInfo uriInfo, + final Admin admin, final boolean updateExisting) { + NamespaceDescriptor.Builder builder = NamespaceDescriptor.create(namespace); + builder.addConfiguration(model.getProperties()); + if(model.getProperties().size() > 0){ + builder.addConfiguration(model.getProperties()); + } + NamespaceDescriptor nsd = builder.build(); + + try{ + if(updateExisting){ + admin.modifyNamespace(nsd); + }else{ + admin.createNamespace(nsd); + } + }catch (IOException e) { + servlet.getMetrics().incrementFailedPutRequests(1); + return processException(e); + } + + servlet.getMetrics().incrementSucessfulPutRequests(1); + return Response.created(uriInfo.getAbsolutePath()).build(); + } + + private boolean doesNamespaceExist(Admin admin, String namespaceName) throws IOException{ + NamespaceDescriptor[] nd = admin.listNamespaceDescriptors(); + for(int i = 0; i < nd.length; i++){ + if(nd[i].getName().equals(namespaceName)){ + return true; + } + } + return false; + } + + /** + * Build a response for DELETE delete namespace. + * @param message value not used. + * @param headers value not used. + * @return response code. + */ + @DELETE + public Response deleteNoBody(final byte[] message, + final @Context UriInfo uriInfo, final @Context HttpHeaders headers) { + if (LOG.isDebugEnabled()) { + LOG.debug("DELETE " + uriInfo.getAbsolutePath()); + } + if (servlet.isReadOnly()) { + servlet.getMetrics().incrementFailedDeleteRequests(1); + return Response.status(Response.Status.FORBIDDEN).type(MIMETYPE_TEXT) + .entity("Forbidden" + CRLF).build(); + } + + try{ + Admin admin = servlet.getAdmin(); + if (!doesNamespaceExist(admin, namespace)){ + return Response.status(Response.Status.NOT_FOUND).type(MIMETYPE_TEXT). + entity("Namespace '" + namespace + "' does not exists. Cannot " + + "drop namespace.").build(); + } + + admin.deleteNamespace(namespace); + servlet.getMetrics().incrementSucessfulDeleteRequests(1); + return Response.ok().build(); + + } catch (IOException e) { + servlet.getMetrics().incrementFailedDeleteRequests(1); + return processException(e); + } + } + + /** + * Dispatch to NamespaceInstanceResource for getting list of tables. + */ + @Path("tables") + public NamespacesInstanceResource getNamespaceInstanceResource( + final @PathParam("tables") String namespace) throws IOException { + return new NamespacesInstanceResource(this.namespace, true); + } +} \ No newline at end of file diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesResource.java new file mode 100644 index 00000000000..0548fe8ca63 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/NamespacesResource.java @@ -0,0 +1,90 @@ +/* + * + * 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; + +import java.io.IOException; + +import javax.servlet.ServletContext; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.rest.model.NamespacesModel; + +/** + * Implements REST GET list of all namespaces. + *
+ * /namespaces + *
+ */ +@InterfaceAudience.Private +public class NamespacesResource extends ResourceBase { + + private static final Log LOG = LogFactory.getLog(NamespacesResource.class); + + /** + * Constructor + * @throws IOException + */ + public NamespacesResource() throws IOException { + super(); + } + + /** + * Build a response for a list of all namespaces request. + * @param context servlet context + * @param uriInfo (JAX-RS context variable) request URL + * @return a response for a version request + */ + @GET + @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, + MIMETYPE_PROTOBUF_IETF}) + public Response get(final @Context ServletContext context, final @Context UriInfo uriInfo) { + if (LOG.isDebugEnabled()) { + LOG.debug("GET " + uriInfo.getAbsolutePath()); + } + servlet.getMetrics().incrementRequests(1); + try { + NamespacesModel rowModel = null; + rowModel = new NamespacesModel(servlet.getAdmin()); + servlet.getMetrics().incrementSucessfulGetRequests(1); + return Response.ok(rowModel).build(); + } catch (IOException e) { + servlet.getMetrics().incrementFailedGetRequests(1); + throw new RuntimeException("Cannot retrieve list of namespaces."); + } + } + + /** + * Dispatch to NamespaceInstanceResource + */ + @Path("{namespace}") + public NamespacesInstanceResource getNamespaceInstanceResource( + final @PathParam("namespace") String namespace) throws IOException { + return new NamespacesInstanceResource(namespace); + } +} \ No newline at end of file diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java index c425e84afb9..c08bb8ba94a 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java @@ -103,4 +103,9 @@ public class RootResource extends ResourceBase { final @PathParam("table") String table) throws IOException { return new TableResource(table); } + + @Path("namespaces") + public NamespacesResource getNamespaceResource() throws IOException { + return new NamespacesResource(); + } } diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/NamespacesInstanceModel.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/NamespacesInstanceModel.java new file mode 100644 index 00000000000..d8528efd1e3 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/NamespacesInstanceModel.java @@ -0,0 +1,168 @@ +/* + * + * 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.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +import org.apache.hadoop.hbase.NamespaceDescriptor; +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.rest.ProtobufMessageHandler; +import org.apache.hadoop.hbase.rest.protobuf + .generated.NamespacePropertiesMessage.NamespaceProperties; + +/** + * List a HBase namespace's key/value properties. + *
repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ java.util.Listrepeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index);
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ int getPropsCount();
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ java.util.List extends org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder>
+ getPropsOrBuilderList();
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder(
+ int index);
+ }
+ /**
+ * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties}
+ */
+ public static final class NamespaceProperties extends
+ com.google.protobuf.GeneratedMessage
+ implements NamespacePropertiesOrBuilder {
+ // Use NamespaceProperties.newBuilder() to construct.
+ private NamespaceProperties(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private NamespaceProperties(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final NamespaceProperties defaultInstance;
+ public static NamespaceProperties getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public NamespaceProperties getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private NamespaceProperties(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ props_ = new java.util.ArrayListrequired string key = 1;
+ */
+ boolean hasKey();
+ /**
+ * required string key = 1;
+ */
+ java.lang.String getKey();
+ /**
+ * required string key = 1;
+ */
+ com.google.protobuf.ByteString
+ getKeyBytes();
+
+ // required string value = 2;
+ /**
+ * required string value = 2;
+ */
+ boolean hasValue();
+ /**
+ * required string value = 2;
+ */
+ java.lang.String getValue();
+ /**
+ * required string value = 2;
+ */
+ com.google.protobuf.ByteString
+ getValueBytes();
+ }
+ /**
+ * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property}
+ */
+ public static final class Property extends
+ com.google.protobuf.GeneratedMessage
+ implements PropertyOrBuilder {
+ // Use Property.newBuilder() to construct.
+ private Property(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Property(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Property defaultInstance;
+ public static Property getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Property getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Property(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ key_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ value_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_NamespaceProperties_Property_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_NamespaceProperties_Property_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.class, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder.class);
+ }
+
+ public static com.google.protobuf.Parserrequired string key = 1;
+ */
+ public boolean hasKey() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string key = 1;
+ */
+ public java.lang.String getKey() {
+ java.lang.Object ref = key_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ key_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string key = 1;
+ */
+ public com.google.protobuf.ByteString
+ getKeyBytes() {
+ java.lang.Object ref = key_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ key_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // required string value = 2;
+ public static final int VALUE_FIELD_NUMBER = 2;
+ private java.lang.Object value_;
+ /**
+ * required string value = 2;
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required string value = 2;
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ value_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string value = 2;
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ key_ = "";
+ value_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasKey()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasValue()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getKeyBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getValueBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getKeyBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getValueBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builderrequired string key = 1;
+ */
+ public boolean hasKey() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string key = 1;
+ */
+ public java.lang.String getKey() {
+ java.lang.Object ref = key_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ key_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * required string key = 1;
+ */
+ public com.google.protobuf.ByteString
+ getKeyBytes() {
+ java.lang.Object ref = key_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ key_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * required string key = 1;
+ */
+ public Builder setKey(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ key_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string key = 1;
+ */
+ public Builder clearKey() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ key_ = getDefaultInstance().getKey();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string key = 1;
+ */
+ public Builder setKeyBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ key_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required string value = 2;
+ private java.lang.Object value_ = "";
+ /**
+ * required string value = 2;
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required string value = 2;
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * required string value = 2;
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * required string value = 2;
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string value = 2;
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string value = 2;
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property)
+ }
+
+ static {
+ defaultInstance = new Property(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property)
+ }
+
+ // repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ public static final int PROPS_FIELD_NUMBER = 1;
+ private java.util.Listrepeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public java.util.Listrepeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public java.util.List extends org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder>
+ getPropsOrBuilderList() {
+ return props_;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public int getPropsCount() {
+ return props_.size();
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index) {
+ return props_.get(index);
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder(
+ int index) {
+ return props_.get(index);
+ }
+
+ private void initFields() {
+ props_ = java.util.Collections.emptyList();
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ for (int i = 0; i < getPropsCount(); i++) {
+ if (!getProps(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ for (int i = 0; i < props_.size(); i++) {
+ output.writeMessage(1, props_.get(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ for (int i = 0; i < props_.size(); i++) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(1, props_.get(i));
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builderrepeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public java.util.Listrepeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public int getPropsCount() {
+ if (propsBuilder_ == null) {
+ return props_.size();
+ } else {
+ return propsBuilder_.getCount();
+ }
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property getProps(int index) {
+ if (propsBuilder_ == null) {
+ return props_.get(index);
+ } else {
+ return propsBuilder_.getMessage(index);
+ }
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder setProps(
+ int index, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property value) {
+ if (propsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensurePropsIsMutable();
+ props_.set(index, value);
+ onChanged();
+ } else {
+ propsBuilder_.setMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder setProps(
+ int index, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder builderForValue) {
+ if (propsBuilder_ == null) {
+ ensurePropsIsMutable();
+ props_.set(index, builderForValue.build());
+ onChanged();
+ } else {
+ propsBuilder_.setMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder addProps(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property value) {
+ if (propsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensurePropsIsMutable();
+ props_.add(value);
+ onChanged();
+ } else {
+ propsBuilder_.addMessage(value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder addProps(
+ int index, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property value) {
+ if (propsBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensurePropsIsMutable();
+ props_.add(index, value);
+ onChanged();
+ } else {
+ propsBuilder_.addMessage(index, value);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder addProps(
+ org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder builderForValue) {
+ if (propsBuilder_ == null) {
+ ensurePropsIsMutable();
+ props_.add(builderForValue.build());
+ onChanged();
+ } else {
+ propsBuilder_.addMessage(builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder addProps(
+ int index, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder builderForValue) {
+ if (propsBuilder_ == null) {
+ ensurePropsIsMutable();
+ props_.add(index, builderForValue.build());
+ onChanged();
+ } else {
+ propsBuilder_.addMessage(index, builderForValue.build());
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder addAllProps(
+ java.lang.Iterable extends org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property> values) {
+ if (propsBuilder_ == null) {
+ ensurePropsIsMutable();
+ super.addAll(values, props_);
+ onChanged();
+ } else {
+ propsBuilder_.addAllMessages(values);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder clearProps() {
+ if (propsBuilder_ == null) {
+ props_ = java.util.Collections.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000001);
+ onChanged();
+ } else {
+ propsBuilder_.clear();
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public Builder removeProps(int index) {
+ if (propsBuilder_ == null) {
+ ensurePropsIsMutable();
+ props_.remove(index);
+ onChanged();
+ } else {
+ propsBuilder_.remove(index);
+ }
+ return this;
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder getPropsBuilder(
+ int index) {
+ return getPropsFieldBuilder().getBuilder(index);
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder getPropsOrBuilder(
+ int index) {
+ if (propsBuilder_ == null) {
+ return props_.get(index); } else {
+ return propsBuilder_.getMessageOrBuilder(index);
+ }
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public java.util.List extends org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.PropertyOrBuilder>
+ getPropsOrBuilderList() {
+ if (propsBuilder_ != null) {
+ return propsBuilder_.getMessageOrBuilderList();
+ } else {
+ return java.util.Collections.unmodifiableList(props_);
+ }
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder addPropsBuilder() {
+ return getPropsFieldBuilder().addBuilder(
+ org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.getDefaultInstance());
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.Builder addPropsBuilder(
+ int index) {
+ return getPropsFieldBuilder().addBuilder(
+ index, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacePropertiesMessage.NamespaceProperties.Property.getDefaultInstance());
+ }
+ /**
+ * repeated .org.apache.hadoop.hbase.rest.protobuf.generated.NamespaceProperties.Property props = 1;
+ */
+ public java.util.Listrepeated string namespace = 1;
+ */
+ java.util.Listrepeated string namespace = 1;
+ */
+ int getNamespaceCount();
+ /**
+ * repeated string namespace = 1;
+ */
+ java.lang.String getNamespace(int index);
+ /**
+ * repeated string namespace = 1;
+ */
+ com.google.protobuf.ByteString
+ getNamespaceBytes(int index);
+ }
+ /**
+ * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.Namespaces}
+ */
+ public static final class Namespaces extends
+ com.google.protobuf.GeneratedMessage
+ implements NamespacesOrBuilder {
+ // Use Namespaces.newBuilder() to construct.
+ private Namespaces(com.google.protobuf.GeneratedMessage.Builder> builder) {
+ super(builder);
+ this.unknownFields = builder.getUnknownFields();
+ }
+ private Namespaces(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+ private static final Namespaces defaultInstance;
+ public static Namespaces getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public Namespaces getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ private final com.google.protobuf.UnknownFieldSet unknownFields;
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ private Namespaces(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ initFields();
+ int mutable_bitField0_ = 0;
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder();
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ case 10: {
+ if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ namespace_ = new com.google.protobuf.LazyStringArrayList();
+ mutable_bitField0_ |= 0x00000001;
+ }
+ namespace_.add(input.readBytes());
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e.getMessage()).setUnfinishedMessage(this);
+ } finally {
+ if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+ namespace_ = new com.google.protobuf.UnmodifiableLazyStringList(namespace_);
+ }
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces.class, org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces.Builder.class);
+ }
+
+ public static com.google.protobuf.Parserrepeated string namespace = 1;
+ */
+ public java.util.Listrepeated string namespace = 1;
+ */
+ public int getNamespaceCount() {
+ return namespace_.size();
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public java.lang.String getNamespace(int index) {
+ return namespace_.get(index);
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public com.google.protobuf.ByteString
+ getNamespaceBytes(int index) {
+ return namespace_.getByteString(index);
+ }
+
+ private void initFields() {
+ namespace_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ for (int i = 0; i < namespace_.size(); i++) {
+ output.writeBytes(1, namespace_.getByteString(i));
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ {
+ int dataSize = 0;
+ for (int i = 0; i < namespace_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(namespace_.getByteString(i));
+ }
+ size += dataSize;
+ size += 1 * getNamespaceList().size();
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.hadoop.hbase.rest.protobuf.generated.NamespacesMessage.Namespaces prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.Namespaces}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builderrepeated string namespace = 1;
+ */
+ public java.util.Listrepeated string namespace = 1;
+ */
+ public int getNamespaceCount() {
+ return namespace_.size();
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public java.lang.String getNamespace(int index) {
+ return namespace_.get(index);
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public com.google.protobuf.ByteString
+ getNamespaceBytes(int index) {
+ return namespace_.getByteString(index);
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public Builder setNamespace(
+ int index, java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureNamespaceIsMutable();
+ namespace_.set(index, value);
+ onChanged();
+ return this;
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public Builder addNamespace(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureNamespaceIsMutable();
+ namespace_.add(value);
+ onChanged();
+ return this;
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public Builder addAllNamespace(
+ java.lang.Iterablerepeated string namespace = 1;
+ */
+ public Builder clearNamespace() {
+ namespace_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000001);
+ onChanged();
+ return this;
+ }
+ /**
+ * repeated string namespace = 1;
+ */
+ public Builder addNamespaceBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureNamespaceIsMutable();
+ namespace_.add(value);
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:org.apache.hadoop.hbase.rest.protobuf.generated.Namespaces)
+ }
+
+ static {
+ defaultInstance = new Namespaces(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:org.apache.hadoop.hbase.rest.protobuf.generated.Namespaces)
+ }
+
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\027NamespacesMessage.proto\022/org.apache.ha" +
+ "doop.hbase.rest.protobuf.generated\"\037\n\nNa" +
+ "mespaces\022\021\n\tnamespace\030\001 \003(\t"
+ };
+ com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+ new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ public com.google.protobuf.ExtensionRegistry assignDescriptors(
+ com.google.protobuf.Descriptors.FileDescriptor root) {
+ descriptor = root;
+ internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Namespaces_descriptor,
+ new java.lang.String[] { "Namespace", });
+ return null;
+ }
+ };
+ com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ }, assigner);
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
index 216f830ba00..ba915195526 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.rest.model.CellModel;
import org.apache.hadoop.hbase.rest.model.CellSetModel;
import org.apache.hadoop.hbase.rest.model.ColumnSchemaModel;
+import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel;
+import org.apache.hadoop.hbase.rest.model.NamespacesModel;
import org.apache.hadoop.hbase.rest.model.RowModel;
import org.apache.hadoop.hbase.rest.model.ScannerModel;
import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel;
@@ -63,6 +65,8 @@ public class JAXBContextResolver implements ContextResolver