1 55 56 package org.apache.bsf.util; 57 58 import org.apache.bsf.util.event.*; 59 import org.apache.bsf.*; 60 import java.io.PrintStream ; 61 62 68 public class BSFEventProcessor implements EventProcessor { 69 BSFEngine engine; 70 BSFManager manager; 71 String filter; 72 String source; 73 int lineNo; 74 int columnNo; 75 Object script; 76 77 81 BSFEventProcessor (BSFEngine engine, BSFManager manager, String filter, 82 String source, int lineNo, int columnNo, Object script) 83 throws BSFException { 84 this.engine = engine; 85 this.manager = manager; 86 this.filter = filter; 87 this.source = source; 88 this.lineNo = lineNo; 89 this.columnNo = columnNo; 90 this.script = script; 91 } 92 100 public void processEvent (String inFilter, Object [] evtInfo) { 101 try { 102 processExceptionableEvent (inFilter, evtInfo); 103 } catch (RuntimeException re) { 104 throw re; 107 } catch (Exception e) { 108 System.err.println ("BSFError: non-exceptionable event delivery " + 110 "threw exception (that's not nice): " + e); 111 e.printStackTrace (); 112 } 113 } 114 120 public void processExceptionableEvent (String inFilter, Object [] evtInfo) 121 throws Exception { 122 if ((filter != null) && !filter.equals (inFilter)) { 123 return; 125 } 126 127 engine.exec (source, lineNo, columnNo, script); 129 } 130 } 131 | Popular Tags |