Search in sources :

Example 16 with Query

use of com.emc.nas.vnxfile.xmlapi.Query in project coprhd-controller by CoprHD.

the class VNXFileArgsCreator method fetchStoragePortGroupInfo.

/**
 * Create VNX Information input request xml and return its stream after
 * marshalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @return
 * @throws VNXFilePluginException
 */
public InputStream fetchStoragePortGroupInfo(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Creating VNX Port group Query...");
    InputStream iStream = null;
    try {
        Query query = new Query();
        MoverQueryParams dataMovers = new MoverQueryParams();
        com.emc.nas.vnxfile.xmlapi.MoverQueryParams.AspectSelection selection = new com.emc.nas.vnxfile.xmlapi.MoverQueryParams.AspectSelection();
        selection.setMovers(true);
        dataMovers.setAspectSelection(selection);
        query.getQueryRequestChoice().add(dataMovers);
        iStream = _vnxFileInputRequestBuilder.getQueryParamPacket(dataMovers, false);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for celerra port group info", jaxbException.getCause());
    }
    return iStream;
}
Also used : MoverQueryParams(com.emc.nas.vnxfile.xmlapi.MoverQueryParams) Query(com.emc.nas.vnxfile.xmlapi.Query) InputStream(java.io.InputStream) AspectSelection(com.emc.nas.vnxfile.xmlapi.FileSystemQueryParams.AspectSelection) JAXBException(javax.xml.bind.JAXBException)

Example 17 with Query

use of com.emc.nas.vnxfile.xmlapi.Query in project coprhd-controller by CoprHD.

the class VNXFileArgsCreator method fetchFileSystemInfoWithSize.

/**
 * Create Filesystem information and FileSystem capcacity input XML request and returns stream after marshalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @return
 * @throws VNXFilePluginException
 */
public InputStream fetchFileSystemInfoWithSize(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Creating filesystem info query");
    InputStream iStream = null;
    try {
        Query query = new Query();
        FileSystemQueryParams fsQueryParam = new FileSystemQueryParams();
        AspectSelection selection = new AspectSelection();
        selection.setFileSystems(true);
        selection.setFileSystemCapacityInfos(true);
        fsQueryParam.setAspectSelection(selection);
        query.getQueryRequestChoice().add(fsQueryParam);
        iStream = _vnxFileInputRequestBuilder.getQueryParamPacket(fsQueryParam, true);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for fileSystem info", jaxbException.getCause());
    }
    return iStream;
}
Also used : FileSystemQueryParams(com.emc.nas.vnxfile.xmlapi.FileSystemQueryParams) Query(com.emc.nas.vnxfile.xmlapi.Query) InputStream(java.io.InputStream) AspectSelection(com.emc.nas.vnxfile.xmlapi.FileSystemQueryParams.AspectSelection) JAXBException(javax.xml.bind.JAXBException)

Example 18 with Query

use of com.emc.nas.vnxfile.xmlapi.Query in project coprhd-controller by CoprHD.

the class VNXFileArgsCreator method fetchStoragePortInfo.

/**
 * Create VNX Information input request xml and return its stream after
 * marshalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @return
 * @throws VNXFilePluginException
 */
public InputStream fetchStoragePortInfo(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Creating VNX Port query");
    InputStream iStream = null;
    try {
        Query query = new Query();
        MoverQueryParams dataMovers = new MoverQueryParams();
        com.emc.nas.vnxfile.xmlapi.MoverQueryParams.AspectSelection selection = new com.emc.nas.vnxfile.xmlapi.MoverQueryParams.AspectSelection();
        selection.setMoverInterfaces(true);
        dataMovers.setAspectSelection(selection);
        query.getQueryRequestChoice().add(dataMovers);
        iStream = _vnxFileInputRequestBuilder.getQueryParamPacket(dataMovers, false);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for celerra storage port info", jaxbException.getCause());
    }
    return iStream;
}
Also used : MoverQueryParams(com.emc.nas.vnxfile.xmlapi.MoverQueryParams) Query(com.emc.nas.vnxfile.xmlapi.Query) InputStream(java.io.InputStream) AspectSelection(com.emc.nas.vnxfile.xmlapi.FileSystemQueryParams.AspectSelection) JAXBException(javax.xml.bind.JAXBException)

Example 19 with Query

use of com.emc.nas.vnxfile.xmlapi.Query in project coprhd-controller by CoprHD.

the class VNXFileArgsCreator method fetchCifsServerParams.

/**
 * Create CIFS Config XML request and return stream after marhalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @throws com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException
 */
