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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations