This commit was manufactured by cvs2svn to create tag
'helma_1_2_pre4'.
This commit is contained in:
parent
817395e8b0
commit
c512ce3cbe
38 changed files with 346 additions and 710 deletions
122
README.txt
122
README.txt
|
@ -1,97 +1,93 @@
|
||||||
This is the README file for version 1.2 of Helma Object Publisher.
|
This is the README file for version 1.2 of Helma Object Publisher.
|
||||||
|
|
||||||
===========
|
============================
|
||||||
ABOUT HELMA
|
ABOUT HELMA OBJECT PUBLISHER
|
||||||
===========
|
============================
|
||||||
|
|
||||||
Helma is a scriptable platform for creating dynamic, database backed
|
Helma Object Publisher is a web application server.
|
||||||
web sites.
|
|
||||||
|
|
||||||
Helma provides an easy way to map relational database tables to objects.
|
With Helma Object Publisher (sometimes simply refered to as Helma or
|
||||||
These objects are wrapped with a layer of scripts and skins that allow
|
Hop) you can define Objects and map them to a relational database
|
||||||
them to be presented and manipulated over the web. The clue here is that
|
table. These so-called HopObjects can be created, modified and deleted
|
||||||
both functions and skins work in an object oriented manner and force
|
using a comfortable object/container model. Hence, no manual fiddling
|
||||||
a clear separation between content, functionality and presentation.
|
around with database code is necessary.
|
||||||
Actions are special functions that are callable over the web. Macros are
|
|
||||||
special functions that expose functionality to the presentation layer.
|
HopObjects are extended JavaScript objects which can be scripted using
|
||||||
Skins are pieces of layout that do not contain any application logic,
|
server-side JavaScript. Beyond the common JavaScript features, Helma
|
||||||
only macro tags as placeholders for parts that are dynamically provided
|
provides special "skin" and template functionalities which facilitate
|
||||||
by the application.
|
the rendering of objects via a web interface.
|
||||||
|
|
||||||
|
Thanks to Helma's relational database mapping technology, HopObjects
|
||||||
|
create a hierarchical structure, the Url space of a Helma site. The
|
||||||
|
parts between slashes in a Helma Url represent HopObjects (similar to
|
||||||
|
the document tree in static sites). The Helma Url space can be thought
|
||||||
|
of as an analogy to the Document Object Model (Dom) in client-side
|
||||||
|
JavaScript.
|
||||||
|
|
||||||
In short, Helma provides a one stop framework to create web applications
|
|
||||||
with less code and in shorter time than most of the other software out
|
|
||||||
there.
|
|
||||||
|
|
||||||
===================
|
===================
|
||||||
SYSTEM REQUIREMENTS
|
SYSTEM REQUIREMENTS
|
||||||
===================
|
===================
|
||||||
|
|
||||||
You need a Java virtual machine 1.3 or higher to run Helma.
|
Windows: 1) On Windows Helma won't run with Microsoft's version of
|
||||||
|
Java (jview). You can get a compatible Java runtime from Sun or IBM:
|
||||||
|
http://java.sun.com/j2se/1.3/jre/download-windows.html
|
||||||
|
http://www.ibm.com/java/jdk/download/ 2) In the Windows start script
|
||||||
|
I've hardcoded c:\java\lib\classes.zip in the CLASSPATH argument. Not
|
||||||
|
good.
|
||||||
|
|
||||||
For Windows, Linux and Solaris you can get a Java runtime or development
|
Macintosh: 1) If you are using the Mac version you should own a G3 CPU
|
||||||
kit from http://java.sun.com/j2se/downloads.html.
|
and/or have MRJ 2.2 (http://www.apple.com/java) installed. Other
|
||||||
|
platforms have less frustration potential. The Mac OS version
|
||||||
|
currently is not up-to-date (version 0.1).
|
||||||
|
|
||||||
If you are on Mac OS X, you already have a Java runtime that will work
|
Linux: The recomended virtual machine for running Helma on Linux is
|
||||||
well with Helma.
|
Blackdown's port of JDK 1.2.2 RC4
|
||||||
|
(http://www.blackdown.org/java-linux/mirrors.html). JDK 1.1.7v3 will
|
||||||
|
work, but much slower and show a lot of CPU activity even when the
|
||||||
|
Helma is idle. IBM's version of JDK 1.1.8 also works well, but this
|
||||||
|
JVM has some problems of its own with thread handling.
|
||||||
|
|
||||||
Unfortunately, there is no Java 2 interpreter for Mac OS Classic, so
|
|
||||||
you can't use Helma on Mac OS 9.
|
|
||||||
|
|
||||||
============================
|
============================
|
||||||
INSTALLING AND RUNNING HELMA
|
INSTALLING AND RUNNING HELMA
|
||||||
============================
|
============================
|
||||||
|
|
||||||
Simply unzip or untar the contents of the archive file into any place
|
Simply unzip the contents of the archive file into any place on your
|
||||||
on your hard disk. Start Helma by invoking hop.bat or hop.sh from the
|
hard disk. Start Helma by opening the file hop.bat or hop.sh,
|
||||||
command line, depending on whether you are on Windows or
|
respectively.
|
||||||
Linux/Unix/MacOSX. If the java command is not found, try setting the
|
|
||||||
JAVA_HOME variable in the start script to the location of your Java
|
|
||||||
installation.
|
|
||||||
|
|
||||||
You may also want to have a look at the start script for other settings.
|
|
||||||
You can adjust server wide settings in the server.properties file. For
|
|
||||||
example, you should set the smtp property to the name of the SMTP server
|
|
||||||
that Helma should use to send Email. Applications can be started or
|
|
||||||
stopped by editing the apps.properties file through the web interface
|
|
||||||
using the Management application that is part of Helma.
|
|
||||||
|
|
||||||
If you manage to get it running you should be able to connect your
|
If you manage to get it running you should be able to connect your
|
||||||
browser to http://localhost:8080/ or http://127.0.0.1:8080/
|
browser to http://127.0.0.1:8080/ (port 8080, that is).
|
||||||
(port 8080 on the local machine, that is).
|
|
||||||
|
|
||||||
Helma comes with a version of Jetty, a lightweight yet industrial strenth
|
This version is set up to use its own embedded Web server and a very
|
||||||
web server developed by Mortbay Consulting. See http://jetty.mortbay.com/
|
basic embedded object database. For this reason it is able to run
|
||||||
for more information. While Jetty works well for deploying real web sites,
|
virtually without installation on any platform with a Java 1.1 virtual
|
||||||
you may want to run Helma behind an existing web server. This is most
|
machine.
|
||||||
easily done by running Helma with the AJPv13 listener which allows you to
|
|
||||||
plug Helma into any web server using the Apache mod_jk module. See
|
|
||||||
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/index.html for more
|
|
||||||
information on mod_jk and AJPv13.
|
|
||||||
|
|
||||||
Finally, Helma can be plugged into Servlet containers using Servlet
|
On the other hand, the embedded Web server and object db are meant for
|
||||||
classes that communicate with Helma either directly or via Java RMI.
|
development work and not ready for prime time deployment. For that
|
||||||
(Be warned that these options may be harder to set up and maintain though,
|
you'd probably use an external relational database, the Berkeley DB
|
||||||
since most of the recent development efforts have been geared towards the
|
package and a full featured Web server like Apache.
|
||||||
mod_jk/AJPv13 setup.)
|
|
||||||
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
DOCUMENTATION AND FURTHER INFORMATION
|
DOCUMENTATION AND FURTHER INFORMATION
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
Currently, documentation-in-progress is available online at
|
Currently, a documentation-in-progress is available online only.
|
||||||
http://helma.org/. We know that it sucks and hope to do some substantial
|
Please refer to http://helma.org/docs/.
|
||||||
improvments within the coming weeks and months.
|
|
||||||
|
|
||||||
Your input is highly welcome. There is a mailing-list to discuss Helma at
|
For further information http://helma.org generally is a good place.
|
||||||
http://helma.org/lists/listinfo/hop. Don't hesitate to voice any questions,
|
There is also a mailing-list about Helma-related stuff available at
|
||||||
proposals, complaints, praise you may have on the list. We know we have
|
http://helma.org/lists/listinfo/hop.
|
||||||
a lot to do and to learn, and we're open to suggestions.
|
|
||||||
|
For questions, comments or suggestions feel free to contact
|
||||||
|
tobi@helma.at.
|
||||||
|
|
||||||
For questions, comments or suggestions also feel free to contact
|
|
||||||
hannes@helma.at.
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Last modified on December 5, 2002 by Hannes Wallnoefer <hannes@helma.at>
|
This document was last modified on Friday 22 June 2001 by
|
||||||
|
tobi@helma.at
|
|
@ -44,100 +44,78 @@ Object Publisher, a powerful and fast scriptable open source web
|
||||||
application server (which itself is written in Java). Antville works
|
application server (which itself is written in Java). Antville works
|
||||||
with a relational database in the backend.
|
with a relational database in the backend.
|
||||||
|
|
||||||
Check out http://project.antville.org/ for more information.
|
============================
|
||||||
|
ABOUT HELMA OBJECT PUBLISHER
|
||||||
|
============================
|
||||||
|
|
||||||
===========
|
Helma Object Publisher is a web application server.
|
||||||
ABOUT HELMA
|
|
||||||
===========
|
|
||||||
|
|
||||||
Helma is a scriptable platform for creating dynamic, database backed
|
With Helma Object Publisher (sometimes simply refered to as Helma or
|
||||||
web sites.
|
Hop) you can define Objects and map them to a relational database
|
||||||
|
table. These so-called HopObjects can be created, modified and deleted
|
||||||
|
using a comfortable object/container model. Hence, no manual fiddling
|
||||||
|
around with database code is necessary.
|
||||||
|
|
||||||
Helma provides an easy way to map relational database tables to objects.
|
HopObjects are extended JavaScript objects which can be scripted using
|
||||||
These objects are wrapped with a layer of scripts and skins that allow
|
server-side JavaScript. Beyond the common JavaScript features, Helma
|
||||||
them to be presented and manipulated over the web. The clue here is that
|
provides special "skin" and template functionalities which facilitate
|
||||||
both functions and skins work in an object oriented manner and force
|
the rendering of objects via a web interface.
|
||||||
a clear separation between content, functionality and presentation.
|
|
||||||
Actions are special functions that are callable over the web. Macros are
|
Thanks to Helma's relational database mapping technology, HopObjects
|
||||||
special functions that expose functionality to the presentation layer.
|
create a hierarchical structure, the Url space of a Helma site. The
|
||||||
Skins are pieces of layout that do not contain any application logic,
|
parts between slashes in a Helma Url represent HopObjects (similar to
|
||||||
only macro tags as placeholders for parts that are dynamically provided
|
the document tree in static sites). The Helma Url space can be thought
|
||||||
by the application.
|
of as an analogy to the Document Object Model (Dom) in client-side
|
||||||
|
JavaScript.
|
||||||
|
|
||||||
In short, Helma provides a one stop framework to create web applications
|
|
||||||
with less code and in shorter time than most of the other software out
|
|
||||||
there.
|
|
||||||
|
|
||||||
===================
|
===================
|
||||||
SYSTEM REQUIREMENTS
|
SYSTEM REQUIREMENTS
|
||||||
===================
|
===================
|
||||||
|
|
||||||
You need a Java virtual machine 1.3 or higher to run Helma.
|
You need Java 2 runtime version 1.3 or higher to run Helma. Helma has
|
||||||
|
been used successfully on Windows, Linux and Mac OS X platforms.
|
||||||
|
|
||||||
For Windows, Linux and Solaris you can get a Java runtime or development
|
|
||||||
kit from http://java.sun.com/j2se/downloads.html.
|
|
||||||
|
|
||||||
If you are on Mac OS X, you already have a Java runtime that will work
|
|
||||||
well with Helma.
|
|
||||||
|
|
||||||
Unfortunately, there is no Java 2 interpreter for Mac OS Classic, so
|
|
||||||
you can't use Helma on Mac OS 9.
|
|
||||||
|
|
||||||
============================
|
============================
|
||||||
INSTALLING AND RUNNING HELMA
|
INSTALLING AND RUNNING HELMA
|
||||||
============================
|
============================
|
||||||
|
|
||||||
Simply unzip or untar the contents of the archive file into any place
|
Simply unzip the contents of the archive file into any place on your
|
||||||
on your hard disk. Start Helma by invoking hop.bat or hop.sh from the
|
hard disk. Start Helma by opening the file hop.bat or hop.sh,
|
||||||
command line, depending on whether you are on Windows or
|
respectively.
|
||||||
Linux/Unix/MacOSX. If the java command is not found, try setting the
|
|
||||||
JAVA_HOME variable in the start script to the location of your Java
|
|
||||||
installation.
|
|
||||||
|
|
||||||
You may also want to have a look at the start script for other settings.
|
|
||||||
You can adjust server wide settings in the server.properties file. For
|
|
||||||
example, you should set the smtp property to the name of the SMTP server
|
|
||||||
that Helma should use to send Email. Applications can be started or
|
|
||||||
stopped by editing the apps.properties file through the web interface
|
|
||||||
using the Management application that is part of Helma.
|
|
||||||
|
|
||||||
If you manage to get it running you should be able to connect your
|
If you manage to get it running you should be able to connect your
|
||||||
browser to http://localhost:8080/ or http://127.0.0.1:8080/
|
browser to http://127.0.0.1:8080/ (port 8080, that is).
|
||||||
(port 8080 on the local machine, that is).
|
|
||||||
|
|
||||||
Helma comes with a version of Jetty, a lightweight yet industrial strenth
|
This version is set up to use its own embedded Web server and a very
|
||||||
web server developed by Mortbay Consulting. See http://jetty.mortbay.com/
|
basic embedded object database. For this reason it is able to run
|
||||||
for more information. While Jetty works well for deploying real web sites,
|
virtually without installation on any platform with a Java 1.1 virtual
|
||||||
you may want to run Helma behind an existing web server. This is most
|
machine.
|
||||||
easily done by running Helma with the AJPv13 listener which allows you to
|
|
||||||
plug Helma into any web server using the Apache mod_jk module. See
|
|
||||||
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/index.html for more
|
|
||||||
information on mod_jk and AJPv13.
|
|
||||||
|
|
||||||
Finally, Helma can be plugged into Servlet containers using Servlet
|
On the other hand, the embedded Web server and object db are meant for
|
||||||
classes that communicate with Helma either directly or via Java RMI.
|
development work and not ready for prime time deployment. For that
|
||||||
(Be warned that these options may be harder to set up and maintain though,
|
you'd probably use an external relational database, the Berkeley DB
|
||||||
since most of the recent development efforts have been geared towards the
|
package and a full featured Web server like Apache.
|
||||||
mod_jk/AJPv13 setup.)
|
|
||||||
|
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
DOCUMENTATION AND FURTHER INFORMATION
|
DOCUMENTATION AND FURTHER INFORMATION
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
Currently, documentation-in-progress is available online at
|
Currently, a documentation-in-progress is available online only.
|
||||||
http://helma.org/. We know that it sucks and hope to do some substantial
|
Please refer to http://helma.org/.
|
||||||
improvments within the coming weeks and months.
|
|
||||||
|
|
||||||
Your input is highly welcome. There is a mailing-list to discuss Helma at
|
For further information http://helma.org generally is a good place.
|
||||||
http://helma.org/lists/listinfo/hop. Don't hesitate to voice any questions,
|
There is also a mailing-list about Helma-related stuff available at
|
||||||
proposals, complaints, praise you may have on the list. We know we have
|
http://helma.org/lists/listinfo/hop.
|
||||||
a lot to do and to learn, and we're open to suggestions.
|
|
||||||
|
For questions, comments or suggestions feel free to contact
|
||||||
|
tobi@helma.at.
|
||||||
|
|
||||||
For questions, comments or suggestions also feel free to contact
|
|
||||||
antville@helma.org.
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Last modified on December 5, 2002 by Hannes Wallnoefer <hannes@helma.at>
|
This document was last modified on Friday 25 October 2002 by
|
||||||
|
hannes@helma.at
|
||||||
|
|
|
@ -35,7 +35,7 @@ rem set JAVA_OPTIONS=-server -Xmx128m
|
||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
:: Setting the script path
|
:: Setting the script path
|
||||||
set INSTALL_DIR=%~d0%~p0
|
set SCRIPT_DIR=%~d0%~p0
|
||||||
|
|
||||||
:: Using JAVA_HOME variable if defined. Otherwise,
|
:: Using JAVA_HOME variable if defined. Otherwise,
|
||||||
:: Java executable must be contained in PATH variable
|
:: Java executable must be contained in PATH variable
|
||||||
|
@ -48,7 +48,7 @@ if "%JAVA_HOME%"=="" goto default
|
||||||
|
|
||||||
:: Setting HOP_HOME to script path if undefined
|
:: Setting HOP_HOME to script path if undefined
|
||||||
if "%HOP_HOME%"=="" (
|
if "%HOP_HOME%"=="" (
|
||||||
set HOP_HOME=%INSTALL_DIR%
|
set HOP_HOME=%SCRIPT_DIR%
|
||||||
)
|
)
|
||||||
cd %HOP_HOME%
|
cd %HOP_HOME%
|
||||||
|
|
||||||
|
@ -76,4 +76,4 @@ if not "%HOP_HOME%"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Invoking the Java virtual machine
|
:: Invoking the Java virtual machine
|
||||||
%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS%
|
%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS%
|
||||||
|
|
|
@ -32,11 +32,6 @@ else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the Helma installation directory
|
|
||||||
INSTALL_DIR="${0%/*}"
|
|
||||||
cd $INSTALL_DIR
|
|
||||||
INSTALL_DIR=$PWD
|
|
||||||
|
|
||||||
# get HOP_HOME variable if it isn't set
|
# get HOP_HOME variable if it isn't set
|
||||||
if test -z "$HOP_HOME"; then
|
if test -z "$HOP_HOME"; then
|
||||||
# try to get HOP_HOME from script file and pwd
|
# try to get HOP_HOME from script file and pwd
|
||||||
|
@ -69,5 +64,5 @@ if [ "$HOP_HOME" ]; then
|
||||||
SWITCHES="$SWITCHES -h $HOP_HOME"
|
SWITCHES="$SWITCHES -h $HOP_HOME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Invoke the Java VM
|
# Invoking the Java VM
|
||||||
$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES
|
$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<target name="init">
|
<target name="init">
|
||||||
<property name="Name" value="helma"/>
|
<property name="Name" value="helma"/>
|
||||||
<property name="year" value="1998-${year}"/>
|
<property name="year" value="1998-${year}"/>
|
||||||
<property name="version" value="1.2-rc2"/>
|
<property name="version" value="1.2pre4"/>
|
||||||
<property name="project" value="helma"/>
|
<property name="project" value="helma"/>
|
||||||
<property name="build.compiler" value="classic"/>
|
<property name="build.compiler" value="classic"/>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<property name="jar.name" value="${project}"/>
|
<property name="jar.name" value="${project}"/>
|
||||||
<property name="package.name" value="${project}-${version}"/>
|
<property name="package.name" value="${project}-${version}"/>
|
||||||
<property name="antclick.name" value="antclick-1.0pre3"/>
|
<property name="antclick.name" value="antclick-1.0pre2"/>
|
||||||
|
|
||||||
<property name="debug" value="on"/>
|
<property name="debug" value="on"/>
|
||||||
<property name="optimize" value="on"/>
|
<property name="optimize" value="on"/>
|
||||||
|
@ -169,14 +169,6 @@
|
||||||
<param name="filename" value="${package.name}"/>
|
<param name="filename" value="${package.name}"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
|
|
||||||
<!-- make the src distributions -->
|
|
||||||
<antcall target="package-src-zip">
|
|
||||||
<param name="filename" value="${package.name}"/>
|
|
||||||
</antcall>
|
|
||||||
<antcall target="package-src-tgz">
|
|
||||||
<param name="filename" value="${package.name}"/>
|
|
||||||
</antcall>
|
|
||||||
|
|
||||||
<!-- clean up -->
|
<!-- clean up -->
|
||||||
<delete dir="${build.work}"/>
|
<delete dir="${build.work}"/>
|
||||||
</target>
|
</target>
|
||||||
|
@ -196,13 +188,10 @@
|
||||||
<!-- copy the launcher jar file -->
|
<!-- copy the launcher jar file -->
|
||||||
<copy file="${home.dir}/launcher.jar" todir="${build.work}/"/>
|
<copy file="${home.dir}/launcher.jar" todir="${build.work}/"/>
|
||||||
|
|
||||||
<!-- copy README.txt -->
|
|
||||||
<copy file="${home.dir}/README.txt" todir="${build.work}/"/>
|
|
||||||
|
|
||||||
<!-- copy the whole docs-directory -->
|
<!-- copy the whole docs-directory -->
|
||||||
<!-- copy todir="${build.work}/docs">
|
<copy todir="${build.work}/docs">
|
||||||
<fileset dir="${build.docs}"/>
|
<fileset dir="${build.docs}"/>
|
||||||
</copy -->
|
</copy>
|
||||||
|
|
||||||
<!-- copy all libraries except helma-YYYYMMDD.jar -->
|
<!-- copy all libraries except helma-YYYYMMDD.jar -->
|
||||||
<copy todir="${build.work}/lib">
|
<copy todir="${build.work}/lib">
|
||||||
|
@ -221,14 +210,14 @@
|
||||||
<copy file="${build.lib}/${jar.name}-${DSTAMP}.jar" tofile="${build.work}/lib/helma.jar"/>
|
<copy file="${build.lib}/${jar.name}-${DSTAMP}.jar" tofile="${build.work}/lib/helma.jar"/>
|
||||||
|
|
||||||
<!-- zip the sourcecode -->
|
<!-- zip the sourcecode -->
|
||||||
<!-- mkdir dir="${build.work}/src"/>
|
<mkdir dir="${build.work}/src"/>
|
||||||
<tar tarfile="${build.work}/src/helma-src.tar" basedir="${build.src}/">
|
<tar tarfile="${build.work}/src/helma-src.tar" basedir="${build.src}/">
|
||||||
<tarfileset dir="${build.src}">
|
<tarfileset dir="${build.src}">
|
||||||
<include name="${build.src}/**"/>
|
<include name="${build.src}/**"/>
|
||||||
</tarfileset>
|
</tarfileset>
|
||||||
</tar>
|
</tar>
|
||||||
<gzip zipfile="${build.work}/src/helma-src.tar.gz" src="${build.work}/src/helma-src.tar"/>
|
<gzip zipfile="${build.work}/src/helma-src.tar.gz" src="${build.work}/src/helma-src.tar"/>
|
||||||
<delete file="${build.work}/src/helma-src.tar"/ -->
|
<delete file="${build.work}/src/helma-src.tar"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,14 +226,14 @@
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
<target name="package-apps" depends="init">
|
<target name="package-apps" depends="init">
|
||||||
|
|
||||||
<mkdir dir="${build.work}/apps" />
|
<mkdir dir="${build.work}/apps" />
|
||||||
|
|
||||||
<!-- get demo apps -->
|
<!-- get demo apps -->
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="base" dest="${build.work}/apps" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="base" dest="${build.work}/apps" />
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="bloggerapi" dest="${build.work}/apps" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="bloggerapi" dest="${build.work}/apps" />
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="himp" dest="${build.work}/apps" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="himp" dest="${build.work}/apps" />
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="hopblog" dest="${build.work}/apps" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="hopblog" dest="${build.work}/apps" />
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="lillebror" dest="${build.work}/apps" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="lillebror" dest="${build.work}/apps" />
|
||||||
|
|
||||||
<antcall target="package-manage" />
|
<antcall target="package-manage" />
|
||||||
|
|
||||||
|
@ -266,7 +255,7 @@ manage
|
||||||
<!-- Checkout and zip manage application -->
|
<!-- Checkout and zip manage application -->
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
<target name="package-manage" depends="init">
|
<target name="package-manage" depends="init">
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="manage" dest="${build.work}" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="manage" dest="${build.work}" />
|
||||||
<mkdir dir="${build.work}/apps/manage"/>
|
<mkdir dir="${build.work}/apps/manage"/>
|
||||||
<zip zipfile="${build.work}/apps/manage/manage.zip" basedir="${build.work}/manage/" includes="**" excludes="**/properties,readme/**" />
|
<zip zipfile="${build.work}/apps/manage/manage.zip" basedir="${build.work}/manage/" includes="**" excludes="**/properties,readme/**" />
|
||||||
<copy todir="${build.work}/apps/manage">
|
<copy todir="${build.work}/apps/manage">
|
||||||
|
@ -302,7 +291,7 @@ manage
|
||||||
<!-- needs parameter ${filename} for final dist-file -->
|
<!-- needs parameter ${filename} for final dist-file -->
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
<target name="package-zip" depends="init">
|
<target name="package-zip" depends="init">
|
||||||
<mkdir dir="${build.dist}" />
|
<mkdir dir="${build.dist}" />
|
||||||
<fixcrlf srcdir="${build.work}" eol="crlf" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml" />
|
<fixcrlf srcdir="${build.work}" eol="crlf" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml" />
|
||||||
<zip zipfile="${build.dist}/${filename}.zip">
|
<zip zipfile="${build.dist}/${filename}.zip">
|
||||||
<zipfileset dir="${build.work}" prefix="${filename}" includes="**" />
|
<zipfileset dir="${build.work}" prefix="${filename}" includes="**" />
|
||||||
|
@ -310,34 +299,6 @@ manage
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<!-- =================================================================== -->
|
|
||||||
<!-- Packages Helma src and build directories with TAR-GZIP -->
|
|
||||||
<!-- needs parameter ${filename} for final dist-file -->
|
|
||||||
<!-- =================================================================== -->
|
|
||||||
<target name="package-src-tgz" depends="init">
|
|
||||||
<mkdir dir="${build.dist}" />
|
|
||||||
<tar tarfile="${build.dist}/${filename}-src.tar">
|
|
||||||
<tarfileset prefix="${filename}" dir="${home.dir}"
|
|
||||||
includes="src/**,build/**,license.txt,licenses/**"/>
|
|
||||||
</tar>
|
|
||||||
<gzip zipfile="${build.dist}/${filename}-src.tar.gz" src="${build.dist}/${filename}-src.tar"/>
|
|
||||||
<delete file="${build.dist}/${filename}-src.tar"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- =================================================================== -->
|
|
||||||
<!-- Packages Helma src and build directories with ZIP -->
|
|
||||||
<!-- needs parameter ${filename} for final dist-file -->
|
|
||||||
<!-- =================================================================== -->
|
|
||||||
<target name="package-src-zip" depends="init">
|
|
||||||
<mkdir dir="${build.dist}" />
|
|
||||||
<zip zipfile="${build.dist}/${filename}-src.zip">
|
|
||||||
<zipfileset dir="${home.dir}" prefix="${filename}"
|
|
||||||
includes="src/**,build/**,license.txt,licenses/**" />
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
<!-- Make Antclick package (helma plus Antville and manage apps) -->
|
<!-- Make Antclick package (helma plus Antville and manage apps) -->
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
|
@ -387,27 +348,27 @@ manage
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
<!-- Gets an application from the cvs and zips/targzs it -->
|
<!-- Gets an application from the cvs and zips/targzs it -->
|
||||||
<!-- =================================================================== -->
|
<!-- =================================================================== -->
|
||||||
<target name="app" depends="init">
|
<target name="app" depends="init">
|
||||||
<mkdir dir="${build.dist}" />
|
<mkdir dir="${build.dist}" />
|
||||||
<mkdir dir="${build.work}" />
|
<mkdir dir="${build.work}" />
|
||||||
|
|
||||||
<!-- to retrieve special versions of an application insert
|
<!-- to retrieve special versions of an application insert
|
||||||
additional attributes: tag="TAGNAME" or date="1972-09-24 20:05" -->
|
additional attributes: tag="TAGNAME" or date="1972-09-24 20:05" -->
|
||||||
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="${application}" dest="${build.work}" />
|
<cvs cvsRoot="${cvs.root.apps}" command="export" tag="HEAD" package="${application}" dest="${build.work}" />
|
||||||
|
|
||||||
<fixcrlf srcdir="${build.work}" eol="crlf" eof="add" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml" />
|
<fixcrlf srcdir="${build.work}" eol="crlf" eof="add" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml" />
|
||||||
<zip zipfile="${build.dist}/${application}-${DSTAMP}.zip" basedir="${build.work}" includes="**"/>
|
<zip zipfile="${build.dist}/${application}-${DSTAMP}.zip" basedir="${build.work}" includes="**"/>
|
||||||
|
|
||||||
<fixcrlf srcdir="${build.work}" eol="lf" eof="remove" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin" />
|
<fixcrlf srcdir="${build.work}" eol="lf" eof="remove" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin" />
|
||||||
<tar tarfile="${build.dist}/${application}-${DSTAMP}.tar" basedir="${build.work}">
|
<tar tarfile="${build.dist}/${application}-${DSTAMP}.tar" basedir="${build.work}">
|
||||||
<tarfileset dir="${build.work}">
|
<tarfileset dir="${build.work}">
|
||||||
<include name="${build.work}/**"/>
|
<include name="${build.work}/**"/>
|
||||||
</tarfileset>
|
</tarfileset>
|
||||||
</tar>
|
</tar>
|
||||||
<gzip zipfile="${build.dist}/${application}-${DSTAMP}.tar.gz" src="${build.dist}/${application}-${DSTAMP}.tar" />
|
<gzip zipfile="${build.dist}/${application}-${DSTAMP}.tar.gz" src="${build.dist}/${application}-${DSTAMP}.tar" />
|
||||||
|
|
||||||
<delete file="${build.dist}/${application}-${DSTAMP}.tar" />
|
<delete file="${build.dist}/${application}-${DSTAMP}.tar" />
|
||||||
<delete dir="${build.work}" />
|
<delete dir="${build.work}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -35,7 +35,7 @@ rem set JAVA_OPTIONS=-server -Xmx128m
|
||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
:: Setting the script path
|
:: Setting the script path
|
||||||
set INSTALL_DIR=%~d0%~p0
|
set SCRIPT_DIR=%~d0%~p0
|
||||||
|
|
||||||
:: Using JAVA_HOME variable if defined. Otherwise,
|
:: Using JAVA_HOME variable if defined. Otherwise,
|
||||||
:: Java executable must be contained in PATH variable
|
:: Java executable must be contained in PATH variable
|
||||||
|
@ -48,7 +48,7 @@ if "%JAVA_HOME%"=="" goto default
|
||||||
|
|
||||||
:: Setting HOP_HOME to script path if undefined
|
:: Setting HOP_HOME to script path if undefined
|
||||||
if "%HOP_HOME%"=="" (
|
if "%HOP_HOME%"=="" (
|
||||||
set HOP_HOME=%INSTALL_DIR%
|
set HOP_HOME=%SCRIPT_DIR%
|
||||||
)
|
)
|
||||||
cd %HOP_HOME%
|
cd %HOP_HOME%
|
||||||
|
|
||||||
|
@ -76,4 +76,4 @@ if not "%HOP_HOME%"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Invoking the Java virtual machine
|
:: Invoking the Java virtual machine
|
||||||
%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS%
|
%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS%
|
||||||
|
|
|
@ -32,11 +32,6 @@ else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the Helma installation directory
|
|
||||||
INSTALL_DIR="${0%/*}"
|
|
||||||
cd $INSTALL_DIR
|
|
||||||
INSTALL_DIR=$PWD
|
|
||||||
|
|
||||||
# get HOP_HOME variable if it isn't set
|
# get HOP_HOME variable if it isn't set
|
||||||
if test -z "$HOP_HOME"; then
|
if test -z "$HOP_HOME"; then
|
||||||
# try to get HOP_HOME from script file and pwd
|
# try to get HOP_HOME from script file and pwd
|
||||||
|
@ -69,5 +64,5 @@ if [ "$HOP_HOME" ]; then
|
||||||
SWITCHES="$SWITCHES -h $HOP_HOME"
|
SWITCHES="$SWITCHES -h $HOP_HOME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Invoke the Java VM
|
# Invoking the Java VM
|
||||||
$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES
|
$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES
|
||||||
|
|
6
hop.bat
6
hop.bat
|
@ -35,7 +35,7 @@ rem set JAVA_OPTIONS=-server -Xmx128m
|
||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
:: Setting the script path
|
:: Setting the script path
|
||||||
set INSTALL_DIR=%~d0%~p0
|
set SCRIPT_DIR=%~d0%~p0
|
||||||
|
|
||||||
:: Using JAVA_HOME variable if defined. Otherwise,
|
:: Using JAVA_HOME variable if defined. Otherwise,
|
||||||
:: Java executable must be contained in PATH variable
|
:: Java executable must be contained in PATH variable
|
||||||
|
@ -48,7 +48,7 @@ if "%JAVA_HOME%"=="" goto default
|
||||||
|
|
||||||
:: Setting HOP_HOME to script path if undefined
|
:: Setting HOP_HOME to script path if undefined
|
||||||
if "%HOP_HOME%"=="" (
|
if "%HOP_HOME%"=="" (
|
||||||
set HOP_HOME=%INSTALL_DIR%
|
set HOP_HOME=%SCRIPT_DIR%
|
||||||
)
|
)
|
||||||
cd %HOP_HOME%
|
cd %HOP_HOME%
|
||||||
|
|
||||||
|
@ -76,4 +76,4 @@ if not "%HOP_HOME%"=="" (
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Invoking the Java virtual machine
|
:: Invoking the Java virtual machine
|
||||||
%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS%
|
%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS%
|
||||||
|
|
9
hop.sh
9
hop.sh
|
@ -32,11 +32,6 @@ else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the Helma installation directory
|
|
||||||
INSTALL_DIR="${0%/*}"
|
|
||||||
cd $INSTALL_DIR
|
|
||||||
INSTALL_DIR=$PWD
|
|
||||||
|
|
||||||
# get HOP_HOME variable if it isn't set
|
# get HOP_HOME variable if it isn't set
|
||||||
if test -z "$HOP_HOME"; then
|
if test -z "$HOP_HOME"; then
|
||||||
# try to get HOP_HOME from script file and pwd
|
# try to get HOP_HOME from script file and pwd
|
||||||
|
@ -69,5 +64,5 @@ if [ "$HOP_HOME" ]; then
|
||||||
SWITCHES="$SWITCHES -h $HOP_HOME"
|
SWITCHES="$SWITCHES -h $HOP_HOME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Invoke the Java VM
|
# Invoking the Java VM
|
||||||
$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES
|
$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES
|
||||||
|
|
BIN
lib/jetty.jar
BIN
lib/jetty.jar
Binary file not shown.
|
@ -78,11 +78,6 @@ class CompatibilityDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // convert
|
||||||
|
|
||||||
// convert
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// class CompatibilityDescriptor
|
|
||||||
|
|
||||||
|
} // class CompatibilityDescriptor
|
|
@ -185,15 +185,11 @@ public final class ESArguments extends ESObject {
|
||||||
ESValue[] argumentValues) {
|
ESValue[] argumentValues) {
|
||||||
ObjectPrototype op =
|
ObjectPrototype op =
|
||||||
(ObjectPrototype) evaluator.getObjectPrototype();
|
(ObjectPrototype) evaluator.getObjectPrototype();
|
||||||
// Get maximum number of arguments (formal or actual), as
|
|
||||||
// more than the number of formal arguments can be reached
|
|
||||||
// using the (old fashioned) arguments variable).
|
|
||||||
int maxArgs = Math.max(argumentValues.length, argumentNames.length);
|
|
||||||
ESArguments args = new ESArguments(op, evaluator, argumentNames,
|
ESArguments args = new ESArguments(op, evaluator, argumentNames,
|
||||||
maxArgs,
|
Math.max(argumentValues.length, argumentNames.length),
|
||||||
callee);
|
callee);
|
||||||
try {
|
try {
|
||||||
for (int i=0; i<maxArgs; i++) {
|
for (int i=0; i<argumentValues.length; i++) {
|
||||||
ESValue val = (i<argumentValues.length) ? argumentValues[i] :
|
ESValue val = (i<argumentValues.length) ? argumentValues[i] :
|
||||||
ESUndefined.theUndefined;
|
ESUndefined.theUndefined;
|
||||||
if (i<argumentNames.length) {
|
if (i<argumentNames.length) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ESBeans extends ESLoader {
|
||||||
*/
|
*/
|
||||||
public ESBeans(String packageName,
|
public ESBeans(String packageName,
|
||||||
ESBeans previousPackage,
|
ESBeans previousPackage,
|
||||||
ClassLoader classLoader,
|
LocalClassLoader classLoader,
|
||||||
Evaluator evaluator) {
|
Evaluator evaluator) {
|
||||||
super(packageName,previousPackage,classLoader,evaluator);
|
super(packageName,previousPackage,classLoader,evaluator);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class ESBeans extends ESLoader {
|
||||||
throw new EcmaScriptException("Missing class directory or jar file name");
|
throw new EcmaScriptException("Missing class directory or jar file name");
|
||||||
}
|
}
|
||||||
String directoryOrJar = arguments[0].toString();
|
String directoryOrJar = arguments[0].toString();
|
||||||
ClassLoader classLoader =
|
LocalClassLoader classLoader =
|
||||||
LocalClassLoader.makeLocalClassLoader(directoryOrJar);
|
LocalClassLoader.makeLocalClassLoader(directoryOrJar);
|
||||||
return new ESBeans(null, null, classLoader, evaluator);
|
return new ESBeans(null, null, classLoader, evaluator);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class ESLoader extends ESObject {
|
||||||
// Incremental package name
|
// Incremental package name
|
||||||
protected String packageName = null;
|
protected String packageName = null;
|
||||||
protected ESLoader previousPackage = null;
|
protected ESLoader previousPackage = null;
|
||||||
protected ClassLoader classLoader = null;
|
protected LocalClassLoader classLoader = null;
|
||||||
|
|
||||||
// the non compatible flag
|
// the non compatible flag
|
||||||
static private CompatibilityDescriptor nonCompatible =
|
static private CompatibilityDescriptor nonCompatible =
|
||||||
|
@ -70,14 +70,6 @@ public abstract class ESLoader extends ESObject {
|
||||||
super(null, evaluator);
|
super(null, evaluator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* To contruct the Bean or Package object with a specific class loader
|
|
||||||
*/
|
|
||||||
public ESLoader(Evaluator evaluator, ClassLoader loader) {
|
|
||||||
super(null, evaluator);
|
|
||||||
this.classLoader = loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To construct a bean or package sub-object (with a specific
|
* To construct a bean or package sub-object (with a specific
|
||||||
* partial or complete package name
|
* partial or complete package name
|
||||||
|
@ -88,7 +80,7 @@ public abstract class ESLoader extends ESObject {
|
||||||
*/
|
*/
|
||||||
public ESLoader(String packageName,
|
public ESLoader(String packageName,
|
||||||
ESLoader previousPackage,
|
ESLoader previousPackage,
|
||||||
ClassLoader classLoader,
|
LocalClassLoader classLoader,
|
||||||
Evaluator evaluator) {
|
Evaluator evaluator) {
|
||||||
super(null, evaluator);
|
super(null, evaluator);
|
||||||
this.packageName = packageName;
|
this.packageName = packageName;
|
||||||
|
|
|
@ -43,14 +43,6 @@ public class ESPackages extends ESLoader {
|
||||||
super(evaluator);
|
super(evaluator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the top level package loader (object Package)
|
|
||||||
* @param evaluator the evaluator
|
|
||||||
*/
|
|
||||||
public ESPackages(Evaluator evaluator, ClassLoader loader) {
|
|
||||||
super(evaluator, loader);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new package loader or package prefix
|
* Create a new package loader or package prefix
|
||||||
* @param packageName The extension of the package name
|
* @param packageName The extension of the package name
|
||||||
|
@ -60,7 +52,7 @@ public class ESPackages extends ESLoader {
|
||||||
*/
|
*/
|
||||||
public ESPackages(String packageName,
|
public ESPackages(String packageName,
|
||||||
ESPackages previousPackage,
|
ESPackages previousPackage,
|
||||||
ClassLoader classLoader,
|
LocalClassLoader classLoader,
|
||||||
Evaluator evaluator) {
|
Evaluator evaluator) {
|
||||||
super(packageName,previousPackage,classLoader,evaluator);
|
super(packageName,previousPackage,classLoader,evaluator);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +117,7 @@ public class ESPackages extends ESLoader {
|
||||||
throw new EcmaScriptException("Missing class directory or file name");
|
throw new EcmaScriptException("Missing class directory or file name");
|
||||||
}
|
}
|
||||||
String directoryOrJar = arguments[0].toString();
|
String directoryOrJar = arguments[0].toString();
|
||||||
ClassLoader classLoader =
|
LocalClassLoader classLoader =
|
||||||
LocalClassLoader.makeLocalClassLoader(directoryOrJar);
|
LocalClassLoader.makeLocalClassLoader(directoryOrJar);
|
||||||
return new ESPackages(null, null, classLoader, evaluator);
|
return new ESPackages(null, null, classLoader, evaluator);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -338,10 +338,10 @@ class ESRowSet extends ESObject {
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
this.resultSet = resultSet;
|
this.resultSet = resultSet;
|
||||||
|
|
||||||
if (sql==null) throw new NullPointerException("sql");
|
if (sql==null) throw new NullPointerException();
|
||||||
if (resultSet==null) throw new NullPointerException("resultSet");
|
if (resultSet==null) throw new NullPointerException();
|
||||||
if (statement==null) throw new NullPointerException("statement");
|
if (statement==null) throw new NullPointerException();
|
||||||
if (database==null) throw new NullPointerException("database");
|
if (database==null) throw new NullPointerException();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
|
@ -168,13 +168,7 @@ public class ClassInfo {
|
||||||
if (indexedReadMethod != null && indexedReadMethod.getParameterTypes().length != 1) {
|
if (indexedReadMethod != null && indexedReadMethod.getParameterTypes().length != 1) {
|
||||||
throw new ProgrammingError("Indexed getter of property ' " + propertyName + "' should have 1 parameter!");
|
throw new ProgrammingError("Indexed getter of property ' " + propertyName + "' should have 1 parameter!");
|
||||||
}
|
}
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (indexedReadMethod != null && Modifier.isPublic (indexedReadMethod.getModifiers ()))
|
|
||||||
indexedReadMethod.setAccessible (true);
|
|
||||||
if (indexedWriteMethod != null) {
|
if (indexedWriteMethod != null) {
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (Modifier.isPublic (indexedWriteMethod.getModifiers ()))
|
|
||||||
indexedWriteMethod.setAccessible (true);
|
|
||||||
Class [] paramCls = indexedWriteMethod.getParameterTypes();
|
Class [] paramCls = indexedWriteMethod.getParameterTypes();
|
||||||
if (paramCls == null || paramCls.length != 2) {
|
if (paramCls == null || paramCls.length != 2) {
|
||||||
throw new ProgrammingError("Indexed setter of property ' " + propertyName + "' should have 2 parameter!");
|
throw new ProgrammingError("Indexed setter of property ' " + propertyName + "' should have 2 parameter!");
|
||||||
|
@ -194,13 +188,7 @@ public class ClassInfo {
|
||||||
if (readMethod != null && readMethod.getParameterTypes().length != 0) {
|
if (readMethod != null && readMethod.getParameterTypes().length != 0) {
|
||||||
throw new ProgrammingError("Non indexed getter of indxed property ' " + propertyName + "' is not supposed to have a parameter!");
|
throw new ProgrammingError("Non indexed getter of indxed property ' " + propertyName + "' is not supposed to have a parameter!");
|
||||||
}
|
}
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (readMethod != null && Modifier.isPublic (readMethod.getModifiers ()))
|
|
||||||
readMethod.setAccessible (true);
|
|
||||||
if (writeMethod != null) {
|
if (writeMethod != null) {
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (Modifier.isPublic (writeMethod.getModifiers ()))
|
|
||||||
writeMethod.setAccessible (true);
|
|
||||||
Class [] paramCls = writeMethod.getParameterTypes();
|
Class [] paramCls = writeMethod.getParameterTypes();
|
||||||
if (paramCls == null || paramCls.length != 1) {
|
if (paramCls == null || paramCls.length != 1) {
|
||||||
throw new ProgrammingError("Non indexed setter of indexed property ' " + propertyName + "' should have 1 parameter!");
|
throw new ProgrammingError("Non indexed setter of indexed property ' " + propertyName + "' should have 1 parameter!");
|
||||||
|
@ -220,13 +208,7 @@ public class ClassInfo {
|
||||||
if (readMethod != null && readMethod.getParameterTypes().length != 0) {
|
if (readMethod != null && readMethod.getParameterTypes().length != 0) {
|
||||||
throw new ProgrammingError("Non indexed getter of property ' " + propertyName + "' is not supposed to have a parameter!");
|
throw new ProgrammingError("Non indexed getter of property ' " + propertyName + "' is not supposed to have a parameter!");
|
||||||
}
|
}
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (readMethod != null && Modifier.isPublic (readMethod.getModifiers ()))
|
|
||||||
readMethod.setAccessible (true);
|
|
||||||
if (writeMethod != null) {
|
if (writeMethod != null) {
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (Modifier.isPublic (writeMethod.getModifiers ()))
|
|
||||||
writeMethod.setAccessible (true);
|
|
||||||
Class [] paramCls = writeMethod.getParameterTypes();
|
Class [] paramCls = writeMethod.getParameterTypes();
|
||||||
if (paramCls == null || paramCls.length != 1) {
|
if (paramCls == null || paramCls.length != 1) {
|
||||||
throw new ProgrammingError("Non indexed setter of property ' " + propertyName + "' should have 1 parameter!");
|
throw new ProgrammingError("Non indexed setter of property ' " + propertyName + "' should have 1 parameter!");
|
||||||
|
@ -417,7 +399,6 @@ public class ClassInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // if class not public
|
} // if class not public
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (Modifier.isPublic (method.getModifiers ()))
|
if (Modifier.isPublic (method.getModifiers ()))
|
||||||
method.setAccessible (true);
|
method.setAccessible (true);
|
||||||
// save it
|
// save it
|
||||||
|
@ -537,7 +518,6 @@ public class ClassInfo {
|
||||||
}
|
}
|
||||||
} // for
|
} // for
|
||||||
} // if class not public
|
} // if class not public
|
||||||
// Work around reflection bug, Hannes Wallnoefer 11/2002
|
|
||||||
if (Modifier.isPublic (method.getModifiers ()))
|
if (Modifier.isPublic (method.getModifiers ()))
|
||||||
method.setAccessible (true);
|
method.setAccessible (true);
|
||||||
// save it
|
// save it
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
// ESNode wrappers must be checked with equals() because
|
// ESNode wrappers must be checked with equals() because
|
||||||
// it's possible that different wrappers wrap the same node!
|
// it's possible that different wrappers wrap the same node!
|
||||||
if (v1 instanceof helma.scripting.fesi.ESNode ||
|
if (v1 instanceof helma.scripting.fesi.ESNode ||
|
||||||
v1 instanceof helma.scripting.fesi.ESGenericObject) {
|
v1 instanceof helma.scripting.fesi.ESGenericObject) {
|
||||||
return v1.equals (v2);
|
return v1.equals (v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,8 +311,8 @@ public class EcmaScriptEvaluateVisitor
|
||||||
|
|
||||||
public Object visit(ASTStatementList node, Object data) {
|
public Object visit(ASTStatementList node, Object data) {
|
||||||
int n = node.jjtGetNumChildren();
|
int n = node.jjtGetNumChildren();
|
||||||
// Return ESUndefined for empty statement lists (for
|
// Accepts empty statement lists (for example generated
|
||||||
// example generated by calling 'function(){}')
|
// by function(){}
|
||||||
Object result = ESUndefined.theUndefined;
|
Object result = ESUndefined.theUndefined;
|
||||||
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
|
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
|
||||||
if (completionCode != C_NORMAL) return result;
|
if (completionCode != C_NORMAL) return result;
|
||||||
|
@ -344,11 +344,11 @@ public class EcmaScriptEvaluateVisitor
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object visit(ASTVariableDeclaration node, Object data) {
|
public Object visit(ASTVariableDeclaration node, Object data) {
|
||||||
Object result = null;
|
|
||||||
int nChildren = node.jjtGetNumChildren();
|
int nChildren = node.jjtGetNumChildren();
|
||||||
if (nChildren<1 || nChildren>2) {
|
if (nChildren<1 || nChildren>2) {
|
||||||
throw new ProgrammingError("Bad AST in variable declaration");
|
throw new ProgrammingError("Bad AST in variable declaration");
|
||||||
}
|
}
|
||||||
|
Object result = null;
|
||||||
if (nChildren == 2) {
|
if (nChildren == 2) {
|
||||||
try {
|
try {
|
||||||
Object lvo = node.jjtGetChild(0).jjtAccept(this,FOR_REFERENCE);
|
Object lvo = node.jjtGetChild(0).jjtAccept(this,FOR_REFERENCE);
|
||||||
|
@ -376,7 +376,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
throw new ProgrammingError("Bad AST in IF statement");
|
throw new ProgrammingError("Bad AST in IF statement");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ESValue testValue = acceptNull(node.jjtGetChild(0).jjtAccept(this, FOR_VALUE));
|
ESValue testValue = (ESValue) node.jjtGetChild(0).jjtAccept(this, FOR_VALUE);
|
||||||
boolean test = testValue.booleanValue();
|
boolean test = testValue.booleanValue();
|
||||||
if (test) {
|
if (test) {
|
||||||
result = node.jjtGetChild(1).jjtAccept(this,FOR_VALUE);
|
result = node.jjtGetChild(1).jjtAccept(this,FOR_VALUE);
|
||||||
|
@ -395,7 +395,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
Object result = null;
|
Object result = null;
|
||||||
node.assertTwoChildren();
|
node.assertTwoChildren();
|
||||||
try {
|
try {
|
||||||
ESValue testValue = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
ESValue testValue = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
while (testValue.booleanValue()) {
|
while (testValue.booleanValue()) {
|
||||||
|
|
||||||
// Thread.yield ();
|
// Thread.yield ();
|
||||||
|
@ -409,10 +409,10 @@ public class EcmaScriptEvaluateVisitor
|
||||||
completionCode = C_NORMAL;
|
completionCode = C_NORMAL;
|
||||||
return result;
|
return result;
|
||||||
} else if (completionCode == C_CONTINUE) {
|
} else if (completionCode == C_CONTINUE) {
|
||||||
testValue = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
completionCode = C_NORMAL;
|
completionCode = C_NORMAL;
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (EcmaScriptException e) {
|
} catch (EcmaScriptException e) {
|
||||||
|
@ -433,7 +433,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (testNode instanceof ASTEmptyExpression) {
|
if (testNode instanceof ASTEmptyExpression) {
|
||||||
testValue = ESBoolean.makeBoolean(true);
|
testValue = ESBoolean.makeBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
while (testValue.booleanValue()) {
|
while (testValue.booleanValue()) {
|
||||||
// Thread.yield ();
|
// Thread.yield ();
|
||||||
|
@ -452,7 +452,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (testNode instanceof ASTEmptyExpression) {
|
if (testNode instanceof ASTEmptyExpression) {
|
||||||
testValue = ESBoolean.makeBoolean(true);
|
testValue = ESBoolean.makeBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
completionCode = C_NORMAL;
|
completionCode = C_NORMAL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -460,7 +460,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (testNode instanceof ASTEmptyExpression) {
|
if (testNode instanceof ASTEmptyExpression) {
|
||||||
testValue = ESBoolean.makeBoolean(true);
|
testValue = ESBoolean.makeBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (testNode instanceof ASTEmptyExpression) {
|
if (testNode instanceof ASTEmptyExpression) {
|
||||||
testValue = ESBoolean.makeBoolean(true);
|
testValue = ESBoolean.makeBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
while (testValue.booleanValue()) {
|
while (testValue.booleanValue()) {
|
||||||
result = node.jjtGetChild(3).jjtAccept(this,FOR_VALUE);
|
result = node.jjtGetChild(3).jjtAccept(this,FOR_VALUE);
|
||||||
|
@ -498,7 +498,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (testNode instanceof ASTEmptyExpression) {
|
if (testNode instanceof ASTEmptyExpression) {
|
||||||
testValue = ESBoolean.makeBoolean(true);
|
testValue = ESBoolean.makeBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
completionCode = C_NORMAL;
|
completionCode = C_NORMAL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -506,7 +506,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (testNode instanceof ASTEmptyExpression) {
|
if (testNode instanceof ASTEmptyExpression) {
|
||||||
testValue = ESBoolean.makeBoolean(true);
|
testValue = ESBoolean.makeBoolean(true);
|
||||||
} else {
|
} else {
|
||||||
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
|
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
Object result = null; // No value by default
|
Object result = null; // No value by default
|
||||||
node.assertThreeChildren();
|
node.assertThreeChildren();
|
||||||
try {
|
try {
|
||||||
ESValue ob = acceptNull(node.jjtGetChild(1).jjtAccept(this,FOR_VALUE));
|
ESValue ob = (ESValue) node.jjtGetChild(1).jjtAccept(this,FOR_VALUE);
|
||||||
ESObject obj = (ESObject) ob.toESObject(evaluator);
|
ESObject obj = (ESObject) ob.toESObject(evaluator);
|
||||||
boolean directEnumeration = obj.isDirectEnumerator();
|
boolean directEnumeration = obj.isDirectEnumerator();
|
||||||
for (Enumeration e = obj.getProperties() ; e.hasMoreElements() ;) {
|
for (Enumeration e = obj.getProperties() ; e.hasMoreElements() ;) {
|
||||||
|
@ -576,10 +576,10 @@ public class EcmaScriptEvaluateVisitor
|
||||||
// Should not happen as it should be an identifier
|
// Should not happen as it should be an identifier
|
||||||
throw new ProgrammingError("Value '"+lvo.toString()+"' is not a variable");
|
throw new ProgrammingError("Value '"+lvo.toString()+"' is not a variable");
|
||||||
}
|
}
|
||||||
ESValue init = acceptNull(node.jjtGetChild(1).jjtAccept(this, FOR_VALUE));
|
ESValue init = (ESValue) node.jjtGetChild(1).jjtAccept(this, FOR_VALUE);
|
||||||
evaluator.putValue(lv, init);
|
evaluator.putValue(lv, init);
|
||||||
|
|
||||||
ESValue ob = acceptNull(node.jjtGetChild(2).jjtAccept(this,FOR_VALUE));
|
ESValue ob = (ESValue) node.jjtGetChild(2).jjtAccept(this,FOR_VALUE);
|
||||||
ESObject obj = (ESObject) ob.toESObject(evaluator);
|
ESObject obj = (ESObject) ob.toESObject(evaluator);
|
||||||
boolean directEnumeration = obj.isDirectEnumerator();
|
boolean directEnumeration = obj.isDirectEnumerator();
|
||||||
for (Enumeration e = obj.getProperties() ; e.hasMoreElements() ;) {
|
for (Enumeration e = obj.getProperties() ; e.hasMoreElements() ;) {
|
||||||
|
@ -635,7 +635,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
ESValue result = null;
|
ESValue result = null;
|
||||||
try {
|
try {
|
||||||
EvaluationSource es = (EvaluationSource) node.getEvaluationSource();
|
EvaluationSource es = (EvaluationSource) node.getEvaluationSource();
|
||||||
ESValue scopeValue = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
ESValue scopeValue = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
ASTStatement statementNode = (ASTStatement) (node.jjtGetChild(1));
|
ASTStatement statementNode = (ASTStatement) (node.jjtGetChild(1));
|
||||||
ESObject scopeObject = (ESObject) scopeValue.toESObject(evaluator);
|
ESObject scopeObject = (ESObject) scopeValue.toESObject(evaluator);
|
||||||
result = evaluator.evaluateWith(statementNode, scopeObject, es);
|
result = evaluator.evaluateWith(statementNode, scopeObject, es);
|
||||||
|
@ -679,7 +679,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
String id = ((ASTIdentifier)baseNode).getName();
|
String id = ((ASTIdentifier)baseNode).getName();
|
||||||
currentProperty = new ESString(id);
|
currentProperty = new ESString(id);
|
||||||
} else {
|
} else {
|
||||||
lastResult = acceptNull(baseNode.jjtAccept(this,FOR_VALUE));
|
lastResult = (ESValue) baseNode.jjtAccept(this,FOR_VALUE);
|
||||||
currentProperty = null; // No reference so far
|
currentProperty = null; // No reference so far
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -811,10 +811,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
//System.out.println("--->Build value cp: " + currentProperty + " lr: " + lastResult + "<---"); // ********
|
//System.out.println("--->Build value cp: " + currentProperty + " lr: " + lastResult + "<---"); // ********
|
||||||
if (currentProperty != null) {
|
if (currentProperty != null) {
|
||||||
// Must dereference value
|
// Must dereference value
|
||||||
if (lastResult == null) {
|
ESObject currentBase = (ESObject) lastResult.toESObject(evaluator);
|
||||||
throw new EcmaScriptException("'undefined' is not an object with properties");
|
|
||||||
}
|
|
||||||
ESObject currentBase = (ESObject) lastResult.toESObject(evaluator);
|
|
||||||
String propertyName = currentProperty.toString();
|
String propertyName = currentProperty.toString();
|
||||||
//System.out.println("--->getProperty in cb: " + currentBase + " pn: " + propertyName + "<---"); // *******
|
//System.out.println("--->getProperty in cb: " + currentBase + " pn: " + propertyName + "<---"); // *******
|
||||||
result = currentBase.getProperty(propertyName,propertyName.hashCode());
|
result = currentBase.getProperty(propertyName,propertyName.hashCode());
|
||||||
|
@ -825,9 +822,6 @@ public class EcmaScriptEvaluateVisitor
|
||||||
} else {
|
} else {
|
||||||
// We want a reference - therefore it cannot be just a value, it
|
// We want a reference - therefore it cannot be just a value, it
|
||||||
// must be a delayed reference.
|
// must be a delayed reference.
|
||||||
if (lastResult == null) {
|
|
||||||
throw new EcmaScriptException("'undefined' is not an assignable value");
|
|
||||||
}
|
|
||||||
if (currentProperty == null) {
|
if (currentProperty == null) {
|
||||||
throw new EcmaScriptException("'"+lastResult.toString()+"' is not an assignable value");
|
throw new EcmaScriptException("'"+lastResult.toString()+"' is not an assignable value");
|
||||||
}
|
}
|
||||||
|
@ -856,7 +850,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
|
|
||||||
public Object visit(ASTPropertyValueReference node, Object data) {
|
public Object visit(ASTPropertyValueReference node, Object data) {
|
||||||
node.assertOneChild();
|
node.assertOneChild();
|
||||||
return acceptNull(node.jjtGetChild(0).jjtAccept(this, FOR_VALUE));
|
return node.jjtGetChild(0).jjtAccept(this, FOR_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object visit(ASTPropertyIdentifierReference node, Object data) {
|
public Object visit(ASTPropertyIdentifierReference node, Object data) {
|
||||||
|
@ -878,8 +872,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
try {
|
try {
|
||||||
int nChildren=node.jjtGetNumChildren();
|
int nChildren=node.jjtGetNumChildren();
|
||||||
Node baseNode = node.jjtGetChild(0);
|
Node baseNode = node.jjtGetChild(0);
|
||||||
// Can be any expression (in fact a a.b.c sequence) [code bizare here]
|
ESValue constr = (ESValue) baseNode.jjtAccept(this, FOR_VALUE); // Can be any expression (in fact a a.b.c sequence)
|
||||||
ESValue constr = acceptNull(baseNode.jjtAccept(this, FOR_VALUE));
|
|
||||||
Node compositor = node.jjtGetChild(1);
|
Node compositor = node.jjtGetChild(1);
|
||||||
if (compositor instanceof ASTFunctionCallParameters) {
|
if (compositor instanceof ASTFunctionCallParameters) {
|
||||||
ASTFunctionCallParameters fc = (ASTFunctionCallParameters) compositor;
|
ASTFunctionCallParameters fc = (ASTFunctionCallParameters) compositor;
|
||||||
|
@ -963,8 +956,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
if (n instanceof ASTIdentifier) {
|
if (n instanceof ASTIdentifier) {
|
||||||
// We need to get a reference, as an null based referenced is "undefined"
|
// We need to get a reference, as an null based referenced is "undefined"
|
||||||
ESReference ref = (ESReference) n.jjtAccept(this,FOR_REFERENCE);
|
ESReference ref = (ESReference) n.jjtAccept(this,FOR_REFERENCE);
|
||||||
// If reference to nothing, consider undefined
|
if (ref.getBase()==null) {
|
||||||
if (ref == null || ref.getBase()==null) {
|
|
||||||
r = new ESString("undefined");
|
r = new ESString("undefined");
|
||||||
} else {
|
} else {
|
||||||
ESValue v = ref.getValue();
|
ESValue v = ref.getValue();
|
||||||
|
@ -972,7 +964,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// It is a value, directly get its string
|
// It is a value, directly get its string
|
||||||
ESValue v = acceptNull(n.jjtAccept(this,FOR_VALUE));
|
ESValue v = (ESValue) n.jjtAccept(this,FOR_VALUE);
|
||||||
r = new ESString(v.getTypeofString());
|
r = new ESString(v.getTypeofString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1043,9 +1035,9 @@ public class EcmaScriptEvaluateVisitor
|
||||||
public Object visit(ASTBinaryExpressionSequence node, Object data) {
|
public Object visit(ASTBinaryExpressionSequence node, Object data) {
|
||||||
ESValue result = null;
|
ESValue result = null;
|
||||||
try {
|
try {
|
||||||
ESValue v1 = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
ESValue v1 = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
for (int i = 0; i < node.jjtGetNumChildren()-1; i+=2) {
|
for (int i = 0; i < node.jjtGetNumChildren()-1; i+=2) {
|
||||||
ESValue v2 = acceptNull(node.jjtGetChild(i+2).jjtAccept(this,FOR_VALUE));
|
ESValue v2 = (ESValue) node.jjtGetChild(i+2).jjtAccept(this,FOR_VALUE);
|
||||||
int operator = ((ASTOperator)(node.jjtGetChild(i+1))).getOperator();
|
int operator = ((ASTOperator)(node.jjtGetChild(i+1))).getOperator();
|
||||||
// System.out.println("V1 = " + v1 + " v2 = " + v2);
|
// System.out.println("V1 = " + v1 + " v2 = " + v2);
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
|
@ -1176,10 +1168,10 @@ public class EcmaScriptEvaluateVisitor
|
||||||
ESValue result = null;
|
ESValue result = null;
|
||||||
int nChildren = node.jjtGetNumChildren();
|
int nChildren = node.jjtGetNumChildren();
|
||||||
try {
|
try {
|
||||||
result = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
result = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (result.booleanValue() && (i<nChildren)) {
|
while (result.booleanValue() && (i<nChildren)) {
|
||||||
result = acceptNull(node.jjtGetChild(i).jjtAccept(this,FOR_VALUE));
|
result = (ESValue) node.jjtGetChild(i).jjtAccept(this,FOR_VALUE);
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
// Normalize to primitive - could be optimized...
|
// Normalize to primitive - could be optimized...
|
||||||
|
@ -1194,10 +1186,10 @@ public class EcmaScriptEvaluateVisitor
|
||||||
int nChildren = node.jjtGetNumChildren();
|
int nChildren = node.jjtGetNumChildren();
|
||||||
ESValue result = null;
|
ESValue result = null;
|
||||||
try {
|
try {
|
||||||
result = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
result = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while ((!result.booleanValue()) && (i<nChildren)) {
|
while ((!result.booleanValue()) && (i<nChildren)) {
|
||||||
result = acceptNull(node.jjtGetChild(i).jjtAccept(this,FOR_VALUE));
|
result = (ESValue) node.jjtGetChild(i).jjtAccept(this,FOR_VALUE);
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
// Normalize to primitive - could be optimized...
|
// Normalize to primitive - could be optimized...
|
||||||
|
@ -1218,7 +1210,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
node.assertThreeChildren();
|
node.assertThreeChildren();
|
||||||
Object result = null;
|
Object result = null;
|
||||||
try {
|
try {
|
||||||
ESValue t = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
|
ESValue t = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
|
||||||
boolean test = t.booleanValue();
|
boolean test = t.booleanValue();
|
||||||
if (test) {
|
if (test) {
|
||||||
result = node.jjtGetChild(1).jjtAccept(this, FOR_VALUE);
|
result = node.jjtGetChild(1).jjtAccept(this, FOR_VALUE);
|
||||||
|
@ -1236,6 +1228,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
ESValue result = null;
|
ESValue result = null;
|
||||||
try {
|
try {
|
||||||
// Get left hand side
|
// Get left hand side
|
||||||
|
|
||||||
Object lvo = node.jjtGetChild(0).jjtAccept(this,FOR_REFERENCE);
|
Object lvo = node.jjtGetChild(0).jjtAccept(this,FOR_REFERENCE);
|
||||||
//System.out.println("REF: " + lvo);
|
//System.out.println("REF: " + lvo);
|
||||||
ESReference lv;
|
ESReference lv;
|
||||||
|
@ -1245,7 +1238,8 @@ public class EcmaScriptEvaluateVisitor
|
||||||
throw new EcmaScriptException("Value '"+lvo.toString()+"' is not an assignable object or property");
|
throw new EcmaScriptException("Value '"+lvo.toString()+"' is not an assignable object or property");
|
||||||
}
|
}
|
||||||
|
|
||||||
ESValue v2 = acceptNull(node.jjtGetChild(2).jjtAccept(this,FOR_VALUE));
|
// get Right hand side
|
||||||
|
ESValue v2 = (ESValue) node.jjtGetChild(2).jjtAccept(this,FOR_VALUE);
|
||||||
|
|
||||||
// Case analysis based on assignement operator type
|
// Case analysis based on assignement operator type
|
||||||
int operator = ((ASTOperator)(node.jjtGetChild(1))).getOperator();
|
int operator = ((ASTOperator)(node.jjtGetChild(1))).getOperator();
|
||||||
|
@ -1254,7 +1248,7 @@ public class EcmaScriptEvaluateVisitor
|
||||||
evaluator.putValue(lv, v2);
|
evaluator.putValue(lv, v2);
|
||||||
result = v2;
|
result = v2;
|
||||||
} else {
|
} else {
|
||||||
// All composite assignement requires a current value
|
// All composite assignement requires a current value
|
||||||
ESValue v1 = lv.getValue();
|
ESValue v1 = lv.getValue();
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case PLUSASSIGN: {
|
case PLUSASSIGN: {
|
||||||
|
@ -1368,29 +1362,6 @@ public class EcmaScriptEvaluateVisitor
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* To transform a null (empty) result (but not an ESNull!)
|
|
||||||
* in 'ESUndefined'. null results may be returned if a
|
|
||||||
* statement as the empty statement, missing else clause of
|
|
||||||
* an if statement, loop not executed at all, etc.. is executed
|
|
||||||
* for value (for example as the last statement of a called function
|
|
||||||
* used in an assignement). This is a programming error, and it
|
|
||||||
* may be useful to modify this function to generate an exception
|
|
||||||
* during debugging. However other implementation seem to accept
|
|
||||||
* ESUndefined in these cases. The standard is not totally clear
|
|
||||||
* to me.
|
|
||||||
* <P>An alternative would be to return ESUndefined in all cases,
|
|
||||||
* but then we lose a useful distinction (at least for debugging...).
|
|
||||||
* <P>A couple of tests are done in visit(ASTCompositeReference node, ...
|
|
||||||
* too.
|
|
||||||
*/
|
|
||||||
static protected ESValue acceptNull(Object v) {
|
|
||||||
if (v == null) {
|
|
||||||
// Accept null (could generate an optional exception).
|
|
||||||
return ESUndefined.theUndefined;
|
|
||||||
} else {
|
|
||||||
// Take advantage to convert...
|
|
||||||
return (ESValue) v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@ import java.util.StringTokenizer;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.*;
|
import java.util.zip.*;
|
||||||
|
|
||||||
import helma.scripting.fesi.FesiEngine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the evaluation interface and contains the evaluation context.
|
* Defines the evaluation interface and contains the evaluation context.
|
||||||
* <P><B>Important:</B> This object is also used as the synchronization
|
* <P><B>Important:</B> This object is also used as the synchronization
|
||||||
|
@ -47,7 +45,7 @@ public class Evaluator {
|
||||||
// used to stop thread, 06.12.99 Hannes Wallnoefer
|
// used to stop thread, 06.12.99 Hannes Wallnoefer
|
||||||
public volatile Thread thread;
|
public volatile Thread thread;
|
||||||
// used to retrieve wrappers with correct Prototype for path elements in ESLoader
|
// used to retrieve wrappers with correct Prototype for path elements in ESLoader
|
||||||
public final FesiEngine engine;
|
public helma.scripting.fesi.FesiEngine engine;
|
||||||
|
|
||||||
private static String eol = System.getProperty("line.separator", "\n");
|
private static String eol = System.getProperty("line.separator", "\n");
|
||||||
|
|
||||||
|
@ -55,7 +53,7 @@ public class Evaluator {
|
||||||
* Return the version identifier of the interpreter
|
* Return the version identifier of the interpreter
|
||||||
*/
|
*/
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return "1.1.5 (29-July-2000)";
|
return "1.1.4 (30-Jan-2000)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,25 +104,16 @@ public class Evaluator {
|
||||||
varDeclarationVisitor = new EcmaScriptVariableVisitor(this);
|
varDeclarationVisitor = new EcmaScriptVariableVisitor(this);
|
||||||
// evaluationVisitor = new EcmaScriptEvaluateVisitor(this);
|
// evaluationVisitor = new EcmaScriptEvaluateVisitor(this);
|
||||||
globalObject = GlobalObject.makeGlobalObject(this);
|
globalObject = GlobalObject.makeGlobalObject(this);
|
||||||
packageObject = engine == null ?
|
packageObject = new ESPackages(this);
|
||||||
new ESPackages(this) :
|
|
||||||
new ESPackages(this, engine.getClassLoader ());
|
|
||||||
extensions = new Hashtable(); // forget extensions
|
extensions = new Hashtable(); // forget extensions
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new empty evaluator
|
* Create a new empty evaluator
|
||||||
*/
|
*/
|
||||||
public Evaluator () {
|
public Evaluator () {
|
||||||
this.engine = null;
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new empty evaluator
|
|
||||||
*/
|
|
||||||
public Evaluator (FesiEngine engine) {
|
|
||||||
this.engine = engine;
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +283,6 @@ public class Evaluator {
|
||||||
*/
|
*/
|
||||||
public void setDatePrototype(ESObject o) {
|
public void setDatePrototype(ESObject o) {
|
||||||
datePrototype = o;
|
datePrototype = o;
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the Date prototype object
|
* Get the Date prototype object
|
||||||
|
@ -312,6 +300,7 @@ public class Evaluator {
|
||||||
return packageObject;
|
return packageObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
// Extension support
|
// Extension support
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
@ -514,16 +503,11 @@ public class Evaluator {
|
||||||
*/
|
*/
|
||||||
public ESValue evaluateEvalString(String theSource) throws EcmaScriptException {
|
public ESValue evaluateEvalString(String theSource) throws EcmaScriptException {
|
||||||
ESValue theValue = ESUndefined.theUndefined;
|
ESValue theValue = ESUndefined.theUndefined;
|
||||||
ASTProgram programNode = null;
|
|
||||||
StringEvaluationSource es = new StringEvaluationSource(theSource, null);
|
|
||||||
// Hack - this ensures correct parsing of // comments
|
|
||||||
// even if no EOL is present (as in an eval('1//a'))
|
|
||||||
if (!theSource.endsWith("\n")) {
|
|
||||||
theSource += "\n";
|
|
||||||
}
|
|
||||||
java.io.StringReader is =
|
java.io.StringReader is =
|
||||||
new java.io.StringReader(theSource);
|
new java.io.StringReader(theSource);
|
||||||
EcmaScript parser = new EcmaScript(is);
|
EcmaScript parser = new EcmaScript(is);
|
||||||
|
ASTProgram programNode = null;
|
||||||
|
StringEvaluationSource es = new StringEvaluationSource(theSource, null);
|
||||||
try {
|
try {
|
||||||
// ASTProgram n = parser.Program();
|
// ASTProgram n = parser.Program();
|
||||||
programNode = (ASTProgram)parser.Program();
|
programNode = (ASTProgram)parser.Program();
|
||||||
|
@ -776,6 +760,7 @@ public class Evaluator {
|
||||||
// currentEvaluationSource = es;
|
// currentEvaluationSource = es;
|
||||||
try {
|
try {
|
||||||
for (Enumeration e = localVariableNames.elements() ; e.hasMoreElements() ;) {
|
for (Enumeration e = localVariableNames.elements() ; e.hasMoreElements() ;) {
|
||||||
|
|
||||||
String variable =(String)(e.nextElement());
|
String variable =(String)(e.nextElement());
|
||||||
createVariable(variable, variable.hashCode());
|
createVariable(variable, variable.hashCode());
|
||||||
}
|
}
|
||||||
|
@ -851,8 +836,6 @@ public class Evaluator {
|
||||||
EcmaScriptEvaluateVisitor evaluationVisitor = new EcmaScriptEvaluateVisitor(this);
|
EcmaScriptEvaluateVisitor evaluationVisitor = new EcmaScriptEvaluateVisitor(this);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Hannes Wallnoefer, 2002/11/29: Pass thisObject to EcmaScriptFunctionVisitor so that
|
|
||||||
// functions are assigned to the prototype instead of the global object
|
|
||||||
functionDeclarationVisitor.processFunctionDeclarations(node, program.getEvaluationSource(), thisObject);
|
functionDeclarationVisitor.processFunctionDeclarations(node, program.getEvaluationSource(), thisObject);
|
||||||
Vector variables = program.getVariableNames();
|
Vector variables = program.getVariableNames();
|
||||||
for (Enumeration e = variables.elements() ; e.hasMoreElements() ;) {
|
for (Enumeration e = variables.elements() ; e.hasMoreElements() ;) {
|
||||||
|
@ -990,11 +973,6 @@ public class Evaluator {
|
||||||
ESValue v = null;
|
ESValue v = null;
|
||||||
EvaluationSource es = new UserEvaluationSource(source, null);
|
EvaluationSource es = new UserEvaluationSource(source, null);
|
||||||
try {
|
try {
|
||||||
// Hack - this ensures correct parsing of // comments
|
|
||||||
// even if no EOL is present (as in an eveal command)/
|
|
||||||
if (!text.endsWith("\n")) {
|
|
||||||
text += "\n";
|
|
||||||
}
|
|
||||||
is = new java.io.StringReader(text);
|
is = new java.io.StringReader(text);
|
||||||
v = evaluate(is, globalObject, es, false);
|
v = evaluate(is, globalObject, es, false);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1026,6 +1004,7 @@ public class Evaluator {
|
||||||
synchronized public ESValue evaluate(File file, ESObject thisObject)
|
synchronized public ESValue evaluate(File file, ESObject thisObject)
|
||||||
throws EcmaScriptException, IOException {
|
throws EcmaScriptException, IOException {
|
||||||
EvaluationSource es = new FileEvaluationSource(file.getPath(), null);
|
EvaluationSource es = new FileEvaluationSource(file.getPath(), null);
|
||||||
|
|
||||||
FileReader fr = null;
|
FileReader fr = null;
|
||||||
ESValue value = null;
|
ESValue value = null;
|
||||||
try {
|
try {
|
||||||
|
@ -1071,11 +1050,6 @@ public class Evaluator {
|
||||||
java.io.StringReader is = null;
|
java.io.StringReader is = null;
|
||||||
ESValue v = null;
|
ESValue v = null;
|
||||||
EvaluationSource es = new StringEvaluationSource(theSource, null);
|
EvaluationSource es = new StringEvaluationSource(theSource, null);
|
||||||
// Hack - this ensures correct parsing of // comments
|
|
||||||
// even if no EOL is present (as in an eveal command)/
|
|
||||||
if (!theSource.endsWith("\n")) {
|
|
||||||
theSource += "\n";
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
is = new java.io.StringReader(theSource);
|
is = new java.io.StringReader(theSource);
|
||||||
v = evaluate(is, thisObject, es, returnAccepted);
|
v = evaluate(is, thisObject, es, returnAccepted);
|
||||||
|
|
|
@ -349,7 +349,7 @@ class FesiHashtable implements Cloneable {
|
||||||
public ESValue put(String key, int hash, boolean hidden, boolean readonly, ESValue value) {
|
public ESValue put(String key, int hash, boolean hidden, boolean readonly, ESValue value) {
|
||||||
// Make sure the value is not null
|
// Make sure the value is not null
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
throw new NullPointerException("value");
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes sure the key is not already in the hashtable.
|
// Makes sure the key is not already in the hashtable.
|
||||||
|
|
|
@ -13,7 +13,6 @@ public final class ASCII_CharStream
|
||||||
int available;
|
int available;
|
||||||
int tokenBegin;
|
int tokenBegin;
|
||||||
public int bufpos = -1;
|
public int bufpos = -1;
|
||||||
boolean addedNewline = false;
|
|
||||||
private int bufline[];
|
private int bufline[];
|
||||||
private int bufcolumn[];
|
private int bufcolumn[];
|
||||||
|
|
||||||
|
@ -108,14 +107,8 @@ public final class ASCII_CharStream
|
||||||
if ((i = inputStream.read(buffer, maxNextCharInd,
|
if ((i = inputStream.read(buffer, maxNextCharInd,
|
||||||
available - maxNextCharInd)) == -1)
|
available - maxNextCharInd)) == -1)
|
||||||
{
|
{
|
||||||
if (!addedNewline) {
|
inputStream.close();
|
||||||
addedNewline = true;
|
throw new java.io.IOException();
|
||||||
buffer[maxNextCharInd] = '\n';
|
|
||||||
i = 1;
|
|
||||||
} else {
|
|
||||||
inputStream.close();
|
|
||||||
throw new java.io.IOException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
maxNextCharInd += i;
|
maxNextCharInd += i;
|
||||||
|
@ -272,7 +265,6 @@ public final class ASCII_CharStream
|
||||||
prevCharIsLF = prevCharIsCR = false;
|
prevCharIsLF = prevCharIsCR = false;
|
||||||
tokenBegin = inBuf = maxNextCharInd = 0;
|
tokenBegin = inBuf = maxNextCharInd = 0;
|
||||||
bufpos = -1;
|
bufpos = -1;
|
||||||
addedNewline = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReInit(java.io.Reader dstream, int startline,
|
public void ReInit(java.io.Reader dstream, int startline,
|
||||||
|
|
|
@ -3164,6 +3164,14 @@ public class EcmaScript/*@bgen(jjtree)*/implements EcmaScriptTreeConstants, Ecma
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final private boolean jj_3R_60() {
|
||||||
|
if (jj_3R_64()) return true;
|
||||||
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
||||||
|
if (jj_3R_59()) return true;
|
||||||
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final private boolean jj_3R_24() {
|
final private boolean jj_3R_24() {
|
||||||
if (jj_scan_token(FOR)) return true;
|
if (jj_scan_token(FOR)) return true;
|
||||||
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
||||||
|
@ -3174,14 +3182,6 @@ public class EcmaScript/*@bgen(jjtree)*/implements EcmaScriptTreeConstants, Ecma
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final private boolean jj_3R_60() {
|
|
||||||
if (jj_3R_64()) return true;
|
|
||||||
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
|
||||||
if (jj_3R_59()) return true;
|
|
||||||
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final private boolean jj_3R_131() {
|
final private boolean jj_3R_131() {
|
||||||
if (jj_3R_138()) return true;
|
if (jj_3R_138()) return true;
|
||||||
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
|
||||||
|
|
|
@ -1654,13 +1654,6 @@ final void SkipLexicalActions(Token matchedToken)
|
||||||
{
|
{
|
||||||
switch(jjmatchedKind)
|
switch(jjmatchedKind)
|
||||||
{
|
{
|
||||||
case 8 :
|
|
||||||
if (image == null)
|
|
||||||
image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
|
|
||||||
else
|
|
||||||
image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
|
|
||||||
input_stream.backup(1);
|
|
||||||
break;
|
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class DocFunction extends DocFileElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads a function file and creates DocFunction objects of type FUNCTION
|
* reads a function file and creates DocFunction objects of type FUNCTION
|
||||||
* connected to another DocElement.
|
* connected to another DocElement.
|
||||||
|
@ -102,9 +103,7 @@ public class DocFunction extends DocFileElement {
|
||||||
func.parseSource (location, beginLine, beginColumn, endLine, endColumn);
|
func.parseSource (location, beginLine, beginColumn, endLine, endColumn);
|
||||||
vec.add (func);
|
vec.add (func);
|
||||||
}
|
}
|
||||||
if (tok.kind != EcmaScriptConstants.FUNCTION) {
|
tok = mgr.getNextToken();
|
||||||
tok = mgr.getNextToken();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (DocFunction[]) vec.toArray (new DocFunction[0]);
|
return (DocFunction[]) vec.toArray (new DocFunction[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,19 +45,5 @@ public class DocProperties extends DocFileElement {
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Properties getMappings () {
|
|
||||||
Properties childProps = new Properties ();
|
|
||||||
for (Enumeration e = props.keys (); e.hasMoreElements (); ) {
|
|
||||||
String key = (String) e.nextElement ();
|
|
||||||
String value = props.getProperty (key);
|
|
||||||
if (value.startsWith ("collection") || value.startsWith ("object") || value.startsWith ("mountpoint")) {
|
|
||||||
String prototype = value.substring (value.indexOf("(")+1, value.indexOf(")")).trim ();
|
|
||||||
childProps.setProperty (key, prototype);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return childProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,7 @@ public final class DocTag {
|
||||||
String name = "";
|
String name = "";
|
||||||
if (tok.hasMoreTokens ())
|
if (tok.hasMoreTokens ())
|
||||||
name = tok.nextToken ();
|
name = tok.nextToken ();
|
||||||
String comment = "";
|
return new DocTag (kind, name, content.substring (name.length ()+1).trim ());
|
||||||
try {
|
|
||||||
comment = content.substring (name.length ()+1).trim ();
|
|
||||||
} catch (StringIndexOutOfBoundsException e) { }
|
|
||||||
return new DocTag (kind, name, comment);
|
|
||||||
} else {
|
} else {
|
||||||
return new DocTag (kind, "", content);
|
return new DocTag (kind, "", content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -930,14 +930,6 @@ public final class Application implements IPathElement, Runnable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the application's classloader
|
|
||||||
*/
|
|
||||||
public ClassLoader getClassLoader () {
|
|
||||||
return typemgr.loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// The following methods mimic the IPathElement interface. This allows us
|
/// The following methods mimic the IPathElement interface. This allows us
|
||||||
/// to script any Java object: If the object implements IPathElement (as does
|
/// to script any Java object: If the object implements IPathElement (as does
|
||||||
|
|
|
@ -72,9 +72,9 @@ public final class RequestEvaluator implements Runnable {
|
||||||
if (scriptingEngine == null) {
|
if (scriptingEngine == null) {
|
||||||
String engineClassName = app.getProperty (
|
String engineClassName = app.getProperty (
|
||||||
"scriptingEngine",
|
"scriptingEngine",
|
||||||
"helma.scripting.fesi.PhantomEngine");
|
"helma.scripting.fesi.FesiEngine");
|
||||||
try {
|
try {
|
||||||
Class clazz = app.getClassLoader().loadClass (engineClassName);
|
Class clazz = app.typemgr.loader.loadClass (engineClassName);
|
||||||
scriptingEngine = (ScriptingEngine) clazz.newInstance ();
|
scriptingEngine = (ScriptingEngine) clazz.newInstance ();
|
||||||
scriptingEngine.init (app, this);
|
scriptingEngine.init (app, this);
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
|
@ -666,7 +666,6 @@ public final class RequestEvaluator implements Runnable {
|
||||||
if (rtx == null || !rtx.isAlive()) {
|
if (rtx == null || !rtx.isAlive()) {
|
||||||
// app.logEvent ("Starting Thread");
|
// app.logEvent ("Starting Thread");
|
||||||
rtx = new Transactor (this, app.threadgroup, app.nmgr);
|
rtx = new Transactor (this, app.threadgroup, app.nmgr);
|
||||||
rtx.setContextClassLoader (app.getClassLoader ());
|
|
||||||
rtx.start ();
|
rtx.start ();
|
||||||
} else {
|
} else {
|
||||||
notifyAll ();
|
notifyAll ();
|
||||||
|
|
|
@ -10,7 +10,6 @@ import helma.util.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,17 +60,7 @@ public final class TypeManager {
|
||||||
prototypes = new HashMap ();
|
prototypes = new HashMap ();
|
||||||
zipfiles = new HashMap ();
|
zipfiles = new HashMap ();
|
||||||
jarfiles = new HashSet ();
|
jarfiles = new HashSet ();
|
||||||
URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
|
URL helmajar = new URL ("file:"+app.home.getAbsolutePath()+"/lib/helma.jar");
|
||||||
URL helmajar = null;
|
|
||||||
for (int i=0; i<urls.length; i++) {
|
|
||||||
String url = urls[i].toString().toLowerCase();
|
|
||||||
if (url.endsWith ("helma.jar")) {
|
|
||||||
helmajar = urls[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (helmajar == null)
|
|
||||||
throw new RuntimeException ("helma.jar not found in embedding classpath");
|
|
||||||
loader = new AppClassLoader(app.getName(), new URL[] { helmajar });
|
loader = new AppClassLoader(app.getName(), new URL[] { helmajar });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.xmlrpc.*;
|
||||||
|
|
||||||
public class Server implements IPathElement, Runnable {
|
public class Server implements IPathElement, Runnable {
|
||||||
|
|
||||||
public static final String version = "1.2 RC2 2002/12/05";
|
public static final String version = "1.2pre4 2002/11/22";
|
||||||
public final long starttime;
|
public final long starttime;
|
||||||
|
|
||||||
// if true we only accept RMI and XML-RPC connections from
|
// if true we only accept RMI and XML-RPC connections from
|
||||||
|
@ -223,14 +223,7 @@ import org.apache.xmlrpc.*;
|
||||||
System.err.println ("Error calling getCanonicalFile() on hopHome: "+iox);
|
System.err.println ("Error calling getCanonicalFile() on hopHome: "+iox);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the current working directory to the helma home dir.
|
// from now on it's safe to call getLogger()
|
||||||
// note that this is not a real cwd, which is not supported
|
|
||||||
// by java. It makes sure relative to absolute path name
|
|
||||||
// conversion is done right, so for Helma code, this should
|
|
||||||
// work.
|
|
||||||
System.setProperty ("user.dir", hopHome.getPath());
|
|
||||||
|
|
||||||
// from now on it's safe to call getLogger() because hopHome is set up
|
|
||||||
|
|
||||||
String startMessage = "Starting Helma "+version+
|
String startMessage = "Starting Helma "+version+
|
||||||
" on Java "+System.getProperty ("java.version");
|
" on Java "+System.getProperty ("java.version");
|
||||||
|
|
|
@ -29,7 +29,9 @@ public class FilteredClassLoader extends URLClassLoader {
|
||||||
* Mask classes that implement the scripting engine(s) contained in helma.jar
|
* Mask classes that implement the scripting engine(s) contained in helma.jar
|
||||||
*/
|
*/
|
||||||
protected Class findClass (String name) throws ClassNotFoundException {
|
protected Class findClass (String name) throws ClassNotFoundException {
|
||||||
if (name != null && "helma.scripting.fesi.PhantomEngine".equals (name))
|
if (name != null && (name.startsWith ("helma.scripting.fesi") ||
|
||||||
|
name.startsWith ("helma.doc") ||
|
||||||
|
name.startsWith ("FESI")))
|
||||||
throw new ClassNotFoundException (name);
|
throw new ClassNotFoundException (name);
|
||||||
return super.findClass (name);
|
return super.findClass (name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,38 +27,49 @@ public class Main {
|
||||||
// check if home directory is set via command line arg. If not,
|
// check if home directory is set via command line arg. If not,
|
||||||
// we'll get it from the location of the jar file this class
|
// we'll get it from the location of the jar file this class
|
||||||
// has been loaded from.
|
// has been loaded from.
|
||||||
String installDir = null;
|
String home = null;
|
||||||
// first, try to get helma home dir from command line options
|
// first, try to get helma home dir from command line options
|
||||||
for (int i=0; i<args.length; i++) {
|
for (int i=0; i<args.length; i++) {
|
||||||
if (args[i].equals ("-i") && i+1<args.length) {
|
if (args[i].equals ("-h") && i+1<args.length) {
|
||||||
installDir = args[i+1];
|
home = args[i+1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
URLClassLoader apploader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
URLClassLoader apploader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||||
// try to get Helma installation directory
|
// try to get Helma installation directory
|
||||||
if (installDir == null) {
|
if (home == null) {
|
||||||
try {
|
try {
|
||||||
URL launcherUrl = apploader.findResource("helma/main/launcher/Main.class");
|
URL homeUrl = apploader.findResource("helma/main/launcher/Main.class");
|
||||||
// this is a JAR URL of the form
|
// this is a JAR URL of the form
|
||||||
// jar:<url>!/{entry}
|
// jar:<url>!/{entry}
|
||||||
// we strip away the jar: prefix and the !/{entry} suffix
|
// we strip away the jar: prefix and the !/{entry} suffix
|
||||||
// to get the original jar file URL
|
// to get the original jar file URL
|
||||||
installDir = launcherUrl.toString().substring(4);
|
home = homeUrl.toString().substring(4);
|
||||||
int excl = installDir.indexOf ("!");
|
int excl = home.indexOf ("!");
|
||||||
if (excl > -1) {
|
if (excl > -1) {
|
||||||
installDir = installDir.substring(0, excl);
|
home = home.substring(0, excl);
|
||||||
launcherUrl = new URL (installDir);
|
homeUrl = new URL (home);
|
||||||
File f = new File (launcherUrl.getPath());
|
File f = new File (homeUrl.getPath());
|
||||||
installDir = f.getParentFile().getCanonicalPath();
|
home = f.getParent();
|
||||||
|
// add home dir to the command line arguments
|
||||||
|
String[] newArgs = new String [args.length+2];
|
||||||
|
newArgs[0] = "-h";
|
||||||
|
newArgs[1] = home;
|
||||||
|
System.arraycopy (args, 0, newArgs, 2, args.length);
|
||||||
|
args = newArgs;
|
||||||
}
|
}
|
||||||
} catch (Exception x) {
|
} catch (Exception ignore) {
|
||||||
// unable to get Helma installation dir from launcher jar
|
// unable to get Helma home dir from launcher jar
|
||||||
System.err.println ("Unable to get Helma installation directory: "+x);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// set the current working directory to the helma home dir.
|
||||||
|
// note that this is not a real cwd, which is not supported
|
||||||
|
// by java. It makes sure relative to absolute path name
|
||||||
|
// conversion is done right, so for Helma code, this should
|
||||||
|
// work.
|
||||||
|
System.setProperty ("user.dir", home);
|
||||||
|
|
||||||
// set up the class path
|
// set up the class path
|
||||||
File libdir = new File (installDir, "lib");
|
File libdir = new File (home, "lib");
|
||||||
ArrayList jarlist = new ArrayList ();
|
ArrayList jarlist = new ArrayList ();
|
||||||
for (int i=0;i<jars.length;i++) {
|
for (int i=0;i<jars.length;i++) {
|
||||||
File jar = new File (libdir, jars[i]);
|
File jar = new File (libdir, jars[i]);
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
// DbColumn.java
|
|
||||||
// Copyright 2002 Hannes Wallnoefer, Helma.org
|
|
||||||
|
|
||||||
package helma.objectmodel.db;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that encapsulates the Column name and data type of a
|
|
||||||
* column in a relational table.
|
|
||||||
*/
|
|
||||||
public final class DbColumn {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
private final int type;
|
|
||||||
private final Relation relation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public DbColumn (String name, int type, Relation rel) {
|
|
||||||
this.name = name;
|
|
||||||
this.type = type;
|
|
||||||
this.relation = rel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the column name.
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this columns SQL data type.
|
|
||||||
*/
|
|
||||||
public int getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the relation associated with this column. May be null.
|
|
||||||
*/
|
|
||||||
public Relation getRelation() {
|
|
||||||
return relation;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -43,21 +43,15 @@ public final class DbMapping implements Updatable {
|
||||||
Relation subRelation;
|
Relation subRelation;
|
||||||
Relation propRelation;
|
Relation propRelation;
|
||||||
|
|
||||||
// if this defines a subnode mapping with groupby layer,
|
// if this defines a subnode mapping with groupby layer, we need a DbMapping for those groupby nodes
|
||||||
// we need a DbMapping for those groupby nodes
|
|
||||||
DbMapping groupbyMapping;
|
DbMapping groupbyMapping;
|
||||||
|
|
||||||
// Map of property names to Relations objects
|
// Map of property names to Relations objects
|
||||||
HashMap prop2db;
|
HashMap prop2db;
|
||||||
// Map of db columns to Relations objects.
|
// Map of db columns to Relations objects
|
||||||
// Case insensitive, keys are stored in upper case so
|
|
||||||
// lookups must do a toUpperCase().
|
|
||||||
HashMap db2prop;
|
HashMap db2prop;
|
||||||
|
|
||||||
// list of columns to fetch from db
|
// list of columns to fetch from db
|
||||||
DbColumn[] columns = null;
|
String[] columns = null;
|
||||||
// Map of db columns by name
|
|
||||||
HashMap columnMap;
|
|
||||||
// pre-rendered select statement
|
// pre-rendered select statement
|
||||||
String select = null;
|
String select = null;
|
||||||
|
|
||||||
|
@ -122,8 +116,6 @@ public final class DbMapping implements Updatable {
|
||||||
prop2db = new HashMap ();
|
prop2db = new HashMap ();
|
||||||
db2prop = new HashMap ();
|
db2prop = new HashMap ();
|
||||||
|
|
||||||
columnMap = new HashMap ();
|
|
||||||
|
|
||||||
parent = null;
|
parent = null;
|
||||||
|
|
||||||
idField = null;
|
idField = null;
|
||||||
|
@ -193,7 +185,6 @@ public final class DbMapping implements Updatable {
|
||||||
keydef = null;
|
keydef = null;
|
||||||
// same with columns and select string
|
// same with columns and select string
|
||||||
columns = null;
|
columns = null;
|
||||||
columnMap.clear();
|
|
||||||
select = null;
|
select = null;
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,8 +211,8 @@ public final class DbMapping implements Updatable {
|
||||||
rel.update (dbField, props);
|
rel.update (dbField, props);
|
||||||
p2d.put (propName, rel);
|
p2d.put (propName, rel);
|
||||||
if (rel.columnName != null &&
|
if (rel.columnName != null &&
|
||||||
(rel.reftype == Relation.PRIMITIVE ||
|
(rel.reftype == Relation.PRIMITIVE ||
|
||||||
rel.reftype == Relation.REFERENCE))
|
rel.reftype == Relation.REFERENCE))
|
||||||
d2p.put (rel.columnName.toUpperCase (), rel);
|
d2p.put (rel.columnName.toUpperCase (), rel);
|
||||||
// app.logEvent ("Mapping "+propName+" -> "+dbField);
|
// app.logEvent ("Mapping "+propName+" -> "+dbField);
|
||||||
}
|
}
|
||||||
|
@ -576,11 +567,11 @@ public final class DbMapping implements Updatable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of DbColumns for the relational table mapped by this DbMapping.
|
* Return a Village Schema object for this DbMapping.
|
||||||
*/
|
*/
|
||||||
public synchronized DbColumn[] getColumns() throws ClassNotFoundException, SQLException {
|
public synchronized String[] getColumns() throws ClassNotFoundException, SQLException {
|
||||||
if (!isRelational ())
|
if (!isRelational ())
|
||||||
throw new SQLException ("Can't get columns for non-relational data mapping "+this);
|
throw new SQLException ("Can't get Schema for non-relational data mapping");
|
||||||
if (source == null && parentMapping != null)
|
if (source == null && parentMapping != null)
|
||||||
return parentMapping.getColumns ();
|
return parentMapping.getColumns ();
|
||||||
// Use local variable cols to avoid synchronization (schema may be nulled elsewhere)
|
// Use local variable cols to avoid synchronization (schema may be nulled elsewhere)
|
||||||
|
@ -589,46 +580,25 @@ public final class DbMapping implements Updatable {
|
||||||
// and build a string of column names.
|
// and build a string of column names.
|
||||||
Connection con = getConnection ();
|
Connection con = getConnection ();
|
||||||
Statement stmt = con.createStatement ();
|
Statement stmt = con.createStatement ();
|
||||||
String t = getTableName();
|
ResultSet rs = stmt.executeQuery ("select * from "+getTableName()+" where 1 = 0");
|
||||||
if (t == null)
|
|
||||||
throw new SQLException ("Table name is null in getColumns() for "+this);
|
|
||||||
ResultSet rs = stmt.executeQuery (
|
|
||||||
new StringBuffer("SELECT * FROM ")
|
|
||||||
.append(t).append(" WHERE 1 = 0").toString());
|
|
||||||
if (rs == null)
|
if (rs == null)
|
||||||
throw new SQLException ("Error retrieving columns for "+this);
|
throw new SQLException ("Error retrieving DB scheme for "+this);
|
||||||
ResultSetMetaData meta = rs.getMetaData ();
|
ResultSetMetaData meta = rs.getMetaData ();
|
||||||
// ok, we have the meta data, now loop through mapping...
|
// ok, we have the meta data, now loop through mapping...
|
||||||
int ncols = meta.getColumnCount ();
|
int ncols = meta.getColumnCount ();
|
||||||
columns = new DbColumn[ncols];
|
columns = new String[ncols];
|
||||||
for (int i=0; i<ncols; i++) {
|
for (int i=0; i<ncols; i++) {
|
||||||
String colName = meta.getColumnName (i+1);
|
columns[i] = meta.getColumnName (i+1);
|
||||||
Relation rel = columnNameToRelation (colName);
|
Relation rel = columnNameToRelation (columns[i]);
|
||||||
columns[i] = new DbColumn (colName, meta.getColumnType (i+1), rel);
|
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
|
||||||
|
rel.reftype != Relation.REFERENCE))
|
||||||
|
continue;
|
||||||
|
rel.setColumnType (meta.getColumnType (i+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DbColumn getColumn (String columnName) throws ClassNotFoundException, SQLException {
|
|
||||||
DbColumn col = (DbColumn) columnMap.get(columnName);
|
|
||||||
if (col == null) {
|
|
||||||
DbColumn[] cols = columns;
|
|
||||||
if (cols == null)
|
|
||||||
cols = getColumns();
|
|
||||||
for (int i=0; i<cols.length; i++) {
|
|
||||||
if (columnName.equalsIgnoreCase (cols[i].getName())) {
|
|
||||||
col = cols[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (col == null)
|
|
||||||
throw new SQLException ("Column "+columnName+" not found in "+this);
|
|
||||||
columnMap.put (columnName, col);
|
|
||||||
}
|
|
||||||
return col;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringBuffer getSelect () throws SQLException, ClassNotFoundException {
|
public StringBuffer getSelect () throws SQLException, ClassNotFoundException {
|
||||||
String sel = select;
|
String sel = select;
|
||||||
if (sel != null)
|
if (sel != null)
|
||||||
|
@ -649,8 +619,13 @@ public final class DbMapping implements Updatable {
|
||||||
if (table == null && parentMapping != null)
|
if (table == null && parentMapping != null)
|
||||||
return parentMapping.needsQuotes (columnName);
|
return parentMapping.needsQuotes (columnName);
|
||||||
try {
|
try {
|
||||||
DbColumn col = getColumn (columnName);
|
Relation rel = (Relation) db2prop.get (columnName.toUpperCase());
|
||||||
switch (col.getType()) {
|
if (rel == null)
|
||||||
|
throw new SQLException ("Error retrieving relational schema for "+this);
|
||||||
|
// make sure columns are initialized and up to date
|
||||||
|
if (columns == null)
|
||||||
|
getColumns();
|
||||||
|
switch (rel.getColumnType()) {
|
||||||
case Types.CHAR:
|
case Types.CHAR:
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
|
|
|
@ -234,7 +234,7 @@ public final class Node implements INode, Serializable {
|
||||||
/**
|
/**
|
||||||
* Constructor used for nodes being stored in a relational database table.
|
* Constructor used for nodes being stored in a relational database table.
|
||||||
*/
|
*/
|
||||||
public Node (DbMapping dbm, ResultSet rs, DbColumn[] columns, WrappedNodeManager nmgr)
|
public Node (DbMapping dbm, ResultSet rs, String[] columns, WrappedNodeManager nmgr)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
||||||
this.nmgr = nmgr;
|
this.nmgr = nmgr;
|
||||||
|
@ -265,35 +265,35 @@ public final class Node implements INode, Serializable {
|
||||||
|
|
||||||
for (int i=0; i<columns.length; i++) {
|
for (int i=0; i<columns.length; i++) {
|
||||||
|
|
||||||
Relation rel = columns[i].getRelation();
|
Relation rel = dbm.columnNameToRelation (columns[i]);
|
||||||
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
|
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
|
||||||
rel.reftype != Relation.REFERENCE))
|
rel.reftype != Relation.REFERENCE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Property newprop = new Property (rel.propName, this);
|
Property newprop = new Property (rel.propName, this);
|
||||||
|
|
||||||
switch (columns[i].getType()) {
|
switch (rel.getColumnType()) {
|
||||||
|
|
||||||
case Types.BIT:
|
case Types.BIT:
|
||||||
newprop.setBooleanValue (rs.getBoolean(columns[i].getName()));
|
newprop.setBooleanValue (rs.getBoolean(columns[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.TINYINT:
|
case Types.TINYINT:
|
||||||
case Types.BIGINT:
|
case Types.BIGINT:
|
||||||
case Types.SMALLINT:
|
case Types.SMALLINT:
|
||||||
case Types.INTEGER:
|
case Types.INTEGER:
|
||||||
newprop.setIntegerValue (rs.getLong(columns[i].getName()));
|
newprop.setIntegerValue (rs.getLong(columns[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.REAL:
|
case Types.REAL:
|
||||||
case Types.FLOAT:
|
case Types.FLOAT:
|
||||||
case Types.DOUBLE:
|
case Types.DOUBLE:
|
||||||
newprop.setFloatValue (rs.getDouble(columns[i].getName()));
|
newprop.setFloatValue (rs.getDouble(columns[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.DECIMAL:
|
case Types.DECIMAL:
|
||||||
case Types.NUMERIC:
|
case Types.NUMERIC:
|
||||||
BigDecimal num = rs.getBigDecimal (columns[i].getName());
|
BigDecimal num = rs.getBigDecimal (columns[i]);
|
||||||
if (num == null)
|
if (num == null)
|
||||||
break;
|
break;
|
||||||
if (num.scale() > 0)
|
if (num.scale() > 0)
|
||||||
|
@ -305,20 +305,20 @@ public final class Node implements INode, Serializable {
|
||||||
case Types.LONGVARBINARY:
|
case Types.LONGVARBINARY:
|
||||||
case Types.VARBINARY:
|
case Types.VARBINARY:
|
||||||
case Types.BINARY:
|
case Types.BINARY:
|
||||||
newprop.setStringValue (rs.getString(columns[i].getName()));
|
newprop.setStringValue (rs.getString(columns[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
case Types.CHAR:
|
case Types.CHAR:
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.OTHER:
|
case Types.OTHER:
|
||||||
newprop.setStringValue (rs.getString(columns[i].getName()));
|
newprop.setStringValue (rs.getString(columns[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.DATE:
|
case Types.DATE:
|
||||||
case Types.TIME:
|
case Types.TIME:
|
||||||
case Types.TIMESTAMP:
|
case Types.TIMESTAMP:
|
||||||
newprop.setDateValue (rs.getTimestamp(columns[i].getName()));
|
newprop.setDateValue (rs.getTimestamp(columns[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.NULL:
|
case Types.NULL:
|
||||||
|
@ -327,7 +327,7 @@ public final class Node implements INode, Serializable {
|
||||||
// continue;
|
// continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
newprop.setStringValue (rs.getString(columns[i].getName()));
|
newprop.setStringValue (rs.getString(columns[i]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1837,7 +1837,7 @@ public final class Node implements INode, Serializable {
|
||||||
*/
|
*/
|
||||||
public INode getNonVirtualParent () {
|
public INode getNonVirtualParent () {
|
||||||
INode node = this;
|
INode node = this;
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
if (node == null) break;
|
if (node == null) break;
|
||||||
if (node.getState() != Node.VIRTUAL)
|
if (node.getState() != Node.VIRTUAL)
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -580,13 +580,7 @@ public final class NodeManager {
|
||||||
try {
|
try {
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
st = con.createStatement ();
|
st = con.createStatement ();
|
||||||
st.executeUpdate (new StringBuffer ("DELETE FROM ")
|
st.executeUpdate ("DELETE FROM "+dbm.getTableName ()+" WHERE "+dbm.getIDField ()+" = "+node.getID ());
|
||||||
.append(dbm.getTableName ())
|
|
||||||
.append(" WHERE ")
|
|
||||||
.append(dbm.getIDField())
|
|
||||||
.append(" = ")
|
|
||||||
.append(node.getID())
|
|
||||||
.toString());
|
|
||||||
} finally {
|
} finally {
|
||||||
if (st != null) try {
|
if (st != null) try {
|
||||||
st.close ();
|
st.close ();
|
||||||
|
@ -611,11 +605,7 @@ public final class NodeManager {
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
try {
|
try {
|
||||||
Connection con = map.getConnection ();
|
Connection con = map.getConnection ();
|
||||||
String q = new StringBuffer("SELECT MAX(")
|
String q = "SELECT MAX("+map.getIDField()+") FROM "+map.getTableName();
|
||||||
.append(map.getIDField())
|
|
||||||
.append(") FROM ")
|
|
||||||
.append(map.getTableName())
|
|
||||||
.toString();
|
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
ResultSet rs = stmt.executeQuery (q);
|
ResultSet rs = stmt.executeQuery (q);
|
||||||
// check for empty table
|
// check for empty table
|
||||||
|
@ -649,10 +639,7 @@ public final class NodeManager {
|
||||||
String retval = null;
|
String retval = null;
|
||||||
try {
|
try {
|
||||||
Connection con = map.getConnection ();
|
Connection con = map.getConnection ();
|
||||||
String q = new StringBuffer("SELECT ")
|
String q = "SELECT "+map.getIDgen()+".nextval FROM dual";
|
||||||
.append(map.getIDgen())
|
|
||||||
.append(".nextval FROM dual")
|
|
||||||
.toString();
|
|
||||||
stmt = con.createStatement();
|
stmt = con.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery (q);
|
ResultSet rs = stmt.executeQuery (q);
|
||||||
if (!rs.next ())
|
if (!rs.next ())
|
||||||
|
@ -695,23 +682,10 @@ public final class NodeManager {
|
||||||
|
|
||||||
if (home.getSubnodeRelation() != null) {
|
if (home.getSubnodeRelation() != null) {
|
||||||
// subnode relation was explicitly set
|
// subnode relation was explicitly set
|
||||||
q = new StringBuffer("SELECT ")
|
q = "SELECT "+idfield+" FROM "+table+" "+home.getSubnodeRelation();
|
||||||
.append(idfield)
|
|
||||||
.append(" FROM ")
|
|
||||||
.append(table)
|
|
||||||
.append(" ")
|
|
||||||
.append(home.getSubnodeRelation())
|
|
||||||
.toString();
|
|
||||||
} else {
|
} else {
|
||||||
// let relation object build the query
|
// let relation object build the query
|
||||||
q = new StringBuffer("SELECT ")
|
q = "SELECT "+idfield+" FROM "+table + rel.buildQuery (home, home.getNonVirtualParent (), null, " WHERE ", true);
|
||||||
.append(idfield)
|
|
||||||
.append(" FROM ")
|
|
||||||
.append(table)
|
|
||||||
.append(rel.buildQuery (home,
|
|
||||||
home.getNonVirtualParent (), null,
|
|
||||||
" WHERE ", true))
|
|
||||||
.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -732,8 +706,8 @@ public final class NodeManager {
|
||||||
continue;
|
continue;
|
||||||
// make the proper key for the object, either a generic DB key or a groupby key
|
// make the proper key for the object, either a generic DB key or a groupby key
|
||||||
Key key = rel.groupby == null ?
|
Key key = rel.groupby == null ?
|
||||||
(Key) new DbKey (rel.otherType, kstr) :
|
(Key) new DbKey (rel.otherType, kstr) :
|
||||||
(Key) new SyntheticKey (k, kstr);
|
(Key) new SyntheticKey (k, kstr);
|
||||||
retval.add (new NodeHandle (key));
|
retval.add (new NodeHandle (key));
|
||||||
// if these are groupby nodes, evict nullNode keys
|
// if these are groupby nodes, evict nullNode keys
|
||||||
if (rel.groupby != null) {
|
if (rel.groupby != null) {
|
||||||
|
@ -776,7 +750,7 @@ public final class NodeManager {
|
||||||
|
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
Statement stmt = con.createStatement ();
|
Statement stmt = con.createStatement ();
|
||||||
DbColumn[] columns = dbm.getColumns ();
|
String[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
try {
|
try {
|
||||||
if (home.getSubnodeRelation() != null) {
|
if (home.getSubnodeRelation() != null) {
|
||||||
|
@ -834,7 +808,7 @@ public final class NodeManager {
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
Statement stmt = con.createStatement ();
|
Statement stmt = con.createStatement ();
|
||||||
DbColumn[] columns = dbm.getColumns ();
|
String[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
try {
|
try {
|
||||||
String idfield = rel.groupby != null ? rel.groupby : dbm.getIDField ();
|
String idfield = rel.groupby != null ? rel.groupby : dbm.getIDField ();
|
||||||
|
@ -861,10 +835,8 @@ public final class NodeManager {
|
||||||
q.append (") ");
|
q.append (") ");
|
||||||
if (rel.groupby != null) {
|
if (rel.groupby != null) {
|
||||||
q.append (rel.renderConstraints (home, home.getNonVirtualParent ()));
|
q.append (rel.renderConstraints (home, home.getNonVirtualParent ()));
|
||||||
if (rel.order != null) {
|
if (rel.order != null)
|
||||||
q.append (" ORDER BY ");
|
q.append (" ORDER BY "+rel.order);
|
||||||
q.append (rel.order);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -969,18 +941,10 @@ public final class NodeManager {
|
||||||
String q = null;
|
String q = null;
|
||||||
if (home.getSubnodeRelation() != null) {
|
if (home.getSubnodeRelation() != null) {
|
||||||
// use the manually set subnoderelation of the home node
|
// use the manually set subnoderelation of the home node
|
||||||
q = new StringBuffer("SELECT count(*) FROM ")
|
q = "SELECT count(*) FROM "+table+" "+home.getSubnodeRelation();
|
||||||
.append(table)
|
|
||||||
.append(" ")
|
|
||||||
.append(home.getSubnodeRelation())
|
|
||||||
.toString();
|
|
||||||
} else {
|
} else {
|
||||||
// let relation object build the query
|
// let relation object build the query
|
||||||
q = new StringBuffer("SELECT count(*) FROM ")
|
q = "SELECT count(*) FROM "+table + rel.buildQuery (home, home.getNonVirtualParent (), null, " WHERE ", false);
|
||||||
.append(table)
|
|
||||||
.append(rel.buildQuery (home, home.getNonVirtualParent(),
|
|
||||||
null, " WHERE ", false))
|
|
||||||
.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -1026,13 +990,7 @@ public final class NodeManager {
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String q = new StringBuffer("SELECT ")
|
String q = "SELECT "+namefield+" FROM "+table+" ORDER BY "+namefield;
|
||||||
.append(namefield)
|
|
||||||
.append(" FROM ")
|
|
||||||
.append(table)
|
|
||||||
.append(" ORDER BY ")
|
|
||||||
.append(namefield)
|
|
||||||
.toString();
|
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
|
|
||||||
if (logSql)
|
if (logSql)
|
||||||
|
@ -1079,7 +1037,7 @@ public final class NodeManager {
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
stmt = con.createStatement ();
|
stmt = con.createStatement ();
|
||||||
|
|
||||||
DbColumn[] columns = dbm.getColumns ();
|
String[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
q.append ("WHERE ");
|
q.append ("WHERE ");
|
||||||
q.append (idfield);
|
q.append (idfield);
|
||||||
|
@ -1141,7 +1099,7 @@ public final class NodeManager {
|
||||||
DbMapping dbm = rel.otherType;
|
DbMapping dbm = rel.otherType;
|
||||||
|
|
||||||
Connection con = dbm.getConnection ();
|
Connection con = dbm.getConnection ();
|
||||||
DbColumn[] columns = dbm.getColumns ();
|
String[] columns = dbm.getColumns ();
|
||||||
StringBuffer q = dbm.getSelect ();
|
StringBuffer q = dbm.getSelect ();
|
||||||
if (home.getSubnodeRelation () != null) {
|
if (home.getSubnodeRelation () != null) {
|
||||||
// combine our key with the constraints in the manually set subnode relation
|
// combine our key with the constraints in the manually set subnode relation
|
||||||
|
|
|
@ -25,7 +25,7 @@ import FESI.Exceptions.*;
|
||||||
/**
|
/**
|
||||||
* This is the implementation of ScriptingEnvironment for the FESI EcmaScript interpreter.
|
* This is the implementation of ScriptingEnvironment for the FESI EcmaScript interpreter.
|
||||||
*/
|
*/
|
||||||
public class FesiEngine implements ScriptingEngine {
|
public final class FesiEngine implements ScriptingEngine {
|
||||||
|
|
||||||
// the application we're running in
|
// the application we're running in
|
||||||
Application app;
|
Application app;
|
||||||
|
@ -80,7 +80,8 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
wrappercache = new CacheMap (200, .75f);
|
wrappercache = new CacheMap (200, .75f);
|
||||||
prototypes = new Hashtable ();
|
prototypes = new Hashtable ();
|
||||||
try {
|
try {
|
||||||
evaluator = new Evaluator(this);
|
evaluator = new Evaluator();
|
||||||
|
evaluator.engine = this;
|
||||||
global = evaluator.getGlobalObject();
|
global = evaluator.getGlobalObject();
|
||||||
for (int i=0; i<extensions.length; i++)
|
for (int i=0; i<extensions.length; i++)
|
||||||
evaluator.addExtension (extensions[i]);
|
evaluator.addExtension (extensions[i]);
|
||||||
|
@ -752,13 +753,6 @@ public class FesiEngine implements ScriptingEngine {
|
||||||
wrappercache.put (n, esn);
|
wrappercache.put (n, esn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the application's classloader
|
|
||||||
*/
|
|
||||||
public ClassLoader getClassLoader () {
|
|
||||||
return app.getClassLoader ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the RequestEvaluator owning and driving this FESI evaluator.
|
* Return the RequestEvaluator owning and driving this FESI evaluator.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
// PhantomEngine.java
|
|
||||||
// Copyright (c) Hannes Wallnöfer 2002
|
|
||||||
|
|
||||||
package helma.scripting.fesi;
|
|
||||||
|
|
||||||
import helma.scripting.ScriptingException;
|
|
||||||
|
|
||||||
public final class PhantomEngine extends FesiEngine {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Object invoke (Object thisObject, String functionName, Object[] args, boolean xmlrpc) throws ScriptingException {
|
|
||||||
return super.invoke (thisObject, functionName, args, xmlrpc);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue