Class GorJavaUtilities


  • public class GorJavaUtilities
    extends java.lang.Object
    Created by sigmar on 21/12/15.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createMapString​(java.util.Map<java.lang.String,​java.lang.String> createMap)  
      static org.gorpipe.model.gor.iterators.RowSource getDbIteratorSource​(java.lang.String sqlQuery, boolean gortable, java.lang.String source, boolean scoping)  
      static java.util.Optional<java.lang.String> getIgnoreCase​(java.util.Collection<java.lang.String> c, java.lang.String str)  
      static java.lang.String[] mergeArrays​(java.lang.String[] array1, java.lang.String[] array2)  
      static java.lang.String projectDataReplacement​(java.lang.String projectRoot, java.lang.String myCommand)  
      static java.lang.String projectReplacement​(java.lang.String myCommand, java.lang.String projectRoot, java.lang.String requestId, java.lang.String securityContext)  
      static java.lang.String projectReplacement​(java.lang.String myCommand, org.gorpipe.gor.session.GorSession session)  
      static java.util.Map<java.lang.String,​GorJavaUtilities.CmdParams> readWhiteList​(java.lang.String cmdConfigFile)  
      static java.util.Map<java.lang.String,​GorJavaUtilities.CmdParams> readWhiteList​(java.nio.file.Path cmdConfigPath)  
      static java.nio.file.Path resolveWhiteListFilePath​(java.lang.String whiteListFile, java.nio.file.Path projectRoot)
      Helper method to resolve whitelist file path (from config file) to full path.
      static java.lang.String seekReplacement​(java.lang.String myCommand, java.lang.String chr, int start, int stop)  
      static java.lang.String[] splitResourceHints​(java.lang.String query, java.lang.String validStart)  
      static java.util.List<org.gorpipe.gor.model.Row> stream2RowList​(java.util.stream.Stream<org.gorpipe.gor.model.Row> str)  
      static java.lang.String[] toUppercase​(java.util.Collection<java.lang.String> c)  
      static java.util.stream.Stream<java.lang.String> wrapObjectArrayIterator​(java.util.Iterator<java.lang.Object[]> iterator)
      Helper method for wrapping Object[] iterator to Stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GorJavaUtilities

        public GorJavaUtilities()
    • Method Detail

      • splitResourceHints

        public static java.lang.String[] splitResourceHints​(java.lang.String query,
                                                            java.lang.String validStart)
      • createMapString

        public static java.lang.String createMapString​(java.util.Map<java.lang.String,​java.lang.String> createMap)
      • stream2RowList

        public static java.util.List<org.gorpipe.gor.model.Row> stream2RowList​(java.util.stream.Stream<org.gorpipe.gor.model.Row> str)
      • seekReplacement

        public static java.lang.String seekReplacement​(java.lang.String myCommand,
                                                       java.lang.String chr,
                                                       int start,
                                                       int stop)
      • projectReplacement

        public static java.lang.String projectReplacement​(java.lang.String myCommand,
                                                          org.gorpipe.gor.session.GorSession session)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • projectReplacement

        public static java.lang.String projectReplacement​(java.lang.String myCommand,
                                                          java.lang.String projectRoot,
                                                          java.lang.String requestId,
                                                          java.lang.String securityContext)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • projectDataReplacement

        public static java.lang.String projectDataReplacement​(java.lang.String projectRoot,
                                                              java.lang.String myCommand)
                                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getDbIteratorSource

        public static org.gorpipe.model.gor.iterators.RowSource getDbIteratorSource​(java.lang.String sqlQuery,
                                                                                    boolean gortable,
                                                                                    java.lang.String source,
                                                                                    boolean scoping)
      • wrapObjectArrayIterator

        public static java.util.stream.Stream<java.lang.String> wrapObjectArrayIterator​(java.util.Iterator<java.lang.Object[]> iterator)
        Helper method for wrapping Object[] iterator to Stream.
        Parameters:
        iterator -
        Returns:
        Stream where iterator elements are represented as string joined with tab delimiter
      • readWhiteList

        public static java.util.Map<java.lang.String,​GorJavaUtilities.CmdParams> readWhiteList​(java.nio.file.Path cmdConfigPath)
      • readWhiteList

        public static java.util.Map<java.lang.String,​GorJavaUtilities.CmdParams> readWhiteList​(java.lang.String cmdConfigFile)
                                                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • resolveWhiteListFilePath

        public static java.nio.file.Path resolveWhiteListFilePath​(java.lang.String whiteListFile,
                                                                  java.nio.file.Path projectRoot)
        Helper method to resolve whitelist file path (from config file) to full path.

        If whitelist path is resolved as follows: 1. If input is absolute or empty then it is returned. 2. Search relative for the project directory. 3. If nothing is found we return the input.

        Parameters:
        whiteListFile - white list file path, can not be null or emtpy.
        projectRoot - project root for the current project.
        Returns:
        fully resolved path to the whitelist file.
      • getIgnoreCase

        public static java.util.Optional<java.lang.String> getIgnoreCase​(java.util.Collection<java.lang.String> c,
                                                                         java.lang.String str)
      • toUppercase

        public static java.lang.String[] toUppercase​(java.util.Collection<java.lang.String> c)
      • mergeArrays

        public static java.lang.String[] mergeArrays​(java.lang.String[] array1,
                                                     java.lang.String[] array2)