ctubbsii commented on code in PR #33:
URL: 
https://github.com/apache/accumulo-classloaders/pull/33#discussion_r2692468460


##########
modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/definition/ContextDefinition.java:
##########
@@ -139,4 +160,29 @@ public String getChecksum() {
   public String toJson() {
     return GSON.toJson(this);
   }
+
+  @Override
+  public String keyword() {
+    return "create-context-definition";
+  }
+
+  @Override
+  public String description() {
+    return "Creates and prints a Context Definition";
+  }
+
+  @Override
+  public void execute(String[] args) throws Exception {
+    URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory(new 
Configuration()));
+
+    Opts opts = new Opts();
+    opts.parseArgs(ContextDefinition.class.getName(), args);
+    URL[] urls = new URL[opts.files.size()];
+    int count = 0;
+    for (String f : opts.files) {
+      urls[count++] = new URL(f);
+    }
+    ContextDefinition def = create(opts.contextName, opts.monitorInterval, 
urls);
+    System.out.println(def.toJson());

Review Comment:
   I think the pretty-printing will add a newline. Either way, we probably 
don't want to add one here, because there won't be one added when we generate 
the checksum after downloading and parsing and computing the checksum for the 
local store file name. So, if you add it here, and that newline is included in 
a pipe to a file, then the checksum of the resulting file won't be the same as 
what shows up in the LocalStore's contexts directory.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to