1 package org.jacorb.notification.filter.etcl; 2 3 23 24 import org.jacorb.notification.filter.EvaluationContext; 25 import org.jacorb.notification.filter.EvaluationException; 26 import org.jacorb.notification.filter.EvaluationResult; 27 import org.jacorb.notification.interfaces.Message; 28 29 33 34 public class EventNameShorthandNode extends ETCLComponentName 35 { 36 private static final AbstractTCLNode expandedPath_; 37 private static final String COMP_NAME = "$.header.fixed_header.event_name"; 38 public static final String SHORT_NAME = "event_name"; 39 40 static { 41 try 42 { 43 expandedPath_ = TCLParser.parse( COMP_NAME ); 44 expandedPath_.acceptInOrder( new TCLCleanUp() ); 45 } 46 catch (Exception e) 47 { 48 throw new RuntimeException (e.getMessage()); 50 } 51 } 52 53 public EventNameShorthandNode() 54 { 55 setName("EventNameShorthandNode"); 56 } 57 58 public String getComponentName() 59 { 60 return COMP_NAME; 61 } 62 63 public void acceptInOrder(AbstractTCLVisitor v) 64 { 65 } 66 67 public void acceptPostOrder(AbstractTCLVisitor v) 68 { 69 } 70 71 public void acceptPreOrder(AbstractTCLVisitor v) 72 { 73 } 74 75 public EvaluationResult evaluate( EvaluationContext context ) 76 throws EvaluationException 77 { 78 Message _event = context.getCurrentMessage(); 79 EvaluationResult _result = new EvaluationResult(); 80 81 switch (_event.getType()) 82 { 83 case Message.TYPE_ANY: 84 _result = expandedPath_.evaluate(context); 85 break; 86 87 case Message.TYPE_STRUCTURED: 88 String _domainName = _event.toStructuredEvent().header.fixed_header.event_name; 89 _result.setString(_domainName); 90 break; 91 92 default: 93 throw new RuntimeException (); 94 } 95 96 return _result; 97 } 98 99 public String toString() 100 { 101 return COMP_NAME; 102 } 103 104 } 105 | Popular Tags |