use of com.vmware.vim.vasa._1_0.InvalidArgument in project coprhd-controller by CoprHD.
the class SOSManager method queryArrays.
/**
* Returns the storage array details for the given storage array Ids
*
* @param arrayId
* @return array of <code>StorageArray</code> objects. Each having details
* of profiles the storage array supports
* @throws InvalidArgument
* @throws InvalidSession
* @throws StorageFault
*/
public synchronized StorageArray[] queryArrays(String[] arrayId) throws InvalidArgument, InvalidSession, StorageFault {
// Mandatory function
final String methodName = "queryArrays(): ";
log.debug(methodName + "Entry");
List<StorageArray> storageArrayList = null;
StorageArray[] arrays = null;
if (!Util.isEmpty(arrayId)) {
log.debug(methodName + "input array ids: " + Arrays.asList(arrayId));
} else {
log.debug(methodName + "input array ids: " + arrayId);
}
try {
String sosArrayId = this.getArrayId();
if (!Util.isEmpty(arrayId)) {
storageArrayList = new ArrayList<StorageArray>();
for (String inputArrayId : arrayId) {
if (!inputArrayId.startsWith(STORAGEARRAY_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given array Id is invalid:[" + arrayId + "]");
}
if (sosArrayId.equals(inputArrayId)) {
StorageArray storageArray = this.getSOSStorageArray();
storageArray.setUniqueIdentifier(inputArrayId);
storageArrayList.add(storageArray);
}
}
return storageArrayList.toArray(new StorageArray[0]);
}
arrays = new StorageArray[1];
StorageArray array = this.getSOSStorageArray();
arrays[0] = array;
} catch (StorageFault e) {
log.error("StorageFault occured", e);
throw e;
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured ", e);
throw e;
}
log.debug(methodName + "Exit returning arrays of size[" + arrays.length + "]");
return arrays;
}
use of com.vmware.vim.vasa._1_0.InvalidArgument in project coprhd-controller by CoprHD.
the class ServiceImpl method handleExceptionsAsStorageFault.
protected void handleExceptionsAsStorageFault(Exception e) throws InvalidArgument, InvalidSession, StorageFault {
if (e instanceof InvalidArgument) {
throw (InvalidArgument) e;
} else if (e instanceof InvalidSession) {
throw (InvalidSession) e;
} else if (e instanceof StorageFault) {
throw (StorageFault) e;
} else {
StorageFault sfe = FaultUtil.StorageFault(e);
sfe.setStackTrace(e.getStackTrace());
throw sfe;
}
}
use of com.vmware.vim.vasa._1_0.InvalidArgument in project coprhd-controller by CoprHD.
the class ServiceImpl method queryArrays.
/**
* Returns array details of the requested arrayIds
*
* @param arrayId
* array of arrayIds
* @return array of StorageArray objects having storage array details
* respectively
* @throws InvalidArgument
* if usage context is incorrect
* @throws InvalidSession
* if session Id is invalid
* @throws StorageFault
* if there is a failure in the underlying storage
*/
public StorageArray[] queryArrays(String[] arrayId) throws InvalidArgument, InvalidSession, StorageFault {
// Mandatory function
final String methodName = "queryArrays(): ";
log.info(methodName + "Entry");
if (arrayId != null) {
log.info(methodName + "input array Ids: " + Arrays.asList(arrayId));
}
// verify valid SSL and VASA Sessions.
sslUtil.checkHttpRequest(true, true);
UsageContext uc = contextManager.getUsageContext();
if (Util.isEmpty(uc.getHostInitiator())) {
StorageArray[] arrays = new StorageArray[0];
log.info(methodName + "Exit returning storage arrays of size[" + (arrays != null ? arrays.length : 0) + "]");
return arrays;
}
SOSManager sosManager = contextManager.getSOSManager();
StorageArray[] arrays = sosManager.queryArrays(arrayId);
log.info(methodName + "Exit returning storage arrays of size[" + (arrays != null ? arrays.length : 0) + "]");
return arrays;
}
Aggregations