This commit was manufactured by cvs2svn to create tag

'helma_1_2_pre4'.
This commit is contained in:
hns 2002-12-06 18:17:33 +00:00
parent 817395e8b0
commit c512ce3cbe
38 changed files with 346 additions and 710 deletions

View file

@ -1,97 +1,93 @@
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
web sites.
Helma Object Publisher is a web application server.
Helma provides an easy way to map relational database tables to objects.
These objects are wrapped with a layer of scripts and skins that allow
them to be presented and manipulated over the web. The clue here is that
both functions and skins work in an object oriented manner and force
a clear separation between content, functionality and presentation.
Actions are special functions that are callable over the web. Macros are
special functions that expose functionality to the presentation layer.
Skins are pieces of layout that do not contain any application logic,
only macro tags as placeholders for parts that are dynamically provided
by the application.
With Helma Object Publisher (sometimes simply refered to as Helma or
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.
HopObjects are extended JavaScript objects which can be scripted using
server-side JavaScript. Beyond the common JavaScript features, Helma
provides special "skin" and template functionalities which facilitate
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
===================
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
kit from http://java.sun.com/j2se/downloads.html.
Macintosh: 1) If you are using the Mac version you should own a G3 CPU
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
well with Helma.
Linux: The recomended virtual machine for running Helma on Linux is
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
============================
Simply unzip or untar the contents of the archive file into any place
on your hard disk. Start Helma by invoking hop.bat or hop.sh from the
command line, depending on whether you are on Windows or
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.
Simply unzip the contents of the archive file into any place on your
hard disk. Start Helma by opening the file hop.bat or hop.sh,
respectively.
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/
(port 8080 on the local machine, that is).
browser to http://127.0.0.1:8080/ (port 8080, that is).
Helma comes with a version of Jetty, a lightweight yet industrial strenth
web server developed by Mortbay Consulting. See http://jetty.mortbay.com/
for more information. While Jetty works well for deploying real web sites,
you may want to run Helma behind an existing web server. This is most
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.
This version is set up to use its own embedded Web server and a very
basic embedded object database. For this reason it is able to run
virtually without installation on any platform with a Java 1.1 virtual
machine.
Finally, Helma can be plugged into Servlet containers using Servlet
classes that communicate with Helma either directly or via Java RMI.
(Be warned that these options may be harder to set up and maintain though,
since most of the recent development efforts have been geared towards the
mod_jk/AJPv13 setup.)
On the other hand, the embedded Web server and object db are meant for
development work and not ready for prime time deployment. For that
you'd probably use an external relational database, the Berkeley DB
package and a full featured Web server like Apache.
=====================================
DOCUMENTATION AND FURTHER INFORMATION
=====================================
Currently, documentation-in-progress is available online at
http://helma.org/. We know that it sucks and hope to do some substantial
improvments within the coming weeks and months.
Currently, a documentation-in-progress is available online only.
Please refer to http://helma.org/docs/.
Your input is highly welcome. There is a mailing-list to discuss Helma at
http://helma.org/lists/listinfo/hop. Don't hesitate to voice any questions,
proposals, complaints, praise you may have on the list. We know we have
a lot to do and to learn, and we're open to suggestions.
For further information http://helma.org generally is a good place.
There is also a mailing-list about Helma-related stuff available at
http://helma.org/lists/listinfo/hop.
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

View file

