1 2 package Jt.ejb; 3 4 5 import javax.ejb.*; 6 import javax.naming.*; 7 import java.rmi.*; 8 9 import java.beans.*; 10 import java.io.*; 11 import java.util.*; 12 import Jt.*; 13 import Jt.xml.*; 14 15 16 19 20 public class JtBusinessDelegate extends JtEJBAdapter { 21 22 23 24 public JtBusinessDelegate () { 25 } 26 27 28 29 36 37 public Object processMessage (Object event) { 38 39 String msgid = null; 40 JtMessage e = (JtMessage) event; 41 Object content; 42 43 if (e == null) 44 return null; 45 46 msgid = (String ) e.getMsgId (); 47 48 if (msgid == null) 49 return null; 50 51 content = e.getMsgContent(); 52 53 if (msgid.equals ("JtTEST")) { 54 return (test ()); 55 } 56 57 60 return (super.processMessage (event)); 61 62 } 63 64 65 private Object test () { 66 67 String tmp; 68 String reply = null; 69 Exception ex; 70 71 72 76 createObject ("Jt.examples.HelloWorld", "helloWorld"); 77 78 79 80 82 setValue ("helloWorld", "greetingMessage", "Hello there..."); 83 84 85 93 94 96 99 100 102 reply = (String ) sendMessage ("helloWorld", new JtMessage ("JtHello")); 104 105 106 108 removeObject ("helloWorld"); 109 110 return (reply); 111 112 } 113 114 117 118 public static void main(String [] args) { 119 120 JtObject main = new JtObject (); 121 JtBusinessDelegate businessDelegate; 122 String str; 123 String reply = null; 124 Exception ex; 125 126 129 130 132 businessDelegate = (JtBusinessDelegate) main.createObject ("Jt.ejb.JtBusinessDelegate", 133 "businessDelegate"); 134 135 136 138 139 reply = (String ) main.sendMessage (businessDelegate, new JtMessage ("JtTEST")); 140 141 142 144 145 147 148 System.out.println (reply); 150 152 154 156 main.removeObject (businessDelegate); 157 158 } 159 160 } 161 162 163 | Popular Tags |