/** interface used by rules processor to get sphere for a notifier */
  public String getSphere(String notifier) {

    // get ridden of notifier uri params, if any
    String notifierWithoutParams = notifier.split(";")[0];

    ComposedPublication composedPublication =
        sbb.getPublicationChildSbb().getComposedPublication(notifierWithoutParams, "presence");
    if (composedPublication != null
        && composedPublication.getUnmarshalledContent().getValue() instanceof Presence) {
      Presence presence = (Presence) composedPublication.getUnmarshalledContent().getValue();
      for (Object anyObject : presence.getAny()) {
        JAXBElement anyElement = (JAXBElement) anyObject;
        if (anyElement.getValue() instanceof Person) {
          Person person = (Person) anyElement.getValue();
          for (Object anotherAnyObject : person.getAny()) {
            JAXBElement anotherAnyElement = (JAXBElement) anotherAnyObject;
            if (anotherAnyElement.getValue() instanceof Sphere) {
              Sphere sphere = ((Sphere) anotherAnyElement.getValue());
              String result = null;
              for (Object contentObject : sphere.getContent()) {
                if (contentObject instanceof String) {
                  if (result == null) {
                    result = (String) contentObject;
                  } else {
                    result += " " + (String) contentObject;
                  }
                } else if (contentObject instanceof JAXBElement) {
                  JAXBElement contentElement = (JAXBElement) contentObject;
                  if (result == null) {
                    result = contentElement.getName().getLocalPart();
                  } else {
                    result += " " + contentElement.getName().getLocalPart();
                  }
                }
              }
              return result;
            }
          }
        }
      }
    }
    return null;
  }
  public NotifyContent getNotifyContent(Subscription subscription) {
    try {

      ComposedPublication composedPublication =
          sbb.getPublicationChildSbb()
              .getComposedPublication(
                  subscription.getNotifier(), subscription.getKey().getEventPackage());
      if (composedPublication != null) {
        return new NotifyContent(
            composedPublication.getUnmarshalledContent(),
            sbb.getHeaderFactory()
                .createContentTypeHeader(
                    composedPublication.getContentType(), composedPublication.getContentSubType()));
      }
    } catch (Exception e) {
      logger.error("failed to get notify content", e);
    }
    return null;
  }