View Javadoc

1   /*
2    * Copyright (C) 2010 Atlassian
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.atlassian.jira.rest.client.api;
18  
19  import com.atlassian.httpclient.api.HttpClient;
20  
21  import java.net.URI;
22  
23  /**
24   * Factory for producing JIRA REST com.atlassian.jira.client with selected authentication handler
25   *
26   * @since v0.1
27   */
28  public interface JiraRestClientFactory {
29  
30      /**
31       * Creates an instance of JiraRestClient with default HttpClient settings.
32       *
33       * @param serverUri             - URI of JIRA instance.
34       * @param authenticationHandler - requests authenticator.
35       */
36      JiraRestClient create(final URI serverUri, final AuthenticationHandler authenticationHandler);
37  
38      /**
39       * Creates an instance of JiraRestClient with default HttpClient settings. HttpClient will conduct a
40       * basic authentication for given credentials.
41       *
42       * @param serverUri - URI or JIRA instance.
43       * @param username  - username of the user used to log in to JIRA.
44       * @param password  - password of the user used to log in to JIRA.
45       */
46      JiraRestClient createWithBasicHttpAuthentication(final URI serverUri, final String username, final String password);
47  
48      /**
49       * Creates an instance of JiraRestClient with default HttpClient settings. HttpClient will call the provided
50       * authentication handler prior to making requests.
51       *
52       * @param serverUri             - URI or JIRA instance.
53       * @param authenticationHandler - Authentication handler.
54       */
55      JiraRestClient createWithAuthenticationHandler(final URI serverUri, final AuthenticationHandler authenticationHandler);
56  
57      /**
58       * Creates an instance of JiraRestClient with given Atlassian HttpClient.
59       * Please note, that this com.atlassian.jira.rest.client.api has to be fully configured to do the request authentication.
60       *
61       * @param serverUri  - URI of JIRA instance.
62       * @param httpClient - instance of Atlassian HttpClient.
63       */
64      JiraRestClient create(final URI serverUri, final HttpClient httpClient);
65  }