@ -25,7 +25,7 @@ On Unix systems open a terminal window, change to the Antclick
directory and type ./hop.sh.
If you manage to get it running you should be able to connect your
browser to http://127.0.0.1:8080/ (port 8080, that is). Now you can
browser to http://127.0.0.1:8080/ (port 8080, that is). Now you can
set up and configure your antville site.
@ -33,111 +33,89 @@ set up and configure your antville site.
ABOUT ANTVILLE
==============
Antville is an open source project aimed to the development of an
"easy to maintain and use" weblog-hosting system. It is not limited
to just one weblog, it can easily host up to several hundred or
thousand weblogs (the number of weblogs is more limited by the site
Antville is an open source project aimed to the development of an
"easy to maintain and use" weblog-hosting system. It is not limited
to just one weblog, it can easily host up to several hundred or
thousand weblogs (the number of weblogs is more limited by the site
owner's choice and server power than software limitations).
Antville is entirely written in JavaScript and based on the Helma
Object Publisher, a powerful and fast scriptable open source web
application server (which itself is written in Java). Antville works
Antville is entirely written in JavaScript and based on the Helma
Object Publisher, a powerful and fast scriptable open source web
application server (which itself is written in Java). Antville works
with a relational database in the backend.
Check out http://project.antville.org/ for more information.
============================
ABOUT HELMA OBJECT PUBLISHER
============================
===========
ABOUT HELMA
===========
Helma Object Publisher is a web application server.
Helma is a scriptable platform for creating dynamic, database backed
web sites.
With Helma Object Publisher (sometimes simply refered to as Helma or
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.
These objects are wrapped with a layer of scripts and skins that allow
them to be presented and manipulated over the web. The clue here is that
both functions and skins work in an object oriented manner and force
a clear separation between content, functionality and presentation.
Actions are special functions that are callable over the web. Macros are
special functions that expose functionality to the presentation layer.
Skins are pieces of layout that do not contain any application logic,
only macro tags as placeholders for parts that are dynamically provided
by the application.
HopObjects are extended JavaScript objects which can be scripted using
server-side JavaScript. Beyond the common JavaScript features, Helma
provides special "skin" and template functionalities which facilitate
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
===================
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
============================
Simply unzip or untar the contents of the archive file into any place
on your hard disk. Start Helma by invoking hop.bat or hop.sh from the
command line, depending on whether you are on Windows or
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.
Simply unzip the contents of the archive file into any place on your
hard disk. Start Helma by opening the file hop.bat or hop.sh,
respectively.
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/
(port 8080 on the local machine, that is).
browser to http://127.0.0.1:8080/ (port 8080, that is).
Helma comes with a version of Jetty, a lightweight yet industrial strenth
web server developed by Mortbay Consulting. See http://jetty.mortbay.com/
for more information. While Jetty works well for deploying real web sites,
you may want to run Helma behind an existing web server. This is most
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.
This version is set up to use its own embedded Web server and a very
basic embedded object database. For this reason it is able to run
virtually without installation on any platform with a Java 1.1 virtual
machine.
Finally, Helma can be plugged into Servlet containers using Servlet
classes that communicate with Helma either directly or via Java RMI.
(Be warned that these options may be harder to set up and maintain though,
since most of the recent development efforts have been geared towards the
mod_jk/AJPv13 setup.)
On the other hand, the embedded Web server and object db are meant for
development work and not ready for prime time deployment. For that
you'd probably use an external relational database, the Berkeley DB
package and a full featured Web server like Apache.
=====================================
DOCUMENTATION AND FURTHER INFORMATION
=====================================
Currently, documentation-in-progress is available online at
http://helma.org/. We know that it sucks and hope to do some substantial
improvments within the coming weeks and months.
Currently, a documentation-in-progress is available online only.
Please refer to http://helma.org/.
Your input is highly welcome. There is a mailing-list to discuss Helma at
http://helma.org/lists/listinfo/hop. Don't hesitate to voice any questions,
proposals, complaints, praise you may have on the list. We know we have
a lot to do and to learn, and we're open to suggestions.
For further information http://helma.org generally is a good place.
There is also a mailing-list about Helma-related stuff available at
http://helma.org/lists/listinfo/hop.
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

View file

@ -35,7 +35,7 @@ rem set JAVA_OPTIONS=-server -Xmx128m
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setting the script path
set INSTALL_DIR=%~d0%~p0
set SCRIPT_DIR=%~d0%~p0
:: Using JAVA_HOME variable if defined. Otherwise,
:: 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
if "%HOP_HOME%"=="" (
set HOP_HOME=%INSTALL_DIR%
set HOP_HOME=%SCRIPT_DIR%
)
cd %HOP_HOME%
@ -76,4 +76,4 @@ if not "%HOP_HOME%"=="" (
)
:: Invoking the Java virtual machine
%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS%
%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS%

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Shell script for starting Helma with a JDK-like virtual machine.
# To add JAR files to the classpath, simply place them into the
# To add JAR files to the classpath, simply place them into the
# lib/ext directory.
# uncomment to set JAVA_HOME variable
@ -32,11 +32,6 @@ else
JAVACMD=java
fi
# Get the Helma installation directory
INSTALL_DIR="${0%/*}"
cd $INSTALL_DIR
INSTALL_DIR=$PWD
# get HOP_HOME variable if it isn't set
if test -z "$HOP_HOME"; then
# try to get HOP_HOME from script file and pwd
@ -69,5 +64,5 @@ if [ "$HOP_HOME" ]; then
SWITCHES="$SWITCHES -h $HOP_HOME"
fi
# Invoke the Java VM
$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES
# Invoking the Java VM
$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES

View file

@ -8,7 +8,7 @@
<target name="init">
<property name="Name" value="helma"/>
<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="build.compiler" value="classic"/>
@ -28,7 +28,7 @@
<property name="jar.name" value="${project}"/>
<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="optimize" value="on"/>
@ -168,14 +168,6 @@
<antcall target="package-tgz">
<param name="filename" value="${package.name}"/>
</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 -->
<delete dir="${build.work}"/>
@ -196,13 +188,10 @@
<!-- copy the launcher jar file -->
<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 todir="${build.work}/docs">
<copy todir="${build.work}/docs">
<fileset dir="${build.docs}"/>
</copy -->
</copy>
<!-- copy all libraries except helma-YYYYMMDD.jar -->
<copy todir="${build.work}/lib">
@ -221,14 +210,14 @@
<copy file="${build.lib}/${jar.name}-${DSTAMP}.jar" tofile="${build.work}/lib/helma.jar"/>
<!-- zip the sourcecode -->
<!-- mkdir dir="${build.work}/src"/>
<mkdir dir="${build.work}/src"/>
<tar tarfile="${build.work}/src/helma-src.tar" basedir="${build.src}/">
<tarfileset dir="${build.src}">
<include name="${build.src}/**"/>
</tarfileset>
</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>
@ -237,14 +226,14 @@
<!-- =================================================================== -->
<target name="package-apps" depends="init">
<mkdir dir="${build.work}/apps" />
<mkdir dir="${build.work}/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="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="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="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="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="lillebror" dest="${build.work}/apps" />
<antcall target="package-manage" />
@ -266,7 +255,7 @@ manage
<!-- Checkout and zip manage application -->
<!-- =================================================================== -->
<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"/>
<zip zipfile="${build.work}/apps/manage/manage.zip" basedir="${build.work}/manage/" includes="**" excludes="**/properties,readme/**" />
<copy todir="${build.work}/apps/manage">
@ -302,7 +291,7 @@ manage
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<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" />
<zip zipfile="${build.dist}/${filename}.zip">
<zipfileset dir="${build.work}" prefix="${filename}" includes="**" />
@ -310,40 +299,12 @@ manage
</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) -->
<!-- =================================================================== -->
<target name="antclick" depends="init">
<mkdir dir="${build.work}"/>
<!-- create the main part of helma -->
<antcall target="package-raw">
<param name="distribution" value="antclick" />
@ -387,27 +348,27 @@ manage
<!-- =================================================================== -->
<!-- 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.work}" />
<!-- to retrieve special versions of an application insert
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" />
<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" />
<tar tarfile="${build.dist}/${application}-${DSTAMP}.tar" basedir="${build.work}">
<tarfileset dir="${build.work}">
<include name="${build.work}/**"/>
</tarfileset>
<tarfileset dir="${build.work}">
<include name="${build.work}/**"/>
</tarfileset>
</tar>
<gzip zipfile="${build.dist}/${application}-${DSTAMP}.tar.gz" src="${build.dist}/${application}-${DSTAMP}.tar" />
<delete file="${build.dist}/${application}-${DSTAMP}.tar" />
<delete dir="${build.work}" />
</target>
</target>
</project>

View file

@ -35,7 +35,7 @@ rem set JAVA_OPTIONS=-server -Xmx128m
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setting the script path
set INSTALL_DIR=%~d0%~p0
set SCRIPT_DIR=%~d0%~p0
:: Using JAVA_HOME variable if defined. Otherwise,
:: 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
if "%HOP_HOME%"=="" (
set HOP_HOME=%INSTALL_DIR%
set HOP_HOME=%SCRIPT_DIR%
)
cd %HOP_HOME%
@ -76,4 +76,4 @@ if not "%HOP_HOME%"=="" (
)
:: Invoking the Java virtual machine
%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS%
%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS%

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Shell script for starting Helma with a JDK-like virtual machine.
# To add JAR files to the classpath, simply place them into the
# To add JAR files to the classpath, simply place them into the
# lib/ext directory.
# uncomment to set JAVA_HOME variable
@ -32,11 +32,6 @@ else
JAVACMD=java
fi
# Get the Helma installation directory
INSTALL_DIR="${0%/*}"
cd $INSTALL_DIR
INSTALL_DIR=$PWD
# get HOP_HOME variable if it isn't set
if test -z "$HOP_HOME"; then
# try to get HOP_HOME from script file and pwd
@ -69,5 +64,5 @@ if [ "$HOP_HOME" ]; then
SWITCHES="$SWITCHES -h $HOP_HOME"
fi
# Invoke the Java VM
$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES
# Invoking the Java VM
$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES

View file

@ -35,7 +35,7 @@ rem set JAVA_OPTIONS=-server -Xmx128m
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setting the script path
set INSTALL_DIR=%~d0%~p0
set SCRIPT_DIR=%~d0%~p0
:: Using JAVA_HOME variable if defined. Otherwise,
:: 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
if "%HOP_HOME%"=="" (
set HOP_HOME=%INSTALL_DIR%
set HOP_HOME=%SCRIPT_DIR%
)
cd %HOP_HOME%
@ -76,4 +76,4 @@ if not "%HOP_HOME%"=="" (
)
:: Invoking the Java virtual machine
%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS%
%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS%

11
hop.sh
View file

@ -1,7 +1,7 @@
#!/bin/sh
# Shell script for starting Helma with a JDK-like virtual machine.
# To add JAR files to the classpath, simply place them into the
# To add JAR files to the classpath, simply place them into the
# lib/ext directory.
# uncomment to set JAVA_HOME variable
@ -32,11 +32,6 @@ else
JAVACMD=java
fi
# Get the Helma installation directory
INSTALL_DIR="${0%/*}"
cd $INSTALL_DIR
INSTALL_DIR=$PWD
# get HOP_HOME variable if it isn't set
if test -z "$HOP_HOME"; then
# try to get HOP_HOME from script file and pwd
@ -69,5 +64,5 @@ if [ "$HOP_HOME" ]; then
SWITCHES="$SWITCHES -h $HOP_HOME"
fi
# Invoke the Java VM
$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES
# Invoking the Java VM
$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES

Binary file not shown.

View file

@ -78,11 +78,6 @@ class CompatibilityDescriptor {
}
}
}
// convert
} // convert
}
// class CompatibilityDescriptor
} // class CompatibilityDescriptor

