Beispiel #1
0
        IScanner ProcessCreateScannerResponse(IRestResponse response, ScannerOptions options)
        {
            string scannerLocation =
                response.Headers.Where(header => header.Type == ParameterType.HttpHeader && header.Name == RestConstants.LocationHeader)
                .Select(header => header.Value.ToString())
                .FirstOrDefault();

            return(string.IsNullOrEmpty(scannerLocation) ? null : new Scanner(options.TableName, new Uri(scannerLocation).PathAndQuery.Trim('/'), this));
        }
Beispiel #2
0
        /// <summary>
        /// Builds a scanner creation URI.
        /// </summary>
        /// <param name="scannerOptions">Name of the table.</param>
        public string BuildScannerCreate(ScannerOptions scannerOptions)
        {
            if (scannerOptions == null || string.IsNullOrEmpty(scannerOptions.TableName))
            {
                throw new ArgumentException(Resources.ResourceBuilder_MinimumForScannerNotMet);
            }

            return(new StringBuilder(scannerOptions.TableName).AppendFormat(_appendSegmentFormat, _scanner).ToString());
        }
Beispiel #3
0
        T CreateScannerInternal <T>(ScannerOptions options, Func <Method, string, string, string, string, HttpStatusCode[], T> action)
        {
            string resource = ResourceBuilder.BuildScannerCreate(options);

            return(action(Method.PUT, resource, HBaseMimeTypes.Xml, null, ScannerConverter.Convert(options), new[] { HttpStatusCode.Created }));
        }
Beispiel #4
0
 /// <summary>
 ///   Creates the scanner.
 /// </summary>
 /// <param name="options">The options.</param>
 public virtual IScanner CreateScanner(ScannerOptions options)
 {
     return(ProcessCreateScannerResponse(CreateScannerInternal(options, SendRequest), options));
 }
Beispiel #5
0
 /// <summary>
 ///   Creates the scanner.
 /// </summary>
 /// <param name="options">The options.</param>
 public virtual async Task <IScanner> CreateScannerAsync(ScannerOptions options)
 {
     return(ProcessCreateScannerResponse(await CreateScannerInternal(options, SendRequestAsync), options));
 }