xiaoyuyao commented on a change in pull request #847: HDDS-1539. Implement 
addAcl,removeAcl,setAcl,getAcl for Volume. Contributed Ajay Kumar.
URL: https://github.com/apache/hadoop/pull/847#discussion_r288178008
 
 

 ##########
 File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/acl/OzoneObjInfo.java
 ##########
 @@ -69,6 +72,32 @@ public String getKeyName() {
     return keyName;
   }
 
+  public static OzoneObjInfo fromProtobuf(OzoneManagerProtocolProtos.OzoneObj
+      proto) {
+    Builder builder = new Builder()
+        .setResType(ResourceType.valueOf(proto.getResType().name()))
+        .setStoreType(StoreType.valueOf(proto.getStoreType().name()));
+    StringTokenizer tokenizer = new StringTokenizer(proto.getPath(),
+        OzoneConsts.OZONE_URI_DELIMITER);
+    // Set volume name.
+    if (tokenizer.hasMoreTokens()) {
+      builder.setVolumeName(tokenizer.nextToken());
+    }
+    // Set bucket name.
+    if (tokenizer.hasMoreTokens()) {
+      builder.setBucketName(tokenizer.nextToken());
+    }
+    // Set key name
+    StringBuffer sb = new StringBuffer();
 
 Review comment:
   should we wrap line 91-97 with if (tokenizer.hasMoreTokens()) to avoid 
setting empty keyName when keyName is not needed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to