Search in sources :

Example 1 with CoSList

use of com.emc.storageos.vasa.data.internal.CoS.CoSList in project coprhd-controller by CoprHD.

the class SyncManager method fetchFileCosIdList.

/**
 * Returns list of file Cos Ids
 *
 * @return list of file CoS ids
 * @throws SOSFailure
 */
private List<String> fetchFileCosIdList() throws SOSFailure {
    final String methodName = "fetchFileCosIdList(): ";
    log.trace(methodName + "Entry");
    final String FILE_COS_URI = "/file/vpools";
    List<String> fileCosIdList = new ArrayList<String>();
    try {
        CoSList cosElemList = _client.queryObject(FILE_COS_URI, CoSList.class);
        if (cosElemList != null && cosElemList.getCosElements() != null) {
            for (CoSElement elem : cosElemList.getCosElements()) {
                if (elem != null) {
                    fileCosIdList.add(elem.getId());
                }
            }
        }
        log.trace(methodName + "File CoS Ids: " + fileCosIdList);
        if (cosElemList != null && fileCosIdList != null) {
            log.trace(methodName + "Exit returning cos list of size[" + fileCosIdList.size() + "]");
            return fileCosIdList;
        }
        log.trace(methodName + "Exit returning cos list of size[0]");
        return new ArrayList<String>();
    } catch (NoSuchAlgorithmException e) {
        log.error(methodName + "NoSuchAlgorithmException occured", e);
        throw new SOSFailure(e);
    } catch (UniformInterfaceException e) {
        log.error(methodName + "UniformInterfaceException occured", e);
        throw new SOSFailure(e);
    }
}
Also used : UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) CoSList(com.emc.storageos.vasa.data.internal.CoS.CoSList) CoSElement(com.emc.storageos.vasa.data.internal.CoS.CoSElement) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 2 with CoSList

use of com.emc.storageos.vasa.data.internal.CoS.CoSList in project coprhd-controller by CoprHD.

the class SyncManager method fetchBlockCosIdList.

/**
 * Returns list of file Cos Ids
 *
 * @return list of file Cos Ids
 * @throws SOSFailure
 */
private List<String> fetchBlockCosIdList() throws SOSFailure {
    final String methodName = "fetchBlockCosIdList(): ";
    log.trace(methodName + "Entry");
    final String BLOCK_COS_URI = "/block/vpools";
    List<String> blockCosIdList = new ArrayList<String>();
    try {
        CoSList cosElemList = _client.queryObject(BLOCK_COS_URI, CoSList.class);
        if (cosElemList != null && cosElemList.getCosElements() != null) {
            for (CoSElement elem : cosElemList.getCosElements()) {
                if (elem != null) {
                    blockCosIdList.add(elem.getId());
                }
            }
        }
        log.trace(methodName + "Block CoS Ids: " + blockCosIdList);
        if (cosElemList != null && blockCosIdList != null) {
            log.trace(methodName + "Exit returning cos list of size[" + blockCosIdList.size() + "]");
            return blockCosIdList;
        }
        log.trace(methodName + "Exit returning cos list of size[0]");
        return new ArrayList<String>();
    } catch (NoSuchAlgorithmException e) {
        log.error(methodName + "NoSuchAlgorithmException occured", e);
        throw new SOSFailure(e);
    } catch (UniformInterfaceException e) {
        log.error(methodName + "UniformInterfaceException occured", e);
        throw new SOSFailure(e);
    }
}
Also used : UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) CoSList(com.emc.storageos.vasa.data.internal.CoS.CoSList) CoSElement(com.emc.storageos.vasa.data.internal.CoS.CoSElement) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Aggregations

CoSElement (com.emc.storageos.vasa.data.internal.CoS.CoSElement)2 CoSList (com.emc.storageos.vasa.data.internal.CoS.CoSList)2 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)2 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 ArrayList (java.util.ArrayList)2