当前位置: 首页>>代码示例>>Java>>正文


Java NotFoundException类代码示例

本文整理汇总了Java中org.jivesoftware.util.NotFoundException的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException类的具体用法?Java NotFoundException怎么用?Java NotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NotFoundException类属于org.jivesoftware.util包,在下文中一共展示了NotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateVCard

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Handles when a user updates their vcard.
 *
 * @param username User that updated their vcard.
 * @param vCardElement vCard element containing the new vcard.
 * @throws UnsupportedOperationException If an invalid field is changed or we are in readonly mode.
 */
@Override
public Element updateVCard(String username, Element vCardElement) throws UnsupportedOperationException {
    if (dbStorageEnabled && defaultProvider != null) {
        if (isValidVCardChange(username, vCardElement)) {
            Element mergedVCard = getMergedVCard(username, vCardElement);
            try {
                defaultProvider.updateVCard(username, mergedVCard);
            } catch (NotFoundException e) {
                try {
                    defaultProvider.createVCard(username, mergedVCard);
                } catch (AlreadyExistsException e1) {
                    // Ignore
                }
            }
            return mergedVCard;
        }
        else {
            throw new UnsupportedOperationException("LdapVCardProvider: Invalid vcard changes.");
        }
    }
    else {
        throw new UnsupportedOperationException("LdapVCardProvider: VCard changes not allowed.");
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:LdapVCardProvider.java

示例2: updateRegistration

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Updates a registration via the web interface.
 *
 *
 * @param registrationID ID number associated with registration to modify.
 * @param legacyUsername User's updated username on the legacy service.
 * @param legacyPassword User's updated password on the legacy service, null if no change.
 * @param legacyNickname User's updated nickname on the legacy service.
 * @return Error message or null on success.
 */
public String updateRegistration(Integer registrationID, String legacyUsername, String legacyPassword, String legacyNickname) {
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
    try {
        Registration reg = new Registration(registrationID);
        if (!plugin.getTransportInstance(reg.getTransportType().toString()).isEnabled()) {
            return LocaleUtils.getLocalizedString("gateway.web.registrations.notenabled", "kraken");
        }
        reg.setUsername(legacyUsername);
        if (legacyPassword != null) {
            reg.setPassword(legacyPassword);
        }
        reg.setNickname(legacyNickname);
        return null;
    }
    catch (NotFoundException e) {
        // Ok, nevermind.
        Log.error("Not found while editing id "+registrationID, e);
        return LocaleUtils.getLocalizedString("gateway.web.registrations.regnotfound", "kraken");
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:32,代码来源:ConfigManager.java

示例3: loadAvatar

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Loads an avatar if one is available.
 *
 * Pulls from cache.  If nothing is in cache, we attempt to check their vcard info.
 */
private void loadAvatar() {
    if (JiveGlobals.getBooleanProperty("plugin.gateway."+getTransport().getType()+".avatars", true)) {
        try {
            this.avatar = new Avatar(jid);
        }
        catch (NotFoundException e) {
            Element vcardElem = VCardManager.getInstance().getVCard(jid.getNode());
            if (vcardElem != null) {
                Element photoElem = vcardElem.element("PHOTO");
                if (photoElem != null) {
                    Element typeElem = photoElem.element("TYPE");
                    Element binElem = photoElem.element("BINVAL");
                    if (typeElem != null && binElem != null) {
                        byte[] imageData = Base64.decode(binElem.getText());
                        this.avatar = new Avatar(jid, imageData);
                    }
                }
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:TransportSession.java

示例4: updateContact

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
   * @see net.sf.kraken.session.TransportSession#updateContact(net.sf.kraken.roster.TransportBuddy)
   */
  @Override
  public void updateContact(SimpleBuddy contact) {
Log.debug("SimpleSession(" + jid.getNode() + ").updateContact:  I was called!");

      JID    destJid    = contact.getJID();
      String destId     = getTransport().convertJIDToID(destJid);

      PseudoRosterItem rosterItem;
      if (pseudoRoster.hasItem(destId)) {
          rosterItem = pseudoRoster.getItem(destId);
          rosterItem.setNickname(contact.getNickname());
      }
      else {
          rosterItem = pseudoRoster.createItem(destId, contact.getNickname(), null);
      }

      try {
          SimpleBuddy simpleBuddy = getBuddyManager().getBuddy(destJid);
          simpleBuddy.pseudoRosterItem = rosterItem;
      }
      catch (NotFoundException e) {
          Log.debug("SIMPLE: Newly added buddy not found in buddy manager: "+destId);
      }
  }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:28,代码来源:SimpleSession.java

示例5: updateContact

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * @see net.sf.kraken.session.TransportSession#updateContact(net.sf.kraken.roster.TransportBuddy)
 */
@Override
public void updateContact(SimpleBuddy contact) {
    Log.debug("SimpleSession(" + jid.getNode() + ").updateContact:  I was called!");

    JID    destJid    = contact.getJID();
    String destId     = getTransport().convertJIDToID(destJid);

    PseudoRosterItem rosterItem;
    if (pseudoRoster.hasItem(destId)) {
        rosterItem = pseudoRoster.getItem(destId);
        rosterItem.setNickname(contact.getNickname());
    }
    else {
        rosterItem = pseudoRoster.createItem(destId, contact.getNickname(), null);
    }

    try {
        SimpleBuddy simpleBuddy = getBuddyManager().getBuddy(destJid);
        simpleBuddy.pseudoRosterItem = rosterItem;
    }
    catch (NotFoundException e) {
        Log.debug("SIMPLE: Newly added buddy not found in buddy manager: "+destId);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:28,代码来源:SimpleSession.java

示例6: processIncomingMessage

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
public void processIncomingMessage(StatusMessage msgPacket) {
    Log.debug("MySpaceIM: Received status message packet: "+msgPacket);
    if (getSession().getBuddyManager().isActivated()) {
        try {
            MySpaceIMBuddy buddy = getSession().getBuddyManager().getBuddy(getSession().getTransport().convertIDToJID(msgPacket.getFrom()));
            buddy.setPresenceAndStatus(
                    ((MySpaceIMTransport)getSession().getTransport()).convertMySpaceIMStatusToXMPP(msgPacket.getStatusCode()),
                    msgPacket.getStatusMessage()
            );
        }
        catch (NotFoundException e) {
            // Not in our contact list.  Ignore.
            Log.debug("MySpaceIM: Received presense notification for contact we don't care about: "+msgPacket.getFrom());
        }
    }
    else {
        getSession().getBuddyManager().storePendingStatus(getSession().getTransport().convertIDToJID(msgPacket.getFrom()), ((MySpaceIMTransport)getSession().getTransport()).convertMySpaceIMStatusToXMPP(msgPacket.getStatusCode()), msgPacket.getStatusMessage());
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:20,代码来源:MySpaceIMListener.java

示例7: processFriendChangeStatus

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Handles an event where a friend changes their status.
 * 
 * @param p Event representing change.
 */
private void processFriendChangeStatus(FriendChangeStatusPacket p) {
    Log.debug("QQ: Processing friend status change event");
    try {
        if (getSession().getBuddyManager().isActivated()) {
            try {
                QQBuddy qqBuddy = getSession().getBuddyManager().getBuddy(getSession().getTransport().convertIDToJID(String.valueOf(p.friendQQ)));
                qqBuddy.setPresenceAndStatus(((QQTransport)getSession().getTransport()).convertQQStatusToXMPP(p.status), null);
            }
            catch (NotFoundException ee) {
                // Not in our list.
                Log.debug("QQ: Received presense notification for contact we don't care about: "+String.valueOf(p.friendQQ));
            }
        }
        else {
            getSession().getBuddyManager().storePendingStatus(getSession().getTransport().convertIDToJID(String.valueOf(p.friendQQ)), ((QQTransport)getSession().getTransport()).convertQQStatusToXMPP(p.status), null);
        }
    } catch (Exception ex) {
        Log.error("Failed to handle friend status change event: ", ex);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:QQListener.java

示例8: storePendingStatus

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Stores a status setting to be recorded after the buddy manager has been activated.
 * This is typically used when status's arrive before the buddy list is activated.
 *
 * @param jid JID of the contact to set status for later.
 * @param presence Presence of contact.
 * @param status verbose status string of contact.
 */
public synchronized void storePendingStatus(JID jid, PresenceType presence, String status) {
    if (!isActivated()) {
        pendingPresences.put(jid, presence);
        pendingVerboseStatuses.put(jid, status);
    }
    else {
        try {
            B buddy = getBuddy(jid);
            buddy.setPresenceAndStatus(presence, status);
        }
        catch (NotFoundException e) {
            // Alrighty then....
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:24,代码来源:TransportBuddyManager.java

示例9: TransportBuddy

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Creates a TransportBuddy instance.
 *
 * @param manager Transport buddy manager we are associated with.
 * @param contactname The legacy contact name.
 * @param nickname The legacy nickname (can be null).
 * @param groups The list of groups the legacy contact is in (can be null).
 */
public TransportBuddy(TransportBuddyManager manager, String contactname, String nickname, Collection<String> groups) {
    this.managerRef = new WeakReference<TransportBuddyManager>(manager);
    this.jid = manager.getSession().getTransport().convertIDToJID(contactname);
    this.contactname = manager.getSession().getTransport().convertJIDToID(this.jid);
    if (nickname != null) {
        this.nickname = nickname;
    }
    else {
        this.nickname = this.contactname;
    }
    if (groups != null && !groups.isEmpty()) {
        this.groups = groups;
    }
    if (JiveGlobals.getBooleanProperty("plugin.gateway."+getManager().getSession().getTransport().getType()+".avatars", true)) {
        try {
            this.avatar = new Avatar(this.jid);
            this.avatarSet = true;
        }
        catch (NotFoundException e) {
            // Ok then, no avatar, no worries.
        }
    }
    lastActivityTimestamp = new Date().getTime();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:33,代码来源:TransportBuddy.java

示例10: addVCardPhoto

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Adds the PHOTO vcard element (representing an avatar) to an existing vcard.
 *
 * This will add the avatar to a vcard if there's one to add.  Otherwise will not add anything.
 * If added, a properly formatted PHOTO element with base64 encoded data in it will be added.
 * 
 * param vcard vcard to add PHOTO element to
 */
public void addVCardPhoto(Element vcard) {
    if (!avatarSet) {
        Log.debug("TransportBuddy: I've got nothing! (no avatar set)");
        return;
    }
    Element photo = vcard.addElement("PHOTO");
    if (avatar != null) {
        try {
            photo.addElement("TYPE").addCDATA(avatar.getMimeType());
            photo.addElement("BINVAL").addCDATA(avatar.getImageData());
        }
        catch (NotFoundException e) {
            // No problem, leave it empty then.
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:25,代码来源:TransportBuddy.java

示例11: getImageData

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Retrieves the actual image data for this avatar.
 *
 * @return The base64 encoded image data for the avatar.
 * @throws NotFoundException if avatar entry was not found in database.
 */
public String getImageData() throws NotFoundException {
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String imageData = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(RETRIEVE_IMAGE);
        pstmt.setString(1, jid.toString());
        rs = pstmt.executeQuery();
        if (!rs.next()) {
            throw new NotFoundException("Avatar not found for " + jid);
        }
        imageData = rs.getString(1);
    }
    catch (SQLException sqle) {
        Log.error(sqle);
    }
    finally {
        DbConnectionManager.closeConnection(rs, pstmt, con);
    }
    return imageData;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:30,代码来源:Avatar.java

示例12: loadFromDb

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Load avatar from database.
 *
 * @throws NotFoundException if avatar entry was not found in database.
 */
private void loadFromDb() throws NotFoundException {
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(LOAD_AVATAR);
        pstmt.setString(1, jid.toString());
        rs = pstmt.executeQuery();
        if (!rs.next()) {
            throw new NotFoundException("Avatar not found for " + jid);
        }
        this.xmppHash = rs.getString(1);
        this.legacyIdentifier = rs.getString(2);
        this.createDate = new Date(rs.getLong(3));
        this.lastUpdate = new Date(rs.getLong(4));
        this.mimeType = rs.getString(5);
    }
    catch (SQLException sqle) {
        Log.error(sqle);
    }
    finally {
        DbConnectionManager.closeConnection(rs, pstmt, con);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:Avatar.java

示例13: logoutSession

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
    * Logs out session via the web interface.
    *
    *
    * @param registrationID ID number associated with registration to log off.
    * @return registration ID on success, -1 on failure (-1 so that js cb_logoutSession knows which Div to edit)
   */

public Integer logoutSession(Integer registrationID)
{
	try
	{
		PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
		KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
		Registration registration = new Registration(registrationID);
		if (!plugin.getTransportInstance(registration.getTransportType().toString()).isEnabled()) {
               return -1;
           }
		JID jid = registration.getJID();
		TransportSession session = plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().getSessionManager().getSession(jid);
		plugin.getTransportInstance(registration.getTransportType().toString()).getTransport().registrationLoggedOut(session);
		return registrationID;
	}
	catch(NotFoundException e)
	{
		return -1;
	}
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:29,代码来源:ConfigManager.java

示例14: RoundRobinDispatcher

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
/**
 * Creates a new dispatcher for the queue. The dispatcher will have a Timer with a unique task
 * that will get the requests from the queue and will try to send an offer to the agents.
 *
 * @param queue the queue that contains the requests and the agents that may attend the
 *        requests.
 */
public RoundRobinDispatcher(RequestQueue queue) {
    this.queue = queue;
    agentList = new LinkedList<AgentSession>();
    properties = new JiveLiveProperties("fpDispatcherProp", queue.getID());
    try {
        info = infoProvider.getDispatcherInfo(queue.getWorkgroup(), queue.getID());
    }
    catch (NotFoundException e) {
        Log.error("Queue ID " + queue.getID(), e);
    }
    // Recreate the agentSelector to use for selecting the best agent to receive the offer
    loadAgentSelector();

    // Fill the list of AgentSessions that are active in the queue.  Once the list has been
    // filled this dispatcher will be notified when new AgentSessions join the queue or leave
    // the queue
    fillAgentsList();

    TaskEngine.getInstance().scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            checkForNewRequests();
        }
    }, 2000, 2000);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:33,代码来源:RoundRobinDispatcher.java

示例15: sendPrivatePacket

import org.jivesoftware.util.NotFoundException; //导入依赖的package包/类
public void sendPrivatePacket(Packet packet, MUCRole senderRole) throws NotFoundException {
    String resource = packet.getTo().getResource();
    MUCRole occupant = occupants.get(resource.toLowerCase());
    if (occupant != null) {
        packet.setFrom(senderRole.getRoleAddress());
        occupant.send(packet);
        if(packet instanceof Message) {
           Message message = (Message) packet;
             MUCEventDispatcher.privateMessageRecieved(occupant.getUserAddress(), senderRole.getUserAddress(),
                     message);
        }
    }
    else {
        throw new NotFoundException();
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:LocalMUCRoom.java


注:本文中的org.jivesoftware.util.NotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。