use of com.sun.jersey.client.apache.ApacheHttpClient in project coprhd-controller by CoprHD.
the class ECSApiFactory method getRESTClient.
/**
* Create ECS API client
*
* @param endpoint ECS endpoint
* @return
*/
public ECSApi getRESTClient(URI endpoint, String username, String password) {
ECSApi ecsApi = _clientMap.get(endpoint.toString() + ":" + username + ":" + password);
if (ecsApi == null) {
Client jerseyClient = new ApacheHttpClient(_clientHandler);
jerseyClient.addFilter(new HTTPBasicAuthFilter(username, password));
RESTClient restClient = new RESTClient(jerseyClient);
ecsApi = new ECSApi(endpoint, restClient);
_clientMap.putIfAbsent(endpoint.toString() + ":" + username + ":" + password, ecsApi);
}
return ecsApi;
}
use of com.sun.jersey.client.apache.ApacheHttpClient in project coprhd-controller by CoprHD.
the class RestClientFactory method getRESTClient.
public RestClientItf getRESTClient(URI endpoint, String username, String password) {
RestClientItf clientApi = _clientMap.get(endpoint.toString() + ":" + username + ":" + password);
if (clientApi == null) {
Client jerseyClient = new ApacheHttpClient(_clientHandler);
clientApi = createNewRestClient(endpoint, username, password, jerseyClient);
_clientMap.putIfAbsent(endpoint.toString() + ":" + username + ":" + password, clientApi);
}
return clientApi;
}
use of com.sun.jersey.client.apache.ApacheHttpClient in project coprhd-controller by CoprHD.
the class RestClientFactory method getRESTClient.
public RestClientItf getRESTClient(URI endpoint, String username, String password, boolean authFilter) {
RestClientItf clientApi = _clientMap.get(endpoint.toString() + ":" + username + ":" + password);
if (clientApi == null) {
Client jerseyClient = new ApacheHttpClient(_clientHandler);
if (authFilter) {
jerseyClient.addFilter(new HTTPBasicAuthFilter(username, password));
}
clientApi = createNewRestClient(endpoint, username, password, jerseyClient);
_clientMap.putIfAbsent(endpoint.toString() + ":" + username + ":" + password, clientApi);
}
return clientApi;
}
use of com.sun.jersey.client.apache.ApacheHttpClient in project coprhd-controller by CoprHD.
the class XtremIOClientFactory method getRESTClient.
public RestClientItf getRESTClient(URI endpoint, String username, String password, String version, boolean authFilter) {
// removed caching RestClient session as it is not actually a session, just a java RestClient object
// RestClientItf clientApi = _clientMap.get(endpoint.toString() + ":" + username + ":" + password + ":" + model);
Client jerseyClient = new ApacheHttpClient(_clientHandler);
if (authFilter) {
jerseyClient.addFilter(new HTTPBasicAuthFilter(username, password));
}
RestClientItf clientApi = createNewRestClient(endpoint, username, password, version, jerseyClient);
return clientApi;
}
use of com.sun.jersey.client.apache.ApacheHttpClient in project coprhd-controller by CoprHD.
the class VPlexApiFactory method getClient.
/**
* Get the VPlex API client for the VPlex Management Station identified
* by the passed endpoint suing the passed username and password.
*
* @param endpoint VPlex Management Station endpoint URI.
* @param username The user name to authenticate.
* @param password The password to authenticate.
*
* @return Reference to a VPlexApiClient.
*/
public synchronized VPlexApiClient getClient(URI endpoint, String username, String password) {
// Make the key dependent on user and password in case they
// change for a client endpoint.
StringBuilder clientKeyBuilder = new StringBuilder();
clientKeyBuilder.append(endpoint.toString());
clientKeyBuilder.append("_");
clientKeyBuilder.append(username);
clientKeyBuilder.append("_");
clientKeyBuilder.append(password);
String clientKey = clientKeyBuilder.toString();
VPlexApiClient vplexApiClient = _clientMap.get(clientKey);
if (vplexApiClient == null) {
s_logger.info("Creating new VPLEX client for the management server {}", endpoint);
Client jerseyClient = new ApacheHttpClient(_clientHandler);
RESTClient restClient = new RESTClient(jerseyClient, username, password);
vplexApiClient = new VPlexApiClient(endpoint, restClient);
_clientMap.putIfAbsent(clientKey, vplexApiClient);
}
return vplexApiClient;
}
Aggregations