Skip to content

Commit

Permalink
[SMALLFIX] Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
apc999 committed Sep 20, 2017
1 parent 6758292 commit ef31f08
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
14 changes: 0 additions & 14 deletions core/common/src/main/java/alluxio/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@ public final class Constants {

public static final String EXTENSION_JAR = ".jar";

public static final String LS_FORMAT_PERMISSION = "%-11s";
public static final String LS_FORMAT_FILE_SIZE = "%15s";
public static final String LS_FORMAT_CREATE_TIME = "%24s";
public static final String LS_FORMAT_ALLUXIO_STATE = "%5s";
public static final String LS_FORMAT_PERSISTENCE_STATE = "%16s";
public static final String LS_FORMAT_USER_NAME = "%-15s";
public static final String LS_FORMAT_GROUP_NAME = "%-15s";
public static final String LS_FORMAT_FILE_PATH = "%-5s";
public static final String LS_FORMAT = LS_FORMAT_PERMISSION + LS_FORMAT_USER_NAME
+ LS_FORMAT_GROUP_NAME + LS_FORMAT_FILE_SIZE + LS_FORMAT_PERSISTENCE_STATE
+ LS_FORMAT_CREATE_TIME + LS_FORMAT_ALLUXIO_STATE + " " + LS_FORMAT_FILE_PATH + "%n";
public static final String LS_FORMAT_NO_ACL = LS_FORMAT_FILE_SIZE + LS_FORMAT_PERSISTENCE_STATE
+ LS_FORMAT_CREATE_TIME + LS_FORMAT_ALLUXIO_STATE + " " + LS_FORMAT_FILE_PATH + "%n";

public static final String MESOS_RESOURCE_CPUS = "cpus";
public static final String MESOS_RESOURCE_MEM = "mem";
public static final String MESOS_RESOURCE_DISK = "disk";
Expand Down
18 changes: 15 additions & 3 deletions shell/src/main/java/alluxio/cli/fs/command/LsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package alluxio.cli.fs.command;

import alluxio.AlluxioURI;
import alluxio.Constants;
import alluxio.client.file.FileSystem;
import alluxio.client.file.URIStatus;
import alluxio.client.file.options.ListStatusOptions;
Expand Down Expand Up @@ -43,6 +42,19 @@
public final class LsCommand extends WithWildCardPathCommand {
public static final String IN_ALLUXIO_STATE_DIR = "DIR";
public static final String IN_ALLUXIO_STATE_FILE_FORMAT = "%d%%";
public static final String LS_FORMAT_PERMISSION = "%-11s";
public static final String LS_FORMAT_FILE_SIZE = "%15s";
public static final String LS_FORMAT_CREATE_TIME = "%24s";
public static final String LS_FORMAT_ALLUXIO_STATE = "%5s";
public static final String LS_FORMAT_PERSISTENCE_STATE = "%16s";
public static final String LS_FORMAT_USER_NAME = "%-15s";
public static final String LS_FORMAT_GROUP_NAME = "%-15s";
public static final String LS_FORMAT_FILE_PATH = "%-5s";
public static final String LS_FORMAT_NO_ACL = LS_FORMAT_FILE_SIZE + LS_FORMAT_PERSISTENCE_STATE
+ LS_FORMAT_CREATE_TIME + LS_FORMAT_ALLUXIO_STATE + " " + LS_FORMAT_FILE_PATH + "%n";
public static final String LS_FORMAT = LS_FORMAT_PERMISSION + LS_FORMAT_USER_NAME
+ LS_FORMAT_GROUP_NAME + LS_FORMAT_FILE_SIZE + LS_FORMAT_PERSISTENCE_STATE
+ LS_FORMAT_CREATE_TIME + LS_FORMAT_ALLUXIO_STATE + " " + LS_FORMAT_FILE_PATH + "%n";

private static final Option FORCE_OPTION =
Option.builder("f")
Expand Down Expand Up @@ -110,11 +122,11 @@ public static String formatLsString(boolean hSize, boolean acl, boolean isFolder
}

if (acl) {
return String.format(Constants.LS_FORMAT, permission, userName, groupName,
return String.format(LS_FORMAT, permission, userName, groupName,
sizeStr, persistenceState, CommonUtils.convertMsToDate(createTimeMs),
inAlluxioState, path);
} else {
return String.format(Constants.LS_FORMAT_NO_ACL, sizeStr,
return String.format(LS_FORMAT_NO_ACL, sizeStr,
persistenceState, CommonUtils.convertMsToDate(createTimeMs), inAlluxioState, path);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package alluxio.cli.fs.command;

import alluxio.AlluxioURI;
import alluxio.Constants;
import alluxio.LocalAlluxioClusterResource;
import alluxio.PropertyKey;
import alluxio.client.WriteType;
Expand Down Expand Up @@ -53,7 +52,7 @@ private String getLsResultStr(String path, long createTime, int size, String inA
String persistenceState)
throws IOException, AlluxioException {
return String
.format(Constants.LS_FORMAT, FormatUtils.formatMode((short) permission, isDir),
.format(LsCommand.LS_FORMAT, FormatUtils.formatMode((short) permission, isDir),
testUser, testGroup, String.valueOf(size), persistenceState,
CommonUtils.convertMsToDate(createTime), inAlluxioState, path);
}
Expand Down Expand Up @@ -82,7 +81,7 @@ private String getLsNoAclResultStr(String path, long createTime, boolean hSize,
} else {
sizeStr = hSize ? FormatUtils.getSizeFromBytes(size) : String.valueOf(size);
}
return String.format(Constants.LS_FORMAT_NO_ACL, sizeStr, persistenceState,
return String.format(LsCommand.LS_FORMAT_NO_ACL, sizeStr, persistenceState,
CommonUtils.convertMsToDate(createTime), inAlluxioState, path);
}

Expand Down

0 comments on commit ef31f08

Please sign in to comment.