1 55 56 package org.apache.bsf.dbline; 57 58 import java.io.*; 59 import org.apache.bsf.debug.*; 60 import org.apache.bsf.debug.jsdi.*; 61 import java.rmi.RemoteException ; 62 63 68 public class FnOrScript { 69 70 Buffer m_buffer; 71 boolean m_loaded; 72 boolean m_executed; 73 boolean m_inError; 74 75 int m_start,m_end; 76 long m_fsid; 77 78 FnOrScript(Buffer buffer, int start, int end) { 79 m_buffer = buffer; 80 m_start = start; 81 m_end = end; 82 } 83 84 void exec() { 85 if (m_inError) { 86 System.out.println("\nIn Error: the load produced errors."); 87 return; 88 } 89 90 StringBuffer buf = m_buffer.buildFnOrScript(m_start, m_end); 91 String scriptText = buf.toString(); 92 93 JsEngine eng = JsDb.self.m_jse; 94 95 try { 96 eng.eval(m_buffer.getName(), scriptText, m_start); 97 } 98 catch (RemoteException ex) { 99 m_inError = true; 100 } 101 } 102 103 Reader getReader() { 104 StringBuffer buf = m_buffer.buildFnOrScript(m_start,m_end); 105 String scriptText = buf.toString(); 106 Reader reader = new StringReader(scriptText); 107 return reader; 108 } 109 } 110 | Popular Tags |