private DatastreamProfile getDSProfile(Datastream ds) throws RepositoryException, IOException {
   logger.trace("Executing getDSProfile() with node: " + ds.getDsId());
   final DatastreamProfile dsProfile = new DatastreamProfile();
   dsProfile.dsID = ds.getDsId();
   dsProfile.pid = ds.getObject().getName();
   logger.trace("Retrieved datastream " + ds.getDsId() + "'s parent: " + dsProfile.pid);
   dsProfile.dsLabel = ds.getLabel();
   logger.trace("Retrieved datastream " + ds.getDsId() + "'s label: " + ds.getLabel());
   dsProfile.dsState = A;
   dsProfile.dsMIME = ds.getMimeType();
   dsProfile.dsSize = getNodePropertySize(ds.getNode()) + ds.getContentSize();
   dsProfile.dsCreateDate = ds.getNode().getProperty("jcr:created").getString();
   return dsProfile;
 }
 /**
  * Get the datastream profile of a datastream
  *
  * @param pid persistent identifier of the digital object
  * @param dsid datastream identifier
  * @return 200
  * @throws RepositoryException
  * @throws IOException
  * @throws TemplateException
  */
 @GET
 @Path("/{dsid}")
 @Produces({TEXT_XML, APPLICATION_JSON})
 public DatastreamProfile getDatastream(
     @PathParam("pid") final String pid, @PathParam("dsid") final String dsId)
     throws RepositoryException, IOException {
   logger.trace("Executing getDatastream() with dsId: " + dsId);
   Datastream ds = DatastreamService.getDatastream(pid, dsId);
   logger.debug("Retrieved dsNode: " + ds.getNode().getName());
   return getDSProfile(ds);
 }