• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AgentSession类的典型用法和代码示例

java 4次浏览

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

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

示例1: executeGet

点赞 3

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void executeGet(IQ packet, Workgroup workgroup) {
    IQ reply;
    Element iq = packet.getChildElement();

    // Verify that an agent is requesting this information.
    try {
        AgentSession agentSession = workgroup.getAgentManager().getAgentSession(packet.getFrom());
        if (agentSession != null) {
            String sessionID = iq.element("sessionID").getTextTrim();

            sendNotesPacket(packet, workgroup, sessionID);
        }
        else {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
            workgroup.send(reply);
        }
    }
    catch (AgentNotFoundException e) {
        reply = IQ.createResultIQ(packet);
        reply.setChildElement(packet.getChildElement().createCopy());
        reply.setError(new PacketError(PacketError.Condition.item_not_found));
        workgroup.send(reply);
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:27,
代码来源:ChatNotes.java

示例2: RoundRobinDispatcher

点赞 3

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的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

示例3: sendOffer

点赞 3

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * Sends an offer to the specified agent for this request. The agent may accept or reject
 * the offer. Moreover, the offer may be revoked while the agent hasn't answered it. This
 * may happen for several reasons: request was cancelled, offer timed out, etc.
 *
 * @param session the agent that will get the offer.
 * @param queue queue that is sending the offer.
 * @return true if the offer was sent to the agent.
 */
public boolean sendOffer(AgentSession session, RequestQueue queue) {
    // Keep track of this request by its ID
    requests.put(requestID, this);
    // Create new IQ to Send
    IQ offerPacket = new IQ();
    offerPacket.setFrom(queue.getWorkgroup().getJID());
    offerPacket.setTo(session.getJID());
    offerPacket.setType(IQ.Type.set);

    Element offerElement = offerPacket.setChildElement("offer", "http://jabber.org/protocol/workgroup");
    offerElement.addAttribute("id", requestID);
    offerElement.addAttribute("jid", getUserJID().toString());

    Element metaDataElement = getMetaDataElement();
    offerElement.add(metaDataElement);

    Element timeoutElement = offerElement.addElement("timeout");
    timeoutElement.setText(Long.toString(offer.getTimeout() / 1000));

    offerElement.add(getSessionElement());
    addOfferContent(offerElement);
    return session.sendOffer(offer, offerPacket);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:33,
代码来源:Request.java

示例4: executeSet

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void executeSet(IQ packet, Workgroup workgroup) {
    IQ reply;
    Element iq = packet.getChildElement();

    try {
        // Verify that an agent is requesting this information.
        AgentSession agentSession = workgroup.getAgentManager().getAgentSession(packet.getFrom());
        if (agentSession != null) {
            String sessionID = iq.element("sessionID").getTextTrim();
            Element notes = iq.element("notes");
            String noteText = notes.getTextTrim();
            appendNote(sessionID, noteText);
            reply = IQ.createResultIQ(packet);
        }
        else {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
        }

    }
    catch (AgentNotFoundException e) {
        reply = IQ.createResultIQ(packet);
        reply.setChildElement(packet.getChildElement().createCopy());
        reply.setError(new PacketError(PacketError.Condition.item_not_found));
    }
    workgroup.send(reply);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:29,
代码来源:ChatNotes.java

示例5: validateAgent

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * Returns true if the agent session may receive an offer. An agent session may receive new
 * offers if:
 *
 * 1) the presence status of the agent allows to receive offers
 * 2) the maximum of chats has not been reached for the agent
 * 3) the agent has not rejected the offer before
 * 4) the agent does not have to answer a previuos offer
 *
 * @param session the session to check if it may receive an offer
 * @param offer the offer to send.
 * @return true if the agent session may receive an offer.
 */
