HBASE-16995 Build client Java API and client protobuf messages - addendum fixes line lengths (Josh Elser)

This commit is contained in:
tedyu 2016-11-21 13:00:27 -08:00 committed by Josh Elser
parent 140413c11b
commit c5172169f2
3 changed files with 20 additions and 15 deletions

View File

@ -128,7 +128,8 @@ public class QuotaSettingsFactory {
static QuotaSettings fromSpace(TableName table, String namespace, SpaceQuota protoQuota) { static QuotaSettings fromSpace(TableName table, String namespace, SpaceQuota protoQuota) {
if ((null == table && null == namespace) || (null != table && null != namespace)) { if ((null == table && null == namespace) || (null != table && null != namespace)) {
throw new IllegalArgumentException("Can only construct SpaceLimitSettings for a table or namespace."); throw new IllegalArgumentException(
"Can only construct SpaceLimitSettings for a table or namespace.");
} }
if (null != table) { if (null != table) {
return SpaceLimitSettings.fromSpaceQuota(table, protoQuota); return SpaceLimitSettings.fromSpaceQuota(table, protoQuota);
@ -300,29 +301,32 @@ public class QuotaSettingsFactory {
*/ */
/** /**
* Creates a {@link QuotaSettings} object to limit the FileSystem space usage for the given table to the given size in bytes. * Creates a {@link QuotaSettings} object to limit the FileSystem space usage for the given table
* When the space usage is exceeded by the table, the provided {@link SpaceViolationPolicy} is enacted on the table. * to the given size in bytes. When the space usage is exceeded by the table, the provided
* {@link SpaceViolationPolicy} is enacted on the table.
* *
* @param tableName The name of the table on which the quota should be applied. * @param tableName The name of the table on which the quota should be applied.
* @param sizeLimit The limit of a table's size in bytes. * @param sizeLimit The limit of a table's size in bytes.
* @param violationPolicy The action to take when the quota is exceeded. * @param violationPolicy The action to take when the quota is exceeded.
* @return An {@link QuotaSettings} object. * @return An {@link QuotaSettings} object.
*/ */
public static QuotaSettings limitTableSpace(final TableName tableName, long sizeLimit, final SpaceViolationPolicy violationPolicy) { public static QuotaSettings limitTableSpace(
final TableName tableName, long sizeLimit, final SpaceViolationPolicy violationPolicy) {
return new SpaceLimitSettings(tableName, sizeLimit, violationPolicy); return new SpaceLimitSettings(tableName, sizeLimit, violationPolicy);
} }
/** /**
* Creates a {@link QuotaSettings} object to limit the FileSystem space usage for the given namespace to the given size in bytes. * Creates a {@link QuotaSettings} object to limit the FileSystem space usage for the given
* When the space usage is exceeded by all tables in the namespace, the provided {@link SpaceViolationPolicy} is enacted on * namespace to the given size in bytes. When the space usage is exceeded by all tables in the
* all tables in the namespace. * namespace, the provided {@link SpaceViolationPolicy} is enacted on all tables in the namespace.
* *
* @param namespace The namespace on which the quota should be applied. * @param namespace The namespace on which the quota should be applied.
* @param sizeLimit The limit of the namespace's size in bytes. * @param sizeLimit The limit of the namespace's size in bytes.
* @param violationPolicy The action to take when the the quota is exceeded. * @param violationPolicy The action to take when the the quota is exceeded.
* @return An {@link QuotaSettings} object. * @return An {@link QuotaSettings} object.
*/ */
public static QuotaSettings limitNamespaceSpace(final String namespace, long sizeLimit, final SpaceViolationPolicy violationPolicy) { public static QuotaSettings limitNamespaceSpace(
final String namespace, long sizeLimit, final SpaceViolationPolicy violationPolicy) {
return new SpaceLimitSettings(namespace, sizeLimit, violationPolicy); return new SpaceLimitSettings(namespace, sizeLimit, violationPolicy);
} }
} }

View File

@ -93,8 +93,8 @@ class SpaceLimitSettings extends QuotaSettings {
* @param proto The protobuf representation. * @param proto The protobuf representation.
* @return A QuotaSettings. * @return A QuotaSettings.
*/ */
static SpaceLimitSettings fromSpaceQuota(final TableName tableName, static SpaceLimitSettings fromSpaceQuota(
final QuotaProtos.SpaceQuota proto) { final TableName tableName, final QuotaProtos.SpaceQuota proto) {
validateProtoArguments(proto); validateProtoArguments(proto);
return new SpaceLimitSettings(tableName, proto.getSoftLimit(), return new SpaceLimitSettings(tableName, proto.getSoftLimit(),
ProtobufUtil.toViolationPolicy(proto.getViolationPolicy())); ProtobufUtil.toViolationPolicy(proto.getViolationPolicy()));
@ -107,8 +107,8 @@ class SpaceLimitSettings extends QuotaSettings {
* @param proto The protobuf representation. * @param proto The protobuf representation.
* @return A QuotaSettings. * @return A QuotaSettings.
*/ */
static SpaceLimitSettings fromSpaceQuota(final String namespace, static SpaceLimitSettings fromSpaceQuota(
final QuotaProtos.SpaceQuota proto) { final String namespace, final QuotaProtos.SpaceQuota proto) {
validateProtoArguments(proto); validateProtoArguments(proto);
return new SpaceLimitSettings(namespace, proto.getSoftLimit(), return new SpaceLimitSettings(namespace, proto.getSoftLimit(),
ProtobufUtil.toViolationPolicy(proto.getViolationPolicy())); ProtobufUtil.toViolationPolicy(proto.getViolationPolicy()));

View File

@ -2587,7 +2587,8 @@ public final class ProtobufUtil {
* @param proto The protocol buffer space violation policy. * @param proto The protocol buffer space violation policy.
* @return The corresponding client SpaceViolationPolicy. * @return The corresponding client SpaceViolationPolicy.
*/ */
public static SpaceViolationPolicy toViolationPolicy(final QuotaProtos.SpaceViolationPolicy proto) { public static SpaceViolationPolicy toViolationPolicy(
final QuotaProtos.SpaceViolationPolicy proto) {
switch (proto) { switch (proto) {
case DISABLE: return SpaceViolationPolicy.DISABLE; case DISABLE: return SpaceViolationPolicy.DISABLE;
case NO_WRITES_COMPACTIONS: return SpaceViolationPolicy.NO_WRITES_COMPACTIONS; case NO_WRITES_COMPACTIONS: return SpaceViolationPolicy.NO_WRITES_COMPACTIONS;
@ -2638,8 +2639,8 @@ public final class ProtobufUtil {
* @param violationPolicy The policy to apply when the quota is violated. * @param violationPolicy The policy to apply when the quota is violated.
* @return The protocol buffer SpaceQuota. * @return The protocol buffer SpaceQuota.
*/ */
public static QuotaProtos.SpaceQuota toProtoSpaceQuota(final long limit, public static QuotaProtos.SpaceQuota toProtoSpaceQuota(
final SpaceViolationPolicy violationPolicy) { final long limit, final SpaceViolationPolicy violationPolicy) {
return QuotaProtos.SpaceQuota.newBuilder() return QuotaProtos.SpaceQuota.newBuilder()
.setSoftLimit(limit) .setSoftLimit(limit)
.setViolationPolicy(toProtoViolationPolicy(violationPolicy)) .setViolationPolicy(toProtoViolationPolicy(violationPolicy))