View file

@ -185,15 +185,11 @@ public final class ESArguments extends ESObject {
ESValue[] argumentValues) {
ObjectPrototype op =
(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,
maxArgs,
Math.max(argumentValues.length, argumentNames.length),
callee);
try {
for (int i=0; i<maxArgs; i++) {
for (int i=0; i<argumentValues.length; i++) {
ESValue val = (i<argumentValues.length) ? argumentValues[i] :
ESUndefined.theUndefined;
if (i<argumentNames.length) {

View file

@ -53,7 +53,7 @@ public class ESBeans extends ESLoader {
*/
public ESBeans(String packageName,
ESBeans previousPackage,
ClassLoader classLoader,
LocalClassLoader classLoader,
Evaluator 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");
}
String directoryOrJar = arguments[0].toString();
ClassLoader classLoader =
LocalClassLoader classLoader =
LocalClassLoader.makeLocalClassLoader(directoryOrJar);
return new ESBeans(null, null, classLoader, evaluator);
} else {
@ -146,4 +146,4 @@ public class ESBeans extends ESLoader {
}
}

View file

@ -56,7 +56,7 @@ public abstract class ESLoader extends ESObject {
// Incremental package name
protected String packageName = null;
protected ESLoader previousPackage = null;
protected ClassLoader classLoader = null;
protected LocalClassLoader classLoader = null;
// the non compatible flag
static private CompatibilityDescriptor nonCompatible =
@ -69,15 +69,7 @@ public abstract class ESLoader extends ESObject {
public ESLoader(Evaluator 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
* partial or complete package name
@ -88,7 +80,7 @@ public abstract class ESLoader extends ESObject {
*/
public ESLoader(String packageName,
ESLoader previousPackage,
ClassLoader classLoader,
LocalClassLoader classLoader,
Evaluator evaluator) {
super(null, evaluator);
this.packageName = packageName;

View file

@ -34,7 +34,7 @@ import java.util.zip.*;
* Implements the object loader
*/
public class ESPackages extends ESLoader {
/**
* Create the top level package loader (object Package)
* @param evaluator the evaluator
@ -42,14 +42,6 @@ public class ESPackages extends ESLoader {
public ESPackages(Evaluator 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
@ -60,7 +52,7 @@ public class ESPackages extends ESLoader {
*/
public ESPackages(String packageName,
ESPackages previousPackage,
ClassLoader classLoader,
LocalClassLoader classLoader,
Evaluator evaluator) {
super(packageName,previousPackage,classLoader,evaluator);
}
@ -125,7 +117,7 @@ public class ESPackages extends ESLoader {
throw new EcmaScriptException("Missing class directory or file name");
}
String directoryOrJar = arguments[0].toString();
ClassLoader classLoader =
LocalClassLoader classLoader =
LocalClassLoader.makeLocalClassLoader(directoryOrJar);
return new ESPackages(null, null, classLoader, evaluator);
} else {
@ -147,4 +139,4 @@ public class ESPackages extends ESLoader {
}
}

View file

@ -338,10 +338,10 @@ class ESRowSet extends ESObject {
this.statement = statement;
this.resultSet = resultSet;
if (sql==null) throw new NullPointerException("sql");
if (resultSet==null) throw new NullPointerException("resultSet");
if (statement==null) throw new NullPointerException("statement");
if (database==null) throw new NullPointerException("database");
if (sql==null) throw new NullPointerException();
if (resultSet==null) throw new NullPointerException();
if (statement==null) throw new NullPointerException();
if (database==null) throw new NullPointerException();
try {

View file

@ -168,13 +168,7 @@ public class ClassInfo {
if (indexedReadMethod != null && indexedReadMethod.getParameterTypes().length != 1) {
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) {
// Work around reflection bug, Hannes Wallnoefer 11/2002
if (Modifier.isPublic (indexedWriteMethod.getModifiers ()))
indexedWriteMethod.setAccessible (true);
Class [] paramCls = indexedWriteMethod.getParameterTypes();
if (paramCls == null || paramCls.length != 2) {
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) {
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) {
// Work around reflection bug, Hannes Wallnoefer 11/2002
if (Modifier.isPublic (writeMethod.getModifiers ()))
writeMethod.setAccessible (true);
Class [] paramCls = writeMethod.getParameterTypes();
if (paramCls == null || paramCls.length != 1) {
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) {
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) {
// Work around reflection bug, Hannes Wallnoefer 11/2002
if (Modifier.isPublic (writeMethod.getModifiers ()))
writeMethod.setAccessible (true);
Class [] paramCls = writeMethod.getParameterTypes();
if (paramCls == null || paramCls.length != 1) {
throw new ProgrammingError("Non indexed setter of property ' " + propertyName + "' should have 1 parameter!");
@ -236,8 +218,8 @@ public class ClassInfo {
}
}
}
// Add to cache
// Add to cache
if (debug) System.out.println("** property '" + propertyName + "' + found, add to cache");
if (beanProperties==null) {
beanProperties = new Hashtable();
@ -248,7 +230,7 @@ public class ClassInfo {
}
return descriptor;
}
/**
* Get the list of public method in this class or superclass, by name (the
@ -417,7 +399,6 @@ public class ClassInfo {
}
} // if class not public
// Work around reflection bug, Hannes Wallnoefer 11/2002
if (Modifier.isPublic (method.getModifiers ()))
method.setAccessible (true);
// save it
@ -537,7 +518,6 @@ public class ClassInfo {
}
} // for
} // if class not public
// Work around reflection bug, Hannes Wallnoefer 11/2002
if (Modifier.isPublic (method.getModifiers ()))
method.setAccessible (true);
// save it

View file

@ -247,14 +247,14 @@ public class EcmaScriptEvaluateVisitor
boolean b2 =v2.booleanValue();
return b1==b2;
}
// ESNode wrappers must be checked with equals() because
// it's possible that different wrappers wrap the same node!
if (v1 instanceof helma.scripting.fesi.ESNode ||
v1 instanceof helma.scripting.fesi.ESGenericObject) {
if (v1 instanceof helma.scripting.fesi.ESNode ||
v1 instanceof helma.scripting.fesi.ESGenericObject) {
return v1.equals (v2);
}
return v1 == v2;
}
@ -311,8 +311,8 @@ public class EcmaScriptEvaluateVisitor
public Object visit(ASTStatementList node, Object data) {
int n = node.jjtGetNumChildren();
// Return ESUndefined for empty statement lists (for
// example generated by calling 'function(){}')
// Accepts empty statement lists (for example generated
// by function(){}
Object result = ESUndefined.theUndefined;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
if (completionCode != C_NORMAL) return result;
@ -344,11 +344,11 @@ public class EcmaScriptEvaluateVisitor
}
public Object visit(ASTVariableDeclaration node, Object data) {
Object result = null;
int nChildren = node.jjtGetNumChildren();
if (nChildren<1 || nChildren>2) {
throw new ProgrammingError("Bad AST in variable declaration");
}
Object result = null;
if (nChildren == 2) {
try {
Object lvo = node.jjtGetChild(0).jjtAccept(this,FOR_REFERENCE);
@ -376,7 +376,7 @@ public class EcmaScriptEvaluateVisitor
throw new ProgrammingError("Bad AST in IF statement");
}
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();
if (test) {
result = node.jjtGetChild(1).jjtAccept(this,FOR_VALUE);
@ -395,7 +395,7 @@ public class EcmaScriptEvaluateVisitor
Object result = null;
node.assertTwoChildren();
try {
ESValue testValue = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
ESValue testValue = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
while (testValue.booleanValue()) {
// Thread.yield ();
@ -406,13 +406,13 @@ public class EcmaScriptEvaluateVisitor
if (completionCode == C_RETURN) {
return result;
} else if (completionCode == C_BREAK) {
completionCode = C_NORMAL;
completionCode = C_NORMAL;
return result;
} 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;
} else {
testValue = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
testValue = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
}
}
} catch (EcmaScriptException e) {
@ -433,7 +433,7 @@ public class EcmaScriptEvaluateVisitor
if (testNode instanceof ASTEmptyExpression) {
testValue = ESBoolean.makeBoolean(true);
} else {
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
}
while (testValue.booleanValue()) {
// Thread.yield ();
@ -452,7 +452,7 @@ public class EcmaScriptEvaluateVisitor
if (testNode instanceof ASTEmptyExpression) {
testValue = ESBoolean.makeBoolean(true);
} else {
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
}
completionCode = C_NORMAL;
} else {
@ -460,7 +460,7 @@ public class EcmaScriptEvaluateVisitor
if (testNode instanceof ASTEmptyExpression) {
testValue = ESBoolean.makeBoolean(true);
} 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) {
testValue = ESBoolean.makeBoolean(true);
} else {
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
}
while (testValue.booleanValue()) {
result = node.jjtGetChild(3).jjtAccept(this,FOR_VALUE);
@ -498,7 +498,7 @@ public class EcmaScriptEvaluateVisitor
if (testNode instanceof ASTEmptyExpression) {
testValue = ESBoolean.makeBoolean(true);
} else {
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
}
completionCode = C_NORMAL;
} else {
@ -506,18 +506,18 @@ public class EcmaScriptEvaluateVisitor
if (testNode instanceof ASTEmptyExpression) {
testValue = ESBoolean.makeBoolean(true);
} else {
testValue = acceptNull(testNode.jjtAccept(this,FOR_VALUE));
testValue = (ESValue) testNode.jjtAccept(this,FOR_VALUE);
}
}
// Thread.yield ();
if (evaluator.thread != Thread.currentThread())
throw new helma.framework.TimeoutException();
}
} catch (EcmaScriptException e) {
throw new PackagedException(e,node);
}
}
return result;
}
@ -525,7 +525,7 @@ public class EcmaScriptEvaluateVisitor
Object result = null; // No value by default
node.assertThreeChildren();
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);
boolean directEnumeration = obj.isDirectEnumerator();
for (Enumeration e = obj.getProperties() ; e.hasMoreElements() ;) {
@ -576,10 +576,10 @@ public class EcmaScriptEvaluateVisitor
// Should not happen as it should be an identifier
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);
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);
boolean directEnumeration = obj.isDirectEnumerator();
for (Enumeration e = obj.getProperties() ; e.hasMoreElements() ;) {
@ -635,7 +635,7 @@ public class EcmaScriptEvaluateVisitor
ESValue result = null;
try {
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));
ESObject scopeObject = (ESObject) scopeValue.toESObject(evaluator);
result = evaluator.evaluateWith(statementNode, scopeObject, es);
@ -679,7 +679,7 @@ public class EcmaScriptEvaluateVisitor
String id = ((ASTIdentifier)baseNode).getName();
currentProperty = new ESString(id);
} else {
lastResult = acceptNull(baseNode.jjtAccept(this,FOR_VALUE));
lastResult = (ESValue) baseNode.jjtAccept(this,FOR_VALUE);
currentProperty = null; // No reference so far
}
}
@ -811,10 +811,7 @@ public class EcmaScriptEvaluateVisitor
//System.out.println("--->Build value cp: " + currentProperty + " lr: " + lastResult + "<---"); // ********
if (currentProperty != null) {
// Must dereference value
if (lastResult == null) {
throw new EcmaScriptException("'undefined' is not an object with properties");
}
ESObject currentBase = (ESObject) lastResult.toESObject(evaluator);
ESObject currentBase = (ESObject) lastResult.toESObject(evaluator);
String propertyName = currentProperty.toString();
//System.out.println("--->getProperty in cb: " + currentBase + " pn: " + propertyName + "<---"); // *******
result = currentBase.getProperty(propertyName,propertyName.hashCode());
@ -825,9 +822,6 @@ public class EcmaScriptEvaluateVisitor
} else {
// We want a reference - therefore it cannot be just a value, it
// must be a delayed reference.
if (lastResult == null) {
throw new EcmaScriptException("'undefined' is not an assignable value");
}
if (currentProperty == null) {
throw new EcmaScriptException("'"+lastResult.toString()+"' is not an assignable value");
}
@ -856,7 +850,7 @@ public class EcmaScriptEvaluateVisitor
public Object visit(ASTPropertyValueReference node, Object data) {
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) {
@ -878,8 +872,7 @@ public class EcmaScriptEvaluateVisitor
try {
int nChildren=node.jjtGetNumChildren();
Node baseNode = node.jjtGetChild(0);
// Can be any expression (in fact a a.b.c sequence) [code bizare here]
ESValue constr = acceptNull(baseNode.jjtAccept(this, FOR_VALUE));
ESValue constr = (ESValue) baseNode.jjtAccept(this, FOR_VALUE); // Can be any expression (in fact a a.b.c sequence)
Node compositor = node.jjtGetChild(1);
if (compositor instanceof ASTFunctionCallParameters) {
ASTFunctionCallParameters fc = (ASTFunctionCallParameters) compositor;
@ -963,8 +956,7 @@ public class EcmaScriptEvaluateVisitor
if (n instanceof ASTIdentifier) {
// We need to get a reference, as an null based referenced is "undefined"
ESReference ref = (ESReference) n.jjtAccept(this,FOR_REFERENCE);
// If reference to nothing, consider undefined
if (ref == null || ref.getBase()==null) {
if (ref.getBase()==null) {
r = new ESString("undefined");
} else {
ESValue v = ref.getValue();
@ -972,7 +964,7 @@ public class EcmaScriptEvaluateVisitor
}
} else {
// 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());
}
}
@ -1043,9 +1035,9 @@ public class EcmaScriptEvaluateVisitor
public Object visit(ASTBinaryExpressionSequence node, Object data) {
ESValue result = null;
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) {
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();
// System.out.println("V1 = " + v1 + " v2 = " + v2);
switch (operator) {
@ -1176,10 +1168,10 @@ public class EcmaScriptEvaluateVisitor
ESValue result = null;
int nChildren = node.jjtGetNumChildren();
try {
result = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
result = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
int i = 1;
while (result.booleanValue() && (i<nChildren)) {
result = acceptNull(node.jjtGetChild(i).jjtAccept(this,FOR_VALUE));
result = (ESValue) node.jjtGetChild(i).jjtAccept(this,FOR_VALUE);
i ++;
}
// Normalize to primitive - could be optimized...
@ -1194,10 +1186,10 @@ public class EcmaScriptEvaluateVisitor
int nChildren = node.jjtGetNumChildren();
ESValue result = null;
try {
result = acceptNull(node.jjtGetChild(0).jjtAccept(this,FOR_VALUE));
result = (ESValue) node.jjtGetChild(0).jjtAccept(this,FOR_VALUE);
int i = 1;
while ((!result.booleanValue()) && (i<nChildren)) {
result = acceptNull(node.jjtGetChild(i).jjtAccept(this,FOR_VALUE));
result = (ESValue) node.jjtGetChild(i).jjtAccept(this,FOR_VALUE);
i ++;
}
// Normalize to primitive - could be optimized...
@ -1218,7 +1210,7 @@ public class EcmaScriptEvaluateVisitor
node.assertThreeChildren();
Object result = null;
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();
if (test) {
result = node.jjtGetChild(1).jjtAccept(this, FOR_VALUE);
@ -1236,6 +1228,7 @@ public class EcmaScriptEvaluateVisitor
ESValue result = null;
try {
// Get left hand side
Object lvo = node.jjtGetChild(0).jjtAccept(this,FOR_REFERENCE);
//System.out.println("REF: " + lvo);
ESReference lv;
@ -1245,7 +1238,8 @@ public class EcmaScriptEvaluateVisitor
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
int operator = ((ASTOperator)(node.jjtGetChild(1))).getOperator();
@ -1254,7 +1248,7 @@ public class EcmaScriptEvaluateVisitor
evaluator.putValue(lv, v2);
result = v2;
} else {
// All composite assignement requires a current value
// All composite assignement requires a current value
ESValue v1 = lv.getValue();
switch (operator) {
case PLUSASSIGN: {
@ -1367,30 +1361,7 @@ public class EcmaScriptEvaluateVisitor
}
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;
}
}
}

View file

@ -33,8 +33,6 @@ import java.util.StringTokenizer;
import java.io.*;
import java.util.zip.*;
import helma.scripting.fesi.FesiEngine;
/**
* Defines the evaluation interface and contains the evaluation context.
* <P><B>Important:</B> This object is also used as the synchronization
@ -43,11 +41,11 @@ import helma.scripting.fesi.FesiEngine;
* for speed reasons.
*/
public class Evaluator {
// used to stop thread, 06.12.99 Hannes Wallnoefer
public volatile Thread thread;
// 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");
@ -55,7 +53,7 @@ public class Evaluator {
* Return the version identifier of the interpreter
*/
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);
// evaluationVisitor = new EcmaScriptEvaluateVisitor(this);
globalObject = GlobalObject.makeGlobalObject(this);
packageObject = engine == null ?
new ESPackages(this) :
new ESPackages(this, engine.getClassLoader ());
packageObject = new ESPackages(this);
extensions = new Hashtable(); // forget extensions
}
/**
* Create a new empty evaluator
*/
public Evaluator () {
this.engine = null;
reset();
}
/**
* Create a new empty evaluator
*/
public Evaluator (FesiEngine engine) {
this.engine = engine;
reset();
}
@ -294,7 +283,6 @@ public class Evaluator {
*/
public void setDatePrototype(ESObject o) {
datePrototype = o;
}
/**
* Get the Date prototype object
@ -312,6 +300,7 @@ public class Evaluator {
return packageObject;
}
//------------------------------------------------------------
// Extension support
//------------------------------------------------------------
@ -514,16 +503,11 @@ public class Evaluator {
*/
public ESValue evaluateEvalString(String theSource) throws EcmaScriptException {
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 =
new java.io.StringReader(theSource);
EcmaScript parser = new EcmaScript(is);
ASTProgram programNode = null;
StringEvaluationSource es = new StringEvaluationSource(theSource, null);
try {
// ASTProgram n = parser.Program();
programNode = (ASTProgram)parser.Program();
@ -776,6 +760,7 @@ public class Evaluator {
// currentEvaluationSource = es;
try {
for (Enumeration e = localVariableNames.elements() ; e.hasMoreElements() ;) {
String variable =(String)(e.nextElement());
createVariable(variable, variable.hashCode());
}
@ -851,8 +836,6 @@ public class Evaluator {
EcmaScriptEvaluateVisitor evaluationVisitor = new EcmaScriptEvaluateVisitor(this);
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);
Vector variables = program.getVariableNames();
for (Enumeration e = variables.elements() ; e.hasMoreElements() ;) {
@ -990,11 +973,6 @@ public class Evaluator {
ESValue v = null;
EvaluationSource es = new UserEvaluationSource(source, null);
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);
v = evaluate(is, globalObject, es, false);
} finally {
@ -1026,6 +1004,7 @@ public class Evaluator {
synchronized public ESValue evaluate(File file, ESObject thisObject)
throws EcmaScriptException, IOException {
EvaluationSource es = new FileEvaluationSource(file.getPath(), null);
FileReader fr = null;
ESValue value = null;
try {
@ -1071,11 +1050,6 @@ public class Evaluator {
java.io.StringReader is = null;
ESValue v = 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 {
is = new java.io.StringReader(theSource);
v = evaluate(is, thisObject, es, returnAccepted);

View file

@ -349,7 +349,7 @@ class FesiHashtable implements Cloneable {
public ESValue put(String key, int hash, boolean hidden, boolean readonly, ESValue value) {
// Make sure the value is not null
if (value == null) {
throw new NullPointerException("value");
throw new NullPointerException();
}
// Makes sure the key is not already in the hashtable.

View file

@ -13,7 +13,6 @@ public final class ASCII_CharStream
int available;
int tokenBegin;
public int bufpos = -1;
boolean addedNewline = false;
private int bufline[];
private int bufcolumn[];
@ -108,14 +107,8 @@ public final class ASCII_CharStream
if ((i = inputStream.read(buffer, maxNextCharInd,
available - maxNextCharInd)) == -1)
{
if (!addedNewline) {
addedNewline = true;
buffer[maxNextCharInd] = '\n';
i = 1;
} else {
inputStream.close();
throw new java.io.IOException();
}
inputStream.close();
throw new java.io.IOException();
}
else
maxNextCharInd += i;
@ -272,7 +265,6 @@ public final class ASCII_CharStream
prevCharIsLF = prevCharIsCR = false;
tokenBegin = inBuf = maxNextCharInd = 0;
bufpos = -1;
addedNewline = false;
}
public void ReInit(java.io.Reader dstream, int startline,
@ -382,4 +374,4 @@ public final class ASCII_CharStream
column = bufcolumn[j];
}
}
}

View file

@ -3164,6 +3164,14 @@ public class EcmaScript/*@bgen(jjtree)*/implements EcmaScriptTreeConstants, Ecma
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() {
if (jj_scan_token(FOR)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@ -3174,14 +3182,6 @@ public class EcmaScript/*@bgen(jjtree)*/implements EcmaScriptTreeConstants, Ecma
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() {
if (jj_3R_138()) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;

View file

@ -1654,13 +1654,6 @@ final void SkipLexicalActions(Token matchedToken)
{
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 :
break;
}

View file

@ -53,6 +53,7 @@ public class DocFunction extends DocFileElement {
}
/**
* reads a function file and creates DocFunction objects of type FUNCTION
* connected to another DocElement.
@ -102,9 +103,7 @@ public class DocFunction extends DocFileElement {
func.parseSource (location, beginLine, beginColumn, endLine, endColumn);
vec.add (func);
}
if (tok.kind != EcmaScriptConstants.FUNCTION) {
tok = mgr.getNextToken();
}
tok = mgr.getNextToken();
}
return (DocFunction[]) vec.toArray (new DocFunction[0]);
}

View file

@ -45,19 +45,5 @@ public class DocProperties extends DocFileElement {
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;
}
}

View file

@ -51,11 +51,7 @@ public final class DocTag {
String name = "";
if (tok.hasMoreTokens ())
name = tok.nextToken ();
String comment = "";
try {
comment = content.substring (name.length ()+1).trim ();
} catch (StringIndexOutOfBoundsException e) { }
return new DocTag (kind, name, comment);
return new DocTag (kind, name, content.substring (name.length ()+1).trim ());
} else {
return new DocTag (kind, "", content);
}

View file

@ -929,14 +929,6 @@ public final class Application implements IPathElement, Runnable {
}
return null;
}
/**
* Return the application's classloader
*/
public ClassLoader getClassLoader () {
return typemgr.loader;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/// The following methods mimic the IPathElement interface. This allows us

View file

@ -72,9 +72,9 @@ public final class RequestEvaluator implements Runnable {
if (scriptingEngine == null) {
String engineClassName = app.getProperty (
"scriptingEngine",
"helma.scripting.fesi.PhantomEngine");
"helma.scripting.fesi.FesiEngine");
try {
Class clazz = app.getClassLoader().loadClass (engineClassName);
Class clazz = app.typemgr.loader.loadClass (engineClassName);
scriptingEngine = (ScriptingEngine) clazz.newInstance ();
scriptingEngine.init (app, this);
} catch (Exception x) {
@ -666,7 +666,6 @@ public final class RequestEvaluator implements Runnable {
if (rtx == null || !rtx.isAlive()) {
// app.logEvent ("Starting Thread");
rtx = new Transactor (this, app.threadgroup, app.nmgr);
rtx.setContextClassLoader (app.getClassLoader ());
rtx.start ();
} else {
notifyAll ();

View file

@ -10,7 +10,6 @@ import helma.util.*;
import java.util.*;
import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.MalformedURLException;
/**
@ -61,17 +60,7 @@ public final class TypeManager {
prototypes = new HashMap ();
zipfiles = new HashMap ();
jarfiles = new HashSet ();
URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
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");
URL helmajar = new URL ("file:"+app.home.getAbsolutePath()+"/lib/helma.jar");
loader = new AppClassLoader(app.getName(), new URL[] { helmajar });
}

View file

@ -25,7 +25,7 @@ import org.apache.xmlrpc.*;
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;
// if true we only accept RMI and XML-RPC connections from
@ -222,15 +222,8 @@ import org.apache.xmlrpc.*;
} catch (IOException iox) {
System.err.println ("Error calling getCanonicalFile() on hopHome: "+iox);
}
// 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", hopHome.getPath());
// from now on it's safe to call getLogger() because hopHome is set up
// from now on it's safe to call getLogger()
String startMessage = "Starting Helma "+version+
" on Java "+System.getProperty ("java.version");

View file

@ -29,7 +29,9 @@ public class FilteredClassLoader extends URLClassLoader {
* Mask classes that implement the scripting engine(s) contained in helma.jar
*/
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);
return super.findClass (name);
}

View file

@ -27,38 +27,49 @@ public class Main {
// 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
// has been loaded from.
String installDir = null;
String home = null;
// first, try to get helma home dir from command line options
for (int i=0; i<args.length; i++) {
if (args[i].equals ("-i") && i+1<args.length) {
installDir = args[i+1];
if (args[i].equals ("-h") && i+1<args.length) {
home = args[i+1];
}
}
URLClassLoader apploader = (URLClassLoader) ClassLoader.getSystemClassLoader();
// try to get Helma installation directory
if (installDir == null) {
if (home == null) {
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
// jar:<url>!/{entry}
// we strip away the jar: prefix and the !/{entry} suffix
// to get the original jar file URL
installDir = launcherUrl.toString().substring(4);
int excl = installDir.indexOf ("!");
home = homeUrl.toString().substring(4);
int excl = home.indexOf ("!");
if (excl > -1) {
installDir = installDir.substring(0, excl);
launcherUrl = new URL (installDir);
File f = new File (launcherUrl.getPath());
installDir = f.getParentFile().getCanonicalPath();
home = home.substring(0, excl);
homeUrl = new URL (home);
File f = new File (homeUrl.getPath());
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) {
// unable to get Helma installation dir from launcher jar
System.err.println ("Unable to get Helma installation directory: "+x);
} catch (Exception ignore) {
// unable to get Helma home dir from launcher jar
}
}
// 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
File libdir = new File (installDir, "lib");
File libdir = new File (home, "lib");
ArrayList jarlist = new ArrayList ();
for (int i=0;i<jars.length;i++) {
File jar = new File (libdir, jars[i]);
@ -74,9 +85,9 @@ public class Main {
if (files != null)
for (int i=0;i<files.length; i++)
// WORKAROUND: add the files in lib/ext before
// lib/apache-dom.jar, since otherwise putting a full version
// of Xerces in lib/ext would cause a version conflict with the
// xerces classes in lib/apache-dom.jar. Generally, having some pieces
// lib/apache-dom.jar, since otherwise putting a full version
// of Xerces in lib/ext would cause a version conflict with the
// xerces classes in lib/apache-dom.jar. Generally, having some pieces
// of Xerces in lib/apache-dom.jar is kind of problematic.
jarlist.add (jars.length-3, new URL ("file:" + files[i].getAbsolutePath()));
URL[] urls = new URL[jarlist.size()];

View file

@ -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;
}
}

View file

@ -13,8 +13,8 @@ import java.util.StringTokenizer;
import java.sql.*;
import com.workingdogs.village.*;
/**
* A DbMapping describes how a certain type of Nodes is to mapped to a
/**
* A DbMapping describes how a certain type of Nodes is to mapped to a
* relational database table. Basically it consists of a set of JavaScript property-to-
* Database row bindings which are represented by instances of the Relation class.
*/
@ -43,21 +43,15 @@ public final class DbMapping implements Updatable {
Relation subRelation;
Relation propRelation;
// if this defines a subnode mapping with groupby layer,
// we need a DbMapping for those groupby nodes
// if this defines a subnode mapping with groupby layer, we need a DbMapping for those groupby nodes
DbMapping groupbyMapping;
// Map of property names to Relations objects
HashMap prop2db;
// Map of db columns to Relations objects.
// Case insensitive, keys are stored in upper case so
// lookups must do a toUpperCase().
// Map of db columns to Relations objects
HashMap db2prop;
// list of columns to fetch from db
DbColumn[] columns = null;
// Map of db columns by name
HashMap columnMap;
String[] columns = null;
// pre-rendered select statement
String select = null;
@ -121,8 +115,6 @@ public final class DbMapping implements Updatable {
prop2db = new HashMap ();
db2prop = new HashMap ();
columnMap = new HashMap ();
parent = null;
@ -193,7 +185,6 @@ public final class DbMapping implements Updatable {
keydef = null;
// same with columns and select string
columns = null;
columnMap.clear();
select = null;
@ -220,8 +211,8 @@ public final class DbMapping implements Updatable {
rel.update (dbField, props);
p2d.put (propName, rel);
if (rel.columnName != null &&
(rel.reftype == Relation.PRIMITIVE ||
rel.reftype == Relation.REFERENCE))
(rel.reftype == Relation.PRIMITIVE ||
rel.reftype == Relation.REFERENCE))
d2p.put (rel.columnName.toUpperCase (), rel);
// app.logEvent ("Mapping "+propName+" -> "+dbField);
}
@ -240,7 +231,7 @@ public final class DbMapping implements Updatable {
if (subRelation == null)
subRelation = new Relation (subnodeMapping, "_children", this, props);
subRelation.update (subnodeMapping, props);
// if subnodes are accessed via access name or group name,
// if subnodes are accessed via access name or group name,
// the subnode relation is also the property relation.
if (subRelation.accessor != null || subRelation.groupby != null)
propRelation = subRelation;
@ -259,7 +250,7 @@ public final class DbMapping implements Updatable {
}
/**
/**
* Method in interface Updatable.
*/
public void remove () {
@ -488,7 +479,7 @@ public final class DbMapping implements Updatable {
groupbyMapping.typename = subRelation.groupbyPrototype;
}
public void setPropertyRelation (Relation rel) {
propRelation = rel;
}
@ -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 ())
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)
return parentMapping.getColumns ();
// 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.
Connection con = getConnection ();
Statement stmt = con.createStatement ();
String t = getTableName();
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());
ResultSet rs = stmt.executeQuery ("select * from "+getTableName()+" where 1 = 0");
if (rs == null)
throw new SQLException ("Error retrieving columns for "+this);
throw new SQLException ("Error retrieving DB scheme for "+this);
ResultSetMetaData meta = rs.getMetaData ();
// ok, we have the meta data, now loop through mapping...
int ncols = meta.getColumnCount ();
columns = new DbColumn[ncols];
columns = new String[ncols];
for (int i=0; i<ncols; i++) {
String colName = meta.getColumnName (i+1);
Relation rel = columnNameToRelation (colName);
columns[i] = new DbColumn (colName, meta.getColumnType (i+1), rel);
columns[i] = meta.getColumnName (i+1);
Relation rel = columnNameToRelation (columns[i]);
if (rel == null || (rel.reftype != Relation.PRIMITIVE &&
rel.reftype != Relation.REFERENCE))
continue;
rel.setColumnType (meta.getColumnType (i+1));
}
}
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 {
String sel = select;
if (sel != null)
@ -649,8 +619,13 @@ public final class DbMapping implements Updatable {
if (table == null && parentMapping != null)
return parentMapping.needsQuotes (columnName);
try {
DbColumn col = getColumn (columnName);
switch (col.getType()) {
Relation rel = (Relation) db2prop.get (columnName.toUpperCase());
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.VARCHAR:
case Types.LONGVARCHAR:

View file

@ -234,7 +234,7 @@ public final class Node implements INode, Serializable {
/**
* 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 {
this.nmgr = nmgr;
@ -265,35 +265,35 @@ public final class Node implements INode, Serializable {
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 &&
rel.reftype != Relation.REFERENCE))
continue;
Property newprop = new Property (rel.propName, this);
switch (columns[i].getType()) {
switch (rel.getColumnType()) {
case Types.BIT:
newprop.setBooleanValue (rs.getBoolean(columns[i].getName()));
newprop.setBooleanValue (rs.getBoolean(columns[i]));
break;
case Types.TINYINT:
case Types.BIGINT:
case Types.SMALLINT:
case Types.INTEGER:
newprop.setIntegerValue (rs.getLong(columns[i].getName()));
newprop.setIntegerValue (rs.getLong(columns[i]));
break;
case Types.REAL:
case Types.FLOAT:
case Types.DOUBLE:
newprop.setFloatValue (rs.getDouble(columns[i].getName()));
newprop.setFloatValue (rs.getDouble(columns[i]));
break;
case Types.DECIMAL:
case Types.NUMERIC:
BigDecimal num = rs.getBigDecimal (columns[i].getName());
BigDecimal num = rs.getBigDecimal (columns[i]);
if (num == null)
break;
if (num.scale() > 0)
@ -305,20 +305,20 @@ public final class Node implements INode, Serializable {
case Types.LONGVARBINARY:
case Types.VARBINARY:
case Types.BINARY:
newprop.setStringValue (rs.getString(columns[i].getName()));
newprop.setStringValue (rs.getString(columns[i]));
break;
case Types.LONGVARCHAR:
case Types.CHAR:
case Types.VARCHAR:
case Types.OTHER:
newprop.setStringValue (rs.getString(columns[i].getName()));
newprop.setStringValue (rs.getString(columns[i]));
break;
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
newprop.setDateValue (rs.getTimestamp(columns[i].getName()));
newprop.setDateValue (rs.getTimestamp(columns[i]));
break;
case Types.NULL:
@ -327,7 +327,7 @@ public final class Node implements INode, Serializable {
// continue;
default:
newprop.setStringValue (rs.getString(columns[i].getName()));
newprop.setStringValue (rs.getString(columns[i]));
break;
}
@ -1837,7 +1837,7 @@ public final class Node implements INode, Serializable {
*/
public INode getNonVirtualParent () {
INode node = this;
for (int i=0; i<5; i++) {
for (int i=0; i<3; i++) {
if (node == null) break;
if (node.getState() != Node.VIRTUAL)
return node;

View file

@ -580,13 +580,7 @@ public final class NodeManager {
try {
Connection con = dbm.getConnection ();
st = con.createStatement ();
st.executeUpdate (new StringBuffer ("DELETE FROM ")
.append(dbm.getTableName ())
.append(" WHERE ")
.append(dbm.getIDField())
.append(" = ")
.append(node.getID())
.toString());
st.executeUpdate ("DELETE FROM "+dbm.getTableName ()+" WHERE "+dbm.getIDField ()+" = "+node.getID ());
} finally {
if (st != null) try {
st.close ();
@ -611,11 +605,7 @@ public final class NodeManager {
Statement stmt = null;
try {
Connection con = map.getConnection ();
String q = new StringBuffer("SELECT MAX(")
.append(map.getIDField())
.append(") FROM ")
.append(map.getTableName())
.toString();
String q = "SELECT MAX("+map.getIDField()+") FROM "+map.getTableName();
stmt = con.createStatement ();
ResultSet rs = stmt.executeQuery (q);
// check for empty table
@ -649,10 +639,7 @@ public final class NodeManager {
String retval = null;
try {
Connection con = map.getConnection ();
String q = new StringBuffer("SELECT ")
.append(map.getIDgen())
.append(".nextval FROM dual")
.toString();
String q = "SELECT "+map.getIDgen()+".nextval FROM dual";
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery (q);
if (!rs.next ())
@ -690,28 +677,15 @@ public final class NodeManager {
Statement stmt = null;
try {
String q = null;
if (home.getSubnodeRelation() != null) {
// subnode relation was explicitly set
q = new StringBuffer("SELECT ")
.append(idfield)
.append(" FROM ")
.append(table)
.append(" ")
.append(home.getSubnodeRelation())
.toString();
q = "SELECT "+idfield+" FROM "+table+" "+home.getSubnodeRelation();
} else {
// let relation object build the query
q = new StringBuffer("SELECT ")
.append(idfield)
.append(" FROM ")
.append(table)
.append(rel.buildQuery (home,
home.getNonVirtualParent (), null,
" WHERE ", true))
.toString();
q = "SELECT "+idfield+" FROM "+table + rel.buildQuery (home, home.getNonVirtualParent (), null, " WHERE ", true);
}
if (logSql)
@ -721,7 +695,7 @@ public final class NodeManager {
if (rel.maxSize > 0)
stmt.setMaxRows (rel.maxSize);
ResultSet result = stmt.executeQuery (q);
// problem: how do we derive a SyntheticKey from a not-yet-persistent Node?
Key k = rel.groupby != null ? home.getKey (): null;
while (result.next ()) {
@ -732,8 +706,8 @@ public final class NodeManager {
continue;
// make the proper key for the object, either a generic DB key or a groupby key
Key key = rel.groupby == null ?
(Key) new DbKey (rel.otherType, kstr) :
(Key) new SyntheticKey (k, kstr);
(Key) new DbKey (rel.otherType, kstr) :
(Key) new SyntheticKey (k, kstr);
retval.add (new NodeHandle (key));
// if these are groupby nodes, evict nullNode keys
if (rel.groupby != null) {
@ -776,7 +750,7 @@ public final class NodeManager {
Connection con = dbm.getConnection ();
Statement stmt = con.createStatement ();
DbColumn[] columns = dbm.getColumns ();
String[] columns = dbm.getColumns ();
StringBuffer q = dbm.getSelect ();
try {
if (home.getSubnodeRelation() != null) {
@ -834,7 +808,7 @@ public final class NodeManager {
if (missing > 0) {
Connection con = dbm.getConnection ();
Statement stmt = con.createStatement ();
DbColumn[] columns = dbm.getColumns ();
String[] columns = dbm.getColumns ();
StringBuffer q = dbm.getSelect ();
try {
String idfield = rel.groupby != null ? rel.groupby : dbm.getIDField ();
@ -861,10 +835,8 @@ public final class NodeManager {
q.append (") ");
if (rel.groupby != null) {
q.append (rel.renderConstraints (home, home.getNonVirtualParent ()));
if (rel.order != null) {
q.append (" ORDER BY ");
q.append (rel.order);
}
if (rel.order != null)
q.append (" ORDER BY "+rel.order);
}
if (logSql)
@ -965,27 +937,19 @@ public final class NodeManager {
Statement stmt = null;
try {
String q = null;
if (home.getSubnodeRelation() != null) {
// use the manually set subnoderelation of the home node
q = new StringBuffer("SELECT count(*) FROM ")
.append(table)
.append(" ")
.append(home.getSubnodeRelation())
.toString();
q = "SELECT count(*) FROM "+table+" "+home.getSubnodeRelation();
} else {
// let relation object build the query
q = new StringBuffer("SELECT count(*) FROM ")
.append(table)
.append(rel.buildQuery (home, home.getNonVirtualParent(),
null, " WHERE ", false))
.toString();
q = "SELECT count(*) FROM "+table + rel.buildQuery (home, home.getNonVirtualParent (), null, " WHERE ", false);
}
if (logSql)
app.logEvent ("### countNodes: "+q);
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery (q);
@ -1026,13 +990,7 @@ public final class NodeManager {
Statement stmt = null;
try {
String q = new StringBuffer("SELECT ")
.append(namefield)
.append(" FROM ")
.append(table)
.append(" ORDER BY ")
.append(namefield)
.toString();
String q = "SELECT "+namefield+" FROM "+table+" ORDER BY "+namefield;
stmt = con.createStatement ();
if (logSql)
@ -1079,7 +1037,7 @@ public final class NodeManager {
Connection con = dbm.getConnection ();
stmt = con.createStatement ();
DbColumn[] columns = dbm.getColumns ();
String[] columns = dbm.getColumns ();
StringBuffer q = dbm.getSelect ();
q.append ("WHERE ");
q.append (idfield);
@ -1141,7 +1099,7 @@ public final class NodeManager {
DbMapping dbm = rel.otherType;
Connection con = dbm.getConnection ();
DbColumn[] columns = dbm.getColumns ();
String[] columns = dbm.getColumns ();
StringBuffer q = dbm.getSelect ();
if (home.getSubnodeRelation () != null) {
// combine our key with the constraints in the manually set subnode relation
@ -1186,7 +1144,7 @@ public final class NodeManager {
}
/**
* Get a DbMapping for a given prototype name. This is just a proxy
* Get a DbMapping for a given prototype name. This is just a proxy
* method to the app's getDbMapping() method.
*/
public DbMapping getDbMapping (String protoname) {

View file

@ -25,7 +25,7 @@ import FESI.Exceptions.*;
/**
* 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
Application app;
@ -80,7 +80,8 @@ public class FesiEngine implements ScriptingEngine {
wrappercache = new CacheMap (200, .75f);
prototypes = new Hashtable ();
try {
evaluator = new Evaluator(this);
evaluator = new Evaluator();
evaluator.engine = this;
global = evaluator.getGlobalObject();
for (int i=0; i<extensions.length; i++)
evaluator.addExtension (extensions[i]);
@ -752,13 +753,6 @@ public class FesiEngine implements ScriptingEngine {
wrappercache.put (n, esn);
}
/**
* Return the application's classloader
*/
public ClassLoader getClassLoader () {
return app.getClassLoader ();
}
/**
* Return the RequestEvaluator owning and driving this FESI evaluator.
*/

View file

@ -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);
}
}