private boolean validateAgent(AgentSession session, Offer offer) {
    if (agentSelector.validateAgent(session, offer)) {
        // Log debug trace
        Log.debug("RR - Agent: " + session.getJID() +
                " MAY receive offer for request: " +
                offer.getRequest());
        return true;
    }
    // Log debug trace
    Log.debug("RR - Agent: " + session.getJID() +
            " MAY NOT receive offer for request: " +
            offer.getRequest());
    return false;
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:28,
代码来源:RoundRobinDispatcher.java

示例6: agentJoined

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * Notification message that an Agent has joined a Workgroup.
 *
 * @param workgroup    the workgroup where the agent has joined.
 * @param agentSession the session of the agent that has started.
 */
public static void agentJoined(Workgroup workgroup, AgentSession agentSession) {
    for (WorkgroupEventListener listener : listeners) {
        try {
            listener.agentJoined(workgroup, agentSession);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:17,
代码来源:WorkgroupEventDispatcher.java

示例7: agentDeparted

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * Notification message that an Agent has left a Workgroup.
 *
 * @param workgroup    the workgroup where the agent has left.
 * @param agentSession the session of the agent that has ended.
 */
public static void agentDeparted(Workgroup workgroup, AgentSession agentSession) {
    for (WorkgroupEventListener listener : listeners) {
        try {
            listener.agentDeparted(workgroup, agentSession);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:17,
代码来源:WorkgroupEventDispatcher.java

示例8: agentJoinedChatSupport

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * Notification message that an agent has joined a chat session. The agent could
 * be the initial agent that accepted the initial offer or may be an agent that
 * was invited to participate in the chat or maybe an agent that accepted a chat
 * tranfer.
 *
 * @param workgroup    the workgroup providing the support.
 * @param sessionID    the ID of the session that uniquely identifies the chat.
 * @param agentSession the session of the agent that joined the chat.
 */
public static void agentJoinedChatSupport(Workgroup workgroup, String sessionID,
        AgentSession agentSession) {
    for (WorkgroupEventListener listener : listeners) {
        try {
            listener.agentJoinedChatSupport(workgroup, sessionID, agentSession);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:22,
代码来源:WorkgroupEventDispatcher.java

示例9: agentLeftChatSupport

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * Notification message that an agent has left a chat session.
 *
 * @param workgroup    the workgroup providing the support.
 * @param sessionID    the ID of the session that uniquely identifies the chat.
 * @param agentSession the session of the agent that left the chat.
 */
public static void agentLeftChatSupport(Workgroup workgroup, String sessionID,
        AgentSession agentSession) {
    for (WorkgroupEventListener listener : listeners) {
        try {
            listener.agentLeftChatSupport(workgroup, sessionID, agentSession);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }
}
 

开发者ID:idwanglu2010,
项目名称:openfire,
代码行数:19,
代码来源:WorkgroupEventDispatcher.java

示例10: fillAgentsList

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * <p>Generate the agents offer list.</p>
 */
private void fillAgentsList() {
    AgentSessionList agentSessionList = queue.getAgentSessionList();
    agentSessionList.addAgentSessionListener(this);
    for (AgentSession agentSession : agentSessionList.getAgentSessions()) {
        if (!agentList.contains(agentSession)) {
            agentList.add(agentSession);
        }
    }
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:13,
代码来源:RoundRobinDispatcher.java

示例11: offerAccepted

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
    * Sends an invitation to the agent that previously accepted the offer to join a room.
    * Agents need to join a room to be able to chat (and fulfil the request) with the
    * user that sent the request.
    *
    * @param agentSession the agent that previously accepted the offer.
    */
   @Override
public void offerAccepted(AgentSession agentSession) {
       super.offerAccepted(agentSession);
       // Ask the workgroup to send invitations to the agent and to the user that made the
       // request. The Workgroup will create a MUC room and send invitations to the agent and
       // the user.
       getWorkgroup().sendInvitation(agentSession, this);
   }
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:16,
代码来源:UserRequest.java

示例12: handleUserHistoryRequest

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
private void handleUserHistoryRequest(IQ packet, Workgroup workgroup) {
    IQ reply;
    Element iq = packet.getChildElement();

    try {
        AgentSession agentSession = workgroup.getAgentManager().getAgentSession(packet.getFrom());
        if (agentSession == null) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.not_authorized));
            workgroup.send(reply);
            return;
        }
    }
    catch (AgentNotFoundException e) {
        reply = IQ.createResultIQ(packet);
        reply.setChildElement(packet.getChildElement().createCopy());
        reply.setError(new PacketError(PacketError.Condition.not_authorized));
        workgroup.send(reply);
        return;
    }

    // Define default values
    String sessionID = iq.attribute("sessionID").getText();

    reply = IQ.createResultIQ(packet);

    Element views = reply.setChildElement("site-user-history", "http://jivesoftware.com/protocol/workgroup");
    views.addAttribute("sessionID", sessionID);

    SiteUser siteUser = siteUsers.get(sessionID);
    if (siteUser != null) {
        for (PageView view : siteUser.getViews()) {
            Element pageView = views.addElement("page-view");
            pageView.addElement("title").setText(view.getTitle());
            pageView.addElement("url").setText(view.getUrl());
            pageView.addElement("time").setText(Long.toString(view.getTimeViewed()));
        }

        workgroup.send(reply);
    }

}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:44,
代码来源:SiteTracker.java

示例13: executeGet

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void executeGet(IQ packet, Workgroup workgroup) {
    IQ reply = IQ.createResultIQ(packet);
    try {
        AgentSession agentSession = workgroup.getAgentManager().getAgentSession(packet.getFrom());
        if (agentSession == null) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.not_authorized));
            workgroup.send(reply);
            return;
        }
    }
    catch (AgentNotFoundException e) {
        reply = IQ.createResultIQ(packet);
        reply.setChildElement(packet.getChildElement().createCopy());
        reply.setError(new PacketError(PacketError.Condition.not_authorized));
        workgroup.send(reply);
        return;
    }

    Element chatSessions = reply.setChildElement("chat-metadata", "http://jivesoftware.com/protocol/workgroup");


    Element iq = packet.getChildElement();
    String sessionID = iq.element("sessionID").getTextTrim();

    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    Map<String, String> map = new HashMap<String, String>();
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(GET_SESSION_METADATA);
        pstmt.setString(1, sessionID);
        rs = pstmt.executeQuery();
        while (rs.next()) {
            String name = rs.getString(1);
            String value = rs.getString(2);
            map.put(name, value);
        }
    }
    catch (Exception ex) {
        Log.error(ex.getMessage(), ex);
    }
    finally {
        DbConnectionManager.closeConnection(rs, pstmt, con);
    }

    // Add metadata
    chatSessions.add(getMetaDataElement(map));

    workgroup.send(reply);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:54,
代码来源:ChatMetadataProvider.java

示例14: notifySessionRemoved

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void notifySessionRemoved(AgentSession session) {
    agentList.remove(session);
    for (Offer offer : offers) {
        offer.reject(session);
    }
}
 

开发者ID:idwanglu2010,
项目名称:openfire,
代码行数:7,
代码来源:RoundRobinDispatcher.java

示例15: agentJoinedChatSupport

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentJoinedChatSupport(Workgroup workgroup, String sessionID, AgentSession agentSession) {
}
 

开发者ID:idwanglu2010,
项目名称:openfire,
代码行数:3,
代码来源:EmailTranscriptEvent.java

示例16: agentJoined

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentJoined(Workgroup workgroup, AgentSession agentSession) {
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:3,
代码来源:EmailTranscriptEvent.java

示例17: agentDeparted

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentDeparted(Workgroup workgroup, AgentSession agentSession) {
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:3,
代码来源:EmailTranscriptEvent.java

示例18: agentLeftChatSupport

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentLeftChatSupport(Workgroup workgroup, String sessionID, AgentSession agentSession) {
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:3,
代码来源:EmailTranscriptEvent.java

示例19: bestAgentFrom

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
/**
 * The best agent will be the agent with less number of chats. If more than one agent has
 * the less number of chats then select the agent that never rejected the offer.
 */
public AgentSession bestAgentFrom(List<AgentSession> possibleSessions, Offer offer) {
    Collections.sort(possibleSessions, new SessionComparator(offer));
    int size = possibleSessions.size() - 1;
    return possibleSessions.get(size);
}
 

开发者ID:idwanglu2010,
项目名称:openfire,
代码行数:10,
代码来源:BasicAgentSelector.java

示例20: notifySessionAdded

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void notifySessionAdded(AgentSession session) {
    if (!agentList.contains(session)) {
        agentList.add(session);
    }
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:6,
代码来源:RoundRobinDispatcher.java

示例21: sendOffer

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
@Override
public boolean sendOffer(AgentSession session, RequestQueue queue) {
    // Keep track of the actual entity that received the transfer offer
    actualInvitee = session.getJID();
    return super.sendOffer(session, queue);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:7,
代码来源:TransferRequest.java

示例22: offerAccepted

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
@Override
public void offerAccepted(AgentSession agentSession) {
    super.offerAccepted(agentSession);
    // Keep track when the offer was accepted by the agent
    offerAccpeted = System.currentTimeMillis();
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:7,
代码来源:InvitationRequest.java

示例23: sendOffer

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
@Override
public boolean sendOffer(AgentSession session, RequestQueue queue) {
       // Keep track of the actual entity that received the transfer offer
       actualInvitee = session.getJID();
       return super.sendOffer(session, queue);
   }
 

开发者ID:idwanglu2010,
项目名称:openfire,
代码行数:7,
代码来源:TransferRequest.java

示例24: agentJoined

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentJoined(Workgroup workgroup, AgentSession agentSession) {
    //Do nothing
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:4,
代码来源:ChatSearchManager.java

示例25: agentDeparted

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentDeparted(Workgroup workgroup, AgentSession agentSession) {
    //Do nothing
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:4,
代码来源:ChatSearchManager.java

示例26: agentJoinedChatSupport

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentJoinedChatSupport(Workgroup workgroup, String sessionID,
                                   AgentSession agentSession) {
    //Do nothing
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:5,
代码来源:ChatSearchManager.java

示例27: agentLeftChatSupport

点赞 2

import org.jivesoftware.xmpp.workgroup.AgentSession; //导入依赖的package包/类
public void agentLeftChatSupport(Workgroup workgroup, String sessionID,
                                 AgentSession agentSession) {
    //Do nothing
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:5,
代码来源:ChatSearchManager.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)