Class CoreUtils


  • public class CoreUtils
    extends java.lang.Object
    Core utility class.
    Version:
    0.9, 27/07/2013
    Author:
    Yuriy Zabrovarnyy
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean allNotBlank​(java.lang.String... p_strings)  
      static java.lang.String cleanUpLog​(java.lang.String log)  
      static org.apache.http.client.HttpClient createClient​(org.apache.http.conn.ssl.SSLConnectionSocketFactory connectionFactory, java.util.Optional<ProxyConfiguration> proxyConfiguration)  
      static org.apache.http.client.HttpClient createClientFallback​(java.util.Optional<ProxyConfiguration> proxyConfiguration)  
      static java.util.concurrent.ScheduledExecutorService createExecutor()  
      static org.apache.http.client.HttpClient createHttpClientForMutualAuthentication​(java.io.File trustStoreFile, java.lang.String trustStorePassword, java.io.File mtlsClientKeyStoreFile, java.lang.String mtlsClientKeyStorePassword, java.lang.String[] tlsVersions, java.lang.String[] tlsSecureCiphers, java.util.Optional<ProxyConfiguration> proxyConfiguration)  
      static org.apache.http.client.HttpClient createHttpClientTrustAll​(java.util.Optional<ProxyConfiguration> proxyConfiguration, java.lang.String[] tlsVersions, java.lang.String[] tlsSecureCiphers)  
      static org.apache.http.client.HttpClient createHttpClientWithKeyStore​(java.io.File trustStoreFile, java.lang.String trustStorePassword, java.lang.String[] tlsVersions, java.lang.String[] tlsSecureCiphers, java.util.Optional<ProxyConfiguration> proxyConfiguration)  
      static java.util.concurrent.ThreadFactory daemonThreadFactory()  
      static boolean isExpired​(java.util.Date expiredAt)  
      static java.lang.String normalizeLengthPrefixString​(int p_length)  
      static long parseSilently​(java.lang.String p_str)  
      static ReadResult readCommand​(java.lang.String p_leftString, java.io.BufferedReader p_reader)  
      static java.lang.String secureRandomString()  
      static void sleep​(int i)  
      static java.util.Map<java.lang.String,​java.lang.String> splitQuery​(java.lang.String url)  
      static java.util.Map<java.lang.String,​java.lang.String> splitQuery​(java.net.URL url)  
      • Methods inherited from class java.lang.Object

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

      • isExpired

        public static boolean isExpired​(java.util.Date expiredAt)
      • createExecutor

        public static java.util.concurrent.ScheduledExecutorService createExecutor()
      • daemonThreadFactory

        public static java.util.concurrent.ThreadFactory daemonThreadFactory()
      • sleep

        public static void sleep​(int i)
      • parseSilently

        public static long parseSilently​(java.lang.String p_str)
      • normalizeLengthPrefixString

        public static java.lang.String normalizeLengthPrefixString​(int p_length)
      • readCommand

        public static ReadResult readCommand​(java.lang.String p_leftString,
                                             java.io.BufferedReader p_reader)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • allNotBlank

        public static boolean allNotBlank​(java.lang.String... p_strings)
      • createHttpClientWithKeyStore

        public static org.apache.http.client.HttpClient createHttpClientWithKeyStore​(java.io.File trustStoreFile,
                                                                                     java.lang.String trustStorePassword,
                                                                                     java.lang.String[] tlsVersions,
                                                                                     java.lang.String[] tlsSecureCiphers,
                                                                                     java.util.Optional<ProxyConfiguration> proxyConfiguration)
                                                                              throws java.lang.Exception
        Parameters:
        trustStoreFile - trust store file, e.g. D:/Development/gluu_conf/etc/certs/DA855F9895A1CA3B9E7D4BF5-java.jks
        trustStorePassword - trust store password
        Returns:
        http client
        Throws:
        java.lang.Exception
      • createHttpClientForMutualAuthentication

        public static org.apache.http.client.HttpClient createHttpClientForMutualAuthentication​(java.io.File trustStoreFile,
                                                                                                java.lang.String trustStorePassword,
                                                                                                java.io.File mtlsClientKeyStoreFile,
                                                                                                java.lang.String mtlsClientKeyStorePassword,
                                                                                                java.lang.String[] tlsVersions,
                                                                                                java.lang.String[] tlsSecureCiphers,
                                                                                                java.util.Optional<ProxyConfiguration> proxyConfiguration)
                                                                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createHttpClientTrustAll

        public static org.apache.http.client.HttpClient createHttpClientTrustAll​(java.util.Optional<ProxyConfiguration> proxyConfiguration,
                                                                                 java.lang.String[] tlsVersions,
                                                                                 java.lang.String[] tlsSecureCiphers)
                                                                          throws java.security.NoSuchAlgorithmException,
                                                                                 java.security.KeyManagementException,
                                                                                 java.security.KeyStoreException
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.KeyManagementException
        java.security.KeyStoreException
      • createClientFallback

        public static org.apache.http.client.HttpClient createClientFallback​(java.util.Optional<ProxyConfiguration> proxyConfiguration)
      • createClient

        public static org.apache.http.client.HttpClient createClient​(org.apache.http.conn.ssl.SSLConnectionSocketFactory connectionFactory,
                                                                     java.util.Optional<ProxyConfiguration> proxyConfiguration)
      • secureRandomString

        public static java.lang.String secureRandomString()
      • splitQuery

        public static java.util.Map<java.lang.String,​java.lang.String> splitQuery​(java.lang.String url)
                                                                                 throws java.io.UnsupportedEncodingException,
                                                                                        java.net.MalformedURLException
        Throws:
        java.io.UnsupportedEncodingException
        java.net.MalformedURLException
      • splitQuery

        public static java.util.Map<java.lang.String,​java.lang.String> splitQuery​(java.net.URL url)
                                                                                 throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException
      • cleanUpLog

        public static java.lang.String cleanUpLog​(java.lang.String log)