Package com.taskadapter.redmineapi
Class RedmineManagerFactory
- java.lang.Object
-
- com.taskadapter.redmineapi.RedmineManagerFactory
-
public final class RedmineManagerFactory extends java.lang.Object
Entry point for the API. Use this class to communicate with Redmine servers.Collection of creation methods for the redmine. Method number may grow as grows number of requirements. However, having all creation methods in one place allows us to refactor RemineManager internals without changing this external APIs. Moreover, we can create "named constructor" for redmine instances. This will allow us to have many construction methods with the same signature.
Sample usage:
RedmineManager redmineManager = RedmineManagerFactory.createWithUserAuth(redmineURI, login, password);
- See Also:
RedmineManager
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.apache.http.conn.ClientConnectionManager
createConnectionManager(org.apache.http.conn.ssl.SSLSocketFactory sslSocketFactory)
static org.apache.http.conn.ClientConnectionManager
createConnectionManagerWithClientCertificate(java.security.KeyStore keyStore, java.lang.String keyStorePassword, java.util.Collection<java.security.KeyStore> trustStores)
Creates a connection manager with extended trust relations and Client Certificate authentication.static org.apache.http.conn.ClientConnectionManager
createConnectionManagerWithExtraTrust(java.util.Collection<java.security.KeyStore> trustStores)
Creates a connection manager with extended trust relations.static org.apache.http.conn.ClientConnectionManager
createDefaultConnectionManager()
Creates default connection manager.static org.apache.http.client.HttpClient
createDefaultHttpClient(java.lang.String uri)
static org.apache.http.conn.ClientConnectionManager
createInsecureConnectionManager()
Deprecated.Use better key-managed factory with additional keystores.static org.apache.http.conn.ClientConnectionManager
createSystemDefaultConnectionManager()
Creates system default connection manager.static RedmineManager
createUnauthenticated(java.lang.String uri)
Creates a non-authenticating redmine manager.static RedmineManager
createUnauthenticated(java.lang.String uri, org.apache.http.client.HttpClient httpClient)
Creates a non-authenticating redmine manager.static RedmineManager
createWithApiKey(java.lang.String uri, java.lang.String apiAccessKey)
Creates an instance of RedmineManager class.static RedmineManager
createWithApiKey(java.lang.String uri, java.lang.String apiAccessKey, org.apache.http.client.HttpClient httpClient)
Creates an instance of RedmineManager class.static RedmineManager
createWithUserAuth(java.lang.String uri, java.lang.String login, java.lang.String password)
Creates a new RedmineManager with user-based authentication.static RedmineManager
createWithUserAuth(java.lang.String uri, java.lang.String authenticationCharset, java.lang.String login, java.lang.String password, org.apache.http.client.HttpClient httpClient)
Creates a new redmine manager with user-based authentication.static RedmineManager
createWithUserAuth(java.lang.String uri, java.lang.String login, java.lang.String password, org.apache.http.client.HttpClient httpClient)
Creates a new redmine manager with user-based authentication.static org.apache.http.client.HttpClient
getNewHttpClient(java.lang.String uri, org.apache.http.conn.ClientConnectionManager connectionManager)
Helper method to create an http client from connection manager.
-
-
-
Method Detail
-
createUnauthenticated
public static RedmineManager createUnauthenticated(java.lang.String uri)
Creates a non-authenticating redmine manager.- Parameters:
uri
- redmine manager URI.
-
createUnauthenticated
public static RedmineManager createUnauthenticated(java.lang.String uri, org.apache.http.client.HttpClient httpClient)
Creates a non-authenticating redmine manager.- Parameters:
uri
- redmine manager URI.httpClient
- you can provide your own pre-configured HttpClient if you want to control connection pooling, manage connections eviction, closing, etc.
-
createWithApiKey
public static RedmineManager createWithApiKey(java.lang.String uri, java.lang.String apiAccessKey)
Creates an instance of RedmineManager class. Host and apiAccessKey are not checked at this moment.- Parameters:
uri
- complete Redmine server web URI, including protocol and port number. Example: http://demo.redmine.org:8080apiAccessKey
- Redmine API access key. It is shown on "My Account" / "API access key" webpage (check http://redmine_server_url/my/account URL). This parameter is optional (can be set to NULL) for Redmine projects, which are "public".
-
createWithApiKey
public static RedmineManager createWithApiKey(java.lang.String uri, java.lang.String apiAccessKey, org.apache.http.client.HttpClient httpClient)
Creates an instance of RedmineManager class. Host and apiAccessKey are not checked at this moment.- Parameters:
uri
- complete Redmine server web URI, including protocol and port number. Example: http://demo.redmine.org:8080apiAccessKey
- Redmine API access key. It is shown on "My Account" / "API access key" webpage (check http://redmine_server_url/my/account URL). This parameter is optional (can be set to NULL) for Redmine projects, which are "public".httpClient
- Http Client. you can provide your own pre-configured HttpClient if you want to control connection pooling, manage connections eviction, closing, etc.
-
createWithUserAuth
public static RedmineManager createWithUserAuth(java.lang.String uri, java.lang.String login, java.lang.String password)
Creates a new RedmineManager with user-based authentication.- Parameters:
uri
- redmine manager URI.login
- user's name.password
- user's password.
-
createWithUserAuth
public static RedmineManager createWithUserAuth(java.lang.String uri, java.lang.String login, java.lang.String password, org.apache.http.client.HttpClient httpClient)
Creates a new redmine manager with user-based authentication. This method will use UTF-8 when converting login plus password into Base64-encoded blob. Please use another "create" method in this class if you want to use some other encoding. although... why would you? please save the world and use UTF-8 encoding where possible.- Parameters:
uri
- redmine manager URI.login
- user's name.password
- user's password.httpClient
- you can provide your own pre-configured HttpClient if you want to control connection pooling, manage connections eviction, closing, etc.
-
createWithUserAuth
public static RedmineManager createWithUserAuth(java.lang.String uri, java.lang.String authenticationCharset, java.lang.String login, java.lang.String password, org.apache.http.client.HttpClient httpClient)
Creates a new redmine manager with user-based authentication.- Parameters:
uri
- redmine manager URI.authenticationCharset
- charset to use when converting login and password to Base64-encoded stringlogin
- user's name.password
- user's password.httpClient
- you can provide your own pre-configured HttpClient if you want to control connection pooling, manage connections eviction, closing, etc.
-
createInsecureConnectionManager
@Deprecated public static org.apache.http.conn.ClientConnectionManager createInsecureConnectionManager()
Deprecated.Use better key-managed factory with additional keystores.Creates default insecure connection manager.- Returns:
- default insecure connection manager.
-
createConnectionManagerWithExtraTrust
public static org.apache.http.conn.ClientConnectionManager createConnectionManagerWithExtraTrust(java.util.Collection<java.security.KeyStore> trustStores) throws java.security.KeyManagementException, java.security.KeyStoreException
Creates a connection manager with extended trust relations. It would use both default system trusted certificates as well as all certificates defined in thetrustStores
.- Parameters:
trustStores
- list of additional trust stores to be included in the trust chain. The server will be validated against all system-provided CAs and all the ones provided via this list.- Returns:
- connection manager with extended trust relationship.
- Throws:
java.security.KeyManagementException
java.security.KeyStoreException
-
createConnectionManagerWithClientCertificate
public static org.apache.http.conn.ClientConnectionManager createConnectionManagerWithClientCertificate(java.security.KeyStore keyStore, java.lang.String keyStorePassword, java.util.Collection<java.security.KeyStore> trustStores) throws java.security.KeyManagementException, java.security.KeyStoreException
Creates a connection manager with extended trust relations and Client Certificate authentication. It would use both default system trusted certificates as well as all certificates defined in thetrustStores
.- Parameters:
keyStore
- key store containing the client certificate to use.keyStorePassword
- the keyStore password string.trustStores
- list of additional trust stores to be included in the trust chain. The server will be validated against all system-provided CAs and all the ones provided via this list.- Returns:
- connection manager with extended trust relationship.
- Throws:
java.security.KeyManagementException
java.security.KeyStoreException
-
createDefaultConnectionManager
public static org.apache.http.conn.ClientConnectionManager createDefaultConnectionManager()
Creates default connection manager.
-
createSystemDefaultConnectionManager
public static org.apache.http.conn.ClientConnectionManager createSystemDefaultConnectionManager()
Creates system default connection manager. Takes in account system properties for SSL configuration.- Returns:
- default insecure connection manager.
-
createConnectionManager
public static org.apache.http.conn.ClientConnectionManager createConnectionManager(org.apache.http.conn.ssl.SSLSocketFactory sslSocketFactory)
-
createDefaultHttpClient
public static org.apache.http.client.HttpClient createDefaultHttpClient(java.lang.String uri)
-
getNewHttpClient
public static org.apache.http.client.HttpClient getNewHttpClient(java.lang.String uri, org.apache.http.conn.ClientConnectionManager connectionManager)
Helper method to create an http client from connection manager. This new client is configured to use system proxy (if any).
-
-