use of com.emc.ecs.management.entity.NamespaceDetail in project ecs-dashboard by carone1.
the class NamespaceBO method collectNamespaceDetails.
/**
* Gathers all namespaces details present on a cluster
*
* @return List - List of namespace details
*/
public void collectNamespaceDetails(Date collectionTime) {
// Start collecting namespace data details from ECS systems
List<Namespace> namespaceList = getNamespaces();
// At this point we should have all the namespace supported by the ECS
// system
long objCounter = 0;
for (Namespace namespace : namespaceList) {
LOGGER.info("Collecting Details for namespace: " + namespace.getName());
NamespaceDetail namespaceDetail = client.getNamespaceDetails(namespace.getId());
if (namespaceDetail == null) {
continue;
}
objCounter++;
// Push collected details into datastore
if (namespaceDAO != null) {
// insert something
namespaceDAO.insert(namespaceDetail, collectionTime);
}
}
// peg global counter
this.objectCount.getAndAdd(objCounter);
}
use of com.emc.ecs.management.entity.NamespaceDetail in project ecs-dashboard by carone1.
the class FileNamespaceDAO method insert.
/**
* {@inheritDoc}
*/
@Override
public void insert(NamespaceDetail namespaceDetail, Date collectionTime) {
JAXBContext jaxbContext;
try {
jaxbContext = JAXBContext.newInstance(NamespaceDetail.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
OutputStream byteOut = new ByteArrayOutputStream();
jaxbMarshaller.marshal(namespaceDetail, byteOut);
String bytesOutStr = byteOut.toString();
System.out.println(bytesOutStr);
if (this.destinationPath != null) {
// could write the formatted output to a file too
}
} catch (JAXBException e) {
throw new RuntimeException(e.getLocalizedMessage());
}
}
use of com.emc.ecs.management.entity.NamespaceDetail in project ecs-dashboard by carone1.
the class ManagementClient method getNamespaceDetails.
/**
* Returns namespace specific details
* @return NamespaceDetail
*/
public NamespaceDetail getNamespaceDetails(String namespaceid) {
String authToken = getAuthToken();
WebResource mgmtResource = this.mgmtClient.resource(uri);
StringBuilder restStr = new StringBuilder();
restStr.append(REST_LIST_NAMESPACES);
restStr.append("/namespace/");
restStr.append(namespaceid);
// Get Namespace Detail Ressource
WebResource getNamespaceDetailResource = mgmtResource.path(restStr.toString());
NamespaceDetail namespaceDetailResponse = getNamespaceDetailResource.header(X_SDS_AUTH_TOKEN, authToken).get(NamespaceDetail.class);
return namespaceDetailResponse;
}
Aggregations