Class CGUtils


  • public class CGUtils
    extends Object
    • Method Detail

      • getCGThriftClient

        public static CloudGatewayService.Client getCGThriftClient​(String hostName,
                                                                   int port,
                                                                   int timeOut,
                                                                   String trustStorePath,
                                                                   String trustStorePassWord)
        Returns an instance of CG_TRANSPORT_NAME thrift client
        Parameters:
        hostName - thrift server host name
        port - thrift server port client should connect to
        timeOut - the thrift client timeout
        trustStorePath - the trust store to use for this client
        trustStorePassWord - the password of the trust store
        Returns:
        a CG_TRANSPORT_NAME thrift client
      • moveElements

        public static void moveElements​(BlockingQueue<Message> src,
                                        List<Message> dest,
                                        int blockSize)
                                 throws org.apache.axis2.AxisFault
        Move elements between buffers. No need of additional synchronization locks, BlockingQueue#drainTo is thread safe, but not atomic, which is not a problem. See BlockingQueue.drainTo(java.util.Collection, int)
        Parameters:
        src - source buffer
        dest - destination buffer
        blockSize - blockSize of message bulk that need to move
        Throws:
        org.apache.axis2.AxisFault - in case of drains fails
      • getKeyStoreFilePath

        public static String getKeyStoreFilePath()
      • getWSO2KeyStoreFilePath

        public static String getWSO2KeyStoreFilePath()
      • getTrustStoreFilePath

        public static String getTrustStoreFilePath()
      • getWSO2TrustStoreFilePath

        public static String getWSO2TrustStoreFilePath()
      • getKeyStorePassWord

        public static String getKeyStorePassWord()
      • getWSO2KeyStorePassword

        public static String getWSO2KeyStorePassword()
      • getTrustStorePassWord

        public static String getTrustStorePassWord()
      • getWSO2TrustStorePassword

        public static String getWSO2TrustStorePassword()
      • handleException

        public static void handleException​(String msg,
                                           Throwable t)
      • getStringProperty

        public static String getStringProperty​(String name,
                                               String def)
      • getIntProperty

        public static int getIntProperty​(String name,
                                         int def)
      • getLongProperty

        public static long getLongProperty​(String name,
                                           long def)
      • getDoubleProperty

        public static double getDoubleProperty​(String name,
                                               double def)
      • getBooleanProperty

        public static Boolean getBooleanProperty​(String name,
                                                 boolean def)
      • getQueueNameFromEPR

        public static String getQueueNameFromEPR​(String targetEPR)
      • getFullUserName

        public static String getFullUserName​(String userName,
                                             String domainName)
      • getCSGServiceName

        public static String getCSGServiceName​(String serviceName,
                                               String userName)
      • getCGThriftServerPort

        public static int getCGThriftServerPort()
      • getPortFromServerURL

        public static String getPortFromServerURL​(String serverURL)
      • getHostFromServerURL

        public static String getHostFromServerURL​(String serverURL)
      • getUserNameFromTenantUserName

        public static String getUserNameFromTenantUserName​(String tenantUserName)
      • getDomainNameFromTenantUserName

        public static String getDomainNameFromTenantUserName​(String tenantUserName)
      • getTryItURLFromWSDLURL

        public static String getTryItURLFromWSDLURL​(String wsdlURL)
      • getPlainToken

        public static String getPlainToken​(String encryptedToken)
                                    throws org.wso2.carbon.core.util.CryptoException
        Throws:
        org.wso2.carbon.core.util.CryptoException
      • isServerAlive

        public static boolean isServerAlive​(String host,
                                            int port)
      • getPermissionsList

        public static String[] getPermissionsList()
      • dumpStringMap

        public static void dumpStringMap​(Map<String,​String> map)