AbderaClient abderaClient = new AbderaClient(abdera);
final Factory factory = abdera.getFactory();
Element el = factory.newElement(APPConstants.QN_ASSOC);
el.setAttributeValue(APPConstants.ASSOC_TYPE, associationType);
el.setText(associationPaths);
ClientResponse resp = abderaClient.post(baseURI + APPConstants.ATOM +
encodeURL(sourcePath +
RegistryConstants.URL_SEPARATOR +
APPConstants.ASSOCIATIONS),
el,
getAuthorization());
if (resp.getType() == Response.ResponseType.SUCCESS) {
if (log.isDebugEnabled()) {
log.debug("associating " + sourcePath + " to " + associationPaths +
" type " + associationType + " succeeded" +
", Response Status: " + resp.getStatus() +
", Response Type: " + resp.getType());
}
abderaClient.teardown();
} else {
String msg = "associating " + sourcePath + " to " + associationPaths +
" type " + associationType + "failed" +
", Response Status: " + resp.getStatus() +
", Response Type: " + resp.getType();
abderaClient.teardown();
log.error(msg);
throw new RegistryException(msg);
}
}