Пример #1
0
        /// <summary>Attempt to parse a storage uri with storage class and URI.</summary>
        /// <remarks>
        /// Attempt to parse a storage uri with storage class and URI. The storage
        /// class component of the uri is case-insensitive.
        /// </remarks>
        /// <param name="rawLocation">
        /// Location string of the format [type]uri, where [type] is
        /// optional.
        /// </param>
        /// <returns>
        /// A StorageLocation object if successfully parsed, null otherwise.
        /// Does not throw any exceptions.
        /// </returns>
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Security.SecurityException"/>
        public static Org.Apache.Hadoop.Hdfs.Server.Datanode.StorageLocation Parse(string
                                                                                   rawLocation)
        {
            Matcher     matcher     = regex.Matcher(rawLocation);
            StorageType storageType = StorageType.Default;
            string      location    = rawLocation;

            if (matcher.Matches())
            {
                string classString = matcher.Group(1);
                location = matcher.Group(2);
                if (!classString.IsEmpty())
                {
                    storageType = StorageType.ValueOf(StringUtils.ToUpperCase(classString));
                }
            }
            return(new Org.Apache.Hadoop.Hdfs.Server.Datanode.StorageLocation(storageType, new
                                                                              Path(location).ToUri()));
        }