[ 
https://issues.apache.org/jira/browse/KNOX-1742?focusedWorklogId=374998&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-374998
 ]

ASF GitHub Bot logged work on KNOX-1742:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Jan/20 14:38
            Start Date: 21/Jan/20 14:38
    Worklog Time Spent: 10m 
      Work Description: lmccay commented on pull request #241: KNOX-1742 - 
Simple SQL Client in KnoxShell for access to JDBC sources
URL: https://github.com/apache/knox/pull/241#discussion_r369037891
 
 

 ##########
 File path: 
gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
 ##########
 @@ -593,21 +594,42 @@ public String toString() {
     String s = JsonUtils.renderAsJsonString(map);
     String home = System.getProperty("user.home");
     try {
-      write(new File(home + File.separator + ".knoxshell" + File.separator + 
fileName), s);
+      write(new File(
+          home + File.separator + ".knoxshell" + File.separator + fileName),
+          s, StandardCharsets.UTF_8);
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 
-  private static void write(File file, String s) throws IOException {
+  /**
+   * Persist provided Map to a file within the {user.home}/.knoxshell directory
+   * @param <T>
+   * @param fileName of persisted file
+   * @param map to persist
+   */
+  public static <T> void persistDataSourcesToKnoxShell(String fileName, 
Map<String, T> map) {
+    String s = JsonUtils.renderAsJsonString(map);
+    String home = System.getProperty("user.home");
+    try {
+      write(new File(
+          home + File.separator +
+          ".knoxshell" + File.separator + fileName),
+          s, StandardCharsets.UTF_8);
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
+
+  private static void write(File file, String s, Charset utf8) throws 
IOException {
 
 Review comment:
   Ahhh - had a merge conflict with that and thought someone else must have 
added it. I see now that you removed for the javadoc error patch.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 374998)
    Time Spent: 50m  (was: 40m)

> Simple SQL Client in KnoxShell for access to JDBC datasources
> -------------------------------------------------------------
>
>                 Key: KNOX-1742
>                 URL: https://issues.apache.org/jira/browse/KNOX-1742
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: KnoxShell
>            Reporter: Larry McCay
>            Assignee: Larry McCay
>            Priority: Major
>             Fix For: 1.5.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Let's take the following wiki article example and make it an actual feature 
> of KnoxShell: 
> https://cwiki.apache.org/confluence/display/KNOX/SQL+Client+Example+using+KnoxShell+in+Apache+Knox
> In order to make it a generic feature, we will need to do a number of things:
> # add a lib directory
> # add the HiveDriver - *maybe* - perhaps it is better to have the user 
> download the right version?
> # add commons-logging jar to lib directory
> # add a real table rendering class to the KnoxShell rather than embedded in 
> the SQL client script - so that other features and scripts can use it to 
> render results
> # add the knoxline.sh and hive2.groovy script to bin directory



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to