agentinfosubscriber.java
来自「《移动Agent技术》一书的所有章节源代码。」· Java 代码 · 共 82 行
JAVA
82 行
/* AgentInfoSubscriber.java * $Id: AgentInfoSubscriber.java,v 2.3 1997-11-19 19:22:41+09 ht Exp $ $Name: alpha5_1-release $ */package com.ibm.acl.kqmlsample.travel;import java.util.*;import com.ibm.acl.kqml.*;// demo useimport java.awt.Frame;/** * * * @version $Revision: 2.3 $ $Date: 1997-11-19 19:22:41+09 $ * @author Hajime Tsuchitani */public class AgentInfoSubscriber extends Subscriber{ private static final String rcsid = "$Id: AgentInfoSubscriber.java,v 2.3 1997-11-19 19:22:41+09 ht Exp $ $Name: alpha5_1-release $"; /** * variable description goes here */ private boolean forever = false; private long timeout; private Conversation conv = null; private Object agent = null; private Frame frame; public AgentInfoSubscriber(Conversation conv, Object agent) { super(conv, agent, 0); } public AgentInfoSubscriber(Conversation conv, Object agent, long timeout) { super(conv, agent, timeout); } public AgentInfoSubscriber(Conversation conv, Object agent, Frame frame) { super(conv, agent, 0); this.frame = frame; } public synchronized boolean handleResult(ReturnValue rtn, Object agent) { System.err.println("> AgentInfoSubscriber.handleResult entered"); if (rtn.getReturnValue() instanceof Vector) { AgentInfo agentinfo = new AgentInfo(); Vector agentInfos = (Vector)rtn.getReturnValue(); Enumeration enum = agentInfos.elements(); while (enum.hasMoreElements()) { agentinfo = (AgentInfo)enum.nextElement(); System.err.println("AgentInfoSubscriber.handleResult"); System.err.print(" -- Name : "); System.err.println(agentinfo.getAgentName()); System.err.print(" -- URL : "); System.err.println(agentinfo.getURL()); System.err.print(" -- ClassName : "); System.err.println(agentinfo.getClassName()); ((TravelBroker) agent).getFrame().addItem(agentinfo); TravelBrokerNotifyDialog diag = new TravelBrokerNotifyDialog(frame); diag.start(); } return true; } return false; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?