use of com.emc.storageos.hp3par.impl.HP3PARException in project coprhd-controller by CoprHD.
the class HP3PARApiFactory method getRESTClient.
/**
* Create HP3PAR API client
*
* @param endpoint
* @param username
* @param password
* @return api client
* @throws HP3PARException
*/
public HP3PARApi getRESTClient(URI endpoint, String username, String password) throws HP3PARException {
try {
_log.info("3PARDriver:getRESTClient");
// key=uri+user+pass to make unique, value=HP3PARApi object
HP3PARApi hp3parApi = _clientMap.get(endpoint.toString() + ":" + username + ":" + password);
if (hp3parApi == null) {
_log.info("3PARDriver:getRESTClient1 hp3parApi null");
ClientHandler handler = new URLConnectionClientHandler();
Client connClient = new Client(handler, configureClient());
RESTClient restClient = new RESTClient(connClient);
hp3parApi = new HP3PARApi(endpoint, restClient, username, password);
_clientMap.putIfAbsent(endpoint.toString() + ":" + username + ":" + password, hp3parApi);
}
return hp3parApi;
} catch (Exception e) {
e.printStackTrace();
_log.error("3PARDriver:getRESTClient Error in getting RESTclient");
throw new HP3PARException(e.toString());
}
}
use of com.emc.storageos.hp3par.impl.HP3PARException in project coprhd-controller by CoprHD.
the class HP3PARUtil method getHP3PARDeviceFromNativeId.
public HP3PARApi getHP3PARDeviceFromNativeId(String nativeId, Registry driverRegistry) throws HP3PARException {
try {
Map<String, List<String>> connectionInfo = driverRegistry.getDriverAttributesForKey(HP3PARConstants.DRIVER_NAME, nativeId);
List<String> ipAddress = connectionInfo.get(HP3PARConstants.IP_ADDRESS);
List<String> portNumber = connectionInfo.get(HP3PARConstants.PORT_NUMBER);
List<String> userName = connectionInfo.get(HP3PARConstants.USER_NAME);
List<String> password = connectionInfo.get(HP3PARConstants.PASSWORD);
HP3PARApi hp3parApi = getHP3PARDevice(ipAddress.get(0), portNumber.get(0), userName.get(0), password.get(0));
return hp3parApi;
} catch (Exception e) {
e.printStackTrace();
_log.error("3PARDriver:Error in getting 3PAR device with nativeId");
throw new HP3PARException("Error in getting 3PAR device");
}
}
use of com.emc.storageos.hp3par.impl.HP3PARException in project coprhd-controller by CoprHD.
the class HP3PARUtil method getHP3PARDevice.
public HP3PARApi getHP3PARDevice(String ip, String port, String user, String pass) throws HP3PARException {
URI deviceURI;
_log.info("3PARDriver:getHP3PARDevice input full details");
try {
deviceURI = new URI("https", null, ip, Integer.parseInt(port), "/", null, null);
return hp3parApiFactory.getRESTClient(deviceURI, user, pass);
} catch (Exception e) {
e.printStackTrace();
_log.error("3PARDriver:Error in getting 3PAR device with details");
throw new HP3PARException("Error in getting 3PAR device");
}
}
use of com.emc.storageos.hp3par.impl.HP3PARException in project coprhd-controller by CoprHD.
the class HP3PARUtil method getHP3PARDevice.
public HP3PARApi getHP3PARDevice(StorageSystem hp3parSystem) throws HP3PARException {
URI deviceURI;
_log.info("3PARDriver:getHP3PARDevice input storage system");
try {
deviceURI = new URI("https", null, hp3parSystem.getIpAddress(), hp3parSystem.getPortNumber(), "/", null, null);
return hp3parApiFactory.getRESTClient(deviceURI, hp3parSystem.getUsername(), hp3parSystem.getPassword());
} catch (Exception e) {
e.printStackTrace();
_log.error("3PARDriver:Error in getting 3PAR device, with StorageSystem");
throw new HP3PARException("Error in getting 3PAR device");
}
}
Aggregations