1 package Jt; 2 import java.util.*; 3 import java.lang.reflect.*; 4 import java.beans.*; 5 import java.io.*; 6 7 8 11 12 13 public class JtProxy extends JtObject { 14 15 16 private Object subject; 17 18 public JtProxy() { 19 } 20 21 26 27 public void setSubject (Object subject) { 28 this.subject = subject; 29 30 } 31 32 35 36 public Object getSubject () { 37 return (subject); 38 } 39 40 41 42 43 48 49 public Object processMessage (Object event) { 50 51 String msgid = null; 52 JtMessage e = (JtMessage) event; 53 Object content; 54 55 57 if (subject == null) { 58 handleError ("JtProxy.process: the subject attribute needs to be set"); 59 return (null); 60 } 61 62 return (sendMessage (subject, event)); 63 64 65 } 66 67 70 71 public static void main(String [] args) { 72 73 JtObject main = new JtFactory (); 74 JtMessage msg; 75 Jt.examples.HelloWorld helloWorld; 76 JtProxy proxy; 77 78 79 81 proxy = (JtProxy) 82 main.createObject ("Jt.JtProxy", 83 "proxy"); 84 helloWorld = (Jt.examples.HelloWorld) main.createObject ("Jt.examples.HelloWorld", 85 "helloWorld"); 86 87 main.setValue (proxy, "subject", helloWorld); 88 89 90 msg = new JtMessage("JtHello"); 91 System.out.println ("Reply:" + main.sendMessage (proxy, msg)); 92 93 94 } 95 96 } 97 | Popular Tags |