metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwallen <...@git.apache.org>
Subject [GitHub] metron pull request #740: METRON-1167 Define Session Specific Global Configu...
Date Fri, 08 Sep 2017 16:53:40 GMT
Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/metron/pull/740#discussion_r137838874
  
    --- Diff: metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/StellarShell.java
---
    @@ -308,17 +315,68 @@ private void handleMagic( String rawExpression) {
                   .collect(Collectors.joining(", "));
           writeLine(functions);
     
    -    } else if(MAGIC_VARS.equals(command)) {
    +    } else if (MAGIC_VARS.equals(command)) {
     
    -      // list all variables
    +      // '%vars' -> list all variables in scope
           executor.getVariables()
    -              .forEach((k,v) -> writeLine(String.format("%s = %s", k, v)));
    +              .forEach((k, v) -> writeLine(String.format("%s = %s", k, v)));
    +
    +    } else if (MAGIC_GLOBALS.equals(command)) {
    +
    +      // '%globals' -> list all globals in scope
    +      Map<String, Object> globals = Collections.emptyMap();
    --- End diff --
    
    It is just not strictly needed since if I start out with an empty map and there is no
global config in Zk, then we are just left with the empty map, so we're good.  So functionally
getOrCreate is not needed here.
    
    That being said, I can see how it would bring a nice sense of symmetry to just use getOrCreate
in this case also.  Let me try that out real quick.
    



---

Mime
View raw message