public InputStream fetchCifsServerParams(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Creating CIFS Server Params Query");
    InputStream iStream = null;
    try {
        String moverId = (String) keyMap.get(VNXFileConstants.MOVER_ID);
        String isVDM = (String) keyMap.get(VNXFileConstants.ISVDM);
        CifsServerQueryParams cifsQuery = new CifsServerQueryParams();
        MoverOrVdmRef mover = new MoverOrVdmRef();
        Boolean moverIsVdm = new Boolean(false);
        if (moverId != null) {
            mover.setMover(moverId);
            if (isVDM != null) {
                if (isVDM.equalsIgnoreCase("true")) {
                    moverIsVdm = new Boolean(true);
                }
            }
            mover.setMoverIdIsVdm(moverIsVdm);
            cifsQuery.setMoverOrVdm(mover);
        }
        Query query = new Query();
        query.getQueryRequestChoice().add(cifsQuery);
        iStream = _vnxFileInputRequestBuilder.getQueryParamPacket(cifsQuery, false);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for  Cifs server info", jaxbException.getCause());
    }
    return iStream;
}
Also used : Query(com.emc.nas.vnxfile.xmlapi.Query) InputStream(java.io.InputStream) JAXBException(javax.xml.bind.JAXBException) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef) CifsServerQueryParams(com.emc.nas.vnxfile.xmlapi.CifsServerQueryParams)

Example 20 with Query

use of com.emc.nas.vnxfile.xmlapi.Query in project coprhd-controller by CoprHD.

the class VNXFileInputRequestBuilder method getQueryParamPacket.

/**
 * Marshal the generated XML for a given QueryParam.
 *
 * @param queryParam : queryParam object.
 * @return
 */
public InputStream getQueryParamPacket(Object queryParam, boolean is_1_2_VerionToSet) throws JAXBException {
    InputStream inputStream = null;
    List<Request> requests = new ArrayList<Request>(1);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    RequestPacket requestPacket = new RequestPacket();
    try {
        Query query = new Query();
        query.getQueryRequestChoice().add(queryParam);
        Request request = new Request();
        request.setQuery(query);
        requests.add(request);
        _logger.info("API Version to set {}", is_1_2_VerionToSet);
        if (is_1_2_VerionToSet) {
            _logger.info("Setting the API Version on Request Packet");
            APIVersion apiVer = APIVersion.V_1_2;
            requestPacket.setApiVersion(apiVer);
        }
        requestPacket.getRequestOrRequestEx().addAll(requests);
        _marshaller.marshal(requestPacket, outputStream);
        inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    } finally {
        try {
            outputStream.close();
        } catch (IOException e) {
            _logger.error("Exception occurred while closing the stream due to ", e);
        }
    }
    return inputStream;
}
Also used : RequestPacket(com.emc.nas.vnxfile.xmlapi.RequestPacket) Query(com.emc.nas.vnxfile.xmlapi.Query) APIVersion(com.emc.nas.vnxfile.xmlapi.APIVersion) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Request(com.emc.nas.vnxfile.xmlapi.Request) ArrayList(java.util.ArrayList) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Aggregations

Query (com.emc.nas.vnxfile.xmlapi.Query)20 InputStream (java.io.InputStream)20 JAXBException (javax.xml.bind.JAXBException)19 AspectSelection (com.emc.nas.vnxfile.xmlapi.FileSystemQueryParams.AspectSelection)10 FileSystemQueryParams (com.emc.nas.vnxfile.xmlapi.FileSystemQueryParams)5 MoverQueryParams (com.emc.nas.vnxfile.xmlapi.MoverQueryParams)4 FileSystemAlias (com.emc.nas.vnxfile.xmlapi.FileSystemAlias)3 CifsServerQueryParams (com.emc.nas.vnxfile.xmlapi.CifsServerQueryParams)2 MoverOrVdmRef (com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef)2 APIVersion (com.emc.nas.vnxfile.xmlapi.APIVersion)1 CelerraSystemQueryParams (com.emc.nas.vnxfile.xmlapi.CelerraSystemQueryParams)1 CheckpointQueryParams (com.emc.nas.vnxfile.xmlapi.CheckpointQueryParams)1 MountQueryParams (com.emc.nas.vnxfile.xmlapi.MountQueryParams)1 NfsExportQueryParams (com.emc.nas.vnxfile.xmlapi.NfsExportQueryParams)1 Request (com.emc.nas.vnxfile.xmlapi.Request)1 RequestPacket (com.emc.nas.vnxfile.xmlapi.RequestPacket)1 StoragePoolQueryParams (com.emc.nas.vnxfile.xmlapi.StoragePoolQueryParams)1 TreeQuotaQueryParams (com.emc.nas.vnxfile.xmlapi.TreeQuotaQueryParams)1 UserAccountQueryParams (com.emc.nas.vnxfile.xmlapi.UserAccountQueryParams)1 VdmQueryParams (com.emc.nas.vnxfile.xmlapi.VdmQueryParams)1