http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/VersionMessage.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/VersionMessage.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/VersionMessage.java new file mode 100644 index 0000000..590b0d3 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/protobuf/generated/VersionMessage.java @@ -0,0 +1,1147 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: VersionMessage.proto + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +public final class VersionMessage { + private VersionMessage() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface VersionOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string restVersion = 1; + /** + * <code>optional string restVersion = 1;</code> + */ + boolean hasRestVersion(); + /** + * <code>optional string restVersion = 1;</code> + */ + java.lang.String getRestVersion(); + /** + * <code>optional string restVersion = 1;</code> + */ + com.google.protobuf.ByteString + getRestVersionBytes(); + + // optional string jvmVersion = 2; + /** + * <code>optional string jvmVersion = 2;</code> + */ + boolean hasJvmVersion(); + /** + * <code>optional string jvmVersion = 2;</code> + */ + java.lang.String getJvmVersion(); + /** + * <code>optional string jvmVersion = 2;</code> + */ + com.google.protobuf.ByteString + getJvmVersionBytes(); + + // optional string osVersion = 3; + /** + * <code>optional string osVersion = 3;</code> + */ + boolean hasOsVersion(); + /** + * <code>optional string osVersion = 3;</code> + */ + java.lang.String getOsVersion(); + /** + * <code>optional string osVersion = 3;</code> + */ + com.google.protobuf.ByteString + getOsVersionBytes(); + + // optional string serverVersion = 4; + /** + * <code>optional string serverVersion = 4;</code> + */ + boolean hasServerVersion(); + /** + * <code>optional string serverVersion = 4;</code> + */ + java.lang.String getServerVersion(); + /** + * <code>optional string serverVersion = 4;</code> + */ + com.google.protobuf.ByteString + getServerVersionBytes(); + + // optional string jerseyVersion = 5; + /** + * <code>optional string jerseyVersion = 5;</code> + */ + boolean hasJerseyVersion(); + /** + * <code>optional string jerseyVersion = 5;</code> + */ + java.lang.String getJerseyVersion(); + /** + * <code>optional string jerseyVersion = 5;</code> + */ + com.google.protobuf.ByteString + getJerseyVersionBytes(); + } + /** + * Protobuf type {@code org.apache.hadoop.hbase.rest.protobuf.generated.Version} + */ + public static final class Version extends + com.google.protobuf.GeneratedMessage + implements VersionOrBuilder { + // Use Version.newBuilder() to construct. + private Version(com.google.protobuf.GeneratedMessage.Builder<?> builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Version(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Version defaultInstance; + public static Version getDefaultInstance() { + return defaultInstance; + } + + public Version getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Version( + 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; + restVersion_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + jvmVersion_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + osVersion_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + serverVersion_ = input.readBytes(); + break; + } + case 42: { + bitField0_ |= 0x00000010; + jerseyVersion_ = 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.VersionMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.class, org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.Builder.class); + } + + public static com.google.protobuf.Parser<Version> PARSER = + new com.google.protobuf.AbstractParser<Version>() { + public Version parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Version(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser<Version> getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional string restVersion = 1; + public static final int RESTVERSION_FIELD_NUMBER = 1; + private java.lang.Object restVersion_; + /** + * <code>optional string restVersion = 1;</code> + */ + public boolean hasRestVersion() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * <code>optional string restVersion = 1;</code> + */ + public java.lang.String getRestVersion() { + java.lang.Object ref = restVersion_; + 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()) { + restVersion_ = s; + } + return s; + } + } + /** + * <code>optional string restVersion = 1;</code> + */ + public com.google.protobuf.ByteString + getRestVersionBytes() { + java.lang.Object ref = restVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + restVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string jvmVersion = 2; + public static final int JVMVERSION_FIELD_NUMBER = 2; + private java.lang.Object jvmVersion_; + /** + * <code>optional string jvmVersion = 2;</code> + */ + public boolean hasJvmVersion() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public java.lang.String getJvmVersion() { + java.lang.Object ref = jvmVersion_; + 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()) { + jvmVersion_ = s; + } + return s; + } + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public com.google.protobuf.ByteString + getJvmVersionBytes() { + java.lang.Object ref = jvmVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + jvmVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string osVersion = 3; + public static final int OSVERSION_FIELD_NUMBER = 3; + private java.lang.Object osVersion_; + /** + * <code>optional string osVersion = 3;</code> + */ + public boolean hasOsVersion() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * <code>optional string osVersion = 3;</code> + */ + public java.lang.String getOsVersion() { + java.lang.Object ref = osVersion_; + 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()) { + osVersion_ = s; + } + return s; + } + } + /** + * <code>optional string osVersion = 3;</code> + */ + public com.google.protobuf.ByteString + getOsVersionBytes() { + java.lang.Object ref = osVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + osVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string serverVersion = 4; + public static final int SERVERVERSION_FIELD_NUMBER = 4; + private java.lang.Object serverVersion_; + /** + * <code>optional string serverVersion = 4;</code> + */ + public boolean hasServerVersion() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public java.lang.String getServerVersion() { + java.lang.Object ref = serverVersion_; + 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()) { + serverVersion_ = s; + } + return s; + } + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public com.google.protobuf.ByteString + getServerVersionBytes() { + java.lang.Object ref = serverVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serverVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string jerseyVersion = 5; + public static final int JERSEYVERSION_FIELD_NUMBER = 5; + private java.lang.Object jerseyVersion_; + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public boolean hasJerseyVersion() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public java.lang.String getJerseyVersion() { + java.lang.Object ref = jerseyVersion_; + 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()) { + jerseyVersion_ = s; + } + return s; + } + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public com.google.protobuf.ByteString + getJerseyVersionBytes() { + java.lang.Object ref = jerseyVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + jerseyVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + restVersion_ = ""; + jvmVersion_ = ""; + osVersion_ = ""; + serverVersion_ = ""; + jerseyVersion_ = ""; + } + 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(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getRestVersionBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getJvmVersionBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getOsVersionBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getServerVersionBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getJerseyVersionBytes()); + } + 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, getRestVersionBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getJvmVersionBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getOsVersionBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getServerVersionBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getJerseyVersionBytes()); + } + 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.VersionMessage.Version parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version 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.VersionMessage.Version parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version 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.VersionMessage.Version parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version 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.VersionMessage.Version parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version 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.VersionMessage.Version parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version 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.VersionMessage.Version 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.Version} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder<Builder> + implements org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.VersionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.class, org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.Builder.class); + } + + // Construct using org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + restVersion_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + jvmVersion_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + osVersion_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + serverVersion_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + jerseyVersion_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_descriptor; + } + + public org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version getDefaultInstanceForType() { + return org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.getDefaultInstance(); + } + + public org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version build() { + org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version buildPartial() { + org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version result = new org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.restVersion_ = restVersion_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.jvmVersion_ = jvmVersion_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.osVersion_ = osVersion_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.serverVersion_ = serverVersion_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.jerseyVersion_ = jerseyVersion_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version) { + return mergeFrom((org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version other) { + if (other == org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version.getDefaultInstance()) return this; + if (other.hasRestVersion()) { + bitField0_ |= 0x00000001; + restVersion_ = other.restVersion_; + onChanged(); + } + if (other.hasJvmVersion()) { + bitField0_ |= 0x00000002; + jvmVersion_ = other.jvmVersion_; + onChanged(); + } + if (other.hasOsVersion()) { + bitField0_ |= 0x00000004; + osVersion_ = other.osVersion_; + onChanged(); + } + if (other.hasServerVersion()) { + bitField0_ |= 0x00000008; + serverVersion_ = other.serverVersion_; + onChanged(); + } + if (other.hasJerseyVersion()) { + bitField0_ |= 0x00000010; + jerseyVersion_ = other.jerseyVersion_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // optional string restVersion = 1; + private java.lang.Object restVersion_ = ""; + /** + * <code>optional string restVersion = 1;</code> + */ + public boolean hasRestVersion() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * <code>optional string restVersion = 1;</code> + */ + public java.lang.String getRestVersion() { + java.lang.Object ref = restVersion_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + restVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>optional string restVersion = 1;</code> + */ + public com.google.protobuf.ByteString + getRestVersionBytes() { + java.lang.Object ref = restVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + restVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>optional string restVersion = 1;</code> + */ + public Builder setRestVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + restVersion_ = value; + onChanged(); + return this; + } + /** + * <code>optional string restVersion = 1;</code> + */ + public Builder clearRestVersion() { + bitField0_ = (bitField0_ & ~0x00000001); + restVersion_ = getDefaultInstance().getRestVersion(); + onChanged(); + return this; + } + /** + * <code>optional string restVersion = 1;</code> + */ + public Builder setRestVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + restVersion_ = value; + onChanged(); + return this; + } + + // optional string jvmVersion = 2; + private java.lang.Object jvmVersion_ = ""; + /** + * <code>optional string jvmVersion = 2;</code> + */ + public boolean hasJvmVersion() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public java.lang.String getJvmVersion() { + java.lang.Object ref = jvmVersion_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + jvmVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public com.google.protobuf.ByteString + getJvmVersionBytes() { + java.lang.Object ref = jvmVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + jvmVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public Builder setJvmVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + jvmVersion_ = value; + onChanged(); + return this; + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public Builder clearJvmVersion() { + bitField0_ = (bitField0_ & ~0x00000002); + jvmVersion_ = getDefaultInstance().getJvmVersion(); + onChanged(); + return this; + } + /** + * <code>optional string jvmVersion = 2;</code> + */ + public Builder setJvmVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + jvmVersion_ = value; + onChanged(); + return this; + } + + // optional string osVersion = 3; + private java.lang.Object osVersion_ = ""; + /** + * <code>optional string osVersion = 3;</code> + */ + public boolean hasOsVersion() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * <code>optional string osVersion = 3;</code> + */ + public java.lang.String getOsVersion() { + java.lang.Object ref = osVersion_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + osVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>optional string osVersion = 3;</code> + */ + public com.google.protobuf.ByteString + getOsVersionBytes() { + java.lang.Object ref = osVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + osVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>optional string osVersion = 3;</code> + */ + public Builder setOsVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + osVersion_ = value; + onChanged(); + return this; + } + /** + * <code>optional string osVersion = 3;</code> + */ + public Builder clearOsVersion() { + bitField0_ = (bitField0_ & ~0x00000004); + osVersion_ = getDefaultInstance().getOsVersion(); + onChanged(); + return this; + } + /** + * <code>optional string osVersion = 3;</code> + */ + public Builder setOsVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + osVersion_ = value; + onChanged(); + return this; + } + + // optional string serverVersion = 4; + private java.lang.Object serverVersion_ = ""; + /** + * <code>optional string serverVersion = 4;</code> + */ + public boolean hasServerVersion() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public java.lang.String getServerVersion() { + java.lang.Object ref = serverVersion_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + serverVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public com.google.protobuf.ByteString + getServerVersionBytes() { + java.lang.Object ref = serverVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serverVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public Builder setServerVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + serverVersion_ = value; + onChanged(); + return this; + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public Builder clearServerVersion() { + bitField0_ = (bitField0_ & ~0x00000008); + serverVersion_ = getDefaultInstance().getServerVersion(); + onChanged(); + return this; + } + /** + * <code>optional string serverVersion = 4;</code> + */ + public Builder setServerVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + serverVersion_ = value; + onChanged(); + return this; + } + + // optional string jerseyVersion = 5; + private java.lang.Object jerseyVersion_ = ""; + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public boolean hasJerseyVersion() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public java.lang.String getJerseyVersion() { + java.lang.Object ref = jerseyVersion_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + jerseyVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public com.google.protobuf.ByteString + getJerseyVersionBytes() { + java.lang.Object ref = jerseyVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + jerseyVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public Builder setJerseyVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + jerseyVersion_ = value; + onChanged(); + return this; + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public Builder clearJerseyVersion() { + bitField0_ = (bitField0_ & ~0x00000010); + jerseyVersion_ = getDefaultInstance().getJerseyVersion(); + onChanged(); + return this; + } + /** + * <code>optional string jerseyVersion = 5;</code> + */ + public Builder setJerseyVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + jerseyVersion_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.apache.hadoop.hbase.rest.protobuf.generated.Version) + } + + static { + defaultInstance = new Version(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.apache.hadoop.hbase.rest.protobuf.generated.Version) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_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\024VersionMessage.proto\022/org.apache.hadoo" + + "p.hbase.rest.protobuf.generated\"s\n\007Versi" + + "on\022\023\n\013restVersion\030\001 \001(\t\022\022\n\njvmVersion\030\002 " + + "\001(\t\022\021\n\tosVersion\030\003 \001(\t\022\025\n\rserverVersion\030" + + "\004 \001(\t\022\025\n\rjerseyVersion\030\005 \001(\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_Version_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_apache_hadoop_hbase_rest_protobuf_generated_Version_descriptor, + new java.lang.String[] { "RestVersion", "JvmVersion", "OsVersion", "ServerVersion", "JerseyVersion", }); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +}
http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..3b8b8ca --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java @@ -0,0 +1,89 @@ +/* + * + * 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.provider; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; +import javax.xml.bind.JAXBContext; + +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.RowModel; +import org.apache.hadoop.hbase.rest.model.ScannerModel; +import org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel; +import org.apache.hadoop.hbase.rest.model.StorageClusterVersionModel; +import org.apache.hadoop.hbase.rest.model.TableInfoModel; +import org.apache.hadoop.hbase.rest.model.TableListModel; +import org.apache.hadoop.hbase.rest.model.TableModel; +import org.apache.hadoop.hbase.rest.model.TableRegionModel; +import org.apache.hadoop.hbase.rest.model.TableSchemaModel; +import org.apache.hadoop.hbase.rest.model.VersionModel; + +import com.sun.jersey.api.json.JSONConfiguration; +import com.sun.jersey.api.json.JSONJAXBContext; + +/** + * Plumbing for hooking up Jersey's JSON entity body encoding and decoding + * support to JAXB. Modify how the context is created (by using e.g. a + * different configuration builder) to control how JSON is processed and + * created. + */ +@Provider [email protected] +public class JAXBContextResolver implements ContextResolver<JAXBContext> { + + private final JAXBContext context; + + private final Set<Class<?>> types; + + private final Class<?>[] cTypes = { + CellModel.class, + CellSetModel.class, + ColumnSchemaModel.class, + RowModel.class, + ScannerModel.class, + StorageClusterStatusModel.class, + StorageClusterVersionModel.class, + TableInfoModel.class, + TableListModel.class, + TableModel.class, + TableRegionModel.class, + TableSchemaModel.class, + VersionModel.class + }; + + @SuppressWarnings("unchecked") + public JAXBContextResolver() throws Exception { + this.types = new HashSet(Arrays.asList(cTypes)); + this.context = new JSONJAXBContext(JSONConfiguration.natural().build(), + cTypes); + } + + @Override + public JAXBContext getContext(Class<?> objectType) { + return (types.contains(objectType)) ? context : null; + } +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java new file mode 100644 index 0000000..7791d02 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java @@ -0,0 +1,31 @@ +/** + * 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.provider; + +import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; + +import javax.ws.rs.ext.Provider; + +//create a class in the defined resource package name +//so it gets activated +//Use jackson to take care of json +//since it has better support for object +//deserializaiton and less clunky to deal with +@Provider +public class JacksonProvider extends JacksonJaxbJsonProvider { +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java new file mode 100644 index 0000000..ec39db0 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java @@ -0,0 +1,88 @@ +/* + * + * 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.provider.consumer; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.Consumes; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.Provider; + +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.Constants; +import org.apache.hadoop.hbase.rest.ProtobufMessageHandler; + +/** + * Adapter for hooking up Jersey content processing dispatch to + * ProtobufMessageHandler interface capable handlers for decoding protobuf input. + */ +@Provider +@Consumes({Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF}) [email protected] +public class ProtobufMessageBodyConsumer + implements MessageBodyReader<ProtobufMessageHandler> { + private static final Log LOG = + LogFactory.getLog(ProtobufMessageBodyConsumer.class); + + @Override + public boolean isReadable(Class<?> type, Type genericType, + Annotation[] annotations, MediaType mediaType) { + return ProtobufMessageHandler.class.isAssignableFrom(type); + } + + @Override + public ProtobufMessageHandler readFrom(Class<ProtobufMessageHandler> type, Type genericType, + Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, String> httpHeaders, InputStream inputStream) + throws IOException, WebApplicationException { + ProtobufMessageHandler obj = null; + try { + obj = type.newInstance(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int read; + do { + read = inputStream.read(buffer, 0, buffer.length); + if (read > 0) { + baos.write(buffer, 0, read); + } + } while (read > 0); + if (LOG.isDebugEnabled()) { + LOG.debug(getClass() + ": read " + baos.size() + " bytes from " + + inputStream); + } + obj = obj.getObjectFromMessage(baos.toByteArray()); + } catch (InstantiationException e) { + throw new WebApplicationException(e); + } catch (IllegalAccessException e) { + throw new WebApplicationException(e); + } + return obj; + } +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java new file mode 100644 index 0000000..523692a --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java @@ -0,0 +1,74 @@ +/* + * + * 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.provider.producer; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; + +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.rest.Constants; + +/** + * An adapter between Jersey and Object.toString(). Hooks up plain text output + * to the Jersey content handling framework. + * Jersey will first call getSize() to learn the number of bytes that will be + * sent, then writeTo to perform the actual I/O. + */ +@Provider +@Produces(Constants.MIMETYPE_TEXT) [email protected] +public class PlainTextMessageBodyProducer + implements MessageBodyWriter<Object> { + + private ThreadLocal<byte[]> buffer = new ThreadLocal<byte[]>(); + + @Override + public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, + MediaType arg3) { + return true; + } + + @Override + public long getSize(Object object, Class<?> type, Type genericType, + Annotation[] annotations, MediaType mediaType) { + byte[] bytes = object.toString().getBytes(); + buffer.set(bytes); + return bytes.length; + } + + @Override + public void writeTo(Object object, Class<?> type, Type genericType, + Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, Object> httpHeaders, OutputStream outStream) + throws IOException, WebApplicationException { + byte[] bytes = buffer.get(); + outStream.write(bytes); + buffer.remove(); + } +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java new file mode 100644 index 0000000..6d737b5 --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java @@ -0,0 +1,81 @@ +/* + * + * 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.provider.producer; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; + +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.rest.Constants; +import org.apache.hadoop.hbase.rest.ProtobufMessageHandler; + +/** + * An adapter between Jersey and ProtobufMessageHandler implementors. Hooks up + * protobuf output producing methods to the Jersey content handling framework. + * Jersey will first call getSize() to learn the number of bytes that will be + * sent, then writeTo to perform the actual I/O. + */ +@Provider +@Produces({Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF}) [email protected] +public class ProtobufMessageBodyProducer + implements MessageBodyWriter<ProtobufMessageHandler> { + + private ThreadLocal<byte[]> buffer = new ThreadLocal<byte[]>(); + + @Override + public boolean isWriteable(Class<?> type, Type genericType, + Annotation[] annotations, MediaType mediaType) { + return ProtobufMessageHandler.class.isAssignableFrom(type); + } + + @Override + public long getSize(ProtobufMessageHandler m, Class<?> type, Type genericType, + Annotation[] annotations, MediaType mediaType) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + baos.write(m.createProtobufOutput()); + } catch (IOException e) { + return -1; + } + byte[] bytes = baos.toByteArray(); + buffer.set(bytes); + return bytes.length; + } + + public void writeTo(ProtobufMessageHandler m, Class<?> type, Type genericType, + Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + byte[] bytes = buffer.get(); + entityStream.write(bytes); + buffer.remove(); + } +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/hbase-webapps/rest/index.html ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/index.html b/hbase-rest/src/main/resources/hbase-webapps/rest/index.html new file mode 100644 index 0000000..e4084b7 --- /dev/null +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/index.html @@ -0,0 +1,20 @@ +<!-- +/** + * 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. + */ +--> +<meta HTTP-EQUIV="REFRESH" content="0;url=/rest.jsp"/> http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp b/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp new file mode 100644 index 0000000..810569c --- /dev/null +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp @@ -0,0 +1,117 @@ +<%-- +/** + * 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. + */ +--%> +<%@ page contentType="text/html;charset=UTF-8" + import="org.apache.hadoop.conf.Configuration" + import="org.apache.hadoop.hbase.HBaseConfiguration" + import="org.apache.hadoop.hbase.util.VersionInfo" + import="java.util.Date"%> +<% +Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); +long startcode = conf.getLong("startcode", System.currentTimeMillis()); +String listenPort = conf.get("hbase.rest.port", "8080"); +%> +<!--[if IE]> +<!DOCTYPE html> +<![endif]--> +<?xml version="1.0" encoding="UTF-8" ?> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>HBase REST Server: <%= listenPort %></title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta name="description" content=""> + + <link href="/static/css/bootstrap.min.css" rel="stylesheet"> + <link href="/static/css/bootstrap-theme.min.css" rel="stylesheet"> + <link href="/static/css/hbase.css" rel="stylesheet"> + </head> + + <body> + <div class="navbar navbar-fixed-top navbar-default"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="/rest.jsp"><img src="/static/hbase_logo_small.png" alt="HBase Logo"/></a> + </div> + <div class="collapse navbar-collapse"> + <ul class="nav navbar-nav"> + <li class="active"><a href="/rest.jsp">Home</a></li> + <li><a href="/logs/">Local logs</a></li> + <li><a href="/logLevel">Log Level</a></li> + <li><a href="/jmx">Metrics Dump</a></li> + <% if (HBaseConfiguration.isShowConfInServlet()) { %> + <li><a href="/conf">HBase Configuration</a></li> + <% } %> + </ul> + </div><!--/.nav-collapse --> + </div> + </div> + +<div class="container"> + <div class="row inner_header"> + <div class="page-header"> + <h1>RESTServer <small><%= listenPort %></small></h1> + </div> + </div> + <div class="row"> + + <section> + <h2>Software Attributes</h2> + <table id="attributes_table" class="table table-striped"> + <tr> + <th>Attribute Name</th> + <th>Value</th> + <th>Description</th> + </tr> + <tr> + <td>HBase Version</td> + <td><%= VersionInfo.getVersion() %>, r<%= VersionInfo.getRevision() %></td> + <td>HBase version and revision</td> + </tr> + <tr> + <td>HBase Compiled</td> + <td><%= VersionInfo.getDate() %>, <%= VersionInfo.getUser() %></td> + <td>When HBase version was compiled and by whom</td> + </tr> + <tr> + <td>REST Server Start Time</td> + <td><%= new Date(startcode) %></td> + <td>Date stamp of when this REST server was started</td> + </tr> + </table> + </section> + </div> + <div class="row"> + + <section> +<a href="http://wiki.apache.org/hadoop/Hbase/Stargate">Apache HBase Wiki on REST</a> + </section> + </div> +</div> +<script src="/static/js/jquery.min.js" type="text/javascript"></script> +<script src="/static/js/bootstrap.min.js" type="text/javascript"></script> +<script src="/static/js/tab.js" type="text/javascript"></script> +</body> +</html> + http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd new file mode 100644 index 0000000..ab1b722 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd @@ -0,0 +1,181 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * 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. + */ +--> +<schema targetNamespace="ModelSchema" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="ModelSchema"> + + <element name="Version" type="tns:Version"></element> + + <complexType name="Version"> + <attribute name="REST" type="string"></attribute> + <attribute name="JVM" type="string"></attribute> + <attribute name="OS" type="string"></attribute> + <attribute name="Server" type="string"></attribute> + <attribute name="Jersey" type="string"></attribute> + </complexType> + + <element name="TableList" type="tns:TableList"></element> + + <complexType name="TableList"> + <sequence> + <element name="table" type="tns:Table" maxOccurs="unbounded" minOccurs="1"></element> + </sequence> + </complexType> + + <complexType name="Table"> + <sequence> + <element name="name" type="string"></element> + </sequence> + </complexType> + + <element name="TableInfo" type="tns:TableInfo"></element> + + <complexType name="TableInfo"> + <sequence> + <element name="region" type="tns:TableRegion" maxOccurs="unbounded" minOccurs="1"></element> + </sequence> + <attribute name="name" type="string"></attribute> + </complexType> + + <complexType name="TableRegion"> + <attribute name="name" type="string"></attribute> + <attribute name="id" type="int"></attribute> + <attribute name="startKey" type="base64Binary"></attribute> + <attribute name="endKey" type="base64Binary"></attribute> + <attribute name="location" type="string"></attribute> + </complexType> + + <element name="TableSchema" type="tns:TableSchema"></element> + + <complexType name="TableSchema"> + <sequence> + <element name="column" type="tns:ColumnSchema" maxOccurs="unbounded" minOccurs="1"></element> + </sequence> + <attribute name="name" type="string"></attribute> + <anyAttribute></anyAttribute> + </complexType> + + <complexType name="ColumnSchema"> + <attribute name="name" type="string"></attribute> + <anyAttribute></anyAttribute> + </complexType> + + <element name="CellSet" type="tns:CellSet"></element> + + <complexType name="CellSet"> + <sequence> + <element name="row" type="tns:Row" maxOccurs="unbounded" minOccurs="1"></element> + </sequence> + </complexType> + + <element name="Row" type="tns:Row"></element> + + <complexType name="Row"> + <sequence> + <element name="key" type="base64Binary"></element> + <element name="cell" type="tns:Cell" maxOccurs="unbounded" minOccurs="1"></element> + </sequence> + </complexType> + + <element name="Cell" type="tns:Cell"></element> + + <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> + + <element name="Scanner" type="tns:Scanner"></element> + + <complexType name="Scanner"> + <sequence> + <element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"></element> + </sequence> + <attribute name="startRow" type="base64Binary"></attribute> + <attribute name="endRow" type="base64Binary"></attribute> + <attribute name="batch" type="int"></attribute> + <attribute name="startTime" type="int"></attribute> + <attribute name="endTime" type="int"></attribute> + <attribute name="filter" type="string"></attribute> + <attribute name="caching" type="int"></attribute> + <sequence> + <element name="labels" type="string" minOccurs="0" maxOccurs="unbounded"></element> + </sequence> + <attribute name="cacheBlocks" type="boolean"></attribute> + </complexType> + + <element name="StorageClusterVersion" type="tns:StorageClusterVersion" /> + + <complexType name="StorageClusterVersion"> + <attribute name="version" type="string"></attribute> + </complexType> + + <element name="StorageClusterStatus" + type="tns:StorageClusterStatus"> + </element> + + <complexType name="StorageClusterStatus"> + <sequence> + <element name="liveNode" type="tns:Node" + maxOccurs="unbounded" minOccurs="0"> + </element> + <element name="deadNode" type="string" maxOccurs="unbounded" + minOccurs="0"> + </element> + </sequence> + <attribute name="regions" type="int"></attribute> + <attribute name="requests" type="int"></attribute> + <attribute name="averageLoad" type="float"></attribute> + </complexType> + + <complexType name="Node"> + <sequence> + <element name="region" type="tns:Region" + maxOccurs="unbounded" minOccurs="0"> + </element> + </sequence> + <attribute name="name" type="string"></attribute> + <attribute name="startCode" type="int"></attribute> + <attribute name="requests" type="int"></attribute> + <attribute name="heapSizeMB" type="int"></attribute> + <attribute name="maxHeapSizeMB" type="int"></attribute> + </complexType> + + <complexType name="Region"> + <attribute name="name" type="base64Binary"></attribute> + <attribute name="stores" type="int"></attribute> + <attribute name="storefiles" type="int"></attribute> + <attribute name="storefileSizeMB" type="int"></attribute> + <attribute name="memstoreSizeMB" type="int"></attribute> + <attribute name="storefileIndexSizeMB" type="int"></attribute> + <attribute name="readRequestsCount" type="int"></attribute> + <attribute name="writeRequestsCount" type="int"></attribute> + <attribute name="rootIndexSizeKB" type="int"></attribute> + <attribute name="totalStaticIndexSizeKB" type="int"></attribute> + <attribute name="totalStaticBloomSizeKB" type="int"></attribute> + <attribute name="totalCompactingKVs" type="int"></attribute> + <attribute name="currentCompactedKVs" type="int"></attribute> + </complexType> + +</schema> http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellMessage.proto new file mode 100644 index 0000000..8d45154 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellMessage.proto @@ -0,0 +1,25 @@ +// +// 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.protobuf.generated; + +message Cell { + optional bytes row = 1; // unused if Cell is in a CellSet + optional bytes column = 2; + optional int64 timestamp = 3; + optional bytes data = 4; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellSetMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellSetMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellSetMessage.proto new file mode 100644 index 0000000..4774a8d --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellSetMessage.proto @@ -0,0 +1,28 @@ +// +// 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. + +import "CellMessage.proto"; + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +message CellSet { + message Row { + required bytes key = 1; + repeated Cell values = 2; + } + repeated Row rows = 1; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ColumnSchemaMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ColumnSchemaMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ColumnSchemaMessage.proto new file mode 100644 index 0000000..05e33b6 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ColumnSchemaMessage.proto @@ -0,0 +1,31 @@ +// +// 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.protobuf.generated; + +message ColumnSchema { + optional string name = 1; + message Attribute { + required string name = 1; + required string value = 2; + } + repeated Attribute attrs = 2; + // optional helpful encodings of commonly used attributes + optional int32 ttl = 3; + optional int32 maxVersions = 4; + optional string compression = 5; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ScannerMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ScannerMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ScannerMessage.proto new file mode 100644 index 0000000..185eac6 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ScannerMessage.proto @@ -0,0 +1,32 @@ +// +// 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.protobuf.generated; + +message Scanner { + optional bytes startRow = 1; + optional bytes endRow = 2; + repeated bytes columns = 3; + optional int32 batch = 4; + optional int64 startTime = 5; + optional int64 endTime = 6; + optional int32 maxVersions = 7; + optional string filter = 8; + optional int32 caching = 9; // specifies REST scanner caching + repeated string labels = 10; + optional bool cacheBlocks = 11; // server side block caching hint +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/StorageClusterStatusMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/StorageClusterStatusMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/StorageClusterStatusMessage.proto new file mode 100644 index 0000000..a0291b4 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/StorageClusterStatusMessage.proto @@ -0,0 +1,51 @@ +// +// 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.protobuf.generated; + +message StorageClusterStatus { + message Region { + required bytes name = 1; + optional int32 stores = 2; + optional int32 storefiles = 3; + optional int32 storefileSizeMB = 4; + optional int32 memstoreSizeMB = 5; + optional int32 storefileIndexSizeMB = 6; + optional int64 readRequestsCount = 7; + optional int64 writeRequestsCount = 8; + optional int32 rootIndexSizeKB = 9; + optional int32 totalStaticIndexSizeKB = 10; + optional int32 totalStaticBloomSizeKB = 11; + optional int64 totalCompactingKVs = 12; + optional int64 currentCompactedKVs = 13; + } + message Node { + required string name = 1; // name:port + optional int64 startCode = 2; + optional int32 requests = 3; + optional int32 heapSizeMB = 4; + optional int32 maxHeapSizeMB = 5; + repeated Region regions = 6; + } + // node status + repeated Node liveNodes = 1; + repeated string deadNodes = 2; + // summary statistics + optional int32 regions = 3; + optional int32 requests = 4; + optional double averageLoad = 5; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableInfoMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableInfoMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableInfoMessage.proto new file mode 100644 index 0000000..674499c --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableInfoMessage.proto @@ -0,0 +1,30 @@ +// +// 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.protobuf.generated; + +message TableInfo { + required string name = 1; + message Region { + required string name = 1; + optional bytes startKey = 2; + optional bytes endKey = 3; + optional int64 id = 4; + optional string location = 5; + } + repeated Region regions = 2; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableListMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableListMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableListMessage.proto new file mode 100644 index 0000000..fbd76ea --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableListMessage.proto @@ -0,0 +1,22 @@ +// +// 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.protobuf.generated; + +message TableList { + repeated string name = 1; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableSchemaMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableSchemaMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableSchemaMessage.proto new file mode 100644 index 0000000..47a4da5 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableSchemaMessage.proto @@ -0,0 +1,33 @@ +// +// 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. + +import "ColumnSchemaMessage.proto"; + +package org.apache.hadoop.hbase.rest.protobuf.generated; + +message TableSchema { + optional string name = 1; + message Attribute { + required string name = 1; + required string value = 2; + } + repeated Attribute attrs = 2; + repeated ColumnSchema columns = 3; + // optional helpful encodings of commonly used attributes + optional bool inMemory = 4; + optional bool readOnly = 5; +} http://git-wip-us.apache.org/repos/asf/hbase/blob/6ddb2f19/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/VersionMessage.proto ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/VersionMessage.proto b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/VersionMessage.proto new file mode 100644 index 0000000..cc107b3 --- /dev/null +++ b/hbase-rest/src/main/resources/org/apache/hadoop/hbase/rest/protobuf/VersionMessage.proto @@ -0,0 +1,26 @@ +// +// 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.protobuf.generated; + +message Version { + optional string restVersion = 1; + optional string jvmVersion = 2; + optional string osVersion = 3; + optional string serverVersion = 4; + optional string jerseyVersion = 5; +}
