Class AzureConfigurationParserUtils


  • public class AzureConfigurationParserUtils
    extends java.lang.Object
    Utility class for parsing Oak Segment Azure configuration (e.g. connection string, container name, uri, etc.) from custom encoded String or Azure standard URI.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isCustomAzureConnectionString​(java.lang.String conn)  
      static java.util.Map<java.lang.String,​java.lang.String> parseAzureConfigurationFromCustomConnection​(java.lang.String connectionString)
      Parses a custom encoded connection string of the form (line breaks added for clarity):

      DefaultEndpointsProtocol=https;
      AccountName=devstoreaccount1;
      AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
      SharedAccessSignature=mySasToken==;
      BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
      ContainerName=mycontainer;
      Directory=mydir

      where the first 5 lines in the string represent a standard Azure Connection String and the last two lines are Oak Segment Azure specific arguments.
      static java.util.Map<java.lang.String,​java.lang.String> parseAzureConfigurationFromUri​(java.lang.String uriStr)
      Parses a standard Azure URI in the format https://myaccount.blob.core.windows.net/container/repo?sasToken.
      • Methods inherited from class java.lang.Object

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

      • isCustomAzureConnectionString

        public static boolean isCustomAzureConnectionString​(java.lang.String conn)
        Parameters:
        conn - the connection string
        Returns:
        true if this is a custom encoded Azure connection String, false otherwise
      • parseAzureConfigurationFromCustomConnection

        public static java.util.Map<java.lang.String,​java.lang.String> parseAzureConfigurationFromCustomConnection​(java.lang.String connectionString)
        Parses a custom encoded connection string of the form (line breaks added for clarity):

        DefaultEndpointsProtocol=https;
        AccountName=devstoreaccount1;
        AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
        SharedAccessSignature=mySasToken==;
        BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
        ContainerName=mycontainer;
        Directory=mydir

        where the first 5 lines in the string represent a standard Azure Connection String and the last two lines are Oak Segment Azure specific arguments. Please note that all configuration keys are semicolon separated, except for the last entry. The order of keys is not important.
        Parameters:
        connectionString - the connection string
        Returns:
        parsed configuration map containing the Azure connectionString, containerName, dir and sharedAccessSignature (key names in bold)
      • parseAzureConfigurationFromUri

        public static java.util.Map<java.lang.String,​java.lang.String> parseAzureConfigurationFromUri​(java.lang.String uriStr)
        Parses a standard Azure URI in the format https://myaccount.blob.core.windows.net/container/repo?sasToken. The sasToken is optional.
        Parameters:
        uriStr - the Azure URI as string
        Returns:
        parsed configuration map containing accountName, storageUri, dir, and sharedAccessSignature (key names in bold)