/** async get response from xdm client */ public void getResponse(XcapUriKey key, int responseCode, String mimetype, String content) { DocumentSelector documentSelector = null; if (key instanceof DocumentUriKey) { documentSelector = ((DocumentUriKey) key).getDocumentSelector(); } else if (key instanceof AttributeUriKey) { documentSelector = ((AttributeUriKey) key).getDocumentSelector(); } else if (key instanceof ElementUriKey) { documentSelector = ((ElementUriKey) key).getDocumentSelector(); } else { try { documentSelector = Parser.parseDocumentSelector(key.getResourceSelector().getDocumentSelector()); } catch (ParseException e) { // won't happen logger.error("bug, a xcap uri key document selector string could not be parsed", e); } } if (responseCode == 200) { // just simulate a document update documentUpdated(documentSelector, null, null, content); } else { // let's be friendly with clients without xcap, allow subscription String notifierWithoutParams = getUser(documentSelector); if (logger.isInfoEnabled()) { logger.info(notifierWithoutParams + " pres-rules not found, allowing subscription"); } Map combinedRules = sbb.getCombinedRules(); if (combinedRules != null) { for (Object object : combinedRules.keySet()) { PresRuleCMPKey cmpKey = (PresRuleCMPKey) object; if (cmpKey.getNotifierWithoutParams().equals(notifierWithoutParams)) { OMAPresRule combinedRule = (OMAPresRule) combinedRules.get(cmpKey); combinedRule.setProvideAllDevices(true); combinedRule.setProvideAllAttributes(true); combinedRule.setProvideAllPersons(true); combinedRule.setProvideAllServices(true); combinedRule.setSubHandling(SubHandlingAction.allow); // notify auth changed sbb.getParentSbbCMP() .authorizationChanged( cmpKey.getSubscriber(), cmpKey.getNotifier(), "presence", cmpKey.getEventId(), combinedRule.getSubHandling().getResponseCode()); } } sbb.setCombinedRules(combinedRules); } } // subscribe to changes in this pres-rules doc sbb.getXDMClientControlSbb().subscribeDocument(documentSelector); }