public String getPresenceStatus(String jid) throws UserNotFoundException {
   log.debug("getPresenceStatus " + jid);
   JID targetJID = new JID(jid);
   User user = userManager.getUser(targetJID.getNode());
   Presence presence = presenceManager.getPresence(user);
   if (presence == null) {
     log.debug("User is offline");
     return "";
   }
   return presence.getStatus();
 }
  public void setPresenceState(String jid, UnifiedPresence.XmppPresence xmppPresence)
      throws UserNotFoundException {
    log.debug("setPresenceState : " + jid + " XmppPresence = " + xmppPresence);
    if (jid == null) {
      throw new UserNotFoundException("Target JID not found in request");
    }
    JID targetJID = new JID(jid);
    // Check that the sender is not requesting information of a remote server entity
    if (targetJID.getDomain() == null || XMPPServer.getInstance().isRemote(targetJID)) {
      throw new UserNotFoundException("Domain does not matches local server domain");
    }
    User user = userManager.getUser(targetJID.getNode());
    Presence presence = presenceManager.getPresence(user);
    if (presence == null) {
      log.debug("User is OFFLINE  -- cannot set presence state");
      return;
    }

    presence.setShow(xmppPresence.asPresenceShowEnum());
    user.getRoster().broadcastPresence(presence);
  }