1 2 3 package Jt; 4 import java.util.*; 5 import java.lang.reflect.*; 6 import java.beans.*; 7 import java.io.*; 8 9 12 13 public class JtEcho extends JtObject { 14 15 16 17 public JtEcho() { 18 } 19 20 21 22 23 28 29 public Object processMessage (Object event) { 30 31 String msgid = null; 32 JtMessage e = (JtMessage) event; 33 Object content; 34 Object data; 35 36 37 if (e == null) 38 return null; 39 40 msgid = (String ) e.getMsgId (); 41 42 if (msgid == null) 43 return null; 44 45 content = e.getMsgContent(); 46 System.out.println ("JtEcho("+ this.getObjName() + "):received a message:" 48 + msgid + "..."); 49 50 e.processMessage (new JtMessage ("JtPRINT_OBJECT")); 51 52 57 return (this); 58 59 69 70 } 71 72 73 76 77 public static void main(String [] args) { 78 79 JtFactory main = new JtFactory (); 80 JtEcho echo; 81 82 83 85 echo = (JtEcho) main.createObject ("Jt.JtEcho", "echo"); 86 87 main.sendMessage (echo, new JtMessage ("JtTEST")); 88 89 90 92 93 } 94 95 } 96 97 98 | Popular Tags |