* @param id the identifier of the object whose metadata to delete.
* @param tags the list of metadata tags to delete.
*/
public void deleteUserMetadata(Identifier id, MetadataTags tags) {
if (tags == null) {
throw new EsuException("Must specify tags to delete");
}
try {
String resource = getResourcePath(context, id);
String query = "metadata/user";
URL u = buildUrl(resource, query);
HttpURLConnection con = (HttpURLConnection) u.openConnection();
// Build headers
Map<String, String> headers = new HashMap<String, String>();
headers.put("x-emc-uid", uid);
// process tags
if (tags != null) {
processTags(tags, headers);
}
// Add date
headers.put("Date", getDateHeader());
// Sign request
signRequest("DELETE", resource, query, headers);
configureRequest( con, "DELETE", headers );
con.connect();
// Check response
if (con.getResponseCode() > 299) {
handleError(con);
}
con.disconnect();
} catch (MalformedURLException e) {
throw new EsuException("Invalid URL", e);
} catch (IOException e) {
throw new EsuException("Error connecting to server", e);
} catch (GeneralSecurityException e) {
throw new EsuException("Error computing request signature", e);
} catch (URISyntaxException e) {
throw new EsuException("Invalid URL", e);
}
}