View Javadoc

1   /*** property of BTexact Communications
2   Not for public use or disclosure. 
3   Research product only.
4   
5   */
6   package zeus.actors.outtrays;
7   
8   import javax.agent.service.*; 
9   import javax.agent.*; 
10  import FIPA.*; 
11  import zeus.concepts.*;
12  import zeus.actors.*;
13  
14  /*** 
15      implementation of the OutTray interface that is used 
16  when two agents in the same container attempt to communicate
17      */
18  public class Zeus_Container_Transport implements OutTray { 
19          
20          
21      private ZeusAgentContext context = null;    
22  //    private ContainerCommunicationIn otherAgent = null;    
23  
24       
25      public Zeus_Container_Transport (ZeusAgentContext context) { 
26           this.context = context;
27      }
28      
29          
30          
31     public void send  (Object obj) throws UnsuitableMessageException { 
32      try { 
33          Performative  perf = (Performative) obj; 
34       // 	otherAgent.message(perf); 
35   
36          } catch (ClassCastException cce) { 
37              throw new UnsuitableMessageException ("Must be Performative to work with this transport"); 
38          }catch (Exception e) { 
39              e.printStackTrace(); 
40              throw new UnsuitableMessageException ("Bad message in send() - unknown problem, Excepiton printed to sout"); 
41      
42      }
43      }
44          
45          
46          
47     public void send (Performative perf) { 
48  	try {
49  	    	//otherAgent.message(perf);}
50                  ;
51                  }
52  	catch (Throwable tr) {
53  		tr.printStackTrace(); 
54  		System.out.println("Error in local container class");}
55     }
56     
57          
58     public void send (javax.agent.Envelope env) { 
59      try {
60          // very risky - is the object a performative, probably not.....
61          Performative perf = (Performative) env.getObject(); 
62        //  otherAgent.messsage(perf);
63      }
64         catch (ClassCastException cce) { 
65          cce.printStackTrace(); 
66          return; }
67  	catch (Throwable tr) {
68  		tr.printStackTrace();
69  		System.out.println("Error in local container class");}
70          
71     }
72     
73     
74     
75   }