Author: sanka Date: Mon Sep 11 12:40:06 2006 New Revision: 442302 URL: http://svn.apache.org/viewvc?view=rev&rev=442302 Log: final preparations for bsf-2.4.0-rc1
Modified: jakarta/bsf/trunk/build-properties.xml jakarta/bsf/trunk/build.xml jakarta/bsf/trunk/src/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java Modified: jakarta/bsf/trunk/build-properties.xml URL: http://svn.apache.org/viewvc/jakarta/bsf/trunk/build-properties.xml?view=diff&rev=442302&r1=442301&r2=442302 ============================================================================== --- jakarta/bsf/trunk/build-properties.xml (original) +++ jakarta/bsf/trunk/build-properties.xml Mon Sep 11 12:40:06 2006 @@ -24,6 +24,8 @@ <property name="build.samples.xsl" value="build/samples/xsl"/> <property name="build.javadocs" value="build/javadocs"/> <property name="build.tests" value="build/testcases" /> + + <property name="source.level" value="1.3" /> <property name="dist.dir" value="dist"/> <property name="dist.dir.root" Modified: jakarta/bsf/trunk/build.xml URL: http://svn.apache.org/viewvc/jakarta/bsf/trunk/build.xml?view=diff&rev=442302&r1=442301&r2=442302 ============================================================================== --- jakarta/bsf/trunk/build.xml (original) +++ jakarta/bsf/trunk/build.xml Mon Sep 11 12:40:06 2006 @@ -214,7 +214,7 @@ <!-- =================================================================== --> <target name="compile" description="Compiles the BSF *.java files." depends="prepare"> <mkdir dir="${build.dest}"/> - <javac srcdir="${src.dir}" destdir="${build.dest}" debug="${project.debug}" deprecation="${project.deprecation}"> + <javac srcdir="${src.dir}" destdir="${build.dest}" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}"> <classpath> <fileset dir="lib"> <include name="*.jar"/> @@ -256,10 +256,10 @@ <copy todir="${build.samples}"> <fileset dir="${samples.dir}" /> </copy> - <javac srcdir="${build.samples.calc}" destdir="${build.samples.calc}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" /> - <javac srcdir="${build.samples.jsplike}" destdir="${build.samples.jsplike}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" /> - <javac srcdir="${build.samples.scriptedui}" destdir="${build.samples.scriptedui}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" /> - <javac srcdir="${build.samples.xsl}" destdir="${build.samples.xsl}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" /> + <javac srcdir="${build.samples.calc}" destdir="${build.samples.calc}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" /> + <javac srcdir="${build.samples.jsplike}" destdir="${build.samples.jsplike}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" /> + <javac srcdir="${build.samples.scriptedui}" destdir="${build.samples.scriptedui}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" /> + <javac srcdir="${build.samples.xsl}" destdir="${build.samples.xsl}" classpath="${build.lib}/${project.name}.jar" debug="${project.debug}" deprecation="${project.deprecation}" source="${source.level}" /> </target> <!-- =================================================================== --> @@ -268,7 +268,7 @@ <target name="javadocs" description="Generates the API documentation." depends="compile"> <mkdir dir="${build.javadocs}" /> <!-- FIXME: Excluding some packages temporarily --> - <javadoc packagenames="${packages}" failonerror="true" excludepackagenames="org.apache.bsf.engines.java, org.apache.bsf.engines.javaclass" destdir="${build.javadocs}" author="true" version="false" use="true" windowtitle="${project.fullName} API" doctitle="${project.fullName}"> + <javadoc packagenames="${packages}" failonerror="true" excludepackagenames="org.apache.bsf.engines.java, org.apache.bsf.engines.javaclass" destdir="${build.javadocs}" author="true" version="false" use="true" windowtitle="${project.fullName} API" doctitle="${project.fullName}" source="${source.level}"> <classpath refid="compile.classpath" /> <fileset dir="${src.dir}"> <patternset refid="java.source.files"></patternset> @@ -352,7 +352,7 @@ <copy file="TODO.txt" tofile="${dist.dir.root}/TODO.txt" /> <copy file="AUTHORS.txt" tofile="${dist.dir.root}/AUTHORS.txt" /> <copy file="LICENSE.txt" tofile="${dist.dir.root}/LICENSE.txt" /> - <copy file="RELEASE.txt" tofile="${dist.dir.root}/RELEASE.txt" /> + <copy file="RELEASE-NOTE.txt" tofile="${dist.dir.root}/RELEASE-NOTE.txt" /> <copy file="${build.file}" tofile="${dist.dir.root}/${build.file}" /> <!-- ================================================================= --> @@ -374,7 +374,7 @@ <!-- =================================================================== --> <target name="compile-test" if="junit.present" depends="compile"> <mkdir dir="${build.tests}" /> - <javac srcdir="${tests.dir}" destdir="${build.tests}" classpath="${build.dest}" /> + <javac srcdir="${tests.dir}" destdir="${build.tests}" classpath="${build.dest}" source="${source.level}" /> </target> <!-- =================================================================== --> Modified: jakarta/bsf/trunk/src/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java URL: http://svn.apache.org/viewvc/jakarta/bsf/trunk/src/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java?view=diff&rev=442302&r1=442301&r2=442302 ============================================================================== --- jakarta/bsf/trunk/src/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java (original) +++ jakarta/bsf/trunk/src/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java Mon Sep 11 12:40:06 2006 @@ -15,134 +15,150 @@ import org.apache.bsf.BSFManager; import org.apache.bsf.util.event.EventProcessor; +/* + * Copyright (C) 2001-2006 Rony G. Flatscher + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * <a + * href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a> + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + * + */ + /** - * This is used to support binding scripts to be run when an event - * occurs, forwarding the arguments supplied to the event listener. It is an adapted version of - * [EMAIL PROTECTED] org.apache.bsf.util.BSFEventProcessor}. - * - * <pre>------------------------ Apache Version 2.0 license ------------------------- - * Copyright (C) 2001-2006 Rony G. Flatscher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a> - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ----------------------------------------------------------------------------- </pre> - * - * @author Rony G. Flatscher, but most of the code copied from org.apache.bsf.util.BSFEventProcessor by Sanjiva Weerawarana - * - * - * @see [EMAIL PROTECTED] org.apache.bsf.util.BSFEventProcessor} - * + * + * This is used to support binding scripts to be run when an event occurs, + * forwarding the arguments supplied to the event listener. It is an adapted + * version of org.apache.bsf.util.BSFEventProcessor. + * + * @author Rony G. Flatscher, but most of the code copied from + * org.apache.bsf.util.BSFEventProcessor by Sanjiva Weerawarana */ -public class BSFEventProcessorReturningEventInfos implements EventProcessor { - BSFEngine engine; - BSFManager manager; - String filter; - String source; - int lineNo; - int columnNo; - Object script; - Object dataFromScriptingEngine; // ---rgf, 2006-02-24: data coming from the script engine, could be - // e.g. an object reference to forward event with received arguments to - - /** - * Package-protected constructor makes this class unavailable for - * public use. - * - * @param dataFromScriptingEngine this contains any object supplied by the scripting engine and gets - * sent back with the supplied script. This could be used e.g. for indicating which scripting - * engine object should be ultimately informed of the event occurrence. - */ - BSFEventProcessorReturningEventInfos (BSFEngine engine, BSFManager manager, String filter, - String source, int lineNo, int columnNo, Object script, Object dataFromScriptingEngine) - throws BSFException { - this.engine = engine; - this.manager = manager; - this.filter = filter; - this.source = source; - this.lineNo = lineNo; - this.columnNo = columnNo; - this.script = script; - this.dataFromScriptingEngine = dataFromScriptingEngine; - } - ////////////////////////////////////////////////////////////////////////// - // - // event is delegated to me by the adapters using this. inFilter is - // in general the name of the method via which the event was received - // at the adapter. For prop/veto change events, inFilter is the name - // of the property. In any case, in the event processor, I only forward - // those events if for which the filters match (if one is specified). - - - public void processEvent (String inFilter, Object[] evtInfo) { - try { - processExceptionableEvent (inFilter, evtInfo); - } catch (RuntimeException re) { - // rethrow this .. I don't want to intercept run-time stuff - // that can in fact occur legit - throw re; - } catch (Exception e) { - // should not occur - System.err.println ("BSFError: non-exceptionable event delivery " + - "threw exception (that's not nice): " + e); - e.printStackTrace (); - } - } - - ////////////////////////////////////////////////////////////////////////// - // - // same as above, but used when the method event method may generate - // an exception which must go all the way back to the source (as in - // the vetoableChange case) - - public void processExceptionableEvent (String inFilter, Object[] evtInfo) throws Exception { - -// System.err.println(this+": inFilter=["+inFilter+"], filter=["+filter+"]"); - if ((filter != null) && !filter.equals (inFilter)) { - // ignore this event - return; - } - - // run the script - // engine.exec (source, lineNo, columnNo, script); - - // create the parameter vectors for engine.apply() - Vector paramNames = new Vector(), paramValues = new Vector(); - - // parameter # 1 - // supply the parameters as an array object as sent to the event object listener - // (usually the first entry is the sent event object) - paramNames. add( "eventParameters" ); - paramValues.add( evtInfo ); - - // parameter # 2 - // supply the data object received from the scripting engine to be sent with the event - paramNames. add( "dataFromScriptingEngine" ); - paramValues.add( this.dataFromScriptingEngine ); // can be null as well - - // parameter # 3 - // event filter in place - paramNames. add( "inFilter" ); - paramValues.add( inFilter ); // event name that has occurred - - // parameter # 4 - // event filter in place - paramNames. add( "eventFilter" ); - paramValues.add( this.filter ); // can be null as well +public class BSFEventProcessorReturningEventInfos implements EventProcessor { + BSFEngine engine; + + BSFManager manager; + + String filter; + + String source; + + int lineNo; + + int columnNo; + + Object script; + + Object dataFromScriptingEngine; // ---rgf, 2006-02-24: data coming from the + // script engine, could be + + // e.g. an object reference to forward event with received arguments to + + /** + * Package-protected constructor makes this class unavailable for public + * use. + * + * @param dataFromScriptingEngine + * this contains any object supplied by the scripting engine and + * gets sent back with the supplied script. This could be used + * e.g. for indicating which scripting engine object should be + * ultimately informed of the event occurrence. + */ + BSFEventProcessorReturningEventInfos(BSFEngine engine, BSFManager manager, + String filter, String source, int lineNo, int columnNo, + Object script, Object dataFromScriptingEngine) throws BSFException { + this.engine = engine; + this.manager = manager; + this.filter = filter; + this.source = source; + this.lineNo = lineNo; + this.columnNo = columnNo; + this.script = script; + this.dataFromScriptingEngine = dataFromScriptingEngine; + } + + // //////////////////////////////////////////////////////////////////////// + // + // event is delegated to me by the adapters using this. inFilter is + // in general the name of the method via which the event was received + // at the adapter. For prop/veto change events, inFilter is the name + // of the property. In any case, in the event processor, I only forward + // those events if for which the filters match (if one is specified). + + public void processEvent(String inFilter, Object[] evtInfo) { + try { + processExceptionableEvent(inFilter, evtInfo); + } catch (RuntimeException re) { + // rethrow this .. I don't want to intercept run-time stuff + // that can in fact occur legit + throw re; + } catch (Exception e) { + // should not occur + System.err.println("BSFError: non-exceptionable event delivery " + + "threw exception (that's not nice): " + e); + e.printStackTrace(); + } + } + + // //////////////////////////////////////////////////////////////////////// + // + // same as above, but used when the method event method may generate + // an exception which must go all the way back to the source (as in + // the vetoableChange case) + + public void processExceptionableEvent(String inFilter, Object[] evtInfo) + throws Exception { + + // System.err.println(this+": inFilter=["+inFilter+"], + // filter=["+filter+"]"); + if ((filter != null) && !filter.equals(inFilter)) { + // ignore this event + return; + } + + // run the script + // engine.exec (source, lineNo, columnNo, script); + + // create the parameter vectors for engine.apply() + Vector paramNames = new Vector(), paramValues = new Vector(); + + // parameter # 1 + // supply the parameters as an array object as sent to the event object + // listener + // (usually the first entry is the sent event object) + paramNames.add("eventParameters"); + paramValues.add(evtInfo); + + // parameter # 2 + // supply the data object received from the scripting engine to be sent + // with the event + paramNames.add("dataFromScriptingEngine"); + paramValues.add(this.dataFromScriptingEngine); // can be null as well + + // parameter # 3 + // event filter in place + paramNames.add("inFilter"); + paramValues.add(inFilter); // event name that has occurred + + // parameter # 4 + // event filter in place + paramNames.add("eventFilter"); + paramValues.add(this.filter); // can be null as well - // parameter # 5 + // parameter # 5 // BSF manager instance (e.g. allows access to its registry) - paramNames. add( "BSFManager" ); - paramValues.add( this.manager ); + paramNames.add("BSFManager"); + paramValues.add(this.manager); - engine.apply(source, lineNo, columnNo, this.script, paramNames, paramValues); - } + engine.apply(source, lineNo, columnNo, this.script, paramNames, + paramValues); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]