diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 3d51f7d0..00000000 --- a/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# EditorConfig is awesome: https://EditorConfig.org - -root = true - -[*] -end_of_line = lf -indent_size = 2 -indent_style = spaces -insert_final_newline = true -trim_trailing_whitespace = true - -[*.java] -indent_size = 4 - -[*.md] -trim_trailing_whitespace = false diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 4e5f4943..00000000 --- a/.eslintrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "eslint:recommended", - "env": { - "es6": true, - "commonjs": true - }, - "globals": { - "app": "readonly", - "HopObject": "readonly", - "java": "readonly", - "Packages": "readonly", - "req": "readonly", - "res": "readonly" - } -} diff --git a/.github/actions/ssh/action.yml b/.github/actions/ssh/action.yml deleted file mode 100644 index 5c4886ab..00000000 --- a/.github/actions/ssh/action.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: SSH setup -description: Set up the SSH agent - -inputs: - config: - description: The SSH configuration - required: true - key: - description: The private SSH key - required: true - known-hosts: - description: The list of known hosts - required: true - -runs: - using: composite - - steps: - - name: Configure SSH - shell: sh - env: - CONFIG: ${{ inputs.config }} - KNOWN_HOSTS: ${{ inputs.known-hosts }} - run: | - mkdir -p ~/.ssh - echo "${CONFIG}" > ~/.ssh/config - echo "${KNOWN_HOSTS}" > ~/.ssh/known_hosts - - - name: Start SSH agent - shell: bash - env: - SOCKET: /tmp/ssh-agent.sock - run: | - echo "SSH_AUTH_SOCK=${SOCKET}" >> $GITHUB_ENV - ssh-agent -a ${SOCKET} > /dev/null - - - name: Add SSH key - shell: bash - env: - KEY: ${{ inputs.key }} - run: | - ssh-add - <<< "${KEY}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 69bcdeab..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Build - -on: - push: - paths: - - .github/workflows/build.yml - - build.gradle - - settings.gradle - - src/** - - launcher/build.gradle - - launcher/src/** - workflow_dispatch: - -jobs: - build: - runs-on: antville - - steps: - - uses: actions/checkout@v4 - - - name: Compile with Gradle - run: ./gradlew :compileJava diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 9eeb14b0..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Deploy - -on: - workflow_dispatch: - inputs: - hostname: - description: Hostname - type: string - required: true - default: antville.org - -jobs: - stage: - runs-on: antville - - environment: - name: production - url: ${{ inputs.hostname }} - - steps: - - uses: actions/checkout@v4 - - - name: Build with Gradle - run: ./gradlew installDist - - - name: Copy build files to server - run: | - rsync ./build/install/helma/ ${{ inputs.hostname }}:./ \ - --verbose --archive --delete --compress \ - --filter '+ /bin' \ - --filter '+ /extras' \ - --filter '+ /launcher.jar' \ - --filter '- /lib/ext' \ - --filter '+ /lib' \ - --filter '+ /modules' \ - --filter '- /*' - - - name: Restart Helma - run: ssh ${{ inputs.hostname }} restart diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ac8a3d1a..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Release - -on: - workflow_dispatch: - push: - tags: '2*' - -permissions: - contents: write - -jobs: - release: - runs-on: antville - - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - LC_TIME: en_US.UTF-8 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Create release notes - id: create_release_notes - run: | - release_notes=$(npx git-cliff@latest --latest) - # Write the release notes as a heredoc to the workflow output - # ⚠️ No white space around `<<` is crucial! - echo "release_notes<<.eot0x03" >> $GITHUB_OUTPUT - echo "$release_notes" >> $GITHUB_OUTPUT - echo ".eot0x03" >> $GITHUB_OUTPUT - - - name: Build with Gradle - run: ./gradlew assembleDist - - - name: Create release - uses: actions/forgejo-release@v2 - with: - direction: upload - url: https://code.host.antville.org - token: ${{ github.token }} - title: Helma ${{ github.ref_name }} - release-dir: build/distributions - release-notes: ${{ steps.create_release_notes.outputs.release_notes }} - verbose: true - - - name: Create release at GitHub - run: | - gh release create "$GITHUB_REF_NAME" \ - --repo "$GITHUB_REPOSITORY" \ - --title "Helma ${{ github.ref_name }}" \ - --notes "${{ steps.create_release_notes.outputs.release_notes }}" - - - name: Upload release assets to GitHub - run: | - gh release upload "$GITHUB_REF_NAME" build/distributions/helma-*.* \ - --repo "$GITHUB_REPOSITORY" \ - --clobber diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml deleted file mode 100644 index e470128c..00000000 --- a/.github/workflows/renovate.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Run Renovate - -on: - schedule: - - cron: "13 * * * *" - workflow_dispatch: - -jobs: - renovate: - runs-on: antville - - steps: - - uses: actions/checkout@v4 - - - name: Run Renovate - # See - # debug | info | warn | error | fatal - run: LOG_LEVEL=info npx renovate - env: - # Renovate is using this token to retrieve release notes - GITHUB_COM_TOKEN: ${{ secrets.renovate_github_com_token }} - # Autodiscover is better suited for an extra repo running Renovate on all desired repos - #RENOVATE_AUTODISCOVER: 'true' - RENOVATE_CONFIG_FILE: renovate.json - RENOVATE_ENDPOINT: ${{ github.api_url }} - RENOVATE_GIT_AUTHOR: Renovate Bot - #RENOVATE_GIT_IGNORED_AUTHORS: - # - 29139614+renovate[bot]@users.noreply.github.com - RENOVATE_IGNORE_PR_AUTHOR: 'true' - RENOVATE_LOG_FILE: renovate-log.ndjson - RENOVATE_LOG_FILE_LEVEL: debug - RENOVATE_PLATFORM: gitea - RENOVATE_REPOSITORIES: ${{ github.repository }} - RENOVATE_REPOSITORY_CACHE: 'enabled' - # github.token is not working here, it lacks some permissions required by Renovate - RENOVATE_TOKEN: ${{ secrets.renovate_token }} - - - name: Save log file - # FIXME: v4 of this action causes an error on Forgejo (“You must configure a GitHub token”) - uses: actions/upload-artifact@v3 - if: always() - with: - name: renovate-log.ndjson - path: renovate-log.ndjson diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7bf7bcbc..00000000 --- a/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -# Generally ignore hidden files -.* - -# Manage some Codium configuration -.vscode/* -!.vscode -!.vscode/extensions.json -!.vscode/launch.json -!.vscode/settings.json -!.vscode/tasks.json - -# Ignore files created during build or run -/bin -/backups -build -/docs -/lib -/licenses -/log - -# Ignore files managed in src/dist -/*.properties -/apps -/db -/extras -/launcher.jar -/static - -# Manage Gradle configuration -!/gradle.properties diff --git a/.java-version b/.java-version deleted file mode 100644 index 98d9bcb7..00000000 --- a/.java-version +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index c52f6863..00000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "recommendations": [ - "vscjava.vscode-java-pack", - "vscjava.vscode-gradle" - ] -} diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index b9116072..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "Current File", - "request": "launch", - "mainClass": "${file}" - }, - { - "type": "java", - "name": "Debug", - "request": "launch", - "mainClass": "helma.main.Server", - "projectName": "helma_" - } - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 83708e5d..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "files.watcherExclude": { - "apps/": true - }, - "java.configuration.updateBuildConfiguration": "automatic" -} diff --git a/CHANGES.md b/CHANGES.md deleted file mode 100644 index 5527d072..00000000 --- a/CHANGES.md +++ /dev/null @@ -1,31 +0,0 @@ -# Change Log - -## May 17, 2020 - -* Added support for colored log output -* Added xgettext and po2js tasks (only running with Antville right now) - -## April 13, 2020 - -* Added support for gzip compressed response in helma.Http -* Fixed helma.Http.getURL() not following redirects if protocol changes (e.g. http → https) -* Fixed references to obsolete Base64 encoder in modules -* Updated JavaMail library to implementation package - -## March 21, 2020 - -* Completely rewrote build system with Gradle -* Separated launcher from main source as Gradle subproject -* Launcher now includes all JARs found in `lib` -* Upgraded Rhino to version 1.7.12 -* Upgraded Jetty to version 9.x -* Fixed compatibility issues with Java 11 -* Removed support for Apache JServ Protocol (AJP) -* Added support for CommonJS require() method -* Allow variable arguments in res.write() and res.writeln() -* Replaced Helma’s MD5 and Base64 methods with equivalent methods from Apache Commons -* Refactored String methods from Java to JavaScript: encode(), encodeForm(), encodeXml(), stripTags() -* Replaced custom String methods with Rhino’s built-in ones: endsWith(), repeat(), startsWith(), trim() -* Refactored custom String.pad() method with built-in methods -* Redefined custom Array.contains() method with built-in Array.includes() -* Refactored custom Array methods with built-in methods: intersection(), union() diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 65dfb884..00000000 --- a/LICENSE.md +++ /dev/null @@ -1,37 +0,0 @@ -# License - -Copyright (c) 1999-2025 Helma Project. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - -3. Products derived from this software may not be called "Helma" - or "Hop", nor may "Helma" or "Hop" appear in their name, without - prior written permission of the Helma Project Group. For written - permission, please contact helma@helma.org. - -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE HELMA PROJECT OR ITS -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -Helma includes third party software released under different specific -license terms. See the licenses directory in the Helma distribution -for a list of these licenses. diff --git a/README.md b/README.md deleted file mode 100644 index f6438677..00000000 --- a/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# How to Helma - -## TL;DR - -- Make sure you have Java 17 or higher installed -- Download and unpack the [latest release](https://code.host.antville.org/antville/helma/releases) -- Invoke `./bin/helma`, resp. `./bin/helma.bat`, depending on your platform -- Direct your web browser to - -## Introduction - -Helma is an open source web application framework for fast and efficient scripting and serving of your websites and Internet applications. - -Helma is written in Java and employs JavaScript for its server-side scripting environment, removing the need for compilation cycles and reducing development costs while giving you instant access to leverage the whole wealth of Java libraries out there. - -Helma pioneered the simple and codeless mapping of application objects to database tables, which has only recently come into vogue with other web frameworks. In addition, an embedded object-oriented database performs automatic data persistence of unmapped objects. - -Helma has proven itself to be stable and fast, capable of serving high traffic sites with hundreds of thousands of dynamic pages per day. The Austrian Broadcasting Corporation, popular weblog hosting sites such as antville.org, twoday.net, and blogger.de, among many others, have successfully been deploying Helma for several years now. - -Although Helma became a Grande Dame of server-side JavaScript already decades ago when she performed in cozy Finnish clubs, she appears somehow retired nowadays. Nevertheless, she is here to stay for those last ones out there still tinkering with this nostalgic and wonderful piece of software. - -## System Requirements - -You need a Java virtual machine version 11 or higher to run Helma. - -Please consult the documentation of your platform how to obtain and install Java. - -You also can directly download a [Java runtime or development kit](https://www.oracle.com/java/technologies/javase-downloads.html#javasejdk) from Oracle. - -Helma is built with [Gradle](https://gradle.org), the build task depends on the binaries [rsync](https://rsync.samba.org) and [npx](https://www.npmjs.com/package/npx) being installed on your system. - -## Development - -### Additional Prerequisites - -* [Node.js](https://nodejs.org) LTS version -* [Rsync](https://rsync.samba.org) version ≥ 3.1.0 - -Clone this repository to your machine and run Helma with `./gradlew run`. - -To update the installation from a build, run `./gradlew update` and enter `yes` at the prompt. - -> ⚠️ -> Please be aware that this step is going to overwrite files in the installation directory – escpecially at a later time when there might be substantial changes. Should this happen by accident you find the previous installation in the `backups` directory. -> -> Alternatively, you could move or copy the desired files manually from the installation directory `build/install/helma`. - -After all files are put into place start Helma by invoking `./bin/helma.bat` or `./bin/helma`, depending on whether you are on Windows or Linux / Unix / OS X, respectively. If the `java` command is not found, try setting the `JAVA_HOME` environment variable to the location of your Java installation. - -You can adjust server-wide settings in the `server.properties` file. For example, you could set the `smtp` property to the name of the SMTP server that Helma should use to send e-mail. Applications can be started or stopped by editing the `apps.properties` file, or through the web interface using the management application that is part of Helma. - -If all goes well you should be able to connect your browser to – port 8080 on the local machine, that is. - -Helma comes with a version of [Jetty](http://eclipse.org/jetty/), a lightweight yet industrial strength web server. - -While Jetty works well for development and in fact deploying real web sites, you might want to run Helma with the web server you are already using. This is most easily done by proxying Helma. Please consult the documentation of your web server how to achieve this. - -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 a proxied setup. - -## Documentation and Further Information - -After installing and running Helma, you will be able to access introductions to the features of Helma and the various included development tools. Further information you will find on the helma.org website: - -> 😿 -> Unfortunately, the Helma website disappeard in the meantime. However, with some archaeological web digging and thanks to the great search engines and archive services out there it is still possible to find useful resources. - -- [helma.org at Internet Archive](http://web.archive.org/web/20180122132315/http://helma.org) -- [Documentation](http://web.archive.org/web/20100530234322/http://helma.org/documentation/) -- [API Reference](https://helma.serverjs.org/reference/) -- [Tutorial](http://web.archive.org/web/20100526182848/http://helma.org/Documentation/Object-Relational+Mapping+Tutorial/) -- [DocBook](http://dev.orf.at/download/helma/documentation/documentation.pdf) diff --git a/README.txt b/README.txt new file mode 100644 index 00000000..c84bde52 --- /dev/null +++ b/README.txt @@ -0,0 +1,93 @@ +This is the README file for version 1.2 of Helma Object Publisher. + +============================ +ABOUT HELMA OBJECT PUBLISHER +============================ + +Helma Object Publisher is a web application server. + +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. + + +=================== +SYSTEM REQUIREMENTS +=================== + +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. + +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). + +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. + + +============================ +INSTALLING AND RUNNING 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://127.0.0.1:8080/ (port 8080, that is). + +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. + +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, a documentation-in-progress is available online only. +Please refer to http://helma.org/docs/. + +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. + + + +-- + +This document was last modified on Friday 22 June 2001 by +tobi@helma.at \ No newline at end of file diff --git a/apps.properties b/apps.properties new file mode 100644 index 00000000..962ebe05 --- /dev/null +++ b/apps.properties @@ -0,0 +1,4 @@ +# List of apps to start. + +test + diff --git a/build.gradle b/build.gradle deleted file mode 100644 index cd60e214..00000000 --- a/build.gradle +++ /dev/null @@ -1,294 +0,0 @@ -plugins { - id 'application' - id 'com.github.jk1.dependency-license-report' version '2.9' -} - -import org.apache.tools.ant.filters.FixCrLfFilter - -def jettyLogLevel = '-Dorg.eclipse.jetty.LEVEL=WARN' - -// Suppress menu bar and default icon being shown in macos dock (Radar #5754483) -// See https://developer.apple.com/library/content/releasenotes/Java/JavaLeopardUpdate1RN/ResolvedIssues/ResolvedIssues.html -def suppressMacosDockIcon = '-Dapple.awt.UIElement=true' - -// This list is used to determine which files need processing of line endings -def textFiles = ['**/*.hac', '**/.html', '**/*.js', '**/*.md', '**/*.properties', '**/*.skin', '**/*.txt', '**/*.xml'] - -allprojects { - apply plugin: 'java' - - java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - repositories { - mavenCentral() - } -} - -version = new Date().format("yy.M.d") - -tasks.build.dependsOn javadoc, 'jsdoc', 'generateLicenseReport' -tasks.compileJava.dependsOn 'processSource' - -// Disable DocLint for now -// See -if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } -} - -configurations { - // Wrapping implementation because it does not allow access to its files - // (i.e. cannot be resolved) - library.extendsFrom implementation -} - -dependencies { - implementation 'com.google.code.gson:gson:2.12.1' - implementation 'commons-codec:commons-codec:1.18.0' - implementation 'org.apache.commons:commons-fileupload2-core:2.0.0-M2' - implementation 'org.apache.commons:commons-fileupload2-jakarta:2.0.0-M1' - implementation 'commons-logging:commons-logging:1.3.5' - implementation 'commons-net:commons-net:3.11.1' - implementation 'com.sun.mail:javax.mail:1.6.2' - implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0' - implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' - implementation 'org.eclipse.jetty.ee9:jetty-ee9-servlet:12.0.19' - implementation 'org.eclipse.jetty:jetty-xml:12.0.19' - implementation 'org.mozilla:rhino-all:1.8.0' - implementation 'org.sejda.imageio:webp-imageio:0.1.6' - implementation 'xerces:xercesImpl:2.12.2' - implementation 'xmlrpc:xmlrpc:2.0.1' -} - -def rhinoJar = configurations.library.files.find { jar -> - jar.name.startsWith('rhino') -} - -run { - jvmArgs jettyLogLevel, suppressMacosDockIcon - classpath += fileTree(dir: 'lib/ext', include: '*.jar') -} - -application { - mainClass = 'helma.main.Server' - - applicationDistribution.from(projectDir) { - include 'modules/**' - include 'LICENSE.md' - include 'README.md' - include 'start.*' - } - - applicationDistribution.from(javadoc.destinationDir) { - include '**' - into 'docs/javadoc' - } - - applicationDistribution.from("${project.buildDir}/docs/jsdoc") { - include '**' - into 'docs/jsdoc' - } - - applicationDistribution.from("${project.buildDir}/reports/dependency-license") { - include '**' - into 'licenses' - } -} - -startScripts { - applicationName = 'helma' - classpath = files('../launcher.jar') - mainClass = 'helma.main.launcher.Main' - - defaultJvmOpts = [jettyLogLevel, suppressMacosDockIcon] - - doLast { - // Work-around to make the classpath above work (launcher.jar is located outside of `lib` dir) - // See https://discuss.gradle.org/t/classpath-in-application-plugin-is-building-always-relative-to-app-home-lib-directory/2012 - def unixScriptFile = file getUnixScript() - def windowsScriptFile = file getWindowsScript() - unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib', '$APP_HOME') - windowsScriptFile.text = windowsScriptFile.text.replace('%APP_HOME%\\lib', '%APP_HOME%') - } -} - -distributions { - main { - contents { - from project(':launcher').jar - } - } -} - -distTar { - dependsOn ':generateLicenseReport', ':javadoc', ':jsdoc' - - compression = Compression.GZIP - - filesMatching(textFiles) { - filter(FixCrLfFilter.class, eol: FixCrLfFilter.CrLf.newInstance("lf")) - } -} - -distZip { - dependsOn ':generateLicenseReport', ':javadoc', ':jsdoc' - - filesMatching(textFiles) { - filter(FixCrLfFilter.class, eol: FixCrLfFilter.CrLf.newInstance("crlf")) - } -} - -installDist { - dependsOn build -} - -def processSource = tasks.register('processSource', Sync) { - def gitOutput = new ByteArrayOutputStream() - - outputs.dir "${project.buildDir}/src" - - exec { - commandLine 'git', 'rev-parse', '--short', 'HEAD' - standardOutput = gitOutput - errorOutput = new ByteArrayOutputStream() - ignoreExitValue = true - } - - from 'src' - - filter { - line -> line - .replaceAll('__builddate__', new Date().format("d MMM yyyy")) - .replaceAll('__commithash__', gitOutput.toString().trim()) - .replaceAll('__version__', version) - } into outputs.files.singleFile -} - -tasks.compileJava.source = processSource.map { it.outputs.files } - -tasks.register('update') { - dependsOn installDist - - def rsyncArgs = ['--archive', '--filter', '- backups'] - - def confirm = { - ant.input(message: 'Update this installation?', validargs: 'yes,no', addproperty: 'continue') - return ant.continue == 'yes' - } - - onlyIf { confirm() } - - doFirst { - def backupDir = 'backups/' + new Date().format('yyyyMMdd-HHmmss') - - mkdir backupDir - - exec { - // Create a backup with rsync instead of a CopyTask because the latter chokes on multi-byte characters - // See https://github.com/gradle/gradle/issues/789 - executable 'rsync' - args rsyncArgs - args "$projectDir/", backupDir - } - - print "Created backup of ${projectDir} in ${backupDir}" - } - - doLast { - exec { - // Using rsync to selectively update the repo directory - executable 'rsync' - args '--delete' - args rsyncArgs - args '--filter', '+ bin/***' - args '--filter', '+ docs/***' - args '--filter', '+ extras/***' - args '--filter', '+ launcher.jar' - args '--filter', '+ lib' - args '--filter', '+ *.jar' - args '--filter', '- *' - args "${installDist.destinationDir}/", projectDir - } - } -} - -tasks.register('jsdoc', Exec) { - description 'Generates JSDoc API documentation for the included JavaScript modules.' - group 'Documentation' - - def sources = ['modules/core', 'modules/helma', 'modules/jala/code'] - def destination = "${project.buildDir}/docs/jsdoc" - - sources.each { dir -> inputs.dir dir } - outputs.dir destination - - executable 'npx' - args = ['jsdoc', '-d', "$destination"].plus(sources) -} - -tasks.register('xgettext', JavaExec) { - description 'Extracts translatable message strings from source code.' - group 'i18n' - - classpath = files('launcher.jar') - mainClass = 'helma.main.launcher.Commandline' - - // TODO: Decouple from Antville app - args = [ - // Root.extractMessages is currently located in antville/code/Global/i18n.js - 'antville.extractMessages', - 'modules/jala/util/HopKit/scripts/MessageParser.js', - 'code compat', - 'apps/antville/i18n/antville.pot' - ] -} - -tasks.register('po2js', JavaExec) { - description 'Converts translated message strings from PO format to JavaScript.' - group 'i18n' - - classpath = files(rhinoJar) - mainClass = 'org.mozilla.javascript.tools.shell.Main' - - // TODO: Decouple from Antville app - args = [ - 'modules/jala/util/HopKit/scripts/PoParser.js', - 'apps/antville/i18n', - 'apps/antville/i18n' - ] -} - -tasks.register('rhinoShell', JavaExec) { - description 'Runs the interactive Rhino JavaScript shell.' - group 'Application' - - classpath = files(rhinoJar) - mainClass = 'org.mozilla.javascript.tools.shell.Main' - - standardInput = System.in -} - -// Call this task with a function definition using the `-P` parameter, e.g. -// `./gradlew commandLine -Pfunction=manage.getAllApplications` -tasks.register('commandLine', JavaExec) { - description 'Runs a function in a Helma application with `-Pfunction=app.functionName`.' - group 'Application' - - classpath = files('launcher.jar') - mainClass = 'helma.main.launcher.Commandline' - args '-h', projectDir, function -} - -tasks.register('debug', JavaExec) { - group = 'application' - main = 'helma.main.Server' - classpath = sourceSets.main.runtimeClasspath - jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'] - classpath += fileTree(dir: 'lib/ext', include: '*.jar') -} diff --git a/build/README b/build/README new file mode 100644 index 00000000..8f0dc893 --- /dev/null +++ b/build/README @@ -0,0 +1,93 @@ +This is the README file for the Helma build files as part of the Helma Object Publisher. It is included in the current distribution (version 1.2pre as of 8 November 2001) downloadable at . + + + +The build directory consists of the following files: + + ant.jar + build.bat + build.sh + build.xml + crimson.jar + jaxp.jar + README + + +PREREQUISITES +============= + +The Helma build script is using a software called Ant. Ant is a build system that was developed for the Jakarta Tomcat project. For more information about Ant, see . + +To run Ant, you also need JDK 1.3 or higher . + +For checking out the source files from Helma's CVS you also need a local installation of a CVS command-line client. More information about CVS at . + + +STARTING BUILD +============== + +The build system is started by invoking the shell script appropriate to your platform, ie. build.sh for *nix (Linux, NetBSD etc.) and build.bat for Windows systems. You need to modify the script and set the JAVA_HOME to fit your system. + +The generic syntax is + + ./build target + +The parameter "target" specifies one of the following build targets. + + +BUILD A SNAPSHOT +================ + +To build a helma.jar with the most up-to-date version of helma yourself you need to run + +./build checkout + +and + +./build snapshot + + +BUILD TARGETS +============= + +checkout + Fetches (or updates, resp.) the Helma source code in the src/-directory from the CVS. If you've still got the sourcecode that came with the distribution in there, you need to move that away first. + +snapshot + Runs snapshotcompile and stuffs the class files as .jar archive in the lib directory. The file is named helma-yyyymmdd.jar. + +snapshotcompile + Compiles the source files contained in the src/hop directory into the classes directory (which will be created if necessary). You can use the source files from your distribution or you can get the most recent version by checking out the "hop"-module from the cvs. + +fullcheckout + Fetches (or updates, resp.) everything that's needed to create a full Helma distribution (source files, build files, libs, demo-apps) from the CVS and copies them into the work/checkout/ directory (which will be created if necessary). + +compile + Compiles the source files contained in the work/checkout/hop/ directory into the work/classes/ directory (which will be created if necessary). + +jar + Stuffs the files in work/classes/ together and saves them as .jar archive in the work directory. The file is named helma-yyyymmdd.jar. + +javadocs + Creates the Java API documentation for the Helma classes. The resulting files are saved into the work/docs/api/ directory (which will be created if necessary). + +helmadocs + Gets the documentation from helma.org via http in a printable version. (still some way to go..) + +package + Builds all previous targets (checkout, compile, jar, javadoc) and saves the created files in the directory work/helma-1.x/ (with 1.x being the version number). All directories will be created if necessary. + +package-zip + Same as "package". Additionally, the files in the output directory will be compressed as .zip file. + +package-tgz + Same as "package". Additionall, the file in the output directory will be compressed as .tar.gz file. + +package-all + Builds all previous targets. The result is a complete and up-to-date (as in the CVS) installation of Helma, the API documentation, source and build files as well as compressed packages for *nix and Windows systems including all the files. + + +-- + +This README was last updated on 26 April 2002. Questions? tobi@helma.org + diff --git a/build/ant.jar b/build/ant.jar new file mode 100644 index 00000000..ba757dfc Binary files /dev/null and b/build/ant.jar differ diff --git a/build/antclick/README.txt b/build/antclick/README.txt new file mode 100644 index 00000000..86372298 --- /dev/null +++ b/build/antclick/README.txt @@ -0,0 +1,121 @@ +============== +ABOUT ANTCLICK +============== + +Antclick is an integrated Helma/Antville package. It comes with +integrated web server and SQL database. It should run out of the +box although you may have to modify the start script. + +This version of Antclick contains Mckoi as the embedded database +and Jetty as the embedded web server. + +Although Antcklick comes preconfigured with the Mckoi database, it +can easily be set up to run with other databases such as MySQL and +Oracle. It is also possible to configure it to use a fully featured +web server instead of the built-in web server. + + +====================== +INSTALLING AND RUNNING +====================== + +Simply uncompress the content of the archive file into any place on +your hard disk. Start Helma on Windows by opening the file hop.bat. +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 +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 +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 +with a relational database in the backend. + +============================ +ABOUT HELMA OBJECT PUBLISHER +============================ + +Helma Object Publisher is a web application server. + +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. + + +=================== +SYSTEM REQUIREMENTS +=================== + +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. + + +============================ +INSTALLING AND RUNNING 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://127.0.0.1:8080/ (port 8080, that is). + +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. + +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, a documentation-in-progress is available online only. +Please refer to http://helma.org/. + +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. + + + +-- + +This document was last modified on Friday 25 October 2002 by +hannes@helma.at diff --git a/build/antclick/apps.properties b/build/antclick/apps.properties new file mode 100644 index 00000000..8e93c8f9 --- /dev/null +++ b/build/antclick/apps.properties @@ -0,0 +1,10 @@ +# List of apps to start. + +# mount antville as /managehop to avoid +# conflict with antville's manage.hac action +manage +manage.mountpoint = /manage/hop + +# mount antville as root application +antville +antville.mountpoint = / diff --git a/build/antclick/apps/antville/db.properties b/build/antclick/apps/antville/db.properties new file mode 100644 index 00000000..a8df91c1 --- /dev/null +++ b/build/antclick/apps/antville/db.properties @@ -0,0 +1,5 @@ +# Properties of antville datasource +antville.url=jdbc:mckoi:local://./db.conf +antville.driver=com.mckoi.JDBCDriver +antville.user=admin +antville.password=entwil diff --git a/build/antclick/data/030SYS_INFO_sUSRPKeyInfo.koi b/build/antclick/data/030SYS_INFO_sUSRPKeyInfo.koi new file mode 100644 index 00000000..61ea401d Binary files /dev/null and b/build/antclick/data/030SYS_INFO_sUSRPKeyInfo.koi differ diff --git a/build/antclick/data/031SYS_INFO_sUSRFKeyInfo.koi b/build/antclick/data/031SYS_INFO_sUSRFKeyInfo.koi new file mode 100644 index 00000000..91fb5ab5 Binary files /dev/null and b/build/antclick/data/031SYS_INFO_sUSRFKeyInfo.koi differ diff --git a/build/antclick/data/032SYS_INFO_sUSRUniqueInfo.koi b/build/antclick/data/032SYS_INFO_sUSRUniqueInfo.koi new file mode 100644 index 00000000..34e01b90 Binary files /dev/null and b/build/antclick/data/032SYS_INFO_sUSRUniqueInfo.koi differ diff --git a/build/antclick/data/033SYS_INFO_sUSRCheckInfo.koi b/build/antclick/data/033SYS_INFO_sUSRCheckInfo.koi new file mode 100644 index 00000000..543a1732 Binary files /dev/null and b/build/antclick/data/033SYS_INFO_sUSRCheckInfo.koi differ diff --git a/build/antclick/data/034SYS_INFO_sUSRPrimaryColumns.koi b/build/antclick/data/034SYS_INFO_sUSRPrimaryColumns.koi new file mode 100644 index 00000000..c9c3bc78 Binary files /dev/null and b/build/antclick/data/034SYS_INFO_sUSRPrimaryColumns.koi differ diff --git a/build/antclick/data/035SYS_INFO_sUSRUniqueColumns.koi b/build/antclick/data/035SYS_INFO_sUSRUniqueColumns.koi new file mode 100644 index 00000000..f0fd85f4 Binary files /dev/null and b/build/antclick/data/035SYS_INFO_sUSRUniqueColumns.koi differ diff --git a/build/antclick/data/036SYS_INFO_sUSRForeignColumns.koi b/build/antclick/data/036SYS_INFO_sUSRForeignColumns.koi new file mode 100644 index 00000000..012a4fb4 Binary files /dev/null and b/build/antclick/data/036SYS_INFO_sUSRForeignColumns.koi differ diff --git a/build/antclick/data/037SYS_INFO_sUSRSchemaInfo.koi b/build/antclick/data/037SYS_INFO_sUSRSchemaInfo.koi new file mode 100644 index 00000000..f947a15b Binary files /dev/null and b/build/antclick/data/037SYS_INFO_sUSRSchemaInfo.koi differ diff --git a/build/antclick/data/038SYS_INFO_sUSRDatabaseVars.koi b/build/antclick/data/038SYS_INFO_sUSRDatabaseVars.koi new file mode 100644 index 00000000..4df76be6 Binary files /dev/null and b/build/antclick/data/038SYS_INFO_sUSRDatabaseVars.koi differ diff --git a/build/antclick/data/039SYS_INFO_sUSRPassword.koi b/build/antclick/data/039SYS_INFO_sUSRPassword.koi new file mode 100644 index 00000000..e6913bf3 Binary files /dev/null and b/build/antclick/data/039SYS_INFO_sUSRPassword.koi differ diff --git a/build/antclick/data/040SYS_INFO_sUSRUserPriv.koi b/build/antclick/data/040SYS_INFO_sUSRUserPriv.koi new file mode 100644 index 00000000..c7070647 Binary files /dev/null and b/build/antclick/data/040SYS_INFO_sUSRUserPriv.koi differ diff --git a/build/antclick/data/041SYS_INFO_sUSRUserConnectPriv.koi b/build/antclick/data/041SYS_INFO_sUSRUserConnectPriv.koi new file mode 100644 index 00000000..7db5798c Binary files /dev/null and b/build/antclick/data/041SYS_INFO_sUSRUserConnectPriv.koi differ diff --git a/build/antclick/data/042SYS_INFO_sUSRGrant.koi b/build/antclick/data/042SYS_INFO_sUSRGrant.koi new file mode 100644 index 00000000..6cda17f3 Binary files /dev/null and b/build/antclick/data/042SYS_INFO_sUSRGrant.koi differ diff --git a/build/antclick/data/043SYS_INFO_sUSRService.koi b/build/antclick/data/043SYS_INFO_sUSRService.koi new file mode 100644 index 00000000..c0b2d938 Binary files /dev/null and b/build/antclick/data/043SYS_INFO_sUSRService.koi differ diff --git a/build/antclick/data/044SYS_INFO_sUSRFunctionFactory.koi b/build/antclick/data/044SYS_INFO_sUSRFunctionFactory.koi new file mode 100644 index 00000000..217a1457 Binary files /dev/null and b/build/antclick/data/044SYS_INFO_sUSRFunctionFactory.koi differ diff --git a/build/antclick/data/045SYS_INFO_sUSRFunction.koi b/build/antclick/data/045SYS_INFO_sUSRFunction.koi new file mode 100644 index 00000000..1c3c4c6c Binary files /dev/null and b/build/antclick/data/045SYS_INFO_sUSRFunction.koi differ diff --git a/build/antclick/data/046SYS_INFO_sUSRView.koi b/build/antclick/data/046SYS_INFO_sUSRView.koi new file mode 100644 index 00000000..46407714 Binary files /dev/null and b/build/antclick/data/046SYS_INFO_sUSRView.koi differ diff --git a/build/antclick/data/047SYS_INFO_sUSRLabel.koi b/build/antclick/data/047SYS_INFO_sUSRLabel.koi new file mode 100644 index 00000000..6eaa3a7b Binary files /dev/null and b/build/antclick/data/047SYS_INFO_sUSRLabel.koi differ diff --git a/build/antclick/data/048APP_AV_ACCESSLOG.koi b/build/antclick/data/048APP_AV_ACCESSLOG.koi new file mode 100644 index 00000000..4cd25df2 Binary files /dev/null and b/build/antclick/data/048APP_AV_ACCESSLOG.koi differ diff --git a/build/antclick/data/049APP_AV_CHOICE.koi b/build/antclick/data/049APP_AV_CHOICE.koi new file mode 100644 index 00000000..b9951a30 Binary files /dev/null and b/build/antclick/data/049APP_AV_CHOICE.koi differ diff --git a/build/antclick/data/050APP_AV_FILE.koi b/build/antclick/data/050APP_AV_FILE.koi new file mode 100644 index 00000000..05a0ae93 Binary files /dev/null and b/build/antclick/data/050APP_AV_FILE.koi differ diff --git a/build/antclick/data/051APP_AV_IMAGE.koi b/build/antclick/data/051APP_AV_IMAGE.koi new file mode 100644 index 00000000..93a65fea Binary files /dev/null and b/build/antclick/data/051APP_AV_IMAGE.koi differ diff --git a/build/antclick/data/052APP_AV_MEMBERSHIP.koi b/build/antclick/data/052APP_AV_MEMBERSHIP.koi new file mode 100644 index 00000000..86ddd807 Binary files /dev/null and b/build/antclick/data/052APP_AV_MEMBERSHIP.koi differ diff --git a/build/antclick/data/053APP_AV_POLL.koi b/build/antclick/data/053APP_AV_POLL.koi new file mode 100644 index 00000000..309a0697 Binary files /dev/null and b/build/antclick/data/053APP_AV_POLL.koi differ diff --git a/build/antclick/data/054APP_AV_SKIN.koi b/build/antclick/data/054APP_AV_SKIN.koi new file mode 100644 index 00000000..6625eb8c Binary files /dev/null and b/build/antclick/data/054APP_AV_SKIN.koi differ diff --git a/build/antclick/data/055APP_AV_SYSLOG.koi b/build/antclick/data/055APP_AV_SYSLOG.koi new file mode 100644 index 00000000..38136209 Binary files /dev/null and b/build/antclick/data/055APP_AV_SYSLOG.koi differ diff --git a/build/antclick/data/056APP_AV_TEXT.koi b/build/antclick/data/056APP_AV_TEXT.koi new file mode 100644 index 00000000..f469ec8a Binary files /dev/null and b/build/antclick/data/056APP_AV_TEXT.koi differ diff --git a/build/antclick/data/058APP_AV_VOTE.koi b/build/antclick/data/058APP_AV_VOTE.koi new file mode 100644 index 00000000..bd032dca Binary files /dev/null and b/build/antclick/data/058APP_AV_VOTE.koi differ diff --git a/build/antclick/data/059APP_AV_SITE.koi b/build/antclick/data/059APP_AV_SITE.koi new file mode 100644 index 00000000..c7dcc6b1 Binary files /dev/null and b/build/antclick/data/059APP_AV_SITE.koi differ diff --git a/build/antclick/data/060APP_AV_USER.koi b/build/antclick/data/060APP_AV_USER.koi new file mode 100644 index 00000000..7341ba53 Binary files /dev/null and b/build/antclick/data/060APP_AV_USER.koi differ diff --git a/build/antclick/data/061APP_AV_SHORTCUT.koi b/build/antclick/data/061APP_AV_SHORTCUT.koi new file mode 100644 index 00000000..45f2cf57 Binary files /dev/null and b/build/antclick/data/061APP_AV_SHORTCUT.koi differ diff --git a/build/antclick/data/DefaultDatabase.sf b/build/antclick/data/DefaultDatabase.sf new file mode 100644 index 00000000..4ad38cdc Binary files /dev/null and b/build/antclick/data/DefaultDatabase.sf differ diff --git a/build/antclick/db.conf b/build/antclick/db.conf new file mode 100644 index 00000000..89530f62 --- /dev/null +++ b/build/antclick/db.conf @@ -0,0 +1,318 @@ + +####################################################### +# +# Configuration options for the Mckoi SQL Database. +# +# NOTE: Lines starting with '#' are comments. +# +####################################################### + +# +# database_path - The path where the database data files +# are located. +# See the 'root_path' configuration property for the +# details of how the engine resolves this to an +# absolute path in your file system. + +database_path=./data + +# +# log_path - The path the log files are written. +# See the 'root_path' configuration property for the +# details of how the engine resolves this to an +# absolute path in your file system. +# The log path must point to a writable directory. If +# no log files are to be kept, then comment out (or +# remove) the 'log_path' variable. + +log_path=./log + +# +# root_path - If this is set to 'jvm' then the root +# path of all database files is the root path of the +# JVM (Java virtual machine) running the database +# engine. If this property is set to 'configuration' +# or if it is not present then the root path is the +# path of this configuration file. +# This property is useful if you are deploying a +# database and need this configuration file to be the +# root of the directory tree of the database files. + +root_path=configuration +#root_path=jvm + +# +# jdbc_server_port - The TCP/IP port on this host where +# the database server is mounted. The default port +# of the Mckoi SQL Database server is '9157' + +jdbc_server_port=9157 + +# +# ignore_case_for_identifiers - If enabled all +# identifiers are compared case insensitive. If +# disabled (the default) the case of the identifier +# is important. +# For example, if a table called 'MyTable' contains +# a column called 'my_column' and this property is +# enabled, the identifier 'MYTAble.MY_COlumN' will +# correctly reference the column of the table. If +# this property is disable a not found error is +# generated. +# This property is intended for compatibility with +# other database managements systems where the case +# of identifiers is not important. + +ignore_case_for_identifiers=disabled + +# +# socket_polling_frequency - Mckoi SQL maintains a pool +# of connections on the server to manage dispatching +# of commands to worker threads. All connections on +# the jdbc port are polled frequently, and ping +# requests are sent to determine if the TCP +# connection has closed or not. This value determines +# how frequently the connections are polled via the +# 'available' method. +# The value is the number of milliseconds between each +# poll of the 'available' method of the connections +# input socket stream. Different Java implementations +# will undoubtedly require this value to be tweaked. +# A value of '3' works great on the Sun NT Java 1.2.2 +# and 1.3 Java runtimes. +# +# NOTE: This 'socket polling' module is a horrible hack +# and will be removed at some point when the threading +# performance improves or there is an API for non- +# blocking IO. I'll probably write an alternative +# version for use with the improved Java version. + +socket_polling_frequency=3 + + + +# ----- PLUG-INS ----- + +# +# database_services - The services (as a Java class) that +# are registered at database boot time. Each service +# class is separated by a semi-colon (;) character. +# A database service must extend +# com.mckoi.database.ServerService +# +#database_services=mypackage.MyService + +# +# function_factories - Registers one or more FunctionFactory +# classes with the database at boot time. A +# FunctionFactory allows user-defined functions to be +# incorporated into the SQL language. Each factory class +# is separated by a semi-colon (;) character. +# +#function_factories=mypackage.MyFunctionFactory + +# +# The Java regular expression library to use. Currently +# the engine supports the Apache Jakarta regular expression +# library, and the GNU LGPL regular expression library. +# These two regular expression libraries can be found at the +# following web sites: +# +# GNU Regexp: http://www.cacas.org/~wes/java/ +# Apache Regexp: http://jakarta.apache.org/regexp/ +# +# The libraries provide similar functionality, however they +# are released under a different license. The GNU library +# is released under the LGPL and is compatible with GPL +# distributions of the database. The Apache Jakarta library +# is released under the Apache Software License and must not +# be linked into GPL distributions. +# +# Use 'regex_library=gnu.regexp' to use the GNU library, or +# 'regex_library=org.apache.regexp' to use the Apache +# library. +# +# NOTE: To use either library, you must include the +# respective .jar package in the Java classpath. + +regex_library=gnu.regexp + + + + +# ----- PERFORMANCE ----- + +# +# data_cache_size - The maximum amount of memory (in bytes) +# to allow the memory cache to grow to. If this is set +# to a value < 4096 then the internal cache is disabled. +# It is recommended that a database server should provide +# a cache of 4 Megabytes (4194304). A stand alone +# database need not have such a large cache. + +# data_cache_size=4194304 +data_cache_size=0 + +# +# max_cache_entry_size - The maximum size of an element +# in the data cache. This is available for tuning +# reasons and the value here is dependant on the type +# of data being stored. If your data has more larger +# fields that would benefit from being stored in the +# cache then increase this value from its default of +# 8192 (8k). + +max_cache_entry_size=8192 + +# +# lookup_comparison_list - When this is set to 'enabled' +# the database attempts to optimize sorting by generating +# an internal lookup table that enables the database to +# quickly calculate the order of a column without having +# to look at the data directly. The column lookup +# tables are only generated under certain query +# conditions. Set this to 'disabled' if the memory +# resources are slim. + +lookup_comparison_list=enabled + +# +# lookup_comparison_cache_size - The maximum amount of +# memory (in bytes) to allow for column lookup tables. +# If the maximum amount of memory is reached, the lookup +# table is either cached to disk so that is may be +# reloaded later if necessary, or removed from memory +# entirely. The decision is based on how long ago the +# table was last used. +# +# This property only makes sense if the +# 'lookup_comparison_list' property is enabled. +# +# NOTE: This property does nothing yet... + +lookup_comparison_cache_size=2097152 + +# +# index_cache_size - The maximum amount of memory (in +# bytes) to allow for the storage of column indices. +# If the number of column indices in memory reaches +# this memory threshold then the index blocks are +# cached to disk. +# +# ISSUE: This is really an implementation of internal +# memory page caching but in Java. Is it necessary? +# Why not let the OS handle it with its page file? +# +# NOTE: This property does nothing yet... + +index_cache_size=2097152 + +# +# max_worker_threads - The maximum number of worker +# threads that can be spawned to handle incoming +# requests. The higher this number, the more +# 'multi-threaded' the database becomes. The +# default setting is '4'. + +maximum_worker_threads=4 + +# +# soft_index_storage - If this is set to 'enabled', the +# database engine will keep all column indices behind a +# soft reference. This enables the JVM garbage collector +# to reclaim memory used by the indexing system if the +# memory is needed. +# +# This is useful for an embedded database where requests +# are rare. When the database part is idle, the index +# memory (that can take up significant space for large +# tables) is reclaimed for other uses. For a dedicated +# database server it is recommended this is disabled. +# +# Enable this if you need the engine to use less memory. +# I would recommend the config property +# 'lookup_comparison_list' is disabled if this is enabled. +# The default setting is 'disabled'. + +soft_index_storage=disabled + +# +# dont_synch_filesystem - If this is enabled, the engine +# will not synchronize the file handle when a table change +# is committed. This will mean the data is not as +# safe but the 'commit' command will work faster. If this +# is enabled, there is a chance that committed changes will +# not get a chance to flush to the file system if the +# system crashes. +# +# It is recommended this property is left commented out. +# +#dont_synch_filesystem=enabled + +# +# transaction_error_on_dirty_select - If this is disabled +# the 4th conflict (dirty read on modified table) will +# not be detected. This has transactional consequences +# that will cause data modifications to sometimes be +# out of syncronization. For example, one transaction +# adds an entry, and another concurrent transaction +# deletes all entries. If this is disabled this +# conflict will not be detected. The table will end up +# with the one entry added after commit. +# +# It is recommended this property is left commented out. +# +#transaction_error_on_dirty_select=disabled + + + + + + +# ----- SPECIAL ----- + +# +# read_only - If this is set to 'enabled' then the database +# is readable and not writable. You may boot a database +# in read only mode from multiple VM's. If the database +# data files are stored on a read only medium such as a +# CD, then the property must be enabled else it will not +# be possible to boot the database. +# ( Uncomment the line below for read only mode ) +#read_only=enabled + + + + +# ----- DEBUGGING ----- + +# +# debug_log_file - The file that is used to log all debug +# information. This file is stored in the 'log_path' +# path. + +debug_log_file=debug.log + +# +# debug_level - The minimum debug level of messages that +# are written to the log file. Reducing this number +# will cause more debug information to be written to +# the log. +# 10 = INFORMATION +# 20 = WARNINGS +# 30 = ALERTS +# 40 = ERRORS + +debug_level=20 + +# +# table_lock_check - If this is enabled, every time a +# table is accessed a check is performed to ensure that +# the table owns the correct locks. If a lock assertion +# fails then an error is generated in the log file. +# This should not be enabled in a production system +# because the lock assertion check is expensive. However +# it should be used during testing because it helps to +# ensure locks are being made correctly. + +table_lock_check=disabled diff --git a/src/dist/db.properties b/build/antclick/db.properties similarity index 58% rename from src/dist/db.properties rename to build/antclick/db.properties index 7530ed26..9dc57b94 100644 --- a/src/dist/db.properties +++ b/build/antclick/db.properties @@ -8,11 +8,9 @@ # The actual mapping of types is done in the # type.properties file in the prototype directories. # -# More information about this file is available at -# http://helma.org/docs/guide/properties/db.properties/ # Properties of JDBC data sources -#myDataSource.url = jdbc:mysql://db.domain.com/space -#myDataSource.driver = org.gjt.mm.mysql.Driver -#myDataSource.user = username -#myDataSource.password = xyz +myDataSource.url = jdbc:mysql://db.domain.com/space +myDataSource.driver = org.gjt.mm.mysql.Driver +myDataSource.user = username +myDataSource.password = xyz diff --git a/build/antclick/hop.bat b/build/antclick/hop.bat new file mode 100755 index 00000000..ad4d6968 --- /dev/null +++ b/build/antclick/hop.bat @@ -0,0 +1,79 @@ +@echo off +rem Batch file for Starting Helma with a JDK-like virtual machine. + +rem To add jar files to the classpath, simply place them into the +rem lib/ext directory of this Helma installation. + +:: Initialize variables +:: (don't touch this section) +set JAVA_HOME= +set HOP_HOME= +set HTTP_PORT= +set XMLRPC_PORT= +set AJP13_PORT= +set RMI_PORT= +set OPTIONS= + +:: Set TCP ports for Helma servers +:: (comment/uncomment to de/activate) +set HTTP_PORT=8080 +rem set XMLRPC_PORT=8081 +rem set AJP13_PORT=8009 +rem set RMI_PORT=5050 + +:: Uncomment to set HOP_HOME +rem set HOP_HOME=c:\program files\helma + +:: Uncomment to set JAVA_HOME variable +rem set JAVA_HOME=c:\program files\java + +:: Uncomment to pass options to the Java virtual machine +rem set JAVA_OPTIONS=-server -Xmx128m + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: No user configuration needed below this line ::::::: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Setting the script path +set SCRIPT_DIR=%~d0%~p0 + +:: Using JAVA_HOME variable if defined. Otherwise, +:: Java executable must be contained in PATH variable +if "%JAVA_HOME%"=="" goto default + set JAVACMD=%JAVA_HOME%\bin\java + goto end +:default + set JAVACMD=java +:end + +:: Setting HOP_HOME to script path if undefined +if "%HOP_HOME%"=="" ( + set HOP_HOME=%SCRIPT_DIR% +) +cd %HOP_HOME% + + +:: Setting Helma server options +if not "%HTTP_PORT%"=="" ( + echo Starting HTTP server on port %HTTP_PORT% + set OPTIONS=%OPTIONS% -w %HTTP_PORT% +) +if not "%XMLRPC_PORT%"=="" ( + echo Starting XML-RPC server on port %XMLRPC_PORT% + set OPTIONS=%OPTIONS% -x %XMLRPC_PORT% +) +if not "%AJP13_PORT%"=="" ( + echo Starting AJP13 listener on port %AJP13_PORT% + set OPTIONS=%OPTIONS% -jk %AJP13_PORT% +) +if not "%RMI_PORT%"=="" ( + echo Starting RMI server on port %RMI_PORT% + set OPTIONS=%OPTIONS% -p %RMI_PORT% +) +if not "%HOP_HOME%"=="" ( + echo Serving applications from %HOP_HOME% + set OPTIONS=%OPTIONS% -h "%HOP_HOME% +) + +:: Invoking the Java virtual machine +%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS% diff --git a/build/antclick/hop.sh b/build/antclick/hop.sh new file mode 100755 index 00000000..1126339c --- /dev/null +++ b/build/antclick/hop.sh @@ -0,0 +1,68 @@ +#!/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 +# lib/ext directory. + +# uncomment to set JAVA_HOME variable +# JAVA_HOME=/usr/lib/java + +# uncomment to set HOP_HOME, otherwise we get it from the script path +# HOP_HOME=/usr/local/helma + +# options to pass to the Java virtual machine +# JAVA_OPTIONS="-server -Xmx128m" + +# Set TCP ports for Helma servers +# (comment/uncomment to de/activate) +HTTP_PORT=8080 +# XMLRPC_PORT=8081 +# AJP13_PORT=8009 +# RMI_PORT=5050 + +########################################################### +###### No user configuration needed below this line ####### +########################################################### + +# if JAVA_HOME variable is set, use it. Otherwise, Java executable +# must be contained in PATH variable. +if [ "$JAVA_HOME" ]; then + JAVACMD="$JAVA_HOME/bin/java" +else + JAVACMD=java +fi + +# 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 + # strip everyting behind last slash + HOP_HOME="${0%/*}" + cd $HOP_HOME + HOP_HOME=$PWD +else + cd $HOP_HOME +fi +echo "Starting Helma in directory $HOP_HOME" + +if [ "$HTTP_PORT" ]; then + SWITCHES="$SWITCHES -w $HTTP_PORT" + echo Starting HTTP server on port $HTTP_PORT +fi +if [ "$XMLRPC_PORT" ]; then + SWITCHES="$SWITCHES -x $XMLRPC_PORT" + echo Starting XML-RPC server on port $XMLRPC_PORT +fi +if [ "$AJP13_PORT" ]; then + SWITCHES="$SWITCHES -jk $AJP13_PORT" + echo Starting AJP13 listener on port $AJP13_PORT +fi +if [ "$RMI_PORT" ]; then + SWITCHES="$SWITCHES -p $RMI_PORT" + echo Starting RMI server on port $RMI_PORT +fi +if [ "$HOP_HOME" ]; then + SWITCHES="$SWITCHES -h $HOP_HOME" +fi + +# Invoking the Java VM +$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES diff --git a/build/antclick/lib/ext/mckoidb.jar b/build/antclick/lib/ext/mckoidb.jar new file mode 100644 index 00000000..f86e3daa Binary files /dev/null and b/build/antclick/lib/ext/mckoidb.jar differ diff --git a/build/antclick/license.txt b/build/antclick/license.txt new file mode 100644 index 00000000..70584794 --- /dev/null +++ b/build/antclick/license.txt @@ -0,0 +1,50 @@ + Copyright (c) 1999-2001 Helma Project. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. The end-user documentation included with the redistribution, + if any, must include the following acknowledgment: + "This product includes software developed by the Helma Project + for use in the Helma Object Publisher (http://www.helma.org/)." + Alternately, this acknowledgment may appear in the software itself, + if and wherever such third-party acknowledgments normally appear. + + 4. The names "Helma" and "Hop" must not be used to endorse or + promote products derived from this software without prior written + permission. For written permission, please contact + helma@helma.org. + + 5. Products derived from this software may not be called "Helma" + or "Hop", nor may "Helma" or "Hop" appear in their name, without + prior written permission of the Helma Project Group. + + 6. We ask you to give credit to the Helma Project for sites which build + upon Helma. This would normally consist of a text or graphic link + to http://helma.org/ with the line "Powered by Helma" somewhere on the + site. While it is not a breach of this license to omit this, it's a + great way for you to make help the Helma Project to continue + to flourish and grow. + + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE HELMA PROJECT OR ITS + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/build/antclick/server.properties b/build/antclick/server.properties new file mode 100644 index 00000000..ce1ef12f --- /dev/null +++ b/build/antclick/server.properties @@ -0,0 +1,27 @@ +# The SMTP server to use for sending mails. Set and +# uncomment this line before trying to send mails from +# Helma applications. +# +# smtp=mail.yourdomain.com + + +# Some examples for server-wide locale settings +# (please refer to http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html +# for country codes, resp. http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt +# for language codes). +# +# country = AT +# language = de +# +# country = UK +# language = en +# +# country = FR +# language = fr +# +# country = CZ +# language = cs + +# list ip addresses for admin-application here: +allowAdmin=127.0.0.1, 192.168.0.1 + diff --git a/build/build.bat b/build/build.bat new file mode 100644 index 00000000..19583079 --- /dev/null +++ b/build/build.bat @@ -0,0 +1,48 @@ +@echo off + +set TARGET=%1% +REM set JAVA_HOME=c:\programme\jdk13 + +REM -------------------------------------------- +REM No need to edit anything past here +REM -------------------------------------------- + +set BUILDFILE=build.xml +if "%TARGET%" == "" goto setdist +goto cont1 + +:cont1 +if not "%2%" == "" goto setapp +goto final + +:setdist +set TARGET=usage +goto cont1 + +:setapp +set APPNAME=-Dapplication=%2% +goto final + +:final + +if "%JAVA_HOME%" == "" goto javahomeerror + +set CP=%CLASSPATH%;ant.jar;jaxp.jar;crimson.jar +if exist %JAVA_HOME%\lib\tools.jar set CP=%CP%;%JAVA_HOME%\lib\tools.jar + +echo Classpath: %CP% +echo JAVA_HOME: %JAVA_HOME% + +%JAVA_HOME%\bin\java.exe -classpath "%CP%" %APPNAME% org.apache.tools.ant.Main -buildfile %BUILDFILE% %TARGET% + +goto end + + +REM -----------ERROR------------- +:javahomeerror +echo "ERROR: JAVA_HOME not found in your environment." +echo "Please, set the JAVA_HOME variable in your environment to match the" +echo "location of the Java Virtual Machine you want to use." + +:end + diff --git a/build/build.sh b/build/build.sh new file mode 100755 index 00000000..c7116e30 --- /dev/null +++ b/build/build.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# export JAVA_HOME=/usr/lib/j2sdk1.4.0 + +#-------------------------------------------- +# No need to edit anything past here +#-------------------------------------------- +if test -z "${JAVA_HOME}" ; then + echo "ERROR: JAVA_HOME not found in your environment." + echo "Please, set the JAVA_HOME variable in your environment to match the" + echo "location of the Java Virtual Machine you want to use." + exit +fi + +if test -f ${JAVA_HOME}/lib/tools.jar ; then + CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar +fi + +if test -n "${2}" ; then + APPNAME=-Dapplication=${2} +fi + +CP=${CLASSPATH}:ant.jar:jaxp.jar:../lib/crimson.jar + +echo "Classpath: ${CP}" +echo "JAVA_HOME: ${JAVA_HOME}" + +BUILDFILE=build.xml + +${JAVA_HOME}/bin/java -classpath ${CP} ${APPNAME} org.apache.tools.ant.Main -buildfile ${BUILDFILE} ${1} + diff --git a/build/build.xml b/build/build.xml new file mode 100644 index 00000000..6e1b572d --- /dev/null +++ b/build/build.xml @@ -0,0 +1,410 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# list of applications to be started by helma +base +base.mountpoint = / +bloggerapi +himp +hopblog +lillebror +manage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/crimson.jar b/build/crimson.jar new file mode 100644 index 00000000..2ad58524 Binary files /dev/null and b/build/crimson.jar differ diff --git a/build/jaxp.jar b/build/jaxp.jar new file mode 100644 index 00000000..b881783e Binary files /dev/null and b/build/jaxp.jar differ diff --git a/build/main/apps.properties b/build/main/apps.properties new file mode 100644 index 00000000..c50bcb23 --- /dev/null +++ b/build/main/apps.properties @@ -0,0 +1,10 @@ +# List of apps to start. + +base +base.mountpoint = / + +manage + +himp +bloggerapi +lillebror diff --git a/build/main/db.properties b/build/main/db.properties new file mode 100644 index 00000000..9dc57b94 --- /dev/null +++ b/build/main/db.properties @@ -0,0 +1,16 @@ +# This is where you specify relational data sources to +# map Helma types to relational databases. +# +# If you want to define a data source just for one +# application, simply copy the db.properties file to +# the application directory. +# +# The actual mapping of types is done in the +# type.properties file in the prototype directories. +# + +# Properties of JDBC data sources +myDataSource.url = jdbc:mysql://db.domain.com/space +myDataSource.driver = org.gjt.mm.mysql.Driver +myDataSource.user = username +myDataSource.password = xyz diff --git a/build/main/db/hopblog/0.xml b/build/main/db/hopblog/0.xml new file mode 100644 index 00000000..7230be1b --- /dev/null +++ b/build/main/db/hopblog/0.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/build/main/db/hopblog/1.xml b/build/main/db/hopblog/1.xml new file mode 100644 index 00000000..45babda3 --- /dev/null +++ b/build/main/db/hopblog/1.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/build/main/db/hopblog/2.xml b/build/main/db/hopblog/2.xml new file mode 100644 index 00000000..9cbf1ee2 --- /dev/null +++ b/build/main/db/hopblog/2.xml @@ -0,0 +1,11 @@ + + + + + + + admin@somedomain.at + helma + helma + + diff --git a/build/main/db/hopblog/3.xml b/build/main/db/hopblog/3.xml new file mode 100644 index 00000000..a8bbdf5c --- /dev/null +++ b/build/main/db/hopblog/3.xml @@ -0,0 +1,24 @@ + + + + + + + 31.05.2002 16:36:44 CEST + 2002.05.31 + + Congratulations! You successfully created your Helma HopBlog! + +As a first step you can login to your HopBlog using "helma" as user name and password (certainly without the quotes) and create or edit stories. + +Or you set-up HopBlog administration for yourself. You can do this by opening the file app.properties in the apps/hopblog directory of your Helma installation and editing the settings for siteAdmin, adminEmail and smtp. + +After that you should register the new administrator as HopBlog user. Simply enter the data you chose for siteAdmin and adminEmail in the appropriate fields of the registration form, fill in the other form fields and submit your data. If you have set a valid e-mail address and smtp server, you should get a message confirming the registration. + +Now you can login to your HopBlog using name and password of the newly created user. + +Let the fun begin... +:) + 31.05.2002 16:36:44 CEST + + diff --git a/build/main/db/hopblog/idgen.xml b/build/main/db/hopblog/idgen.xml new file mode 100644 index 00000000..0e1d4e21 --- /dev/null +++ b/build/main/db/hopblog/idgen.xml @@ -0,0 +1,6 @@ + + + + + 3 + diff --git a/build/main/hop.bat b/build/main/hop.bat new file mode 100755 index 00000000..06771c62 --- /dev/null +++ b/build/main/hop.bat @@ -0,0 +1,79 @@ +@echo off +rem Batch file for Starting Helma with a JDK-like virtual machine. + +rem To add jar files to the classpath, simply place them into the +rem lib/ext directory of this Helma installation. + +:: Initialize variables +:: (don't touch this section) +set JAVA_HOME= +set HOP_HOME= +set HTTP_PORT= +set XMLRPC_PORT= +set AJP13_PORT= +set RMI_PORT= +set OPTIONS= + +:: Set TCP ports for Helma servers +:: (comment/uncomment to de/activate) +set HTTP_PORT=8080 +rem set XMLRPC_PORT=8081 +rem set AJP13_PORT=8009 +rem set RMI_PORT=5050 + +:: Uncomment to set HOP_HOME +rem set HOP_HOME=c:\program files\helma + +:: Uncomment to set JAVA_HOME variable +rem set JAVA_HOME=c:\program files\java + +:: Uncomment to pass options to the Java virtual machine +rem set JAVA_OPTIONS=-server -Xmx128m + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: No user configuration needed below this line ::::::: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Setting the script path +set INSTALL_DIR=%~d0%~p0 + +:: Using JAVA_HOME variable if defined. Otherwise, +:: Java executable must be contained in PATH variable +if "%JAVA_HOME%"=="" goto default + set JAVACMD=%JAVA_HOME%\bin\java + goto end +:default + set JAVACMD=java +:end + +:: Setting HOP_HOME to script path if undefined +if "%HOP_HOME%"=="" ( + set HOP_HOME=%INSTALL_DIR% +) +cd %HOP_HOME% + + +:: Setting Helma server options +if not "%HTTP_PORT%"=="" ( + echo Starting HTTP server on port %HTTP_PORT% + set OPTIONS=%OPTIONS% -w %HTTP_PORT% +) +if not "%XMLRPC_PORT%"=="" ( + echo Starting XML-RPC server on port %XMLRPC_PORT% + set OPTIONS=%OPTIONS% -x %XMLRPC_PORT% +) +if not "%AJP13_PORT%"=="" ( + echo Starting AJP13 listener on port %AJP13_PORT% + set OPTIONS=%OPTIONS% -jk %AJP13_PORT% +) +if not "%RMI_PORT%"=="" ( + echo Starting RMI server on port %RMI_PORT% + set OPTIONS=%OPTIONS% -p %RMI_PORT% +) +if not "%HOP_HOME%"=="" ( + echo Serving applications from %HOP_HOME% + set OPTIONS=%OPTIONS% -h "%HOP_HOME% +) + +:: Invoking the Java virtual machine +%JAVACMD% %JAVA_OPTIONS% -jar "%INSTALL_DIR%\launcher.jar" %OPTIONS% diff --git a/build/main/hop.sh b/build/main/hop.sh new file mode 100644 index 00000000..9ab42a07 --- /dev/null +++ b/build/main/hop.sh @@ -0,0 +1,73 @@ +#!/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 +# lib/ext directory. + +# uncomment to set JAVA_HOME variable +# JAVA_HOME=/usr/lib/java + +# uncomment to set HOP_HOME, otherwise we get it from the script path +# HOP_HOME=/usr/local/helma + +# options to pass to the Java virtual machine +# JAVA_OPTIONS="-server -Xmx128m" + +# Set TCP ports for Helma servers +# (comment/uncomment to de/activate) +HTTP_PORT=8080 +# XMLRPC_PORT=8081 +# AJP13_PORT=8009 +# RMI_PORT=5050 + +########################################################### +###### No user configuration needed below this line ####### +########################################################### + +# if JAVA_HOME variable is set, use it. Otherwise, Java executable +# must be contained in PATH variable. +if [ "$JAVA_HOME" ]; then + JAVACMD="$JAVA_HOME/bin/java" +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 + # strip everyting behind last slash + HOP_HOME="${0%/*}" + cd $HOP_HOME + HOP_HOME=$PWD +else + cd $HOP_HOME +fi +echo "Starting Helma in directory $HOP_HOME" + +if [ "$HTTP_PORT" ]; then + SWITCHES="$SWITCHES -w $HTTP_PORT" + echo Starting HTTP server on port $HTTP_PORT +fi +if [ "$XMLRPC_PORT" ]; then + SWITCHES="$SWITCHES -x $XMLRPC_PORT" + echo Starting XML-RPC server on port $XMLRPC_PORT +fi +if [ "$AJP13_PORT" ]; then + SWITCHES="$SWITCHES -jk $AJP13_PORT" + echo Starting AJP13 listener on port $AJP13_PORT +fi +if [ "$RMI_PORT" ]; then + SWITCHES="$SWITCHES -p $RMI_PORT" + echo Starting RMI server on port $RMI_PORT +fi +if [ "$HOP_HOME" ]; then + SWITCHES="$SWITCHES -h $HOP_HOME" +fi + +# Invoke the Java VM +$JAVACMD $JAVA_OPTIONS -jar "$INSTALL_DIR/launcher.jar" $SWITCHES diff --git a/src/dist/extras/dpkg/copyright b/build/main/license.txt similarity index 62% rename from src/dist/extras/dpkg/copyright rename to build/main/license.txt index 6dd9115c..5b5e251b 100644 --- a/src/dist/extras/dpkg/copyright +++ b/build/main/license.txt @@ -1,21 +1,4 @@ -This package was debianized by Hannes Wallnoefer on -Mon, 15 Dec 2008 11:04:41 +0100. - -It was downloaded from http://www.helma.org/ - -Upstream Authors: - - Hannes Wallnoefer - Robert Gaggl - Daniel Rutharth - Stefan Pollach - Tobias Schaefer - Manfred Andres - Juerg Lehni - -Copyright: 1999-2008 Helma Project. All rights reserved. - -License: + Copyright (c) 1999-2002 Helma Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -48,15 +31,19 @@ License: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +This product contains the FESI EcmaScript interpreter written by +Jean-Marc Lugrin (http://home.worldcom.ch/jmlugrin/fesi/). FESI is +released under the GNU Lesser General Public License (see licenses/lesser.txt). -Helma includes third party software released under different specific -license terms. See the licenses directory in the Helma distribution -for a list of these licenses. +This product contains software from the Acme package written by Jef +Poskanzer. Please see the licensing terms in the Acme source code and check out +Jef's site at http://www.acme.com/. -The Debian packaging is (C) 2008, Hannes Wallnoefer and -is licensed under the GPL, see `/usr/share/common-licenses/GPL'. - -Parts of Helma come with different licenses, see /usr/share/helma/licenses -for details. +This product includes software developed by the Apache Software Foundation +released under the Apache Software License (licenses/apache.txt). +This product includes software developed by the JDOM Project +(http://www.jdom.org/). Please see the licensing terms in licenses/jdom.txt +This product includes software developed by the Word Wide Web Consortium +(http://www.w3c.org/). Please see the licensing terms in licenses/w3c.html. diff --git a/build/main/server.properties b/build/main/server.properties new file mode 100644 index 00000000..ce1ef12f --- /dev/null +++ b/build/main/server.properties @@ -0,0 +1,27 @@ +# The SMTP server to use for sending mails. Set and +# uncomment this line before trying to send mails from +# Helma applications. +# +# smtp=mail.yourdomain.com + + +# Some examples for server-wide locale settings +# (please refer to http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html +# for country codes, resp. http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt +# for language codes). +# +# country = AT +# language = de +# +# country = UK +# language = en +# +# country = FR +# language = fr +# +# country = CZ +# language = cs + +# list ip addresses for admin-application here: +allowAdmin=127.0.0.1, 192.168.0.1 + diff --git a/build/main/static/helma.gif b/build/main/static/helma.gif new file mode 100644 index 00000000..475b94fc Binary files /dev/null and b/build/main/static/helma.gif differ diff --git a/src/dist/static/helma2.gif b/build/main/static/helma2.gif similarity index 100% rename from src/dist/static/helma2.gif rename to build/main/static/helma2.gif diff --git a/build/main/static/himp/original.jpg b/build/main/static/himp/original.jpg new file mode 100644 index 00000000..d8e24618 Binary files /dev/null and b/build/main/static/himp/original.jpg differ diff --git a/src/dist/apps/welcome/static/test.txt b/build/main/static/test.txt similarity index 100% rename from src/dist/apps/welcome/static/test.txt rename to build/main/static/test.txt diff --git a/cliff.toml b/cliff.toml deleted file mode 100644 index 755c4ca2..00000000 --- a/cliff.toml +++ /dev/null @@ -1,52 +0,0 @@ -# git-cliff ~ default configuration file -# https://git-cliff.org/docs/configuration -# -# Lines starting with "#" are comments. -# Configuration options are organized into tables and keys. -# See documentation for more information on available options. - -[changelog] -trim = true - -header = "## Changes" - -body = """ -{% for group, commits in commits | filter(attribute="merge_commit") | group_by(attribute="group") %} - ### {{ group | striptags | trim | upper_first }} - {% for commit in commits %} - * [{{ commit.id | split(pat="") | slice(end=11) | join() }}]\ - (https://code.host.antville.org/antville/helma/commit/{{ commit.id }}) \ - {% if commit.breaking %}**Breaking:** {% endif %}\ - {{ commit.message | split(pat="\\n") | first | upper_first | escape }}\ - {% endfor %} -{% endfor %} - -**Full Changelog:** [{{ previous.version }} → {{ version }}]\ -(https://code.host.antville.org/antville/helma/compare/\ -{{ previous.version | urlencode }}..{{ version | urlencode }})\n\n -""" - -footer = """ -Generated by [git-cliff](https://git-cliff.org/). -""" - -[git] -conventional_commits = false -filter_commits = false -filter_unconventional = false -protect_breaking_commits = false -sort_commits = "newest" -split_commits = false -topo_order = false - -commit_parsers = [ - { message = "^Apply \\d+ suggestion", skip = true }, - { message = "^Merge .*(branch|dependabot|dependency|renovate)", skip = true }, - { message = "^Lock file maintenance", skip = true }, - { message = "yarn\\.lock", skip = true }, - - { message = "^[Ff]ix", group = " 🐛 Bug Fixes" }, - { field = "author.name", pattern = "[Rr]enovate|[Dd]ependabot", group = " 📦 Dependency Updates" }, - { message = "^Merge pull request", group = " 🔀 Merges" }, - { message = ".*", group = " Uncategorized" }, -] diff --git a/db.properties b/db.properties new file mode 100644 index 00000000..9dc57b94 --- /dev/null +++ b/db.properties @@ -0,0 +1,16 @@ +# This is where you specify relational data sources to +# map Helma types to relational databases. +# +# If you want to define a data source just for one +# application, simply copy the db.properties file to +# the application directory. +# +# The actual mapping of types is done in the +# type.properties file in the prototype directories. +# + +# Properties of JDBC data sources +myDataSource.url = jdbc:mysql://db.domain.com/space +myDataSource.driver = org.gjt.mm.mysql.Driver +myDataSource.user = username +myDataSource.password = xyz diff --git a/docs/reference.html b/docs/reference.html new file mode 100644 index 00000000..d03585fe --- /dev/null +++ b/docs/reference.html @@ -0,0 +1,2472 @@ + + + Printer-friendly Output + + + + + +

Reference

+ +

+ +

This is a growing collection of Helma documentation categorized by functionality. +

Application Object

+ +

+ +

app represents the Application object in Hop. By adding variables to this object it is possible to store temporary global variables, which are independent from request evaluator threads, i.e. they are shared by all threads. But be aware that they are not persistent and lost as soon as you restart the application. +

errorCount

+ +

+ +

Syntax +
app.errorCount

Description +
Returns the number of Errors which occured due to User Requests since the application has been started. +
+
Note: "File Not Found" Errors are not counted.

Example +
res.write(app.errorCount); +
8
+

getActiveThreads()

+ +

+ +

Syntax +
app.getActiveThreads()

Description +
This function returns the number of currently working Request Evaluator Threads. +
+
If this number reaches the maximum allowed Treads Hop returns a "maximum thread count reached" error page.

Example +
res.write(app.getMaxThreads()); +
12
+

getFreeThreads()

+ +

+ +

Syntax +
app.getFreeThreads()

Description +
This function returns the number of additional of Request Evaluator Threads, which could be created at the current moment. +
+
This is equivalent to the number of current Threads deducted from the number of maximum THreads.

Example +
res.write(app.getActiveThreads()); +
2 +
+
res.write(app.getMaxThreads()); +
12 +
+
res.write(app.getFreeThreads()); +
10
+

getMaxActiveThreads()

+ +

+ +

Syntax +
app.getMaxActiveThreads()

Description +
This function returns the historic maximum number of Request Evaluator Threads, which occured at some point since the application has been started.

Example +
res.write(app.getMaxActiveThreads()); +
6
+

getMaxThreads()

+ +

+ +

Syntax +
app.getMaxActiveThreads()

Description +
This function returns the historic maximum number of Request Evaluator Threads, which occured at some point since the application has been started.

Example +
res.write(app.getMaxActiveThreads()); +
6
+

requestCount

+ +

+ +

Syntax +
app.requestCount

Description +
Returns the number of HTTP-Requests since the application has been started.

Example +
res.write(app.requestCount); +
231
+

setMaxThreads()

+ +

+ +

Syntax +
app.setMaxThreads(Number)

Description +
This function enables the programmer to adjust the number of maximum allowed Request Evaluator Threads without having to restart the application.

Example +
app.setMaxThreads(10); +
res.write(app.getMaxThreads()); +
10
+

skinfiles

+ +

Array containing the skins of an application. + +

Syntax +
app.skinfiles

Description +
To access the actual content of a skin file in the inner loop you'd say app.skinfiles[a][b]. To access a skin file by name, you'd say something like app.skinfiles.root.test.

Example +
for (var a in app.skinfiles) { +
  res.write(a + "<br>"); +
  for (var b in app.skinfiles[a]) { +
    res.write("&nbsp;&nbsp;&nbsp;&nbsp;" + b + "<br>"); +
  } +
}
+

upSince

+ +

+ +

Syntax +
app.upSince

Description +
Returns the createtime of the Application object, i.e. the time when the application was started.

Example +
res.write(app.upSince.format("dd.MMM yyyy HH:mm")); +
06.Sep 2001 13:09
+

xmlrpcCount

+ +

+ +

Syntax +
app.xmlrpcCount

Description +
Returns the number of XML-RPC-Requests since the application has been started.

Example +
res.write(app.xmlrpcCount); +
12
+

Date Object

+ +

+ +

+

format()

+ +

Formatting a date string for custom output. + +

Syntax +
Date.format(String)

Description +
Formats the date string of a date object for custom output. The function's string parameter is used as a pattern to describe the desired format. Most common are the following pattern letters:

+Symbol Meaning              Presentation   Example
+------ -------              ------------   -------
+y      year                 (Number)       1996
+M      month in year        (Text, Number) July, 07
+d      day in month         (Number)       10
+h      hour in am/pm (1~12) (Number)       12
+H      hour in day (0~23)   (Number)       0
+m      minute in hour       (Number)       30
+s      second in minute     (Number)       55
+E      day in week          (Text)         Tuesday
+a      am/pm marker         (Text)         PM
+Please note that the output is depending on the locale settings of the Helma server. For further reference refer to the examples below or directly to the documentation of the Java SimpleDateFormat class.

Example +
var d = new Date(); +
res.write(d.format("EEE d.M.y, HH:mm'h'")); +
Thu 9.8.01, 15:15h +
+
res.write(d.format("dd. MMM. yyyy, hh:mm:ss aa")); +
09. Aug. 2001, 03:15:44 PM +
+
res.write(d.format("hh:mm:ss,SS")); +
03:15:44,609 +
+
res.write(d.format("EEEEE d MMMMM yyyy")); +
Thursday 9 August 2001 +
+
res.write(d.format("EEE, d MMM yyyy HH:mm:ss z")); +
Thu, 9 Aug 2001 15:15:44 CET
+

Direct Database Interface

+ +

+ +

The Direct Db interface allows the developer to directly access relational databases defined in the db.properties file without going through the Helma objectmodel layer. +
+
var con = getDBConnection("db_source_name"); +
+
This returns a Connection object from the Helma connection pool that can be used as specified by the Fesi DbAccess protocol, except that it is not necessary to call the connect() and disconnect() functions. +
+
var rows = con.executeRetrieval("select title from dummy"); +
while (rows.next()) +
  res.write(rows.getColumnItem("title")+"<br>"); +
+
+

FESI Extensions

+ +

+ +

FESI (pronounced like fuzzy) is a full implementation of the ECMAScript language as defined in the ECMA technical standard specification ECMA-262 (June 97 edition). +
+
ECMAScript is largely equivalent to the JavaScript language version 1.1 or to the core part of JScript, but without the extensions specific to Netscape Navigator. Instead, FESI comes with its own extensions as listed below. +
+
These parts of the documentation are adapted from the FESI Homepage courtesy by Jean-Marc Lugrin. +

throwError()

+ +

+ +

Syntax +
throwError(stringOrException)

Description +
This function throws an exception, ie. the script interpreter aborts, the stringOrException parameter is converted to a string and immediately written to the response object for output.

Example +
throwError("Aborting without any reason"); +
Runtime error Aborting without any reason +
detected at line 1 of function 'main_action' in string starting with: 'function main_action (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {'...
+

tryEval()

+ +

+ +

Syntax +
tryEval(functionString, defaultValue)

Description +
tryEval() evaluates the functionString parameter just like the standard ECMAScript function eval() does, but returns an object with two properties, value and error. +
+
If the evaluation is successful, the value property contains the result of the evaluation and the error property equals to null (which tests as false). +
+
If the evaluation results in an error, the value property has either the value of the optional defaultValue parameter (if specified) or undefined, and the error property contains an object describing the error, which is guaranteed to test as true. +
+
The error object string representation is some description of the error. In the future more detailed error information may be available.

Example +
var trial = tryEval("undefinedFunction()", -1) +
if (trial.error) +
   res.writeln(trial.error); +
res.writeln(trial.value); +
+
FESI.Exceptions.EcmaScriptException: Runtime error no global function named 'undefinedFunction' detected at line 1 in string: 'undefinedFunction()' +
-1
+

FTP Client

+ +

+ +

This object represents an Ftp client object for sending and receiving files from an Ftp server. The constructor is called FtpServer and invoked as follows: +
+
var ftp = new FtpClient("ftp.mydomain.com"); +
+
The Ftp client needs Daniel Savarese's NetComponents library in the classpath in order to work. +
+
Functions and Properties +

ascii()

+ +

+ +

Syntax +
FtpObject.ascii();

Description +
Set transfermodus to Ascii for transmitting text.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
ftp.ascii();
+

binary()

+ +

+ +

Syntax +
FtpObject.binary();

Description +
Set transfer mode to binary for transmitting images and other non-text files.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
ftp.binary();
+

cd()

+ +

+ +

Syntax +
FtpObject.cd(Path);

Description +
Change the current path on the FTP server.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
+
// use absolute pathname +
ftp.cd("/home/users/fred/www"); +
+
// change to parent directory +
ftp.cd(".."); +
+
// use relative pathname +
ftp.cd("images");
+

getFile()

+ +

+ +

Syntax +
FtpObject.getFile(RemoteFile, LocalFile);

Description +
Transfer a file from the server to the local file system.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
ftp.getFile(".htaccess", "htaccess.txt");
+

getString()

+ +

+ +

Syntax +
FtpObject.getString(RemoteFile);

Description +
Retrieves a file from the remote server and returns it as string.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
var str = ftp.getString("messages.txt");
+

lcd()

+ +

+ +

Syntax +
FtpObject.lcd(LocalPath);

Description +
Change the local path of the FTP client.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
+
// use absolute pathname +
ftp.lcd("/home/users/fred/www"); +
+
// change to parent directory +
ftp.lcd(".."); +
+
// use relative pathname +
ftp.lcd("images");
+

login()

+ +

+ +

Syntax +
FtpObject.login(UserName, Password);

Description +
Log in to the FTP server. The function returns true if successful, false otherwise.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
if (ftp.login("user", "pass")) +
   res.write("User logged in."); +
else +
   res.write("Unable to log in."); +
+
User logged in.
+

logout()

+ +

+ +

Syntax +
FtpObject.logout();

Description +
Terminate the current FTP session.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
ftp.putFile("htaccess.txt", ".htaccess"); +
ftp.logout();
+

mkdir()

+ +

+ +

Syntax +
FtpObject.mkdir(String);

Description +
Creates a new directory on the server. The name of the directory is determined as the function's string parameter. Returns false when an error occured (e.g. due to access restrictions, directory already exists etc.), otherwise true.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
if (ftp.mkdir("testdir")) +
   ftp.cd("testdir") +
else +
   ftp.logout();
+

putFile()

+ +

+ +

Syntax +
FtpObject.putFile(LocalFile, RemoteFile);

Description +
Transfers a file from the local file system to the remote server. Returns true if the transmission was successful, otherwise false.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
if (ftp.putFile("testfile")) +
   res.write("File transfered successfully."); +
else +
   res.write("Transfer error."); +
+
File transfered successfully.
+

putString()

+ +

+ +

Syntax +
FtpObject.putString(String, RemoteFile);

Description +
Transfer text from a string to a file on the remote server.

Example +
var ftp = new FtpClient("ftp.host.dom"); +
ftp.login("user", "pass"); +
ftp.putString("Hello, World!", "message.txt");
+

Global Functions

+ +

+ +

These are the global functions that are added to the Hop interpreter in addition to the standard global functions found in a JavaScript interpreter. +

authenticate()

+ +

+ +

Syntax +
authenticate(UserNameString, PasswordString)

Description +
This function authenticates against a standard Unix password file, which is both secure (encrypted using CRYPT) and can be managed using the htpasswd utility which is included in the Apache web server distribution. +
+
The function just returns true or false, so you have to make sure yourself you remember the result in the user object by setting some cache flag. +
+
The function compares the two arguments with the data in the file called "passwd", stored in the Helma installation directory. This can be overridden by a file with the same name in the application directory. +
+
Please note that this function is currently not working under Windows because the Windows version of Apache's htpasswd can use a special type of MD5 encryption only.

Example +
var login = authenticate("user", "pass"); +
if (login) +
   res.write("Welcome back!"); +
else +
   res.write("Oops, please try again..."); +
+
Welcome back!
+

countActiveUsers()

+ +

+ +

Syntax +
countActiveUsers()

Description +
Returns the number of currently active users.

Example +
var nr = countActiveUsers(); +
res.write(nr); +
18
+

createSkin()

+ +

+ +

Syntax +
createSkin(String)

Description +
Turns a string into a Skin object ready for rendering with renderSkin() and renderSkinAsString().

Example +
var str = "Hello, <% response.body %>!"; +
var skin = createSkin(str); +
res.body = "World"; +
renderSkin(skin); +
+
Hello, World!
+

encode()

+ +

Preparing a string for smooth html output. + +

Syntax +
encode(string)

Description +
Encodes a string by replacing linebreaks with <br> tags and diacritical characters as well as html tags with their equivalent html entities.

Example +
var str = encode("<b>Bananer växer\n minsann inte på träd.<b>"); +
res.write(str); +
&lt;b&gt;Bananer v&auml;xer +
<br> minsann inte p&aring; tr&auml;d.&lt;/b&gt;
+

encodeForm()

+ +

+ +

Syntax +
encodeForm(String)

Description +
Similar to encode() this functions substitutes html entities but leaves newlines untouched. This is what you usually want to do for encoding form content (esp. with textarea values).

Example +
var str = encodeForm("<b>Bananer växer\n minsann inte på träd.<b>"); +
res.write(str); +
&lt;b&gt;Bananer v&auml;xer +
minsann inte p&aring; tr&auml;d.&lt;/b&gt;
+

encodeXml()

+ +

Preparing a string for smooth xml output. + +

Syntax +
encodeXml(string)

Description +
Encodes a string by replacing < and > with &lt; and &gt; as well as & with its html entity &amp;.

Example +
var str = encodeXml("<title>Smørebrød</title>"); +
res.write(str); +
&lt;title&gt;Sm&amp;oslash;rebr&amp;oslash;d&lt;/title&gt;
+

format()

+ +

Preparing a string for smooth html output. + +

Syntax +
format(string)

Description +
Encodes a string similar to encode() but keeping the markup tags and trying to avoid <br> tags where possible (e.g. in table structures).

Example +
var str = encode("<b>Bananer växer\n minsann inte på träd.<b>"); +
res.write(str); +
<b>Bananer v&auml;xer +
<br> minsann inte p&aring; tr&auml;d.</b>
+

getActiveUsers()

+ +

Retrieving active Users. + +

Syntax +
getActiveUsers()

Description +
Returns an array that contains all User Objects of users who are currently browsing the Hop application. This includes users who are logged in as well as anonymous users.

Example +
var myUsers = getActiveUsers(); +
res.write(myUsers); +
UserNode 6df1869674117400@e4042e487b, UserNode Snoopy, UserNode Woodstock
+

getAllUsers()

+ +

Retrieving the names of all registered users. + +

Syntax +
getAllUsers()

Description +
Returns an array that contains the names of all registered users. Use the getUser() function to retrieve the actual user object. This is to be used with caution with large amounts of users.

Example +
var myUsers = getAllUsers(); +
res.write(myUsers); +
Snoopy, Lucy, Linux, Woodstock +
+
res.write(getUser(myUsers[1])); +
UserObject Lucy
+
+

getProperty()

+ +

Retrieving a global Property. + +

Syntax +
getProperty(string)

Description +
Returns a Property named string stored in one of the files app.properties or server.properties. If the Property exists in both of the files, app.properties overwrites server.properties. This way server.properties defines Properties for all applications which app.properties can refine for a particular application. app.properties is located in the top directory of a Hop application. server.properties is located in the Hop installation directory. +
+
There is a complete list of Hop's System Properties

Example +
var smtp = getProperty("smtp"); +
res.write(smtp); +
mail.helma.org
+

getURL()

+ +

Retrieving the content behind a URL. + +

Syntax +
getURL(url)

Description +
Allocates and retrieves a remote file from a url.

Example +
var url = getURL("http://helma.org/"); +
res.write(url);
+
...see helma.org :-> +
+
var url = getURL("ftp://user:pass@ftp.server.dom/welcome.txt"); +
res.write(url); +
Welcome on the FTP server of server.dom!
+
+
var url = getURL("file:///home/snoopy/www/title.txt"); +
res.write(url); +
The Nudist on the Late Shift
+

getUser()

+ +

Retrieving a User Object. + +

Syntax +
getUser(string)

Description +
Returns a Hop Object describing the user referred to with string.

Example +
var myUser = getUser("Snoopy"); +
res.write(myUser.email); +
atomicdog@helma.org
+

getUserBySession()

+ +

Retrieving a User Object. + +

Syntax +
getUserBySession(sessionId)

Description +
Returns a user object with a certain session id (= Helma session cookie).

Example +
+
var id = user.sessionID; +
var user = getUserBySession(id); +
res.write(user.name); +
Snoopy
+
(quite recursive, isn't it?) +

isActive()

+ +

Determining whether a user is logged in. + +

Syntax +
isActive(userObject)

Description +
Returns true if the user referred to by the user object is logged in.

Example +
var user = getUser("Snoopy"); +
res.write(isActive(user)); +
false
+

renderSkin()

+ +

+ +

Syntax +
renderSkin(String, ParameterObject)

Description +
Renders a global skin (ie. a skin file inside the global directory). The name of the skin is defined by the string parameter. +
+
A skin is a file that only contains markup (e.g. Html or Xml) and macros. Macros are references to Helma functions wrapped in special tags (<% and %>). For more information about skin and macro techniques please refer to the section about Helma Skins. +
+
Optionally, a JavaScript object can be assigned to the function call as second argument. This object's properties later can be accessed from the skin via pseudo-macro calls of the kind <% param.PropertyName %> +
+
If a param property is not set but referred to in the skin file, it will be replaced with an empty string. Please note that this behaviour is different from generic macro calls.

Example +
Contents of the file global/example.skin: +
<html> +
<head> +
   <title>Hello, <% param.title %>!</title> +
</head> +
<body bgcolor="<% param.bgcolor %>"> +
I greet you <% param.amount %> times. +
</body> +
</html>
+
+
Rendering the skin: +
var param = new Object(); +
param.bgcolor = "#ffcc00"; +
param.title = "World"; +
param.amount = "12345"; +
renderSkin("example", param); +
+
<html> +
<head> +
   <title>Hello, World!</title> +
</head> +
<body bgcolor="#ffcc00"> +
I greet you 12345 times. +
</body>
+

renderSkinAsString()

+ +

+ +

Syntax +
renderSkinAsString(String, ParameterObject)

Description +
Renders a global skin just the same way as renderSkin() does. The only difference is though, that this function returns the result as string instead of immediately writing it to the response object.

Example +
var str = renderSkinAsString("example", param); +
res.write(str);
+
+
which is equivalent to +
+
renderSkin("example", param); +

stripTags()

+ +

Removing markup tags from a string. + +

Syntax +
stripTags(string)

Description +
Removes any < and > as well as everyhing between both of these two characters. In other words: extracts the essence of the text from a string without anything that looks like markup.

Example +
var str = "<html><b>The Nudist on the Late Shift</b></html>"; +
res.write(str); +
The Nudist on the Late Shift
+

write()

+ +

+ +

Syntax +
write(String)

Description +
This function echoes the string parameter on the console display. Very useful for debugging purposes.

Example +
write("Hello, Console!"); +
Hello, Console!
+

writeln()

+ +

+ +

Syntax +
writeln(String)

Description +
This function echoes the string parameter on the console display and additionally a newline character. Very useful for debugging purposes.

Example +
writeln("Hello,"); +
writeln("Console!"); +
Hello, +
Console!
+

Hop Object

+ +

+ +

The HopObject is the basic building block of a Hop applications. The website root object, the user object, as well as any custom type defined by the application are HopObjects and inherit all functionality described below. +
+
In addition to defining and scripting special types of HopObjects it is possible to extend all HopObjects at once by defining a prototype called hopobject. +
+
Functions and Properties +

add()

+ +

Adding a Subnode to a Hop Object. + +

Syntax +
hopObject.add(hopObject)

Description +
Adds a Hop Object as new Subnode to another Hop Object. The new Subnode is added after the last Subnode already contained in the Hop Object.

Example +
res.write(root.size()); +
0 +
var myStory= new story(); +
root.add(myStory); +
res.write(root.size()); +
1
+
+
It is also possible to add a bunch of Subnodes with only one function call: +
var myAuthor= new author(); +
var myTitle= "The Nudist On The Late Shift"; +
var myStory= new story(); +
root.add(myAuthor, myTitle, myStory); +
res.write(root.size()); +
3
+

addAt()

+ +

Adding a Subnode to a Hop Object. + +

Syntax +
hopObject.addAt(number, hopObject)

Description +
Adds a Subnode to a Hop Object. Unlike add() the position of the Subnode is determined by a number as first parameter in the function call. +
+
Using addAt() instead of add() usually only has an effect with the embedded database, since the order of objects stored in a relational database depends on the value of some column. Thus when adding objects stored in a relational database, one may as well use add().

Example +
res.write(root.get(23)); +
null +
var myStory= new story(); +
root.addAt(23, myStory); +
res.write(root.get(23)); +
hopObject story
+

cache

+ +

+ +

Syntax +
HopObject.cache

Description +
Each HopObject contains a cache object to store temporary properties (e.g. strings, numbers or other objects) in. These properties can be accessed in any thread until the application is restarted or the HopObject is invalidated, either manually using the invalidate() function or whenever Helma is fetching the HopObject's data from a remote database. +
+
There is no way to make the cache object persistent.

Example +
user.cache.message = "This is a temporary message." +

contains()

+ +

Determining if a Hop Object contains a certain Subnode. + +

Syntax +
hopObject.contains(hopObject)

Description +
Returns the index position of a Subnode contained by a Hop Object (as usual for JavaScript starting with 0 referring to the first position). The index position is a relative value inside a Hop Object (not to be confused with a Hop ID which is unique for each Hop Object). If there is no appropriate Subnode inside the Hop Object the returned value equals -1

Example +
var obj = root.get("myObject"); +
res.write(root.contains(obj)); +
23 +
+
obj = root.get("blobject"); +
res.write(root.contains(obj)); +
-1
+

count()

+ +

Counting Subnodes. + +

Syntax +
hopObject.count()

Description +
Returns the amount of Subnodes contained in a Hop Object.

Example +
res.write(root.count()); +
5
+

editor()

+ +

+ +

Syntax +
hopObject.editor(string, width, height)

Description +
Returns an input element for the object's property defined by the string parameter. The result can be used inside an Html form. The property's value is set to the form elements value. If the optional height parameter is set, a text area is used instead of a one-line text field.

Example +
var editor = this.editor("title", 20); +
res.write("<form>" + editor + "</form>"); +
+
<form><input type="text" name="title" size="20" value="Hello, World"></form> +
+
var editor = this.editor("bodytext", 20, 5); +
res.write("<form>" + editor + "</form>"); +
+
<form><textarea name="bodytext" cols="20" rows="5" wrap="virtual">When the going gets tough, the tough goes shopping.</textarea></form>
+

get()

+ +

Retrieving Properties and Subnodes. + +

Syntax +
hopObject.get(stringOrNumber)

Description +
Retrieves a Property or a Subnode of a known Hop Object. The type of the result depends on the type of the submitted parameter: a number will retrieve the Subnode of the Hop Object at the corresponding index position, a string the corresponding Property of the Hop Object. Finally, a number as string retrieves the subnode with the corresponding Hop ID.

Example +
root.get(0); +
HopObject author +
root.get(1); +
HopObject story +
+
root.get("date"); +
Wed Oct 18 02:01:41 GMT+01:00 1971 +
root.get("title"); +
The Nudist On The Late Shift +
+
root.get("1"); +
HopObject author
+

href()

+ +

Getting a Hop Object's url-compatible reference. + +

Syntax +
hopObject.href() +
hopObject.href(string)

Description +
Returns the absoulte url path of a Hop Object relative to the application's root. Any string parameter is simply appended to the return value. Useful to refer to a Hop Object in a markup tag (e.g. with a href parameter in an html <a> tag).

Example +
var obj = root.get(0); +
+
res.write("<a href=\"" + obj.href() + "\">"); +
<a href="/main/"> +
+
res.write("<a href=\"" + obj.href("edit") + "\">"); +
<a href="/main/edit"> +
+
+

invalidate()

+ +

Delete a Hop Object from the cache. + +

Syntax +
hopObject.invalidate()

Description +
Marks a HopObject as invalid so that it is fetched again from the database the next time it's accessed. In other words, use this function to kick an object out of Helma's database cache.

Example +
var obj = this.get(0); +
obj.invalidate();
+

list()

+ +

Listing Hop Objects. + +

Syntax +
hopObject.list()

Description +
Returns an array including all Subnodes of a Hop Object. Useful if array data is required, however general use should be avoided in favor of the method described below.

Example +
var objectList = root.list(); +
for (var i=0; i<objectList.length; i++){ +
 var myObject = objectList[i]; +
 res.write(myObject.created + "<br>"); +
} +
Wed Oct 18 02:01:41 GMT+01:00 1971 +
Fri Nov 03 13:25:15 GMT+01:00 2000 +
Mon May 29 07:43:09 GMT+01:00 1999
+
+
With increasing amounts of Subnodes tied to a Hop Object the use of list() becomes seriously inefficient as long as not all Subnodes really need to be read out. This is due to the creation of a JavaScript Array containing the whole bunch of Subnodes each time the list() function is called. Instead, it is recommended to determine the amount of Subnodes using the count() function and looping through them using get(): +
+
var amount = root.size(); +
for (var i=0; i<amount; i++){ +
 var myObject = root.get(i); +
 res.write(myObject.created + "<br>"); +
} +
Wed Oct 18 02:01:41 GMT+01:00 1971 +
Fri Nov 03 13:25:15 GMT+01:00 2000 +
Mon May 29 07:43:09 GMT+01:00 1999
+

remove()

+ +

Removing a Subnode. + +

Syntax +
hopObject.remove()

Description +
Removes a known Subnode from a Hop Object. The subnode can be determined e.g. via the get() function.

Example +
res.write(root.size()); +
24 +
var myObject = root.get(5); +
root.remove(myObject); +
res.write(root.size()); +
23
+

renderSkin()

+ +

+ +

Syntax +
HopObject.renderSkin(String, ParameterObject)

Description +
Renders a skin of this object. The name of the skin is defined by the string parameter. +
+
A skin is a file that only contains markup (e.g. Html or Xml) and macros. Macros are references to Helma functions wrapped in special tags (<% and %>). For more information about skin and macro techniques please refer to the section about Helma Skins. +
+
Optionally, a JavaScript object can be assigned to the function call as second argument. This object's properties later can be accessed from the skin via pseudo-macro calls of the kind <% param.PropertyName %> +
+
If a param property is not set but referred to in the skin file, it will be replaced with an empty string. Please note that this behaviour is different from generic macro calls.

Example +
Contents of the file root/example.skin: +
<html> +
<head> +
   <title>Hello, <% param.title %>!</title> +
</head> +
<body bgcolor="<% param.bgcolor %>"> +
I greet you <% param.amount %> times. +
</body> +
</html>
+
+
Rendering the skin: +
var param = new Object(); +
param.bgcolor = "#ffcc00"; +
param.title = "World"; +
param.amount = "12345"; +
root.renderSkin("example", param); +
+
<html> +
<head> +
   <title>Hello, World!</title> +
</head> +
<body bgcolor="#ffcc00"> +
I greet you 12345 times. +
</body>
+

renderSkinAsString()

+ +

+ +

Syntax +
HopObject.renderSkinAsString(String, ParameterObject)

Description +
Renders a skin of this object just the same way as renderSkin() does. The only difference is though, that this function returns the result as string instead of immediately writing it to the response object.

Example +
var str = root.renderSkinAsString("example", param); +
res.write(str);
+
+
which is equivalent to +
+
root.renderSkin("example", param); +

set()

+ +

Changing Properties and Subnodes. + +

Syntax +
hopObject.set(stringOrNumber, value)

Description +
Replaces the value of a Property or Subnode with a new value.

Example +
res.write(root.get(23)); +
null +
var myAuthor = new author(); +
root.set(23, myAuthor); +
res.write(root.get(23)); +
hopObject author +
+
res.write(root.title); +
null +
var myTitle = "The Nudist On The Late Shift"; +
root.set("title", myTitle); +
res.write(root.title); +
The Nudist On The Late Shift
+

setParent()

+ +

Defining a Hop Object as parent for a Subnode. + +

Syntax +
hopObject.setParent(hopObject)

Description +
Sometimes it is necessary to set a Subnode's parent to a certain Hop Object. This is caused by the way Hop caches Subnodes. Especially if you are retrieving a Subnode from a relational database through different ways (e.g. by using subnoderelation) and you want to remove this Subnode or apply the href() function on it.

Example +
var trash = user.stories.get(23); +
trash.setParent(root); +
root.remove(trash);
+

size()

+ +

Counting Subnodes. + +

Please refer to count(). +

_id

+ +

+ +

Syntax +
hopObject._id

Description +
Returns the internal id of the object. This property is assigned by Helma and cannot be set.

Example +
var obj = root.get(0); +
res.write(obj._id); +
43
+

_parent

+ +

+ +

Syntax +
hopObject._parent

Description +
Returns the parent object of this object.

Example +
var obj = root.get(0); +
res.write(obj._parent); +
HopObject root
+

Image Processing

+ +

+ +

The image object allows you to read, manipulate, and save images. An image object is created using the Image() constructor. +
+
var img = new Image(imageUrl); +
var img = new Image(imageUrl, imageFilter);
+
+
For this to work, you must have Sun's Jimi library in your classpath. +
+
Example: +
var img = new Image("http://helma.org/image.gif"); +
var img = new Image("file:///home/images/image.jpg"); +
+
var filter = new Packages.com.sun.jimi.core.filters.Rotate(90); +
var img = new Image("http://helma.org/image.gif", filter);
. +
+
Please refer to the getSource() function for details and examples of the imageFilter parameter. +
+

crop()

+ +

Cutting out a rectangular area of an image. + +

Syntax +
imageObject.crop(x, y, width, height)

Description +
Cuts out (crops) a rectanglular area of an image. The dimensions of the area are calculated from the x- and y-offset from the top left corner of the image as upper left reference point to x + width and y + height as lower right reference point.

Example +
var img = new Image("http://helma.org/images/original.gif"); +
res.write("<img src=\"/images/original.gif\">"); +
+
+
+
img.crop(58,9,48,21); +
img.saveAs("/www/images/processed.gif"); +
res.write("<img src=\"/images/processed.gif\">"); +
+
+

drawLine()

+ +

Adding a drawn line to an image. + +

Syntax +
imageObject.drawLine(x1, x2, y1, y2)

Description +
Draws a line onto an image. The line starts at the reference point defined by the offsets x1 and y1 from the top left corner of the image and ends at the reference point defined by the offsets x2 and y2.

Example +
var img = new Image("http://helma.org/images/originalgif"); +
res.write("<img src=\"/images/original.gif\">"); +
+
+
+
img.setColor(204,0,0); +
img.drawLine(58,26,100,26); +
img.saveAs("/www/images/processed.gif"); +
res.write("<img src=\"/images/processed.gif\">"); +
+
+

drawRect()

+ +

Adding a drawn rectangle to an image. + +

Syntax +
imageObject.drawRect(x, y, width, height)

Description +
Draws a rectangle onto an image. The rectangle's dimensions are calculated from the x- and y-offset from the top left corner of the image as upper left reference point to x + width and y + height as lower right reference point.

Example +
var img = new Image("http://helma.org/images/originalgif"); +
res.write("<img src=\"/images/original.gif\">"); +
+
+
+
img.setColor(204,0,0); +
img.drawRect(57,8,46,20); +
img.saveAs("/www/images/processed.gif"); +
res.write("<img src=\"/images/processed.gif\">"); +
+
+

drawString()

+ +

Adding text to an image. + +

Syntax +
imageObject.drawString(string, x, y)

Description +
Draws a string onto an image. The string will be drawn starting at the x- and y-offset from the top left corner of the imaget.

Example +
var img = new Image("http://helma.org/images/original.gif"); +
res.write("<img src=\"/images/original.gif\">"); +
+
+
+
img.setColor(204,0,0); +
img.drawString("rocks!",82,35); +
img.saveAs("/www/images/processed.gif"); +
res.write("<img src=\"/images/processed.gif\">"); +
+
+

fillRect()

+ +

Adding a filled rectangle to an image. + +

Syntax +
imageObject.fillRect(x, y, width, height)

Description +
Draws a filled rectangle onto an image. The rectangle's dimensions are calculated from the x- and y-offset from the top left corner of the image as upper left reference point to (x + width) and (y + height) as lower right reference point.

Example +
var img = new Image("http://helma.org/images/original.gif"); +
res.write("<img src=\"/images/original.gif\">"); +
+
+
+
img.setColor(204,0,0); +
img.fillRect(58,27,43,29); +
img.saveAs("/www/images/processed.gif"); +
res.write("<img src=\"/images/processed.gif\">"); +
+
+

getHeight()

+ +

Determining the height of an image. + +

Syntax +
imageObject.getHeight()

Description +
Returns the height of an image measured in pixels.

Example +
var img = new Image("http://helma.org/images/hop.gif"); +
res.write("<img src=\"/images/hop.gif\">"); +
+
+
+
var height = img.getHeight(); +
res.write(height); +
35
+

getSource()

+ +

+ +

Syntax +
Image.getSource()

Description +
To use the image filters provided by the Jimi java image processing package Packages.com.sun.jimi.core.filters, a specific class of image objects is needed. Helma wraps the sun.awt.image objects into a custom class. To use Helma image objects with Jimi's filters these have to be "unwrapped" using the getSource() function. +
+
The following filter functions have been successfully applied the way as described in the examples above:

  • Rotate(degreeNumber)
  • +
  • Gray()
  • +
  • Flip(typeNumber)
  • +
  • Oil(intensityNumber)
  • +
  • Invert()
  • +
  • Smooth(intensityNumber)
  • +
  • Shear(degreeNumber)
  • +
  • Edges()
  • +
  • Shrink(multiplyNumber)
  • +
  • Enlarge(divisionNumber)
+Please take into account that the quality might suffer depending on the type and amount of filters applied to the image.

Example +
var img = new Image("http://helma.org/static/original.jpg"); +
var rotator = new Packages.com.sun.jimi.core.filters.Rotate(45); +
var processed = new Image(img, rotator); +
processed.saveAs("/path/to/static/processed.jpg"); +
res.write("&lt;img src=\"/static/processed.jpg\&gt;"); +
+
+
+
var img = new Image("http://helma.org/static/original.jpg"); +
var filter = Packages.com.sun.jimi.core.filters; +
var oil = new filter.Oil(img.getSource(), 3); +
var processed = new Image(img, oil); +
processed.saveAs("/path/to/static/processed.jpg"); +
res.write("&lt;img src=\"/static/processed.jpg\&gt;"); +
+
+

getWidth()

+ +

Determining the width of an image. + +

Syntax +
imageObject.getWidth()

Description +
Returns the width of an image measured in pixels.

Example +
var img = new Image("http://helma.org/images/hop.gif"); +
res.write("<img src=\"/images/hop.gif\">"); +
+
+
+
var width = img.getWidth(); +
res.write(width); +
174
+

reduceColors()

+ +

Setting the color depth of an image. + +

Syntax +
imageObject.reduceColors(number)

Description +
Reduces the number of colors used in an image to the amount specified with number. Use with caution, generally. Gif images need a color depth of max. 256 colors maximum.

Example +
var img = new Image("http://helma.org/images/original.jpg"); +
res.write("<img src=\"/images/original.jpg\">"); +
+
+
+
img.reduceColors(8); +
img.saveAs("/www/images/processed.jpg"); +
res.write("<img src=\"/images/processed.jpg\">"); +
+
+

resize()

+ +

Setting the dimensions of an image. + +

Syntax +
imageObject.resize(width, heigth)

Description +
Sets the height and width of an image to new values. The new width and height have to be integers, so be careful to round the new values eventually. In case of a gif image be sure to reduce the image to 256 colors after resizing by using the reduceColors() function.

Example +
var img = new Image("http://helma.org/images/original.jpg"); +
res.write("<img src=\"/images/original.jpg\">"); +
+
+
+
var factor = 0.66; +
var wd = Math.round(img.getWidth() * factor); +
var ht = Math.round(img.getHeight() * factor); +
img.resize(wd, ht); +
img.saveAs("/www/images/processed.jpg"); +
+
res.write("<img src=\"/images/processed.jpg\">"); +
+
+

saveAs()

+ +

Storing an image on the hard disk. + +

Syntax +
imageObject.saveAs(path)

Description +
Stores the binary data of an image on the hard disk. Before the image is converted into the appropriate image format determined by the file extension (please refer to the JIMI documentation for a detailed overview of the available formats).

Example +
var img = new Image("http://helma.org/images/original.jpg"); +
res.write("<img src=\"/images/original.jpg\">"); +
+
+
+
img.saveAs("/www/images/processed.png"); +
res.write("<img src=\"/images/processed.png\">"); +
+
+

setColor()

+ +

Selecting a drawing color. + +

Syntax +
imageObject.setColor(colorOrRgbValues)

Description +
Determines the color of the following drawing actions either by a 24-bit integer (016777215) or by an rgb-tuple (each element ranging from 0 to 255).

Example +
var img = new Image("http://helma.org/images/original.jpg"); +
res.write("<img src=\"/images/original.jpg\">"); +
+
+
+
img.setColor(16777215); +
img.fillRect(80, 50, 30, 30); +
img.setColor(255, 255, 0); +
img.fillRect(65, 15, 30, 30); +
img.saveAs("/www/images/processed.png"); +
res.write("<img src=\"/images/processed.png\">"); +
+
+

setFont()

+ +

Selecting a typeface for font setting. + +

Syntax +
imageObject.setFont(name, style, size)

Description +
Determines the font face, style and size of a font to be used in following drawString() actions. name specifies the font face as string (e.g. "sansserif", "dialog"). +
+
The integer style sets the font to normal (0), bold (1), italic (2) or bold and italic (3). size, also an integer, refers to the font size in pixels. +
+
Please take a look at this description about adding fonts to the Java Runtime for a detailed look onto Java's font mechanics.

Example +
var img = new Image("http://helma.org/images/original.jpg"); +
res.write("<img src=\"/images/original.jpg\">"); +
+
+
+
img.setColor(255, 255, 255); +
img.setFont("serif", 0, 12); +
img.drawString("I shot the serif.", 50, 15); +
img.setFont("sansserif", 1, 14); +
img.drawString("But I didn't shoot", 10, 100); +
img.setFont("monospaced", 2, 16); +
img.drawString("the monotype.", 15, 115); +
img.saveAs("/www/images/processed.png"); +
res.write("<img src=\"/images/processed.png\">"); +
+
+

Java Object Access

+ +

+ +

See the Fesi documentation for Java object access. +
+
For starters, objects from the core Java Api (in the java.* packages) can be instantiated directly, while other Java classes need the Packages prefix. +
+
var buffer = new java.lang.StringBuffer(); +
var foo = new Packages.com.bar.util.Foo();
+
+
Use Sun's Api Specification to find out more about Java objects. +
+
Example +
/** +
* This function returns a date string +
* from a Date object formatted +
* according to a custom locale. +
*/ +
function getLocaleDate(date) { +
   // Here the locale is set (english / Ireland): +
   var locale = new java.util.Locale("en", "IE"); +
   // Creating the date formatter: +
   var dateFormat = new java.text.SimpleDateFormat("EEEE d MMMM yyyy, HH:mm", locale); +
   // Formatting the Date object as date string: +
   var dateString = dateFormat.format(date); +
   return(dateString); +
}
+

Mail Client

+ +

+ +

Mail objects are used to send email via Smtp and are created by using the Mail() constructor: +
+
var mail = new Mail(); +
+
The mail object can than be manipulated and sent using the functions listed below. +
+
You'll need the JavaMail library installed for this to work. Also, don't forget to set your mail server via the smtp property. +
+
Note: Make sure that the Smtp server itself is well-configured, so that it accepts Mails coming from your server and does not deny relaying. +
Best and fastest configuration is of course if you run your own Smtp server (e.g. sendmail), but which might be a bit tricky to set up. +

addBCC()

+ +

+ +

Syntax +
mailObject.addBCC(EmailString, NameString)

Description +
Adds a recipient to the list of addresses to get a "blind carbon copy" of the message. The first argument specifies the receipient's e-mail address. The second argument is optional and specifies the name of the recipient.

Example +
var mail = new Mail(); +
mail.addBCC("hop@helma.at"); +
mail.addBCC("tobi@helma.at", "Tobi Schaefer");
+

addCC()

+ +

+ +

Syntax +
mailObject.addCC(EmailString, NameString)

Description +
Adds an address to the list of carbon copy recipients. The first argument specifies the receipient's e-mail address. The second argument is optional and specifies the name of the recipient.

Example +
var mail = new Mail(); +
mail.addCC("hop@helma.at"); +
mail.addCC("tobi@helma.at", "Tobi Schaefer");
+

addPart()

+ +

+ +

Syntax +
mailObject.addPart(Object)

Description +
Adds a mime-part to the message. The mime-part (e.g. a gif image or an rtf document) has to be wrapped into a java.io.File object.

Example +
var file = new java.io.File("/home/snoopy/woodstock.jpg"); +
var mail = new Mail(); +
mail.setFrom("snoopy@doghouse.com"); +
mail.setTo("woodstock@birdcage.com"); +
mail.setSubject("Look at this!"); +
mail.addPart("I took a photograph from you. Neat, isn't it? -Snoop"); +
mail.addPart(file); +
mail.send();
+

addText()

+ +

+ +

Syntax +
mailObject.addText(String)

Description +
Appends a string to the body text of the message. Note that this method will overwrite any multi-mime-parts already added to the message.

Example +
var mail = new Mail(); +
mail.addText("Hello, World!");
+

addTo()

+ +

+ +

Syntax +
mailObject.addTo(EmailString, NameString)

Description +
Adds a receipient to the address list of the message. The first argument specifies the receipient's e-mail address. The second argument is optional and specifies the name of the recipient.

Example +
var mail = new Mail(); +
mail.addTo("hop@helma.at"); +
mail.addTo("tobi@helma.at", "Tobi Schaefer");
+

send()

+ +

+ +

Syntax +
mailObject.send()

Description +
This function actually sends the message created with the mail object using the smtp server as specified in an appropriate property file.

Example +
var mail = new Mail(); +
mail.addTo("watching@michi.tv", "michi"); +
mail.addCC("franzi@home.at", "franzi"); +
mail.addBCC("monie@home.at"); +
mail.setFrom("chef@frischfleisch.at", "Hannes"); +
mail.setSubject("Registration Conformation"); +
mail.addText("Thanks for your Registration..."); +
mail.send();
+
+

setFrom()

+ +

+ +

Syntax +
mailObject.setFrom(EmailString, NameString)

Description +
Sets the sender of the message. The first argument specifies the sender's e-mail address. The second argument is optional and specifies the name of the sender.

Example +
var mail = new Mail(); +
mail.setFrom("tobi@helma.at", "Tobi Schaefer");
+

setSubject()

+ +

+ +

Syntax +
mailObject.setSubject(String)

Description +
Sets the subject of the message.

Example +
var mail = new Mail(); +
mail.setSubject("Hello, World!");
+

status

+ +

+ +

Syntax +
mailObject.status

Description +
Returns the current status of the message. If an error has occured the status is greater than zero. Here are the error codes:

+nr   error description
+--   -----------------
+ 0   no error
+10   error with setSubject()
+11   error with addText()
+12   error with addPart()
+20   error with addTo()
+21   error with addCC()
+22   error with addBCC()
+30   error while trying to send the Message

Example +
var mail = new Mail(); +
mail.addTo("idont@know@myemail.com"); +
res.write(mail.status); +
20
+

Number Object

+ +

+ +

+

format()

+ +

+ +

Syntax +
Number.format(PatternString)

Description +
Formats a number as string for custom output. The function's string parameter is used as a pattern to describe the desired format. In the pattern string you can use the following pattern letters:

+Symbol   Meaning
+------   -------
+  0      a digit
+  #      a digit, zero shows as absent
+  .      placeholder for decimal separator
+  ,      placeholder for grouping separator.
+  E      separates mantissa and exponent for
+         exponential formats.
+  ;      separates formats.
+  -      default negative prefix.
+  %      multiply by 100 and show as percentage
+  ?      multiply by 1000 and show as per mille
+        currency sign; replaced by currency symbol;
+         if doubled, replaced by international currency
+         symbol. If present in a pattern, the monetary
+         decimal separator is used instead of the decimal
+         separator.
+  X      any other characters can be used in the prefix
+         or suffix.
+  '      used to quote special characters in a prefix
+         or suffix.
+Please note that the output is depending on the locale settings of the Helma server. For further reference refer to the examples below or directly to the documentation of the Java DecimalFormat class

Example +
var nr = 12345.67890; +
res.write(nr.format("#.00 ")); +
12345,68 S +
+
res.write(nr.format("###,####.00 ")); +
1.2345,68 ATS +
+
var nr = 0.0987654321; +
res.write(nr.format("0.###%")); +
9,877% +
+
var nr = 7.9E-5 +
res.write(nr.format("0.######")); +
0,000079
+

Object-Relational Mapping

+ +

+ +

The Hop comes with the ability to store Hop objects natively in its embedded object database. However, for many purposes it is advisable to use an external relational database product for object storage for reasons including features, accessability and reliability. +
+
A prototype can specify how its data properties are stored in relational database tables by providing a types.properties file. This file is located in the prototype's directory along with the prototype code. It is basically a Java properties file that maps JavaScript properties to database columns. Unfortunately, the mapping rules have gone from clean and simple to rather obscure as features were added to the Hop. +
+
A basic type.properties file might look like this: +

_datasource = my_data_source
+_tablename = my_table
+
+_subnodes = <child.db_parent_id
+_id = id
+
+title = db_title
+createdate = db_createdate
+owner = db_owner_id>user.id
+The first thing we notice is that some properties begin with an underscore ("_") while others don't. This is a simple convention to separate those properties which are needed by Hop internally from those that specify script-accessible properties of this prototype. +
+
In the following, we describe the different kinds of entries that can be used in type.properties files. +
+

Path Object

+ +

+ +

Description +
The objects in the uri path of a request are not only accessible as array members of the global path object, but also as named properties of path via the name of their prototype. For instance, if an object in the uri path has a prototype called "story", it will be accessible as path.story. +
+
Example +
Assumed the request path of an application is +
/h_files/myDocument/storyTitle/23 +
+
for (var i=0; i<path.length; i++) +
   res.writeln(path[i]); +
+
HopObject file +
HopObject document +
HopObject story +
HopObject note
+
+
var obj = path.story; +
res.write(obj); +
+
HopObject story
+
+

Property Files

+ +

+ +

Helma's property files are simple text files containing information e.g. about which applications to start, about the database connection, server configuration etc. +
+
There is no general syntax of the various properties, however most of the time each line represents a property's assignment the way +
+
propertyName = propertyValue(s) +
+
A line starting with a hash character # will be handled as comment: +
+
# This is a comment. +
This is no comment. # This is no comment, either.
+

app.properties

+ +

+ +

Description +
This file is located in an application's directory (e.g. apps/myApp/). A wide variety of properties can be defined here. Generally, any imaginable name can be used as a property and assigned a string value the way +
+
propertyName = propertyValue +
+
Properties defined in such a way can be evaluated from inside Helma's scripting environment by using the getProperty() function. +
+
However, there is a bunch of pre-defined properties that are used internally by Helma. Be careful not to accidentally bend these special properties for your custom purposes or your application eventually could behave unexpectedly. +
+
Many of those pre-defined properties also can be defined server-wide in server.properties. However, any property that is set there will be overwritten by an appropriate setting in app.properties. +
+
Example +
# Setting some properties: +
backgroundColor = #3333ff +
title = "Hello, World!"
+
+
Accessing the properties e.g. from root/main.hac: +
var bgColor = getProperty("backgroundColor"); +
res.write(bgColor); +
#3333ff +
+
var title = getProperty("title"); +
res.write(title); +
Hello, World!
+

apps.properties

+ +

+ +

Description +
This file is located in Helma's installation directory. It contains a list of applications that helma will handle (ie. start up, execute, update). The name of an application refers to a directory with the same name in helma's apps directory. +
+
Example +
hopblog +
antville +
gong +
kolin +
+
Special case: appname = self +
+
Using this syntax enables the application appname to script Helma herself. Currently, there can be only one application set-up this way: +
+
Example +
hopblog +
antville +
base = self +
gong
+

db.properties

+ +

+ +

Description +
This file is located in Helma's installation directory. It contains a list of data sources and data source properties setting up the basic connection between Helma and relational databases. +
+
To define data sources, the property sources is assigned a comma-separated list of names (certainly, the list can contain only one element): +
+
sources = dataSourceName +
+
In consequence the following properties of the data source(s) must be set: +
+
dataSourceName.url +
dataSourceName.driver +
dataSourceName.user +
dataSourceName.password
+
+
Example +
sources = mySqlDB, oracleDB, hsqlDB +
+
mySqlDB.url = jdbc:mysql://db.domain.com/mysql +
mySqlDB.driver = org.gjt.mm.mysql.Driver +
mySqlDB.user = username +
mySqlDB.password = secretPassword +
+
oracleDB.url = jdbc:oracle://db.domain.com/oracle +
oracleDB.driver = oracle.jdbc.driver.OracleDriver +
oracleDB.user = username2 +
oracleDB.password = secretPassword2 +
+
hsqlDB.url = jdbc:hsqldb:dbData +
hsqlDB.driver=org.hsqldb.jdbcDriver +
hsqlDB.user=sa +
hsqlDB.password=
+

server.properties

+ +

+ +

Description +
This file is located in Helma's installation directory. It contains pre-defined properties that are used internally by Helma for configuring the server. +
+
Many of these properties also can be defined in an app.properties file. Any property that is set there will overwrite the appropriate setting in server.properties. +
+
Example +
# Setting a custom locale: +
country = AT +
language = de +
+
# Defining a mail server: +
smtp = mail.domain.dom
+

type.properties

+ +

+ +

This file is located in a prototype's directory (e.g. apps/myApp/myProto). It contains definitions that specify the way Helma maps the relational database tables to hierarchical objects. +

Basic Mappings

+ +

+ +

The _db entry describes the database to use for storing objects of this type. dbname is the name of a database as defined in the db.properties file. +
+
_db = dbname +
+
The _table entry tells Helma which table to use for objects of this type within the database. +
+
_table = TABLENAME +
+
The _id entry defines the column to use as primary key. Helma requires a single primary key with no other functionality. +
+
_id = ID_COLUMN +
+
The optional _name entry tells Helma which database column to use as object name. This is important for the user prototype, since it defines which column constitutes the user name. +
+
_name = NAME_COLUMN +
+
The _parent entry contains a list of properties of objects of this type to be used as parent. Objects must know their parent in order to generate correct URLs in their href() function. +
+
_parent = property1, property2 +

Simple Property Mappings

+ +

+ +

The mappings for simple (non-object) properties simple map a property name of the specified object type to a column of the relational database table. The type of the property or column need not be specified. Helma does all necessary conversion when reading or writing a property value. +
+
prop1 = DB_COLUMN_1 +
prop2 = DB_COLUMN_2
+
+
To prevent a property from being overwritten by the application it can be made readonly. +
+
prop1.readonly = true +

Mountpoint Mappings

+ +

+ +

Mountpoints provide a simple way to directly attach a prototype to the URL path. If the path contains the name of a mountpoint the prototype's objects are accessible simply by adding their id (or a property defined by ._accessname) to the URL string. +
+
myMountpoint = mountpoint(myProto) +
+
In the example above, the path /myMountpoint/23/test refers to the action test.hac of the object with id 23, which is derived from the myProto prototype. +

Object Property Mappings

+ +

+ +

Properties that contain other objects are defined by the object keyword and the prototype name of the referenced object in brackets. The object reference is resolved via two entries: +
+
prop3 = object (protoype) +
prop3.local = LOCAL_DB_COLUMN +
prop3.foreign = FOREIGN_DB_COLUMN
+
+
prop3.local specifies the part of the reference in the local database-table, prop3.foreign the column in the table where objects of the referenced prototype are stored. By executing the assignment obj.prop3 = someObject, the database-column specified by prop3.local will be set to the value of FOREIGN_DB_COLUMN, or null if someObject == null. +

Collection Mappings

+ +

+ +

The following section describes the entries used to define collections of objects. There are two kinds of collections: First, every object can itself act as a collection, and second, it can define additional properties to be used as collections. Direct descendents are defined with entries starting with _children, while additional collections are defined using their property name. Otherwise the syntax for the two is the same. +
+
The following are examples for simple collection mappings for both the direct descendants and those contained in a collection-property called prop4. The .foreign entry is used in both cases to specify a column in the foreign table used to collect the objects. Exactly those objects will be collected whose FOREIGN_DB_COLUMN value equals the LOCAL_DB_COLUMN value of the object holding the collection. Leaving away .local and .foreign creates a collection of all available objects of the specified prototype. +
+
_children = collection (protoype) +
_children.local = LOCAL_DB_COLUMN +
_children.foreign = FOREIGN_DB_COLUMN +
+
prop4 = collection (protoype) +
prop4.local = LOCAL_DB_COLUMN +
prop4.foreign = FOREIGN_DB_COLUMN
+
+
By executing obj.add(otherObj) resp. obj.prop4.add(otherObj), the FOREIGN_DB_COLUMN will be set to the value of LOCAL_DB_COLUMN. +
+
By default, child objects can be accessed from the containing parent object through their index-position or ID value. Additionally the entry .accessname can be used to specify a database column in the child table. The value of this column will be used as name of the objects contained in this collection. +
+
prop4.accessname = DB_COLUMN +
+
With the above mapping, an object contained in the prop4 collection with a DB_COLUMN value of "xyz" would be reachable as this.prop4.xyz from the containing object. +
+
filter can be used to add an additional condition for the selection of objects which is not dependent on the object holding the collection. order contains the sorting to be applied to the child objects. group tells Helma to group the objects in the collection according to the value in DB_GROUPCOLUMN. +
+
prop4.filter = DB_FILTERCOLUMN is not null +
prop4.order = DB_ORDERCOLUMN desc +
prop4.group = DB_GROUPCOLUMN +
prop4.group.order = DB_GROUPORDERCOLUMN
+
+
Notice the two appearences of order above. The first one, prop4.order sorts the objects, the second, prop4.group.order sorts the grouped objects, that Helma will create as a result of the group entry. With this it's also possible to sort the grouped objects ascending, but the contents of the grouped objects descending. +

Additional Join Conditions

+ +

+ +

For both object and collection mappings, it is possible to provide any number of additional restraints used to join the local with the other table to further limit the selected objects. +
+
prop4.local.1 = FIRST_LOCAL_COLUMN +
prop4.foreign.1 = FIRST_FOREIGN_COLUMN +
prop4.local.2 = SECOND_LOCAL_COLUMN +
prop4.foreign.2 = SECOND_FOREIGN_COLUMN
+
+
Whenever one specifies more than one restraint, the use of .[Number] is mandatory. +

List of All Properties

+ +

+ +

This is a list of all pre-defined properties that can be set in one of the files server.properties, db.properties and app.properties (type.properties coming soon). Which property is available in which file is displayed in the "Range" column. +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyRangeDescription
actionExtensionserver, appSets the extension for Helma action files. Default setting is actionExtension = .hac. Changing this setting is not recommended. Use with caution and at your own risk.
allowWebserverSpecifies ip adresses (or networks) that are allowed to connect to the Helma rmi servlet server (port 5055). For more than one ip adress put a comma between the entries, subnets should be written as i.e. 192.168.0.*.
allowXmlRpcserver, appSame as allowWeb, but for the xml-rpc server (port 5056).
appHomeserverDefines the path to the location of Helma applications. If not specified, [hopHome]/apps will be used.
appsPropFileserverSets the location of the apps.properties file (i.e. for security reasons). The default is the root directory of your Helma installation.
baseURIserver, appSpecifies the prefix to add to urls generated by a Helma application. For example, if your application is "mounted" at /myapp in the server's document tree, you'd set baseURI = /myapp.
cachesizeserverDefines the size of the node cache in bytes.
charsetserverDefines the character encoding. The default is ISO-8859-1 (Western) encoding. You can use any of the encodings supported by Java.
countryserverLike language, this is used to set the country for proper localisation. For details you can refer to this list of country codes.
dbHomeserverDefines the path to the location of the embedded database files. If not specified, [hopHome]/db will be used
debugserver, appSwitches between "normal" logging output (debug = false) and the extensive "debug" output (debug = true) which may be useful when developing. Default setting is false.
exposeTemplatesserver, appTo directly call a .hsp (instead of a .hac) file via the http interface it is necessary to set exposeTemplates = true. Default setting is false.
hopHomeserverThis property defines the Helma working directory, e.g. hopHome = /hop/apps. If not specified, the current directory is used.
hrefSkinappThe name of the skin that is assigned to this property is used to extend the href() function. E.g. setting hrefSkin = customLink will cause Helma to set param.path to the result of href() and to render the skinfile customLink.skin as if the function renderSkin("customLink", param) was invoked. Take a look at the hrefSkin example for the whole picture.
idBaseValueserver, appUsed to set the current value of the internal ID generator. This is useful when starting a new internal db (where the id value would normally start at 1), but relational dbs are used that already contain data. Only applied if the current counter value is smaller than idBaseValue.
languageserverUsed to set the language on systems where the Java runtime doesn't recognize it by itself (e.g. Linux), which may be important for date formatting and the like. Refer to this list of language codes for details.
linkMethodserver, applinkMethod = query | path
Deprecated.
logDirserver, app
logSQLserver, appWith this option set to "true", Helma writes out all sql select statements to the logging device (and just those, so you won't find any insert, update or delete statements in there).
maxThreadsserverSets the maximum number of Helma's Java threads, e.g. maxThreads = 12. This is one of the parameters you should adjust for each server depending on the applications you run. If you see an error like "maximum thread count reached" you should increase the value of this property.
paranoidserverIf set to true, switches Helma to "paranoid" mode, which means that it won't accept connections from servers with unknown ip adresses >you can specify allowed ip adresses with the allowWeb and allowXmlRpc properties. Default setting is paranoid = false.
requestTimeoutserverDefines the time in seconds after which a request receives a timeout. Normally there is no need to change this value, but if you have tasks in your Helma application that take a longer time, you should increase this value.
scriptExtensionserver, appUsed to change the extension of script files. Default setting is scriptingExtension = .js. Changing this setting is not recommended. Use with caution and at your own risk.
sessionTimeoutserver, appThis determines the time (in minutes) after which an inactive session becomes invalid.
skinPathapp
smtpserver, appSpecifies an smtp server, e.g. smtp = mail.server.dom. If you want Helma to send e-mail you should define this property.
sourcesdbDefines the name of one or more data sources to be used in an application, e.g. sources = mySqlDB, oracleDB. Each data source has then to be specified in detail by assigning values to its properties url, driver, user and password. Refer to the description of db.properties for further information.
templateExtensionserver, appUsed to change the extension of Helma template files. Changing this setting is not recommended. Use with caution and at your own risk.
timezoneserverIt might be necessary to explicitly set the timezone for Helma. If new Date() puts out the wrong date, check if this option was set correctly. For details, refer to this list of timezones
xmlparserserver, appCan be used to specify a different Xml parser, e.g. xmlparser = minml. The default value is openxml.
XmlRpcAccessserver, appFunctions which should be callable via Xml-Rpc need to be listed in this property on a per-application basis. The list contains entries of the kind prototype.function for each exposed function separated by commata, e.g. XmlRpcAccess = weblog.getStory, weblog.showStatus.
xmlRpcHandlerNameappSetting this property makes it possible to change the name under which an application is registered with the XML-RPC server. This means that the functions exposed via XML-RPC will have a "blogger" prefix. For instance a function called "newPost" will be XML-RPC callable as blogger.newPost instead of antville.newPost.
+ +

Example Files

+ +

+ +

server.properties +
# Setting the extension for Helma action files: +
actionExtension = .hac +
+
# Allowing some ip addreses for web access: +
allowWeb = 192.168.0.*, 194.152.169.160 +
+
# Allowing some ip addreses for xml-rpc access: +
allowXmlRpc = 192.168.0.* +
+
# Setting the directory where Helma applications reside: +
appHome = /helma-1.2/apps +
+
# Setting the location of apps.properties: +
appsPropFile = /helma-1.2/propFiles +
+
# Setting the application's base uri: +
baseURI = /apps/testApp +
+
# Setting the size of Helma's cache memory: +
cachesize = 1000 +
+
# Setting the character encoding: +
charset = UTF8 +
+
# Setting the country code: +
country = AT +
+
# Setting the location of database files: +
dbHome = /etc/db/helma +
+
# Enabling debugging: +
debug = true +
+
# Enabling web access to .hsp templates: +
exposeTemplates = true +
+
# Setting the Helma working directory +
hopHome = /helma-1.2 +
+
# Setting the base value to create id numbers from: +
idBaseValue = 5000 +
+
# Setting the language code: +
language = de +
+
# Enabling database logging +
logSQL = true +
+
# Setting the maximum number of server threads: +
maxThreads = 12 +
+
# Enabling restricted web access to the Helma server: +
paranoid = true +
+
# Setting the duration after a request times out: +
requestTimeout = 60 +
+
# Setting the extension of JavaScript files: +
scriptExtension = .js +
+
# Setting the duration after an inactive session times out: +
sessionTimeout = 10 +
+
# Setting a smtp server: +
smtp = mail.server.dom +
+
# Setting a relational data source: +
sources = mySqlDB +
+
# Setting the extension of Helma templates: +
templateExtension = .hsp +
+
# Setting the server's timezone: +
timezone = GMT +
+
# Enabling the MinML xml parser: +
xmlparser = minml +
+
# Defining which application functions should be accessible via xml-rpc: +
XmlRpcAccess = weblog.getStory, weblog.showStatus +
+

Request Object

+ +

+ +

The request object represents the request coming from the client. It is accessible as a global variable called req. +

data

+ +

+ +

Syntax +
req.data.String;

Description +
Retrieves the corresponding value from the http request. The value can either come from a cookie, or from a "post" or "get" http request. Hop does not make any difference here. +
+
The following variables are automatically set by Helma if they are available:

  • HopSession +
    The id of the current hop session cookie
  • +
  • http_browser +
    Name and version of the client Browser
  • +
  • http_host +
    Name of the local server
  • +
  • http_remotehost +
    Internet address of the user
  • +
  • http_referer +
    URL of the page which linked the user to the current page
+req.get() provides exactly the same functionality in a what we think not as comfortable way (gotta type brackets and quotes). But it's just a matter of taste which one to use.

Example +
Here we see all three methods of setting a name, value pair: +
res.write("<form action=" + root.href("showValues") + " method="post"><input name="city"><input type="submit"></form>"); +
+
res.write("<form action=" + root.href("showValues") + " method="get"><input name="district"><input type="submit"></form>"); +
+
res.setCookie("street", "Lindengasse");
+
+
root/showValues.hac: +
res.write(req.data.city); +
res.write(req.data.district); +
res.write(req.data.street);
+
+
Note: If you have got a cookie and a form element with the same name sent by "get" or "post", the cookie value will be overridden by the form value. +
+
If you are very curious and want to see all the values sent by the http request, you can use the getReqData() function. +

get()

+ +

+ +

Syntax +
req.get(String)

Description +
Retrieves the corresponding value from the http request. The value can either come from a cookie, or from a "post" or "get" http request. Hop does not make any difference here. +
+
This is an alternative way of accessing request data to the req.data object. Please see the req.data documentation for more information.

Example +
res.write(req.get("http_remotehost")); +
127.0.0.1
+

path

+ +

+ +

Syntax +
req.path

Description +
returns the path of the current request

Example +
res.write(req.path); +
docs/reference/req/path
+

session

+ +

+ +

Syntax +
req.session

Description +
returns the Session ID of the current user

Example +
res.write(req.session); +
717163f187abf800@e4b40a0e88
+

Response Object

+ +

+ +

The response object represents the response to be sent back to the client. It is accessible as a global variable called res. +

body

+ +

Deprectated property. + +

This property is deprecated and will not be supported in future releases of Helma. +
+
Use res.data instead, by attaching the appropriate property to it. +

cache

+ +

+ +

Syntax +
res.cache = Boolean

Description +
Specifies on a per-response base whether to allow client-side caching of the response or not. The default value is set to true, but can be changed globally by passing caching=false to the initial Helma java call. Please refer to the section about servlet properties for more details.

Example +
res.cache = true; +

charset

+ +

Setting character encoding. + +

Syntax +
res.charset = CharsetString

Description +
Sets Helma's character encoding according to the list of supported encodings. By default, Helma uses ISO-8859-1 (western) encoding. It is also possible to set the encoding server or application wide using the charset property in the appropriate file.

Example +
res.charset = "UTF8"; +
res.write(""); +
// this is displayed if the brower's encoding is set to "Western" +
ÄÖÜäöüß
+

contentType

+ +

+ +

Syntax +
res.contentType = ContentTypeString

Description +
The contentType of the http response can be set manually by changing the value of this Property. The default value is "text/html".

Example +
res.contentType="text/plain"; +
res.contentType="text/xml"; +

data

+ +

+ +

res.data can be used to attach any property propertyName onto it to make it available in a skin via <% response.propertyName %>. +
+
Example +
+
== root/main.hac +
res.data.title = "Test"; +
res.data.body = "Hello, World!"; +
root.renderSkin("main");
+
+
== root/main.skin +
<html> +
<head> +
  <title><% response.title %></title> +
</head> +
<body> +
+
<% response.body %> +
+
</body> +
</html>
+

encode()

+ +

+ +

Syntax +
res.encode(String)

Description +
Works similar to the global function encode() but writes the result directly to the response string buffer. Encodes a string by replacing linebreaks with <br> tags and diacritical characters as well as html tags with their equivalent html entities.

Example +
res.encode("<b>Bananer växer\n minsann inte på träd.<b>"); +
&lt;b&gt;Bananer v&auml;xer +
<br> minsann inte p&aring; tr&auml;d.&lt;/b&gt;
+

encodeXml()

+ +

+ +

Syntax +
res.encodeXml(String)

Description +
Works the same way as the global Function encodeXml(), but writes the result directly to the response string buffer.

Example +
res.encodeXml("<title>Smørebrød</title>"); +
&lt;title&gt;Sm&amp;oslash;rebr&amp;oslash;d&lt;/title&gt;
+

error

+ +

Contains an internal Helma error message. + +

Syntax +
res.error

Description +
Contains a string describing an error if one should occur. If no error was detected, res.error contains an empty string. A good place for this function is a custom error page to display errors in a pretty layout.

Example +
res.write(res.error); +
Runtime error Syntax error detected near line 1, column 24, after in string starting with: 'function main_action (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {'...
+

format()

+ +

+ +

Syntax +
res.format(String);

Description +
Encodes a string similar to encode() but keeping the markup tags and trying to avoid <br> tags where possible (e.g. in table structures).

Example +
res.encode("<b>Bananer växer\n minsann inte på träd.<b>"); +
<b>Bananer v&auml;xer +
<br> minsann inte p&aring; tr&auml;d.</b>
+

head

+ +

Deprectated property. + +

This property is deprecated and will not be supported in future releases of Helma. +
+
Use res.data instead, by attaching the appropriate property to it. +

message

+ +

Buffer a string for output. + +

When this property is set, its value can be retrieved either by res.message from within an action or a JavaScript file or by <% response.message %> from within a skin file. +
+
Additionally, it will survive an HTTP redirect which can be necessary to display warnings or error messages to the user. The property's value will be cleared at latest after a redirected response was output. +

redirect()

+ +

+ +

Syntax +
res.redirect(UrlString);

Description +
Redirects the user to the specified url immediately. The JavaScript code following this command will not be processed anymore.

Example +
Here is a simple check using a hypothetic isAdmin() function to grant access to authorized people only: +
+
if (!user.isAdmin()) +
   res.redirect("/main");
+

reset()

+ +

+ +

Syntax +
res.reset();

Description +
Resets the current Response StringBuffer.

Example +
res.write("Writing something to the response"); +
// changing my mind (e.g. an error occured somewhere) +
res.reset(); +
res.write("Actually this is what I wanted to tell you: ..."); +
+
Actually this is what I wanted to tell you: ...
+

setCookie()

+ +

+ +

Syntax +
res.setCookie(KeyString, ValueString, NumberOfDays);

Description +
Sets a Cookie on the client machine. The third number argument is optional and specifies the number of days until the cookie expires.

Example +
The following can be used to "remember" users, and automatically log them in, when they return to your site. +
+
res.setCookie("username", "michi", 10); +
res.setCookie("password", "strenggeheim", 10);
+

title

+ +

Deprectated property. + +

This property is deprecated and will not be supported in future releases of Helma. +
+
Use res.data instead, by attaching the appropriate property to it. +

write()

+ +

Writes to the Response StringBuffer + +

Syntax +
res.write(String);

Description +
Transforms the passed argument to a string (only if necessary) and appends the result to the response string buffer. Throws an error if no argument or an undefined argument is passed.

Example +
var now = new Date(); +
res.write("current time: " + now); +
+
current time: Thu Feb 15 23:34:29 GMT+01:00 2001
+

writeBinary()

+ +

+ +

Syntax +
res.writeBinary(javaByteArray);

Description +
This function takes one argument, which must be a Java byte array. Useful when handling binary data retrieved via http file upload.

Example +
var upload = req.data.fileUpload; +
res.writeBinary(upload);
+

writeln()

+ +

+ +

Syntax +
res.writeln(string)

Description +
Transforms the passed argument to a string (only if necessary), appends an Html break <br> and appends the result to the response string buffer. Throws an error if no argument or an undefined argument is passed. Useful for debugging tasks.

Example +
res.writeln("Hello,"); +
res.write("World!"); +
Hello,<br> +
World!
+

Skin Object

+ +

+ +

+

allowMacro()

+ +

+ +

Syntax +
allowMacro(String)

Description +
This function is necessary to limit the range of allowed macros to be rendered to an explicit set. This is useful when text entered by non-trusted users is interpreted as skins to provide macro functions on a user-level.

Example +
Two macro functions defined in a JavaScript file: +
function isAllowed_macro() { +
  return("Hello"); +
} +
+
function isForbidden_macro() { +
  return("World"); +
}
+
+
The action that enables one of the macros: +
var str = "<% root.isAllowed %>, <% root.isForbidden %>!"; +
var skin = createSkin(str); +
// as soon as we call allowMacro() on a skin, only those +
// macros explicitely set are allowed to be evaluated. +
// all others will result in an error msg. +
skin.allowMacro("root.isAllowed"); +
renderSkin(skin); +
+
Hello, [Macro root.isForbidden not allowed in sandbox]!
+

containsMacro()

+ +

+ +

Syntax +
containsMacro(String)

Description +
This function checks whether a skin does contain the macro specified by the string parameter. This is thus useful to make sure a user-edited skin does not contain any macro with which the application would break.

Example +
var skin1 = createSkin("myMacro"); +
var skin2 = createSkin("<% myMacro %>"); +
res.writeln(skin1.containsMacro("myMacro")); +
false +
+
res.writeln(skin2.containsMacro("myMacro")); +
true
+

User Object

+ +

+ +

+

lastActive()

+ +

Determine the last time of a certain user being logged in. + +

Syntax +
user.lastActive()

Description +
Returns a Date Object of the timestamp the current user was logged in the last time. Please note that you can use this function with the user prototype only, not with any user HopObject.

Example +
res.write(user.lastActive()) +
Thu Nov 02 16:12:13 GMT+01:00 2000
+

login()

+ +

+ +

Syntax +
UserObject.login(UserNameString, PasswordString)

Description +
Returns true if the user name / password pair match the stored values in the database. Otherwise it returns false.

Example +
var login = user.login("user", "pass"); +
if (login) +
   res.write("Welcome back!"); +
else +
   res.write("Oops, please try again..."); +
+
Welcome back!
+

onSince()

+ +

+ +

Syntax +
userObject.onSince()

Description +
Returns the date string of the time the user's session was started.

Example +
var usr = getUser("Tobi"); +
res.write(usr.onSince()); +
Fri Aug 10 16:36:36 GMT+02:00 2001
+

register()

+ +

+ +

Syntax +
userObject.register(usernameString, passwordString)

Description +
Stores this user in the database using two arguments as user name and password phrase. Returns a valid user HopObject if the transaction was successful, false otherwise (e.g. if a user HopObject with the same name already exists). Additional properties can be attached to the user HopObject the usual way, then.

Example +
var newUser = user.register("snoopy", "woodstock"); +
res.write(newUser); +
HopObject snoopy +
+
newUser.email = "snoopy@peanuts.com"; +
newUser.fullname = "Snoop Doggy Dogg";
+

touch()

+ +

+ +

Syntax +
UserObject.touch()

Description +
Refreshes the user's session, moving its expiration date to now plus session timeout unless it is "touched" again either by the user requesting a page or calling touch().

Example +
var usr = getUser("tobi"); +
usr.touch();
+

uid

+ +

+ +

Syntax +
UserObject.uid

Description +
Returns the database-internal id of the current user. If the user is logged into the application uid is set, otherwise it is null.

Example +
res.writeln(user); +
res.writeln(user.uid); +
TransientNode [session cache] +
null
+
+
res.writeln(user); +
res.writeln(user.uid); +
HopObject tobi +
tobi
+

XML and HTML Parsing

+ +

+ +

Syntax +
getXmlDocument(XmlString) +
getXmlDocument(UrlString) +
getXmlDocument(java.io.InputStream) +
getXmlDocument(java.io.Reader) +
+
getHtmlDocument(HtmlString) +
getHtmlDocument(UrlString) +
getHtmlDocument(java.io.InputStream) +
getHtmlDocument(java.io.Reader) +
+
jdomize(DomDocument)

Description +
The Xml and Html parsing functions take one parameter and try to parse it into a Dom document object. If the document could not be retrieved or contains invalid markup, the functions return null. +
+
The Dom object can be processed according to the Java language binding for Dom Level 1. +
+
Be sure to update your Helma 1.x installation with the patched openxml.jar file for this to work. +
+
As an alternative to the W3C Dom Api, Dom documents may be transformed into JDOM documents using the global jdomize() function. JDom documents are far easier to handle than Dom documents. Be sure to have the jdom.jar file in your classpath for this to work.

Example +
This .hac file fetches an Xml document containing news headlines and generates some simple Html output. +
+
var xmltext = getXmlDocument("http://www.salon.at/news/lxml"); +
if (xmltext == null) +
 res.write("Error retrieving Xml document!"); +
else { +
 var newslist = xmltext.firstChild.childNodes; +
 for (var i=0; i<newslist.length; i++) { +
  var newsitem = newslist.item(i); +
  // make sure we only look at <headline> elements, +
  // ignoring whitespace CDATA +
  if (newsitem.nodeName == "headline") { +
   // get the <title> element +
   var titleElem = newsitem.getElementsByTagName("title").item(0); +
   // get the character data contained in it +
   var title = titleElem.firstChild.nodeValue; +
   // get the <url> element +
   var urlElem = newsitem.getElementsByTagName("url").item(0); +
   // get the actual url character data +
   var url = urlElem.firstChild.nodeValue +
   res.write ("<a href='"+url+"'>"+encode(title)+"</a><br>"); +
  } +
 } +
}
+

XML-RPC

+ +

+ +

Remote procedure calls via Xml-Rpc are very straightforward with the Hop for both client and server side. +

XML-RPC Client

+ +

+ +

Description +
Xml-Rpc calls are performed using a Remote object. Remote objects are created with the Url of the Xml-Rpc service. Functions of the remote Xml-Rpc service can then be called just like local functions. +
+
To compensate for the missing exception handling, Remote objects return result wrappers which contain either the result of the remote function, or a description of the error if one occurred. +
+
Example +
var xr = new Remote("http://helma.domain.tld:5056/"); +
var msg1 = xr.helmaorg.getXmlRpcMessage(); +
if (msg1.error) +
   res.write(msg1.error); +
else +
   res.write(msg1.result); +
+
Hello, Xml-Rpc World! +
+
var msg2 = xr.hotelGuide.hotels.grandimperial.getXmlRpcMessage(); +
if (!msg2.error) +
   res.write(msg2.result); +
+
Welcome to the Grand Imperial Hotel, Vienna! +
+
var msg3 = xr.kolin.document.comments["23"].getXmlRpcMessage(); +
if (!msg3.error) +
   res.write(msg3.result); +
+
Here you can write your comments. +
+
var xr = new Remote("http://betty.userland.com/RPC2"); +
var state = xr.examples.getStateName(23); +
if (!state.error) +
   res.write(state.result); +
+
Minnesota
+
+

XML-RPC Server

+ +

+ +

Description +
The Helma Xml-Rpc server is running on port 5056 by default, or port+1 if the -p command line parameter is specified. +
+
You can make any Helma function callable via Xml-Rpc. To do so, the function needs to be added to the XmlRpcAccess property in the app.properties file. +
+
For example, if you have two functions, listThings() and addThing(), in the root prototype you want to call via Xml-Rpc, add the following line to the app.properties file of your application: +
+
XmlRpcAccess = root.listThings, myprototype.addThing +
+
Xml-Rpc function names have the application name as first element followed by an optional object path within the application and the actual function name. Thus, a function called sayHello() in the root directory of an application called myapp would result in an Xml-Rpc function name of myapp.sayHello. +
+
There are a few things to consider when working with server side Xml-Rpc:

  • There is no Helma user object associated with an Xml-Rpc request.

  • +
  • There is no request object associated with an Xml-Rpc request.

  • +
  • You can pass any primitive Javascript types as parameters as well as objects and arrays, but should not pass a persistent HopObject directly as parameter or return value. Xml-Rpc can't handle objects with circular references, i.e. if obj1 has a reference to obj2, obj2 must not have a reference to obj1.
+ + + + + + diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 71690dc7..00000000 --- a/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.console = plain - -function = diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 1b33c55b..00000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 002b867c..00000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew deleted file mode 100755 index 23d15a93..00000000 --- a/gradlew +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH="\\\"\\\"" - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index 5eed7ee8..00000000 --- a/gradlew.bat +++ /dev/null @@ -1,94 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH= - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/hop.bat b/hop.bat new file mode 100755 index 00000000..ad4d6968 --- /dev/null +++ b/hop.bat @@ -0,0 +1,79 @@ +@echo off +rem Batch file for Starting Helma with a JDK-like virtual machine. + +rem To add jar files to the classpath, simply place them into the +rem lib/ext directory of this Helma installation. + +:: Initialize variables +:: (don't touch this section) +set JAVA_HOME= +set HOP_HOME= +set HTTP_PORT= +set XMLRPC_PORT= +set AJP13_PORT= +set RMI_PORT= +set OPTIONS= + +:: Set TCP ports for Helma servers +:: (comment/uncomment to de/activate) +set HTTP_PORT=8080 +rem set XMLRPC_PORT=8081 +rem set AJP13_PORT=8009 +rem set RMI_PORT=5050 + +:: Uncomment to set HOP_HOME +rem set HOP_HOME=c:\program files\helma + +:: Uncomment to set JAVA_HOME variable +rem set JAVA_HOME=c:\program files\java + +:: Uncomment to pass options to the Java virtual machine +rem set JAVA_OPTIONS=-server -Xmx128m + +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: No user configuration needed below this line ::::::: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Setting the script path +set SCRIPT_DIR=%~d0%~p0 + +:: Using JAVA_HOME variable if defined. Otherwise, +:: Java executable must be contained in PATH variable +if "%JAVA_HOME%"=="" goto default + set JAVACMD=%JAVA_HOME%\bin\java + goto end +:default + set JAVACMD=java +:end + +:: Setting HOP_HOME to script path if undefined +if "%HOP_HOME%"=="" ( + set HOP_HOME=%SCRIPT_DIR% +) +cd %HOP_HOME% + + +:: Setting Helma server options +if not "%HTTP_PORT%"=="" ( + echo Starting HTTP server on port %HTTP_PORT% + set OPTIONS=%OPTIONS% -w %HTTP_PORT% +) +if not "%XMLRPC_PORT%"=="" ( + echo Starting XML-RPC server on port %XMLRPC_PORT% + set OPTIONS=%OPTIONS% -x %XMLRPC_PORT% +) +if not "%AJP13_PORT%"=="" ( + echo Starting AJP13 listener on port %AJP13_PORT% + set OPTIONS=%OPTIONS% -jk %AJP13_PORT% +) +if not "%RMI_PORT%"=="" ( + echo Starting RMI server on port %RMI_PORT% + set OPTIONS=%OPTIONS% -p %RMI_PORT% +) +if not "%HOP_HOME%"=="" ( + echo Serving applications from %HOP_HOME% + set OPTIONS=%OPTIONS% -h "%HOP_HOME% +) + +:: Invoking the Java virtual machine +%JAVACMD% %JAVA_OPTIONS% -jar launcher.jar %OPTIONS% diff --git a/hop.sh b/hop.sh new file mode 100755 index 00000000..1126339c --- /dev/null +++ b/hop.sh @@ -0,0 +1,68 @@ +#!/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 +# lib/ext directory. + +# uncomment to set JAVA_HOME variable +# JAVA_HOME=/usr/lib/java + +# uncomment to set HOP_HOME, otherwise we get it from the script path +# HOP_HOME=/usr/local/helma + +# options to pass to the Java virtual machine +# JAVA_OPTIONS="-server -Xmx128m" + +# Set TCP ports for Helma servers +# (comment/uncomment to de/activate) +HTTP_PORT=8080 +# XMLRPC_PORT=8081 +# AJP13_PORT=8009 +# RMI_PORT=5050 + +########################################################### +###### No user configuration needed below this line ####### +########################################################### + +# if JAVA_HOME variable is set, use it. Otherwise, Java executable +# must be contained in PATH variable. +if [ "$JAVA_HOME" ]; then + JAVACMD="$JAVA_HOME/bin/java" +else + JAVACMD=java +fi + +# 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 + # strip everyting behind last slash + HOP_HOME="${0%/*}" + cd $HOP_HOME + HOP_HOME=$PWD +else + cd $HOP_HOME +fi +echo "Starting Helma in directory $HOP_HOME" + +if [ "$HTTP_PORT" ]; then + SWITCHES="$SWITCHES -w $HTTP_PORT" + echo Starting HTTP server on port $HTTP_PORT +fi +if [ "$XMLRPC_PORT" ]; then + SWITCHES="$SWITCHES -x $XMLRPC_PORT" + echo Starting XML-RPC server on port $XMLRPC_PORT +fi +if [ "$AJP13_PORT" ]; then + SWITCHES="$SWITCHES -jk $AJP13_PORT" + echo Starting AJP13 listener on port $AJP13_PORT +fi +if [ "$RMI_PORT" ]; then + SWITCHES="$SWITCHES -p $RMI_PORT" + echo Starting RMI server on port $RMI_PORT +fi +if [ "$HOP_HOME" ]; then + SWITCHES="$SWITCHES -h $HOP_HOME" +fi + +# Invoking the Java VM +$JAVACMD $JAVA_OPTIONS -jar launcher.jar $SWITCHES diff --git a/launcher/build.gradle b/launcher/build.gradle deleted file mode 100644 index 7e1983a9..00000000 --- a/launcher/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -jar { - manifest { - from 'src/main/java/helma/main/launcher/manifest.txt' - } -} diff --git a/launcher/src/main/java/helma/main/launcher/Commandline.java b/launcher/src/main/java/helma/main/launcher/Commandline.java deleted file mode 100644 index 5dc211bd..00000000 --- a/launcher/src/main/java/helma/main/launcher/Commandline.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2003 Helma Software. All Rights Reserved. - * - * $RCSfile$ - * $Author$ - * $Revision$ - * $Date$ - */ - -package helma.main.launcher; - -import java.lang.reflect.*; - -/** - * Helma bootstrap class. Figures out Helma home directory, sets up class path and - * lauchnes main class. This class must be invoked from a jar file in order to work. - * - * @author Stefan Pollach - */ -public class Commandline { - - /** - * boot method for running a request from the command line. - * This retrieves the Helma home directory, creates the - * classpath, get the request properties, creates the app and - * runs it - *- - * @param args command line arguments - */ - public static void main(String[] args) { - try { - String installDir = Main.getInstallDir(args); - - ClassLoader loader = Main.createClassLoader(installDir); - - // get the main server class - Class clazz = loader.loadClass("helma.main.CommandlineRunner"); - Class[] cargs = new Class[]{args.getClass()}; - Method main = clazz.getMethod("main", cargs); - Object[] nargs = new Object[]{args}; - - // and invoke the static main(String, String[]) method - main.invoke(null, nargs); - } catch (Exception x) { - // unable to get Helma installation dir from launcher jar - x.printStackTrace(); - System.err.println("Unable to get Helma installation directory: "); - System.err.println(x.getMessage()); - System.exit(2); - } - } -} diff --git a/launcher/src/main/java/helma/main/launcher/Main.java b/launcher/src/main/java/helma/main/launcher/Main.java deleted file mode 100644 index d7060eda..00000000 --- a/launcher/src/main/java/helma/main/launcher/Main.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2003 Helma Software. All Rights Reserved. - * - * $RCSfile$ - * $Author$ - * $Revision$ - * $Date$ - */ - -package helma.main.launcher; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLDecoder; -import java.net.MalformedURLException; -import java.util.ArrayList; - -/** - * Helma bootstrap class. Basically this is a convenience wrapper that takes over - * the job of setting the class path and helma install directory before launching - * the static main(String[]) method in helma.main.Server. This class - * should be invoked from a jar file in the Helma install directory in order to - * be able to set up class and install paths. - */ -public class Main { - private Class serverClass; - private Object server; - - private static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - /** - * Helma boot method. This retrieves the Helma home directory, creates the - * classpath and invokes main() in helma.main.Server. - * - * @param args command line arguments - * - */ - public static void main(String[] args) { - Main main = new Main(); - main.init(args); - main.start(); - } - - public void init(String[] args) { - try { - String installDir = getInstallDir(args); - ClassLoader loader = createClassLoader(installDir); - // get the main server class - serverClass = loader.loadClass("helma.main.Server"); - Class[] cargs = new Class[]{args.getClass()}; - Method loadServer = serverClass.getMethod("loadServer", cargs); - Object[] nargs = new Object[]{args}; - // and invoke the static loadServer(String[]) method - server = loadServer.invoke(null, nargs); - Method init = serverClass.getMethod("init", EMPTY_CLASS_ARRAY); - init.invoke(server, EMPTY_OBJECT_ARRAY); - } catch (Exception x) { - // unable to get Helma installation dir from launcher jar - System.err.println("Unable to load Helma: "); - x.printStackTrace(); - System.exit(2); - } - } - - public void start() { - try { - Method start = serverClass.getMethod("start", EMPTY_CLASS_ARRAY); - start.invoke(server, EMPTY_OBJECT_ARRAY); - } catch (Exception x) { - // unable to get Helma installation dir from launcher jar - System.err.println("Unable to start Helma: "); - x.printStackTrace(); - System.exit(2); - } - } - - public void stop() { - try { - Method start = serverClass.getMethod("stop", EMPTY_CLASS_ARRAY); - start.invoke(server, EMPTY_OBJECT_ARRAY); - } catch (Exception x) { - // unable to get Helma installation dir from launcher jar - System.err.println("Unable to stop Helma: "); - x.printStackTrace(); - System.exit(2); - } - } - - public void destroy() { - try { - Method start = serverClass.getMethod("shutdown", EMPTY_CLASS_ARRAY); - start.invoke(server, EMPTY_OBJECT_ARRAY); - } catch (Exception x) { - // unable to get Helma installation dir from launcher jar - System.err.println("Unable to shutdown Helma: "); - x.printStackTrace(); - System.exit(2); - } - } - - static void addJars(ArrayList jarlist, File dir) throws MalformedURLException { - File[] files = dir.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - String n = name.toLowerCase(); - return n.endsWith(".jar") || n.endsWith(".zip"); //$NON-NLS-1$//$NON-NLS-2$ - } - }); - - if (files != null) { - for (int i = 0; i < files.length; i++) { - jarlist.add(new URL("file:" + files[i].getAbsolutePath())); //$NON-NLS-1$ - } - } - } - - /** - * Create a server-wide ClassLoader from our install directory. - * This will be used as parent ClassLoader for all application - * ClassLoaders. - * - * @param installDir - * @return the main classloader we'll be using - * @throws MalformedURLException - */ - public static ClassLoader createClassLoader(String installDir) - throws MalformedURLException, UnsupportedEncodingException { - - // decode installDir in case it is URL-encoded - installDir = URLDecoder.decode(installDir, System.getProperty("helma.urlEncoding", "UTF-8")); - - // set up the class path - File libdir = new File(installDir, "lib"); - ArrayList jarlist = new ArrayList(); - - // add all jar files from the lib directory - addJars(jarlist, libdir); - - // add all jar files from the lib/ext directory - addJars(jarlist, new File(libdir, "ext")); //$NON-NLS-1$ - - URL[] urls = new URL[jarlist.size()]; - - jarlist.toArray(urls); - - // find out if system classes should be excluded from class path - String excludeSystemClasses = System.getProperty("helma.excludeSystemClasses"); - - ClassLoader loader; - - if ("true".equalsIgnoreCase(excludeSystemClasses)) { - loader = new URLClassLoader(urls, null); - } else { - loader = new URLClassLoader(urls); - } - - // set the new class loader as context class loader - Thread.currentThread().setContextClassLoader(loader); - return loader; - } - - - /** - * Get the Helma install directory from the command line -i argument or - * from the Jar URL from which this class was loaded. Additionally, the - * System property "helma.home" is set to the install directory path. - * - * @param args - * @return the base install directory we're running in - * @throws IOException - * @throws MalformedURLException - */ - public static String getInstallDir(String[] args) - throws IOException, MalformedURLException { - // 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; - - // 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]; - } - } - - // try to get Helma installation directory - if (installDir == null) { - URL launcherUrl = ClassLoader.getSystemClassLoader() - .getResource("helma/main/launcher/Main.class"); //$NON-NLS-1$ - - // this is a JAR URL of the form - // jar:!/{entry} - // we strip away the jar: prefix and the !/{entry} suffix - // to get the original jar file URL - - String jarUrl = launcherUrl.toString(); - - if (!jarUrl.startsWith("jar:") || jarUrl.indexOf("!") < 0) { - installDir = System.getProperty("user.dir"); - System.err.println("Warning: Helma install dir not set by -i parameter "); - System.err.println(" and not started from launcher.jar. Using "); - System.err.println(" current working directory as install dir."); - } else { - jarUrl = jarUrl.substring(4); - - int excl = jarUrl.indexOf("!"); - jarUrl = jarUrl.substring(0, excl); - launcherUrl = new URL(jarUrl); - - File f = new File(launcherUrl.getPath()).getAbsoluteFile(); - - installDir = f.getParentFile().getCanonicalPath(); - } - } - // set System property - System.setProperty("helma.home", installDir); - // and return install dir - return installDir; - } - -} diff --git a/lib/activation.jar b/lib/activation.jar new file mode 100644 index 00000000..db4b1fb5 Binary files /dev/null and b/lib/activation.jar differ diff --git a/lib/apache-dom.jar b/lib/apache-dom.jar new file mode 100644 index 00000000..e1e980a0 Binary files /dev/null and b/lib/apache-dom.jar differ diff --git a/lib/crimson.jar b/lib/crimson.jar new file mode 100644 index 00000000..42658472 Binary files /dev/null and b/lib/crimson.jar differ diff --git a/lib/ext/.keep b/lib/ext/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/ext/mysql.jar b/lib/ext/mysql.jar new file mode 100644 index 00000000..32f04104 Binary files /dev/null and b/lib/ext/mysql.jar differ diff --git a/lib/gnu-regexp.jar b/lib/gnu-regexp.jar new file mode 100644 index 00000000..c3c8770b Binary files /dev/null and b/lib/gnu-regexp.jar differ diff --git a/lib/jdom.jar b/lib/jdom.jar new file mode 100644 index 00000000..7ccb9fda Binary files /dev/null and b/lib/jdom.jar differ diff --git a/lib/jetty.jar b/lib/jetty.jar new file mode 100644 index 00000000..a7ab11ec Binary files /dev/null and b/lib/jetty.jar differ diff --git a/lib/jimi.jar b/lib/jimi.jar new file mode 100644 index 00000000..8bed0837 Binary files /dev/null and b/lib/jimi.jar differ diff --git a/lib/mail.jar b/lib/mail.jar new file mode 100644 index 00000000..eb2269d7 Binary files /dev/null and b/lib/mail.jar differ diff --git a/lib/netcomponents.jar b/lib/netcomponents.jar new file mode 100644 index 00000000..21ce702d Binary files /dev/null and b/lib/netcomponents.jar differ diff --git a/lib/regexp.jar b/lib/regexp.jar new file mode 100644 index 00000000..3c21d4ed Binary files /dev/null and b/lib/regexp.jar differ diff --git a/lib/servlet.jar b/lib/servlet.jar new file mode 100644 index 00000000..d2f0db9d Binary files /dev/null and b/lib/servlet.jar differ diff --git a/lib/village.jar b/lib/village.jar new file mode 100644 index 00000000..74545253 Binary files /dev/null and b/lib/village.jar differ diff --git a/lib/xmlrpc.jar b/lib/xmlrpc.jar new file mode 100644 index 00000000..b360b037 Binary files /dev/null and b/lib/xmlrpc.jar differ diff --git a/license.txt b/license.txt new file mode 100644 index 00000000..5b5e251b --- /dev/null +++ b/license.txt @@ -0,0 +1,49 @@ + Copyright (c) 1999-2002 Helma Project. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. Products derived from this software may not be called "Helma" + or "Hop", nor may "Helma" or "Hop" appear in their name, without + prior written permission of the Helma Project Group. For written + permission, please contact helma@helma.org. + + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE HELMA PROJECT OR ITS + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +This product contains the FESI EcmaScript interpreter written by +Jean-Marc Lugrin (http://home.worldcom.ch/jmlugrin/fesi/). FESI is +released under the GNU Lesser General Public License (see licenses/lesser.txt). + +This product contains software from the Acme package written by Jef +Poskanzer. Please see the licensing terms in the Acme source code and check out +Jef's site at http://www.acme.com/. + +This product includes software developed by the Apache Software Foundation +released under the Apache Software License (licenses/apache.txt). + +This product includes software developed by the JDOM Project +(http://www.jdom.org/). Please see the licensing terms in licenses/jdom.txt + +This product includes software developed by the Word Wide Web Consortium +(http://www.w3c.org/). Please see the licensing terms in licenses/w3c.html. diff --git a/licenses/apache.txt b/licenses/apache.txt new file mode 100644 index 00000000..b37087c5 --- /dev/null +++ b/licenses/apache.txt @@ -0,0 +1,56 @@ +/* + * The Apache Software License, Version 1.1 + * + * + * Copyright (c) 1999 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Xerces" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation and was + * originally based on software copyright (c) 1999, International + * Business Machines, Inc., http://www.ibm.com. For more + * information on the Apache Software Foundation, please see + * . + */ diff --git a/licenses/jdom.txt b/licenses/jdom.txt new file mode 100644 index 00000000..2aad34f0 --- /dev/null +++ b/licenses/jdom.txt @@ -0,0 +1,56 @@ +/*-- + + $Id$ + + Copyright (C) 2000-2002 Brett McLaughlin & Jason Hunter. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the disclaimer that follows + these conditions in the documentation and/or other materials + provided with the distribution. + + 3. The name "JDOM" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact license@jdom.org. + + 4. Products derived from this software may not be called "JDOM", nor + may "JDOM" appear in their name, without prior written permission + from the JDOM Project Management (pm@jdom.org). + + In addition, we request (but do not require) that you include in the + end-user documentation provided with the redistribution and/or in the + software itself an acknowledgement equivalent to the following: + "This product includes software developed by the + JDOM Project (http://www.jdom.org/)." + Alternatively, the acknowledgment may be graphical using the logos + available at http://www.jdom.org/images/logos. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + This software consists of voluntary contributions made by many + individuals on behalf of the JDOM Project and was originally + created by Brett McLaughlin and + Jason Hunter . For more information on the + JDOM Project, please see . + + */ + diff --git a/modules/jala/licenses/id3.txt b/licenses/lesser.txt similarity index 99% rename from modules/jala/licenses/id3.txt rename to licenses/lesser.txt index 5ab7695a..b1e3f5a2 100644 --- a/modules/jala/licenses/id3.txt +++ b/licenses/lesser.txt @@ -2,7 +2,7 @@ Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. diff --git a/licenses/sun-javamail.txt b/licenses/sun-javamail.txt new file mode 100644 index 00000000..6984ddb7 --- /dev/null +++ b/licenses/sun-javamail.txt @@ -0,0 +1,170 @@ + Sun Microsystems, Inc. + Binary Code License Agreement + +READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSE TERMS +(COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA +PACKAGE. BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF +THIS AGREEMENT. IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE +YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END +OF THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY RETURN +THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF THE +SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END +OF THIS AGREEMENT. + +1. LICENSE TO USE. Sun grants you a non-exclusive and non-transferable +license for the internal use only of the accompanying software and +documentation and any error corrections provided by Sun (collectively +"Software"), by the number of users and the class of computer hardware for +which the corresponding fee has been paid. + +2. RESTRICTIONS. Software is confidential and copyrighted. Title to +Software and all associated intellectual property rights is retained by Sun +and/or its licensors. Except as specifically authorized in any Supplemental +License Terms, you may not make copies of Software, other than a single copy +of Software for archival purposes. Unless enforcement is prohibited by +applicable law, you may not modify, decompile, or reverse engineer +Software. You acknowledge that Software is not designed, licensed or +intended for use in the design, construction, operation or maintenance of +any nuclear facility. Sun disclaims any express or implied warranty of +fitness for such uses. No right, title or interest in or to any trademark, +service mark, logo or trade name of Sun or its licensors is granted under +this Agreement. + +3. LIMITED WARRANTY. Sun warrants to you that for a period of ninety (90) +days from the date of purchase, as evidenced by a copy of the receipt, the +media on which Software is furnished (if any) will be free of defects in +materials and workmanship under normal use. Except for the foregoing, +Software is provided "AS IS". Your exclusive remedy and Sun's entire +liability under this limited warranty will be at Sun's option to replace +Software media or refund the fee paid for Software. + +4. DISCLAIMER OF WARRANTY. UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS +OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED +WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS +ARE HELD TO BE LEGALLY INVALID. + +5. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO +EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR +DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE +DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT +OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will Sun's +liability to you, whether in contract, tort (including negligence), or +otherwise, exceed the amount paid by you for Software under this Agreement. +The foregoing limitations will apply even if the above stated warranty fails +of its essential purpose. + +6. Termination. This Agreement is effective until terminated. You may +terminate this Agreement at any time by destroying all copies of Software. +This Agreement will terminate immediately without notice from Sun if you +fail to comply with any provision of this Agreement. Upon Termination, you +must destroy all copies of Software. + +7. Export Regulations. All Software and technical data delivered under this +Agreement are subject to US export control laws and may be subject to export +or import regulations in other countries. You agree to comply strictly with +all such laws and regulations and acknowledge that you have the +responsibility to obtain such licenses to export, re-export, or import as +may be required after delivery to you. + +8. U.S. Government Restricted Rights. If Software is being acquired by or +on behalf of the U.S. Government or by a U.S. Government prime contractor or +subcontractor (at any tier), then the Government's rights in Software and +accompanying documentation will be only as set forth in this Agreement; this +is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of +Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD +acquisitions). + +9. Governing Law. Any action related to this Agreement will be governed by +California law and controlling U.S. federal law. No choice of law rules of +any jurisdiction will apply. + +10. Severability. If any provision of this Agreement is held to be +unenforceable, this Agreement will remain in effect with the provision +omitted, unless omission would frustrate the intent of the parties, in which +case this Agreement will immediately terminate. + +11. Integration. This Agreement is the entire agreement between you and +Sun relating to its subject matter. It supersedes all prior or +contemporaneous oral or written communications, proposals, representations +and warranties and prevails over any conflicting or additional terms of any +quote, order, acknowledgment, or other communication between the parties +relating to its subject matter during the term of this Agreement. No +modification of this Agreement will be binding, unless in writing and signed +by an authorized representative of each party. + + + + JAVAMAIL, VERSION 1.2 + SUPPLEMENTAL LICENSE TERMS + +These supplemental license terms ("Supplemental Terms") add to or modify the +terms of the Binary Code License Agreement (collectively, the "Agreement"). +Capitalized terms not defined in these Supplemental Terms shall have the +same meanings ascribed to them in the Agreement. These Supplemental Terms +shall supersede any inconsistent or conflicting terms in the Agreement, or +in any license contained within the Software. + +1. Software Internal Use and Development License Grant. Subject to the +terms and conditions of this Agreement, including, but not limited to +Section 3 (Java(TM) Technology Restrictions) of these Supplemental Terms, +Sun grants you a non-exclusive, non-transferable, limited license to +reproduce internally and use internally the binary form of the Software, +complete and unmodified, for the sole purpose of designing, developing and +testing your Java applets and applications ("Programs"). + +2. License to Distribute Software. Subject to the terms and conditions of +this Agreement, including, but not limited to Section 3 (Java (TM) +Technology Restrictions) of these Supplemental Terms, Sun grants you a +non-exclusive, non-transferable, limited license to reproduce and distribute +the Software in binary code form only, provided that (i) you distribute the +Software complete and unmodified and only bundled as part of, and for the +sole purpose of running, your Java applets or applications ("Programs"), +(ii) the Programs add significant and primary functionality to the Software, +(iii) you do not distribute additional software intended to replace any +component(s) of the Software, (iv) you do not remove or alter any +proprietary legends or notices contained in the Software, (v) you only +distribute the Software subject to a license agreement that protects Sun's +interests consistent with the terms contained in this Agreement, and (vi) +you agree to defend and indemnify Sun and its licensors from and against any +damages, costs, liabilities, settlement amounts and/or expenses (including +attorneys' fees) incurred in connection with any claim, lawsuit or action by +any third party that arises or results from the use or distribution of any +and all Programs and/or Software. + +3. Java Technology Restrictions. You may not modify the Java Platform +Interface ("JPI", identified as classes contained within the "java" package +or any subpackages of the "java" package), by creating additional classes +within the JPI or otherwise causing the addition to or modification of the +classes in the JPI. In the event that you create an additional class and +associated API(s) which (i) extends the functionality of the Java platform, +and (ii) is exposed to third party software developers for the purpose of +developing additional software which invokes such additional API, you must +promptly publish broadly an accurate specification for such API for free use +by all developers. You may not create, or authorize your licensees to +create additional classes, interfaces, or subpackages that are in any way +identified as "java", "javax", "sun" or similar convention as specified by +Sun in any naming convention designation. + +4. Trademarks and Logos. You acknowledge and agree as between you and Sun +that Sun owns the SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, STARPORTAL +and iPLANET trademarks and all SUN, SOLARIS, JAVA, JINI, FORTE, STAROFFICE, +STARPORTAL and iPLANET-related trademarks, service marks, logos and other +brand designations ("Sun Marks"), and you agree to comply with the Sun +Trademark and Logo Usage Requirements currently located at +http://www.sun.com/policies/trademarks. Any use you make of the Sun Marks +inures to Sun's benefit. + +5. Source Code. Software may contain source code that is provided solely for +reference purposes pursuant to the terms of this Agreement. Source code may +not be redistributed unless expressly provided for in this Agreement. + +6. Termination for Infringement. Either party may terminate this Agreement +immediately should any Software become, or in either party's opinion be +likely to become, the subject of a claim of infringement of any intellectual +property right. + +For inquiries please contact: Sun Microsystems, Inc. 901 San Antonio Road, +Palo Alto, California 94303 + diff --git a/licenses/w3c.html b/licenses/w3c.html new file mode 100644 index 00000000..26049b75 --- /dev/null +++ b/licenses/w3c.html @@ -0,0 +1,100 @@ + + + + + W3C IPR SOFTWARE NOTICE + + +

+ W3C IPR SOFTWARE NOTICE +

+

+ Copyright © 2000 World Wide Web + Consortium, (Massachusetts + Institute of Technology, Institut + National de Recherche en Informatique et en Automatique, Keio University). All Rights + Reserved. +

+

+ The DOM bindings are published under the W3C Software Copyright Notice + and License. The software license requires "Notice of any changes or + modifications to the W3C files, including the date changes were made." + Consequently, modified versions of the DOM bindings must document that + they do not conform to the W3C standard; in the case of the IDL binding, + the pragma prefix can no longer be 'w3c.org'; in the case of the Java + binding, the package names can no longer be in the 'org.w3c' package. +

+

+ Note: The original version of the W3C Software Copyright Notice + and License could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720 +

+

+ Copyright © 1994-2000 World Wide Web + Consortium, (Massachusetts + Institute of Technology, Institut + National de Recherche en Informatique et en Automatique, Keio University). All Rights + Reserved. http://www.w3.org/Consortium/Legal/ +

+

+ This W3C work (including software, documents, or other related items) is + being provided by the copyright holders under the following license. By + obtaining, using and/or copying this work, you (the licensee) agree that + you have read, understood, and will comply with the following terms and + conditions: +

+

+ Permission to use, copy, and modify this software and its documentation, + with or without modification,  for any purpose and without fee or + royalty is hereby granted, provided that you include the following on ALL + copies of the software and documentation or portions thereof, including + modifications, that you make: +

+
    +
  1. + The full text of this NOTICE in a location viewable to users of the + redistributed or derivative work. +
  2. +
  3. + Any pre-existing intellectual property disclaimers, notices, or terms + and conditions. If none exist, a short notice of the following form + (hypertext is preferred, text is permitted) should be used within the + body of any redistributed or derivative code: "Copyright © + [$date-of-software] World Wide Web + Consortium, (Massachusetts + Institute of Technology, Institut + National de Recherche en Informatique et en Automatique, Keio University). All Rights + Reserved. http://www.w3.org/Consortium/Legal/" +
  4. +
  5. + Notice of any changes or modifications to the W3C files, including the + date changes were made. (We recommend you provide URIs to the location + from which the code is derived.) +
  6. +
+

+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT + HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR + DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, + TRADEMARKS OR OTHER RIGHTS. +

+

+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR + DOCUMENTATION. +

+

+ The name and trademarks of copyright holders may NOT be used in + advertising or publicity pertaining to the software without specific, + written prior permission. Title to copyright in this software and any + associated documentation will at all times remain with copyright + holders. +

+ + diff --git a/modules/README.md b/modules/README.md deleted file mode 100644 index a067850e..00000000 --- a/modules/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Helma Modules - -The Helma modules directory is organized in several groups: - -* **modules/core** which contains extensions to core JavaScript types such as -Object, Array, or Date. -* **modules/helma** which provide new functionality to JavaScript, usually by -wrapping a Java library. -* **modules/jala**, a Git submodule providing the very useful ORF.at libraries for Helma - -To use a HelmaLib module in your Helma application, you need to add it to the -app's repositories. The simplest way to do so is by using the `app.addRepository()` -function: - - app.addRepository('modules/helma/Search.js'); diff --git a/modules/core/Array.js b/modules/core/Array.js deleted file mode 100644 index 450380e7..00000000 --- a/modules/core/Array.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Array.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Adds useful methods to the JavaScript Array type. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/Array.js') - */ - -/** - * Check if this array contains a specific value. - * @external - * @memberof {Array} - * @param {Object} val the value to check - * @return {boolean} true if the value is contained - */ -Array.prototype.contains = Array.prototype.includes - -/** - * Retrieve the union set of a bunch of arrays - * @external - * @memberof {Array} - * @param {Array} array1,... the arrays to unify - * @return {Array} the union set - */ -Array.union = function() { - return Array.from(arguments).reduce((result, array) => { - return result.concat(array.filter(element => !result.includes(element))); - }, []); -}; - -/** - * Retrieve the intersection set of a bunch of arrays - * @external - * @memberof {Array} - * @param {Array} array1,... the arrays to intersect - * @return {Array} the intersection set - */ -Array.intersection = function() { - return Array.from(arguments).reduce((result, array) => { - return result.filter(element => array.includes(element)); - }); -}; - -// prevent any newly added properties from being enumerated -for (var i in Array) - Array.dontEnum(i); -for (var i in Array.prototype) - Array.prototype.dontEnum(i); diff --git a/modules/core/Date.js b/modules/core/Date.js deleted file mode 100644 index 76bc5f36..00000000 --- a/modules/core/Date.js +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2005 Helma Software. All Rights Reserved. - * - * $RCSfile: Date.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Adds useful methods to the JavaScript Date type. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/Date.js') - */ - -Date.ONESECOND = 1000; -Date.ONEMINUTE = 60 * Date.ONESECOND; -Date.ONEHOUR = 60 * Date.ONEMINUTE; -Date.ONEDAY = 24 * Date.ONEHOUR; -Date.ONEWEEK = 7 * Date.ONEDAY; -Date.ONEMONTH = 30 * Date.ONEDAY; -Date.ONEYEAR = 12 * Date.ONEMONTH; -Date.ISOFORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; - - -/** - * Format a Date to a string. - * For details on the format pattern, see - * http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html * - * @external - * @memberof {Date} - * - * @param String Format pattern - * @param Object Java Locale Object (optional) - * @param Object Java TimeZone Object (optional) - * @return String formatted Date - * @see http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html - */ -Date.prototype.format = function (format, locale, timezone) { - if (!format) - return this.toString(); - var sdf = locale ? new java.text.SimpleDateFormat(format, locale) - : new java.text.SimpleDateFormat(format); - if (timezone && timezone != sdf.getTimeZone()) - sdf.setTimeZone(timezone); - return sdf.format(this); -}; - - -/** - * set the date/time to UTC by subtracting - * the timezone offset - * @external - * @memberof {Date} - */ -Date.prototype.toUtc = function() { - this.setMinutes(this.getMinutes() + this.getTimezoneOffset()); -}; - - -/** - * set the date/time to local time by adding - * the timezone offset - * @external - * @memberof {Date} - */ -Date.prototype.toLocalTime = function() { - this.setMinutes(this.getMinutes() - this.getTimezoneOffset()); -}; - - -/** - * returns the difference between this and another - * date object in milliseconds - * @external - * @memberof {Date} - */ -Date.prototype.diff = function(dateObj) { - return this.getTime() - dateObj.getTime(); -}; - - -/** - * return the timespan to current date/time or a different Date object - * @external - * @memberof {Date} - * @param Object parameter object containing optional properties: - * .now = String to use if difference is < 1 minute - * .day|days = String to use for single|multiple day(s) - * .hour|hours = String to use for single|multiple hour(s) - * .minute|minutes = String to use for single|multiple minute(s) - * .date = Date object to use for calculating the timespan - * @return Object containing properties: - * .isFuture = (Boolean) - * .span = (String) timespan - * @see Date.prototype.getAge - * @see Date.prototype.getExpiry - */ -Date.prototype.getTimespan = function(param) { - if (!param) - param = {date: new Date()}; - else if (!param.date) - param.date = new Date(); - - var result = {isFuture: this > param.date}; - var diff = Math.abs(param.date.diff(this)); - var age = {days: Math.floor(diff / Date.ONEDAY), - hours: Math.floor((diff % Date.ONEDAY) / Date.ONEHOUR), - minutes: Math.floor((diff % Date.ONEHOUR) / Date.ONEMINUTE)}; - - res.push(); - if (diff < Date.ONEMINUTE) - res.write(param.now || "now"); - else { - var arr = [{one: "day", many: "days"}, - {one: "hour", many: "hours"}, - {one: "minute", many: "minutes"}]; - for (var i in arr) { - var value = age[arr[i].many]; - if (value != 0) { - var prop = (value == 1 ? arr[i].one : arr[i].many); - res.write(value); - res.write(" "); - res.write(param[prop] || prop); - if (i < arr.length -1) - res.write(param.delimiter || ", "); - } - } - } - result.span = res.pop(); - return result; -}; - - -/** - * return the past timespan between this Date object and - * the current Date or a different Date object - * @see Date.prototype.getTimespan - * @external - * @memberof {Date} - */ -Date.prototype.getAge = function(param) { - var age = this.getTimespan(param); - if (!age.isFuture) - return age.span; - return null; -}; - - -/** - * return the future timespan between this Date object and - * the current Date or a different Date object - * @see Date.prototype.getTimespan - * @external - * @memberof {Date} - */ -Date.prototype.getExpiry = function(param) { - var age = this.getTimespan(param); - if (age.isFuture) - return age.span; - return null; -}; - - -/** - * checks if a date object equals another date object - * @external - * @memberof {Date} - * @param Object Date object to compare - * @param Int indicating how far the comparison should go - * @return Boolean - */ -Date.prototype.equals = function(date, extend) { - if (!extend) - extend = Date.ONEDAY; - switch (extend) { - case Date.ONESECOND: - if (this.getSeconds() != date.getSeconds()) - return false; - case Date.ONEMINUTE: - if (this.getMinutes() != date.getMinutes()) - return false; - case Date.ONEHOUR: - if (this.getHours() != date.getHours()) - return false; - case Date.ONEDAY: - if (this.getDate() != date.getDate()) - return false; - case Date.ONEMONTH: - if (this.getMonth() != date.getMonth()) - return false; - case Date.ONEYEAR: - if (this.getFullYear() != date.getFullYear()) - return false; - } - return true; -}; - - -// prevent any newly added properties from being enumerated -for (var i in Date) - Date.dontEnum(i); -for (var i in Date.prototype) - Date.prototype.dontEnum(i); diff --git a/modules/core/Filters.js b/modules/core/Filters.js deleted file mode 100644 index f1b94acf..00000000 --- a/modules/core/Filters.js +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2007 Helma Software. All Rights Reserved. - * - * $RCSfile$ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Implements some useful macro filters. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/Filters.js') - */ - -app.addRepository('modules/core/String.js'); - -/** - * Transforms a string to lowercase. - * - * @see String.prototype.toLowerCase - */ -function lowercase_filter(input) { - return (input || "").toString().toLowerCase(); -} - - -/** - * Transforms a string to uppercase. - * - * @see String.prototype.toUpperCase - */ -function uppercase_filter(input) { - return (input || "").toString().toUpperCase(); -} - - -/** - * Transforms the first Character of a string to uppercase. - * - * @see String.prototype.capitalize - */ -function capitalize_filter(input) { - return (input || "").toString().capitalize(); -} - - -/** - * Transforms the first Character of each word in a string - * to uppercase. - * - * @see String.prototype.titleize - */ -function titleize_filter(input) { - return (input || "").toString().titleize(); -} - - -/** - * Cuts a String at a certain position, and - * optionally appends a suffix, if truncation - * has occurred. - * - * @see String.prototype.head - * @param limit Maximum length - * @param clipping Appended String, default is the empty String - */ -function truncate_filter(input, param, limit, clipping) { - var limit = param.limit != null ? param.limit : limit; - var clipping = param.clipping || clipping || ""; - return (input || "").toString().head(limit, clipping); -} - - -/** - * Removes leading and trailing whitespaces. - * - * @see String.prototype.trim - */ -function trim_filter(input) { - return (input || "").toString().trim(); -} - - -/** - * Removes all tags from a String. - * Currently simply wraps Helma's stripTags-method. - * - * @see global.stripTags - */ -function stripTags_filter(input) { - return stripTags((input || "").toString()); -}; - - -/** - * Escapes the characters in a String using XML entities. - * Currently simply wraps Helma's encodeXml-method. - * - * @see global.encodeXml - */ -function escapeXml_filter(input) { - return encodeXml((input || "").toString()); -} - - -/** - * Escapes the characters in a String using HTML entities. - * - * @see http://www.google.com/codesearch?q=escapeHtml - */ -function escapeHtml_filter(input) { - var replace = Packages.org.eclipse.jetty.util.StringUtil.replace; - var str = (input || "").toString(); - return replace(replace(replace(replace(str, '&', '&'), '"', '"'), '>', '>'), '<', '<'); -} - -var h_filter = escapeHtml_filter; - - -/** - * Escapes the characters in a String to be suitable - * to use as an HTTP parameter value. - * - * @see http://www.google.com/codesearch?q=escapeUrl - * @param charset Optional String. The name of a supported - * character encoding. - */ -function escapeUrl_filter(input, param, charset) { - var charset = param.charset || charset || app.getCharset(); - return java.net.URLEncoder.encode(input || "", charset); -} - - -/** - * Escapes a string so it may be used in JavaScript String - * definitions. - */ -function escapeJavaScript_filter(input) { - var replace = Packages.org.eclipse.jetty.util.StringUtil.replace; - var str = (input || "").toString(); - return replace(replace(replace(replace(replace(str, '"', '\\"'), "'", "\\'"), '\n', '\\n'), '\r', '\\r'), '\t', '\\t'); -} - - -/** - * Replaces linebreaks with HTML linebreaks. - */ -function linebreakToHtml_filter(input) { - var replace = Packages.org.eclipse.jetty.util.StringUtil.replace; - var str = (input || "").toString(); - return replace(str, '\n', '
'); -} - - -/** - * Performs a string replacement. - * - * @param old - * @param new - */ -function replace_filter(input, param, oldString, newString) { - var str = String(input || ''); - var oldString = param.old || oldString; - var newString = param['new'] || newString; - return str.replace(new RegExp(oldString, 'g'), newString); -} - - -/** - * Returns a substring. Simply wraps the javascript - * method 'substring'. - * - * @see String.prototype.substring - * @param from - * @param to - */ -function substring_filter(input, param, from, to) { - var from = param.from != null ? param.from : from; - var to = param.to != null ? param.to : to; - var str = (input || "").toString(); - return str.substring(from, to); -} - - -/** - * Returns a formatted string representation of a Date. - * Simply wraps javascripts Date.format-method. - * - * @see Date.prototype.format - * @param format - */ -function dateFormat_filter(input, param, format) { - var format = param.format || format; - if (!input) { - return; - } else { - return input.format(format); - } -} diff --git a/modules/core/Global.js b/modules/core/Global.js deleted file mode 100644 index 41e32357..00000000 --- a/modules/core/Global.js +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2005 Helma Software. All Rights Reserved. - * - * $RCSfile: Global.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Adds useful global macros. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/Global.js') - */ - -app.addRepository("modules/core/String.js"); - - -/** - * write out a property contained in app.properties - * @param Object containing the name of the property - */ -function property_macro(param, name) { - res.write(getProperty(name || param.name) || String.NULL); - return; -} - - -/** - * wrapper to output a string from within a skin - * just to be able to use different encodings - * @param Object containing the string as text property - */ -function write_macro(param, text) { - res.write(param.text || text || String.NULL); - return; -} - - -/** - * renders the current datetime - * @param Object containing a formatting string as format property - */ -function now_macro(param) { - var d = new Date(); - if (param.format) { - try { - res.write(d.format(param.format)); - } catch (e) { - res.write('[Invalid date format]'); - } - } else if (param.as == "timestamp") { - res.write(d.getTime()); - } else { - res.write(d); - } - return; -} - - -/** - * renders a global skin - */ -var skin_macro = function(param, name) { - var skinName = name || param.name; - if (skinName) { - renderSkin(skinName, param); - } - return; -} - -/** - * Encodes a string for HTML output and inserts linebreak tags. - * - * Performs the following string manipulations: - * All line breaks (i.e. line feeds) are replaced with
tags. - * All special characters are being replaced with their equivalent HTML entity. - * Existing markup tags are being encoded. - * - * @param {string} text - * The string to encode for HTML output. - * @param {boolean} [encodeNewLine = true] - * If or if not to encode line breaks (i.e. line feeds). - * @return {string} - * The encoded string. - */ -function encode(text, encodeNewLine) { - text = String(text); - - if (text === null || !text.length) return text; - var buffer = []; - if (typeof encodeNewLine === 'undefined') encodeNewLine = true; - - for (var i = 0, len = text.length; i < len; i += 1) { - var char = text.charAt(i); - - switch (char) { - case '<': - buffer.push('<'); - break; - - case '>': - buffer.push('>'); - break; - - case '&': - buffer.push('&'); - break; - - case '"': - buffer.push('"'); - break; - - case '\n': - if (encodeNewLine) { - buffer.push("
"); - } - buffer.push('\n'); - break; - - default: - buffer.push(char); - } - } - - return buffer.join(''); -} - -/** - * Encodes a string for XML output. - * - * Performs the following string manipulations: - * All special characters are being replaced with their equivalent HTML entity. - * Existing tags, single and double quotes, as well as ampersands are being encoded. - * Some invalid XML characters below '0x20' are removed - * - * @param {string} text - * The string to encode for XML output. - * @return {string} - * The string encoded for XML output. - */ -function encodeXml(text) { - text = String(text); - - if (text === null || !text.length) return text; - var buffer = []; - - for (var i = 0, len = text.length; i < len; i += 1) { - var char = text.charAt(i); - - switch (char) { - case '<': - buffer.push('<'); - break; - - case '>': - buffer.push('>'); - break; - - case '&': - buffer.push('&'); - break; - - case '"': - buffer.push('"'); - break; - - case '\'': - buffer.push('''); - break; - - default: - var charCode = text.charCodeAt(i); - if (charCode < 0x20) { - // sort out invalid XML characters below 0x20 - all but 0x9, 0xA and 0xD. - // The trick is an adaption of java.lang.Character.isSpace(). - if (((((1 << 0x9) | (1 << 0xA) | (1 << 0xD)) >> charCode) & 1) !== 0) { - buffer.push(char); - } - } else { - buffer.push(char); - } - } - } - - return buffer.join(''); -} - -/** - * Encodes a string for HTML output, leaving linebreaks untouched. - * - * Performs the following string manipulations: - * Unlike encode, leaves linebreaks untouched. This is what you usually want to do for encoding form content (esp. - * with text input values). - * All special characters (i.e. non ASCII) are being replaced with their equivalent HTML entity. - * Existing markup tags are being encoded. - * - * @param {string} text - * The string to format for HTML output. - * @return {string} - * The string formatted for HTML output. - */ -var encodeForm = function(text) { - text = String(text); - - if (text === null || !text.length) return text; - - return encode(text, false); -}; - -/** - * Removes any markup tags contained in the passed string, and returns the modified string. - * - * @param {string} markup - * The text that is to be stripped of tags. - * @return {string} - * The text with the tags stripped out. - */ -var stripTags = function (markup) { - if (!markup) return ''; - - var chars = String(markup).split(''); - var charCounter = 0; - var inTag = false; - - for (var i = 0, len = markup.length; i < len; i += 1) { - if (chars[i] === '<') inTag = true; - - if (!inTag) { - if (i > charCounter) { - chars[charCounter] = chars[i]; - } - - charCounter += 1; - } - - if (chars[i] === '>') { - inTag = false; - } - } - - if (i > charCounter) { - chars.length = charCounter; - return chars.join(''); - } - - return markup; -}; diff --git a/modules/core/HopObject.js b/modules/core/HopObject.js deleted file mode 100644 index 507177cb..00000000 --- a/modules/core/HopObject.js +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2005 Helma Software. All Rights Reserved. - * - * $RCSfile: HopObject.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Adds useful methods to Helma's built-in HopObject prototype. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/HopObject.js') - */ - -app.addRepository("modules/core/Number.js"); -app.addRepository("modules/core/String.js"); - - -/** - * Iterates over each child node of the HopObject. - * @external - * @memberof {HopObject} - * @param {Function} callback The callback function to be - * called for each child node. On every call the first - * argument of this function is set to the current value - * of the counter variable i. - */ -HopObject.prototype.forEach = function(callback) { - if (!callback || callback instanceof Function == false) { - return; - } - for (var i=0; iparam - * argument: - *
    - *
  1. param.none - not a single child node
  2. - *
  3. param.one - exactly one child node
  4. - *
  5. param.many - more than one child node
  6. - *
- * @external - * @memberof {HopObject} - * @param {Object} param The default macro parameter - * @param {String} name The default name for a child node - */ -HopObject.prototype.size_macro = function(param, name) { - var EMPTYSTR = ""; - var n = this.size(); - if (name) { - var text; - var plural = name.endsWith("s") ? "es" : "s"; - if (n > 0) { - if (n > 1) { - text = n + " " + name + plural; - } else { - text = (param.one !== null) ? param.one : "one " + name; - } - } else { - text = (param.none !== null) ? param.none : "no " + name + plural; - } - res.write(text); - } else { - res.write(n); - } - return; -}; diff --git a/modules/core/JSON.js b/modules/core/JSON.js deleted file mode 100644 index 56dfb991..00000000 --- a/modules/core/JSON.js +++ /dev/null @@ -1,2 +0,0 @@ -// This file intentionally left blank to prevent legacy code from -// breaking when trying to include the obsolete JSON module. diff --git a/modules/core/Number.js b/modules/core/Number.js deleted file mode 100644 index 1f460109..00000000 --- a/modules/core/Number.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Number.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Adds useful methods to the JavaScript Number type. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/Number.js') - */ - -/** - * format a Number to a String - * @external - * @memberof {Number} - * @param String Format pattern - * @param java.util.Locale An optional Locale instance - * @return String Number formatted to a String - */ -Number.prototype.format = function(fmt, locale) { - var symbols; - if (locale != null) { - symbols = new java.text.DecimalFormatSymbols(locale); - } else { - symbols = new java.text.DecimalFormatSymbols(); - } - var df = new java.text.DecimalFormat(fmt || "###,##0.##", symbols); - return df.format(0 + this); // addition with 0 prevents exception -}; - - -/** - * return the percentage of a Number - * according to a given total Number - * @external - * @memberof {Number} - * @param Int Total - * @param String Format Pattern - * @param java.util.Locale An optional Locale instance - * @return Int Percentage - */ -Number.prototype.toPercent = function(total, fmt, locale) { - if (!total) - return (0).format(fmt, locale); - var p = this / (total / 100); - return p.format(fmt, locale); -}; - - -/** - * factory to create functions for sorting objects in an array - * @external - * @memberof {Number} - * @param String name of the field each object is compared with - * @param Number order (ascending or descending) - * @return Function ready for use in Array.prototype.sort - */ -Number.Sorter = function(field, order) { - if (!order) - order = 1; - return function(a, b) { - return (a[field] - b[field]) * order; - }; -}; - -Number.Sorter.ASC = 1; -Number.Sorter.DESC = -1; - - -// prevent any newly added properties from being enumerated -for (var i in Number) - Number.dontEnum(i); -for (var i in Number.prototype) - Number.prototype.dontEnum(i); diff --git a/modules/core/Object.js b/modules/core/Object.js deleted file mode 100644 index 0bf53006..00000000 --- a/modules/core/Object.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Object.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Adds useful methods to the JavaScript Object type. - *

- * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/Object.js') - */ - -app.addRepository('modules/core/Global.js'); - -/** - * Copies the properties of this object into a clone. - * @external - * @memberof {Object} - * @param {Object} clone The optional target object - * @param {Boolean} recursive If true child objects are cloned as well, otherwise - * the clone contains references to the child objects - * @returns The resulting object - */ -Object.prototype.clone = function(clone, recursive) { - - var getValue = function(value, recursive) { - if (recursive !== true || value == null - || (typeof (value) !== "object" && typeof (value) !== "function")) { - return value; - } - return value.clone(null, recursive); - }; - - if (typeof (this) === "object") { - if (this === null) { - return null; - } - switch (this.constructor) { - case String: - case Number: - case Boolean: - case Date: - return new this.constructor(this.valueOf()); - - case Array: - return this.map(function(value) { - return getValue(value, recursive); - }); - - default: - if (clone == null) { - clone = new this.constructor(); - } - for ( var propName in this) { - clone[propName] = getValue(this[propName], recursive); - } - return clone; - } - } else if (typeof (this) === "function" && this.constructor === RegExp) { - return new RegExp(this.valueOf()); - } - return this; -}; - - -/** - * reduce an extended object (ie. a HopObject) - * to a generic javascript object - * @external - * @memberof {Object} - * @param HopObject the HopObject to be reduced - * @return Object the resulting generic object - */ -Object.prototype.reduce = function(recursive) { - var result = {}; - for (var i in this) { - if (this[i] instanceof HopObject == false) - result[i] = this[i]; - else if (recursive) - result[i] = this.reduce(true); - } - return result; -}; - - -/** - * print the contents of an object for debugging - * @external - * @memberof {Object} - * @param Object the object to dump - * @param Boolean recursive flag (if true, dump child objects, too) - */ -Object.prototype.dump = function(recursive) { - var beginList = "
    "; - var endList = "
"; - var beginItem = "
  • "; - var endItem = "
  • "; - var beginKey = ""; - var endKey = ": "; - res.write(beginList); - for (var p in this) { - res.write(beginItem); - res.write(beginKey); - res.write(p); - res.write(endKey); - if (recursive && typeof this[p] == "object") { - var recurse = true; - var types = [Function, Date, String, Number]; - for (var i in types) { - if (this[p] instanceof types[i]) { - recurse = false - break; - } - } - if (recurse == true) - this[p].dump(true); - else { - res.write(this[p].toSource()); - } - } else if (this[p]) { - res.write(encode(this[p].toSource())); - } - res.write(endItem); - } - res.write(endList); - return; -}; - - -// prevent any newly added properties from being enumerated -for (var i in Object) - Object.dontEnum(i); -for (var i in Object.prototype) - Object.prototype.dontEnum(i); diff --git a/modules/core/String.js b/modules/core/String.js deleted file mode 100644 index 9348d7b2..00000000 --- a/modules/core/String.js +++ /dev/null @@ -1,684 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: String.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -String.ANUMPATTERN = /[^a-zA-Z0-9]/; -String.APATTERN = /[^a-zA-Z]/; -String.NUMPATTERN = /[^0-9]/; -String.FILEPATTERN = /[^a-zA-Z0-9-_\. ]/; -String.HEXPATTERN = /[^a-fA-F0-9]/; -String.LEFT = -1 -String.BALANCE = 0 -String.RIGHT = 1 -String.ISOFORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; -String.SPACE = " "; -String.EMPTY = ""; -String.NULL = String.EMPTY; // to be deprecated? - -// Email and URL RegExps contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ -// licensed unter MIT license - http://www.opensource.org/licenses/mit-license.php - -String.EMAILPATTERN = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i; - -String.URLPATTERN = /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i; - -/** - * @fileoverview Adds useful methods to the JavaScript String type. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/core/String.js') - */ - -app.addRepository('modules/core/Global.js'); - -/** - * checks if a date format pattern is correct - * @external - * @memberof {String} - * @return Boolean true if the pattern is correct - */ -String.prototype.isDateFormat = function() { - try { - new java.text.SimpleDateFormat(this); - return true; - } catch (err) { - return false; - } -}; - - -/** - * parse a timestamp into a date object. This is used when users - * want to set createtime explicitly when creating/editing stories. - * @external - * @memberof {String} - * @param String date format to be applied - * @param Object Java TimeZone Object (optional) - * @return Object contains the resulting date - */ -String.prototype.toDate = function(format, timezone) { - var sdf = res.data._dateformat; - if (!sdf) { - sdf = new java.text.SimpleDateFormat(format); - res.data._dateformat = sdf; - } else if (format != sdf.toPattern()) - sdf.applyPattern(format); - if (timezone && timezone != sdf.getTimeZone()) - sdf.setTimeZone(timezone); - try { - return new Date(sdf.parse(this).getTime()); - } catch (err) { - return null; - } -}; - - -/** - * function checks if the string passed contains any characters that - * are forbidden in URLs and tries to create a java.net.URL from it - * FIXME: probably deprecated -> helma.Url - * @external - * @memberof {String} - * @return Boolean - * @see helma.Url.PATTERN - */ -String.prototype.isUrl = function() { - return String.URLPATTERN.test(this); -}; - - -/** - * function checks if the string passed contains any characters - * that are forbidden in image- or filenames - * @external - * @memberof {String} - * @return Boolean - */ -String.prototype.isFileName = function() { - return !String.FILEPATTERN.test(this); -}; - - -/** - * function cleans the string passed as argument from any characters - * that are forbidden or shouldn't be used in filenames - * @external - * @memberof {String} - * @return Boolean - */ -String.prototype.toFileName = function() { - return this.replace(new RegExp(String.FILEPATTERN.source, "g"), String.NULL); -}; - - -/** - * function checks a string for a valid color value in hexadecimal format. - * it may also contain # as first character - * @external - * @memberof {String} - * @returns Boolean false, if string length (without #) > 6 or < 6 or - * contains any character which is not a valid hex value - */ -String.prototype.isHexColor = function() { - var str = this; - if (this.indexOf("#") == 0) - str = this.substring(1); - if (str.length != 6) - return false; - return !String.HEXPATTERN.test(str); -}; - - -/** - * converts a string into a hexadecimal color - * representation (e.g. "ffcc33"). also knows how to - * convert a color string like "rgb (255, 204, 51)". - * @external - * @memberof {String} - * @return String the resulting hex color (w/o "#") - */ -String.prototype.toHexColor = function() { - if (this.startsWith("rgb")) { - res.push(); - var col = this.replace(/[^0-9,]/g, String.NULL); - var parts = col.split(","); - for (var i in parts) { - var num = parseInt(parts[i], 10); - var hex = num.toString(16); - res.write(hex.pad("0", 2, String.LEFT)); - } - return res.pop(); - } - var col = this.replace(new RegExp(String.HEXPATTERN.source), String.NULL); - return col.toLowerCase().pad("0", 6, String.LEFT); -}; - - -/** - * function returns true if the string contains - * only a-z and 0-9 (case insensitive!) - * @external - * @memberof {String} - * @return Boolean true in case string is alpha, false otherwise - */ -String.prototype.isAlphanumeric = function() { - if (!this.length) - return false; - return !String.ANUMPATTERN.test(this); -}; - - -/** - * function cleans a string by throwing away all - * non-alphanumeric characters - * @external - * @memberof {String} - * @return cleaned string - */ -String.prototype.toAlphanumeric = function() { - return this.replace(new RegExp(String.ANUMPATTERN.source, "g"), String.NULL); -}; - - -/** - * function returns true if the string contains - * only characters a-z - * @external - * @memberof {String} - * @return Boolean true in case string is alpha, false otherwise - */ -String.prototype.isAlpha = function() { - if (!this.length) - return false; - return !String.APATTERN.test(this); -}; - - -/** - * function returns true if the string contains - * only 0-9 - * @external - * @memberof {String} - * @return Boolean true in case string is numeric, false otherwise - */ -String.prototype.isNumeric = function() { - if (!this.length) - return false; - return !String.NUMPATTERN.test(this); -}; - - -/** - * transforms the first n characters of a string to uppercase - * @external - * @memberof {String} - * @param Number amount of characters to transform - * @return String the resulting string - */ -String.prototype.capitalize = function(limit) { - if (limit == null) - limit = 1; - var head = this.substring(0, limit); - var tail = this.substring(limit, this.length); - return head.toUpperCase() + tail.toLowerCase(); -}; - - -/** - * transforms the first n characters of each - * word in a string to uppercase - * @external - * @memberof {String} - * @return String the resulting string - */ -String.prototype.titleize = function() { - var parts = this.split(" "); - res.push(); - for (var i in parts) { - res.write(parts[i].capitalize()); - if (i < parts.length-1) - res.write(" "); - } - return res.pop(); -}; - - -/** - * translates all characters of a string into HTML entities - * @external - * @memberof {String} - * @return String translated result - */ -String.prototype.entitize = function() { - res.push(); - for (var i=0; i/g, replacement); - return str; -}; - - -/** - * function calculates the md5 hash of a string - * @external - * @memberof {String} - * @return String md5 hash of the string - */ -String.prototype.md5 = function() { - return Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(this); -}; - - -/** - * fills a string with another string up to a desired length - * @external - * @memberof {String} - * @param String the filling string - * @param Number the desired length of the resulting string - * @param Number the direction which the string will be padded in: - * -1: left 0: both (balance) 1: right - * (you can use the constants String.LEFT, - * String.BALANCE and String.RIGHT here as well.) - * @return String the resulting string - */ -String.prototype.pad = function(str, length, mode) { - if (mode === null || mode === String.RIGHT) return this.padEnd(length, str); - if (mode === String.LEFT) return this.padStart(length, str); - - if (mode === String.BALANCE && str && length) { - const pos = Math.ceil(this.length / 2); - const head = this.substr(0, pos); - const tail = this.substr(pos); - const additionalLength = (length - this.length) / 2; - const startLength = head.length + Math.floor(additionalLength); - const endLength = tail.length + Math.ceil(additionalLength); - return head.padStart(startLength, str) + tail.padEnd(endLength, str); - } - - return this; -}; - - -/** - * function returns true if a string contains the string - * passed as argument - * @external - * @memberof {String} - * @param String string to search for - * @param Int Position to start search - * @param Boolean - */ -String.prototype.contains = function(str, fromIndex) { - return this.indexOf(str, fromIndex || 0) > -1; -}; - - -/** - * function compares a string with the one passed as argument - * using diff - * @external - * @memberof {String} - * @param String String to compare against String object value - * @param String Optional regular expression string to use for - * splitting. If not defined, newlines will be used. - * @return Object Array containing one JS object for each line - * with the following properties: - * .num Line number - * .value String line if unchanged - * .deleted Obj Array containing deleted lines - * .inserted Obj Array containing added lines - */ -String.prototype.diff = function(mod, separator) { - // if no separator use line separator - var regexp = (typeof(separator) == "undefined") ? - new RegExp("\r\n|\r|\n") : - new RegExp(separator); - // split both strings into arrays - var orig = this.split(regexp); - var mod = mod.split(regexp); - // create the Diff object - var diff = new Packages.helma.util.Diff(orig, mod); - // get the diff. - var d = diff.diff(); - if (!d) - return null; - - var max = Math.max(orig.length, mod.length); - var result = new Array(); - for (var i=0;i -1) { - count += 1; - offset += 1; - } - return count; -}; - - -/** - * returns the string encoded using the base64 algorithm - * @external - * @memberof {String} - */ -String.prototype.enbase64 = function() { - var bytes = java.lang.String(this).getBytes('utf-8'); - return String(java.lang.String(Packages.org.apache.commons.codec.binary.Base64.encodeBase64(bytes), 'utf-8')); -}; - - -/** - * returns the decoded string using the base64 algorithm - * @external - * @memberof {String} - */ -String.prototype.debase64 = function() { - var bytes = Packages.org.apache.commons.codec.binary.Base64.decodeBase64(this); - return String(java.lang.String(bytes, 'utf-8')); -}; - - -// wrapper methods for string-related -// global helma functions - -String.prototype.encode = function() { - return encode(this); -}; - -String.prototype.encodeXml = function() { - return encodeXml(this); -}; - -String.prototype.encodeForm = function() { - return encodeForm(this); -}; - -String.prototype.format = function() { - return format(this); -}; - -String.prototype.stripTags = function() { - return stripTags(this); -}; - -/** - * factory to create functions for sorting objects in an array - * @external - * @memberof {String} - * @param String name of the field each object is compared with - * @param Number order (ascending or descending) - * @return Function ready for use in Array.prototype.sort - */ -String.Sorter = function(field, order) { - if (!order) - order = 1; - var key = field + ":" + order; - if (!String.Sorter.cache[key]) { - String.Sorter.cache[key] = function(a, b) { - var str1 = String(a[field] || String.NULL).toLowerCase(); - var str2 = String(b[field] || String.NULL).toLowerCase(); - if (str1 > str2) - return order * 1; - if (str1 < str2) - return order * -1; - return 0; - }; - } - return String.Sorter.cache[key]; -}; - -String.Sorter.ASC = 1; -String.Sorter.DESC = -1; -String.Sorter.cache = {}; - - -/** - * create a string from a bunch of substrings - * @external - * @memberof {String} - * @param String one or more strings as arguments - * @return String the resulting string - */ -String.compose = function() { - res.push(); - for (var i=0; i
    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Aspects.js') - */ - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Library for adding Aspects - *

    - * Provides static methods to wrap existing functions - * inside a javascript closure in order to add additional - * behavior without overriding the existing one. - *

    - * Based on code by roman porotnikov, - * http://www.jroller.com/page/deep/20030701 - *

    - * Note: Each prototype that uses aspects must implement a method - * onCodeUpdate() to prevent aspects being lost when the prototype - * is re-compiled - * - * @constructor - */ -helma.Aspects = function() { - return this; -}; - - -/** @ignore */ -helma.Aspects.toString = function() { - return "[helma.Aspects]"; -}; - - -/** @ignore */ -helma.Aspects.prototype.toString = function() { - return "[helma.Aspects Object]"; -}; - - -/** - * Adds a function to be called before the orginal function. - *

    - * The return value of the added function needs to provide the - * array of arguments that is passed to the original function. - * The added function receives an array of the original arguments, - * the original function and the scope object of the original - * function as its parameters. - * - * @param {Object} obj The object of which the original function is a property - * @param {String} fname The property name of the original function - * @param {Function} before The function to be called before the original function - * @returns Function A new function, wrapping the original function - * @type Function - */ -helma.Aspects.prototype.addBefore = function(obj, fname, before) { - var oldFunc = obj[fname]; - obj[fname] = function() { - return oldFunc.apply(this, before(arguments, oldFunc, this)); - } - return; -}; - - -/** - * Adds a function to be called after an existing function. - *

    - * The return value of the original function is passed to the - * added function as its first argument. In addition, the added - * function also receives an array of the original arguments, - * the original function and the scope object of the original - * function as additional parameters. - * - * @param {Object} obj as Object, the object of which the original function is a property - * @param {String} fname as String, the property name of the original function - * @param {Function} after as Function, the function to be called after the original function - * @returns Function A new function, wrapping the original function - * @type Function - */ -helma.Aspects.prototype.addAfter = function(obj, fname, after) { - var oldFunc = obj[fname]; - obj[fname] = function() { - return after(oldFunc.apply(this, arguments), arguments, oldFunc, this); - } - return; -}; - - -/** - * Wraps an additional function around the original function. - *

    - * The added function receives as its arguments an array of the original - * arguments, the original function and the scope object of the original - * function. The original function is not called directly and needs - * to be invoked by the added function. - * - * @param {Object} obj as Object, the object of which the original function is a property - * @param {String} fname as String, the property name of the original function - * @param {Function} around as Function, the function to be called inside the original function - * @returns Function A new function, wrapping the original function - * @type Function - */ -helma.Aspects.prototype.addAround = function(obj, fname, around) { - var oldFunc = obj[fname]; - obj[fname] = function() { - return around(arguments, oldFunc, this); - } - return; -}; - - -helma.lib = "Aspects"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; - - -helma.aspects = new helma.Aspects(); -helma.dontEnum("aspects"); diff --git a/modules/helma/Chart.js b/modules/helma/Chart.js deleted file mode 100644 index 6f699ebc..00000000 --- a/modules/helma/Chart.js +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Chart.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Fields and methods of the helma.Chart prototype - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Chart.js') - */ - -// take care of any dependencies -app.addRepository('modules/helma/jxl-2.5.7.jar'); - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Creates a new instance of helma.Chart - * @class Instances of this class are capable of reading - * Excel spreadsheets and rendering them as XHTML table. Internally - * helma.Chart uses the Java Excel API - * by Andy Khan. - * @param {String} fpath The path to the spreadsheet file - * @param {String} prefix An optional prefix to use for all - * stylesheet classes within the rendered table - * @param {String} sheetName The name of the sheet within the - * spreadsheet file to render. If this argument is omitted, the - * first sheet is rendered. - * @returns A newly created helma.Chart instance. - * @constructor - * @author Tobi Schaefer - */ -helma.Chart = function(fpath, prefix, sheetName) { - var JXLPKG = Packages.jxl.Workbook; - var JXLPKGNAME = "jxl.jar"; - var JXLPKGURL = "http://www.andykhan.com/jexcelapi/"; - - var workbook, file; - try { - file = new java.io.File(fpath); - workbook = JXLPKG.getWorkbook(file); - } catch (e) { - if (e instanceof TypeError == false) - throw(e); - throw("helma.Chart needs " + JXLPKGNAME + - " in lib/ext or application directory " + - "[" + JXLPKGURL + "]"); - } - - var getCellStyle = function(c) { - if (!c) - return; - var result = new Object(); - var format = c.getCellFormat(); - var font = format.getFont(); - if (font.getBoldWeight() > 400) - result.bold = true; - result.italic = font.isItalic(); - result.wrap = format.getWrap(); - var type = c.getType(); - var align = format.getAlignment().getDescription(); - if (align == "right" || type == "Number" || type == "Date") - result.align = "right"; - else if (align == "centre") - result.align = "center"; - return result; - } - - if (sheetName) { - var sheet = workbook.getSheet(sheetName); - } else { - var sheet = workbook.getSheet(0); - } - if (!sheet) - return; - - prefix = prefix ? prefix + "_" : "chart_"; - - /** - * Renders the Excel spreadsheet as XHTML table. - */ - this.render = function() { - res.write('\n'); - - var rowBuf = []; - var rows = sheet.getRows(); - var max = 0; - for (var i=0; i max) - max = row.length; - rowBuf.push(row); - } - - for (var i in rowBuf) { - res.write('\n'); - for (var n=0; n"); - if (style.bold) - res.write(""); - if (style.italic) - res.write(""); - } - else - res.write(">"); - res.write(str); - if (style) { - if (style.italic) - res.write(""); - if (style.bold) - res.write(""); - } - res.write('\n'); - } - res.write('\n'); - } - - res.write('
    \n'); - workbook.close(); - }; - - /** - * Returns the spreadsheet as rendered XHTML table. - * @returns The rendered spreadsheet table - * @type String - */ - this.renderAsString = function() { - res.push(); - this.render(); - return res.pop(); - }; - - /** @ignore */ - this.toString = function() { - return "[helma.Chart " + file + "]"; - }; - - for (var i in this) - this.dontEnum(i); - - return this; -} - - -/** @ignore */ -helma.Chart.toString = function() { - return "[helma.Chart]"; -}; - - -/** - * A simple example for using helma.Chart that renders - * the passed file as XHTML table to response. - * @param {String} file The path to the Excel spreadsheet file - */ -helma.Chart.example = function(file) { - // var file = "/path/to/file.xls"; - var chart = new helma.Chart(file); - chart.render(); - return; -}; - - -helma.lib = "Chart"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Color.js b/modules/helma/Color.js deleted file mode 100644 index 32e011ae..00000000 --- a/modules/helma/Color.js +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Color.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Fields and methods of the helma.Chart prototype - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Color.js') - */ - -// take care of any dependencies -app.addRepository("modules/core/String.js"); - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructs a new instance of helma.Color. - * @class Instances of this class provide methods for - * converting HTML color names into their corresponding - * RGB values and vice versa, or retrieving single RGB color values. - * @param {Number|String} R Either the red fraction of the color, - * or the name of the color. - * @param {Number} G The green fraction - * @param {Number} B The blue fraction - * @returns A newly created helma.Color instance - * @constructor - */ -helma.Color = function(R, G, B) { - var value = null; - var name = null; - var hex = null; - var rgb = null; - - /** - * Returns the decimal value of this color, or of a specified - * color channel. - * @param {String} channel An optional color channel which - * decimal value should be returned. Must be either "red", - * "green" or "blue". If no channel is specified this - * method returns the decimal value of the color itself. - * @returns The decimal value of this color or a single channel. - * @type Number - */ - this.valueOf = function(channel) { - if (channel) { - if (!rgb) { - var compose = function(n, bits) { - var div = Math.pow(2, bits); - remainder = n % div; - return Math.floor(n/div); - } - var remainder = value; - rgb = { - red: compose(remainder, 16), - green: compose(remainder, 8), - blue: compose(remainder, 0) - }; - } - return rgb[channel]; - } - return value; - }; - - /** - * Returns the hexidecimal value of this color (without - * a leading hash sign). - * @returns The hexidecimal value of this color - * @type String - */ - this.toString = function() { - if (!value) - return null; - if (!hex) - hex = value.toString(16).pad("0", 6, String.LEFT); - return hex; - }; - - - /** - * Returns the trivial name of this color - * @returns The trivial name of this color - * @type String - */ - this.getName = function() { - return helma.Color.COLORVALUES[value]; - }; - - /** - * Main constructor body - */ - if (arguments.length % 2 == 0) - throw("Insufficient arguments for creating Color"); - if (arguments.length == 1) { - if (R.constructor == Number) { - value = R; - } else if (R.constructor == String) { - R = R.toLowerCase(); - if (helma.Color.COLORNAMES[R]) { - this.name = R; - value = helma.Color.COLORNAMES[R]; - } else { - if (R.startsWith("#")) { - R = R.substring(1); - } - value = parseInt(R, 16); - this.name = helma.Color.COLORVALUES[value]; - } - } - } else { - value = R * Math.pow(2, 16) + G * Math.pow(2, 8) + B; - } - - if (value == null || isNaN(value)) - throw("helma.Color: invalid argument " + R); - - for (var i in this) - this.dontEnum(i); - - return this; -}; - - -/** - * Creates a new helma.Color instance based on a color name. - * @param {String} name The color name (eg. "darkseagreen") - * @returns An instance of helma.Color representing the color specified - * @type helma.Color - */ -helma.Color.fromName = function(name) { - var value = helma.Color.COLORNAMES[name.toLowerCase()]; - return new helma.Color(value || 0); -}; - - -/** - * Creates a new helma.Color instance based on a HSL color - * representation. This method is adapted from the HSLtoRGB - * conversion method as described at - * http://www1.tip.nl/~t876506/ColorDesign.html#hr. - * @param {Number} H The hue fraction of the color definition - * @param {Number} S The saturation fraction - * @param {Number} L The lightness fraction - * @returns An instance of helma.Color representing the corresponding - * RGB color definition. - * @type helma.Color - */ -helma.Color.fromHsl = function(H,S,L) { - function H1(H,S,L) { - var R = 1; var G = 6*H; var B = 0; - G = G*S + 1 - S; B = B*S + 1 - S; - R = R*L; G = G*L; B = B*L; - return [R,G,B]; - } - - function H2(H,S,L) { - var R = 1-6*(H - 1/6); var G = 1; var B = 0; - R = R*S + 1 - S; B = B*S + 1 - S; - R = R*L; G = G*L; B = B*L; - return [R,G,B]; - } - - function H3(H,S,L) { - var R = 0; var G = 1; var B = 6*(H - 1/3); - R = R*S + 1 - S; B = B*S + 1 - S; - R = R*L; G = G*L; B = B*L - return [R,G,B]; - } - - function H4(H,S,L) { - var R = 0; var G = 1-6*(H - 1/2); var B = 1; - R = R*S + 1 - S; G = G*S + 1 - S; - R = R*L; G = G*L; B = B*L; - return [R,G,B]; - } - - function H5(H,S,L) { - var R = 6*(H - 2/3); var G = 0; var B = 1; - R = R*S + 1 - S; G = G*S + 1 - S; - R = R*L; G = G*L; B = B*L; - return [R,G,B]; - } - - function H6(H,S,L) { - var R = 1; var G = 0; var B = 1-6*(H - 5/6); - G = G*S + 1 - S; B = B*S + 1 - S; - R = R*L; G = G*L; B = B*L; - return [R,G,B]; - } - - // H [0-1] is divided into 6 equal sectors. - // From within each sector the proper conversion function is called. - var rgb; - if (H < 1/6) rgb = H1(H,S,L); - else if (H < 1/3) rgb = H2(H,S,L); - else if (H < 1/2) rgb = H3(H,S,L); - else if (H < 2/3) rgb = H4(H,S,L); - else if (H < 5/6) rgb = H5(H,S,L); - else rgb = H6(H,S,L); - - return new helma.Color( - Math.round(rgb[0]*255), - Math.round(rgb[1]*255), - Math.round(rgb[2]*255) - ); -}; - - -/** - * Contains the hexadecimal values of named colors. - * @type Object - * @final - */ -helma.Color.COLORNAMES = { - black: 0x000000, - maroon: 0x800000, - green: 0x008000, - olive: 0x808000, - navy: 0x000080, - purple: 0x800080, - teal: 0x008080, - silver: 0xc0c0c0, - gray: 0x808080, - red: 0xff0000, - lime: 0x00ff00, - yellow: 0xffff00, - blue: 0x0000ff, - fuchsia: 0xff00ff, - aqua: 0x00ffff, - white: 0xffffff, - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - greenyellow: 0xadff2f, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - oldlace: 0xfdf5e6, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - whitesmoke: 0xf5f5f5, - yellowgreen: 0x9acd32 -}; - - -/** - * Contains the color names for specific hex values - * @type Object - * @final - */ -helma.Color.COLORVALUES = {}; - -for (var i in helma.Color.COLORNAMES) { - helma.Color.COLORVALUES[helma.Color.COLORNAMES[i]] = i; -} - - -/** @ignore */ -helma.Color.toString = function() { - return "[helma.Color]"; -}; - - -helma.lib = "Color"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Database.js b/modules/helma/Database.js deleted file mode 100644 index 23fb8150..00000000 --- a/modules/helma/Database.js +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Database.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Properties and methods of the helma.Database prototype. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Database.js') - */ - -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructor for Database objects, providing access through relational - * databases through JDBC. It is usually simpler to use one of the factory - * methods {@link #createInstance} or {@link #getInstance}. - * @class

    This class provides access to a relational database through JDBC. - * There are two convenient ways to create instances of this class.

    - * - *

    The first is to use {@link #getInstance helma.Database.getInstance()} - * to obtain a connection to a DB that is defined in the application's - * db.properties and managed by Helma. The second way is to define and create - * a database connection locally using - * {@link #createInstance helma.Database.createInstance()} and passing it - * all necessary parameters.

    - * - *

    This class provides two ways of interaction: - * The {@link #query} method allows to issue SQL queries, returning a result set. - * The {@link #execute} provides a way to issue SQL statements that do not - * return a result set.

    - * - *

    Database connections allocated by this class are be managed and eventually - * disposed by Helma.

    - * - * @param {DbSource} source instance of a helma.objectmodel.db.DbSource - * @constructor - */ -helma.Database = function(source) { - var Types = java.sql.Types; - var DbSource = Packages.helma.objectmodel.db.DbSource; - - if (typeof(source) == "string") - source = app.getDbSource(source); - if (!(source instanceof DbSource)) - throw "helma.Database requires a helma.objectmodel.db.DbSource argument"; - - /** - * Get the java.sql.Connection for this Database instance. This can be used - * to operate on the connection directly, without going through the helma.Database - * class. - * @return {java.sql.Connection} the JDBC connection - */ - this.getConnection = function() { - return source.getConnection(); - }; - - /** - * Returns the lower case name of the underlying database product. - * @return {String} the name of the DB product - */ - this.getProductName = function() { - return source.getConnection().getMetaData().getDatabaseProductName().toLowerCase(); - }; - - /** - * Returns true if this is an Oracle database. - * @return {boolean} true if this is an Oracle database. - */ - this.isOracle = function() { - return source.isOracle(); - }; - - /** - * Returns true if this is a MySQL database. - * @return {boolean} true if this is an MySQL database. - */ - this.isMySql = function() { - return source.isMySQL(); - }; - - /** - * Returns true if this is a PostgreSQL database. - * @return {boolean} true if this is a PostgreSQL database. - */ - this.isPostgreSql = function() { - return source.isPostgreSQL(); - }; - - /** - * Executes the given SQL statement. The result set is returned - * as JavaScript Array containing a JavaScript Object for each result. - * @param {String} sql an SQL query statement - * @return {Array} an Array containing the result set - */ - this.query = function(sql) { - var isLogSqlEnabled = (getProperty("logSQL", "false").toLowerCase() == "true"); - var logTimeStart = isLogSqlEnabled ? java.lang.System.currentTimeMillis() : 0; - var connection = source.getConnection(); - connection.setReadOnly(true); - var statement = connection.createStatement(); - var resultSet = statement.executeQuery(sql); - var metaData = resultSet.getMetaData(); - var max = metaData.getColumnCount(); - var types = []; - for (var i=1; i <= max; i++) { - types[i] = metaData.getColumnType(i); - } - var result = []; - while (resultSet.next()) { - var row = {} - for (var i=1; i<=max; i+=1) { - switch (types[i]) { - case Types.BIT: - case Types.BOOLEAN: - row[metaData.getColumnLabel(i)] = resultSet.getBoolean(i); - break; - case Types.TINYINT: - case Types.BIGINT: - case Types.SMALLINT: - case Types.INTEGER: - row[metaData.getColumnLabel(i)] = resultSet.getLong(i); - break; - case Types.REAL: - case Types.FLOAT: - case Types.DOUBLE: - case Types.DECIMAL: - case Types.NUMERIC: - row[metaData.getColumnLabel(i)] = resultSet.getDouble(i); - break; - case Types.VARBINARY: - case Types.BINARY: - case Types.LONGVARBINARY: - case Types.LONGVARCHAR: - case Types.CHAR: - case Types.VARCHAR: - case Types.CLOB: - case Types.OTHER: - row[metaData.getColumnLabel(i)] = resultSet.getString(i); - break; - case Types.DATE: - case Types.TIME: - case Types.TIMESTAMP: - row[metaData.getColumnLabel(i)] = resultSet.getTimestamp(i); - break; - case Types.NULL: - row[metaData.getColumnLabel(i)] = null; - break; - default: - row[metaData.getColumnLabel(i)] = resultSet.getString(i); - break; - } - } - result[result.length] = row; - } - var logTimeStop = isLogSqlEnabled ? java.lang.System.currentTimeMillis() : 0; - if (isLogSqlEnabled) { - var tableName = metaData.getColumnCount() > 0 ? metaData.getTableName(1) : null; - app.getLogger("helma." + app.name + ".sql").info("SQL DIRECT_QUERY " + (tableName || "-") + " " + (logTimeStop - logTimeStart) + ": " + sql); - } - try { - statement.close(); - resultSet.close(); - } catch (error) { - // ignore - } - return result; - }; - - /** - * Executes the given SQL statement, which may be an INSERT, UPDATE, - * or DELETE statement or an SQL statement that returns nothing, - * such as an SQL data definition statement. The return value is an integer that - * indicates the number of rows that were affected by the statement. - * @param {String} sql an SQL statement - * @return {int} either the row count for INSERT, UPDATE or - * DELETE statements, or 0 for SQL statements that return nothing - */ - this.execute = function(sql) { - var isLogSqlEnabled = (getProperty("logSQL", "false").toLowerCase() == "true"); - var logTimeStart = isLogSqlEnabled ? java.lang.System.currentTimeMillis() : 0; - var connection = source.getConnection(); - connection.setReadOnly(false); - var statement = connection.createStatement(); - var result; - try { - result = statement.executeUpdate(sql); - } finally { - try { - statement.close(); - } catch (error) { - // ignore - } - } - var logTimeStop = isLogSqlEnabled ? java.lang.System.currentTimeMillis() : 0; - if (isLogSqlEnabled) { - app.getLogger("helma." + app.name + ".sql").info("SQL DIRECT_EXECUTE - " + (logTimeStop - logTimeStart) + ": " + sql); - } - return result; - }; - - /** - * Return the name of the Helma DbSource object. - * @return {String} the DbSource name - */ - this.getName = function() { - return source.getName(); - }; - - /** - * Return the name of the JDBC driver used by this Database instance. - * @return {String} the JDBC driver name - */ - this.getDriverName = function() { - return source.getDriverName(); - }; - - /** - * @ignore - */ - this.toString = function() { - return "[helma.Database " + this.getName() + "]"; - }; - - for (var i in this) - this.dontEnum(i); - - return this; -}; - -/** - * Create a new Database instance using the given parameters. - *

    Some of the parameters support shortcuts for known database products. - * The url parameter recognizes the values "mysql", "oracle" and - * "postgresql". For those databases, it is also possible to pass just - * hostname or hostname:port as url - * parameters instead of the full JDBC URL.

    - * @param {String} driver the class name of the JDBC driver. As - * shortcuts, the values "mysql", "oracle" and "postgresql" are - * recognized. - * @param {String} url the JDBC URL. - * @param {String} name the name of the database to use - * @param {String} user the the username - * @param {String} password the password - * @return {helma.Database} a helma.Database instance - */ -helma.Database.createInstance = function(driver, url, name, user, password) { - var DbSource = Packages.helma.objectmodel.db.DbSource; - - if (!driver || !url || !name) - throw("Insufficient arguments to create helma.db.Connection"); - if (typeof password != "string") - password = ""; - - var MYSQL = "mysql"; - var ORACLE = "oracle"; - var POSTGRESQL = "postgresql"; - var JDBC = "jdbc:"; - var DRIVER_MYSQL = "com.mysql.jdbc.Driver"; - var DRIVER_ORACLE = "oracle.jdbc.driver.OracleDriver"; - var DRIVER_POSTGRESQL = "org.postgresql.Driver"; - - if (driver == MYSQL) { - driver = DRIVER_MYSQL; - if (url.indexOf(JDBC) != 0) - url = "jdbc:mysql://" + url + "/" + name; - } else if (driver == ORACLE) { - driver = DRIVER_ORACLE; - if (url.indexOf(JDBC) != 0) - url = "jdbc:oracle:thin:@" + url + ":" + name; - } else if (driver == POSTGRESQL) { - driver = DRIVER_POSTGRESQL; - if (url.indexOf(JDBC) != 0) - url = "jdbc:postgresql://" + url + "/" + name; - } - var props = new Packages.helma.util.ResourceProperties(); - props.put(name + ".url", url); - props.put(name + ".driver", driver); - if (user) { - props.put(name + ".user", user) - } - if (password) { - props.put(name + ".password", password); - } - return new helma.Database(new DbSource(name, props)); -} - -/** - * Get a Database instance using the Database source defined in the - * application's db.properties file with the given name. - * @param {String} name the name of the DB source as defined in db.properties - * @return {helma.Database} a helma.Database instance - */ -helma.Database.getInstance = function(name) { - return new helma.Database(app.getDbSource(name)); -} - -/** - * @ignore - */ -helma.Database.toString = function() { - return "[helma.Database]"; -}; - -/** - * @ignore - */ -helma.Database.example = function() { - var type = "mysql"; - var host = "localhost"; - var user = "root"; - var pw = ""; - var name = "mysql"; - var db = new helma.Database(type, host, user, pw, name); - var result = db.query("select count(*) from db"); - res.write(result.toSource()); - return; -}; - - -helma.lib = "Database"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/File.js b/modules/helma/File.js deleted file mode 100644 index c5ad66f6..00000000 --- a/modules/helma/File.js +++ /dev/null @@ -1,760 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2007 Helma Software. All Rights Reserved. - * - * $RCSfile: File.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Default properties and methods of the File prototype. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/File.js') - */ - - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - - -/** - * Constructor for File objects, providing read and - * write access to the file system. - * @class This class represents a local file or directory - * @param {String} path as String, can be either absolute or relative to the helma home directory - * @constructor - */ -helma.File = function(path) { - var BufferedReader = java.io.BufferedReader; - var File = java.io.File; - var Writer = java.io.Writer; - var FileReader = java.io.FileReader; - var PrintWriter = java.io.PrintWriter; - var FileOutputStream = java.io.FileOutputStream; - var OutputStreamWriter = java.io.OutputStreamWriter; - var FileInputStream = java.io.FileInputStream; - var InputStreamReader = java.io.InputStreamReader; - var EOFException = java.io.EOFException; - var IllegalStateException = java.lang.IllegalStateException; - var IllegalArgumentException = java.lang.IllegalArgumentException - - var self = this; - - var file; - try { - // immediately convert to absolute path - java.io.File is - // incredibly stupid when dealing with relative file names - if (arguments.length > 1) - file = new File(path, arguments[1]).getAbsoluteFile(); - else - file = new File(path).getAbsoluteFile(); - } catch (e) { - throw(e); - } - - var readerWriter; - var atEOF = false; - var lastLine = null; - - var setError = function(e) { - self.lastError = e; - }; - - this.lastError = null; - - /** @ignore */ - this.toString = function() { - return file.toString(); - }; - - /** - * Returns the name of the file or directory represented by this File object. - *

    - * This is just the last name in the pathname's name sequence. - * If the pathname's name sequence is empty, then the empty - * string is returned. - * - * @returns String containing the name of the file or directory - * @type String - */ - this.getName = function() { - var name = file.getName(); - return (name == null ? "" : name); - }; - - /** - * Returns true if the file represented by this File object - * is currently open. - * - * @returns Boolean - * @type Boolean - */ - this.isOpened = function() { - return (readerWriter != null); - }; - - /** - * Opens the file represented by this File object. If the file exists, - * it is used for reading, otherwise it is opened for writing. - * If the encoding argument is specified, it is used to read or write - * the file. Otherwise, the platform's default encoding is used. - * - * @param {Object} options an optional argument holder object. - * The following options are supported: - *
    • charset name of encoding to use for reading or writing
    • - *
    • append whether to append to the file if it exists
    - * @returns Boolean true if the operation succeeded - * @type Boolean - */ - this.open = function(options) { - if (self.isOpened()) { - setError(new IllegalStateException("File already open")); - return false; - } - // We assume that the BufferedReader and PrintWriter creation - // cannot fail except if the FileReader/FileWriter fails. - // Otherwise we have an open file until the reader/writer - // get garbage collected. - var charset = options && options.charset; - var append = options && options.append; - try { - if (file.exists() && !append) { - if (charset) { - readerWriter = new BufferedReader( - new InputStreamReader(new FileInputStream(file), charset)); - } else { - readerWriter = new BufferedReader(new FileReader(file)); - } - } else { - if (append && charset) { - readerWriter = new PrintWriter( - new OutputStreamWriter(new FileOutputStream(file, true), charset)); - } else if (append) { - readerWriter = new PrintWriter( - new OutputStreamWriter(new FileOutputStream(file, true))); - } else if (charset) { - readerWriter = new PrintWriter(file, charset); - } else { - readerWriter = new PrintWriter(file); - } - } - return true; - } catch (e) { - setError(e); - return false; - } - return; - }; - - /** - * Tests whether the file or directory represented by this File object exists. - * - * @returns Boolean true if the file or directory exists; false otherwise - * @type Boolean - */ - this.exists = function() { - return file.exists(); - }; - - /** - * Returns the pathname string of this File object's parent directory. - * - * @returns String containing the pathname of the parent directory - * @type String - */ - this.getParent = function() { - if (!file.getParent()) - return null; - return new helma.File(file.getParent()); - }; - - /** - * This methods reads characters until an end of line/file is encountered - * then returns the string for these characters (without any end of line - * character). - * - * @returns String of the next unread line in the file - * @type String - */ - this.readln = function() { - if (!self.isOpened()) { - setError(new IllegalStateException("File not opened")); - return null; - } - if (!(readerWriter instanceof BufferedReader)) { - setError(new IllegalStateException("File not opened for reading")); - return null; - } - if (atEOF) { - setError(new EOFException()); - return null; - } - if (lastLine != null) { - var line = lastLine; - lastLine = null; - return line; - } - var reader = readerWriter; - // Here lastLine is null, return a new line - try { - var line = readerWriter.readLine(); - if (line == null) { - atEOF = true; - setError(new EOFException()); - } - return line; - } catch (e) { - setError(e); - return null; - } - return; - }; - - /** - * Appends a string to the file represented by this File object. - * - * @param {String} what as String, to be written to the file - * @returns Boolean - * @type Boolean - * @see #writeln - */ - this.write = function(what) { - if (!self.isOpened()) { - setError(new IllegalStateException("File not opened")); - return false; - } - if (!(readerWriter instanceof PrintWriter)) { - setError(new IllegalStateException("File not opened for writing")); - return false; - } - if (what != null) { - readerWriter.print(what.toString()); - } - return true; - }; - - /** - * Appends a string with a platform specific end of - * line to the file represented by this File object. - * - * @param {String} what as String, to be written to the file - * @returns Boolean - * @type Boolean - * @see #write - */ - this.writeln = function(what) { - if (self.write(what)) { - readerWriter.println(); - return true; - } - return false; - }; - - /** - * Tests whether this File object's pathname is absolute. - *

    - * The definition of absolute pathname is system dependent. - * On UNIX systems, a pathname is absolute if its prefix is "/". - * On Microsoft Windows systems, a pathname is absolute if its prefix - * is a drive specifier followed by "\\", or if its prefix is "\\". - * - * @returns Boolean if this abstract pathname is absolute, false otherwise - * @type Boolean - */ - this.isAbsolute = function() { - return file.isAbsolute(); - }; - - /** - * Deletes the file or directory represented by this File object. - * - * @returns Boolean - * @type Boolean - */ - this.remove = function() { - if (self.isOpened()) { - setError(new IllegalStateException("An openened file cannot be removed")); - return false; - } - return file["delete"](); - }; - - /** - * List of all files within the directory represented by this File object. - *

    - * You may pass a RegExp Pattern to return just files matching this pattern. - *

    - * Example: var xmlFiles = dir.list(/.*\.xml/); - * - * @param {RegExp} pattern as RegExp, optional pattern to test each file name against - * @returns Array the list of file names - * @type Array - */ - this.list = function(pattern) { - if (self.isOpened()) - return null; - if (!file.isDirectory()) - return null; - if (pattern) { - var fileList = file.list(); - var result = []; - for (var i in fileList) { - if (pattern.test(fileList[i])) - result.push(fileList[i]); - } - return result; - } - return file.list(); - }; - - /** - * Purges the content of the file represented by this File object. - * - * @returns Boolean - * @type Boolean - */ - this.flush = function() { - if (!self.isOpened()) { - setError(new IllegalStateException("File not opened")); - return false; - } - if (readerWriter instanceof Writer) { - try { - readerWriter.flush(); - } catch (e) { - setError(e); - return false; - } - } else { - setError(new IllegalStateException("File not opened for write")); - return false; // not supported by reader - } - return true; - }; - - /** - * Closes the file represented by this File object. - * - * @returns Boolean - * @type Boolean - */ - this.close = function() { - if (!self.isOpened()) - return false; - try { - atEOF = false; - lastLine = null; - readerWriter.close(); - readerWriter = null; - return true; - } catch (e) { - setError(e); - readerWriter = null; - return false; - } - }; - - /** - * Returns the pathname string of this File object. - *

    - * The resulting string uses the default name-separator character - * to separate the names in the name sequence. - * - * @returns String of this file's pathname - * @type String - */ - this.getPath = function() { - var path = file.getPath(); - return (path == null ? "" : path); - }; - - /** - * Contains the last error that occured, if any. - * @returns String - * @type String - * @see #clearError - */ - this.error = function() { - if (this.lastError == null) { - return ""; - } else { - var exceptionName = this.lastError.getClass().getName(); - var l = exceptionName.lastIndexOf("."); - if (l > 0) - exceptionName = exceptionName.substring(l + 1); - return exceptionName + ": " + this.lastError.getMessage(); - } - }; - - /** - * Clears any error message that may otherwise be returned by the error method. - * - * @see #error - */ - this.clearError = function() { - this.lastError = null; - return; - }; - - /** - * Tests whether the application can read the file - * represented by this File object. - * - * @returns Boolean true if the file exists and can be read; false otherwise - * @type Boolean - */ - this.canRead = function() { - return file.canRead(); - }; - - /** - * Tests whether the file represented by this File object is writable. - * - * @returns Boolean true if the file exists and can be modified; false otherwise. - * @type Boolean - */ - this.canWrite = function() { - return file.canWrite(); - }; - - /** - * Returns the absolute pathname string of this file. - *

    - * If this File object's pathname is already absolute, then the pathname - * string is simply returned as if by the getPath() method. If this - * abstract pathname is the empty abstract pathname then the pathname - * string of the current user directory, which is named by the system - * property user.dir, is returned. Otherwise this pathname is resolved - * in a system-dependent way. On UNIX systems, a relative pathname is - * made absolute by resolving it against the current user directory. - * On Microsoft Windows systems, a relative pathname is made absolute - * by resolving it against the current directory of the drive named by - * the pathname, if any; if not, it is resolved against the current user - * directory. - * - * @returns String The absolute pathname string - * @type String - */ - this.getAbsolutePath = function() { - var absolutPath = file.getAbsolutePath(); - return (absolutPath == null ? "" : absolutPath); - }; - - /** - * Returns the length of the file represented by this File object. - *

    - * The return value is unspecified if this pathname denotes a directory. - * - * @returns Number The length, in bytes, of the file, or 0L if the file does not exist - * @type Number - */ - this.getLength = function() { - return file.length(); - }; - - /** - * Tests whether the file represented by this File object is a directory. - * - * @returns Boolean true if this File object is a directory and exists; false otherwise - * @type Boolean - */ - this.isDirectory = function() { - return file.isDirectory(); - }; - - /** - * Tests whether the file represented by this File object is a normal file. - *

    - * A file is normal if it is not a directory and, in addition, satisfies - * other system-dependent criteria. Any non-directory file created by a - * Java application is guaranteed to be a normal file. - * - * @returns Boolean true if this File object is a normal file and exists; false otherwise - * @type Boolean - */ - this.isFile = function() { - return file.isFile(); - }; - - /** - * Returns the time when the file represented by this File object was last modified. - *

    - * A number representing the time the file was last modified, - * measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), - * or 0L if the file does not exist or if an I/O error occurs. - * - * @returns Number in milliseconds since 00:00:00 GMT, January 1, 1970 - * @type Number - */ - this.lastModified = function() { - return file.lastModified(); - }; - - /** - * Creates the directory represented by this File object. - * - * @returns Boolean true if the directory was created; false otherwise - * @type Boolean - */ - this.makeDirectory = function() { - if (self.isOpened()) - return false; - // don't do anything if file exists or use multi directory version - return (file.exists() || file.mkdirs()); - }; - - /** - * Renames the file represented by this File object. - *

    - * Whether or not this method can move a file from one - * filesystem to another is platform-dependent. The return - * value should always be checked to make sure that the - * rename operation was successful. - * - * @param {FileObject} toFile as FileObject of the new path - * @returns true if the renaming succeeded; false otherwise - * @type Boolean - */ - this.renameTo = function(toFile) { - if (toFile == null) { - setError(new IllegalArgumentException("Uninitialized target File object")); - return false; - } - if (self.isOpened()) { - setError(new IllegalStateException("An openened file cannot be renamed")); - return false; - } - if (toFile.isOpened()) { - setError(new IllegalStateException("You cannot rename to an openened file")); - return false; - } - return file.renameTo(new java.io.File(toFile.getAbsolutePath())); - }; - - /** - * Returns true if the file represented by this File object - * has been read entirely and the end of file has been reached. - * - * @returns Boolean - * @type Boolean - */ - this.eof = function() { - if (!self.isOpened()) { - setError(new IllegalStateException("File not opened")); - return true; - } - if (!(readerWriter instanceof BufferedReader)) { - setError(new IllegalStateException("File not opened for read")); - return true; - } - if (atEOF) - return true; - if (lastLine != null) - return false; - try { - lastLine = readerWriter.readLine(); - if (lastLine == null) - atEOF = true; - return atEOF; - } catch (e) { - setError(e); - return true; - } - }; - - /** - * This methods reads all the lines contained in the - * file and returns them. - * - * @return String of all the lines in the file - * @type String - */ - this.readAll = function() { - // Open the file for readAll - if (self.isOpened()) { - setError(new IllegalStateException("File already open")); - return null; - } - try { - if (file.exists()) { - readerWriter = new BufferedReader(new FileReader(file)); - } else { - setError(new IllegalStateException("File does not exist")); - return null; - } - if (!file.isFile()) { - setError(new IllegalStateException("File is not a regular file")); - return null; - } - - // read content line by line to setup proper eol - var buffer = new java.lang.StringBuffer(file.length() * 1.10); - while (true) { - var line = readerWriter.readLine(); - if (line == null) - break; - if (buffer.length() > 0) - buffer.append("\n"); // EcmaScript EOL - buffer.append(line); - } - - // Close the file - readerWriter.close(); - readerWriter = null; - return buffer.toString(); - } catch (e) { - readerWriter = null; - setError(e); - return null; - } - }; - - - /** - * This method removes a directory recursively . - *

    - * DANGER! DANGER! HIGH VOLTAGE! - * The directory is deleted recursively without - * any warning or precautious measures. - */ - this.removeDirectory = function() { - if (!file.isDirectory()) - return false; - var arr = file.list(); - for (var i=0; i
    - * Useful for passing it to a function instead of an request object. - */ - this.toByteArray = function() { - if (!this.exists()) - return null; - var body = new java.io.ByteArrayOutputStream(); - var stream = new java.io.BufferedInputStream( - new java.io.FileInputStream(this.getAbsolutePath()) - ); - var buf = java.lang.reflect.Array.newInstance( - java.lang.Byte.TYPE, 1024 - ); - var read; - while ((read = stream.read(buf)) > -1) - body.write(buf, 0, read); - stream.close(); - return body.toByteArray(); - }; - - for (var i in this) - this.dontEnum(i); - - return this; -} - - -/** @ignore */ -helma.File.toString = function() { - return "[helma.File]"; -}; - - -helma.File.separator = java.io.File.separator; - - -helma.lib = "File"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Ftp.js b/modules/helma/Ftp.js deleted file mode 100644 index 67296bfa..00000000 --- a/modules/helma/Ftp.js +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2007 Helma Software. All Rights Reserved. - * - * $RCSfile: Ftp.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Default properties and methods of the FTP prototype. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Ftp.js') - */ - -// requires helma.File -app.addRepository("modules/helma/File.js"); - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructor for FTP client objects, to send and receive files from an FTP server. - *

    - * @class This class represents a FTP client, providing - * access to an FTP server. - * - * @example var ftp = new helma.Ftp("ftp.mydomain.com"); - * @param {String} server as String, the address of the FTP Server to connect to - * @constructor - */ -helma.Ftp = function(server) { - var OK = 0; - var SOCKET = 1; - var TIMEOUT = 2; - var LOGIN = 10; - var LOGOUT = 11; - var BINARY = 20; - var ASCII = 21; - var ACTIVE = 22; - var PASSIVE = 23; - var CD = 30; - var LCD = 31; - var PWD = 32; - var DIR = 33; - var MKDIR = 34; - var RMDIR = 35; - var GET = 40; - var PUT = 41; - var DELETE = 42; - var RENAME = 43; - - var FTP = Packages.org.apache.commons.net.ftp.FTP; - var FtpClient = Packages.org.apache.commons.net.ftp.FTPClient; - var BufferedInputStream = java.io.BufferedInputStream; - var BufferedOutputStream = java.io.BufferedOutputStream; - var FileInputStream = java.io.FileInputStream; - var FileOutputStream = java.io.FileOutputStream; - var ByteArrayInputStream = java.io.ByteArrayInputStream; - var ByteArrayOutputStream = java.io.ByteArrayOutputStream; - - var self = this; - var className = "helma.Ftp"; - - var ftpclient = new FtpClient(); - var localDir; - - var error = function(methName, errMsg) { - var tx = java.lang.Thread.currentThread(); - tx.dumpStack(); - app.log("Error in " + className + ":" + methName + ": " + errMsg); - return; - }; - - var debug = function(methName, msg) { - msg = msg ? " " + msg : ""; - app.debug(className + ":" + methName + msg); - return; - }; - - var setStatus = function(status) { - if (self.status === OK) { - self.status = status; - } - return; - }; - - var getStatus = function() { - return self.status; - }; - - this.server = server; - this.status = OK; - - /** @ignore */ - this.toString = function() { - return "[helma.Ftp " + server + "]"; - }; - - /** - * Set the default timeout in milliseconds to use when opening a socket. - */ - this.setReadTimeout = function(timeout) { - try { - ftpclient.setDefaultTimeout(timeout); - debug("setReadTimeout", timeout); - return true; - } catch(x) { - error("setReadTimeout", x); - setStatus(SOCKET); - } - return false; - }; - - /** - * Sets the timeout in milliseconds to use when reading from the data connection. - */ - this.setTimeout = function(timeout) { - try { - ftpclient.setDataTimeout(timeout); - debug("setTimeout", timeout); - return true; - } catch(x) { - error("setTimeout", x); - setStatus(TIMEOUT); - } - return false; - }; - - /** - * Logs in to the FTP server. - * - * @param {String} username as String - * @param {String} password as String - * @return Boolean true if the login was successful, otherwise false - * @type Boolean - */ - this.login = function(username, password) { - try { - ftpclient.connect(this.server); - var result = ftpclient.login(username, password); - debug("login", username + "@" + server); - return result; - } catch(x) { - error("login", x); - setStatus(LOGIN); - } - return false; - }; - - /** - * Sets transfer mode to binary for transmitting images and other non-text files. - * - * @example ftp.binary(); - */ - this.binary = function() { - try { - var result = ftpclient.setFileType(FTP.BINARY_FILE_TYPE); - debug("binary"); - return result; - } catch(x) { - error("binary", x); - setStatus(BINARY); - } - return false; - }; - - /** - * Sets transfer mode to ascii for transmitting text-based data. - * - * @example ftp.ascii(); - */ - this.ascii = function() { - try { - var result = ftpclient.setFileType(FTP.ASCII_FILE_TYPE); - debug("ascii"); - return result; - } catch(x) { - error("ascii", x); - setStatus(ASCII); - } - return false; - }; - - /** - * Switches the connection to use active mode. - * - * @example ftp.active(); - */ - this.active = function() { - try { - ftpclient.enterLocalActiveMode(); - debug("active"); - return true; - } catch(x) { - error("active", x); - setStatus(ACTIVE); - } - return false; - }; - - /** - * Switches the connection to use passive mode. - * - * @example ftp.passive(); - */ - this.passive = function() { - try { - ftpclient.enterLocalPassiveMode(); - debug("passive"); - return true; - } catch(x) { - error("passive", x); - setStatus(PASSIVE); - } - return false; - }; - - /** - * Returns the path of the current working directory. - * - * @example var remotepath = ftp.pwd(); - * @type String - * @return String containing the current working directory path - */ - this.pwd = function() { - try { - debug("pwd"); - return ftpclient.printWorkingDirectory(); - } catch(x) { - error("pwd", x); - setStatus(PWD); - } - return; - }; - - /** - * Returns a listing of the files contained in a directory on the FTP server. - *

    - * Lists the files contained in the current working - * directory or, if an alternative path is specified, the - * files contained in the specified directory. - * - * @example var filelist = ftp.dir(); - * @param {String} path as String, optional alternative directory - * @return Array containing the list of files in that directory - * @type Array - */ - this.dir = function(path) { - try { - debug("dir", path); - return ftpclient.listNames(path ? path : "."); - } catch(x) { - error("dir", x); - setStatus(DIR); - } - return; - }; - - /** - * Creates a new directory on the server. - *

    - * The name of the directory is determined as the function's - * string parameter. Returns false when an error occured - * (e.g. due to access restrictions, directory already - * exists etc.), otherwise true. - * - * @param {String} dir as String, the name of the directory to be created - * @return Boolean true if the directory was successfully created, false if there was an error - * @type Boolean - */ - this.mkdir = function(dir) { - try { - var result = ftpclient.makeDirectory(dir); - debug("mkdir", dir); - return result; - } catch(x) { - error("mkdir", x); - setStatus(MKDIR); - } - return false; - }; - - /** - * Deletes a directory on the FTP server. - * - * @param {String} dir as String, the name of the directory to be deleted - * @return Boolean true if the deletion was successful, false otherwise - * @type Boolean - */ - this.rmdir = function(dir) { - try { - var result = ftpclient.removeDirectory(dir); - debug("rmdir", dir); - return result; - } catch(x) { - error("rmdir", x); - setStatus(RMDIR); - } - return false; - }; - - /** - * Changes the working directory on the FTP server. - * - * @example ftp.cd("/home/users/fred/www"); // use absolute pathname - * @example ftp.cd(".."); // change to parent directory - * @example ftp.cd("images"); // use relative pathname - * @param {String} dir as String, the path that the remote working directory should be changed to - */ - this.cd = function(path) { - try { - var result = ftpclient.changeWorkingDirectory(path); - debug("cd", path); - return result; - } catch(x) { - error("cd", x); - setStatus(CD); - } - return false; - }; - - /** - * Changes the working directory of the local machine when being connected to an FTP server. - * - * @example ftp.lcd("/home/users/fred/www"); // use absolute pathname - * @example ftp.lcd(".."); // change to parent directory - * @example ftp.lcd("images"); // use relative pathname - * @param {String} dir as String, the path that the local working directory should be changed to - */ - this.lcd = function(dir) { - try { - localDir = new helma.File(dir); - if (!localDir.exists()) { - localDir.mkdir(); - debug("lcd", dir); - } - return true; - } catch(x) { - error("lcd", x); - setStatus(LCD); - } - return false; - }; - - /** - * Transfers a file from the local file system to the remote server. - *

    - * Returns true if the transmission was successful, otherwise false. - * - * @param {String} localFile as String, the name of the file to be uploaded - * @param {String} remoteFile as String, the name of the remote destination file - * @return Boolean true if the file was successfully uploaded, false if there was an error - * @type Boolean - */ - this.putFile = function(localFile, remoteFile) { - try { - if (localFile instanceof File || localFile instanceof helma.File) { - var f = localFile; - } else if (typeof localFile == "string") { - if (localDir == null) - var f = new helma.File(localFile); - else - var f = new helma.File(localDir, localFile); - } - var stream = new BufferedInputStream( - new FileInputStream(f.getPath()) - ); - if (!remoteFile) { - remoteFile = f.getName(); - } - var result = ftpclient.storeFile(remoteFile, stream); - stream.close(); - debug("putFile", remoteFile); - return result; - } catch(x) { - error("putFile", x); - setStatus(PUT); - } - return false; - }; - - /** - * Transfers text from a string to a file on the FTP server. - * - * @example ftp.putString("Hello, World!", "message.txt"); - * @param {String} str as String, the text content that should be uploaded - * @param {String} remoteFile as String, the name of the remote destination file - * @param {String} charset as String, optional - * @return Boolean true if the file was successfully uploaded, false if there was an error - * @type Boolean - */ - this.putString = function(str, remoteFile, charset) { - try { - str = new java.lang.String(str); - var bytes = charset ? str.getBytes(charset) : str.getBytes(); - var stream = ByteArrayInputStream(bytes); - var result = ftpclient.storeFile(remoteFile, stream); - debug("putString", remoteFile); - return result; - } catch(x) { - error("putString", x); - setStatus(PUT); - } - return false; - }; - - /** - * Transfers a byte array to a file on the FTP server. - * @param {Array} bytes The byte array that should be uploaded - * @param {String} remoteFile The name of the remote destination file - * @return Boolean True if the file was successfully uploaded, false if there was an error - * @type Boolean - */ - this.putBytes = function(bytes, remoteFile) { - try { - var stream = ByteArrayInputStream(bytes); - var result = ftpclient.storeFile(remoteFile, stream); - debug("putBytes", remoteFile); - return result; - } catch(x) { - error("putBytes", x); - setStatus(PUT); - } - return false; - }; - - /** - * Transfers a file from the FTP server to the local file system. - * - * @example ftp.getFile(".htaccess", "htaccess.txt"); - * @param {String} remoteFile as String, the name of the file that should be downloaded - * @param {String} localFile as String, the name which the file should be stored under - * @see #cd - * @see #lcd - */ - this.getFile = function(remoteFile, localFile) { - try { - if (localDir == null) - var f = new helma.File(localFile); - else - var f = new helma.File(localDir, localFile); - var stream = new BufferedOutputStream( - new FileOutputStream(f.getPath()) - ); - var result = ftpclient.retrieveFile(remoteFile, stream); - stream.close(); - debug("getFile", remoteFile); - return result; - } catch(x) { - error("getFile", x); - setStatus(GET); - } - return false; - }; - - /** - * Retrieves a file from the FTP server and returns it as string. - * - * @example var str = ftp.getString("messages.txt"); - * @param {String} remoteFile as String, the name of the file that should be downloaded - * @return String containing the data of the downloaded file - * @type String - * @see #cd - */ - this.getString = function(remoteFile) { - try { - var stream = ByteArrayOutputStream(); - ftpclient.retrieveFile(remoteFile, stream); - debug("getString", remoteFile); - return stream.toString(); - } catch(x) { - error("getString", x); - setStatus(GET); - } - return; - }; - - /** - * Deletes a file on the FTP server. - * - * @example var str = ftp.deleteFile("messages.txt"); - * @param {String} remoteFile as String, the name of the file to be deleted - * @return Boolean true if the deletion was successful, false otherwise - * @type Boolean - */ - this.deleteFile = function(remoteFile) { - try { - var result = ftpclient.deleteFile(remoteFile); - debug("deleteFile", remoteFile); - return result; - } catch(x) { - error("deleteFile", x); - setStatus(DELETE); - } - return false; - }; - - /** - * Renames a file on the FTP server. - * - * @example var success = ftp.renameFile("messages.tmp", "messages.txt"); - * @param {String} from the name of the original file - * @param {String} to the new name the original file should get - * @return Boolean true if renaming the remote file was successful, false otherwise - * @type Boolean - */ - this.renameFile = function(from, to) { - try { - var result = ftpclient.rename(from, to); - debug("renameFile", from + "->" + to); - return result; - } catch(x) { - error("renameFile", x); - setStatus(RENAME); - } - return false; - }; - - /** - * Terminates the current FTP session. - */ - this.logout = function() { - try { - var result = ftpclient.logout(); - ftpclient.disconnect(); - debug("logout"); - return result; - } catch(x) { - error("logout", x); - setStatus(LOGOUT); - } - return false; - }; - - for (var i in this) - this.dontEnum(i); - - return this; -} - - -/** @ignore */ -helma.Ftp.toString = function() { - return "[helma.Ftp]"; -}; - - -helma.lib = "Ftp"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Group.js b/modules/helma/Group.js deleted file mode 100644 index a15081dc..00000000 --- a/modules/helma/Group.js +++ /dev/null @@ -1,875 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Group.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview A JavaScript library wrapping - * Packages.helma.extensions.helmagroups - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Group.js') - */ - -// Define the global namespace if not existing -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructs a new helma.Group Object. - * @class This is what is retrieved through groups.get(groupName), - * wrapping the root object of each group tree. - * @param {FIXME} javaGroup FIXME - * @constructor - */ -helma.Group = function(javaGroup) { - // private variable containing the wrapper object - var groupRoot = new helma.Group.GroupObject(javaGroup.getRoot()); - - /** - * @returns the wrapped java object Group - */ - this.getJavaObject = function() { - return javaGroup; - }; - - /** - * sets a key/value pair on the group's root, - * wraps the function of the wrapper object - */ - this.set = function(key, val, sendMode) { - groupRoot.set(key, val, sendMode); - return; - }; - - /** - * removes a key from the group's root, - * wraps the function of the root GroupObject - */ - this.remove = function(key, sendMode) { - return groupRoot.remove(key, sendMode); - }; - - /** - * retrieves a key from the group's root, - * wraps the function of the root GroupObject - */ - this.get = function(key) { - return groupRoot.get(key); - }; - - /** - * @see helma.Group.GroupObject.listChildren - */ - this.listChildren = function() { - return groupRoot.listChildren(); - }; - - /** - * @see helma.Group.GroupObject.listProperties - */ - this.listProperties = function() { - return groupRoot.listProperties(); - }; - - /** - * @see helma.Group.GroupObject.countChildren - */ - this.countChildren = function() { - return groupRoot.countChildren(); - }; - - /** - * @see helma.Group.GroupObject.countProperties - */ - this.countProperties = function() { - return groupRoot.countProperties(); - }; - - /** - * calls a function in all connected applications - * (to be specific: in all registered localClients). - * @param method name of the method in xmlrpc-style: test - * is called as root.test(), stories.137.render - * is called as root.stories.get("137").render() etc etc. - * @param argArr array of arguments to the remote method - * @param sendMode as defined for helma.Group.GroupObject - * @returns array of result objects - */ - this.callFunction = function(method, argArr, sendMode) { - groups.checkWriteAccess(javaGroup); - if (sendMode == null) { - sendMode = helma.Group.GroupObject.DEFAULT_GET; - } - var argVec = new java.util.Vector(); - for (var i=0; i - *
  • a String
  • - *
  • a String containing slashes
  • - *
  • an Array containing String keys
  • - * - * @param {Number} The value to set the property to. - * @param {Object} The mode to use when committing the change to - * the helma.Group - */ - this.set = function(key, val, sendMode) { - if (!key) { - throw "helma.Group.GroupObject.set(): key can't be null"; - } - checkWriteAccess(); - // check content type of value: - var ok = false; - if (val == null) - ok = true; - else if (typeof(val) == "string") - ok = true; - else if (typeof(val) == "number") - ok = true; - else if (typeof(val) == "boolean") - ok = true; - else if (val instanceof Date) - ok = true; - else if (val instanceof helma.Group.GroupObject) - ok = true; - if (ok == false) { - throw "only primitive values, Date and helma.Group.GroupObject allowed in helma.Group.GroupObject.set()"; - } - if (sendMode == null) { - sendMode = helma.Group.GroupObject.DEFAULT_GET; - } - - if (keyIsPath(key)) { - var obj = createPath(this, key); - if (obj != null) { - obj.set(getLastKeyElement(key), val, sendMode); - } - } else { - // set a property/child of this object - if (val == null) { - // null values aren't permitted in the group, - // setting a property to null is the same as deleting it - this.remove(key, sendMode); - } else if (val instanceof helma.Group.GroupObject) { - // replicate helma.Group.GroupObject - javaGroupObject.put(key, val.getJavaObject(), sendMode); - } else { - // put the primitive property (or maybe replicate, - // decision's up to helma.Group.GroupObject) - if (val instanceof Date) { - // convert javascript dates to java dates - val = new java.util.Date(val.getTime()); - } - javaGroupObject.put(key, val, sendMode); - } - } - return; - }; - - - - /** - * Removes a property or a child GroupObject from this instance. - * The Key may be a String, an Array or a String with separator characters ("/"). - * In the latter two cases the argument is considered a path and - * the function walks down that path to find the GroupObject and - * deletes it. - * @param {Object} key Either - *
      - *
    • a String
    • - *
    • a String containing slashes
    • - *
    • an Array containing String keys
    • - *
    - * @param {Number} The mode to use when committing the change to - * the helma.Group - */ - this.remove = function(key, sendMode) { - checkWriteAccess(); - if (sendMode == null) { - sendMode = helma.Group.GroupObject.DEFAULT_GET; - } - if (keyIsPath(key)) { - var obj = walkPath(this, key); - if (obj != null) { - obj.remove(getLastKeyElement(key)); - } - } else { - javaGroupObject.remove(key, sendMode); - } - return; - }; - - - /** - * Returns either a property or a child GroupObject from - * this GroupObject instance. The key passed as argument - * may be a String, an Array containing Strings or a - * String containing separator characters ("/"). In the latter - * two cases the argument is considered a path and - * the function walks down that path to find the requested - * GroupObject. - * @param {Object} key Either - *
      - *
    • a String
    • - *
    • a String containing slashes
    • - *
    • an Array containing String keys
    • - *
    - * @return Depending on the argument either the appropriate property - * value or a helma.Group.GroupObject - * @type Object - */ - this.get = function(key) { - if (key == null) { - return null; - } - if (keyIsPath(key)) { - var obj = walkPath(this, key); - if (obj != null) { - return obj.get(getLastKeyElement(key)); - } else { - return null; - } - } else if (javaGroupObject.hasProperty(key)) { - // we got a primitive property - var val = javaGroupObject.getProperty(key); - if (val instanceof java.util.Date) { - // convert java dates to javascript dates - val = new Date(val); - } - return val; - } else if (javaGroupObject.hasChild(key)) { - // we got a child object - return new helma.Group.GroupObject(javaGroupObject.getChild(key)); - } - return null; - }; - - - /** - * Gets a property from this GroupObject. The key passed as argument - * is always considered a property even if it contains a slash. - * This is actually a workaround for the fact that other - * instances of the group not using the javascript extension aren't forbidden - * to add properties containing a slash in the property's name. - * So, using this extension we can at least read the property. - * @param {String} key The name of the property to return - * @returns The value of the property - * @type Object - */ - this.getProperty = function(key) { - if (key == null) { - return null; - } else if (javaGroupObject.hasProperty(key)) { - // we got a primitive property - var val = javaGroupObject.getProperty(key); - if (val instanceof java.util.Date) { - // convert java dates to javascript dates - val = new Date(val); - } - return val; - } - return null; - } - - - /** - * Exchanges this GroupObject with the one passed - * as argument. This is done by exchanging the wrapped - * instance of helma.extensions.helmagroups.GroupObject - * @param {GroupObject} The GroupObject to use - * @returns The GroupObject with the exchanged wrapped java object - * @type GroupObject - */ - this.wrap = function(newGroupObject) { - checkWriteAccess(); - if (javaGroupObject.getState() != helmagroups.GroupObject.REPLICATED) { - throw "helma.Group.GroupObject.wrap() may only be called on replicated GroupObjects"; - } - if (newGroupObject == null || !(newGroupObject instanceof helma.Group.GroupObject)) { - throw "helma.Group.GroupObject.wrap() requires a helma.Group.GroupObject as an argument"; - } - javaGroupObject.wrap(newGroupObject.getJavaObject()); - return this; - }; - - /** - * Clones this GroupObject and returns it. - * This method should be considered if many properties - * of a GroupObject must be set or modified since every - * change to an already replicated GroupObject will - * result in immediate network traffic. Using unwrap - * one can modify several properties and then commit - * the GroupObject at once using {@link #wrap). - * @returns A clone of this GroupObject - * @type GroupObject - */ - this.unwrap = function() { - var javaGroupObjectClone = javaGroupObject.clone(); - javaGroupObjectClone.setChildren(new java.util.Hashtable()); - javaGroupObjectClone.setState(helmagroups.GroupObject.LOCAL); - javaGroupObjectClone.setPath(null); - return new helma.Group.GroupObject(javaGroupObjectClone); - }; - - /** - * Converts this GroupObject into a vanilla Object - * @returns An Object containing all properties of this GroupObject - * @type Object - */ - this.toJSObject = function() { - var key; - var obj = {}; - var e = javaGroupObject.properties(); - while(e.hasMoreElements()) { - obj[key = e.nextElement()] = javaGroupObject.getProperty(key); - } - return obj; - }; - - /** - * Returns an Array containing all child GroupObjects - * @returns An Array containing GroupObjects - * @type Array - */ - this.listChildren = function() { - var arr = []; - var e = javaGroupObject.children(); - while(e.hasMoreElements()) { - arr.push(e.nextElement()); - } - return arr; - }; - - /** - * Returns an Array containing all property - * names of this GroupObject instance - * @returns An Array containing property names - * @type Array - */ - this.listProperties = function() { - var arr = []; - var e = javaGroupObject.properties(); - while(e.hasMoreElements()) { - arr.push(e.nextElement()); - } - return arr; - }; - - /** - * Returns the number of child GroupObjects - * @returns The number of child GroupObjects of this - * helma.Group.GroupObject instance - * @type Number - */ - this.countChildren = function() { - var ht = javaGroupObject.getChildren(); - if (ht == null) { - return 0; - } else { - return ht.size(); - } - }; - - /** - * Returns the number of properties of this GroupObject - * @return The number of properties - * @type Number - */ - this.countProperties = function() { - var ht = javaGroupObject.getProperties(); - return (ht == null) ? 0 : ht.size(); - }; - - /** - * Returns true if the GroupObject is not replicated - * @returns True if this GroupObject is still local - * @type Boolean - */ - this.isLocal = function() { - return (javaGroupObject.getState() - == helmagroups.GroupObject.LOCAL); - }; - - /** @ignore */ - this.toString = function() { - return javaGroupObject.toString(); - }; - - return this; -}; - -/** - * Static properties of GroupObject constructor function. - * These values determine if and for how many confirmation of the - * group members this instance waits after a modification. - * These values are passed through to org.jgroups.blocks.GroupRequest, - * for further comments see the sourcecode of that class - */ -// wait just for the first response -helma.Group.GroupObject.GET_FIRST = 1; -// wait until all members have responded -helma.Group.GroupObject.GET_ALL = 2; -// wait for majority (50% + 1) to respond -helma.Group.GroupObject.GET_MAJORITY = 3; -// wait for majority of all members (may block!) -helma.Group.GroupObject.GET_ABS_MAJORITY = 4; -// don't wait for any response (fire & forget) -helma.Group.GroupObject.GET_NONE = 6; -// default: wait for all responses -helma.Group.GroupObject.DEFAULT_GET = helma.Group.GroupObject.GET_ALL; - -/** - * This is mounted as "groups". - * @class The root for all groups started in this application - * @constructor - */ -helma.Group.Manager = function() { - var helmagroups = Packages.helma.extensions.helmagroups; - var extension = helmagroups.GroupExtension.self; - - if (extension == null) { - throw("helma.Group.Manager requires the HelmaGroups Extension \ - located in lib/ext or the application's top-level directory \ - [http://adele.helma.org/download/helma/contrib/helmagroups/]"); - } - - - /** - * get a java object Group for a groupname. - * object is fetched regardless of connection status - * @returns null if group is not defined - */ - var getJavaGroup = function(name) { - return extension.checkAppLink(app.name).get(name); - }; - - - /** - * visible to scripting env: get a group, wrapped as a javascript helma.Group object. - * the group must be defined in app.properties: group.nameXX = - * and can then be accessed like this group.get("nameXX") - * @returns null if group is not defined or not connected - */ - this.get = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null || javaGroup.isConnected() == false) { - return null; - } else { - return new helma.Group(javaGroup); - } - }; - - - /** - * checks for write access to a group according to app.properties - * group.nameXX.writable must be true so that this function returns - * @param nameOrJGroup can be the name of a group or a java Group itself - * @throws an error if group is not writable - */ - this.checkWriteAccess = function(nameOrJGroup) { - var extension = helmagroups.GroupExtension.self; - var jAppLink = extension.checkAppLink(app.name); - if (nameOrJGroup instanceof helmagroups.Group) { - // arg was a Group - var javaGroup = nameOrJGroup; - } else { - // arg was the name of the group - var javaGroup = jAppLink.get(nameOrJGroup); - } - if (javaGroup != null && jAppLink.isWritable(javaGroup) == false) { - throw("tried to access write-protected group"); - } - return true; - }; - - - /** - * try to connect a group - * @returns false if group is not found - */ - this.connect = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - javaGroup.connect(); - return true; - }; - - - /** - * try to disconnect from a group - * @returns false if group is not found - */ - this.disconnect = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - javaGroup.disconnect(); - return true; - }; - - - /** - * try to disconnect and connect again to a group - * @returns false if group is not found - */ - this.reconnect = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - javaGroup.reconnect(); - return true; - }; - - - /** - * try to reset a group (if application may write in group). - * all instances of the group empty their cache. - * @returns false if group is not found - */ - this.reset = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - groups.checkWriteAccess(javaGroup); - javaGroup.reset(); - return true; - }; - - - /** - * try to destroy a group (if application may write in group). - * all other instances of the group disconnect - * @returns false if group is not found - */ - this.destroy = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - groups.checkWriteAccess(javaGroup); - javaGroup.destroy(); - return true; - }; - - - /** - * try to restart a group (if application may write in group). - * all other instances of the group disconnect and reconnect - each app after a different pause - * so that they don't all come up at the same moment - * @returns false if group is not found - */ - this.restart = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - groups.checkWriteAccess(javaGroup); - javaGroup.restart(); - return true; - }; - - - /** - * list the members of this group (ie instances of Group, one helma server is one instance) - * @returns array of strings, false if group is not found - */ - this.listMembers = function(name) { - var javaGroup = getJavaGroup(name); - if (javaGroup == null) { - return false; - } - var addrArr = javaGroup.info.listMembers(); - var arr = []; - for (var i=0; i
    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Html.js') - */ - -// take care of any dependencies -app.addRepository('modules/core/String.js'); -app.addRepository('modules/core/Object.js'); -app.addRepository('modules/core/Array.js'); - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Creates a new instance of helma.Html - * @class This class provides various methods for rendering - * X/Html tags. - * @returns A newly created instance of helma.Html - * @constructor - */ -helma.Html = function() { - return this; -}; - -/** - * Static helper method that renders an arbitrary markup part. - * @param {String} name The element's name - * @param {String} start Prefix of each rendered element - * @param {String} end Suffix of each rendered element - * @param {Object} attr Optional element attributes - */ -helma.Html.renderMarkupPart = function(name, start, end, attr) { - res.write(start); - res.write(name); - if (attr) { - for (var i in attr) { - if (i == "prefix" || i == "suffix" || - i == "default" || attr[i] == null) { - continue; - } - res.write(" "); - res.write(i); - res.write("=\""); - res.write(attr[i]); - res.write("\""); - } - } - res.write(end); - return; -}; - -/** - * Static helper method used in helma.Html.checkBox - * and helma.Html.dropDown to check if a current value - * matches against one or more selected values passed - * as argument - * @param {String} value The current value to check - * @param {String|Array} selectedValue Either a single - * value to check against the current value, or an array - * containing values. - * @returns True in case the value is among the selected - * values, false otherwise - * @type Boolean - */ -helma.Html.isSelected = function(value, selectedValue) { - if (selectedValue == null || value == null) - return false; - if (selectedValue instanceof Array) - return selectedValue.contains(value); - return value == selectedValue; -}; - - -/** @ignore */ -helma.Html.prototype.toString = function() { - return "[helma.Html]"; -}; - -/** - * Renders the opening tag of an arbitrary x/html tag - * @param {String} name The tag name - * @param {Object} attr An optional object containing element attributes - */ -helma.Html.prototype.openTag = function(name, attr) { - helma.Html.renderMarkupPart(name, "<", ">", attr); - return; -}; - -/** - * Returns the opening tag of an arbitrary x/html tag - * @param {String} name The tag name - * @param {Object} attr An optional object containing element attributes - * @returns The rendered x/html opening tag - * @type String - * @see #openTag - */ -helma.Html.prototype.openTagAsString = function(name, attr) { - res.push(); - helma.Html.renderMarkupPart(name, "<", ">", attr); - return res.pop(); -}; - -/** - * Renders the closing tag of an arbitrary x/html tag - * @param {String} name The tag name - */ -helma.Html.prototype.closeTag = function(name) { - helma.Html.renderMarkupPart(name, "", null); - return; -}; - -/** - * Returns the closing tag of an arbitray x/html element - * @param {String} name The tag name - * @returns The rendered closing tag - * @type String - * @see #closeTag - */ -helma.Html.prototype.closeTagAsString = function(name) { - res.push(); - helma.Html.renderMarkupPart(name, "", null); - return res.pop(); -}; - -/** - * Renders an empty arbitrary x/html tag ("contentless tag") - * @param {String} name The tag name - * @param {Object} attr An optional object containing tag attributes - */ -helma.Html.prototype.tag = function(name, attr) { - helma.Html.renderMarkupPart(name, "<", " />", attr); - return; -}; - -/** - * Returns an empty arbitrary x/html tag ("contentless tag") - * @param {String} name The tag name - * @param {Object} attr An optional object containing tag attributes - * @returns The rendered element - * @type String - * @see #tag - */ -helma.Html.prototype.tagAsString = function(name, attr) { - res.push(); - helma.Html.renderMarkupPart(name, "<", " />", attr); - return res.pop(); -}; - -/** - * Renders an arbitrary x/html element - * @param {String} name The element name - * @param {String} str The content of the element - * @param {Object} attr An optional object containing element attributes - */ -helma.Html.prototype.element = function(name, str, attr) { - helma.Html.renderMarkupPart(name, "<", ">", attr); - res.write(str); - helma.Html.renderMarkupPart(name, ""); - return; -}; - -/** - * Return an arbitrary x/html element - * @param {String} name The element name - * @param {String} str The content of the element - * @param {Object} attr An optional object containing element attributes - * @returns The rendered element - * @type String - * @see #element - */ -helma.Html.prototype.elementAsString = function(name, str, attr) { - res.push(); - this.element(name, str, attr); - return res.pop(); -}; - -/** - * Renders an x/html link tag - * @param {Object} attr An object containing the link attributes - * @param {String} text The text to appear as link - */ -helma.Html.prototype.link = function(attr, text) { - if (!attr) { - res.write("[Html.link: insufficient arguments]"); - return; - } - this.openTag("a", attr); - res.write(text); - this.closeTag("a"); - return; -}; - -/** - * Returns a rendered x/html link tag - * @param {Object} attr An object containing the link attributes - * @param {String} text The text to appear as link - * @returns The rendered link tag - * @type String - * @see #link - */ -helma.Html.prototype.linkAsString = function(attr, text) { - res.push(); - this.link(attr, text); - return res.pop(); -}; - -/** - * Renders an x/html input tag of type "hidden" - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.hidden = function(param) { - if (!param) { - res.write("[Html.hidden: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - attr.type = "hidden"; - attr.value = (attr.value != null) ? encodeForm(attr.value) : ""; - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html input tag of type "hidden" - * @param {Object} attr An object containing the tag attributes - * @returns The rendered input element - * @type String - * @see #hidden - */ -helma.Html.prototype.hiddenAsString = function(attr) { - res.push(); - this.hidden(attr); - return res.pop(); -}; - -/** - * Renders an x/html text input tag - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.input = function(param) { - if (!param) { - res.write("[Html.input: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - attr.type = param.type || "text"; - attr.value = (attr.value != null) ? encodeForm(attr.value) : ""; - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html text input tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered text input tag - * @type String - * @see #input - */ -helma.Html.prototype.inputAsString = function(attr) { - res.push(); - this.input(attr); - return res.pop(); -}; - -/** - * Renders an x/html textarea tag - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.textArea = function(param) { - if (!param) { - res.write("[Html.textArea: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - var value = (attr.value != null) ? encodeForm(attr.value) : ""; - delete attr.value; - this.openTag("textarea", attr); - res.write(value); - this.closeTag("textarea"); - return; -}; - -/** - * Returns a rendered x/html textarea tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered textarea tag - * @type String - * @see #textArea - */ -helma.Html.prototype.textAreaAsString = function(attr) { - res.push(); - this.textArea(attr); - return res.pop(); -}; - -/** - * Renders an x/html checkbox input tag - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.checkBox = function(param) { - if (!param) { - res.write("[Html.checkBox: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - attr.type = "checkbox"; - if (attr.selectedValue != null) { - if (helma.Html.isSelected(param.value, param.selectedValue)) - attr.checked = "checked"; - else - delete attr.checked; - delete attr.selectedValue; - } - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html checkbox input tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered checkbox tag - * @type String - * @see #checkBox - */ -helma.Html.prototype.checkBoxAsString = function(attr) { - res.push(); - this.checkBox(attr); - return res.pop(); -}; - -/** - * Renders an x/html radiobutton input tag - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.radioButton = function(param) { - if (!param) { - res.write("[Html.radioButton: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - attr.type = "radio"; - if (attr.selectedValue != null) { - if (attr.value == attr.selectedValue) - attr.checked = "checked"; - else - delete attr.checked; - delete attr.selectedValue; - } - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html radio input tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered element - * @type String - * @see #radioButton - */ -helma.Html.prototype.radioButtonAsString = function(attr) { - res.push(); - this.radioButton(attr); - return res.pop(); -}; - -/** - * Renders an x/html submit input tag - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.submit = function(param) { - if (!param) { - res.write("[Html.submit: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - attr.type = "submit"; - if (!attr.name) - attr.name = attr.type; - attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type; - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html submit input tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered submit input tag - * @type String - * @see #submit - */ -helma.Html.prototype.submitAsString = function(attr) { - res.push(); - this.submit(attr); - return res.pop(); -}; - -/** - * Renders an x/html button input tag - * @param {Object} param An object containing the tag attributes - */ -helma.Html.prototype.button = function(param) { - if (!param) { - res.write("[Html.button: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - attr.type = "button"; - if (!attr.name) - attr.name = attr.type; - attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type; - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html button input tag - * @param {Object} param An object containing the tag attributes - * @returns The rendered button input tag - * @type String - * @see #button - */ -helma.Html.prototype.buttonAsString = function(attr) { - res.push(); - this.button(attr); - return res.pop(); -}; - -/** - * Renders a x/html drop down select box - * @param {Object} param An object containing the tag attributes - * @param {Array} options Either an array of strings, an array with - * several {value: v, display: d} objects, or a collection - * of ["value", "display"] arrays in an array - * @param {String} selectedValue The value to pre-select - * @param {String} firstOption An optional first option to display in the - * select box (this option will always have no value) - */ -helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOption) { - if (!param) { - res.write("[Html.dropDown: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - this.openTag("select", attr); - res.write("\n "); - if (firstOption) { - this.openTag("option", {value: ""}); - res.write(firstOption); - this.closeTag("option"); - res.write("\n "); - } - var hasOpenGroup = false; - for (var i in options) { - if (options[i].group) { - hasOpenGroup && html.closeTag("optgroup"); - html.openTag("optgroup", {label: options[i].group}); - hasOpenGroup = true; - } - var attr = new Object(); - var display = ""; - if ((options[i] instanceof Array) && options[i].length > 0) { - // option is an array - attr.value = options[i][0]; - display = options[i][1]; - } else if (options[i].value != null && options[i].display != null) { - // option is an object - attr.value = options[i].value; - if (options[i]["class"] != null) { - attr["class"] = options[i]["class"]; - } - display = options[i].display; - } else { - // assume option is a string - attr.value = i; - display = options[i]; - } - if (helma.Html.isSelected(attr.value, selectedValue)) - attr.selected = "selected"; - this.openTag("option", attr); - res.write(display); - this.closeTag("option"); - res.write("\n "); - } - hasOpenGroup && html.closeTag("optgroup"); - this.closeTag("select"); - res.write("\n "); - return; -}; - -/** - * Returns a rendered x/html drop down select box - * @param {Object} param An object containing the tag attributes - * @param {Array} options Either an array of strings, an array with - * several {value: v, display: d} objects, or a collection - * of ["value", "display"] arrays in an array - * @param {String} selectedValue The value to pre-select - * @param {String} firstOption An optional first option to display in the - * select box (this option will always have no value) - * @returns The rendered drop down select box - * @type String - * @see #dropDown - */ -helma.Html.prototype.dropDownAsString = function(attr, options, selectedValue, firstOption) { - res.push(); - this.dropDown(attr, options, selectedValue, firstOption); - return res.pop(); -}; - -/** - * Renders an image map based on an array containing the map parameters. - * @param {String} name The name of the image map - * @param {Array} param An array containing objects, where each of them - * contains the attributes for a single image map entry - */ -helma.Html.prototype.map = function(name, param) { - if (!name || !param) { - res.write("[Html.map: insufficient arguments]"); - return; - } - this.openTag("map", {name: name}); - var attr = Object.prototype.reduce.call(param); - for (var i in areas) { - if (!areas[i].alt) - areas[i].alt = ""; - if (!areas[i].shape) - areas[i].shape = "rect"; - this.openTag("area", areas[i]); - } - this.closeTag("map"); - return; -}; - -/** - * Returns a rendered image map based on an array containing the map parameters. - * @param {String} name The name of the image map - * @param {Array} areas An array containing objects, where each of them - * contains the attributes for a single image map entry - * @returns The rendered image map - * @type String - * @see #map - */ -helma.Html.prototype.mapAsString = function(name, areas) { - res.push(); - this.map(name, areas); - return res.pop(); -}; - -/** - * Renders a complete x/html table. - * @param {Array} headers An array containing table headers - * @param {Array} data A two-dimensional array containing the table data - * @param {Object} param An object containing the following properties: - *
      - *
    • table: Attributes to render within the opening <table> tag
    • - *
    • tr: Attributes to render within each <tr> tag
    • - *
    • td: Attributes to render within each <td> tag
    • - *
    • th: Attributes to render within each <th> tag
    • - *
    • trHead: Attributes to render within each <tr> tag - in the header area of the table
    • - *
    • trEven: Attributes to render within each even <tr> tag
    • - *
    • trOdd: Attributes to render within each odd <tr> tag
    • - *
    • tdEven: Attributes to render within each even <td> tag
    • - *
    • tdOdd: Attributes to render within each odd <td> tag
    • - *
    • thEven: Attributes to render within each even <th> tag
    • - *
    • thOdd: Attributes to render within each odd <th> tag
    • - *
    - */ -helma.Html.prototype.table = function(headers, data, param) { - if (!param) { - res.write("[Html.table: insufficient arguments]"); - return; - } - var attr = Object.prototype.reduce.call(param); - if (!attr.trHead) attr.trHead = attr.tr; - if (!attr.trEven) attr.trEven = attr.tr; - if (!attr.trOdd) attr.trOdd = attr.tr; - if (!attr.tdEven) attr.tdEven = attr.td; - if (!attr.tdOdd) attr.tdOdd = attr.td; - if (!attr.thEven) attr.thEven = attr.th; - if (!attr.thOdd) attr.thOdd = attr.th; - this.openTag("table", attr.table); - if (headers) { - this.openTag("tr", attr.trHead); - for (var i in headers) { - var evenOdd = i % 2 == 0 ? "Even" : "Odd"; - this.openTag("th", attr["th"+evenOdd]); - res.write(headers[i]); - this.closeTag("th"); - } - this.closeTag("tr"); - } - for (var i in data) { - var evenOdd = i % 2 == 0 ? "Even" : "Odd"; - this.openTag("tr", attr["tr"+evenOdd]); - for (var j in data[i]) { - var evenOddCell = j % 2 == 0 ? "Even" : "Odd"; - this.openTag("td", attr["td"+evenOddCell]); - res.write(data[i][j]); - this.closeTag("td"); - } - this.closeTag("tr"); - } - this.closeTag("table"); - return; -}; - -/** - * Returns a rendered x/html table - * @param {Array} headers An array containing table headers - * @param {Array} data A two-dimensional array containing the table data - * @param {Object} attr For a description see {@link #table} - * @returns The rendered table - * @type String - * @see #table - */ -helma.Html.prototype.tableAsString = function(headers, data, attr) { - res.push(); - this.table(headers, data, attr); - return res.pop(); -}; - -/*********************************************************************/ -/* */ -/* the following functions should be deliberately altered or removed */ -/* (most of these can easily be replaced by the methods they call) */ -/* */ -/*********************************************************************/ - -/** - * Renders an x/html opening link tag - * @param {Object} attr An object containing the tag attributes - */ -helma.Html.prototype.openLink = function(attr) { - this.openTag("a", attr); - return; -}; - -/** - * Returns an x/html opening link tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered open link tag - * @type String - * @see #openTag - */ -helma.Html.prototype.openLinkAsString = function(attr) { - return this.openTagAsString("a", attr); -}; - -/** - * Renders an x/html closing link tag - */ -helma.Html.prototype.closeLink = function() { - this.closeTag("a"); - return; -}; - -/** - * Returns a rendered x/html closing link tag - * @returns Rhe rendered closing link tag - * @type String - * @see #closeLink - */ -helma.Html.prototype.closeLinkAsString = function() { - return this.closeTagAsString("a"); -}; - -/** - * Renders a color definition string. If the string passed as - * argument contains only hex characters it will be prefixed with a - * hash sign if necessary, otherwise this method assumes that the - * value is a named color (eg. "yellow"). - * @param {String} c The color definintion - * @deprecated - */ -helma.Html.prototype.color = function(c) { - if (c) { - var nonhex = /[^0-9,a-f]/gi; - if (!c.match(nonhex)) { - c = c.pad("0", 6); - res.write("#"); - } - } - res.write(c); - return; -}; - -/** - * Returns a color definition. - * @param {String} c The color definintion - * @returns The rendered color definition - * @type String - * @see #color - * @deprecated - */ -helma.Html.prototype.colorAsString = function(c) { - res.push(); - this.color(c); - return res.pop(); -}; - -/** - * Renders an x/html opening form tag - * @param {Object} attr An object containing the tag attributes - */ -helma.Html.prototype.form = function(attr) { - this.openTag("form", attr); - return; -}; - -/** - * Returns an x/html opening form tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered opening form tag - * @type String - * @see #form - */ -helma.Html.prototype.formAsString = function(attr) { - res.push(); - this.form(attr); - return res.pop(); -}; - -/** - * Renders an x/html password input tag - * @param {Object} attr An object containing the tag attributes - */ -helma.Html.prototype.password = function(attr) { - if (!attr) { - res.write("[Html.password: insufficient arguments]"); - return; - } - attr.type = "password"; - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html password input tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered password input tag - * @type String - * @see #password - */ -helma.Html.prototype.passwordAsString = function(attr) { - res.push(); - this.password(attr); - return res.pop(); -}; - -/** - * Renders an x/html file input tag - * @param {Object} attr An object containing the tag attributes - */ -helma.Html.prototype.file = function(attr) { - if (!attr) { - res.write("[Html.file: insufficient arguments]"); - return; - } - attr.type = "file"; - this.tag("input", attr); - return; -}; - -/** - * Returns a rendered x/html file input tag - * @param {Object} attr An object containing the tag attributes - * @returns The rendered file input tag - * @type String - * @see #file - */ -helma.Html.prototype.fileAsString = function(attr) { - res.push(); - this.file(attr); - return res.pop(); -}; - -/** - * Parses the string passed as argument and converts any - * URL in it into a link tag - * @param {String} str The string wherein URLs should be - * converted into link tags - * @returns The string containing URLs converted into link tags - * @type String - */ -helma.Html.prototype.activateUrls = function(str) { - var re = /(^|\/>|\s+)([fhtpsr]+:\/\/[^\s]+?)([\.,;:\)\]\"]?)(?=[\s<]|$)/gim; - var func = function(str, p1, p2, p3) { - res.push(); - res.write(p1); - res.write(''); - res.write(p2.clip(50, "...", true)); - res.write(''); - res.write(p3); - return res.pop(); - }; - return str.replace(re, func); -}; - -/** - * Creates a new TableWriter instance - * @class This class provides various methods for - * programmatically creating an x/html table. - * @param {Number} numberOfColumns The number of columns in the table - * @param {Object} attr An object containing attributes to use when - * rendering the single table elements. For a description see {@link #table}. - * @returns An instance of TableWriter - * @constructor - */ -helma.Html.TableWriter = function(numberOfColumns, attr) { - if (isNaN(numberOfColumns)) - throw "Illegal argument in TableWriter(): first argument must be a number"; - if (numberOfColumns < 1) - throw "Illegal argument in TableWriter(): first argument must be > 1"; - /** @private */ - this.ncols = numberOfColumns; - /** @private */ - this.written = 0; - // if no attributes object given, create an empty one - if (!attr) - attr = {}; - if (!attr.trEven) attr.trEven = attr.tr; - if (!attr.trOdd) attr.trOdd = attr.tr; - if (!attr.trHead) attr.trHead = attr.trEven; - if (!attr.tdEven) attr.tdEven = attr.td; - if (!attr.tdOdd) attr.tdOdd = attr.td; - if (!attr.thEven) attr.thEven = attr.th; - if (!attr.thOdd) attr.thOdd = attr.th; - /** @private */ - this.attr = attr; - - /** - * If set to true the first row of the table data is rendered - * using <th> tags (defaults to false). - * @type Boolean - */ - this.writeHeader = false; - - /** - * If set to true the TableWriter returns the rendered table - * as string, otherwise the table is written directly to response, - * which is the default. - * @type Boolean - */ - this.writeString = false; - - this.dontEnum("ncols", "written", "attr", "writeHeader", "writeString"); - - return this; -}; - -/** @ignore */ -helma.Html.TableWriter.prototype.toString = function() { - return "[helma.Html.TableWriter]"; -} - -/** - * Writes a single table cell to response. - * @param {String} text The content of the table cess - * @param {Object} attr An optional object containig attributes - * to render for this table cell - */ -helma.Html.TableWriter.prototype.write = function(text, attr) { - // set up some variables - var isHeaderRow = (this.writeHeader && this.written < this.ncols); - var isNewRow = (this.written % this.ncols == 0); - var isEvenRow = ((this.written / this.ncols) % 2 == 0); - var isEvenCol = ((this.written % this.ncols) % 2 == 0); - // write out table and table row tags - if (this.written == 0) { - if (this.writeString) - res.push(); - helma.Html.prototype.openTag.call(this, "table", this.attr.table); - helma.Html.prototype.openTag.call(this, "tr", this.attr.trHead); - } else if (isNewRow) { - helma.Html.prototype.closeTag.call(this, "tr"); - if (isEvenRow) - helma.Html.prototype.openTag.call(this, "tr", this.attr.trEven); - else - helma.Html.prototype.openTag.call(this, "tr", this.attr.trOdd); - } - // get the attribute object for the table cell - if (!attr) { - // no explicit attribute given - if (isEvenCol) { - attr = isHeaderRow ? this.attr.thEven : this.attr.tdEven; - } else { - attr = isHeaderRow ? this.attr.thOdd : this.attr.tdOdd; - } - } - // write out table cell tag - helma.Html.prototype.openTag.call(this, isHeaderRow ? "th" : "td", attr); - // write out table cell contents - if (text) { - res.write(text); - } - // close table cell - helma.Html.prototype.closeTag.call(this, isHeaderRow ? "th" : "td"); - if (attr && !isNaN(attr.colspan)) { - this.written += attr.colspan; - } else { - this.written += 1; - } - return; -}; - -/** - * Closes all open table tags. If {@link #writeString} is set to - * true, this method returns the rendered table. - * @returns The rendered table, if {@link #writeString} is set to - * true, otherwise void. - * @type String - */ -helma.Html.TableWriter.prototype.close = function() { - if (this.written > 0) { - while (this.written++ % this.ncols != 0) - res.write(""); - res.write(""); - this.written = 0; - } - if (this.writeString) - return res.pop(); - return; -}; - - - -helma.lib = "Html"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -for (var i in helma[helma.lib].TableWriter.prototype) - helma[helma.lib].TableWriter.prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Http.js b/modules/helma/Http.js deleted file mode 100644 index f1cab23d..00000000 --- a/modules/helma/Http.js +++ /dev/null @@ -1,833 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Http.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Fields and methods of the helma.Http class. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Http.js') - */ - -// take care of any dependencies -app.addRepository('modules/core/Date.js'); - - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Creates a new instance of helma.Http - * @class This class provides functionality to programatically issue - * an Http request based on java.net.HttpUrlConnection. - * By default the request will use method GET. - * @returns A newly created helma.Http instance - * @constructor - */ -helma.Http = function() { - var self = this; - var proxy = null; - var content = ""; - var userAgent = "Helma Http Client"; - var method = "GET"; - var cookies = null; - var credentials = null; - var followRedirects = true; - var binaryMode = false; - var headers = {}; - var timeout = { - "connect": 0, - "socket": 0 - }; - var maxResponseSize = null; - var maxTries = 5; - var currentTries = 0; - - var responseHandler = function(connection, result) { - var input; - var stream; - try { - stream = connection.getInputStream(); - } catch (error) { - stream = connection.getErrorStream(); - } - if (stream) { - if (connection.getContentEncoding() === 'gzip') { - stream = new java.util.zip.GZIPInputStream(stream); - } - input = new java.io.BufferedInputStream(stream); - } - if (input) { - var body = new java.io.ByteArrayOutputStream(); - var buf = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024); - var len; - var currentSize = 0; - while ((len = input.read(buf)) > -1) { - body.write(buf, 0, len); - currentSize += len; - if (maxResponseSize && currentSize > maxResponseSize) { - throw new Error("Maximum allowed response size is exceeded"); - } - } - try { - input.close(); - } catch (error) { - // safe to ignore - } - if (binaryMode) { - result.content = body.toByteArray(); - } else { - result.content = result.charset ? - body.toString(result.charset) : - body.toString(); - } - // adjust content length - if (result.content) { - result.length = result.content.length; - } - } - }; - - /** @private */ - var setTimeout = function(type, value) { - var v = java.lang.System.getProperty("java.specification.version"); - if (parseFloat(v, 10) >= 1.5) { - timeout[type] = value; - } else { - app.logger.warn("helma.Http: Timeouts can only be set with Java Runtime version >= 1.5"); - } - return true; - } - - /** - * Sets the proxy host and port for later use. The argument must - * be in host:port format (eg. "proxy.example.com:3128"). - * @param {String} proxyString The proxy to use for this request - * @see #getProxy - */ - this.setProxy = function(proxyString) { - var idx = proxyString.indexOf(":"); - var host = proxyString.substring(0, idx); - var port = proxyString.substring(idx+1); - if (java.lang.Class.forName("java.net.Proxy") != null) { - // construct a proxy instance - var socket = new java.net.InetSocketAddress(host, port); - proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, socket); - } else { - // the pre jdk1.5 way: set the system properties - var sys = java.lang.System.getProperties(); - if (host) { - app.logger.warn("[Helma Http Client] WARNING: setting system http proxy to " + host + ":" + port); - sys.put("http.proxySet", "true"); - sys.put("http.proxyHost", host); - sys.put("http.proxyPort", port); - } - } - return; - }; - - /** - * Returns the proxy in host:port format - * @return The proxy defined for this request - * @type String - * @see #setProxy - */ - this.getProxy = function() { - if (proxy != null) { - return proxy.address().getHostName() + ":" + proxy.address().getPort(); - } else if (sys.get("http.proxySet") == "true") { - return sys.get("http.proxyHost") + ":" + sys.get("http.proxyPort"); - } else { - return null; - } - }; - - /** - * Sets the credentials for basic http authentication - * @param {String} username The username - * @param {String} password The password - */ - this.setCredentials = function(username, password) { - var str = username + ":" + password; - credentials = str.enbase64(); - return; - } - - /** - * Sets the content to send to the remote server within this request. - * @param {String|Object} stringOrObject The content of the request, which - * can be either a string or an object. In the latter case all properties - * and their values are concatenated into a single string. - * If a property is an array, then for each value the propertyname and value pair is added. - * If the name of an array property ends with "_array" then the _array part is removed. - */ - this.setContent = function(stringOrObject) { - if (stringOrObject != null) { - if (stringOrObject.constructor == Object) { - res.push(); - var value; - for (var key in stringOrObject) { - value = stringOrObject[key]; - if (value instanceof Array) { - if (key.substring(key.length - 6) == "_array") - key = key.substring(0,key.length - 6); - for (var i = 0; i < value.length; i++) { - res.write(encodeURIComponent(key)); - res.write("="); - res.write(encodeURIComponent(value[i])); - res.write("&"); - } - } else { - res.write(encodeURIComponent(key)); - res.write("="); - res.write(encodeURIComponent(value)); - res.write("&"); - } - } - content = res.pop(); - content = content.substring(0, content.length-1); - } else { - content = stringOrObject.toString(); - } - } else { - content = null; - } - return; - }; - - /** - * Sets the request method to use. - * @param {String} m The method to use (GET, POST ...) - * @see #getMethod - */ - this.setMethod = function(m) { - method = m; - return; - }; - - /** - * Returns the currently defined request method. - * @returns The method used - * @type String - * @see #setMethod - */ - this.getMethod = function() { - return method; - }; - - /** - * Sets a single HTTP request header field - * @param {String} name The name of the header field - * @param {String} value The value of the header field - * @see #getHeader - */ - this.setHeader = function(name, value) { - headers[name] = value; - return; - }; - - /** - * Returns the value of the request header field with the given name - * @param {String} name The name of the request header field - * @returns The value of the request header field - * @type String - * @see #setHeader - */ - this.getHeader = function(name) { - return headers[name]; - }; - - /** - * Adds a cookie with the name and value passed as arguments - * to the list of cookies to send to the remote server. - * @param {String} name The name of the cookie - * @param {String} value The value of the cookie - * @see #getCookie - * @see #getCookies - */ - this.setCookie = function(name, value) { - if (name != null && value != null) { - // store the cookie in the cookies map - if (!cookies) { - cookies = {}; - } - cookies[name] = new helma.Http.Cookie(name, value); - } - return; - }; - - /** - * Returns the value of the cookie with the given name - * @param {String} name The name of the cookie - * @returns The value of the cookie - * @type String - * @see #setCookie - */ - this.getCookie = function(name) { - return (cookies != null) ? cookies[name] : null; - }; - - /** - * Adds the cookies passed as argument to the list of cookies to send - * to the remote server. - * @param {Array} cookies An array containing objects with the properties - * "name" (the name of the cookie) and "value" (the value of the cookie) set. - */ - this.setCookies = function(cookies) { - if (cookies != null) { - for (var i=0; i - *
  • url: (String) The Url of the request
  • - *
  • location: (String) The value of the location header field
  • - *
  • code: (Number) The HTTP response code
  • - *
  • message: (String) An optional HTTP response message
  • - *
  • length: (Number) The content length of the response
  • - *
  • type: (String) The mimetype of the response
  • - *
  • charset: (String) The character set of the response
  • - *
  • encoding: (String) An optional encoding to use with the response
  • - *
  • lastModified: (String) The value of the lastModified response header field
  • - *
  • eTag: (String) The eTag as received from the remote server
  • - *
  • cookie: (helma.Http.Cookie) An object containing the cookie parameters, if the remote - server has set the "Set-Cookie" header field
  • - *
  • headers: (java.util.Map) A map object containing the headers, access them using get("headername") - *
  • content: (String|ByteArray) The response received from the server. Can be either - a string or a byte array (see #setBinaryMode)
  • - * - */ - this.getUrl = function(url, opt) { - if (typeof url == "string") { - if (!(url = helma.Http.evalUrl(url))) - throw new Error("'" + url + "' is not a valid URL."); - } else if (!(url instanceof java.net.URL)) { - throw new Error("'" + url + "' is not a valid URL."); - } - - var conn = proxy ? url.openConnection(proxy) : url.openConnection(); - // Note: we must call setInstanceFollowRedirects() instead of - // static method setFollowRedirects(), as the latter will - // set the default value for all url connections, and will not work for - // url connections that have already been created. - conn.setInstanceFollowRedirects(followRedirects); - conn.setAllowUserInteraction(false); - conn.setRequestMethod(method); - conn.setRequestProperty("User-Agent", userAgent); - - if (opt) { - if (opt instanceof Date) - conn.setIfModifiedSince(opt.getTime()); - else if ((typeof opt == "string") && (opt.length > 0)) - conn.setRequestProperty("If-None-Match", opt); - } - - var userinfo; - if (userinfo = url.getUserInfo()) { - userinfo = userinfo.split(/:/, 2); - this.setCredentials(userinfo[0], userinfo[1]); - } - if (credentials != null) { - conn.setRequestProperty("Authorization", "Basic " + credentials); - } - // set timeouts - if (parseFloat(java.lang.System.getProperty("java.specification.version"), 10) >= 1.5) { - conn.setConnectTimeout(timeout.connect); - conn.setReadTimeout(timeout.socket); - } - // set header fields - for (var i in headers) { - conn.setRequestProperty(i, headers[i]); - } - // set cookies - if (cookies != null) { - var arr = []; - for (var i in cookies) { - arr[arr.length] = cookies[i].getFieldValue(); - } - conn.setRequestProperty("Cookie", arr.join(";")); - } - // set content - if (content) { - conn.setRequestProperty("Content-Length", content.length); - conn.setDoOutput(true); - var out = new java.io.OutputStreamWriter(conn.getOutputStream()); - out.write(content); - out.flush(); - out.close(); - } - - var result = { - url: conn.getURL(), - location: conn.getHeaderField("location"), - code: conn.getResponseCode(), - message: conn.getResponseMessage(), - length: conn.getContentLength(), - type: conn.getContentType(), - encoding: conn.getContentEncoding(), - lastModified: null, - eTag: conn.getHeaderField("ETag"), - cookies: null, - headers: conn.getHeaderFields(), - content: null, - } - - // java.net.URLConnection does not follow redirects from http to https - // See https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4620571 - if (followRedirects && [301, 303].contains(result.code) && result.location) { - currentTries += 1; - if (currentTries >= maxTries) throw new Error('Too many redirects'); - return this.getUrl(result.location, opt); - } - - // parse all "Set-Cookie" header fields into an array of - // helma.Http.Cookie instances - var setCookies = conn.getHeaderFields().get("Set-Cookie"); - if (setCookies != null) { - var arr = []; - var cookie; - for (var i=0; i 0) { - result.cookies = arr; - } - } - - var lastmod = conn.getLastModified(); - if (lastmod) { - result.lastModified = new Date(lastmod); - } - - if (maxResponseSize && result.length > maxResponseSize) { - throw new Error("Maximum allowed response size is exceeded"); - } - - if (result.type && result.type.indexOf("charset=") != -1) { - var charset = result.type.substring(result.type.indexOf("charset=") + 8); - charset = charset.replace(/[;"]/g, '').trim(); - result.charset = charset; - } - - // invoke response handler - responseHandler(conn, result); - - conn.disconnect(); - return result; - } - - /** @ignore */ - this.toString = function() { - return "[Helma Http Client]"; - }; - - for (var i in this) - this.dontEnum(i); - - return this; -}; - - -/** - * Evaluates the url passed as argument. - * @param {String} url The url or uri string to evaluate - * @returns If the argument is a valid url, this method returns - * a new instance of java.net.URL, otherwise it returns null. - * @type java.net.URL - */ -helma.Http.evalUrl = function(url) { - try { - return new java.net.URL(url); - } catch (err) { - return null; - } -}; - - -/** - * Sets the global http proxy setting. If no proxy definition - * is passed to this method, any existing proxy setting is - * cleared. Internally this method sets the system properties - * http.proxySet, http.proxyHost and - * http.proxyPort. Keep in mind that this is valid for - * the whole Java Virtual Machine, therefor using this method - * can potentially influence other running Helma applications too! - * @param {String} proxyString A proxy definition in host:port - * format (eg. "proxy.example.com:3128"); - * @member helma.Http - */ -helma.Http.setProxy = function(proxyString) { - var sys = java.lang.System.getProperties(); - if (proxyString) { - var idx = proxyString.indexOf(":"); - var host = proxyString.substring(0, idx); - var port = proxyString.substring(idx+1); - if (!port) - port = "3128"; - else if (typeof port == "number") - port = port.toString(); - app.logger.info("helma.Http.setProxy " + proxyString); - sys.put("http.proxySet", "true"); - sys.put("http.proxyHost", host); - sys.put("http.proxyPort", port); - } else { - sys.put("http.proxySet", "false"); - sys.put("http.proxyHost", ""); - sys.put("http.prodyPort", ""); - } - return; - -}; - - -/** - * Returns the proxy setting of the Java Virtual Machine - * the Helma application server is running in. If no - * proxy is set, this method returns boolean false. - * @returns The global proxy setting in host:port - * format (eg. "proxy.example.com:3128"), or boolean false. - * @type String|Boolean - * @member helma.Http - */ -helma.Http.getProxy = function() { - var sys = java.lang.System.getProperties(); - if (sys.get("http.proxySet") == "true") - return sys.get("http.proxyHost") + ":" + sys.get("http.proxyPort"); - return false; -}; - - -/** - * Static helper method to check if a request issued agains a - * Helma application is authorized or not. - * @param {String} name The username to check req.username against - * @param {String} pwd The password to check req.password against - * @return True if the request is authorized, false otherwise. In - * the latter case the current response is reset and the response code - * is set to "401" ("Authentication required"). - * @type Boolean - */ -helma.Http.isAuthorized = function(name, pwd) { - if (!req.username || !req.password || - req.username != name || req.password != pwd) { - res.reset(); - res.status = 401; - res.realm = "Helma Http Authorization"; - res.write("Authorization required."); - return false; - } else { - return true; - } -}; - -/** @ignore */ -helma.Http.toString = function() { - return "[helma.Http]"; -}; - -/** - * Creates a new instance of helma.Http.Cookie - * @class Instances of this object represent a HTTP cookie - * @param {String} name The name of the cookie - * @param {String} value The value of the cookie - * @returns A newly created Cookie instance - * @constructor - */ -helma.Http.Cookie = function(name, value) { - /** - * The name of the Cookie - * @type String - */ - this.name = name; - - /** - * The value of the Cookie - * @type String - */ - this.value = value; - - /** - * An optional date defining the lifetime of this cookie - * @type Date - */ - this.expires = null; - - /** - * An optional path where this cookie is valid - * @type String - */ - this.path = null; - - /** - * An optional domain where this cookie is valid - * @type String - */ - this.domain = null; - - return this; -} - -/** - * An instance of java.text.SimpleDateFormat used for both parsing - * an "expires" string into a date and vice versa - * @type java.text.SimpleDateFormat - * @final - */ -helma.Http.Cookie.DATEFORMAT = new java.text.SimpleDateFormat("EEE, dd-MMM-yy HH:mm:ss z"); - - -/** - * A regular expression used for parsing cookie strings - * @type RegExp - * @final - */ -helma.Http.Cookie.PATTERN = /([^=;]+)=?([^;]*)(?:;\s*|$)/g; - - -/** - * Parses the cookie string passed as argument into an instance of helma.Http - * @param {String} cookieStr The cookie string as received from the remote server - * @returns An instance of helma.Http.Cookie containing the cookie parameters - * @type helma.Http.Cookie - */ -helma.Http.Cookie.parse = function(cookieStr) { - if (cookieStr != null) { - var cookie = new helma.Http.Cookie; - var m = helma.Http.Cookie.PATTERN.exec(cookieStr); - if (m) { - cookie.name = m[1].trim(); - cookie.value = m[2] ? m[2].trim() : ""; - } - while ((m = helma.Http.Cookie.PATTERN.exec(cookieStr)) != null) { - var key = m[1].trim(); - var value = m[2] ? m[2].trim() : ""; - switch (key.toLowerCase()) { - case "expires": - // try to parse the expires date string into a date object - try { - cookie.expires = helma.Http.Cookie.DATEFORMAT.parse(value); - } catch (e) { - // ignore - } - break; - default: - cookie[key.toLowerCase()] = value; - break; - } - } - return cookie; - } - return null; -}; - -/** - * Returns this cookie in a format useable to set the HTTP header field "Cookie" - * @return This cookie formatted as HTTP header field value - * @type String - */ -helma.Http.Cookie.prototype.getFieldValue = function() { - return this.name + "=" + this.value; -}; - -/** @ignore */ -helma.Http.Cookie.prototype.toString = function() { - return "[helma.Http.Cookie " + this.name + " " + this.value + "]"; -}; - -helma.lib = "Http"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -for (var i in helma[helma.lib].Cookie.prototype) - helma[helma.lib].Cookie.prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Image.js b/modules/helma/Image.js deleted file mode 100644 index 0d82691b..00000000 --- a/modules/helma/Image.js +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Image.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Methods of the helma.Image module. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Image.js') - */ - -if (!global.helma) { - global.helma = {}; -} - -/** - * Returns an Image object, generated from the specified source. - *

    - * If the JIMI package is installed, an instance of - * helma.image.jimi.JimiGenerator will be returned. Otherwise, - * if the javax.imageio package is available, an instance of - * helma.image.imageio.ImageIOGenerator is returned. - * Additionally, the class of the ImageGenerator implementation - * to be used can be set using the imageGenerator - * property in either the app.properties or server.properties - * file. - * - * - * @param {helma.File|java.io.File|String} arg image source, filename or url - * @return a new Image object - * @singleton - * @see Packages.helma.image.ImageGenerator - * @see Packages.helma.image.jimi.JimiGenerator - * @see Packages.helma.image.imageio.ImageIOGenerator - */ -helma.Image = function(arg) { - // according to - // http://grazia.helma.org/pipermail/helma-dev/2004-June/001253.html - var generator = Packages.helma.image.ImageGenerator.getInstance(); - return generator.createImage(arg); -} - -/** @ignore */ -helma.Image.toString = function() { - return "[helma.Image]"; -}; - - -/** - * Returns an ImageInfo object for the specified image file. - * - * @param {helma.File|java.io.File|String} arg image source, filename or url - * @returns an ImageInfo object - * @memberof helma.Image - * @see Packages.helma.image.ImageInfo - */ -helma.Image.getInfo = function(arg) { - if (arguments.length != 1) { - throw new java.lang.IllegalArgumentException( - "Image.getInfo() expects one argument" - ); - } - - var inp, result; - var info = new Packages.helma.image.ImageInfo(); - // FIXME: we need a byte array for class comparison - var b = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 0); - - try { - if (arg instanceof java.io.InputStream) { - inp = new java.io.InputStream(arg); - // FIXME: here comes a dirty hack to check for a byte array - } else if (arg.getClass && arg.getClass() == b.getClass()) { - inp = new java.io.ByteArrayInputStream(arg); - } else if (arg instanceof java.io.File) { - inp = new java.io.FileInputStream(arg); - } else if (arg instanceof helma.File) { - inp = new java.io.FileInputStream(arg.getFile()); - } else if (typeof arg == "string") { - var str = arg; - // try to interpret argument as URL if it contains a colon, - // otherwise or if URL is malformed interpret as file name. - if (str.indexOf(":") > -1) { - try { - var url = new java.net.URL(str); - inp = url.openStream(); - } catch (mux) { - inp = new java.io.FileInputStream(str); - } - } else { - inp = new java.io.FileInputStream(str); - } - } - if (inp == null) { - var msg = "Unrecognized argument in Image.getInfo(): "; - msg += (arg == null ? "null" : arg.getClass().toString()); - throw new java.lang.IllegalArgumentException(msg); - } - info.setInput(inp); - if (info.check()) { - result = info; - } - } catch (e) { - // do nothing, returns null later - } finally { - if (inp != null) { - try { - inp.close(); - } catch (e) {} - } - } - - return result; -}; - - -/** - * Writes a 1x1 pixel transparent spacer GIF image to the - * response buffer and sets the content type to image/gif. - * - * @memberof helma.Image - */ -helma.Image.spacer = function() { - res.contentType = "image/gif"; - res.writeBinary([71,73,70,56,57,97,2,0,2,0,-128,-1,0,-64,-64,-64,0,0,0,33,-7,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,64,2,2,68,1,0,59]); - return; -}; - -helma.lib = "Image"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; - - - diff --git a/modules/helma/Mail.js b/modules/helma/Mail.js deleted file mode 100644 index 5ea1a3b3..00000000 --- a/modules/helma/Mail.js +++ /dev/null @@ -1,705 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2007 Helma Software. All Rights Reserved. - * - * $RCSfile: Mail.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Fields and methods of the helma.Mail class. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Mail.js') - */ - -// take care of any dependencies -app.addRepository('modules/helma/File.js'); - -/** - * Define the global namespace if not existing - */ -if (!global.helma) { - global.helma = {}; -} - -/** - * Mail client enabling you to send e-mail via SMTP using Packages.javax.mail. - *

    - * @class This class provides functionality to sending - * Email messages. - * A mail client object is created by using the helma.Mail() - * constructor. The mail object then can be manipulated and sent - * using the methods listed below. - *

    - * You will either need to set your mail server via the smtp - * property in the app.properties or server.properties file - * or pass the hostname of the mail server you want to use as a - * parameter to the constructor. - *

    - * Note: Make sure that the SMTP server itself is well-configured, - * so that it accepts e-mails coming from your server and does - * not deny relaying. Best and fastest configuration is of course - * if you run your own SMTP server (e.g. postfix) which might be - * a bit tricky to set up, however.

    - * - * @param {String} smtp as String, the hostname of the mail server - * @constructor - */ -helma.Mail = function(host, port) { - // Error code values for this.status - var OK = 0; - var SUBJECT = 10; - var TEXT = 11; - var MIMEPART = 12; - var TO = 20; - var CC = 21; - var BCC = 22; - var FROM = 23; - var REPLYTO = 24; - var SETHEADER = 25; - var ADDHEADER = 26; - var GETHEADER = 27; - var REMOVEHEADER = 28; - var SEND = 30; - var MAILPKG = Packages.javax.mail; - - var self = this; - var errStr = "Error in helma.Mail"; - - var System = java.lang.System; - var Properties = java.util.Properties; - var IOException = java.io.IOException; - var Wrapper = Packages.org.mozilla.javascript.Wrapper; - var FileDataSource = Packages.javax.activation.FileDataSource; - var DataHandler = Packages.javax.activation.DataHandler; - - var MimePart = Packages.helma.util.MimePart; - var MimePartDataSource = Packages.helma.util.MimePartDataSource; - - var BodyPart = MAILPKG.BodyPart; - var Message = MAILPKG.Message; - var Session = MAILPKG.Session; - var InternetAddress = MAILPKG.internet.InternetAddress; - var AddressException = MAILPKG.internet.AddressException; - var MimeBodyPart = MAILPKG.internet.MimeBodyPart; - var MimeMessage = MAILPKG.internet.MimeMessage; - var MimeUtility = MAILPKG.internet.MimeUtility; - var MimeMultipart = MAILPKG.internet.MimeMultipart; - - var buffer, multipart, multipartType = "mixed"; - var username, password; - - var setStatus = function(status) { - if (self.status === OK) { - self.status = status; - } - return; - }; - - var getStatus = function() { - return self.status; - }; - - var addRecipient = function(addstr, name, type) { - if (addstr.indexOf("@") < 0) { - throw new AddressException(); - } - if (name != null) { - var address = new InternetAddress(addstr, - MimeUtility.encodeWord(name.toString())); - } else { - var address = new InternetAddress(addstr); - } - message.addRecipient(type, address); - return; - }; - - /** - * Adds the content stored in this helma.Mail instance - * to the wrapped message. - * @private - */ - var setContent = function() { - if (buffer != null) { - if (multipart != null) { - var part = new MimeBodyPart(); - part.setContent(buffer.toString(), "text/plain"); - multipart.addBodyPart(part, 0); - message.setContent(multipart); - } else { - message.setText(buffer.toString()); - } - } else if (multipart != null) { - message.setContent(multipart); - } else { - message.setText(""); - } - return; - }; - - /** - * Returns the text buffer of this mail message - * @returns The text buffer of this mail message - * @type java.lang.StringBuffer - * @private - */ - this.getBuffer = function() { - return buffer; - }; - - /** - * Returns the mime multipart object of this mail message - * @returns The mime multipart object of this mail message - * @type javax.mail.internet.MimeMultipart - * @private - */ - this.getMultipart = function() { - return multipart; - }; - - /** - * Sets username and password to use for SMTP authentication. - * @param {String} uname The username to use - * @param {String} pwd The password to use - */ - this.setAuthentication = function(uname, pwd) { - if (uname && pwd) { - username = uname; - password = pwd; - // enable smtp authentication - props.put("mail.smtp.auth", "true"); - } - return; - } - - /** - * Returns the wrapped message - * @returns The wrapped message - * @type javax.mail.internet.MimeMessage - */ - this.getMessage = function() { - return message; - }; - - /** - * Switches debug mode on or off. - * @param {Boolean} debug If true debug mode is enabled - */ - this.setDebug = function(debug) { - session.setDebug(debug === true); - }; - - /** - * The status of this Mail object. This equals 0 unless - * an error occurred. See {@link helma.Mail Mail.js} source code for a list of - * possible error codes. - */ - this.status = OK; - - /** - * Sets the sender of an e-mail message. - *

    - * The first argument specifies the receipient's - * e-mail address. The optional second argument - * specifies the name of the recipient. - * - * @param {String} addstr as String, sender email address - * @param {String} name as String, optional sender name - */ - this.setFrom = function(addstr, name) { - try { - if (addstr.indexOf("@") < 0) { - throw new AddressException(); - } - if (name != null) { - var address = new InternetAddress(addstr, - MimeUtility.encodeWord(name.toString())); - } else { - var address = new InternetAddress(addstr); - } - message.setFrom(address); - } catch (mx) { - app.logger.error(errStr + ".setFrom(): " + mx); - setStatus(FROM); - } - return; - }; - - /** - * Set a header in the e-mail message. If the given header is already set the previous - * value is replaced with the new one. - * @param name a header name - * @param value the header value - */ - this.setHeader = function(name, value) { - try { - message.addHeader(name, MimeUtility.encodeText(value)); - } catch (mx) { - app.logger.error(errStr + ".setHeader(): " + mx); - setStatus(SETHEADER); - } - return; - } - - /** - * Set a header in the e-mail message. If the given header is already set the previous - * value is replaced with the new one. - * @param name a header name - * @param value the header value - */ - this.addHeader = function(name, value) { - try { - message.addHeader(name, MimeUtility.encodeText(value)); - } catch (mx) { - app.logger.error(errStr + ".addHeader(): " + mx); - setStatus(ADDHEADER); - } - return; - } - - /** - * Get all the headers for this header name. - * Returns null if no headers for this header name are available. - * @param name a header name - * @return {String[]} a string array of header values, or null - */ - this.getHeader = function(name) { - var value = null; - try { - value = message.getHeader(name); - if (value && value.length) { - for (var i = 0; i < value.length; i++) { - value[i] = MimeUtility.decodeText(value[i]); - } - } - } catch (mx) { - app.logger.error(errStr + ".getHeader(): " + mx); - setStatus(GETHEADER); - } - return value; - } - - /** - * Remove all headers with this name. - * @param name the header name - */ - this.removeHeader = function(name) { - try { - message.removeHeader(name); - } catch (mx) { - app.logger.error(errStr + ".removeHeader(): " + mx); - setStatus(REMOVEHEADER); - } - return; - } - - /** - * Sets the Reply-To address of an e-mail message. - * - * @param {String} addstr as String, the reply-to email address - */ - this.setReplyTo = function(addstr) { - try { - if (addstr.indexOf("@") < 0) { - throw new AddressException(); - } - var address = [new InternetAddress(addstr)]; - message.setReplyTo(address); - } catch (mx) { - app.logger.error(errStr + ".setReplyTo(): " + mx); - setStatus(REPLYTO); - } - return; - } - - /** - * Sets the recipient of an e-mail message. - *   - * The first argument specifies the receipient's - * e-mail address. The optional second argument - * specifies the name of the recipient. - * - * @param {String} addstr as String, receipients email address - * @param {String} name as String, optional receipients name - * @see #addTo - */ - this.setTo = function(addstr, name) { - try { - addRecipient(addstr, name, Message.RecipientType.TO); - } catch (mx) { - app.logger.error(errStr + ".setTo(): " + mx); - setStatus(TO); - } - return; - }; - - /** - * Adds a recipient to the address list of an e-mail message. - *

    - * The first argument specifies the receipient's - * e-mail address. The optional second argument - * specifies the name of the recipient. - * - * @param {String} addstr as String, receipients email address - * @param {String} name as String, optional receipients name - * @see setTo - */ - this.addTo = function(addstr, name) { - try { - addRecipient(addstr, name, Message.RecipientType.TO); - } catch (mx) { - app.logger.error(errStr + ".addTo(): " + mx); - setStatus(TO); - } - return; - } - - /** - * Adds a recipient to the list of addresses to get a "carbon copy" - * of an e-mail message. - *

    - * The first argument specifies the receipient's - * e-mail address. The optional second argument - * specifies the name of the recipient. - * - * @param {String} addstr as String, receipients email address - * @param {String} name as String, optional receipients name - */ - this.addCC = function(addstr, name) { - try { - addRecipient(addstr, name, Message.RecipientType.CC); - } catch (mx) { - app.logger.error(errStr + ".addCC(): " + mx); - setStatus(CC); - } - return; - } - - /** - * Adds a recipient to the list of addresses to get a "blind carbon copy" of an e-mail message. - *

    - * The first argument specifies the receipient's - * e-mail address. The optional second argument - * specifies the name of the recipient. - * - * @param {String} addstr as String, receipients email address - * @param {String} name as String, optional receipients name - */ - this.addBCC = function(addstr, name) { - try { - addRecipient(addstr, name, Message.RecipientType.BCC); - } catch (mx) { - app.logger.error(errStr + ".addBCC(): " + mx); - setStatus(BCC); - } - return; - } - - /** - * Sets the subject of an e-mail message. - * - * @param {String} subject as String, the email subject - */ - this.setSubject = function(subject) { - if (!subject) { - return; - } - try { - message.setSubject(MimeUtility.encodeWord(subject.toString())); - } catch (mx) { - app.logger.error(errStr + ".setSubject(): " + mx); - setStatus(SUBJECT); - } - return; - }; - - /** - * Sets the body text of an e-mail message. - * - * @param {String} text as String, to be appended to the message body - * @see #addText - */ - this.setText = function(text) { - if (text) { - buffer = new java.lang.StringBuffer(text); - } - return; - }; - - /** - * Appends a string to the body text of an e-mail message. - * - * @param {String} text as String, to be appended to the message body - * @see #setText - */ - this.addText = function(text) { - if (buffer == null) { - buffer = new java.lang.StringBuffer(text); - } else { - buffer.append(text); - } - return; - }; - - /** - * Sets the MIME multiparte message subtype. The default value is - * "mixed" for messages of type multipart/mixed. A common value - * is "alternative" for the multipart/alternative MIME type. - * @param {String} messageType the MIME subtype such as "mixed" or "alternative". - * @see #getMultipartType - * @see #addPart - */ - this.setMultipartType = function(messageType) { - multipartType = messageType; - return; - }; - - /** - * Returns the MIME multiparte message subtype. The default value is - * "mixed" for messages of type multipart/mixed. - * @return the MIME subtype - * @type String - * @see #setMultipartType - * @see #addPart - */ - this.getMultipartType = function(messageType) { - return multipartType; - }; - - /** - * Adds an attachment to an e-mail message. - *

    - * The attachment needs to be either a helma.util.MimePart Object retrieved - * through the global getURL function, or a {@link helma.File} object, or a String. - *

    - * Use the getURL() function to retrieve a MIME object or wrap a - * helma.File object around a file of the local file system. - * - * @param {fileOrMimeObjectOrString} obj File, Mime object or String to attach to the email - * @param {String} filename optional name of the attachment - * @param {String} contentType optional content type (only if first argument is a string) - * @see global.getURL - * @see helma.util.MimePart - * @see helma.File - */ - this.addPart = function(obj, filename, contentType) { - try { - if (obj == null) { - throw new IOException( - errStr + ".addPart: method called with wrong number of arguments." - ); - } - if (multipart == null) { - multipart = new MimeMultipart(multipartType); - } - if (obj instanceof Wrapper) { - obj = obj.unwrap(); - } - - var part; - if (obj instanceof BodyPart) { - // we already got a body part, no need to convert it - part = obj; - } else { - part = new MimeBodyPart(); - if (typeof obj == "string") { - part.setContent(obj.toString(), contentType || "text/plain"); - } else if (obj instanceof File || obj instanceof helma.File) { - var source = new FileDataSource(obj.getPath()); - part.setDataHandler(new DataHandler(source)); - } else if (obj instanceof MimePart) { - var source = new MimePartDataSource(obj); - part.setDataHandler(new DataHandler(source)); - } - } - if (filename != null) { - try { - part.setFileName(filename.toString()); - } catch (x) {} - } else if (obj instanceof File || obj instanceof helma.File) { - try { - part.setFileName(obj.getName()); - } catch (x) {} - } - multipart.addBodyPart(part); - } catch (mx) { - app.logger.error(errStr + ".addPart(): " + mx); - setStatus(MIMEPART); - } - return; - }; - - /** - * Saves this mail RFC 822 formatted into a file. The name of the - * file is prefixed with "helma.Mail" followed by the current time - * in milliseconds and a random number. - * @param {helma.File} dir An optional directory where to save - * this mail to. If omitted the mail will be saved in the system's - * temp directory. - */ - this.writeToFile = function(dir) { - if (!dir || !dir.exists() || !dir.canWrite()) { - dir = new java.io.File(System.getProperty("java.io.tmpdir")); - } - var fileName = "helma.Mail." + (new Date()).getTime() + - "." + Math.round(Math.random() * 1000000); - var file = new java.io.File(dir, fileName); - if (file.exists()) { - file["delete"](); - } - try { - setContent(); - var fos = new java.io.FileOutputStream(file); - var os = new java.io.BufferedOutputStream(fos); - message.writeTo(os); - os.close(); - app.logger.info("helma.Mail.saveTo(): saved mail to " + - file.getAbsolutePath()); - } catch (e) { - app.logger.error(errStr + ".saveTo(): " + e); - } - return; - }; - - /** - * Returns the source of this mail as RFC 822 formatted string. - * @returns The source of this mail as RFC 822 formatted string - * @type String - */ - this.getSource = function() { - try { - setContent(); - var buf = new java.io.ByteArrayOutputStream(); - var os = new java.io.BufferedOutputStream(buf); - message.writeTo(os); - os.close(); - return buf.toString(); - } catch (e) { - app.logger.error(errStr + ".getSource(): " + e); - } - return null; - }; - - /** - * Sends an e-mail message. - *

    - * This function sends the message using the SMTP - * server as specified when the Mail object was - * constructed using helma.Mail. - *

    - * If no smtp hostname was specified when the Mail - * object was constructed, the smtp property in either - * the app.properties or server.properties file needs - * to be set in order for this to work. - *

    - * As a fallback, the message will then be written to - * file using the {@link #writeToFile} method. - * Additionally, the location of the message files can - * be determined by setting smtp.dir in app.properties - * to the desired file path. - */ - this.send = function() { - if (this.status > OK) { - app.logger.error(errStr + ".send(): Status is " + this.status); - return; - } - if (host != null) { - try { - setContent(); - message.setSentDate(new Date()); - var transport = session.getTransport("smtp"); - if (username && password) { - transport.connect(host, username, password); - } else { - transport.connect(); - } - message.saveChanges(); - transport.sendMessage(message, message.getAllRecipients()); - } catch (mx) { - app.logger.error(errStr + ".send(): " + mx); - setStatus(SEND); - } finally { - if (transport != null && transport.isConnected()) { - transport.close(); - } - } - } else { - // no smtp host is given, so write the mail to a file - this.writeToFile(getProperty("smtp.dir")); - } - return; - }; - - /** - * Main constructor body - */ - var props = new Properties(); - if (host || (host = getProperty("smtp"))) { - props.put("mail.transport.protocol", "smtp"); - props.put("mail.smtp.host", String(host)); - props.put("mail.smtp.port", String(port || 25)); - props.put("mail.smtp.starttls.enable", - getProperty("smtp.tls") || "false"); - props.put("mail.mime.charset", - getProperty("smtp.charset") || - System.getProperty("mail.charset") || - "ISO-8859-15"); - } - - this.setAuthentication(getProperty("smtp.username"), - getProperty("smtp.password")); - var session = Session.getInstance(props); - var message = new MimeMessage(session); - - for (var i in this) - this.dontEnum(i); - - return this; -} - - -/** @ignore */ -helma.Mail.toString = function() { - return "[helma.Mail]"; -}; - - -/** @ignore */ -helma.Mail.prototype.toString = function() { - return "[helma.Mail Object]"; -}; - -helma.Mail.example = function(host, sender, addr, subject, text) { - // var smtp = "smtp.host.dom"; - // var sender = "sender@host.dom"; - // var addr = "recipient@host.dom"; - // var subject = "Hello, World!"; - // var text = "This is a test."; - var port = 25; - var msg = new helma.Mail(host, port); - msg.setFrom(sender); - msg.addTo(addr); - msg.setSubject(subject); - msg.setText(text); - msg.send(); - res.write(msg.status); - return; -}; - - -helma.lib = "Mail"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Search.js b/modules/helma/Search.js deleted file mode 100644 index c4b97dd1..00000000 --- a/modules/helma/Search.js +++ /dev/null @@ -1,1458 +0,0 @@ -// -// A wrapper for Apache Lucene for use with Helma Object Publisher -// Copyright (c) 2005-2006 Robert Gaggl -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// -// $Revision$ -// $Author$ -// $Date$ -// - - -/** - * @fileoverview Fields and methods of the helma.Search class - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Search.js') - */ - -// take care of any dependencies -app.addRepository('modules/helma/lucene-core-2.2.0.jar'); -app.addRepository('modules/helma/lucene-analyzers-2.2.0.jar'); - - -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructs a new instance of helma.Search. This merely - * checks if the Apache Lucene library is in the application - * classpath. - * @class This class provides functionality for - * creating a fulltext search index based on Apache Lucene. - * @returns A newly created instance of this prototype. - * @constructor - * @author Robert Gaggl - */ -helma.Search = function() { - try { - var c = java.lang.Class.forName("org.apache.lucene.analysis.Analyzer", - true, app.getClassLoader()); - var pkg = Packages.org.apache.lucene.LucenePackage.get(); - var version = parseFloat(pkg.getSpecificationVersion()); - if (version < 2.2) { - throw "Incompatible version"; - } - } catch (e) { - throw "helma.Search needs lucene.jar in version >= 2.2 \ - in lib/ext or application directory \ - [http://lucene.apache.org/]"; - } - return this; -}; - - -/*************************************** - ***** S T A T I C M E T H O D S ***** - ***************************************/ - -/** @ignore */ -helma.Search.toString = function() { - return "[helma.Search]"; -}; - -/** - * Returns a new Analyzer instance depending on the key - * passed as argument. Currently supported arguments are - * "br" (BrazilianAnalyzer), "cn" (ChineseAnalyzer), "cz" (CzechAnalyzer), - * "nl" (DutchAnalyzer), "fr" (FrenchAnalyzer), "de" (GermanAnalyzer), - * "el" (GreekAnalyzer), "keyword" (KeywordAnalyzer), "ru" (RussianAnalyzer), - * "simple" (SimpleAnalyzer), "snowball" (SnowballAnalyzer), "stop" (StopAnalyzer) - * "whitespace" (WhitespaceAnalyzer). If no argument is given, a StandardAnalyzer - * is returned. - * @param {String} key The key identifying the analyzer - * @returns A newly created Analyzer instance - * @type {org.apache.lucene.analysis.Analyzer} - */ -helma.Search.getAnalyzer = function(key) { - var pkg = Packages.org.apache.lucene; - switch (key) { - case "br": - return new pkg.analysis.br.BrazilianAnalyzer(); - case "cn": - return new pkg.analysis.cn.ChineseAnalyzer(); - case "cz": - return new pkg.analysis.cz.CzechAnalyzer(); - case "nl": - return new pkg.analysis.nl.DutchAnalyzer(); - case "fr": - return new pkg.analysis.fr.FrenchAnalyzer(); - case "de": - return new pkg.analysis.de.GermanAnalyzer(); - case "el": - return new pkg.analysis.el.GreekAnalyzer(); - case "keyword": - return new pkg.analysis.KeywordAnalyzer(); - case "ru": - return new pkg.analysis.ru.RussianAnalyzer(); - case "simple": - return new pkg.analysis.SimpleAnalyzer(); - case "snowball": - return new pkg.analysis.snowball.SnowballAnalyzer(); - case "stop": - return new pkg.analysis.StopAnalyzer(); - case "whitespace": - return new pkg.analysis.WhitespaceAnalyzer(); - default: - return new pkg.analysis.standard.StandardAnalyzer(); - } -}; - -/** - * Constructs a new QueryFilter instance. This class - * wraps a lucene QueryFilter. - * @param {helma.Search.Query} q The query object to use as - * the basis for the QueryFilter instance. - * @returns A newly created QueryFilter instance. - * @constructor - */ -helma.Search.QueryFilter = function(q) { - var filter = new Packages.org.apache.lucene.search.QueryFilter(q.getQuery()); - - /** - * Returns the wrapped filter instance - * @type org.apache.lucene.search.QueryFilter - */ - this.getFilter = function() { - return filter; - }; - - return this; -}; - -/** @ignore */ -helma.Search.QueryFilter.prototype.toString = function() { - return this.getFilter().toString(); -}; - - - -/********************************************* - ***** P R O T O T Y P E M E T H O D S ***** - *********************************************/ - - -/** @ignore */ -helma.Search.prototype.toString = function() { - return helma.Search.toString(); -}; - -/** - * Returns an instance of org.apache.lucene.store.FSDirectory. If - * no index is present in the given directory, it is created on the fly. - * @param {File|helma.File|java.io.File|String} dir The directory - * where the index is located or should be created at. - * @param {Boolean} create If true the index will be created, removing - * any existing index in the same directory - * @returns The index directory. - * @type org.apache.lucene.store.FSDirectory - */ -helma.Search.prototype.getDirectory = function(dir, create) { - if (!dir) { - throw "helma.Search.getDirectory(): insufficient arguments."; - } - var d; - if (dir.constructor == String) { - d = new java.io.File(dir); - } else if (dir.constructor == File || dir.constructor == helma.File) { - d = new java.io.File(dir.getAbsolutePath()); - } else if (!((d = dir) instanceof java.io.File)) { - throw "helma.Search.getDirectory(): " + dir + " is not a valid argument."; - } - return Packages.org.apache.lucene.store.FSDirectory.getDirectory(d, - create === true || !d.exists()); -}; - -/** - * Returns a RAM directory object. - * @param {File|helma.File|java.io.File|String} dir Optional directory - * containing a Lucene index from which this RAM directory should be created. - * @returns A RAM directory instance. - * @type org.apache.lucene.store.RAMDirectory - */ -helma.Search.prototype.getRAMDirectory = function(dir) { - if (dir != null) { - var d; - if (dir.constructor == String) { - d = new java.io.File(dir); - } else if (dir.constructor == File || dir.constructor == helma.File) { - d = new java.io.File(dir.getAbsolutePath()); - } else if (!((d = dir) instanceof java.io.File)) { - throw "helma.Search.getRAMDirectory(): " + dir + " is not a valid argument."; - } - if (!d.exists()) { - throw "helma.Search.getRAMDirectory(): " + dir + " does not exist."; - } - return Packages.org.apache.lucene.store.RAMDirectory(d); - } - return Packages.org.apache.lucene.store.RAMDirectory(); -}; - -/** - * Creates a new Lucene index in the directory passed as - * argument, using an optional analyzer, and returns an instance - * of helma.Search.Index. Any already existing index in this - * directory will be preserved. - * @param {org.apache.lucene.store.Directory} dir The directory - * where the index should be stored. This can be either a - * FSDirectory or a RAMDirectory instance. - * @param {org.apache.lucene.analysis.Analyzer} analyzer The analyzer to - * use for the index. If not specified a StandardAnalyzer will be used. - * @returns The index instance. - * @type helma.Search.Index - */ -helma.Search.prototype.createIndex = function(dir, analyzer) { - if (!dir || !(dir instanceof Packages.org.apache.lucene.store.Directory)) { - throw "Index directory missing or invalid."; - } else if (!analyzer) { - // no analyzer given, use a StandardAnalyzer - analyzer = helma.Search.getAnalyzer(); - } - var index = new helma.Search.Index(dir, analyzer); - if (!Packages.org.apache.lucene.index.IndexReader.indexExists(dir)) { - index.create(); - } - return index; -}; - - -/********************* - ***** I N D E X ***** - *********************/ - - -/** - * Creates a new instance of helma.Search.Index - * @class Instances of this class represent a Lucene search index - * located in either a directory on disk or in RAM. This class - * provides various methods for modifying the underlying Lucene index. - * @param {org.apache.lucene.store.Directory} directory The directory - * where the Lucene index is located at. - * @param {org.apache.lucene.analysis.Analyzer} analyzer The analyzer - * to use when modifying the index. - * @constructor - */ -helma.Search.Index = function(directory, analyzer) { - - /** - * Returns an IndexWriter instance that can be used to add documents to - * the underlying index or to perform various other modifying operations. - * If the index is currently locked this method will try for the next - * two seconds to create the IndexWriter, otherwise it will - * throw an error. - * @param {Boolean} create True to create the index (overwriting an - * existing index), false to append to an existing index. Defaults to false - * @param {Boolean} autoCommit Enables or disables auto commit (defaults to - * false) - * @returns An IndexWriter instance. - * @type org.apache.lucene.index.IndexWriter - */ - this.getWriter = function(create, autoCommit) { - try { - return new Packages.org.apache.lucene.index.IndexWriter(directory, - (autoCommit === true), analyzer, (create === true)); - } catch (e) { - throw "Failed to get IndexWriter due to active lock (Thread " - + java.lang.Thread.currentThread().getId() + ")"; - } - }; - - /** - * Returns an IndexReader instance. Due to locking issues an - * IndexModifier should be used for deleting documents. - * @returns An IndexReader instance - * @type org.apache.lucene.index.IndexReader - */ - this.getReader = function() { - return Packages.org.apache.lucene.index.IndexReader.open(directory); - }; - - /** - * Returns the directory the underlying Lucene index is located at. - * @returns The directory of this index - * @type org.apache.lucene.store.Directory - */ - this.getDirectory = function() { - return directory; - }; - - /** - * Returns the analyzer used within this index. - * @returns The analyzer used within this index. - * @type org.apache.lucene.analysis.Analyer - */ - this.getAnalyzer = function() { - return analyzer; - }; - - /** - * Returns a searcher for querying this index. - * @returns A searcher useable for querying the index. - * @type helma.Search.Searcher - */ - this.getSearcher = function() { - return new helma.Search.Searcher(this); - }; - - /** @ignore */ - this.toString = function() { - return ("[Lucene Index " + directory + "]"); - }; - - return this; -}; - -/** - * Merges the indexes passed as argument into this one. - * @param {org.apache.lucene.store.Directory} dir At least one - * index director to add to this index. - */ -helma.Search.Index.prototype.addIndexes = function(dir /* [, dir[, dir...] */) { - var dirs = java.lang.reflect.Array.newInstance( - Packages.org.apache.lucene.store.Directory, - arguments.length); - for (var i=0;i 0) { - var arr = java.lang.reflect.Array.newInstance(pkg.SortField, this.sortFields.size()); - var sort = pkg.Sort(this.sortFields.toArray(arr)); - if (filter) { - hits = searcher.search(query, filter, sort); - } else { - hits = searcher.search(query, sort); - } - } else if (filter) { - hits = searcher.search(query, filter); - } else { - hits = searcher.search(query); - } - this.hits = new helma.Search.HitCollection(hits); - return this.hits.length(); -}; - -/** - * Sets a field as result sorting field. This method can be called - * with a different number of arguments: - * sortBy(fieldName) - * sortBy(fieldName, type) - * sortBy(fieldName, reverse) - * sortBy(fieldName, type, reverse) - * @param {String} fieldName The name of the field in the index by which - * the search result should be ordered. - * @param {String} type The type of the field defined by argument fieldName. - * Valid arguments are "string", "float", "int", "score", "doc", "auto", "custom". - * Default is "auto". See http://lucene.apache.org/java/docs/api/org/apache/lucene/search/SortField.html - * for an explanation. - */ -helma.Search.Searcher.prototype.sortBy = function(fieldName /** type, reverse */) { - var pkg = Packages.org.apache.lucene.search; - if (!this.sortFields) - this.sortFields = new java.util.Vector(); - var f = fieldName; - var t = pkg.SortField.AUTO; - var r = false; - if (arguments.length == 3) { - t = pkg.SortField[arguments[1].toUpperCase()]; - r = arguments[2]; - } else if (arguments.length == 2) { - if (arguments[1].constructor == Boolean) { - r = arguments[1]; - } else { - t = pkg.SortField[arguments[1].toUpperCase()]; - } - } - this.sortFields.add(new pkg.SortField(f, t, r)); - return; -}; - -/** - * Closes the wrapped IndexSearcher instance. - */ -helma.Search.Searcher.prototype.close = function() { - var s = this.getSearcher(); - if (s != null) { - s.close(); - } - return; -}; - -/** - * Creates a new instance of helma.Search.HitCollection - * @class This class provides Helma-like methods for accessing - * a collection of search hits. - * @param {org.lucene.search.Hits} hits The hit collection returned - * by lucene. - * @constructor - */ -helma.Search.HitCollection = function(hits) { - /** - * Silently converts the hit at the given index position into - * an instance of helma.Search.Document. - * @param {Number} idx The index position of the hit - * @returns The document object at the given index position - * @type helma.Search.Document - */ - this.get = function(idx) { - var doc = new helma.Search.Document(hits.doc(idx)); - doc.id = hits.id(idx); - doc.score = hits.score(idx); - doc.rank = idx +1; - return doc; - }; - - /** - * Returns the number of hits in this collection. - * @returns The number of hits. - * @type Number - */ - this.size = function() { - return (hits != null) ? hits.length() : 0; - }; - - /** - * Returns the number of hits in this collection. - * This method is deprecated, use {@link #size} instead. - * @returns The number of hits. - * @type Number - * @deprecated - * @see #size - */ - this.length = function() { - return this.size(); - }; - - /** - * Executes a provided function once per hit. - * @param {Function} fun Function to execute for each element - * @param {Object} context Object to use as "this" when executing callback. - * @see https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/Array/ForEach - */ - this.forEach = function(func, context) { - if (typeof func != "function") { - throw new TypeError(); - } - var len = this.size(); - for (var i = 0; i < len; i += 1) { - var hit = this.get(i); - if (hit) { - func.call(context, hit, i, hits); - } - } - return; - }; - - return this; -}; - -/** @ignore */ -helma.Search.HitCollection.prototype.toString = function() { - return "[HitCollection]"; -}; - -/*********************************************** - ***** Q U E R Y C O N S T R U C T O R S ***** - ***********************************************/ - -/** - * Creates a new instance of helma.Search.Query - * @class Base class for the various query constructors. Don't - * call this directly, as it provides just basic methods used - * in all of its extends. - * @constructor - */ -helma.Search.Query = function() { - /** - * The wrapped query instance - * @type org.apache.lucene.search.Query - * @private - */ - this.query = null; - - return this; -}; - -/** - * Returns the wrapped Lucene Query object. - * @returns The wrapped query object - * @type org.apache.lucene.search.Query - */ -helma.Search.Query.prototype.getQuery = function() { - return this.query; -}; - -/** @ignore */ -helma.Search.Query.prototype.toString = function(field) { - return "[" + this.getQuery().toString(field) + "]"; -}; - -/** - * Returns the boost factor of this query. - * @type Number - */ -helma.Search.Query.prototype.getBoost = function() { - return this.getQuery().getBoost(); -}; - -/** - * Sets the boost factor of this query clause to - * the given number. Documents matching this query - * will have their score multiplied with the given - * factor - * @param {Number} fact The factor to multiply the score - * of matching documents with. - */ -helma.Search.Query.prototype.setBoost = function(fact) { - this.getQuery().setBoost(fact); - return; -}; - -/** - * Creates a new instance of helma.Search.TermQuery - * @class This class represents a simple Term Query. - * @param {String} field The name of the field - * @param {String} str The value of the field - * @constructor - * @extends helma.Search.Query - */ -helma.Search.TermQuery = function(field, str) { - var t = new Packages.org.apache.lucene.index.Term(field, str); - /** - * Contains the wrapped TermQuery instance - * @type org.apache.lucene.search.TermQuery - */ - this.query = new Packages.org.apache.lucene.search.TermQuery(t); - return this; -}; -helma.Search.TermQuery.prototype = new helma.Search.Query; - -/** - * Creates a new instance of helma.Search.BooleanQuery - * @class This class represents a Boolean Query, providing - * various methods for combining other Query instances using boolean operators. - * @param String name of the field - * @param String query string - * @returns Object BooleanQuery object - * @constructor - * @extends helma.Search.Query - */ -helma.Search.BooleanQuery = function(field, str, clause, analyzer) { - /** - * Contains the wrapped BooleanQuery instance - * @type org.apache.lucene.search.BooleanQuery - */ - this.query = new Packages.org.apache.lucene.search.BooleanQuery(); - - /** - * Main constructor body - */ - if (field && str) { - this.addTerm.apply(this, arguments); - } - - return this; -}; -helma.Search.BooleanQuery.prototype = new helma.Search.Query; - -/** - * Adds a term to the wrapped query object. This method can be called - * with two, three or four arguments, eg.: - *
    addTerm("fieldname", "querystring")
    - * addTerm("fieldname", "querystring", "and")
    - * addTerm("fieldname", "querystring", helma.Search.getAnalyzer("de"))
    - * addTerm("fieldname", "querystring", "not", helma.Search.getAnalyzer("simple"))
    - * @param {String|Array} field Either a String or an Array containing Strings - * that determine the index field(s) to match - * @param {String} str Query string to match - * @param {String} clause Boolean clause ("or", "not" or "and", default is "and") - * @param {org.apache.lucene.analysis.Analyzer} analyzer An analyzer to use - */ -helma.Search.BooleanQuery.prototype.addTerm = function(field, str, clause, analyzer) { - var pkg = Packages.org.apache.lucene; - if (arguments.length == 3 && arguments[2] instanceof pkg.analysis.Analyzer) { - analyzer = arguments[2]; - clause = "or"; - } - if (!analyzer) { - analyzer = helma.Search.getAnalyzer(); - } - - var fields = (field instanceof Array) ? field : [field]; - var parser = new pkg.queryParser.MultiFieldQueryParser(fields, analyzer); - this.addQuery(parser.parse(str), clause); - return; -}; - -/** - * Adds an additional query clause to this query. - * @param {helma.Search.Query} q The query to add - * @param {String} clause Boolean clause ("or", "not", or "and", default is "and") - */ -helma.Search.BooleanQuery.prototype.addQuery = function(q, clause) { - var pkg = Packages.org.apache.lucene; - var booleanClause; - if (q instanceof helma.Search.Query) { - q = q.getQuery(); - } - switch (clause) { - case "and": - booleanClause = pkg.search.BooleanClause.Occur.MUST; - break; - case "not": - booleanClause = pkg.search.BooleanClause.Occur.MUST_NOT; - break; - default: - booleanClause = pkg.search.BooleanClause.Occur.SHOULD; - break; - } - this.getQuery().add(q, booleanClause); - return; -}; - -/** - * Constructs a new helma.Search.PhraseQuery instance that wraps - * a Lucene Phrase Query object. - * @class Instances of this class represent a phrase query. - * @param {String} field The name of the field - * @param {String} str The phrase query string - * @returns A newly created PhraseQuery instance - * @constructor - * @extends helma.Search.Query - */ -helma.Search.PhraseQuery = function(field, str) { - /** - * Contains the wrapped PhraseQuery instance - * @type org.apache.lucene.search.PhraseQuery - */ - this.query = new Packages.org.apache.lucene.search.PhraseQuery(); - - /** - * add a term to the end of the phrase query - */ - this.addTerm = function(field, str) { - var t = new Packages.org.apache.lucene.index.Term(field, str); - this.query.add(t); - return; - }; - - if (field && str) - this.addTerm(field, str); - delete this.base; - return this; -}; -helma.Search.PhraseQuery.prototype = new helma.Search.Query; - -/** - * Constructs a new helma.Search.RangeQuery instance. - * @class Instances of this class represent a range - * query, wrapping a Lucene RangeQuery instance. - * @param {String} field The name of the field - * @param {String} from The minimum value to match (can be null) - * @param {String} to The maximum value to match (can be null) - * @param {Boolean} inclusive If true the given min/max values are included - * @returns A newly created RangeQuery instance - * @constructor - * @extends helma.Search.Query - */ -helma.Search.RangeQuery = function(field, from, to, inclusive) { - if (!field) - throw "Missing field name in RangeQuery()"; - if (arguments.length < 4) - inclusive = true; - var t1 = from ? new Packages.org.apache.lucene.index.Term(field, from) : null; - var t2 = to ? new Packages.org.apache.lucene.index.Term(field, to) : null; - /** - * Contains the wrapped RangeQuery instance - * @type org.apache.lucene.search.RangeQuery - */ - this.query = new Packages.org.apache.lucene.search.RangeQuery(t1, t2, inclusive); - return this; -}; -helma.Search.RangeQuery.prototype = new helma.Search.Query; - -/** - * Constructs a new helma.Search.FuzzyQuery instance. - * @class Instances of this class represent a fuzzy query - * @param {String} field The name of the field - * @param {String} str The query string to match - * @returns A newly created FuzzyQuery instance - * @constructor - * @extends helma.Search.Query - */ -helma.Search.FuzzyQuery = function(field, str) { - var t = new Packages.org.apache.lucene.index.Term(field, str); - /** - * Contains the wrapped FuzzyQuery instance - * @type org.apache.lucene.search.FuzzyQuery - */ - this.query = new Packages.org.apache.lucene.search.FuzzyQuery(t); - return this; -}; -helma.Search.FuzzyQuery.prototype = new helma.Search.Query; - -/** - * Constructs a new helma.Search.PrefixQuery instance. - * @class Instances of this class represent a prefix query - * @param {String} field The name of the field - * @param {String} str The query string to match - * @returns A newly created PrefixQuery instance - * @constructor - * @extends helma.Search.Query - */ -helma.Search.PrefixQuery = function(field, str) { - var t = new Packages.org.apache.lucene.index.Term(field, str); - /** - * Contains the wrapped PrefixQuery instance - * @type org.apache.lucene.search.PrefixQuery - */ - this.query = new Packages.org.apache.lucene.search.PrefixQuery(t); - return this; -}; -helma.Search.PrefixQuery.prototype = new helma.Search.Query; - -/** - * Constructs a new helma.Search.WildcardQuery instance. - * @class Instances of this class represent a wildcard query. - * @param {String} field The name of the field - * @param {String} str The query string to match - * @returns A newly created WildcardQuery instance - * @constructor - * @extends helma.Search.Query - */ -helma.Search.WildcardQuery = function(field, str) { - var t = new Packages.org.apache.lucene.index.Term(field, str); - /** - * Contains the wrapped WildcardQuery instance - * @type org.apache.lucene.search.WildcardQuery - */ - this.query = new Packages.org.apache.lucene.search.WildcardQuery(t); - return this; -}; -helma.Search.WildcardQuery.prototype = new helma.Search.Query; - - - -/*************************** - ***** D O C U M E N T ***** - ***************************/ - - -/** - * Creates a new instance of helma.Search.Document. - * @class Instances of this class represent a single - * index document. This class provides various methods for - * adding content to such documents. - * @param {org.apache.lucene.document.Document} document Optional Lucene Document object - * that should be wrapped by this Document instance. - * @constructor - */ -helma.Search.Document = function(document) { - if (!document) { - document = new Packages.org.apache.lucene.document.Document(); - } - - /** - * Returns the wrapped Lucene Document object - * @returns The wrapped Document object - * @type org.apache.lucene.document.Document - */ - this.getDocument = function() { - return document; - }; - - return this; -}; - -/** - * Adds a field to this document. - * @param {String|helma.Search.Document.Field} name The name of the field, or - * an instance of {@link helma.Search.Document.Field}, in which case the other - * arguments are ignored. - * @param {String} value The value of the field - * @param {Object} options Optional object containing the following properties - * (each of them is optional too): - *
      - *
    • store (String) Defines whether and how the value is stored - * in the field. Accepted values are "no", "yes" and "compress" (defaults to "yes")
    • - *
    • index (String) Defines whether and how the value is indexed - * in the field. Accepted values are "no", "tokenized", "unTokenized" and - * "noNorms" (defaults to "tokenized")
    • - *
    • termVector (String) Defines if and how the fiels should have - * term vectors. Accepted values are "no", "yes", "withOffsets", "withPositions" - * and "withPositionsAndOffsets" (defaults to "no")
    • - *
    - */ -helma.Search.Document.prototype.addField = function(name, value, options) { - if (!name) { - throw "helma.Search: missing arguments to Document.addField"; - } else if (arguments.length == 1) { - if (arguments[0] instanceof Packages.org.apache.lucene.document.Field) { - this.getDocument().add(arguments[0]); - } else if (arguments[0] instanceof helma.Search.Document.Field) { - this.getDocument().add(arguments[0].getField()); - } - return; - } - - // for backwards compatibility only - if (options != null) { - if (typeof(options.store) === "boolean") { - options.store = (options.store === true) ? "yes" : "no"; - } - if (typeof(options.index) === "boolean") { - if (options.index === true) { - options.index = (options.tokenize === true) ? "tokenized" : "unTokenized"; - } else { - options.index = "no"; - } - delete options.tokenize; - } - } - this.addField(new helma.Search.Document.Field(name, value, options)); - return; -}; - -/** - * Returns a single document field. - * @param {String} name The name of the field in this document object. - * @returns The field with the given name - * @type helma.Search.Document.Field - */ -helma.Search.Document.prototype.getField = function(name) { - var f = this.getDocument().getField(name); - if (f != null) { - return new helma.Search.Document.Field(f); - } - return null; -}; - -/** - * Returns the fields of a document object. If a name is passed as argument, - * this method returns only the fields with the given name - * @param {String} name Optional name of the fields to return - * @returns An array containing all fields in this document object. - * @type Array - */ -helma.Search.Document.prototype.getFields = function(name) { - var fields; - if (name != null) { - fields = this.getDocument().getFields(name); - } else { - fields = this.getDocument().getFields().toArray(); - } - var size = fields.length; - var result = new Array(size); - for (var i=0; i - *
  • store (String) Defines whether and how the value is stored - * in the field. Accepted values are "no", "yes" and "compress" (defaults to "yes")
  • - *
  • index (String) Defines whether and how the value is indexed - * in the field. Accepted values are "no", "tokenized", "unTokenized" and - * "noNorms" (defaults to "tokenized")
  • - *
  • termVector (String) Defines if and how the fiels should have - * term vectors. Accepted values are "no", "yes", "withOffsets", "withPositions" - * and "withPositionsAndOffsets" (defaults to "no")
  • - * - */ -helma.Search.Document.Field = function(name, value, options) { - var field; - - /** - * Contains the name of the field - * @type String - */ - this.name = undefined; // for documentation purposes only - this.__defineGetter__("name", function() { - return field.name(); - }); - - /** - * Contains the string value of the field - * @type String - */ - this.value = undefined; // for documentation purposes only - this.__defineGetter__("value", function() { - return field.stringValue(); - }); - - /** - * Contains the value of the field converted into a date object. - * @type String - */ - this.dateValue = undefined; // for documentation purposes only - this.__defineGetter__("dateValue", function() { - return Packages.org.apache.lucene.document.DateTools.stringToDate(this.value); - }); - - /** - * Returns the wrapped field instance - * @returns The wrapped field - * @type org.apache.lucene.document.Field - */ - this.getField = function() { - return field; - }; - - /** - * Main constructor body - */ - if (arguments.length == 1 && arguments[0] instanceof Packages.org.apache.lucene.document.Field) { - // calling the constructor with a single field argument is - // only used internally (eg. in Document.getFields()) - field = arguments[0]; - } else { - var pkg = Packages.org.apache.lucene.document.Field; - // default options - var store = pkg.Store.YES; - var index = pkg.Index.TOKENIZED; - var termVector = pkg.TermVector.NO; - - var opt; - if (options != null) { - if (options.store != null) { - opt = options.store.toUpperCase(); - if (opt == "YES" || opt == "NO" || opt == "COMPRESS") { - store = pkg.Store[opt]; - } else { - app.logger.warn("helma.Search: unknown field storage option '" + - options.store + "'"); - } - } - if (options.index != null) { - opt = options.index.toUpperCase(); - if (opt == "TOKENIZED" || opt == "NO") { - index = pkg.Index[opt]; - } else if (opt == "UNTOKENIZED") { - index = pkg.Index.UN_TOKENIZED; - } else if (opt == "NONORMS") { - index = pkg.Index.NO_NORMS; - } else { - app.logger.warn("helma.Search: unknown field indexing option '" + - options.index + "'"); - } - } - if (options.termVector != null) { - opt = options.termVector.toUpperCase(); - if (opt == "NO" || opt == "YES") { - termVector = pkg.TermVector[opt]; - } else if (opt == "WITHOFFSETS") { - termVector = pkg.TermVector.WITH_OFFSETS; - } else if (opt == "WITHPOSITIONS") { - termVector = pkg.TermVector.WITH_POSITIONS; - } else if (opt == "WITHPOSITIONSANDOFFSETS") { - termVector = pkg.TermVector.WITH_POSITIONS_OFFSETS; - } else { - app.logger.warn("helma.Search: unknown field term vector option '" + - options.termVector + "'"); - } - } - } - - // construct the field instance and add it to this document - field = new Packages.org.apache.lucene.document.Field( - name, helma.Search.Document.Field.valueToString(value), - store, index, termVector); - } - - return this; -}; - -/** - * Converts the value passed as argument to the appropriate string value. For - * null values this method returns an empty string. - * @param {Object} value The value to convert into a string - * @returns The value converted into a string - * @type String - */ -helma.Search.Document.Field.valueToString = function(value) { - var pkg = Packages.org.apache.lucene.document; - if (value != null) { - if (value.constructor === Date) { - return pkg.DateTools.timeToString(value.getTime(), pkg.DateTools.Resolution.MINUTE); - } else if (value.constructor !== String) { - return String(value); - } - return value; - } - return ""; -}; - -/** @ignore */ -helma.Search.Document.Field.prototype.toString = function() { - return "[Field '" + this.name + "' (" + this.getField().toString() + ")]"; -}; - -/** - * Returns the boost factor of this field. - * @returns The boost factor of this field - * @type Number - */ -helma.Search.Document.Field.prototype.getBoost = function() { - return this.getField().getBoost(); -}; - -/** - * Sets the boost factor of this field. - * @param {Number} boost The boost factor of this field - */ -helma.Search.Document.Field.prototype.setBoost = function(boost) { - this.getField().setBoost(boost); - app.logger.debug("boost is now: " + this.getField().getBoost()); - return; -}; - -/** - * Returns true if this field is indexed - * @returns True if this field's value is indexed, false otherwise - * @type Boolean - */ -helma.Search.Document.Field.prototype.isIndexed = function() { - return this.getField().isIndexed(); -}; - -/** - * Returns true if this field's value is stored in compressed form in the index - * @returns True if this field's value is compressed, false otherwise - * @type Boolean - */ -helma.Search.Document.Field.prototype.isCompressed = function() { - return this.getField().isCompressed(); -}; - -/** - * Returns true if this field's value is stored in the index - * @returns True if this field's value is stored, false otherwise - * @type Boolean - */ -helma.Search.Document.Field.prototype.isStored = function() { - return this.getField().isStored(); -}; - -/** - * Returns true if this field's value is tokenized - * @returns True if this field's value is tokenized, false otherwise - * @type Boolean - */ -helma.Search.Document.Field.prototype.isTokenized = function() { - return this.getField().isTokenized(); -}; - -/** - * Returns true if this field's term vector is stored in the index - * @returns True if this field's term vector is stored, false otherwise - * @type Boolean - */ -helma.Search.Document.Field.prototype.isTermVectorStored = function() { - return this.getField().isTermVectorStored(); -}; - - -helma.lib = "Search"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Skin.js b/modules/helma/Skin.js deleted file mode 100644 index 60325858..00000000 --- a/modules/helma/Skin.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Skin.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Fields and methods of the helma.Skin class. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Skin.js') - */ - - -// define the helma namespace, if not existing -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructs a new instance of helma.Skin - * @class Instances of this class represent a Helma skin. In addition - * to the standard skin functionality this class allows creation of - * a skin based on a Base64 encoded source. - * @param {String} source The source of the skin - * @param {Boolean} encFlag If true the source will be Base64-decoded. - * @constructor - * @returns A newly created instance of helma.Skin - */ -helma.Skin = function(source, encFlag) { - /** @ignore */ - var Base64 = Packages.helma.util.Base64; - - if (!encFlag) { - var skin = createSkin(source); - } else { - var encoded = source; - source = new java.lang.String(source); - var bytes = Base64.decode(source.toCharArray()); - var skin = createSkin(new java.lang.String(bytes, "UTF-8")); - } - - /** @ignore */ - this.toString = function() { - return source; - }; - - /** - * Returns the source of the skin as Base64 encoded string - * @returns The source of the skin as Base64 encoded string - * @type String - */ - this.valueOf = function() { - if (encFlag) { - return encoded; - } - var bytes = new java.lang.String(source).getBytes("UTF-8"); - return new java.lang.String(Base64.encode(bytes)); - }; - - /** - * Renders the skin. - * @param {Object} param An optional parameter object to pass to the skin. - */ - this.render = function(param) { - return renderSkin(skin, param); - }; - - /** - * Returns the rendered skin. - * @param {Object} param An optional parameter object to pass to the skin. - * @type String - */ - this.renderAsString = function(param) { - return renderSkinAsString(skin, param); - }; - - /** - * Returns true if the skin contains a macro with the name - * and optional handler passed as argument. - * @param {String} name The name of the macro - * @param {String} handler An optional macro handler name - * @returns True if the skin contains this macro at least once, - * false otherwise. - * @type Boolean - */ - this.containsMacro = function(name, handler) { - res.push(); - res.write("<% *"); - if (handler) { - res.write(handler); - res.write("."); - } - res.write(name); - res.write(" *%>"); - var re = new RegExp(res.pop(), "g"); - return re.test(source); - }; - - for (var i in this) - this.dontEnum(i); - - return this; -}; - - -helma.lib = "Skin"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Ssh.js b/modules/helma/Ssh.js deleted file mode 100644 index 76d47966..00000000 --- a/modules/helma/Ssh.js +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Ssh.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - - -/** - * @fileoverview Fields and methods of the helma.Ssh class. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Ssh.js') - */ - -// take care of any dependencies -app.addRepository('modules/helma/File.js'); -app.addRepository('modules/helma/ganymed-ssh2-build208.jar'); - -// define the helma namespace, if not existing -if (!global.helma) { - global.helma = {}; -} - -/** - * Creates a new instance of helma.Ssh - * @class This class provides methods for connecting to a remote - * server via secure shell (ssh) and copying files from/to a remote - * server using secure copy (scp). It utilizes "Ganymed SSH-2 for Java" - * (see http://www.ganymed.ethz.ch/ssh2/). - * @param {String} server The server to connect to - * @param {helma.File|java.io.File|String} hosts Either a file - * containing a list of known hosts, or the path pointing to a - * file. This argument is optional. - * @constructor - * @returns A newly created instance of helma.Ssh - * @author Robert Gaggl - */ -helma.Ssh = function(server, hosts) { - var SSHPKG = Packages.ch.ethz.ssh2; - var SSHPKGNAME = "ganymed-ssh2.jar"; - var SSHPKGURL = "http://www.ganymed.ethz.ch/ssh2"; - var className = "helma.Ssh"; - var paranoid = false; - var verifier = null; - var knownHosts, connection; - - // check if necessary jar file is in classpath - try { - knownHosts = new SSHPKG.KnownHosts(); - connection = new SSHPKG.Connection(server); - } catch (e) { - if (e instanceof TypeError == false) - throw(e); - throw("helma.Ssh needs " + SSHPKGNAME + - " in lib/ext or application directory " + - "[" + SSHPKGURL + "]"); - } - - /** - * A simple verifier for verifying host keys - * @private - */ - var SimpleVerifier = { - verifyServerHostKey: function(hostname, port, serverHostKeyAlgorithm, serverHostKey) { - var result = knownHosts.verifyHostkey(hostname, serverHostKeyAlgorithm, serverHostKey); - switch (result) { - case SSHPKG.KnownHosts.HOSTKEY_IS_OK: - debug("verifyServerHostKey", "received known host key, proceeding"); - return true; - case SSHPKG.KnownHosts.HOSTKEY_IS_NEW: - if (paranoid == true) { - debug("verifyServerHostKey", "received unknown host key, rejecting"); - return false; - } else { - debug("verifyServerHostKey", "received new host key, adding temporarily to known hosts"); - var hn = java.lang.reflect.Array.newInstance(java.lang.String, 1); - hn[0] = hostname; - knownHosts.addHostkey(hn, serverHostKeyAlgorithm, serverHostKey); - return true; - } - case SSHPKG.KnownHosts.HOSTKEY_HAS_CHANGED: - debug("verifyServerHostKey", "WARNING: host key has changed, rejecting"); - default: - return false; - } - return; - } - }; - - /** - * Converts the argument into an instance of java.io.File - * @param {helma.File|java.io.File|String} file Either a file - * object or the path to a file as string - * @returns The argument converted into a file object - * @type java.io.File - * @private - */ - var getFile = function(file) { - if (file instanceof helma.File) { - return new java.io.File(file.getAbsolutePath()); - } else if (file instanceof java.io.File) { - return file; - } else if (file.constructor == String) { - return new java.io.File(file); - } - return null; - }; - - /** - * Connects to the remote server - * @return Boolean - * @private - */ - var connect = function() { - try { - var info = connection.connect(verifier); - debug("connect", "connected to server " + server); - return true; - } catch (e) { - error("connect", "connection to " + server + " failed."); - } - return false; - }; - - /** - * Private helper method for debugging output using app.logger - * @param {String} methodName The name of the method - * @param {String} msg The debug message to write to event log file - * @private - */ - var debug = function(methodName, msg) { - var msg = msg ? " " + msg : ""; - app.logger.debug(className + ":" + methodName + msg); - return; - }; - - /** - * Private helper method for error output using app.logger - * @param {String} methodName The name of the method - * @param {String} msg The error message to write to event log file - * @private - */ - var error = function(methodName, msg) { - var tx = java.lang.Thread.currentThread(); - tx.dumpStack(); - app.logger.error(className + ":" + methodName + ": " + msg); - return; - }; - - /** - * Opens the file passed as argument and adds the known hosts - * therein to the list of known hosts for this client. - * @param {helma.File|java.io.File|String} file Either a file object - * or the path to a file containing a list of known hosts - * @returns True if adding the list was successful, false otherwise - * @type Boolean - */ - this.addKnownHosts = function(file) { - try { - knownHosts.addHostkeys(getFile(file)); - verifier = new SSHPKG.ServerHostKeyVerifier(SimpleVerifier); - return true; - } catch (e) { - error("addKnownHosts", "Missing or invalid known hosts file '" + file + "'"); - } - return false; - }; - - /** - * Connects to a remote host using plain username/password authentication. - * @param {String} username The username - * @param {String} password The password - * @returns True in case the connection attempt was successful, false otherwise. - * @type Boolean - */ - this.connect = function(username, password) { - if (!username || !password) { - error("connect", "Insufficient arguments."); - } else if (connect() && connection.authenticateWithPassword(username, password)) { - debug("connect", "authenticated using password"); - return true; - } else { - error("connect", "Authentication failed!"); - } - return false; - }; - - /** - * Connects to a remote host using a private key and the corresponding - * passphrase. - * @param {String} username The username - * @param {helma.File|java.io.File|String} key Either a file object - * representing the private key file, or the path to it. - * @param {String} passphrase The passphrase of the private key, if necessary. - * @returns True in case the connection attempt was successful, false otherwise. - * @type Boolean - */ - this.connectWithKey = function(username, key, passphrase) { - var keyFile; - if (!username || !(keyFile = getFile(key))) { - error("connectWithKey", "Insufficient or wrong arguments."); - } else if (connect() && connection.authenticateWithPublicKey(username, keyFile, passphrase)) { - debug("connectWithKey", "authenticated with key"); - return true; - } else { - error("connectWithKey", "Authentication failed!"); - } - return false; - }; - - /** - * Disconnects this client from the remote server. - */ - this.disconnect = function() { - connection.close(); - debug("disconnect", "disconnected from server " + server); - return; - }; - - /** - * Returns true if this client is currently connected. - * @returns True in case this client is connected, false otherwise. - * @type Boolean - */ - this.isConnected = function() { - return (connection != null && connection.isAuthenticationComplete()); - }; - - /** - * Copies a local file to the remote server - * @param {String|Array} localFile Either the path to a single local - * file or an array containing multiple file paths that should be - * copied to the remote server. - * @param {String} remoteDir The path to the remote destination directory - * @param {String} mode An optional 4-digit permission mode string (eg. - * 0755); - * @returns True in case the operation was successful, false otherwise. - * @type Boolean - */ - this.put = function(localFile, remoteDir, mode) { - if (!localFile || !remoteDir) { - error("put", "Insufficient arguments."); - } else if (!this.isConnected()) { - error("put", "Not connected. Please establish a connection first."); - } else { - try { - var scp = connection.createSCPClient(); - if (mode != null) - scp.put(localFile, remoteDir, mode); - else - scp.put(localFile, remoteDir); - debug("put", "copied '" + localFile + "' to '" + remoteDir + "'"); - return true; - } catch (e) { - error("put", e); - } - } - return false; - }; - - /** - * Retrieves a file from the remote server and stores it locally. - * @param {String|Array} remoteFile Either the path to a single remote - * file or an array containing multiple file paths that should be - * copied onto the local disk. - * @param {String} targetDir The path to the local destination directory - * @returns True if the copy process was successful, false otherwise. - * @type Boolean - */ - this.get = function(remoteFile, targetDir) { - if (!remoteFile || !targetDir) { - error("get", "Insufficient arguments."); - } else if (!this.isConnected()) { - error("get", "Not connected. Please establish a connection first."); - } else { - try { - var scp = connection.createSCPClient(); - scp.get(remoteFile, targetDir); - debug("get", "copied '" + remoteFile + "' to '" + targetDir + "'"); - return true; - } catch (e) { - error("get", e); - } - } - return false; - }; - - /** - * Executes a single command on the remote server. - * @param {String} cmd The command to execute on the remote server. - * @return The result of the command execution - * @type String - */ - this.execCommand = function(cmd) { - if (!this.isConnected()) { - error("execCommand", "Not connected. Please establish a connection first."); - } else { - var session = connection.openSession(); - try { - session.execCommand(cmd); - var stdout = new SSHPKG.StreamGobbler(session.getStdout()); - var br = new java.io.BufferedReader(new java.io.InputStreamReader(stdout)); - res.push(); - while (true) { - if (!(line = br.readLine())) - break; - res.writeln(line); - } - debug("execCommand", "executed command '" + cmd + "'"); - return res.pop(); - } catch (e) { - error("execCommand", e); - } finally { - session.close(); - } - } - }; - - /** - * Toggles paranoid mode. If set to true this client tries to - * verify the host key against the its list of known hosts - * during connection and rejects if the host key is not found - * therein or is different. - * @param {Boolean} p Either true or false - */ - this.setParanoid = function(p) { - paranoid = (p === true); - return; - }; - - /** - * Returns true if this client is in paranoid mode. - * @return Boolean - * @see #setParanoid - */ - this.isParanoid = function() { - return paranoid; - }; - - /** - * main constructor body - */ - if (hosts) { - this.addKnownHosts(hosts); - } - - for (var i in this) - this.dontEnum(i); - return this; -}; - - -/** @ignore */ -helma.Ssh.toString = function() { - return "[helma.Ssh]"; -}; - - -helma.lib = "Ssh"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/Url.js b/modules/helma/Url.js deleted file mode 100644 index 081f765d..00000000 --- a/modules/helma/Url.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2007 Helma Software. All Rights Reserved. - * - * $RCSfile: Url.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Fields and methods of the helma.Url class. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Url.js') - */ - -if (!global.helma) { - global.helma = {}; -} - - -/** - * Creates a helma.Url object from a provided url string. - * - * @constructor - */ -helma.Url = function(str) { - if (!str || !helma.Url.PATTERN.test(str)) - throw Error("Cannot create helma.Url: insufficient arguments"); - - // filter punctuation from user-generated urls - // FIXME: a) can this be done in helma.Url.PATTERN? - // b) should it be done rather in methods like activateUrls? - str = str.replace(/[,.;:]\s/, ""); - - var parts = helma.Url.PATTERN.exec(str); - /** - * Protocol segment of this URL - */ - this.protocol = parts[1]; - - if (!parts[2]) { - if (parts[3]) - /** - * User name segment of this URL - */ - this.user = parts[3]; - } else { - this.user = parts[2]; - if (parts[3]) - /** - * Password segment of this URL - */ - this.password = parts[3]; - } - - if (!parts[4]) - throw Error("Cannot create helma.Url: missing host part"); - - /** - * Fully qualified domain name segment of this URL - */ - this.domainName = parts[4]; // actually, the fully-qualified domain name - var fqdnParts = this.domainName.split("."); - if (fqdnParts.length < 3) - this.host = ""; - else { - /** - * Host name segment of this URL - */ - this.host = fqdnParts[0]; - fqdnParts.splice(0, 1); - } - /** - * Top level domain name segment of this URL - */ - this.topLevelDomain = fqdnParts[fqdnParts.length-1]; - /** - * Domain name segment of this URL - */ - this.domain = fqdnParts.join("."); - - /** - * Request path segment of this URL as string - */ - this.pathString = parts[5] || ""; - if (this.pathString.indexOf("/") == 0) - this.pathString = this.pathString.substring(1); - /** - * Request path segment of this URL as array - */ - this.path = this.pathString.split("/"); - /** - * File name segment of this URL - */ - this.file = this.path.pop(); - - if (parts[6]) { - /** - * Query parameter segment of this URL as string - */ - this.queryString = parts[6]; - var pairs; - /** - * Query parameter segment of this URL as object - */ - this.query = {}; - parts = parts[6].split("&"); - for (var i in parts) { - pairs = parts[i].split("="); - this.query[pairs[0]] = pairs[1]; - } - } - - return this; -}; - - -helma.Url.PATTERN = /^([^:]*):\/\/+(?:([^\/]*):)?(?:([^\/]*)@)?([\w\-_.]*[^.])(\/[^?]*)?(?:\?(.*))?$/; diff --git a/modules/helma/Zip.js b/modules/helma/Zip.js deleted file mode 100644 index ab17f4f4..00000000 --- a/modules/helma/Zip.js +++ /dev/null @@ -1,523 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Zip.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -/** - * @fileoverview Fields and methods of the helma.Zip class. - *

    - * To use this optional module, its repository needs to be added to the - * application, for example by calling app.addRepository('modules/helma/Zip.js') - */ - -// take care of any dependencies -app.addRepository('modules/helma/File.js'); - -// define the helma namespace, if not existing -if (!global.helma) { - global.helma = {}; -} - -/** - * Constructs a new helma.Zip instance - * @class Instances of this class represent a single zip archive - * and provide various methods for extracting entries or manipulating - * the contents of the archive. - * @param {helma.File|java.io.File|String} file Either - * a file object representing the .zip file on disk, or the - * path to the .zip file as string. - * @constructor - * @returns A newly created instance of helma.Zip. - * @author Robert Gaggl - */ -helma.Zip = function(file) { - - /** - * Private method that extracts the data of a single file - * in a .zip archive. If a destination path is given it - * writes the extracted data directly to disk using the - * name of the ZipEntry Object, otherwise it returns the - * byte array containing the extracted data. - * @param {java.util.zip.ZipFile} zFile The zip archive to extract - * the file from. - * @param {java.util.zip.ZipEntry} entry The zip entry to extract - * @param {String} destPath The destination path where the extracted - * file should be stored. - * @returns If no destination path is given, this method returns - * the contents of the extracted file as ByteArray, otherwise - * it returns null. - * @private - */ - var extractEntry = function(zFile, entry, destPath) { - var size = entry.getSize(); - if (entry.isDirectory() || size <= 0) - return null; - - var zInStream = new java.io.BufferedInputStream(zFile.getInputStream(entry)); - var buf = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, size); - zInStream.read(buf, 0, size); - zInStream.close(); - - if (!destPath) { - // no filesystem destination given, so return - // the byte array containing the extracted data - return buf; - } - // extract the file to the given path - var dest = new java.io.File(destPath, entry.getName()); - if (entry.isDirectory()) - dest.mkdirs(); - else if (buf) { - if (!dest.getParentFile().exists()) - dest.getParentFile().mkdirs(); - try { - var outStream = new java.io.BufferedOutputStream(new java.io.FileOutputStream(dest)); - outStream.write(buf, 0, size); - } finally { - if (outStream) outStream.close(); - } - } - return null; - }; - - /** - * Private method for adding a single file to the Zip archive - * represented by this helma.Zip instance - * @param {java.util.zip.ZipOutputStream} zOutStream The output - * stream to write to - * @param {java.io.File} f The file that should be added to the - * Zip archive. - * @param {Number} level The compression-level between 0-9. - * @param {String} pathPrefix The path of the directory within the - * Zip archive where the file should be added (optional). - * @private - */ - var addFile = function(zOutStream, f, level, pathPrefix) { - var fInStream = new java.io.BufferedInputStream(new java.io.FileInputStream(f)); - buf = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, f.length()); - fInStream.read(buf, 0, f.length()); - - var name = new java.lang.StringBuffer(); - if (pathPrefix) { - // append clean pathPrefix to name buffer - var st = new java.util.StringTokenizer(pathPrefix, "\\/"); - while (st.hasMoreTokens()) { - name.append(st.nextToken()); - name.append("/"); - } - } - name.append(f.getName()); - var entry = new java.util.zip.ZipEntry(name.toString()); - entry.setSize(f.length()); - entry.setTime(f.lastModified()); - zOutStream.setLevel(level); - zOutStream.putNextEntry(entry); - zOutStream.write(buf, 0, buf.length); - zOutStream.closeEntry(); - fInStream.close(); - return; - }; - - /** - * Private helper method that converts the argument into - * an instance of java.io.File. - * @param {helma.File|java.io.File} f Either a file object or - * the path to a file as string - * @return The argument converted into a file object - * @type java.io.File - * @private - */ - var evalFile = function(f) { - var result; - if (f instanceof java.io.File) { - result = f; - } else if (f instanceof helma.File || typeof(f) == "string") { - result = new java.io.File(f); - } - if (!result.exists()) { - throw "Error creating Zip Object: File '" + f + "' doesn't exist."; - } - return result; - }; - - /** - * Returns an array containing the entries of the archive - * represented by this helma.Zip instance. - * @returns The entries stored in the zip archive - * @type helma.Zip.Content - */ - this.list = function() { - var result = new helma.Zip.Content(); - var zFile = new java.util.zip.ZipFile(file); - var entries = zFile.entries(); - while (entries.hasMoreElements()) { - result.add(new helma.Zip.Entry(entries.nextElement())); - } - zFile.close(); - return result; - }; - - /** - * Extracts a single file from the zip archive represented - * by this helma.Zip instance. If a destination path is given it - * writes the extracted data directly to disk using the - * name of the zip entry, otherwise the resulting entry object - * contains the extracted data in the property data. - * @param {String} name The name of the file to extract - * @param {String} destPath An optional destination path where - * the extracted file should be stored. - * @returns An object containing the entry's properties - * @type helma.Zip.Entry - * @see helma.Zip.Entry - */ - this.extract = function(name, destPath) { - var zFile = new java.util.zip.ZipFile(file); - var entry = zFile.getEntry(name); - if (!entry) - return null; - var result = new helma.Zip.Entry(entry); - result.data = extractEntry(zFile, entry, destPath); - zFile.close(); - return result; - }; - - /** - * Extracts all files within the zip archive represented by - * this helma.Zip instance. If a destination path is given it - * stores the files directly on disk, while preserving any directory - * structure within the archive. If no destination path is given, - * the resulting entry objects will contain the extracted data - * in their property data. - * @param {String} destPath An optional destination path where the - * files in the zip archive should be stored. - * @returns An object containing the extracted entries. - * @type helma.Zip.Content - * @see helma.Zip.Entry - */ - this.extractAll = function(destPath) { - var result = new helma.Zip.Content(); - var zFile = new java.util.zip.ZipFile(file); - var entries = zFile.entries(); - while (entries.hasMoreElements()) { - var entry = entries.nextElement(); - var e = new helma.Zip.Entry(entry); - e.data = extractEntry(zFile, entry, destPath); - result.add(e); - } - zFile.close(); - return result; - }; - - /** - * Adds a single file or a whole directory (recursive!) to the zip archive - * @param {helma.File|java.io.File|String} f Either a file object - * or the path to a file or directory on disk that should be added to the - * archive. If the argument represents a directory, its contents will be added - * recursively to the archive. - * @param {Number} level An optional compression level to use. The argument - * must be between zero and 9 (default: 9 = best compression). - * @param {String} pathPrefix An optional path prefix to use within the archive. - */ - this.add = function (f, level, pathPrefix) { - var f = evalFile(f); - - // evaluate arguments - if (arguments.length == 2) { - if (typeof arguments[1] == "string") { - pathPrefix = arguments[1]; - level = 9; - } else { - level = parseInt(arguments[1], 10); - pathPrefix = null; - } - } else if (level == null || isNaN(level)) { - level = 9; - } - // only levels between 0 and 9 are allowed - level = Math.max(0, Math.min(9, level)); - - if (f.isDirectory()) { - // add a whole directory to the zip file (recursive!) - var files = (new helma.File(f.getAbsolutePath())).listRecursive(); - for (var i in files) { - var fAdd = new java.io.File(files[i]); - if (!fAdd.isDirectory()) { - var p = fAdd.getPath().substring(f.getAbsolutePath().length, fAdd.getParent().length); - if (pathPrefix) - p = pathPrefix + p; - addFile(zOutStream, fAdd, level, p); - } - } - } else { - addFile(zOutStream, f, level, pathPrefix); - } - return; - }; - - /** - * Adds a new entry to the zip file. - * @param {ByteArray} buf A byte array containing the data to add - * to the archive. - * @param {String} name The name of the file to add, containing - * an optional path prefix - * @param {Number} level The compression level to use (0-9, defaults to 9). - */ - this.addData = function(buf, name, level) { - var entry = new java.util.zip.ZipEntry(name); - entry.setSize(buf.length); - entry.setTime(new Date()); - if (level == null || isNaN(level)) { - zOutStream.setLevel(9); - } else { - zOutStream.setLevel(Math.max(0, Math.min(9, parseInt(level, 10)))); - } - zOutStream.putNextEntry(entry); - zOutStream.write(buf, 0, buf.length); - zOutStream.closeEntry(); - return; - }; - - /** - * Closes the zip archive. This method should be called when - * all operations have been finished, to ensure that no open - * file handles are left. - */ - this.close = function() { - zOutStream.close(); - return; - }; - - /** - * Returns the binary data of the zip archive. - * @returns A ByteArray containing the binary data of the zip archive - * @type ByteArray - */ - this.getData = function() { - zOutStream.close(); - fOutStream.close(); - var inputStream = new java.io.FileInputStream(tempFile); - var bOutStream = new java.io.ByteArrayOutputStream(); - var buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 8192); - try { - var chunk; - while ((chunk = inputStream.read(buffer)) !== -1) { - bOutStream.write(buffer, 0, chunk); - } - bOutStream.flush(); - } catch (ex) { - app.log(ex); - } finally { - if (inputStream) inputStream.close(); - if (bOutStream) bOutStream.close(); - } - return bOutStream.toByteArray(); - }; - - /** - * Saves the archive. - * @param {String} dest The full destination path including the name - * where the zip archive should be saved. - */ - this.save = function(dest) { - if (!dest) - throw new Error("no destination for ZipFile given"); - // first of all, close the ZipOutputStream - zOutStream.close(); - fOutStream.close(); - var destFile = new java.io.File(dest); - try { - if (destFile.exists()) destFile['delete'](); - java.nio.file.Files.move(tempFile.toPath(), destFile.toPath()); - } catch (ex) { - app.log(ex); - } - return; - }; - - /** @ignore */ - this.toString = function() { - if (file) { - return "[helma.Zip " + file.getAbsolutePath() + "]"; - } else { - return "[helma.Zip]"; - } - }; - - /** - * constructor body - */ - var tempFile = new java.io.File.createTempFile('zip-', ''); - var fOutStream = new java.io.FileOutputStream(tempFile); - var zOutStream = new java.util.zip.ZipOutputStream(fOutStream); - - if (file) { - file = evalFile(file); - } - - for (var i in this) - this.dontEnum(i); - - return this; -} - -/** - * Creates a new helma.Zip.Content instance - * @class Instances of this class represent the content - * of a zip archive. - * @constructor - * @returns A newly created instance of helma.Zip.Content - */ -helma.Zip.Content = function() { - /** - * The table of contents of the archive - * @type Array - */ - this.toc = []; - - /** - * The files contained in the zip archive, where - * each directory level is a separate object containing - * the entries (files and directories) as properties. - */ - this.files = {}; - - /** - * Adds a zip entry object to the table of contents - * and the files collection - * @param {helma.Zip.Entry} entry The entry to add to the - * zip archive - */ - this.add = function(entry) { - // add the file to the table of contents array - this.toc[this.toc.length] = entry; - // plus add it to the files tree - var arr = entry.name.split(/[\\\/]/); - var cnt = 0; - var curr = this.files; - var propName; - while (cnt < arr.length-1) { - propName = arr[cnt++]; - if (!curr[propName]) { - curr[propName] = {}; - } - curr = curr[propName]; - } - curr[arr[cnt]] = entry; - return; - }; - - for (var i in this) - this.dontEnum(i); - - return this; -}; - - -/** @ignore */ -helma.Zip.Content.prototype.toString = function() { - return "[helma.Zip.Content]"; -} - - -/** - * Creates a new instance of helma.Zip.Entry - * @class Instances of this class represent a single zip archive entry, - * containing the (meta)data of the entry. - * @param {java.util.zip.ZipEntry} entry The zip entry object whose metadata - * should be stored in this instance - * @constructor - * @returns A newly created helma.Zip.Entry instance. - */ -helma.Zip.Entry = function(entry) { - /** - * The name of the zip archive entry - * @type String - */ - this.name = entry.getName(); - - /** - * The size of the entry in bytes - * @type Number - */ - this.size = entry.getSize(); - - /** - * The file date of the entry - * @type Date - */ - this.time = entry.getTime() ? new Date(entry.getTime()) : null; - - /** - * True if the entry is a directory, false otherwise - * @type Boolean - */ - this.isDirectory = entry.isDirectory(); - - /** - * The data of the zip entry - * @type ByteArray - */ - this.data = null; - - for (var i in this) - this.dontEnum(i); - return this; -}; - - -/** @ignore */ -helma.Zip.Entry.prototype.toString = function() { - return "[helma.Zip.Entry]"; -} - - -/** - * Extracts all files in the zip archive data passed as argument - * and returns them. - * @param {ByteArray} zipData A ByteArray containing the data of the zip archive - * @returns The entries of the zip archive - * @type helma.Zip.Content - */ -helma.Zip.extractData = function(zipData) { - var zInStream = new java.util.zip.ZipInputStream(new java.io.ByteArrayInputStream(zipData)); - var result = new helma.Zip.Content(); - - var entry; - while ((entry = zInStream.getNextEntry()) != null) { - var eParam = new helma.Zip.Entry(entry); - if (eParam.isDirectory) - continue; - if (eParam.size == -1) - eParam.size = 16384; - var bos = new java.io.ByteArrayOutputStream(eParam.size); - var buf = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 8192); - var count; - while ((count = zInStream.read(buf)) != -1) - bos.write(buf, 0, count); - eParam.data = bos.toByteArray(); - eParam.size = bos.size(); - result.add(eParam); - } - zInStream.close(); - return result; -}; - - -helma.lib = "Zip"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/helma/all.js b/modules/helma/all.js deleted file mode 100644 index 3b3dfd0e..00000000 --- a/modules/helma/all.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2006 Helma Software. All Rights Reserved. - * - * $RCSfile: Aspects.js,v $ - * $Author$ - * $Revision$ - * $Date$ - */ - -// convenience SingleFileRepository to load all the -// Javascript library files in ./modules/helma - -/** @namespace helma */ - -app.addRepository('modules/helma/Aspects.js'); -app.addRepository('modules/helma/Chart.js'); -app.addRepository('modules/helma/Color.js'); -app.addRepository('modules/helma/Database.js'); -app.addRepository('modules/helma/File.js'); -app.addRepository('modules/helma/Ftp.js'); -app.addRepository('modules/helma/Html.js'); -app.addRepository('modules/helma/Http.js'); -app.addRepository('modules/helma/Image.js'); -app.addRepository('modules/helma/Mail.js'); -app.addRepository('modules/helma/Search.js'); -app.addRepository('modules/helma/Skin.js'); -app.addRepository('modules/helma/Ssh.js'); -app.addRepository('modules/helma/Url.js'); -app.addRepository('modules/helma/Zip.js'); diff --git a/modules/helma/build.gradle b/modules/helma/build.gradle deleted file mode 100644 index 401dd406..00000000 --- a/modules/helma/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -dependencies { - runtimeOnly 'ch.ethz.ganymed:ganymed-ssh2:build209' - runtimeOnly 'net.sourceforge.jexcelapi:jxl:2.5.7' - runtimeOnly 'org.apache.lucene:lucene-analyzers:2.2.0' - runtimeOnly 'org.apache.lucene:lucene-core:2.2.0' -} - -jar.enabled = false -compileJava.enabled = false -compileTestJava.enabled = false -processResources.enabled = false -processTestResources.enabled = false -test.enabled = false - -tasks.register('deps', Copy) { - from sourceSets.main.runtimeClasspath - into '.' -} diff --git a/modules/helma/ganymed-ssh2-build208.jar b/modules/helma/ganymed-ssh2-build208.jar deleted file mode 100644 index 8ca7bd74..00000000 Binary files a/modules/helma/ganymed-ssh2-build208.jar and /dev/null differ diff --git a/modules/helma/jxl-2.5.7.jar b/modules/helma/jxl-2.5.7.jar deleted file mode 100644 index fc1a5a55..00000000 Binary files a/modules/helma/jxl-2.5.7.jar and /dev/null differ diff --git a/modules/helma/licenses/ganymed-ssh2.txt b/modules/helma/licenses/ganymed-ssh2.txt deleted file mode 100644 index 8a1a974a..00000000 --- a/modules/helma/licenses/ganymed-ssh2.txt +++ /dev/null @@ -1,86 +0,0 @@ -Copyright (c) 2006 - 2011 Christian Plattner. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -a.) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -b.) Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -c.) Neither the name of Christian Plattner nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - -This software includes work that was released under the following license: - -Copyright (c) 2005 - 2006 Swiss Federal Institute of Technology (ETH Zurich), - Department of Computer Science (http://www.inf.ethz.ch), - Christian Plattner. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -a.) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -b.) Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -c.) Neither the name of ETH Zurich nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - -The Java implementations of the AES, Blowfish and 3DES ciphers have been -taken (and slightly modified) from the cryptography package released by -"The Legion Of The Bouncy Castle". - -Their license states the following: - -Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle -(http://www.bouncycastle.org) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/modules/helma/licenses/jxl.txt b/modules/helma/licenses/jxl.txt deleted file mode 100644 index a47ada12..00000000 --- a/modules/helma/licenses/jxl.txt +++ /dev/null @@ -1,125 +0,0 @@ -GNU GENERAL PUBLIC LICENSE -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -Preamble -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - -a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. -b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. -c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - -a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, -b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, -c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) -The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS -How to Apply These Terms to Your New Programs -If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - -one line to give the program's name and an idea of what it does. -Copyright (C) yyyy name of author - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - -Gnomovision version 69, Copyright (C) year name of author -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details -type `show w'. This is free software, and you are welcome -to redistribute it under certain conditions; type `show c' -for details. -The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - -Yoyodyne, Inc., hereby disclaims all copyright -interest in the program `Gnomovision' -(which makes passes at compilers) written -by James Hacker. - -signature of Ty Coon, 1 April 1989 -Ty Coon, President of Vice -This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/modules/helma/licenses/lucene-analyzers.txt b/modules/helma/licenses/lucene-analyzers.txt deleted file mode 100644 index d6456956..00000000 --- a/modules/helma/licenses/lucene-analyzers.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/helma/licenses/lucene-core.txt b/modules/helma/licenses/lucene-core.txt deleted file mode 100644 index d6456956..00000000 --- a/modules/helma/licenses/lucene-core.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/helma/lucene-analyzers-2.2.0.jar b/modules/helma/lucene-analyzers-2.2.0.jar deleted file mode 100644 index 86226042..00000000 Binary files a/modules/helma/lucene-analyzers-2.2.0.jar and /dev/null differ diff --git a/modules/helma/lucene-core-2.2.0.jar b/modules/helma/lucene-core-2.2.0.jar deleted file mode 100644 index 2469481c..00000000 Binary files a/modules/helma/lucene-core-2.2.0.jar and /dev/null differ diff --git a/modules/jala/README.md b/modules/jala/README.md deleted file mode 100644 index 331e0c87..00000000 --- a/modules/jala/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# About Jala - -Jala is an open-source collection of JavaScript modules for Helma Object Publisher. Copyright 2004 ORF Online und Teletext GmbH, Vienna (Austria). You can find more information about each module in the API Documentation located in the `docs` directory. - -## Licensing - -Jala itself is licensed under the Apache 2.0 License, but parts of Jala require third party libraries coming with different licenses. You can find all necessary information in the `licenses` directory. - -## Installation - -Move the Jala folder into the `modules` directory of your Helma installation. To include a certain Jala module simply add the following line to your Helma application's source code (replace `[name]` with the desired module name): - - app.addRepository("./modules/jala/code/[name].js"); - -If you want to include the whole Jala package at once, you can use the `all` module for convenience: - - app.addRepository("./modules/jala/code/all.js"); - -Alternatively, you can import the Jala module from within Helma's -`apps.properties` file (replace `[appName]` with the name of your Helma application, `[n]` with a number between 0 and 9 and `[moduleName]` with the desired module -name): - - [appName].respository.[n] = ./modules/jala/code/[moduleName].js - -More information about the `addRepository()` method and generally including repositories in a Helma application is available at -http://helma.org/stories/77712/. - -## Contact, Bugs and Feedback - -The Jala Project is hosted at https://dev.orf.at/jala/ providing all necessary information about Subversion access, Ticketing, Releases etc. - -Although we encourage you to post your questions and comments as ticket, we also provide a mailing list for convenience (details at -https://dev.orf.at/trac/jala/wiki/MailingList). - -For immediate contact you can reach the developers via jaladev AT gmail.com. diff --git a/modules/jala/build.gradle b/modules/jala/build.gradle deleted file mode 100644 index 3b9b6684..00000000 --- a/modules/jala/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -dependencies { - runtimeOnly 'dom4j:dom4j:1.1.3' - runtimeOnly 'jaxen:jaxen:1.1-beta-8' - runtimeOnly 'net.sf.javamusictag:jid3lib:0.5.4' - - // FIXME: Did not find these two or appropriate replacements for them - //runtime 'id3:de.ueberdosis.mp3info:1.6.0d9' - //runtime 'javadns:org.wonderly:?' -} - -jar.enabled = false -compileJava.enabled = false -compileTestJava.enabled = false -processResources.enabled = false -processTestResources.enabled = false -test.enabled = false - -tasks.register('deps', Copy) { - from sourceSets.main.runtimeClasspath - into 'lib' -} diff --git a/modules/jala/build.properties b/modules/jala/build.properties deleted file mode 100644 index 387dc22a..00000000 --- a/modules/jala/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -## build properties for jsdoc api documentation -## all paths *must* be relative to the directory where -## this file is located - -docs.source = ./code -docs.destination = ./docs -docs.projectName = Jala 1.3 diff --git a/modules/jala/code/.jsdoc/summary.html b/modules/jala/code/.jsdoc/summary.html deleted file mode 100644 index 3474c714..00000000 --- a/modules/jala/code/.jsdoc/summary.html +++ /dev/null @@ -1 +0,0 @@ -Jala is a Helma-based library and utility project initially developed to ease the work at ORF.at's software development department. diff --git a/modules/jala/code/AsyncRequest.js b/modules/jala/code/AsyncRequest.js deleted file mode 100644 index 40c19c7a..00000000 --- a/modules/jala/code/AsyncRequest.js +++ /dev/null @@ -1,175 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.AsyncRequest class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Creates a new AsyncRequest instance. - * @class This class is used to create requests of type "INTERNAL" - * (like cron-jobs) that are processed in a separate thread and - * therefor asynchronous. - * @param {Object} obj Object in whose context the method should be called - * @param {String} funcName Name of the function to call - * @param {Array} args Array containing the arguments that should be passed - * to the function (optional). This option is deprecated, instead - * pass the arguments directly to the {@link #run} method. - * @constructor - * @returns A new instance of AsyncRequest - * @type AsyncRequest - * @deprecated Use the {@link http://helma.zumbrunn.net/reference/core/app.html#invokeAsync - * app.invokeAsync} method instead (built-in into Helma as - * of version 1.6) - */ -jala.AsyncRequest = function(obj, funcName, args) { - app.logger.warn("Use of jala.AsyncRequest is deprecated in this version."); - app.logger.warn("This module will probably be removed in a " + - "future version of Jala."); - - /** - * Contains a reference to the thread started by this AsyncRequest - * @type java.lang.Thread - * @private - */ - var thread; - - /** - * Contains the timeout defined for this AsyncRequest (in milliseconds) - * @type Number - * @private - */ - var timeout; - - /** - * Contains the number of milliseconds to wait before starting - * the asynchronous request. - * @type Number - * @private - */ - var delay; - - /** - * Run method necessary to implement java.lang.Runnable. - * @private - */ - var runner = function() { - // evaluator that will handle the request - var ev = app.__app__.getEvaluator(); - - if (delay != null) { - java.lang.Thread.sleep(delay); - } - try { - if (args === undefined || args === null || args.constructor != Array) { - args = []; - } - if (timeout != null) { - ev.invokeInternal(obj, funcName, args, timeout); - } else { - ev.invokeInternal(obj, funcName, args); - } - } catch (e) { - // ignore it, but log it - app.log("[Runner] Caught Exception: " + e); - } finally { - // release the ev in any case - app.__app__.releaseEvaluator(ev); - // remove reference to underlying thread - thread = null; - } - return; - }; - - /** - * Sets the timeout of this asynchronous request. - * @param {Number} seconds Thread-timeout. - */ - this.setTimeout = function(seconds) { - timeout = seconds * 1000; - return; - }; - - /** - * Defines the delay to wait before evaluating this asynchronous request. - * @param {Number} millis Milliseconds to wait - */ - this.setDelay = function(millis) { - delay = millis; - return; - }; - - /** - * Starts this asynchronous request. Any arguments passed to - * this method will be passed to the method executed by - * this AsyncRequest instance. - */ - this.run = function() { - if (arguments.length > 0) { - // convert arguments object into array - args = Array.prototype.slice.call(arguments, 0, arguments.length); - } - thread = (new java.lang.Thread(new java.lang.Runnable({"run": runner}))); - thread.start(); - return; - }; - - /** - * Starts this asynchronous request. - * @deprecated Use {@link #run} instead - */ - this.evaluate = function() { - this.run.apply(this, arguments); - return; - }; - - /** - * Returns true if the underlying thread is alive - * @returns True if the underlying thread is alive, - * false otherwise. - * @type Boolean - */ - this.isAlive = function() { - return thread != null && thread.isAlive(); - } - - /** @ignore */ - this.toString = function() { - return "[jala.AsyncRequest]"; - }; - - /** - * Main constructor body - */ - if (!obj || !funcName) - throw "jala.AsyncRequest: insufficient arguments."; - return this; -} diff --git a/modules/jala/code/BitTorrent.js b/modules/jala/code/BitTorrent.js deleted file mode 100644 index 05ad1311..00000000 --- a/modules/jala/code/BitTorrent.js +++ /dev/null @@ -1,429 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.BitTorrent class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Module dependencies - */ -app.addRepository("modules/core/String.js"); -app.addRepository("modules/helma/File.js"); - - -/** - * Constructs a new BitTorrent file. - * @class This class provides methods to create a BitTorrent - * metadata file from any desired file. - * @param {String} trackerUrl The URL string of the tracker. - * @param {String} filePath The path to the original file. - * @returns A new BitTorrent file. - * @constructor - */ -jala.BitTorrent = function(filePath, trackerUrl) { - var self = this; - self.arguments = arguments; - - // FIXME: Add support for multitracker mode as specified in - // http://www.bittornado.com/docs/multitracker-spec.txt - - var torrent, sourceFile, torrentFile; - var pieceLength = 256; - - var updateTorrent = function() { - if (torrent.info) { - return torrent; - } - - var file = new java.io.File(filePath); - if (!file.exists()) { - throw Error("File " + file + " does not exist!"); - } - - var md5 = java.security.MessageDigest.getInstance("MD5"); - var sha1 = java.security.MessageDigest.getInstance("SHA-1"); - - var fis = new java.io.FileInputStream(file); - var bis = new java.io.BufferedInputStream(fis); - var cache = new java.io.ByteArrayOutputStream(); - - var pieces = []; - var length = pieceLength * 1024; - var buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, length); - - while (bis.read(buffer, 0, buffer.length) > -1) { - app.debug("Updating SHA-1 hash with " + buffer.length + " bytes"); - sha1.reset(); - sha1["update(byte[])"](buffer); - cache["write(byte[])"](buffer); - pieces.push(new java.lang.String(sha1.digest())); - } - - bis.close(); - fis.close(); - - torrent.info = { - //md5sum: new java.lang.String(md5.digest(cache.toByteArray())), - length: cache.size(), - name: file.getName(), - "piece length": length, - pieces: pieces.join("") - }; - - return torrent; - }; - - /** - * Get all available property names. - * @returns The list of property names. - * @type Array - */ - this.keys = function() { - var keys = []; - for (var i in torrent) { - keys.push(i); - } - keys.sort(); - return keys; - }; - - /** - * Get a torrent property. - * @param {String} name The name of the property. - * @returns The value of the property. - */ - this.get = function(name) { - return torrent[name]; - }; - - /** - * Set a torrent property. - * @param {String} name The name of the property. - * @param {Object} value The property's value. - */ - this.set = function(name, value) { - if (typeof torrent[name] == "undefined") { - throw Error("Cannot set torrent property " + name); - } - torrent[name] = value; - delete torrent.info; - return; - }; - - /** - * Get the creation date of the torrent. - * @returns The torrent's creation date. - * @type Date - */ - this.getCreationDate = function() { - return new Date(torrent["creation date"] * 1000); - }; - - /** - * Set the creation date of the torrent. - * @param {Date} date The desired creation date. - */ - this.setCreationDate = function(date) { - this.set("creation date", Math.round((date || new Date()).getTime() / 1000)); - return; - }; - - /** - * Get the piece length of the torrent. - * @returns The torrent's piece length. - * @type Number - */ - this.getPieceLength = function() { - return pieceLength; - }; - - /** - * Set the piece length of the torrent. - * @param {Number} length The desired piece length. - */ - this.setPieceLength = function(length) { - pieceLength = length; - delete torrent.info; - return; - }; - - /** - * Returns the underlying torrent file. - * @returns The torrent file. - * @type helma.File - */ - this.getTorrentFile = function() { - return torrentFile; - }; - - /** - * Returns the underlying source file. - * @returns The source file. - * @type helma.File - */ - this.getSourceFile = function() { - return sourceFile; - }; - - /** - * Saves the torrent as file. - * @param {String} filename An optional name for the torrent file. - * If no name is given it will be composed from name of source - * file as defined in the torrent plus the ending ".torrent". - */ - this.save = function(filename) { - updateTorrent(); - if (!filename) { - filename = torrent.info.name + ".torrent"; - } - torrentFile = new helma.File(sourceFile.getParent(), filename); - torrentFile.remove(); - torrentFile.open(); - torrentFile.write(jala.BitTorrent.bencode(torrent)); - torrentFile.close(); - return; - }; - - /** - * Get a string representation of the torrent. - * @returns The torrent as string. - * @type String - */ - this.toString = function() { - return "[jala.BitTorrent " + filePath + "]"; - }; - - if (String(filePath).endsWith(".torrent")) { - torrentFile = new helma.File(filePath); - torrent = jala.BitTorrent.bdecode(torrentFile.readAll()); - sourceFile = new helma.File(torrent.info.name); - } else { - torrent = { - announce: trackerUrl || null, - "announce-list": null, - "creation date": null, - comment: null, - "created by": null, - }; - this.setCreationDate(); - sourceFile = new helma.File(filePath); - } - - return this; -}; - - -/** - * The bencode method. Turns an arbitrary JavaScript - * object structure into a corresponding encoded - * string. - * @param {Object} obj The target JavaScript object. - * @returns The encoded string. - * @type String - */ -jala.BitTorrent.bencode = function(obj) { - var bencode = arguments.callee; - var str = obj.toString(); - res.push(); - switch (obj.constructor) { - case Array: - res.write("l"); - for (var i in obj) { - if (obj[i]) - res.write(bencode(obj[i])); - } - res.write("e"); - break; - - case Number: - res.write("i" + str + "e"); - break; - - case Object: - res.write("d"); - var keys = []; - for (var i in obj) { - keys.push(i); - } - keys.sort(); - var key; - for (var i in keys) { - key = keys[i]; - if (obj[key]) { - res.write(bencode(key)); - res.write(bencode(obj[key])); - } - } - res.write("e"); - break; - - default: - res.write(str.length + ":" + str); - } - return res.pop(); -}; - - -/** - * The bdecode method. Turns an encoded string into - * a corresponding JavaScript object structure. - * FIXME: Handle with caution... - * @param {String} code The encoded string. - * @returns The decoded JavaScript structure. - * @type Object - */ -jala.BitTorrent.bdecode = function(code) { - var DICTIONARY = "d"; - var LIST = "l"; - var INTEGER = "i"; - var STRING = "s"; - var END = "e"; - - var stack = []; - var overflowCounter = 0; - - var position = -1, current; - - function getResult() { - update(); - var result; - switch (current) { - case DICTIONARY: - result = bdecodeDictionary(); - break; - case LIST: - result = bdecodeList(); - break; - case INTEGER: - result = bdecodeInteger(); - break; - case END: - case null: - //res.debug("*** end detected in getResult()"); - result = null; - break; - default: - result = bdecodeString(); - } - return result; - } - - function update() { - position += 1; - current = code.charAt(position); - /* res.debug("stack: " + stack); - res.debug("position: " + position); - res.debug("current: " + current); - res.debug("remains: " + code.substr(position)); */ - return; - } - - function overflow() { - if (overflowCounter++ > 100) - throw Error("Error parsing bdecoded string"); - return false; - } - - function bdecodeDictionary() { - stack.push(DICTIONARY); - var dictionary = {}, key, value; - while (current && !overflow()) { - key = getResult(); - if (key === null) - break; - value = getResult(); - if (key && value) - dictionary[key] = value; - else - break; - } - stack.pop(); - return dictionary; - } - - function bdecodeList() { - stack.push(LIST); - var list = [], value; - while (current && !overflow()) { - var value = getResult(); - if (value) - list.push(value); - else - break; - } - stack.pop(); - return list; - } - - function bdecodeInteger() { - var integer = ""; - stack.push(integer); - while (current && !overflow()) { - update(); - if (current == "e") - break; - integer += current; - } - if (isNaN(integer)) - throw("Error in bdecoded integer: " + integer + " is not a number"); - //res.debug("integer = " + integer); - stack.pop(); - return parseInt(integer); - } - - function bdecodeString() { - var length = current, string = ""; - stack.push(string); - update(); - while (current && current != ":" && !overflow()) { - length += current; - update(); - } - if (isNaN(length)) - throw("Error in bdecoded string: invalid length " + length); - //res.debug("length = " + length); - length = parseInt(length); - if (length > code.length - position) - throw Error("Error parsing bdecoded string"); - for (var i=0; i - *
  • name (String): The name of the table
  • - *
  • schema (String): The name of the schema the table belongs to
  • - *
  • columns (Array): An array of column metadata (see {@link #getColumns})
  • - *
  • keys (Array): An array containing primary key column names (see {@link #getPrimaryKeys}
  • - * - * @type Array - */ -jala.db.metadata.getTables = function(dbMetadata, tablePattern, schemaPattern) { - var result = []; - var tableMeta = null; - try { - tableMeta = dbMetadata.getTables(null, (schemaPattern || "%"), - (tablePattern || "%"), null); - while (tableMeta.next()) { - var tableName = tableMeta.getString("TABLE_NAME"); - var schemaName = tableMeta.getString("TABLE_SCHEM") || null; - result.push({ - "name": tableName, - "schema": schemaName, - "columns": jala.db.metadata.getColumns(dbMetadata, tableName, schemaName), - "keys": jala.db.metadata.getPrimaryKeys(dbMetadata, tableName, schemaName) - }); - } - return result; - } finally { - if (tableMeta != null) { - tableMeta.close(); - } - } - return null; -}; - -/** - * Returns the column metadata of a table (or multiple tables, if a tableName - * pattern matching several tables is specified). - * @param {java.sql.DatabaseMetaData} dbMetadata The metadata to use for retrieval - * @param {String} tablePattern Optional table name pattern - * @param {String} schemaPattern Optional schema name pattern - * @param {String} columnPattern Optional column name pattern - * @returns An array containing column metadata. Each one is represented by a - * javascript object containing the following properties: - *
      - *
    • name (String): The name of the column
    • - *
    • type (Number): The data type of the column
    • - *
    • length (Number): The maximum length of the column
    • - *
    • nullable (Boolean): True if the column may contain null values, false otherwise
    • - *
    • default (String): The default value of the column
    • - *
    • precision (Number): The precision of the column
    • - *
    • scale (Number): The radix of the column
    • - *
    - * @type Array - */ -jala.db.metadata.getColumns = function(dbMetadata, tablePattern, schemaPattern, columnPattern) { - var result = []; - var columnMeta = null; - try { - columnMeta = dbMetadata.getColumns(null, schemaPattern || null, - tablePattern || null, columnPattern || "%"); - while (columnMeta.next()) { - result.push({ - "name": columnMeta.getString("COLUMN_NAME"), - "type": columnMeta.getInt("DATA_TYPE"), - "length": columnMeta.getInt("COLUMN_SIZE"), - "nullable": (columnMeta.getInt("NULLABLE") == dbMetadata.typeNoNulls) ? false : true, - "default": columnMeta.getString("COLUMN_DEF"), - "precision": columnMeta.getInt("DECIMAL_DIGITS"), - "scale": columnMeta.getInt("NUM_PREC_RADIX") - }); - } - return result; - } finally { - if (columnMeta != null) { - columnMeta.close(); - } - } - return null; -}; - -/** - * Returns an array containing the primary key names of the specified table. - * @param {java.sql.DatabaseMetaData} dbMetadata The metadata to use for retrieval - * @param {String} tableName The name of the table - * @param {String} schemaName Optional name of the schema - * @returns An array containing the primary key column names - * @type Array - */ -jala.db.metadata.getPrimaryKeys = function(dbMetadata, tableName, schemaName) { - var result = []; - var keyMeta = null; - try { - // retrieve the primary keys of the table - var keyMeta = dbMetadata.getPrimaryKeys(null, schemaName || null, tableName); - while (keyMeta.next()) { - result.push(keyMeta.getString("COLUMN_NAME")); - } - return result; - } finally { - if (keyMeta != null) { - keyMeta.close(); - } - } - return null; -}; - - -/** - * Returns the table metadata of the given database. The optional patterns - * can contain "_" for matching a single character or "%" for any - * character sequence. - * @param {helma.Database} database The database to connect to - * @param {String} schemaPattern An optional schema name pattern - * @param {String} tablePattern An optional table name pattern - * @returns An array containing the metadata of all matching tables (see {@link #getTables}) - * @type Array - */ -jala.db.getTableMetadata = function(database, tablePattern, schemaPattern) { - var conn = null; - try { - conn = database.getConnection(); - return jala.db.metadata.getTables(conn.getMetaData(), tablePattern, schemaPattern); - } finally { - if (conn != null) { - conn.close(); - } - } - return null; -}; - - - - -/***************************************** - *** D A T A B A S E S E R V E R *** - *****************************************/ - - -/** - * Returns a new Server instance. - * @class Instances of this class represent a H2 database listener that - * allows multiple databases to be accessed via tcp. - *
    Important: You need the h2.jar in directory "lib/ext" - * of your helma installation for this library to work, which you can get - * at http://www.h2database.com/. - * @param {helma.File} baseDir The directory where the database files - * are located or should be stored - * @param {Number} port The port to listen on (defaults to 9001) - * @param {Boolean} createOnDemand If true this server will create non-existing - * databases on-the-fly, if false it only accepts connections to already - * existing databases in the given base directory - * @param {Boolean} makePublic If true this database is reachable from outside, - * if false it's only reachable from localhost - * @param {Boolean} useSsl If true SSL will be used to encrypt the connection - * @returns A newly created Server instance - * @constructor - */ -jala.db.Server = function(baseDir, port) { - - /** - * Private variable containing the h2 server instance - * @type org.h2.tools.Server - * @private - */ - var server = null; - - /** - * An object containing configuration properties used when creating - * the server instance - * @private - */ - var config = { - "baseDir": baseDir.getAbsolutePath(), - "tcpPort": port || 9092, - "tcpSSL": false, - "ifExists": true, - "tcpAllowOthers": false, - "log": false - }; - - /** - * Returns the wrapped database server instance - * @returns The wrapped database server - * @type org.h2.tools.Server - * @private - */ - this.getServer = function() { - return server; - }; - - /** - * Returns the directory used by this server instance - * @returns The directory where the databases used by this - * server are located in - * @type helma.File - */ - this.getDirectory = function() { - return baseDir; - }; - - /** - * Returns the port this server listens on - * @returns The port this server listens on - * @type Number - */ - this.getPort = function() { - return config.tcpPort; - }; - - /** - * Returns the config of this server - * @returns The config of this server - * @private - */ - this.getConfig = function() { - return config; - }; - - /** - * Starts the database server. - * @returns True in case the server started successfully, false otherwise - * @type Boolean - */ - this.start = function() { - if (server != null && server.isRunning(true)) { - throw "jala.db.Server: already listening on port " + this.getPort(); - } - // convert properties into an array - var config = this.getConfig(); - var args = []; - for (var propName in config) { - args.push("-" + propName); - args.push(config[propName].toString()); - } - // create the server instance - server = Packages.org.h2.tools.Server.createTcpServer(args); - try { - server.start(); - } catch (e) { - app.logger.error("jala.db.Server: unable to start server, reason: " + e); - return false; - } - app.logger.info("jala.db.Server: listening on localhost:" + this.getPort()); - return true; - }; - - - return this; -}; - -/** @ignore */ -jala.db.Server.prototype.toString = function() { - return "[Jala Database Server]"; -}; - -/** - * Stops the database server. - * @returns True if stopping the server was successful, false otherwise - * @type Boolean - */ -jala.db.Server.prototype.stop = function() { - try { - this.getServer().stop(); - app.logger.info("jala.db.Server: stopped listening on localhost:" + - this.getPort()); - } catch (e) { - app.logger.error("jala.db.Server: Unable to stop, reason: " + e); - return false; - } - return true; -}; - -/** - * Returns true if the database server is running. - * @returns True if the database server is running - * @type Boolean - */ -jala.db.Server.prototype.isRunning = function() { - return this.getServer().isRunning(true); -}; - -/** - * Toggles the use of Ssl encryption within this server. This should be set - * before starting the server. - * @param {Boolean} bool If true SSL encryption will be used, false - * otherwise. If no argument is given, this method returns the - * current setting. - * @returns The current setting if no argument is given, or void - * @type Boolean - */ -jala.db.Server.prototype.useSsl = function(bool) { - var config = this.getConfig(); - if (bool != null) { - config.tcpSSL = (bool === true); - } else { - return config.tcpSSL; - } - return; -}; - -/** - * If called with boolean true as argument, this server creates databases - * on-the-fly, otherwise it only accepts connections to already existing - * databases. This should be set before starting the server. - * @param {Boolean} bool If true this server creates non-existing databases - * on demand, if false it only allows connections to existing databases. - * If no argument is given, this method returns the current setting. - * @returns The current setting if no argument is given, or void - * @type Boolean - */ -jala.db.Server.prototype.createOnDemand = function(bool) { - var config = this.getConfig(); - if (bool != null) { - config.ifExists = (bool === false); - } else { - return !config.ifExists; - } - return; -}; - -/** - * If called with boolean true as argument, this server accepts connections - * from outside localhost. This should be set before starting the server. - * @param {Boolean} bool If true this server accepts connections from outside - * localhost. If no argument is given, this method returns the current setting. - * @returns The current setting if no argument is given, or void - * @type Boolean - */ -jala.db.Server.prototype.isPublic = function(bool) { - var config = this.getConfig(); - if (bool != null) { - config.tcpAllowOthers = (bool === true); - } else { - return config.tcpAllowOthers; - } - return; -}; - -/** - * Returns the JDBC Url to use for connections to a given database. - * @param {String} name An optional name of a database running - * @param {Object} props Optional connection properties to add - * @returns The JDBC Url to use for connecting to a database - * within this sever - * @type String - */ -jala.db.Server.prototype.getUrl = function(name, props) { - res.push(); - res.write("jdbc:h2:"); - res.write(this.useSsl() ? "ssl" : "tcp"); - res.write("://localhost:"); - res.write(this.getPort()); - res.write("/"); - res.write(name); - res.write(jala.db.getPropertyString(props)) - return res.pop(); -}; - -/** - * Returns a properties object containing the connection properties - * of the database with the given name. - * @param {String} name The name of the database - * @param {String} username Optional username to use for this connection - * @param {String} password Optional password to use for this connection - * @param {Object} props An optional parameter object containing - * connection properties to add to the connection Url. - * @returns A properties object containing the connection properties - * @type helma.util.ResourceProperties - */ -jala.db.Server.prototype.getProperties = function(name, username, password, props) { - var rp = new Packages.helma.util.ResourceProperties(); - rp.put(name + ".url", this.getUrl(name, props)); - rp.put(name + ".driver", "org.h2.Driver"); - rp.put(name + ".user", username || "sa"); - rp.put(name + ".password", password || ""); - return rp; -}; - -/** - * Returns a connection to a database within this server. - * @param {String} name The name of the database running - * within this server - * @param {String} username Optional username to use for this connection - * @param {String} password Optional password to use for this connection - * @param {Object} props An optional parameter object - * containing connection properties to add to the connection Url. - * @returns A connection to the specified database - * @type helma.Database - */ -jala.db.Server.prototype.getConnection = function(name, username, password, props) { - var rp = this.getProperties(name, username, password, props); - var dbSource = new Packages.helma.objectmodel.db.DbSource(name, rp); - return new helma.Database(dbSource); -}; - - - -/***************************** - *** D A T A T Y P E *** - *****************************/ - - -/** - * Returns a newly created DataType instance. - * @class Instances of this class represent a data type. Each instance - * contains the code number as defined in java.sql.Types, the name of - * the data type as defined in java.sql.Types and optional creation parameters - * allowed for this data type. - * @param {Number} type The sql code number of this data type - * @param {String} typeName The type name of this data type, as used within sql statements - * @param {String} params Optional creation parameters allowed for this data type. - * @returns A newly created instance of DataType. - * @constructor - * @private - */ -jala.db.DataType = function(type, typeName, params) { - - /** - * Returns the sql type code number as defined in java.sql.Types - * @returns The sql type code number of this data type - * @type Number - */ - this.getType = function() { - return type; - }; - - /** - * Returns the type name of this data type, which can be - * used in sql queries. - * @returns The type name of this data type - * @type String - */ - this.getTypeName = function() { - return typeName; - }; - - /** - * Returns the creation parameter string of this data type - * @returns The creation parameter string of this data type - * @type String - */ - this.getParams = function() { - return params; - }; - - /** @ignore */ - this.toString = function() { - return "[DataType " + - " CODE: " + code + - ", SQL: " + sqlType + - ", PARAMS: " + params + "]"; - }; - - return this; -}; - -/** - * Returns true if values for this data type should be surrounded - * by (single) quotes. - * @returns True if values for this data type should be surrounded - * by quotes, false if not - * @type Boolean - */ -jala.db.DataType.prototype.needsQuotes = function() { - switch (this.getType()) { - case java.sql.Types.CHAR: - case java.sql.Types.VARCHAR: - case java.sql.Types.LONGVARCHAR: - case java.sql.Types.BINARY: - case java.sql.Types.VARBINARY: - case java.sql.Types.LONGVARBINARY: - case java.sql.Types.DATE: - case java.sql.Types.TIME: - case java.sql.Types.TIMESTAMP: - return true; - default: - return false; - } -}; - - - -/*********************************** - *** R A M D A T A B A S E *** - ***********************************/ - - -/** - * Returns a newly created RamDatabase instance. - * @class Instances of this class represent an in-memory sql database. - *
    Important: You need the h2.jar in directory "lib/ext" - * of your helma installation for this library to work, which you can get - * at http://www.h2database.com/. - * @param {String} name The name of the database. If not given a private - * un-named database is created, that can only be accessed through this instance - * of jala.db.RamDatabase - * @param {String} username Optional username (defaults to "sa"). This username - * is used when creating the database, so the same should be used when - * creating subsequent instances of jala.db.RamDatabase pointing to a named - * database. - * @param {String} password Optional password (defaults to ""). - * @returns A newly created instance of RamDatabase - * @constructor - */ -jala.db.RamDatabase = function(name, username, password) { - - /** - * Returns the name of the database - * @returns The name of the database - * @type String - */ - this.getName = function() { - return name; - }; - - /** - * Returns the username of this database - * @returns The username of this database - * @type String - */ - this.getUsername = function() { - return username || "sa"; - }; - - /** - * Returns the password of this database - * @returns The password of this database - * @type String - */ - this.getPassword = function() { - return password || ""; - }; - - return; -}; - -/** @ignore */ -jala.db.RamDatabase.prototype.toString = function() { - return "[Jala RamDatabase " + this.getName() + "]"; -} - -/** - * Returns the JDBC Url to connect to this database - * @param {Object} props Optional connection properties to add - * @returns The JDBC url to use for connecting to this database - * @type String - */ -jala.db.RamDatabase.prototype.getUrl = function(props) { - var url = "jdbc:h2:" + this.getDatabasePath(); - if (props != null) { - url += jala.db.getPropertyString(props); - } - return url; -}; - -/** - * Returns the path of this database, which is used by jala.db.Server - * when adding the database to its set of hosted databases. - * @returns The path of this database within a server instance - * @type String - * @private - */ -jala.db.RamDatabase.prototype.getDatabasePath = function() { - return "mem:" + this.getName(); -} - -/** - * Returns a properties object containing the connection properties - * for this database. - * @param {Object} props An optional parameter object containing - * connection properties to add to the connection Url. - * @returns A properties object containing the connection properties - * @type helma.util.ResourceProperties - */ -jala.db.RamDatabase.prototype.getProperties = function(props) { - var name = this.getName(); - var rp = new Packages.helma.util.ResourceProperties(); - rp.put(name + ".url", this.getUrl(props)); - rp.put(name + ".driver", "org.h2.Driver"); - rp.put(name + ".user", this.getUsername()); - rp.put(name + ".password", this.getPassword()); - return rp; -}; - -/** - * Returns a connection to this database - * @param {Object} An optional parameter object containing connection - * properties to add to the connection Url. - * @returns A connection to this database - * @type helma.Database - */ -jala.db.RamDatabase.prototype.getConnection = function(props) { - var name = this.getName(); - var rp = this.getProperties(props); - var dbSource = new Packages.helma.objectmodel.db.DbSource(name, rp); - return new helma.Database(dbSource); -}; - -/** - * Stops this in-process database by issueing a "SHUTDOWN" sql command. - */ -jala.db.RamDatabase.prototype.shutdown = function() { - var conn = this.getConnection(); - conn.execute("SHUTDOWN"); - return; -}; - -/** - * Creates a table in this database. - * @param {String} name The name of the table - * @param {Array} columns The columns to create in the table. Each column - * must be described using an object containing the following properties: - *
      - *
    • name (String): The name of the column
    • - *
    • type (Number): The type of the column as defined in java.sql.Types
    • - *
    • nullable (Boolean): If true the column may contain null values (optional, defaults to true)
    • - *
    • length (Number): The maximum length of the column (optional)
    • - *
    • precision (Number): The precision to use (optional)
    • - *
    • unique (Boolean): If true the column may only contain unique values (optional, defaults to false)
    • - *
    • default (Object): The default value to use (optional)
    • - *
    - * @param {String} primaryKey The name of the column that contains - * the primary key - * @private - */ -jala.db.RamDatabase.prototype.createTable = function(tableName, columns, primaryKey) { - res.push(); - res.write("CREATE TABLE "); - res.write(tableName); - res.write(" ("); - var column, dataType, params; - for (var i=0;i 0) { - res.write("("); - res.write(arr.join(",")); - res.write(")"); - } - } - if (column["default"]) { - res.write(" DEFAULT "); - if (dataType.needsQuotes() === true) { - res.write("'"); - res.write(column["default"]); - res.write("'"); - } else { - res.write(column["default"]); - } - } - if (column.nullable === false) { - res.write(" NOT NULL"); - } - if (i < columns.length - 1) { - res.write(", "); - } - } - if (primaryKey != null) { - res.write(", PRIMARY KEY ("); - if (primaryKey instanceof Array) { - res.write(primaryKey.join(", ")); - } else { - res.write(primaryKey); - } - res.write(")"); - } - res.write(")"); - var sql = res.pop(); - try { - var conn = this.getConnection(); - conn.execute(sql); - app.logger.info("Successfully created table " + tableName); - app.logger.debug("Sql statement used: " + sql); - return true; - } catch (e) { - app.logger.error("Unable to create table " + tableName + ", reason: " + e); - return false; - } -}; - -/** - * Drops the table with the given name - * @param {String} tableName The name of the table - * @returns True if the table was successfully dropped, false otherwise - * @type Boolean - */ -jala.db.RamDatabase.prototype.dropTable = function(tableName) { - var conn = this.getConnection(); - var sql = "DROP TABLE " + tableName; - conn.execute(sql); - return; -}; - -/** - * Returns true if the table exists already in the database - * @param {String} name The name of the table - * @returns True if the table exists, false otherwise - * @type Boolean - */ -jala.db.RamDatabase.prototype.tableExists = function(name) { - var conn = this.getConnection().getConnection(); - var meta = conn.getMetaData(); - var t = meta.getTables(null, "PUBLIC", "%", null); - var tableName; - try { - while (t.next()) { - tableName = t.getString(3).toUpperCase(); - if (tableName.toLowerCase() === name.toLowerCase()) { - return true; - } - } - return false; - } finally { - if (t != null) { - t.close(); - } - } -}; - -/** - * Copies all tables in the database passed as argument into this embedded database. - * If any of the tables already exists in this database, they will be removed before - * re-created. Please mind that this method ignores any indexes in the source database, - * but respects the primary key settings. - * @param {helma.Database} database The database to copy the tables from - * @param {Array} tables An optional array containing the names of the tables to copy. - * If not given all tables are copied - */ -jala.db.RamDatabase.prototype.copyTables = function(database, tables) { - // retrieve the metadata for all tables in this schema - var conn = null; - try { - conn = database.getConnection(); - var dbMetadata = conn.getMetaData(); - if (tables === null || tables === undefined) { - // no tables specified, so copy all available - tables = jala.db.metadata.getTableNames(dbMetadata); - } - - for (let tableName of tables) { - // drop the table if it exists - if (this.tableExists(tableName)) { - this.dropTable(tableName); - } - // retrieve the table metadata and create the table - var metadata = jala.db.metadata.getTables(dbMetadata, tableName); - if (metadata !== null && metadata.length > 0) { - this.createTable(metadata[0].name, metadata[0].columns, metadata[0].keys); - } - } - } finally { - if (conn != null) { - conn.close(); - } - } - return; -}; - -/** - * Returns an array containing all available data types. - * @returns All available data types - * @type Array - * @see jala.db.DataType - * @private - */ -jala.db.RamDatabase.prototype.getDataTypes = function() { - // data types are cached for performance reasons - if (!arguments.callee.cache) { - // java.sql data types - arguments.callee.cache = []; - var con = this.getConnection().getConnection(); - var meta = con.getMetaData(); - var rs = meta.getTypeInfo(); - var code, name, params; - while (rs.next()) { - code = rs.getInt("DATA_TYPE"); - name = rs.getString("TYPE_NAME"); - params = rs.getString("CREATE_PARAMS"); - arguments.callee.cache.push(new jala.db.DataType(code, name, params)); - } - } - return arguments.callee.cache; -}; - -/** - * Returns the data type for the code passed as argument - * @param {Number} type The type code as defined in java.sql.Types - * @returns The data type object for the code - * @type jala.db.DataType - * @private - */ -jala.db.RamDatabase.prototype.getDataType = function(type) { - var types = this.getDataTypes(); - var dataType; - for (var i=0;iImportant: You need the h2.jar in directory "lib/ext" - * of your helma installation for this library to work, which you can get - * at http://www.h2database.com/. - * @param {String} name The name of the database. This name is used as - * prefix for all database files - * @param {helma.File} directory The directory where the database files - * should be stored in. - * @param {String} username Optional username (defaults to "sa"). This username - * is used when creating the database, so the same should be used when - * creating subsequent instances of jala.db.FileDatabase pointing to the - * same database - * @param {String} password Optional password (defaults to ""). - * @returns A newly created FileDatabase instance - * @constructor - */ -jala.db.FileDatabase = function(name, directory, username, password) { - - /** - * Returns the name of the database. This name is used as prefix - * for all files of this database in the specified directory - * @returns The name of the database - * @type String - */ - this.getName = function() { - return name; - }; - - /** - * Returns the directory where the database files are stored. - * @returns The directory where this database is stored. - * @type helma.File - */ - this.getDirectory = function() { - return directory; - }; - - /** - * Returns the username of this database - * @returns The username of this database - * @type String - */ - this.getUsername = function() { - return username || "sa"; - }; - - /** - * Returns the password of this database - * @returns The password of this database - * @type String - */ - this.getPassword = function() { - return password || ""; - }; - - if (!name || typeof(name) != "string" || - !directory || !(directory instanceof helma.File)) { - throw "jala.db.FileDatabase: Missing or invalid arguments" - } else if (!directory.exists()) { - throw "jala.db.FileDatabase: directory '" + directory + "' does not exist"; - } - - return this; -}; -// extend RamDatabase -jala.db.FileDatabase.prototype = new jala.db.RamDatabase(); - -/** @ignore */ -jala.db.FileDatabase.prototype.toString = function() { - return "[Jala FileDatabase '" + this.getName() + "' in " - + this.getDirectory().getAbsolutePath() + "]"; -}; - -/** - * Returns the path of this database, which is used when adding - * the database to a server instance. - * @returns The path of this database within a server instance - * @type String - * @private - */ -jala.db.FileDatabase.prototype.getDatabasePath = function() { - var directory = new helma.File(this.getDirectory(), this.getName()); - return "file:" + directory.getAbsolutePath(); -}; - -/** - * Deletes all files of this database on disk. Note that this also - * closes the database before removing it. - * @returns True in case the database was removed successfully, false otherwise - * @type Boolean - */ -jala.db.FileDatabase.prototype.remove = function() { - var directory = this.getDirectory(); - try { - // shut down the database - this.shutdown(); - Packages.org.h2.tools.DeleteDbFiles.execute( - directory.getAbsolutePath(), - this.getName(), - false - ); - } catch(e) { - app.logger.error("jala.db: Unable to delete database in " + - directory.getAbsolutePath() + ", reason: " + e); - return false; - } - return true; -}; - -/** - * Creates a backup of this database, using the file passed as argument. The - * result will be a zipped file containing the database files - * @param {helma.File} file The file to write the backup to - * @returns True if the database backup was created successfully, false otherwise - * @type Boolean - */ -jala.db.FileDatabase.prototype.backup = function(file) { - try { - Packages.org.h2.tools.Backup.execute( - file.getAbsolutePath(), - this.getDirectory().getAbsolutePath(), - this.getName(), - false - ); - } catch (e) { - app.logger.error("jala.db: Unable to backup database to '" + - file.getAbsolutePath() + ", reason: " + e); - return false; - } - return true; -}; - -/** - * Restores this database using a backup on disk. - * @param {helma.File} backupFile The backup file to use for restore - * @returns True if the database was successfully restored, false otherwise - * @type Boolean - */ -jala.db.FileDatabase.prototype.restore = function(backupFile) { - try { - Packages.org.h2.tools.Restore.execute( - backupFile.getAbsolutePath(), - this.getDirectory().getAbsolutePath(), - this.getName(), - false - ); - } catch (e) { - app.logger.error("jala.db: Unable to restore database using '" + - backupFile.getAbsolutePath() + ", reason: " + e); - return false; - } - return true; -}; diff --git a/modules/jala/code/Date.js b/modules/jala/code/Date.js deleted file mode 100644 index 0a282af1..00000000 --- a/modules/jala/code/Date.js +++ /dev/null @@ -1,545 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * @fileoverview Fields and methods of the jala.Date class. - */ - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * HelmaLib dependencies - */ -app.addRepository("modules/core/Date.js"); -app.addRepository("modules/helma/Html.js"); - -/** - * Constructs a new Renderings object. - * @class This class provides various convenience - * methods for rendering purposes. - * @constructor - */ -jala.Date = function() { - return this; -}; - -/** - * Renders a timestamp as set of DropDown boxes, following the - * format passed as argument. Every <select> - * item is prefixed with a string so that it can be retrieved - * easily from the values of a submitted POST request. - * @param {String} prefix The prefix to use for all dropdown boxes, eg. "postdate" - * @param {Date} date A Date object to use as preselection (optional) - * @param {Object} fmt Array containing one parameter object for every single - * select box that should be rendered, with the following properties set: - *
      - *
    • pattern - The date format pattern that should be rendered. Valid - * patterns are: "dd", "MM", "yyyy", "HH", "ss".
    • - *
    • firstOption - The string to use as first option, eg.: "choose a day"
    • - *
    - */ -jala.Date.prototype.renderEditor = function(prefix, date, fmt) { - /** - * rendering method - * @private - */ - var render = function(param, date) { - switch (param.pattern) { - case "dd": - param.offset = 1; - param.max = 31; - param.selected = (date ? date.getDate() : null); - break; - - case "MM": - param.offset = 1; - param.max = 12; - param.selected = (date ? date.getMonth() +1 : null); - break; - - case "yyyy": - param.offset = 2002; - param.max = 20; - param.selected = (date ? date.getFullYear() : null); - break; - - case "HH": - param.offset = 0; - param.max = 24; - param.selected = (date ? date.getHours() : null); - break; - - case "mm": - param.offset = 0; - param.max = 60; - param.selected = (date ? date.getMinutes() : null); - break; - - case "ss": - param.offset = 0; - param.max = 60; - param.selected = (date ? date.getSeconds() : null); - break; - } - - var key = prefix + ":" + param.pattern; - if (req.data[key]) - param.selected = req.data[key]; - var options = []; - var opt; - for (var i=0;i days) { - renderer.renderDay(null); - } else { - date.setDate(daycnt); - if ((dayObj = collection.get(date.format(accessNameFormat))) != null) { - idx = collection.contains(dayObj); - if (idx > -1) { - if (idx > firstDayIndex) { - firstDayIndex = idx; - } - if (idx < lastDayIndex) { - lastDayIndex = idx; - } - } - } - selected = (today != null) ? date.equals(today) : false; - renderer.renderDay(date, dayObj != null, selected); - daycnt++; - } - } - renderer.renderRow(res.pop()); - } - var prevMonth = prevNextMonth("prev", firstDayIndex) || null; - var nextMonth = prevNextMonth("next", lastDayIndex) || null; - renderer.renderCalendar(date, res.pop(), prevMonth, nextMonth); - return; -}; - -/** - * Returns a rendered calendar - * @see #renderCalendar - * @type String - */ -jala.Date.Calendar.prototype.getCalendar = function(today) { - res.push(); - this.render(today); - return res.pop(); -}; - -/** - * Returns a new instance of the default calendar renderer. - * @class A default renderer to use in conjunction with jala.Date.Calendar - * @param {jala.Date.Calendar} calendar The calendar utilizing this renderer - * @returns A newly created instance of jala.Date.Calendar.Renderer - * @constructor - */ -jala.Date.Calendar.Renderer = function(calendar) { - - /** - * An instance of helma.Html used for rendering the calendar - * @type helma.Html - */ - this.html = new helma.Html(); - - /** - * The calendar utilizing this renderer instance - * @type jala.Date.Calendar - */ - this.calendar = calendar; - - return this; -}; - -/** @ignore */ -jala.Date.Calendar.Renderer.prototype.toString = function() { - return "[Jala Calendar Default Renderer]"; -}; - -/** - * Renders a single cell in the calendar day header row directly to response. - * @param {String} text The text to display in the header field. - */ -jala.Date.Calendar.Renderer.prototype.renderDayHeader = function(text) { - this.html.element("th", text); - return; -}; - -/** - * Renders a single calendar row directly to response. - * @param {String} row The body of the calendar row. - */ -jala.Date.Calendar.Renderer.prototype.renderRow = function(row) { - this.html.element("tr", row); - return; -}; - -/** - * Renders a single day within the calendar directly to response. - * @param {Date} date A date instance representing the day within the calendar. - * @param {Boolean} isExisting True if there is a child object in the calendar's - * collection to which the date cell should link to - * @param {Boolean} isSelected True if this calendar day should be rendered - * as selected day. - */ -jala.Date.Calendar.Renderer.prototype.renderDay = function(date, isExisting, isSelected) { - var attr = {"class": "jala-calendar-day day"}; - if (isSelected === true) { - attr["class"] += " jala-calendar-selected selected"; - } - this.html.openTag("td", attr); - if (date != null) { - var text = date.getDate(); - if (isExisting === true) { - attr = {"href": this.calendar.getCollection().href() + - date.format(this.calendar.getHrefFormat())}; - this.html.link(attr, text); - } else { - res.write(text); - } - } - this.html.closeTag("td"); - return; -}; - -/** - * Renders a link to the previous or next month's calendar directly to response. - * @param {Date} date A date object set to the previous or next available - * month. This can be null in case there is no previous or next month. - */ -jala.Date.Calendar.Renderer.prototype.renderPrevNextLink = function(date) { - if (date != null) { - var attr = {"href": this.calendar.getCollection().href() + - date.format(this.calendar.getHrefFormat())}; - this.html.link(attr, date.format("MMMM", this.calendar.getLocale())); - } - return; -}; - -/** - * Renders the calendar directly to response. - * @param {Date} date A date object representing this calendar's month and year. - * Please mind that the day will be set to the last date in this - * month. - * @param {String} body The rendered calendar weeks including the day header - * (basically the whole kernel of the table). - * @param {Date} prevMonth A date object set to the last available date of - * the previous month. This can be used to render a navigation link to - * the previous month. - * @param {Date} nextMonth A date object set to the first available date - * of the next month. This can be used to render a navigation link to - * the next month. - */ -jala.Date.Calendar.Renderer.prototype.renderCalendar = function(date, body, prevMonth, nextMonth) { - var locale = this.calendar.getLocale(); - this.html.openTag("table", {"class": "jala-calendar calendar"}); - this.html.openTag("thead"); - this.html.openTag("tr"); - this.html.openTag("th", {"colspan": 7}); - res.write(date.format("MMMM", locale)); - res.write(' '); - res.write(date.format("yyyy", locale)); - this.html.closeTag("th"); - this.html.closeTag("tr"); - this.html.closeTag("thead"); - this.html.element("tbody", body); - this.html.openTag("tfoot"); - this.html.openTag("tr"); - this.html.openTag("td", {"class": "jala-calendar-left left", "colspan": 3}); - this.renderPrevNextLink(prevMonth); - this.html.closeTag("td"); - this.html.openTag("td"); - this.html.closeTag("td"); - this.html.openTag("td", {"class": "jala-calendar-right right", "colspan": 3}); - this.renderPrevNextLink(nextMonth); - this.html.closeTag("td"); - this.html.closeTag("tr"); - this.html.closeTag("tfoot"); - this.html.closeTag("table"); - return; -}; - -/** - * Default date class instance. - * @type jala.Date - * @final - */ -jala.date = new jala.Date(); diff --git a/modules/jala/code/DnsClient.js b/modules/jala/code/DnsClient.js deleted file mode 100644 index 810cf15b..00000000 --- a/modules/jala/code/DnsClient.js +++ /dev/null @@ -1,312 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.DnsClient class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Jala dependencies - */ -app.addRepository(getProperty("jala.dir", "modules/jala") + - "/lib/javadns.jar"); - -/** - * Constructs a new DnsClient object. - * @class This is a wrapper around the Dns Client by wonderly.org - * providing methods for querying Dns servers. For more information - * about the Java DNS client visit - * https://javadns.dev.java.net/. - * Please mind that the nameserver specified must accept queries on port - * 53 TCP (the Java DNS client used doesn't support UDP nameserver queries), - * and that reverse lookups are not supported. - * @param {String} nameServer IP-Address or FQDN of nameserver to query - * @constructor - */ -jala.DnsClient = function(nameServer) { - /** - * Contains the IP Adress/FQDN of the name server to query. - * @type String - */ - this.nameServer = nameServer; - - if (!this.nameServer) { - throw "jala.DnsClient: missing nameserver argument"; - } else { - // test if required javadns library is available - try { - var clazz = java.lang.Class.forName("org.wonderly.net.dns.Query", - false, app.getClassLoader()) - } catch (e) { - throw "jala.DnsClient requires JavaDNS.jar" - + " in lib/ext or application directory " - + "[https://javadns.dev.java.net/]"; - } - } - - return this; -}; - -/** @ignore */ -jala.DnsClient.PKG = Packages.org.wonderly.net.dns; - -/** - * The "A" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_A = jala.DnsClient.PKG.Question.TYPE_A; - -/** - * The "CNAME" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_CNAME = jala.DnsClient.PKG.Question.TYPE_CNAME; - -/** - * The "MX" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_MX = jala.DnsClient.PKG.Question.TYPE_MX; - -/** - * The "NS" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_NS = jala.DnsClient.PKG.Question.TYPE_NS; - -/** - * The "PTR" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_PTR = jala.DnsClient.PKG.Question.TYPE_PTR; - -/** - * The "SOA" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_SOA = jala.DnsClient.PKG.Question.TYPE_SOA; - -/** - * The "TXT" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_TXT = jala.DnsClient.PKG.Question.TYPE_TXT; - -/** - * The "WKS" record/query type. - * @type Number - * @final - */ -jala.DnsClient.TYPE_WKS = jala.DnsClient.PKG.Question.TYPE_WKS; - -/** - * Queries the nameserver for a specific domain - * and the given type of record. - * @param {String} dName The domain name to query for - * @param {Number} queryType The type of records to retrieve - * @returns The records retrieved from the nameserver - * @type org.wonderly.net.dns.RR - */ -jala.DnsClient.prototype.query = function(dName, queryType) { - if (dName == null) { - throw new Error("no domain-name to query for"); - } - if (queryType == null) { - queryType = jala.DnsClient.TYPE_A; - } - // construct the question for querying the nameserver - var question = new jala.DnsClient.PKG.Question(dName, - queryType, - jala.DnsClient.PKG.Question.CLASS_IN); - // construct the query - var query = new jala.DnsClient.PKG.Query(question); - // run the query - query.runQuery(this.nameServer); - // wrap the records received in instances of jala.DnsClient.Record - var answers = query.getAnswers(); - var arr = []; - for (var i=0;i<% param.label prefix=' ' suffix='\n' %><% param.controls prefix=' ' suffix='\n' %><% param.help prefix=' ' suffix='\n' %>"); - - /** - * Contains a map of component objects. - * @type Object - */ - this.components = {}; - - /** - * Returns an array containing the components - * of this jala.Form instance. - * @returns The components of this jala.Form instance. - * @type Array - */ - this.listComponents = function() { - return components; - }; - - /** - * Adds a component to this jala.Form instance - * @param {jala.Form.Component.Input} component - */ - this.addComponent = function(component) { - component.setForm(this); - components.push(component); - this.components[component.name] = component; - return; - }; - - /** - * Returns true if this instance of jala.Form contains at least - * one component doing a file upload. - * @see jala.Form.Component#containsFileUpload - * @type Boolean - */ - this.containsFileUpload = function() { - for (var i=0; ithe name of the element
  • - *
  • the parsed value of the element if all requirements have - * been fulfilled. E.g., for a date editor, the parsed value would - * be a date object.
  • - *
  • the map containing all user inputs as string (req.data)
  • - *
  • the form object
  • - * @see #validate - * @type Function - */ - this.validator; - - this.__defineGetter__("validator", function() { return validator; }); - this.__defineSetter__("validator", function(newValidator) { - if (newValidator instanceof Function) { - validator = newValidator; - } else { - throw "Invalid argument: validator must be a function"; - } - return; - }); - - return this; -}; -// extend jala.Form.Component -jala.Form.extend(jala.Form.Component.Input, jala.Form.Component); - -/** - * Validates the input provided to this component. First, - * checkRequirements is called. If no error occurs, the input - * is parsed using parseValue and passed on to the validator - * function. - * @see #checkRequirements - * @see #parseValue - * @param {jala.Form.Tracker} tracker Tracker object collecting - * request data, error messages and parsed values. - */ -jala.Form.Component.Input.prototype.validate = function(tracker) { - var error = this.checkRequirements(tracker.reqData); - if (error != null) { - tracker.errors[this.name] = error; - } else { - tracker.values[this.name] = this.parseValue(tracker.reqData); - if (this.validator) { - error = this.validator.call( - this.form.getDataObject(), - this.name, - tracker.values[this.name], - tracker.reqData, - this.form - ); - if (error != null) { - tracker.errors[this.name] = error; - } - } - } - return; -}; - -/** - * Saves the parsed value using setValue. - * @see #setValue - * @param {jala.Form.Tracker} tracker Tracker object collecting - * request data, error messages and parsed values. - * @param {Object} destObj (optional) object whose values will be changed. - */ -jala.Form.Component.Input.prototype.save = function(tracker, destObj) { - this.setValue(destObj, tracker.values[this.name]); - return; -}; - -/** - * Retrieves the property which is edited by this component. - *
      - *
    • If no getter is given, the method returns the primitive property - * of the data object with the same name as the component.
    • - *
    • If a getter function is defined, it is executed with the scope - * of the data object and the return value is used as default value. - * The name of the component is passed to the getter function - * as an argument.
    • - *
    - * @returns The value of the property - * @type String|Number|Date - */ -jala.Form.Component.Input.prototype.getValue = function() { - if (this.form.getTracker()) { - // handling re-rendering - return null; - } else { - var getter = (this.getter) ? this.getter : this.form.getter; - return getter.call(this.form.getDataObject(), this.name); - } -}; - -/** - * Sets a property of the object passed as argument to the given value. - *
  • If no setter is set at the component, the primitive property - * of the data object is changed.
  • - *
  • If a setter function is defined it is executed with the data object - * as scope and with the name and new value provided as arguments
  • - *
  • If the setter is explicitly set to null, no changes are made at all.
  • - * @param {Object} destObj (optional) object whose values will be changed. - * @param {Object} value The value to set the property to - * @returns True in case the update was successful, false otherwise. - * @see jala.Form#setter - */ -jala.Form.Component.Input.prototype.setValue = function(destObj, value) { - // default value for this.setter is undefined, so if it has been - // set to explicitly null, we don't save the value. in this case, - // we assume, the property is handled outside of jala.Form or purposely - // ignored at all. - if (this.setter !== null) { - var setter = (this.setter) ? this.setter : this.form.setter; - setter.call(destObj, this.name, value); - } - return; -}; - -/** - * Renders this component including label, error and help messages directly - * to response. - */ -jala.Form.Component.Input.prototype.render = function() { - var className = (this.getRequirement(jala.Form.REQUIRE) == true) ? "require" : "optional"; - if (this.getClassName()) { - className += " " + this.getClassName(); - } - var tracker = this.form.getTracker(); - if (tracker && tracker.errors[this.name]) { - className += " error"; - } - - jala.Form.html.openTag("div", - {id: this.createDomId(), - "class": "component " + className} - ); - res.write("\n"); - renderSkin(this.form.componentSkin, this); - jala.Form.html.closeTag("div"); - res.write("\n"); - return; -}; - -/** - * If the error tracker holds an error message for this component, - * it is wrapped in a div-tag and returned as a string. - * @returns Rendered string - * @type String - */ -jala.Form.Component.Input.prototype.renderError = function() { - var tracker = this.form.getTracker(); - if (tracker && tracker.errors[this.name]) { - return jala.Form.html.elementAsString("div", - tracker.errors[this.name], - {"class": "errorText"} - ); - } - return null; -}; - -/** - * Returns the rendered label of this component - * @returns The rendered label of this component - * @type String - */ -jala.Form.Component.Input.prototype.renderLabel = function() { - return jala.Form.html.elementAsString( - "label", - this.getLabel() || "", - {"for": this.createDomId("control")} - ); -}; - -/** - * If this component contains a help message, it is wrapped in - * a div-tag and returned as a string. - * @returns The rendered help message - * @type String - */ -jala.Form.Component.Input.prototype.renderHelp = function() { - var help = this.getHelp(); - if (help) { - return jala.Form.html.elementAsString( - "div", - help, - {"class": "helpText"} - ); - } - return null; -}; - - -/** - * Renders this component including label, error and help messages - * directly to response - */ -jala.Form.Component.Input.prototype.render_macro = function() { - this.render(); - return; -}; - -/** - * Renders the control(s) of this component - */ -jala.Form.Component.Input.prototype.controls_macro = function() { - var attr = this.getControlAttributes(); - var tracker = this.form.getTracker() - if (tracker) { - this.renderControls(attr, null, tracker.reqData); - } else { - this.renderControls(attr, this.getValue()); - } - return; -}; - -/** - * Renders this component's error message (if set) directly to response - */ -jala.Form.Component.Input.prototype.error_macro = function() { - res.write(this.renderError()); - return; -}; - -/** - * Renders this component's label. - */ -jala.Form.Component.Input.prototype.label_macro = function() { - res.write(this.renderLabel()); - return; -}; - -/** - * Renders this component's help text, if set. - */ -jala.Form.Component.Input.prototype.help_macro = function() { - res.write(this.renderHelp()); - return; -}; - -/** - * Renders this component's id - * @see jala.Form#createDomId - */ -jala.Form.Component.Input.prototype.id_macro = function() { - res.write(this.createDomId()); - return; -}; - -/** - * Renders this component's name - */ -jala.Form.Component.Input.prototype.name_macro = function() { - res.write(this.name); - return; -}; - -/** - * Renders this component's type - */ -jala.Form.Component.Input.prototype.type_macro = function() { - res.write(this.getType()); - return; -}; - -/** - * Renders this component's class name. - * Note that this is just the class name that has been explicitly - * assigned using setClassName. - * @see #setClassName - */ -jala.Form.Component.Input.prototype.class_macro = function() { - var className = this.getClassName(); - if (className) { - res.write(className); - } - return; -}; - - -/** - * Creates a new attribute object for this element. - * @returns Object with properties id, name, class - * @type Object - */ -jala.Form.Component.Input.prototype.getControlAttributes = function() { - var attr = { - id: this.createDomId("control"), - name: this.name, - "class": this.getType() - }; - if (this.getClassName()) { - attr["class"] += " " + this.getClassName(); - } - return attr; -}; - -/** - * Checks user input for maximum length, minimum length and require - * if the corresponding options have been set using the require method. - * @param {Object} reqData request data - * @returns String containing error message or null if everything is ok. - * @type String - * @see #require - */ -jala.Form.Component.Input.prototype.checkLength = function(reqData) { - var require = this.getRequirement(jala.Form.REQUIRE); - var minLength = this.getRequirement(jala.Form.MINLENGTH); - var maxLength = this.getRequirement(jala.Form.MAXLENGTH); - - if (require && (reqData[this.name] == null || reqData[this.name].trim() == "")) { - return this.getMessage(jala.Form.REQUIRE, "Please enter text into this field."); - } else if (maxLength && reqData[this.name].length > maxLength) { - return this.getMessage(jala.Form.MAXLENGTH, "Input for this field is too long ({0} characters). Please enter no more than {1} characters.", - reqData[this.name].length, maxLength); - } else if (minLength) { - // set an error if the element is required but the input is too short - // but don't throw an error if the element is optional and empty - if (reqData[this.name].length < minLength && - (require || (!require && reqData[this.name].length > 0))) { - return this.getMessage(jala.Form.MINLENGTH, "Input for this field is too short ({0} characters). Please enter at least {1} characters.", - reqData[this.name].length, minLength); - } - } - return null; -}; - -/** - * Checks user input against options set using the require method. - * @param {Object} reqData request data - * @returns String containing error message or null if everything is ok. - * @type String - * @see #checkLength - * @see #require - */ -jala.Form.Component.Input.prototype.checkRequirements = function(reqData) { - return this.checkLength(reqData); -}; - -/** - * Parses the string input from the form and creates the datatype that - * is edited with this component. For the input component this method - * is not of much use, but subclasses that edit other datatypes may use - * it. For example, a date editor should convert the user input from string - * to a date object. - * @param {Object} reqData request data - * @returns parsed value - * @type Object - */ -jala.Form.Component.Input.prototype.parseValue = function(reqData) { - return reqData[this.name]; -}; - -/** - * Renders the html form elements to the response. - * This method shall be overridden by subclasses of input component. - * @param {Object} attr Basic attributes for the html form elements. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Input.prototype.renderControls = function(attr, value, reqData) { - attr.value = (reqData) ? reqData[this.name] : value; - if (this.getRequirement(jala.Form.MAXLENGTH)) { - attr.maxlength = this.getRequirement(jala.Form.MAXLENGTH); - } - jala.Form.html.input(attr); - return; -}; - -/** - * Constructs a newly created Password component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * password input tag. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Password component instance - * @constructor - */ -jala.Form.Component.Password = function Password(name) { - jala.Form.Component.Password.superConstructor.apply(this, arguments); - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.Password, jala.Form.Component.Input); - -/** - * Renders a password input tag to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Password.prototype.renderControls = function(attr, value, reqData) { - attr.value = (reqData) ? reqData[this.name] : value; - if (this.getRequirement(jala.Form.MAXLENGTH)) { - attr.maxlength = this.getRequirement(jala.Form.MAXLENGTH); - } - jala.Form.html.password(attr); - return; -}; - -/** - * Constructs a newly created Hidden component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * hidden input tag. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Hidden component instance - * @constructor - */ -jala.Form.Component.Hidden = function Hidden(name) { - jala.Form.Component.Hidden.superConstructor.apply(this, arguments); - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.Hidden, jala.Form.Component.Input); - -/** - * Renders this component directly to response. For a hidden tag, this is - * just an input element, no div tag or anything. - */ -jala.Form.Component.Hidden.prototype.render = function() { - var attr = this.getControlAttributes(); - var tracker = this.form.getTracker() - if (tracker) { - this.renderControls(attr, null, tracker.reqData); - } else { - this.renderControls(attr, this.getValue()); - } - return; -}; - -/** - * Renders a hidden input tag to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Hidden.prototype.renderControls = function(attr, value, reqData) { - attr.value = (reqData) ? reqData[this.name] : value; - jala.Form.html.hidden(attr); - return; -}; - -/** - * Constructs a new Textarea component. - * @class Subclass of jala.Form.Component.Input which renders and validates a - * textarea input field. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Textarea component instance - * @constructor - */ -jala.Form.Component.Textarea = function Textarea(name) { - jala.Form.Component.Textarea.superConstructor.apply(this, arguments); - - var rows, cols = undefined; - - /** - * Returns the row numbers for this component. - * @returns row numbers - * @type String - */ - this.getRows = function() { - return rows; - }; - - /** - * Sets the row numbers for this component. - * @param {String} newRows new row numbers - */ - this.setRows = function(newRows) { - rows = newRows; - return; - }; - - /** - * Returns the col numbers for this component. - * @returns col numbers - * @type String - */ - this.getCols = function() { - return cols; - }; - - /** - * Sets the col numbers for this component. - * @param {String} newCols new col numbers - */ - this.setCols = function(newCols) { - cols = newCols; - return; - }; - - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.Textarea, jala.Form.Component.Input); - -/** - * Renders a textarea input field to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Textarea.prototype.renderControls = function(attr, value, reqData) { - attr.value = (reqData) ? reqData[this.name] : value; - attr.rows = this.getRows() || 5; - attr.cols = this.getCols() || 25; - jala.Form.html.textArea(attr); - return; -}; - -/** - * Constructs a new Date component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * date editor. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Date component - * @constructor - */ -jala.Form.Component.Date = function Date(name) { - jala.Form.Component.Date.superConstructor.apply(this, arguments); - - var dateFormat = "d.M.yyyy H:m"; - var dateFormatObj; - - /** - * Returns the date format for this component. - * @returns date format object - * @type java.text.SimpleDateFormat - */ - this.getDateFormat = function() { - if (!dateFormatObj || dateFormatObj.toPattern() != dateFormat) { - dateFormatObj = new java.text.SimpleDateFormat(dateFormat); - } - return dateFormatObj; - }; - - /** - * Sets the date format for this component. - * @param {String} newDateFormat new date format - */ - this.setDateFormat = function(newDateFormat) { - dateFormat = newDateFormat; - return; - }; - - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.Date, jala.Form.Component.Input); - -/** - * Renders a textarea tag to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Date.prototype.renderControls = function(attr, value, reqData) { - if (reqData) { - attr.value = reqData[this.name]; - } else if (value instanceof Date) { - attr.value = this.getDateFormat().format(value); - } - if (this.getRequirement(jala.Form.MAXLENGTH)) { - attr.maxlength = this.getRequirement(jala.Form.MAXLENGTH); - } - jala.Form.html.input(attr); - return; -}; - -/** - * Validates user input from a date editor. - * @param {Object} reqData request data - * @returns null if everything is ok or string containing error message - * @type String - */ -jala.Form.Component.Date.prototype.checkRequirements = function(reqData) { - try { - this.parseValue(reqData); - return null; - } catch(e) { - return this.getMessage("invalid", "This date cannot be parsed."); - } -}; - -/** - * Parses the string input from the form and converts it to a date object. - * Throws an error if the string cannot be parsed. - * @param {Object} reqData request data - * @returns parsed date value - * @type Date - */ -jala.Form.Component.Date.prototype.parseValue = function(reqData) { - return this.getDateFormat().parse(reqData[this.name]); -}; - -/** - * Constructs a new Select component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * dropdown element. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Select component - * @constructor - */ -jala.Form.Component.Select = function Select(name) { - jala.Form.Component.Select.superConstructor.apply(this, arguments); - - var options, firstOption = undefined; - - /** - * Returns the option list for this component. - */ - this.getOptions = function() { - return options; - }; - - /** - * Sets the option list for this component. - * The argument may either be an array that will be used as option list, - * or a function that is called when the option component is rendered and - * has to return an option array. - * For both arrays those formats are allowed: - *
  • Array of arrays [ [val, display], [val, display], .. ]
  • - *
  • Array of objects [ {value:val, display:display}, .. ]
  • - *
  • Array of strings [ display, display, .. ] In this case, - * the index position of the string will be the value.
  • - * @param {Array|Function} newOptions Array or function defining option list. - */ - this.setOptions = function(newOptions) { - options = newOptions; - return; - }; - - /** - * Returns the text that should be displayed if no value is selected. - * @type String - */ - this.getFirstOption = function() { - return firstOption; - }; - - /** - * Sets the text that is displayed if no value is selected - * @param {String} newFirstOption text to display as first option element. - */ - this.setFirstOption = function(newFirstOption) { - firstOption = newFirstOption; - return; - }; - - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.Select, jala.Form.Component.Input); - -/** - * Renders a dropdown element to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Select.prototype.renderControls = function(attr, value, reqData) { - value = (reqData) ? reqData[this.name] : value; - jala.Form.html.dropDown(attr, this.parseOptions(), value, this.getFirstOption()); - return; -}; - -/** - * Validates user input from a dropdown element by making sure that - * the option value list contains the user input. - * @see jala.Form.Component.Select#checkOptions - * @param {Object} reqData request data - * @returns string containing error message or null if everything is ok. - * @type String - */ -jala.Form.Component.Select.prototype.checkRequirements = function(reqData) { - return this.checkOptions(reqData); -}; - -/** - * Creates an array of options for a dropdown element or a - * group of radiobuttons. If options field of this element's - * config is an array, that array is returned. - * If options is a function, its return value is returned. - * @returns array of options - * @type Array - */ -jala.Form.Component.Select.prototype.parseOptions = function() { - var options = this.getOptions(); - if (options != null) { - if (options instanceof Array) { - return options; - } else if (options instanceof Function) { - return options.call(this.form.getDataObject(), this.name); - } - } - return []; -}; - -/** - * Checks user input for optiongroups: Unless require("checkoptions") - * has ben set to false, the user input must exist in the option array. - * @param {Object} reqData request data - * @returns null if everything is ok or string containing error message - * @type String - */ -jala.Form.Component.Select.prototype.checkOptions = function(reqData) { - // if field is required, an empty option is not allowed: - var found = (!this.getRequirement(jala.Form.REQUIRE) && !reqData[this.name]); - if (!found) { - if (this.getRequirement(jala.Form.CHECKOPTIONS) === false) { - // exit, if option check shall be suppressed - return null; - } - var options = this.parseOptions(); - var val = reqData[this.name]; - for (var i=0; i 0) { - // option is an array (1st element = value, 2nd = display) - if (options[i][0] == reqData[this.name]) { - found = true; - break; - } - } else if (options[i].value && options[i].display) { - // option is an object with fields value + display - if (options[i].value == reqData[this.name]) { - found = true; - break; - } - } else { - // option is a string, value is index number - if (i == reqData[this.name]) { - found = true; - break; - } - } - } - } - if (!found) { - return "Please select a valid option."; - } - return null; -}; - -/** - * Creates a new Radio component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * set of radio buttons. - * @base jala.Form.Component.Select - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Radio component - * @constructor - */ -jala.Form.Component.Radio = function Radio(name) { - jala.Form.Component.Radio.superConstructor.apply(this, arguments); - return this; -}; -// extend jala.Form.Component.Select -jala.Form.extend(jala.Form.Component.Radio, jala.Form.Component.Select); - -/** - * Renders a set of radio buttons to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - */ -jala.Form.Component.Radio.prototype.renderControls = function(attr, value) { - var options = this.parseOptions(); - var optionAttr, optionDisplay; - for (var i=0; i 0) { - optionAttr.value = options[i][0]; - optionDisplay = options[i][1]; - } else if (options[i].value && options[i].display) { - optionAttr.value = options[i].value; - optionDisplay = options[i].display; - } else { - optionAttr.value = i; - optionDisplay = options[i]; - } - if (String(value) == String(optionAttr.value)) { - optionAttr.checked = "checked"; - } - jala.Form.html.radioButton(optionAttr); - res.write(optionDisplay); - jala.Form.html.tag("br"); - } - return; -}; - -/** - * Validates user input from a set of radio buttons and makes sure that - * option value list contains the user input. - * @see jala.Form.Component.Select#checkOptions - * @param {Object} reqData request data - * @returns null if everything is ok or string containing error message - * @type String - */ -jala.Form.Component.Radio.prototype.checkRequirements = function(reqData) { - return this.checkOptions(reqData); -}; - -/** - * Creates a new Checkbox component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * checkbox. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Checkbox component instance - * @constructor - */ -jala.Form.Component.Checkbox = function Checkbox(name) { - jala.Form.Component.Checkbox.superConstructor.apply(this, arguments); - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.Checkbox, jala.Form.Component.Input); - -/** - * Renders an checkbox to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - */ -jala.Form.Component.Checkbox.prototype.renderControls = function(attr, value, reqData) { - if (value == 1 || (reqData && reqData[this.name] == "1")) { - attr.checked = "checked"; - } - attr.value = "1"; - jala.Form.html.checkBox(attr); - return; -}; - -/** - * Parses the string input from the form. For a checked box, the value is 1, - * for an unchecked box the value is 0. - * @param {Object} reqData request data - * @returns parsed value - * @type Number - */ -jala.Form.Component.Checkbox.prototype.parseValue = function(reqData) { - return (reqData[this.name] == "1") ? 1 : 0; -}; - -/** - * Validates user input from checkbox. - * @param {Object} reqData request data - * @returns null if everything is ok or string containing error message - * @type String - */ -jala.Form.Component.Checkbox.prototype.checkRequirements = function(reqData) { - if (reqData[this.name] && reqData[this.name] != "1") { - return this.getMessage("invalid", "The value of this checkbox is invalid."); - } - return null; -}; - -/** - * Creates a new File component instance - * @class Subclass of jala.Form.Component.Input which renders and validates a - * file upload. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created File component - * @constructor - */ -jala.Form.Component.File = function File(name) { - jala.Form.Component.File.superConstructor.apply(this, arguments); - - this.containsFileUpload = function() { - return true; - }; - - return this; -}; -// extend jala.Form.Component.Input -jala.Form.extend(jala.Form.Component.File, jala.Form.Component.Input); - -/** - * Renders a file input tag to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.File.prototype.renderControls = function(attr, value, reqData) { - var contentType = this.getRequirement(jala.Form.CONTENTTYPE); - if (contentType) { - attr.accept = (contentType instanceof Array) ? contentType.join(",") : contentType; - } - jala.Form.html.file(attr); - return; -}; - -/** - * Validates a file upload by making sure it's there (if REQUIRE is set), - * checking the file size, the content type and by trying to construct an image. - * @param {Object} reqData request data - * @param {jala.Form.Tracker} tracker jala.Form.Tracker object storing possible error messages - * @returns null if everything is ok or string containing error message - * @type String - */ -jala.Form.Component.File.prototype.checkRequirements = function(reqData) { - - if (reqData[this.name].contentLength == 0) { - // no upload - if (this.getRequirement(jala.Form.REQUIRE) == true) { - return this.getMessage(jala.Form.REQUIRE, "File upload is required."); - } else { - // no further checks necessary, exit here - return null; - } - } - - var maxLength = this.getRequirement(jala.Form.MAXLENGTH); - if (maxLength && reqData[this.name].contentLength > maxLength) { - return this.getMessage(jala.Form.MAXLENGTH, "This file is too big ({0} bytes), maximum allowed size {1} bytes.", - reqData[this.name].contentLength, maxLength); - } - - var contentType = this.getRequirement(jala.Form.CONTENTTYPE); - if (contentType) { - var arr = (contentType instanceof Array) ? contentType : [contentType]; - if (arr.indexOf(reqData[this.name].contentType) == -1) { - return this.getMessage(jala.Form.CONTENTTYPE, "The file type {0} is not allowed.", - reqData[this.name].contentType); - } - } - - return null; -}; - - -/** - * Creates a new Image component instance - * @class Subclass of jala.Form.Component.File which renders a file upload - * and validates uploaded files as images. - * @base jala.Form.Component.File - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Image component - * @constructor - */ -// FIXME: see below -jala.Form.Component.Image = function() {}; - -/** - * FIXME: JSDoc has some sever problems with this class. - * It's somehow due to the named method ("Image") that it - * always appears as global static object. - * Wrapping the method in another function which immediately - * is executed seems to solve this problem and could be used - * as a work-around for similar issues. - */ -jala.Form.Component.Image = (function() { - return function Image(name) { - jala.Form.Component.Image.superConstructor.apply(this, arguments); - return this; - }; -})(); - -// extend jala.Form.Component.File -jala.Form.extend(jala.Form.Component.Image, jala.Form.Component.File); - -/** - * Validates an image upload by making sure it's there (if REQUIRE is set), - * checking the file size, the content type and by trying to construct an image. - * If the file is an image, width and height limitations set by require are - * checked. - * @param {Object} reqData request data - * @type String - */ -jala.Form.Component.Image.prototype.checkRequirements = function(reqData) { - var re = this.constructor.superConstructor.prototype.checkRequirements.call(this, reqData); - if (re) { - return re; - } - - if (reqData[this.name].contentLength > 0) { - var helmaImg = undefined; - try { - helmaImg = new Image(reqData[this.name]); - } catch (imgError) { - return this.getMessage("invalid", "This image file can't be processed."); - } - - var maxWidth = this.getRequirement(jala.Form.MAXWIDTH); - if (maxWidth && helmaImg.getWidth() > maxWidth) { - return this.getMessage("maxwidth", "This image is too wide."); - } - - var minWidth = this.getRequirement(jala.Form.MINWIDTH); - if (minWidth && helmaImg.getWidth() < minWidth) { - return this.getMessage("minwidth", "This image is not wide enough."); - } - - var maxHeight = this.getRequirement(jala.Form.MAXHEIGHT); - if (maxHeight && helmaImg.getHeight() > maxHeight) { - return this.getMessage("maxheight", "This image is too tall."); - } - - var minHeight = this.getRequirement(jala.Form.MINHEIGHT); - if (minHeight && helmaImg.getHeight() < minHeight) { - return this.getMessage("minheight", "This image is not tall enough."); - } - } - - return null; -}; - - - -/** - * Creates a new Button component instance - * @class Subclass of jala.Form.Component.Input which renders a button. - * @base jala.Form.Component.Input - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Button component - * @constructor - */ -jala.Form.Component.Button = function Button(name) { - jala.Form.Component.Button.superConstructor.apply(this, arguments); - - /** - * Private field containing the value of the button (ie. the visible text) - * @type String - */ - var value; - - /** - * Returns the value set for this button. - * @returns value - * @type String - */ - this.getValue = function() { - return value; - }; - - /** - * Sets the value for this button. - * @param {String} newValue new value - */ - this.setValue = function(newValue) { - value = newValue; - return; - }; - - return this; -}; -// extend jala.Form.Component -jala.Form.extend(jala.Form.Component.Button, jala.Form.Component.Input); - -/** - * Renders a button to the response. - * @param {Object} attr Basic attributes for this element. - * @param {Object} value Value to be used for rendering this element. - * @param {Object} reqData Request data for the whole form. This argument is - * passed only if the form is re-rendered after an error occured. - */ -jala.Form.Component.Button.prototype.render = function(attr, value, reqData) { - var classStr = (this.getClassName()) ? " " + this.getClassName() : ""; - var attr = { - id: this.createDomId(), - "class": "component" + classStr - }; - jala.Form.html.openTag("div", attr); - res.write("\n "); - - this.renderControls(this.getControlAttributes(), this.getValue()); - res.write("\n"); - - jala.Form.html.closeTag("div"); - res.write("\n"); - return; -}; - -/** - * Creates a new attribute object for this button. - * @returns Object with all attributes set for this button. - * @type Object - */ -jala.Form.Component.Button.prototype.renderControls = function(attr, value) { - if (value) { - attr.value = value; - } - jala.Form.html.button(attr); - return; -}; - - -/** - * Creates a new Submit component instance - * @class Subclass of jala.Form.Component.Button which renders a submit button. - * @base jala.Form.Component.Button - * @param {String} name Name of the component, used as name of the html controls. - * @returns A newly created Submit component - * @constructor - */ -jala.Form.Component.Submit = function Submit(name) { - jala.Form.Component.Submit.superConstructor.apply(this, arguments); - - return this; -}; -// extend jala.Form.Component.Button -jala.Form.extend(jala.Form.Component.Submit, jala.Form.Component.Button); - -/** - * Creates a new attribute object for this button. - * @returns Object with all attributes set for this button. - * @type Object - */ -jala.Form.Component.Submit.prototype.renderControls = function(attr, value) { - if (value) { - attr.value = value; - } - jala.Form.html.submit(attr); - return; -}; - - -/** - * static default getter function used to return a field - * from the data object. - * @param {String} name Name of the property. - * @type Object - */ -jala.Form.propertyGetter = function(name, value) { - return this[name]; -}; - -/** - * static default setter function used to change a field - * of the data object. - * @param {String} name Name of the property. - * @param {Object} value New value of the property. - */ -jala.Form.propertySetter = function(name, value) { - this[name] = value; -}; - - -/** - * A generic container for error-messages and values - * @class Instances of this class can contain error-messages and values - * @constructor - * @type jala.Form.Tracker - */ -jala.Form.Tracker = function(reqData) { - - /** - * A map containing input from request data - * @type Object - */ - this.reqData = reqData; - - /** - * A map containing parsed values (only for those fields that didn't - * fail during checkRequirements method). - * @type Object - */ - this.values = {}; - - /** - * A map containing error messages - * @type Object - */ - this.errors = {}; - - return this; -}; - -/** @ignore */ -jala.Form.Tracker.toString = function() { - return "[jala.Form.Tracker]"; -}; - -/** @ignore */ -jala.Form.Tracker.prototype.toString = jala.Form.Tracker.toString; - -/** - * Returns true if an error has been set for at least one component. - * @returns true if form encountered an error. - * @type Boolean - */ -jala.Form.Tracker.prototype.hasError = function() { - for (var keys in this.errors) { - return true; - } - return false; -}; - -/** - * Returns the number of components for which this instance has - * tracked an error. - * @returns Number of components that did not validate. - * @type Number - */ -jala.Form.Tracker.prototype.countErrors = function() { - var ct = 0; - for (var keys in this.errors) { - ct++; - } - return ct; -}; - -/** - * Helper method. - * @private - */ -jala.Form.Tracker.prototype.debug = function() { - for (var key in this.errors) { - res.debug(key + ":" + this.errors[key]); - } - return; -}; - - diff --git a/modules/jala/code/Global.js b/modules/jala/code/Global.js deleted file mode 100644 index 0c75f031..00000000 --- a/modules/jala/code/Global.js +++ /dev/null @@ -1,130 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the Global prototype. - */ - - -/** - * Returns true if the value passed as argument is either a string literal, - * an instance of String or of java.lang.String. - * @param {Object} val The value to test - * @returns True if the value is a string, false otherwise - * @type Boolean - */ -function isString(val) { - return typeof(val) == "string" || - val instanceof java.lang.String || - val instanceof String; -}; - -/** - * Returns true if the value passed as argument is either a boolean - * literal or an instance of Boolean. - * @param {Object} val The value to test - * @returns True if the value is a boolean, false otherwise - * @type Boolean - */ -function isBoolean(val) { - return typeof(val) == "boolean" || - val instanceof Boolean; -}; - -/** - * Returns true if the value passed as argument is either a number, - * an instance of Number or of java.lang.Number. - * @param {Object} val The value to test - * @returns True if the value is a number, false otherwise - * @type Boolean - */ -function isNumber(val) { - return typeof(val) == "number" || - val instanceof java.lang.Number || - val instanceof Number; -}; - -/** - * Returns true if the value passed as argument is null. - * @param {Object} val The value to test - * @returns True if the value is null, false otherwise - * @type Boolean - */ -function isNull(val) { - return val === null; -}; - -/** - * Returns true if the value passed as argument is undefined. - * @param {Object} val The value to test - * @returns True if the value is undefined, false otherwise - * @type Boolean - */ -function isUndefined(val) { - return val === undefined; -}; - -/** - * Returns true if the value passed as argument is an array. - * @param {Object} val The value to test - * @returns True if the value is an array, false otherwise - * @type Boolean - */ -function isArray(val) { - return val instanceof Array; -}; - -/** - * Returns true if the value passed as argument is either a Javascript date - * or an instance of java.util.Date. - * @param {Object} val The value to test - * @returns True if the value is a date, false otherwise - * @type Boolean - */ -function isDate(val) { - return val instanceof Date || - val instanceof java.util.Date; -}; - -/** - * Returns true if the value passed as argument is either a Javascript - * object or an instance of java.lang.Object. - * @param {Object} val The value to test - * @returns True if the value is an object, false otherwise - * @type Boolean - */ -function isObject(val) { - return val instanceof Object || - val instanceof java.lang.Object; -}; - -/** - * Returns true if the value passed as argument is a function. - * @param {Object} val The value to test - * @returns True if the argument is a function, false otherwise - * @type Boolean - */ -function isFunction(val) { - return val instanceof Function; -}; \ No newline at end of file diff --git a/modules/jala/code/History.js b/modules/jala/code/History.js deleted file mode 100644 index 215166ac..00000000 --- a/modules/jala/code/History.js +++ /dev/null @@ -1,253 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.History class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Constructs a new History object. - * @class This class is an implementation of a Browser-like history - * stack suitable to use in any Helma application. The difference - * to a Browser's history is that this implementation ignores - * POST requests and checks if Urls in the stack are still valid to - * prevent eg. redirections to a HopObject's url that has been deleted. - * Plus it is capable to create new "intermediate" history-stacks - * and this way maintain a "history of histories" which is needed for - * eg. editing sessions in a popup window that should use their own - * request history without interfering with the history of the - * main window. - * @constructor - */ -jala.History = function() { - var MAX = 40; - - /** - * Stack constructor - * @private - */ - var Stack = function(id) { - this.items = []; - this.id = id; - return this; - }; - - /** - * Returns the current url including query string - * @private - */ - var getUrl = function() { - var query; - var url = path.href(req.action); - try { - if (query = req.getServletRequest().getQueryString()) - url += "?" + query; - } catch (e) { - // ignore - } - return url; - } - - /** - * Checks if a request is valid for being added - * to the history stack. This method returns false - * for all POST-requests or requests whose action name - * contains a dot (to prevent requests for external stylesheets - * or the like from being recorded). - * @private - * @type Boolean - */ - var isValid = function() { - // FIXME: we should check for mimetype of response instead - // of assuming that requests containing a dot aren't worth - // being put into history stack ... - if (req.isPost() || (req.action && req.action.contains("."))) - return false; - return true; - }; - - /** - * returns a single Stack instance - * @private - */ - var getStack = function() { - if (history.length < 1) - history.push(new Stack(getUrl())); - return history[history.length -1]; - }; - - /** - * Variable containing the history-stacks - * @private - */ - var history = []; - - /** - * Initializes a new history stack, adds - * it to the array of stacks (which makes it - * the default one to use for further requests) - * and records the current request Url. - */ - this.add = function() { - if (!isValid()) - return; - var url = getUrl(); - if (getStack().id != url) { - history.push(new Stack(url)); - this.push(); - } - return; - }; - - /** - * Removes the current history stack - */ - this.remove = function() { - history.pop(); - return; - }; - - /** - * Records a request Url in the currently active - * history stack. - */ - this.push = function() { - if (isValid()) { - var obj = path[path.length-1]; - var url = getUrl(); - var stack = getStack(); - if (stack.items.length < 1 || stack.items[stack.items.length -1].url != url) { - if (stack.items.length >= MAX) - stack.items.shift(); - stack.items.push({ - url: url, - path: path.href().substring(root.href().length).replace(/\+/g, " ") - }); - } - } - return; - }; - - /** - * Clears the currently active history stack - */ - this.clear = function() { - getStack().items.length = 0; - return; - }; - - /** - * Redirects the client back to the first valid - * request in history. Please mind that searching for - * a valid Url starts at history.length - 2. - * @param {Number} offset The index position in the stack to start - * searching at - */ - this.redirect = function(offset) { - res.redirect(this.pop(offset)); - return; - }; - - /** - * Retrieves the first valid request Url in history - * stack starting with a given offset. The default offset is 1. - * Any valid Url found is removed from the stack, therefor - * this method alters the contents of the history stack. - * @param {Number} offset The index position in history stack to start - * searching at - * @return The Url of the request - * @type String - */ - this.pop = function(offset) { - /** - * checks if a referrer is stil valid - * @private - */ - var isValidPath = function(p) { - var arr = p.split("/"); - var obj = root; - for (var i=0;i 0) { - while (cut-- > 0) { - obj = stack.items.pop(); - } - } - while (stack.items.length > 0) { - obj = stack.items.pop(); - // check if url is valid - if (isValidPath(obj.path)) { - return obj.url; - } - } - return path.href(); - }; - - /** - * Retrieves the request Url at the given position - * in the current history stack. If no offset is given - * the last Url in the stack is returned. This method - * does not alter the stack contents! - * @param {Number} offset The index position in history stack to start - * searching at - * @return The Url of the request - * @type String - */ - this.peek = function(offset) { - var stack = getStack(); - return stack.items[stack.items.length - (offset != null ? offset : 1)]; - }; - - /** - * Returns the contents of all history stacks - * as string - * @return The history stacks as string - * @type String - */ - this.dump = function() { - return history.toSource(); - }; - - /** @ignore */ - this.toString = function() { - return "[History " + getStack().toSource() + "]"; - }; - - return this; -} diff --git a/modules/jala/code/HopObject.js b/modules/jala/code/HopObject.js deleted file mode 100644 index 657a24c7..00000000 --- a/modules/jala/code/HopObject.js +++ /dev/null @@ -1,177 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * @fileoverview Additional fields and methods of the HopObject class. - */ - -/** - * HelmaLib dependencies - */ -app.addRepository("modules/core/String.js"); -app.addRepository("modules/helma/File.js"); - -/** - * Constructs a name from an object which - * is unique in the underlying HopObject collection. - * @param {Object} obj The object representing or containing - * the alias name. Possible object types include: - *
      - *
    • File
    • - *
    • helma.File
    • - *
    • java.io.File
    • - *
    • String
    • - *
    • java.lang.String
    • - *
    • Packages.helma.util.MimePart
    • - *
    - * @param {Number} maxLength The maximum length of the alias - * @returns The resulting alias - * @type String - */ -HopObject.prototype.getAccessName = function(obj, maxLength) { - /** - * Private method checking if the key passed as argument is already - * existing in this object - * @param {String} key The key string to test - * @returns True in case the key is already in use, false otherwise - * @type Boolean - */ - var isReserved = function(obj, key) { - return key === "." || - key === ".." || - obj[key] != null || - obj[key + "_action"] != null || - obj.get(key) != null - }; - - // prepare name depending on argument - var name; - var clazz = obj.constructor || obj.getClass(); - switch (clazz) { - case File: - case helma.File: - case java.io.File: - case Packages.helma.util.MimePart: - // first fix bloody ie/win file paths containing backslashes - name = obj.getName().split(/[\\\/]/).pop(); - if (name.contains(".")) - name = name.substring(0, name.lastIndexOf(".")); - break; - case String: - case java.lang.String: - name = obj; - break; - default: - name = obj.toString(); - } - - // remove all (back)slashes - var accessName = name.replace(/[\\\/]/g, ""); - // remove all plus signs - accessName = accessName.replace("+",""); - if (accessName.length > maxLength) { - accessName = accessName.substring(0, maxLength); - } - var result = accessName; - if (isReserved(this, result)) { - var len = result.length; - var counter = 1; - var overflow; - while (isReserved(this, result)) { - result = accessName + "-" + counter.toString(); - if ((overflow = result.length - maxLength) > 0) { - result = accessName.substring(0, accessName.length - overflow) + - "-" + counter.toString(); - if (result.length > maxLength) { - throw "Unable to create accessname due to limit restriction"; - } - } - counter += 1; - } - } - return result; -}; - - -/** - * Returns true if the internal state of this HopObject is TRANSIENT. - * @returns True if this HopObject is marked as transient, false otherwise. - * @type Boolean - */ -HopObject.prototype.isTransient = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.TRANSIENT; -}; - -/** - * Returns true if the internal state of this HopObject is VIRTUAL. - * @returns True if this HopObject is marked as virtual, false otherwise. - * @type Boolean - */ -HopObject.prototype.isVirtual = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.VIRTUAL; -}; - -/** - * Returns true if the internal state of this HopObject is INVALID. - * @returns True if this HopObject is marked as invalid, false otherwise. - * @type Boolean - */ -HopObject.prototype.isInvalid = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.INVALID; -}; - -/** - * Returns true if the internal state of this HopObject is CLEAN. - * @returns True if this HopObject is marked as clean, false otherwise. - * @type Boolean - */ -HopObject.prototype.isClean = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.CLEAN; -}; - -/** - * Returns true if the internal state of this HopObject is NEW. - * @returns True if this HopObject is marked as new, false otherwise. - * @type Boolean - */ -HopObject.prototype.isNew = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.NEW; -}; - -/** - * Returns true if the internal state of this HopObject is MODIFIED. - * @returns True if this HopObject is marked as modified, false otherwise. - * @type Boolean - */ -HopObject.prototype.isModified = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.MODIFIED; -}; - -/** - * Returns true if the internal state of this HopObject is DELETED. - * @returns True if this HopObject is marked as deleted, false otherwise. - * @type Boolean - */ -HopObject.prototype.isDeleted = function() { - return this.__node__.getState() === Packages.helma.objectmodel.INodeState.DELETED; -}; diff --git a/modules/jala/code/HtmlDocument.js b/modules/jala/code/HtmlDocument.js deleted file mode 100644 index ae5626cf..00000000 --- a/modules/jala/code/HtmlDocument.js +++ /dev/null @@ -1,156 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * @fileoverview Fields and methods of the jala.HtmlDocument class. - */ - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - -/** - * Jala dependencies - */ -(function() { - var jalaDir = getProperty("jala.dir", "modules/jala"); - app.addRepository(jalaDir + "/lib/dom4j-1.6.1.jar"); - app.addRepository(jalaDir + "/lib/jaxen-1.1-beta-8.jar"); -})(); - -/** - * Construct a new HTML document. - * @class This class provides easy access to the elements of - * an arbitrary HTML document. By using TagSoup, Dom4J and Jaxen - * even invalid HTML can be parsed, turned into an object tree - * and easily be processed with XPath expressions. - * @param {String} source The HTML source code. - * @returns A new HTML document. - * @constructor - */ -jala.HtmlDocument = function(source) { - var REQUIREMENTS = { - "dom4j-1.6.1": "http://www.dom4j.org", - "jaxen-1.1-beta-8": "http://www.jaxen.org" - }; - - var reader = new java.io.StringReader(source); - var dom4j = Packages.org.dom4j; - var tagsoup = "org.ccil.cowan.tagsoup.Parser"; - - try { - var saxReader = new dom4j.io.SAXReader(tagsoup); - var document = saxReader.read(reader); - document.normalize(); - } catch(e) { - res.push(); - res.write("\njala.HtmlDocument requires the following Java "); - res.write("packages in ext/lib or application directory:\n"); - for (var i in REQUIREMENTS) { - res.write(i); - res.write(".jar"); - res.write(" ["); - res.write(REQUIREMENTS[i]); - res.write("]\n"); - } - throw (e + res.pop()); - } - - /** - * Get all document nodes from an XPath expression. - * @param {String} xpathExpr An XPath expression. - * @returns A list of HTML elements. - * @type org.dom4j.tree.DefaultElement - */ - this.scrape = function(xpathExpr) { - return document.selectNodes(xpathExpr); - }; - - /** - * Get all link elements of the HTML document. - * @returns A list of link elements. - * @type Array - */ - this.getLinks = function() { - var result = []; - var list = this.scrape("//html:a"); - for (var i=0; i 0) { - object.attributes = new Array; - for (n=0; nlanguage[_COUNTRY][_variant], where language - * is a valid ISO Language Code (eg. "de"), COUNTRY a valid ISO - * Country Code (eg. "AT"), and variant an identifier for the variant to use. - * @returns The locale for the given id - * @type java.util.Locale - */ -jala.I18n.prototype.getLocale = function(localeId) { - if (localeId) { - if (localeId.indexOf("_") > -1) { - var arr = localeId.split("_"); - if (arr.length == 3) { - return new java.util.Locale(arr[0], arr[1], arr[2]); - } else { - return new java.util.Locale(arr[0], arr[1]); - } - } else { - return new java.util.Locale(localeId); - } - } - return java.util.Locale.getDefault(); -} - -/** - * Tries to "translate" the given message key into a localized - * message. - * @param {String} key The message to translate (required) - * @param {String} plural The plural form of the message to translate - * @param {Number} amount A number to determine whether to use the - * singular or plural form of the message - * @returns The localized message or the appropriate key if no - * localized message was found - * @type String - */ -jala.I18n.prototype.translate = function(singularKey, pluralKey, amount) { - var translation = null; - if (singularKey) { - // use the getter method for retrieving the locale - var locale = this.getLocaleGetter()(); - var catalog, key; - if ((catalog = jala.i18n.getCatalog(locale))) { - if (arguments.length == 3 && amount != 1) { // is plural - key = pluralKey; - } else { - key = singularKey; - } - if (!(translation = catalog[key])) { - translation = key; - app.logger.debug("jala.i18n.translate(): Can't find message '" + - key + "' for locale '" + locale + "'"); - } - } else { - app.logger.debug("jala.i18n.translate(): Can't find message catalog for locale '" + locale + "'"); - if (!pluralKey || amount == 1) { - translation = singularKey; - } else { - translation = pluralKey; - } - } - } - return translation; -}; - -/** - * Helper method to get the message catalog - * corresponding to the actual locale. - * @params {java.util.Locale} locale - * @returns The message catalog. - */ -jala.I18n.prototype.getCatalog = function(locale) { - if (!jala.I18n.catalogs) { - jala.I18n.catalogs = {}; - } - - var catalog = jala.I18n.catalogs[locale]; - - if (catalog) return catalog; - - var messages = this.getMessages(); - - if (locale && messages) { - catalog = messages[locale.toLanguageTag()]; - jala.I18n.catalogs[locale] = catalog; - } - - return catalog; -}; - -/** - * Converts the message passed as argument into an instance - * of java.text.MessageFormat, and formats it using the - * replacement values passed. - * @param {String} message The message to format - * @param {Array} values An optional array containing replacement values - * @returns The formatted message or, if the formatting fails, the - * message passed as argument. - * @type String - * @see http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html - */ -jala.I18n.prototype.formatMessage = function(message, values) { - if (message) { - var args = null; - if (values != null && values.length > 0) { - args = java.lang.reflect.Array.newInstance(java.lang.Object, values.length); - var arg; - for (var i=0;inumber must - * match the number of the additional argument (starting with zero). - * @param {String} key The message to localize - * @returns The translated message - * @type String - * @see #translate - * @see #formatMessage - */ -jala.I18n.prototype.gettext = function(key /** [value 0][, value 1][, ...] */) { - return this.formatMessage(this.translate(key), - Array.prototype.splice.call(arguments, 1)); -}; - -/** - * Returns a localized message for the message key passed as - * argument. In contrast to gettext() this method - * can handle plural forms based on the amount passed as argument. - * If no localization is found, the appropriate message key is - * returned. Any additional arguments passed to this function - * will be used as replacement values during message rendering. - * To reference these values the message can contain placeholders - * following "{number}" notation, where number must - * match the number of the additional argument (starting with zero). - * @param {String} singularKey The singular message to localize - * @param {String} pluralKey The plural form of the message to localize - * @param {Number} amount The amount which is used to determine - * whether the singular or plural form of the message should be returned. - * @returns The translated message - * @type String - * @see #translate - * @see #formatMessage - */ -jala.I18n.prototype.ngettext = function(singularKey, pluralKey, amount /** [value 0][, value 1][, ...] */) { - return this.formatMessage(this.translate(singularKey, pluralKey, amount || 0), - Array.prototype.splice.call(arguments, 2)); -}; - -/** - * A simple proxy method which is used to mark a message string - * for the i18n parser as to be translated. - * @param {String} key The message that should be seen by the - * i18n parser as to be translated. - * @returns The message in unmodified form - * @type String - */ -jala.I18n.prototype.markgettext = function(key) { - return key; -}; - -/** - * Returns a translated message. The following macro attributes - * are accepted: - *
      - *
    • text: The message to translate (required)
    • - *
    • plural: The plural form of the message
    • - *
    • values: A list of replacement values. Use a comma to separate more - * than one value. Each value is either interpreted as a global property - * (if it doesn't containg a dot) or as a property name of the given macro - * handler object (eg. "user.name"). If the value of the property is a - * HopObject or an Array this macro uses the size() resp. length of the - * object, otherwise the string representation of the object will be used.
    • - *
    - * @returns The translated message - * @type String - * @see #gettext - * @see #ngettext - */ -jala.I18n.prototype.message_macro = function(param) { - if (param.text) { - var args = [param.text]; - if (param.plural) { - args[args.length] = param.plural; - } - if (param.values != null) { - var arr = param.values.split(/\s*,\s*/g); - // convert replacement values: if the value name doesn't contain - // a dot, look for a global property with that name, otherwise - // for a property of the specified macro handler object. - var propName, dotIdx, handlerName, handler; - for (var i=0;i 0) { - var handlerName = propName.substring(0, dotIdx); - if (handlerName == "request") { - handler = req.data; - } else if (handlerName == "response") { - handler = res.data; - } else if (!(handler = res.handlers[handlerName])) { - continue; - } - propName = propName.substring(dotIdx + 1); - // primitive security: don't allow access to internal properties - // and a property named "password" - if (propName.charAt(0) != "_" && propName.toLowerCase() != "password") { - value = handler[propName]; - } - } else { - value = global[propName]; - } - if (value != null) { - // if its a HopObject collection or Array, use its size/length - // as value - if (value instanceof HopObject) { - value = value.size(); - } else if (value instanceof Array) { - value = value.length; - } - } - args[args.length] = value; - } - } - } - if (param.plural) { - return this.ngettext.apply(this, args); - } else { - return this.gettext.apply(this, args); - } - } - return; -}; - -/** - * Default i18n class instance. - * @type jala.I18n - * @final - */ -jala.i18n = new jala.I18n(); - -/** - * For convenience reasons the public methods and macros are - * put into global scope too - */ -var gettext = function() { - return jala.i18n.gettext.apply(jala.i18n, arguments); -}; -var ngettext = function() { - return jala.i18n.ngettext.apply(jala.i18n, arguments); -}; -var markgettext = function() { - return jala.i18n.markgettext.apply(jala.i18n, arguments); -}; -var message_macro = function() { - return jala.i18n.message_macro.apply(jala.i18n, arguments); -}; diff --git a/modules/jala/code/ImageFilter.js b/modules/jala/code/ImageFilter.js deleted file mode 100644 index d20ff9b2..00000000 --- a/modules/jala/code/ImageFilter.js +++ /dev/null @@ -1,362 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.ImageFilter class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Constructs a new ImageFilter object - * @class This class provides several image manipulating - * methods. Most of this filter library is based on filters created - * by Janne Kipin for JAlbum. For more information have a look - * at http://www.ratol.fi/~jakipina/java/ - * @param {Object} img Either -
      -
    • an instance of helma.image.ImageWrapper
    • -
    • the path to the image file as String
    • -
    • an instance of helma.File representing the image file
    • -
    • an instance of java.io.File representing the image file
    • -
    - * @constructor - */ -jala.ImageFilter = function(img) { - /** - * The buffered image to work on - * @type java.awt.image.BufferedImage - * @private - */ - var bi; - - /** - * Perfoms a gaussian operation (unsharp masking or blurring) - * on the image using the kernelFactory passed as argument - * @param {Number} radius The radius - * @param {Number} amount The amount - * @param {Function} kernelFactory Factory method to call for building the kernel - * @private - */ - var gaussianOp = function(radius, amount, kernelFactory) { - var DEFAULT_RADIUS = 2; - var MINIMUM_RADIUS = 1; - var MAXIMUM_RADIUS = 10; - var DEFAULT_AMOUNT = 15; - var MINIMUM_AMOUNT = 1; - var MAXIMUM_AMOUNT = 100; - - // correct arguments if necessary - if (isNaN(radius = Math.min(Math.max(radius, MINIMUM_RADIUS), MAXIMUM_RADIUS))) - radius = DEFAULT_RADIUS; - if (isNaN(amount = Math.min(Math.max(amount, MINIMUM_AMOUNT), MAXIMUM_AMOUNT))) - amount = DEFAULT_AMOUNT; - - if ((bi.getWidth() < bi.getHeight()) && (radius > bi.getWidth())) { - radius = bi.getWidth(); - } else if ((bi.getHeight() < bi.getWidth()) && (radius > bi.getHeight())) { - radius = bi.getHeight(); - } - - var size = (radius * 2) + 1; - var deviation = amount / 20; - var elements = kernelFactory(size, deviation); - var large = jala.ImageFilter.getEnlargedImageWithMirroring(bi, radius); - var resultImg = new java.awt.image.BufferedImage(large.getWidth(), large.getHeight(), large.getType()); - var kernel = new java.awt.image.Kernel(size, size, elements); - var cop = new java.awt.image.ConvolveOp(kernel, java.awt.image.ConvolveOp.EDGE_NO_OP, null); - cop.filter(large, resultImg); - // replace the wrapped buffered image with the modified one - bi = resultImg.getSubimage(radius, radius, bi.getWidth(), bi.getHeight()); - return; - }; - - /** - * Sharpens the image using a plain sharpening kernel. - * @param {Number} amount The amount of sharpening to apply - */ - this.sharpen = function(amount) { - var DEFAULT = 20; - var MINIMUM = 1; - var MAXIMUM = 100; - // correct argument if necessary - if (isNaN(Math.min(Math.max(amount, MINIMUM), MAXIMUM))) - amount = DEFAULT; - var sharpened = new java.awt.image.BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType()); - var kernel = new java.awt.image.Kernel(3, 3, jala.ImageFilter.getSharpeningKernel(amount)); - var cop = new java.awt.image.ConvolveOp(kernel, java.awt.image.ConvolveOp.EDGE_NO_OP, null); - cop.filter(bi, sharpened); - bi = sharpened; - return; - }; - - /** - * Performs an unsharp mask operation on the image - * @param {Number} radius The radius - * @param {Number} amount The amount - */ - this.unsharpMask = function(radius, amount) { - gaussianOp(radius, amount, jala.ImageFilter.getUnsharpMaskKernel); - return; - }; - - /** - * Performs a gaussian blur operation on the image - * @param {Number} radius The radius - * @param {Number} amount The amount - */ - this.gaussianBlur = function(radius, amount) { - gaussianOp(radius, amount, jala.ImageFilter.getGaussianBlurKernel); - return; - }; - - - /** - * Returns the image that has been worked on - * @return An instance of helma.image.ImageWrapper - * @type helma.image.ImageWrapper - */ - this.getImage = function() { - var generator = Packages.helma.image.ImageGenerator.getInstance(); - return new Packages.helma.image.ImageWrapper(bi, - bi.getWidth(), - bi.getHeight(), - generator); - }; - - /** - * Returns the wrapped image as byte array, to use eg. in conjunction - * with res.writeBinary() - * @returns The wrapped image as byte array - * @type byte[] - */ - this.getBytes = function() { - var outStream = new java.io.ByteArrayOutputStream(); - Packages.javax.imageio.ImageIO.write(bi, "jpeg", outStream); - var bytes = outStream.toByteArray(); - outStream.close(); - return bytes; - }; - - /** - * constructor body - * @ignore - */ - if (arguments.length == 0 || img == null) { - throw "jala.ImageFilter: insufficient arguments"; - } else if (img instanceof Packages.helma.image.ImageWrapper) { - bi = img.getBufferedImage(); - } else { - if (typeof(img) == "string") { - var inStream = new java.io.FileInputStream(new java.io.File(img)); - } else { - var inStream = new java.io.FileInputStream(img); - } - var decoder = Packages.com.sun.image.codec.jpeg.JPEGCodec.createJPEGDecoder(inStream); - bi = decoder.decodeAsBufferedImage(); - } - - return this; -}; - -/** @ignore */ -jala.ImageFilter.prototype.toString = function() { - return "[jala.ImageFilter]"; -}; - -/** - * Transforms an image into a bigger one while mirroring the edges - * This method is used to apply the filtering up to the edges - * of an image (otherwise the image would keep an unmodified - * border). - * @param {java.awt.image.BufferedImage} bi The buffered image to transform - * @param {Number} size The size of the border area - * @returns The transformed image - * @type java.awt.image.BufferedImage - * @private - */ -jala.ImageFilter.getEnlargedImageWithMirroring = function(bi, size) { - - var doFlip = function(bi, sx, sy, dist) { - var out = new java.awt.image.BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType()); - var transform = java.awt.geom.AffineTransform.getScaleInstance(sx, sy); - (sx < sy) ? transform.translate(-dist, 0) : transform.translate(0, -dist); - var atop = new java.awt.image.AffineTransformOp(transform, - java.awt.image.AffineTransformOp.TYPE_NEAREST_NEIGHBOR); - out = atop["filter(java.awt.image.BufferedImage,java.awt.image.BufferedImage)"](bi, null); - return out; - } - - var doHorizontalFlip = function(bi) { - return doFlip(bi, -1, 1, bi.getWidth()); - } - - var doVerticalFlip = function(bi) { - return doFlip(bi, 1, -1, bi.getHeight()); - } - - var width = bi.getWidth() + 2 * size; - var height = bi.getHeight() + 2 * size; - var out = new java.awt.image.BufferedImage(width, height, bi.getType()); - var g = out.createGraphics(); - // due to method overloading exactly define the method to be called - var func = "drawImage(java.awt.Image,int,int,java.awt.image.ImageObserver)"; - g[func](bi, size, size, null); - - var part; - //top-left corner - part = bi.getSubimage(0, 0, size, size); - part = doHorizontalFlip(part); - part = doVerticalFlip(part); - g[func](part, 0, 0, null); - //top-right corner - part = bi.getSubimage(bi.getWidth()-size, 0, size, size); - part = doHorizontalFlip(part); - part = doVerticalFlip(part); - g[func](part, width-size, 0, null); - //bottom-left corner - part = bi.getSubimage(0, bi.getHeight()-size, size, size); - part = doHorizontalFlip(part); - part = doVerticalFlip(part); - g[func](part, 0, height-size, null); - //bottom-right corner - part = bi.getSubimage(bi.getWidth()-size, bi.getHeight()-size, size, size); - part = doHorizontalFlip(part); - part = doVerticalFlip(part); - g[func](part, width-size, height-size, null); - //left border - part = bi.getSubimage(0, 0, size, bi.getHeight()); - part = doHorizontalFlip(part); - g[func](part, 0, size, null); - //right border - part = bi.getSubimage(bi.getWidth()-size, 0, size, bi.getHeight()); - part = doHorizontalFlip(part); - g[func](part, width-size, size, null); - //top border - part = bi.getSubimage(0, 0, bi.getWidth(), size); - part = doVerticalFlip(part); - g[func](part, size, 0, null); - //bottom border - part = bi.getSubimage(0, bi.getHeight()-size, bi.getWidth(), size); - part = doVerticalFlip(part); - g[func](part, size, height-size, null); - return out; -}; - -/** - * Factory method for a gaussian blur kernel - * @returns The gaussian blur kernel - * @param {Number} size The size of the kernel - * @param {Number} deviation The deviation to use - * @returns The gaussian blur kernel - * @type float[] - * @private - */ -jala.ImageFilter.getGaussianBlurKernel = function(size, deviation) { - var nominator = 2 * deviation * deviation; - var kernel = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, size*size); - var center = (size - 1) / 2; - var limit = size - 1; - var xx, yy; - var sum = 0; - var value = 0; - for (var y=0; y= y) { - //calculate new value - xx = center - x; - yy = center - y; - value = Math.exp(-(xx*xx + yy*yy) / nominator); - kernel[(y*size)+x] = value; - sum += value; - } else { - //copy existing value - value = kernel[(x*size)+y]; - kernel[(y*size)+x] = value; - sum += value; - } - } else { - xx = x; - yy = y; - if (yy > center) - yy = limit - yy; - if (xx > center) - xx = limit - xx; - value = kernel[(yy*size)+xx]; - kernel[(y*size)+x] = value; - sum += value; - } - } - } - for (var i=0; i 0) { - // convert the array with sortfields to a java array - var arr = java.lang.reflect.Array.newInstance(pkg.search.SortField, sortFields.length); - sortFields.forEach(function(sortField, idx) { - arr[idx] = sortField; - }); - var sort = pkg.search.Sort(arr); - if (filter) { - hits = searcher.search(query, filter, sort); - } else { - hits = searcher.search(query, sort); - } - } else if (filter) { - hits = searcher.search(query, filter); - } else { - hits = searcher.search(query); - } - this.log("debug", "Query: " + query.toString()); - return new helma.Search.HitCollection(hits); -}; - -/** - * Parses the query string passed as argument into a lucene Query instance - * @param {String} queryStr The query string to parse - * @param {Array} fields An array containing the names of the files to search in - * @param {Object} boostMap An optional object containing properties whose name denotes - * the name of the field to boost in the query, and the value the boost value. - * @returns The query - * @type org.apache.lucene.search.Query - */ -jala.IndexManager.prototype.parseQuery = function(queryStr, fields, boostMap) { - if (queryStr == null || typeof(queryStr) !== "string") { - throw "IndexManager.parseQuery(): missing or invalid query string"; - } - if (fields == null || fields.constructor !== Array || fields.length < 1) { - throw "IndexManager.parseQuery(): missing fields argument"; - } - var query = null; - var analyzer = this.getIndex().getAnalyzer(); - var pkg = Packages.org.apache.lucene; - var map = null; - if (boostMap != null) { - // convert the javascript object into a HashMap - map = new java.util.HashMap(); - for (var name in boostMap) { - map.put(name, new java.lang.Float(boostMap[name])); - } - } - var parser; - try { - if (fields.length > 1) { - parser = new pkg.queryParser.MultiFieldQueryParser(fields, analyzer, map); - } else { - parser = new pkg.queryParser.QueryParser(fields, analyzer); - } - query = parser.parse(queryStr); - } catch (e) { - // ignore, but write a message to debug log - app.logger.debug("Unable to construct search query '" + queryStr + - "', reason: " + e); - } - return query; -}; - -/** - * Parses the query passed as argument and returns a caching filter. If an array - * with more than one query strings is passed as argument, this method constructs - * a boolean query filter where all queries in the array must match. - * @param {String|Array} query Either a query string, or an array containing - * one or more query strings - * @param {org.apache.lucene.analysis.Analyzer} analyzer Optional analyzer - * to use when parsing the filter query - * @returns A caching query filter - * @type org.apache.lucene.search.CachingWrapperFilter - */ -jala.IndexManager.prototype.parseQueryFilter = function(query, analyzer) { - var filter = null; - if (query != null) { - var pkg = Packages.org.apache.lucene; - // use the index' analyzer if none has been specified - if (analyzer == null) { - analyzer = this.getIndex().getAnalyzer(); - } - var parser = new pkg.queryParser.QueryParser("", analyzer); - var filterQuery; - try { - if (query.constructor === Array) { - if (query.length > 1) { - filterQuery = new pkg.search.BooleanQuery(); - query.forEach(function(queryStr){ - filterQuery.add(parser.parse(queryStr), pkg.search.BooleanClause.Occur.MUST); - }, this); - } else { - filterQuery = parser.parse(query[0]); - } - } else { - filterQuery = parser.parse(query); - } - filter = new pkg.search.CachingWrapperFilter(new pkg.search.QueryWrapperFilter(filterQuery)); - } catch (e) { - app.logger.debug("Unable to parse query filter '" + query + "', reason: " + e); - } - } - return filter; -}; - - - -/********************* - ***** J O B ***** - *********************/ - - -/** - * Creates a new Job instance. - * @class Instances of this class represent a single index - * manipulation job to be processed by the index manager. - * @param {Number} id The Id of the job - * @param {Number} type The type of job, which can be either - * jala.IndexManager.Job.ADD, jala.IndexManager.Job.REMOVE - * or jala.IndexManager.Job.OPTIMIZE. - * @param {Object} data The data needed to process the job. - * @returns A newly created Job instance. - * @constructor - * @see jala.IndexManager.Job - */ -jala.IndexManager.Job = function(type, callback) { - /** - * The type of the job - * @type Number - */ - this.type = type; - - /** - * The data needed to process this job. For adding jobs this property - * must contain the {@link helma.Search.Document} instance to add to - * the index. For removal job this property must contain the unique identifier - * of the document that should be removed from the index. For optimizing - * jobs this property is null. - */ - this.callback = callback; - - /** - * An internal error counter which is increased whenever processing - * the job failed. - * @type Number - * @see jala.IndexManager.MAXTRIES - */ - this.errors = 0; - - /** - * The date and time at which this job was created. - * @type Date - */ - this.createtime = new Date(); - - return this; -}; - -/** @ignore */ -jala.IndexManager.Job.prototype.toString = function() { - return "[Job (type: " + this.type + ")]"; -}; - -/** - * Constant defining an add job - * @type Number - * @final - */ -jala.IndexManager.Job.ADD = "add"; - -/** - * Constant defining a removal job - * @type Number - * @final - */ -jala.IndexManager.Job.REMOVE = "remove"; - -/** - * Constant defining an optimizing job - * @type Number - * @final - */ -jala.IndexManager.Job.OPTIMIZE = "optimize"; diff --git a/modules/jala/code/ListRenderer.js b/modules/jala/code/ListRenderer.js deleted file mode 100644 index 215237cc..00000000 --- a/modules/jala/code/ListRenderer.js +++ /dev/null @@ -1,1130 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.ListRenderer class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * HelmaLib dependencies - */ -app.addRepository("modules/helma/Html.js"); - -/** - * @class - * @param {HopObject|ArrayList|Array} coll The collection this ListRenderer - * operates on, or - for backwards compatibility only - a parameter object containing - * the collection and any other optional configuration parameters. - * @param {Object} renderer An optional renderer to use. If this is set, - * any rendering method defined in this renderer overrides the default renderer. - * @constructor - */ -jala.ListRenderer = function(coll, renderer) { - - /** - * The collection this ListRenderer operates on - * @type HopObject|ArrayList - * @private - */ - var collection = null; - - /** - * Private variable containing the number of items to display - * on one page. Defaults to 10. - * @type Number - * @private - */ - var pageSize = 10; - - /** - * Private variable containing the maximum number of pages to display - * within this ListRenderer instance - * @type Number - * @private - */ - var maxPages = Number.MAX_VALUE; - - /** - * Private variable containing the maximum number of days to display - * within this ListRenderer instance. If set to null this check - * is not used. - * @type Number - * @private - */ - var maxDays = null; - - /** - * Private variable containing the base href of this ListRenderer - * @type String - * @private - */ - var baseHref = null; - - /** - * Private variable containing the name of the skin to render for - * a single list item - * @type String - * @private - */ - var itemSkin = null; - - /** - * Private variable containing any optional url parameters to append to - * every navigation link rendered by this ListRenderer instance. - * @type String - * @private - */ - var urlParameters = null; - - /** - * Private variable containing the name of the url parameter containing - * the page number to display. Defaults to "page". - * @type String - * @private - */ - var urlParameterName = "page"; - - /** - * Internal cache for rendered navigation elements - * @private - */ - this.cache = { - pageNavigation: null, - prevLink: null, - nextLink: null, - maxDayDate: null, - nextItem: null - }; - - /** - * Returns the collection this ListRenderer instance operates on - * @returns The collection of this ListRenderer - * @type HopObject|Array - */ - this.getCollection = function() { - return collection; - }; - - /** - * Sets the collection of this ListRenderer - * @param {HopObject|ArrayList|Array} coll The collection this ListRenderer instance - * should operate on - */ - this.setCollection = function(coll) { - if (coll != null) { - if (coll instanceof Array) { - // wrap array in an ArrayList instance - collection = new jala.ListRenderer.ArrayList(coll); - } else { - collection = coll; - } - } - return; - }; - - /** - * Returns the number of items displayed on one page - * @returns The number of items displayed on a single page - * @type Number - */ - this.getPageSize = function() { - return pageSize; - }; - - /** - * Sets the number of items to display on a single page - * @param {Number} size The number of items to display on one page - */ - this.setPageSize = function(size) { - if (size != null && !isNaN(size)) { - pageSize = parseInt(size, 10); - } - return; - }; - - /** - * Returns the current page index. This is either the page url parameter - * or the page number 1. - * @returns The current page number (starts with 1). - * @type Number - * @see #setUrlParameterName - */ - this.getCurrentPage = function() { - var pageNr = parseInt(req.data[this.getUrlParameterName()], 10); - if (!pageNr || isNaN(pageNr)) { - pageNr = 1; - } - return Math.min(Math.max(1, pageNr), this.getTotalPages()); - }; - - /** - * Returns the maximum number of pages handled by this ListRenderer instance - * @returns The maximum number of pages - * @type Number - */ - this.getMaxPages = function() { - return maxPages; - }; - - /** - * Sets the maximum number of pages to display - * @param {Number} pages The maximum number of pages to display - */ - this.setMaxPages = function(pages) { - if (pages != null && !isNaN(pages)) { - maxPages = parseInt(pages, 10); - } - return; - }; - - /** - * Returns the maximum number of days handled by this ListRenderer instance - * @returns The maximum number of days - * @type Number - */ - this.getMaxDays = function() { - return maxDays; - }; - - /** - * Sets the maximum number of days to display - * @param {Number} days The maximum number of days to display - */ - this.setMaxDays = function(days) { - if (days != undefined && !isNaN(days)) { - maxDays = parseInt(days, 10); - } - return; - }; - - /** - * Gets the Date offset indicated by parameter maxDays as Number for runtime efficent comparison - * @type Number - */ - this.getMaxDayDate = function() { - if (this.cache.maxDayDate != null) { - return this.cache.maxDayDate; - } - this.cache.maxDayDate = parseInt((new Date((new Date()).getTime() - (maxDays * Date.ONEDAY))).format("yyyyMMdd"), 10); - return this.cache.maxDayDate; - }; - - /** - * @returns {Object} the next Item - */ - this.getNextItem = function() { - if (this.cache.nextItem !== null) { - return this.cache.nextItem; - } - var nextItemIndex = this.getEndIndex() + 1; - this.cache.nextItem = "none"; - if (collection.size() > nextItemIndex) { - this.cache.nextItem = collection.get(nextItemIndex); - } - return this.cache.nextItem; - }; - - /** - * @returns {Boolean} wether there is a next item - */ - this.hasNext = function() { - var nextItem = this.getNextItem(); - var nextIsDisplayable = false; - var collection = this.getCollection(); - if (maxDays != undefined) { - if (nextItem != "none" && nextItem.getDayDate() >= this.getMaxDayDate()) { - nextIsDisplayable = true; - } - } else { - if (nextItem != "none") { - nextIsDisplayable = true; - } - } - if (collection.size() && - nextIsDisplayable === true) { - return true; - } - return false; - }; - - /** - * Returns the total number of pages handled by this ListRenderer instance - * (which is the collection size divided by the page size). - * @returns The total number of pages - * @type Number - */ - this.getTotalPages = function() { - var collectionSize = collection.size(); - var pages = Math.ceil(collectionSize / pageSize); - if (maxPages > 0) { - return Math.min(maxPages, pages); - } - return pages; - }; - - /** - * Returns the base href of this ListRenderer instance - * @returns The base href of this ListRenderer instance - * @type String - */ - this.getBaseHref = function() { - return baseHref; - }; - - /** - * Sets the base href of this ListRenderer instance. All links rendered - * will start with the href passed as argument - * @param {String} href The base href to use for rendering links - */ - this.setBaseHref = function(href) { - if (href != null) { - baseHref = href; - } - return; - }; - - /** - * Returns the name of the skin rendered for a single list item - * @returns The name of the list item skin - * @type Number - */ - this.getItemSkin = function() { - return itemSkin; - }; - - /** - * Sets the name of the skin to render for every list item - * @param {String} name The name of the skin to render for every list item - */ - this.setItemSkin = function(name) { - if (name != null) { - itemSkin = name; - } - return; - }; - - /** - * Returns the name of the URL parameter name containing the index - * of the page to display - * @returns The name of the page URL parameter name - * @type String - */ - this.getUrlParameterName = function() { - return urlParameterName; - }; - - /** - * Sets the name of the URL parameter name containing the index of the page - * to display - * @param {String} name The name of the page URL parameter - */ - this.setUrlParameterName = function(name) { - if (name != null) { - urlParameterName = name; - } - return; - }; - - /** - * Returns any additional URL parameters included in every navigation link - * rendered by this ListRenderer instance. - * @returns A string containing additional URL parameters - * @type String - */ - this.getUrlParameters = function() { - return urlParameters; - }; - - /** - * Sets additional parameters to include in every navigation link - * @param {String} params A string to append to every navigation URL - */ - this.setUrlParameters = function(params) { - if (params != null) { - urlParameters = params; - } - return; - }; - - /** - * Returns the renderer used by this ListRenderer instance - */ - this.getRenderer = function() { - return renderer; - }; - - /** - * Sets the renderer to be used by this ListRenderer instance - * @param {Object} r The renderer to use - */ - this.setRenderer = function(r) { - if (r != null) { - renderer = r; - } - return; - }; - - /** - * Main constructor body - */ - if (!coll) { - throw "jala.ListRenderer: insufficient arguments"; - } else if (coll instanceof jala.ListRenderer.ArrayList || - coll instanceof Array || - coll instanceof HopObject) { - this.setCollection(coll); - } else if (coll.collection != null) { - // this is for backwards compatibility only - the former ListRenderer - // signature allowed just one parameter object as argument - this.setCollection(coll.collection); - this.setBaseHref(coll.href); - this.setUrlParameters(coll.urlParams); - this.setUrlParameterName(coll.urlParamName); - this.setPageSize(coll.itemsPerPage); - this.setMaxPages(coll.maxPages); - this.setMaxDays(coll.maxDays); - this.setItemSkin(coll.itemSkin); - } else { - throw "jala.ListRenderer: invalid argument " + coll; - } - return this; -}; - -/** - * Static instance of helma.Html - * @type helma.Html - * @private - */ -jala.ListRenderer.html = new helma.Html(); - -/** @ignore */ -jala.ListRenderer.prototype.toString = function() { - return "[jala.ListRenderer]"; -}; - -/** - * Returns the href of a page. If no argument is given, the href - * of the current page is returned. Any URL parameters set with - * {@link #setUrlParameters} are added to the href. - * @param {Number} page The optional page number to include in the href. - * @returns The href of the page - * @type String - * @see #setUrlParameters - * @see #setUrlParameterName - */ -jala.ListRenderer.prototype.getPageHref = function(page) { - var pageNr = (page != null && !isNaN(page)) ? page : this.getCurrentPage(); - var urlParams = this.getUrlParameters(); - res.push(); - res.write(this.getBaseHref()); - if (pageNr || urlParams) { - res.write("?"); - if (urlParams) { - res.write(urlParams); - res.write("&"); - } - if (pageNr) { - res.write(this.getUrlParameterName()); - res.write("="); - res.write(pageNr); - } - } - return res.pop(); -}; - -/** - * Returns the zero-based index position of the first item of the current page - * in the collection this ListRenderer operates on. - * @returns The index position of the first item in the list - * @type Number - */ -jala.ListRenderer.prototype.getStartIndex = function() { - return (this.getCurrentPage() -1) * this.getPageSize(); -}; - -/** - * Returns the zero-based index position of the last item of the current page - * in the collection this ListRenderer operates on. - * @returns The index position of the last item in the list - * @type Number - */ -jala.ListRenderer.prototype.getEndIndex = function() { - var start = this.getStartIndex(); - return Math.min(start + this.getPageSize(), this.getCollection().size()) - 1; -}; - -/** - * Returns the render function to use for a given part of the list. If this - * ListRenderer doesn't have a renderer attached, or if the renderer doesn't - * have the appropriate rendering function, the default renderer is used. - * @param {String} part The part of the page. Valid arguments are - * "list", "pageNavigation" and "pageLink". - * @param {String} fName The name of the rendering function to return - * @returns The function to call for rendering the desired part of the list - * @type Function - * @private - * @see jala.ListRenderer#defaultRenderer - */ -jala.ListRenderer.prototype.getRenderFunction = function(part, fName) { - - var getFunction = function(renderer, name) { - var handler; - if ((handler = renderer[part]) != null) { - if (handler[name] instanceof Function) { - return handler[name]; - } - } - return null; - }; - - var result; - var renderer = this.getRenderer(); - if (renderer != null) { - if (!fName || !(result = getFunction(renderer, fName))) { - result = getFunction(renderer, "default"); - } - } - if (!result) { - result = getFunction(jala.ListRenderer.defaultRenderer, "default"); - } - return result; -}; - -/** - * Renders the list of items for one page directly to response. - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @see #getList - */ -jala.ListRenderer.prototype.renderList = function(param) { - var collection = this.getCollection(); - var totalPages = this.getTotalPages(); - var currentPage = this.getCurrentPage(); - var pageSize = this.getPageSize(); - var maxDays = this.getMaxDays(); - var itemSkin = this.getItemSkin(); - - if (totalPages > 0) { - if (!param) { - param = {}; - } - var idx = this.getStartIndex(); - var stop = this.getEndIndex(); - // preload objects if collection is a HopObject one - if (collection instanceof HopObject) { - collection.prefetchChildren(idx, stop - idx); - } - // add various item and list related properties to the parameter object - param.counter = 1; - param.index = idx + 1; - param.stop = stop; - param.pageSize = pageSize; - param.itemsPerPage = pageSize; // for backwards compatibility only - param.collectionSize = collection.size(); - if (!param.skin && itemSkin) { - param.skin = itemSkin; - } - - var renderFunc = this.getRenderFunction("list", param.type); - var item, prevItem; - while (idx <= stop) { - item = collection.get(idx++); - if ((maxDays != undefined) && (item.getDayDate() < this.getMaxDayDate())) { - idx = stop; - break; - } - renderFunc(item, prevItem, param); - prevItem = item; - param.counter += 1; - param.index += 1; - } - } - return; -}; - -/** - * Returns the rendered list of collection items as string - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @returns The rendered list - * @type String - * @see #renderList - */ -jala.ListRenderer.prototype.getList = function(param) { - res.push(); - this.renderList(param); - return res.pop() || null; -}; - -/** - * Returns the rendered list of collection items as string - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @returns The rendered list - * @type String - * @see #renderList - * @deprecated Use {@link #getList} instead - */ -jala.ListRenderer.prototype.renderListAsString = function(param) { - return this.getList(param); -}; - -/** - * Renders a link to the previous page directly to response. - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @see #getPrevLink - */ -jala.ListRenderer.prototype.renderPrevLink = function(param) { - res.write(this.getPrevLink(param)); - return; -}; - -/** - * Returns a rendered link to the previous page as string. For performance - * reasons this method caches the rendered link in the local cache of this - * ListRenderer instance. - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @returns A rendered link to the previous page - * @type String - * @see #renderPrevLink - */ -jala.ListRenderer.prototype.getPrevLink = function(param) { - if (!this.cache.prevLink) { - res.push(); - var collection = this.getCollection(); - var currentPage = this.getCurrentPage(); - if (collection.size() && currentPage > 1) { - param.index = currentPage - 1; - param.href = this.getPageHref(param.index); - this.getRenderFunction("pageLink", param.type)("prev", param); - } - this.cache.prevLink = res.pop(); - } - return this.cache.prevLink || null; -}; - -/** - * Returns a rendered link to the previous page as string - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @returns A rendered link to the previous page - * @type String - * @deprecated Use {@link #getPrevLink} instead - */ -jala.ListRenderer.prototype.renderPrevLinkAsString = function(param) { - return this.getPrevLink(param); -}; - -/** - * Renders a link to the next page directly to response. - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @see #getNextLink - */ -jala.ListRenderer.prototype.renderNextLink = function(param) { - res.write(this.getNextLink(param)); - return; -}; - -/** - * Returns a rendered link to the previous page as string. For performance - * reasons this method caches the rendered link in the local cache of this - * ListRenderer instance. - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @returns A rendered link to the previous page - * @type String - * @see #renderNextLink - */ -jala.ListRenderer.prototype.getNextLink = function(param) { - if (!this.cache.nextLink) { - res.push(); - var collection = this.getCollection(); - var currentPage = this.getCurrentPage(); - var totalPages = this.getTotalPages(); - var nextItem = this.getNextItem(); - var nextIsDisplayable = false; - if (this.getMaxDays() != undefined) { - if (nextItem != "none" && nextItem.getDayDate() >= this.getMaxDayDate()) { - nextIsDisplayable = true; - } - } else { - if (nextItem != "none") { - nextIsDisplayable = true; - } - } - if (collection.size() && currentPage < totalPages && nextIsDisplayable === true) { - param.index = currentPage + 1; - param.href = this.getPageHref(param.index); - this.getRenderFunction("pageLink", param.type)("next", param); - } - this.cache.nextLink = res.pop(); - } - return this.cache.nextLink || null; -}; - -/** - * Returns a rendered link to the previous page as string - * @returns A rendered link to the next page - * @type String - * @deprecated Use {@link #getNextLink} instead - */ -jala.ListRenderer.prototype.renderNextLinkAsString = function(param) { - return this.getNextLink(param); -}; - -/** - * Renders the page navigation bar directly to response. For performance reasons - * this method caches the rendered page navigation in the local cache of this - * ListRenderer instance. - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @see #getPageNavigation - */ -jala.ListRenderer.prototype.renderPageNavigation = function(param) { - if (!this.cache.pageNavigation) { - var collection = this.getCollection(); - var totalPages = this.getTotalPages(); - var currentPage = this.getCurrentPage(); - var pageSize = this.getPageSize(); - - if (totalPages > 1) { - var renderFunc = this.getRenderFunction("pageNavigation", param.type); - if (!renderFunc) { - return "[Render function missing]"; - } - - // render the navigation-bar - res.push(); - if (currentPage > 1) { - renderFunc("item", { - text: param.previous || "prev", - url: this.getPageHref(currentPage -1), - }); - } - var navLength = parseInt(param.length, 10) || 10; - var pageNr = 1 + Math.floor((currentPage -1) / navLength) * navLength; - if (pageNr > 1) { - renderFunc("item", { - text: param.previousN || "[..]", - url: this.getPageHref(pageNr - navLength), - }); - } - var stop = Math.min(pageNr + navLength, totalPages +1); - do { - renderFunc("item", { - text: (param.itemPrefix || "") + pageNr + (param.itemSuffix || ""), - url: this.getPageHref(pageNr), - selected: pageNr == currentPage - }); - } while ((pageNr += 1) < stop); - - if (pageNr <= totalPages) { - renderFunc("item", { - text: param.nextN || "[..]", - url: this.getPageHref(pageNr), - }); - } - if (currentPage < totalPages) { - renderFunc("item", { - text: param.next || "next", - url: this.getPageHref(currentPage +1), - }); - } - var navigation = res.pop(); - res.push(); - renderFunc("navigation", { - from: ((currentPage -1) * pageSize) +1, - to: Math.min(((currentPage -1) * pageSize) + pageSize, collection.size()), - total: collection.size(), - pageNavigation: navigation, - }); - this.cache.pageNavigation = res.pop(); - } - } - res.write(this.cache.pageNavigation); - return; -}; - -/** - * Returns the rendered page navigation bar as string - * @param {Object} param Object containing extra parameters (e.g. from a macro call). - * @returns The rendered page navigation - * @type String - * @see #renderPageNavigation - */ -jala.ListRenderer.prototype.getPageNavigation = function(param) { - res.push(); - this.renderPageNavigation(param); - return res.pop() || null; -}; - -/** - * Returns the rendered page navigation bar as string - * @returns The rendered page navigation bar - * @type String - * @deprecated Use {@link #getPageNavigation} instead - */ -jala.ListRenderer.prototype.renderPageNavigationAsString = function(param) { - return this.getPageNavigation(param); -}; - - - -/********************************* - ********** M A C R O S ********** - *********************************/ - - -/** - * Either renders the maximum number of items per page, or - * sets the limit to a given number. - * @param {Object} param Extra macro parameters: - *
      - *
    • to - The maximum number of items per page to be set. - *
    - * If no limit is set, this macro returns the current number - * of items per page. - * @returns The current maximum number of items per page - * @type Number - */ -jala.ListRenderer.prototype.limit_macro = function(param) { - if (param.to) { - this.setPageSize(param.to); - return; - } else { - return this.getPageSize(); - } -}; - -/** - * Returns a rendered link to the previous page. - * @param {Object} param Extra macro parameters: - *
      - *
    • type - The type of renderer to be applied.
    • - *
    - * @returns A rendered link to the previous page - * @type String - * @see #renderPrevLink - */ -jala.ListRenderer.prototype.prevLink_macro = function(param) { - return this.getPrevLink(param); -}; - -/** - * Returns a rendered link to the next page. - * @param {Object} param Extra macro parameters: - *
      - *
    • type - The type of renderer to be applied.
    • - *
    - * @returns A rendered link to the next page - * @type String - * @see #renderNextLink - */ -jala.ListRenderer.prototype.nextLink_macro = function(param) { - return this.getNextLink(param); -}; - -/** - * Returns the rendered page navigation bar. - * @param {Object} param Extra macro parameters: - *
      - *
    • type - The type of renderer to be applied.
    • - *
    - * @returns The rendered page navigation bar - * @type String - * @see #getPageNavigation - */ -jala.ListRenderer.prototype.pageNavigation_macro = function(param) { - return this.getPageNavigation(param); -}; - -/** - * Returns the total number of items - * @returns The total number of items in the collection this ListRenderer - * instance is working on - * @type Number - */ -jala.ListRenderer.prototype.size_macro = function() { - return Math.min(this.getMaxPages() * this.getPageSize(), - this.getCollection().size()); -}; - -/** - * Returns the total number of pages - * @returns The total number of pages available - * @type Number - */ -jala.ListRenderer.prototype.totalPages_macro = function() { - return this.getTotalPages(); -}; - -/** - * Returns the current page number - * @returns The current page number - * @type Number - */ -jala.ListRenderer.prototype.currentPage_macro = function() { - return this.getCurrentPage(); -}; - -/** - * Returns the start item number in the current page - * @returns The start item number in the current page - * @type Number - */ -jala.ListRenderer.prototype.currentStart_macro = function() { - return this.getStartIndex() + 1; -}; - -/** - * Returns the end item number in the current page - * @returns The end item number in the current page - * @type Number - */ -jala.ListRenderer.prototype.currentEnd_macro = function() { - return this.getEndIndex() + 1; -}; - -/** - * Renders the current page of this list. - * @param {Object} param Extra macro parameters: - *
      - *
    • skin - The name of the list skin to render for each item in the list.
    • - *
    • type - The type of renderer to be applied.
    • - *
    - * @see #renderList - */ -jala.ListRenderer.prototype.render_macro = function(param) { - var skinName; - if (!(skinName = param.skin || this.getItemSkin())) { - res.write("[Name of skin missing]"); - } else { - this.renderList(param); - } - return; -}; - - - -/***************************************************** - ********** D E F A U L T R E N D E R E R ********** - *****************************************************/ - - -/** - * Default Renderer object containing functions - * used for rendering different list items (eg. page navigation, - * prev/next links and list items). - * @final - */ -jala.ListRenderer.defaultRenderer = {}; - -/** - * List renderer object - */ -jala.ListRenderer.defaultRenderer.list = {}; - -/** - * Default renderer method for a list - * @param {Object} item The current list item to render. - * @param {Object} prevItem The previous list item - * @param {Object} param A parameter object containing macro attributes - * and some parameters set by the ListRenderer. - */ -jala.ListRenderer.defaultRenderer.list["default"] = function(item, prevItem, param) { - var p = {"class": (param.index % 2 == 0 ? "even" : "odd")}; - item.renderSkin(param.skin, p); - return; -}; - -/** - * Pagenavigation renderer object - */ -jala.ListRenderer.defaultRenderer.pageNavigation = {}; - -/** - * Default renderer method for a page navigation bar. - * @param {String} what A string indicating what should be rendered. Can be - * either "item" or "navigation" (the former is a single page link, the latter - * is the whole navigation. - * @param {Object} A parameter object containing the macro attributes and some - * attributes set by the ListRenderer. - */ -jala.ListRenderer.defaultRenderer.pageNavigation["default"] = function(what, param) { - var skin; - switch (what) { - case "item": - if (param.selected == true) { - param["class"] = "selected"; - } else { - delete param["class"]; - } - param.text = jala.ListRenderer.html.linkAsString({href: param.url}, param.text); - if (param.skin != null) { - renderSkin(param.skin, param); - } else if ((skin = app.getSkin("Global", "pageNavigationItem", res.skinpath)) != null) { - renderSkin(skin, param); - } else { - if (param["class"]) { - res.write(''); - } else { - res.write(""); - } - res.write(param.text); - res.write(''); - } - break; - - case "navigation": - if (param.skin != null) { - renderSkin(param.skin, param); - } else if ((skin = app.getSkin("Global", "pageNavigation", res.skinpath)) != null) { - renderSkin(skin, param); - } else { - res.write('"); - } - break; - } - return; -}; - -/** - * Pagelink renderer object - */ -jala.ListRenderer.defaultRenderer.pageLink = {}; - -/** - * Default rendering method for a page link (aka "prev/next" link) - * @param {String} what A string indicating what should be rendered. Can be - * either "prev" or "next" - * @param {Object} param A parameter object containing macro attributes and - * some set by the ListRenderer. - */ -jala.ListRenderer.defaultRenderer.pageLink["default"] = function(what, param) { - delete param.index; - if (param.skin) { - renderSkin(param.skin, param); - } else { - jala.ListRenderer.html.link(param, param.text || what); - } - return; -}; - - - -/***************************************** - ********** A R R A Y L I S T ********** - *****************************************/ - - -/** - * Creates a new ArrayList instance. - * @class A simple wrapper around an array to use in conjunction - * with jala.ListRenderer. This wrapper can either handle complete arrays - * or subsections of an array. In the latter case the wrapper needs offset - * and total size information as argument to mimick a complete array. - * @param {Array} arr The array (or a subsection of an array) to wrap - * @param {Number} offset An optional offset to use (mandatory if the array - * is just a subsection). - * @param {Number} total An optional total size of the array. This argument is - * mandatory if the wrapped array is just a subsection. - * @returns A newly created ArrayList instance - * @constructor - */ -jala.ListRenderer.ArrayList = function(arr, offset, total) { - /** - * The offset of this ArrayList instance. This might be > zero for - * ArrayList instances wrapping just a subsection, that is - * mimicking a bigger list. - * @type Number - */ - this.offset = offset || 0; - - /** - * The length of this ArrayList instance. - * @type Number - */ - this.length = total || arr.length; - - /** - * Returns the element at the index position passed - * as argument. If the wrapped array is just a subsection - * the index position passed will be corrected using - * the offset. - * @param {Number} idx The index position of the element - * to return - * @returns The element at the given index position - */ - this.get = function(idx) { - return arr[(this.offset > 0) ? idx - offset : idx]; - }; - - /** - * Returns the size of this ArrayList, which is either - * the length of the wrapped array or the total size - * passed as argument to the constructor (in case the wrapped - * array is just a subsection). - * @returns The size of this ArrayList instance - * @type Number - */ - this.size = function() { - return this.length; - }; - - /** - * Returns true if this ArrayList is a subsection of a bigger array - * @returns True if this ArrayList is a subsection of a bigger array - * @type Boolean - */ - this.isSubset = function() { - return offset || total ? true : false; - }; - - /** - * Returns the actual size of this ArrayList's wrapped array. - * @returns The actual size of this ArrayList's wrapped array. - * @type Number - */ - this.subsetSize = function() { - return arr.length; - }; - - return this; -}; - -/** @ignore */ -jala.ListRenderer.ArrayList.prototype.toString = function() { - return "[jala.ListRenderer.ArrayList]"; -}; diff --git a/modules/jala/code/Mp3.js b/modules/jala/code/Mp3.js deleted file mode 100644 index 2a8cfcd9..00000000 --- a/modules/jala/code/Mp3.js +++ /dev/null @@ -1,1521 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * @fileoverview Fields and methods of the jala.audio package. - */ - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - -// Load java libraries -(function() { - var jalaDir = getProperty("jala.dir", "modules/jala"); - // JavaMusicTag (org.farng.mp3.*) - app.addRepository(jalaDir + "/lib/jid3lib-0.5.4.jar"); - // Mp3Info (de.ueberdosis.mp3info.*, required for parseDuration) - app.addRepository(jalaDir + "/lib/id3-1.6.0d9.jar"); -})(); - -// Resolve HelmaLib dependencies -app.addRepository("modules/helma/File.js"); - -/** - * Constructs a new jala.Mp3 wrapper and - * parses the header data of the MP3 file. - * The standard fields for a tag are accessible - * as properties of the new object. - * - * @class This is a class representing an MP3 file - * providing methods to access its metadata. - * - * @param {String|File} file The mp3 file to be parsed, either as - * path string or as any kind of file object - * - * @constructor - */ -jala.Mp3 = function(file) { - - // check and normalize file argument - if (!file) { - throw "jala.Mp3: missing argument"; - } else { - file = new helma.File(file); - } - - try { - var clazz = java.lang.Class.forName("org.farng.mp3.MP3File", - false, app.getClassLoader()) - } catch (e) { - throw "jala.Mp3 requires jid3lib-0.5.4.jar" - + " in lib/ext or modules/jala/lib directory " - + "[http://javamusictag.sourceforge.net/]"; - } - - if (file.getLength() < 128) { - throw "file too short to be an MP3 file (< 128 bytes)"; - } - try { - var mp3File = new Packages.org.farng.mp3.MP3File(file.getAbsolutePath()); - } catch (e) { - throw "error parsing mp3 file: " + e.toString(); - } - - /** - * Returns a helma.File reference to the wrapped file. - * @type helma.File - */ - this.getFile = function() { - return file; - }; - - /** - * Returns the underlying java object - * @type org.farng.mp3.MP3File - */ - this.getJavaObject = function() { - return mp3File; - }; - - - // map to remember tag objects - var tagObjects = {}; - - if (mp3File.hasID3v1Tag()) { - tagObjects[jala.Mp3.Id3v1] = new jala.Mp3.Id3v1(this); - } - - if (mp3File.hasID3v2Tag()) { - tagObjects[jala.Mp3.Id3v2] = new jala.Mp3.Id3v2(this); - } - - /** - * This method creates a new tag object, attaches it - * to the file (thereby replacing an existing tag of - * this type) and returns it. Type is specified using - * the class name in jala.Mp3.*. If a second - * argument is provided, its values are copied into - * the new tag. - * - * @param {Object} tagClass - * @param {Object} tagObject optional tag whose standard - * properties are copied to the new tag. - * @type Object - */ - this.createTag = function(tagClass, tagObject) { - - this.removeTag(tagClass); - tagObjects[tagClass] = new tagClass(this); - // we use zero as default value for empty track numbers. - // this is the same behaviour as with winamp and tag&rename. - tagObjects[tagClass].setTrackNumber("0"); - - if (tagObject) { - tagObjects[tagClass].copyFrom(tagObject); - } - return tagObjects[tagClass]; - }; - - /** - * Returns a tag object, type is specified using the class name - * in jala.Mp3.*. - * @type Object - */ - this.getTag = function(tagClass) { - return tagObjects[tagClass]; - }; - - /** - * Tells if the file contains a certain tag, type is specified - * using the class name in jala.Mp3.* - */ - this.hasTag = function(tagClass) { - return (tagObjects[tagClass]) ? true : false; - }; - - - // field to remember a v2 tag that has to be deleted from the file in save() - var v2JavaTagToDelete = null; - - /** - * Removes a tag from the file, type is specified using the - * class name in jala.Mp3.* - */ - this.removeTag = function(tagClass) { - if (!tagObjects[tagClass]) { - return; - } - - // remember v2 tag here to explicitly delete it from - // the audio file if save() is called ... - // this is a workaround for a bug in JavaMusicTag! - v2JavaTagToDelete = tagObjects[tagClass].getJavaObject(); - - tagObjects[tagClass].removeFromAudio(); - tagObjects[tagClass] = null; - return; - }; - - - /** - * Writes changed metadata back to the source file or to a new file. - * @param {String|helma.File} outFile (optional) save the modified file - * to a different file - * @returns true on success, false if the file contains tags that cannot be saved (Id3v2_2). - * @type Boolean - */ - this.save = function(outFile) { - var tagOptions = Packages.org.farng.mp3.TagOptionSingleton.getInstance(); - // (robert) this appearently fixes the problem that Windows Media Player cannot play files - // anymore if the size of an Id3v2 tag changed - tagOptions.setId3v2PaddingCopyTag(false); - // turn off saving of backup-files: - tagOptions.setOriginalSavedAfterAdjustingID3v2Padding(false); - - if (v2JavaTagToDelete) { - // this is a workaround for a bug in JavaMusicTag: - // MP3File.save() just tries to delete an ID3v2_4 tag, - // but omits 2_3 or 2_2 tags. To be on the safe side - // we have to explicitly remove the deleted v2 tag. - var raf = new java.io.RandomAccessFile(mp3File.getMp3file(), "rw"); - v2JavaTagToDelete["delete"](raf); - v2JavaTagToDelete = null; - raf.close(); - } - - if(tagObjects[jala.Mp3.Id3v2] && tagObjects[jala.Mp3.Id3v2].getSubtype() == 2) { - app.log("Error in jala.Mp3#save: Can't save a tag of version Id3v2_2. Please remove the tag and add a new Id3v2 tag of sub type 3 or 4!"); - return false; - } - - if(outFile) { - var outFile = new helma.File(outFile); - // MP3File.save(file) only saves the tags! - // Thus, we make a hardcopy first. - file.hardCopy(outFile); - } else { - outFile = file; - } - mp3File.save(outFile, - Packages.org.farng.mp3.TagConstant.MP3_FILE_SAVE_OVERWRITE - ); - return true; - }; - - - - // flag to remember if mp3 header has been read - var mp3HeaderRead = false; - - /** - * Makes sure that the mp3 header is read only once - * This takes a few milliseconds, so we only do it when a - * function that depends on header data is called. - * @private - */ - this.readMp3Header = function() { - if (!mp3HeaderRead) { - mp3File.seekMP3Frame(); - mp3HeaderRead = true; - } - return; - }; - - - /** @type String */ - this.album; - - /** @type String */ - this.artist; - - /** @type String */ - this.comment; - - /** @type String */ - this.genre; - - /** @type String */ - this.title; - - /** @type String */ - this.trackNumber; - - /** @type String */ - this.year; - - return this; -}; - -// define getter for standard fields: -try { - jala.Mp3.prototype.__defineGetter__("album", function() { return this.getField("album"); }); - jala.Mp3.prototype.__defineGetter__("artist", function() { return this.getField("artist"); }); - jala.Mp3.prototype.__defineGetter__("comment", function() { return this.getField("comment"); }); - jala.Mp3.prototype.__defineGetter__("genre", function() { return this.getField("genre"); }); - jala.Mp3.prototype.__defineGetter__("title", function() { return this.getField("title"); }); - jala.Mp3.prototype.__defineGetter__("trackNumber", function() { return this.getField("trackNumber"); }); - jala.Mp3.prototype.__defineGetter__("year", function() { return this.getField("year"); }); -} catch (e) { - // older helma versions can't handle __defineGetter__ -} - - -/** - * Array defining valid genres in ID3v1 - * @type Array - * @final - */ -jala.Mp3.GENRES = ["Blues", "Classic Rock", "Country", "Dance", "Disco", - "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", - "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", - "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", - "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", - "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", - "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", - "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", - "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", - "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", - "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", - "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", - "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk", "Folk-Rock", - "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", - "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", - "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", - "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", "Opera", - "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", - "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", - "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", - "Acapella", "Euro-House", "Dance Hall"]; - - -/** - * Array defining mp3 modes. - * @type Array - * @final - */ -jala.Mp3.MODES = ["Stereo", "Joint stereo", "Dual channel", "Mono"]; - - -/** - * Array defining valid text encodings. Note: UTF-8 is valid for v2.4 only. - * UTF-16 with BOM doesn't work with Winamp etc - use UTF-16BE instead! - * The index position within the array defines the number used in the mp3 file. - * @type Array - * @final - */ -jala.Mp3.TEXT_ENCODINGS = ["ISO-8859-1", "UTF-16", "UTF-16BE", "UTF-8"]; - - -/** - * Array defining valid picture types. Note: Most image tagged files come with - * one picture of picture type null! - * The index position within the array defines the number used in the mp3 file. - * @type Array - * @final - */ -jala.Mp3.PICTURE_TYPES = ["Other", "32x32 pixels 'file icon' (PNG only)", - "Other file icon", "Cover (front)", "Cover (back)", "Leaflet page", - "Media (e.g. label side of CD)", "Lead artist/lead performer/soloist", - "Artist/performer", "Conductor", "Band/Orchestra", "Composer", - "Lyricist/text writer", "Recording Location", "During recording", - "During performance", "Movie/video screen capture", "A bright coloured fish", - "Illustration", "Band/artist logotype", "Publisher/Studio logotype"]; - - -/** - * Maps the name of the standard fields to frame ids in the different versions - * of ID3v2. - * @type Object - * @private - * @final - */ -jala.Mp3.FIELD_MAPPING = { - "album": ["", "", "TALB", "TALB", "TALB"], - "artist": ["", "", "TPE1", "TPE1", "TPE1"], - "comment": ["", "", "COMM", "COMM", "COMM"], - "genre": ["", "", "TCON", "TCON", "TCON"], - "title": ["", "", "TIT2", "TIT2", "TIT2"], - "subtitle": ["", "", "TIT3", "TIT3", "TIT3"], - "trackNumber": ["", "", "TRCK", "TRCK", "TRCK"], - "year": ["", "", "TYER", "TYER", "TDRC"], - "author": ["", "", "TCOM", "TCOM", "TCOM"], - "copyright": ["", "", "TCOP", "TCOP", "TCOP"], - "url": ["", "", "WXXX", "WXXX", "WXXX"], - "image": ["", "", "APIC", "APIC", "APIC"] -}; - - -/** - * Helper method to copy the standard fields from one tag - * to another - * @param {Object} src object with setter methods for fields album, artist, - * comment, title, trackNumber, genre and year. - * @param {Object} dest object with getter methods for fields album, artist, - * comment, title, trackNumber, genre and year. - * @returns changed object - * @type Object - * @private - */ -jala.Mp3.copyFields = function(src, dest) { - dest.setAlbum(src.getAlbum()); - dest.setArtist(src.getArtist()); - dest.setComment(src.getComment()); - dest.setTitle(src.getTitle()); - dest.setTrackNumber(src.getTrackNumber()); - dest.setGenre(src.getGenre()); - dest.setYear(src.getYear()); - return dest; -}; - - -/** - * Helper function to handle arguments that may either be a - * number or an object that matches a value in an array. - * In the first case the number itself is returned, in the latter - * case the index position within the array is returned. - * @param {Number|Object} arg argument as number or object - * @param {Array} values Array of objects. - * @returns The number the argument represents - * @type Number - * @private - */ -jala.Mp3.normalizeArg = function(arg, values, defaultValue) { - if (arg == null) { - return defaultValue; - } else if (!isNaN(arg)) { - return parseInt(arg); - } else { - var idx = values.indexOf(arg); - if (idx > 0) { - return idx; - } - } - return null; -}; - - -/** - * The audio length of the file in seconds at best estimate - * from the file info (method returns immediately). - * This method calculates based on the bitrate. Therefore it - * has to produce wrong results for files encoded with variable - * bitrate (vbr). For these files parseDuration() can be used. - * @returns length in seconds - * @type Number - * @see #parseDuration - */ -jala.Mp3.prototype.getDuration = function() { - var bitrate = this.getBitRate(); - if (bitrate != 0) { - return Math.round(this.getSize() / (bitrate * 1000 / 8)); - } - return 0; -}; - - -/** - * Parses the audio file to extract the precise duration of the audio. - * The upside is that it works fine for files with variable bitrates. - * The downside is that this action may take a few seconds depending on - * the size of the audio file. - * @returns length in seconds - * @type Number - * @see #getDuration - */ -jala.Mp3.prototype.parseDuration = function() { - try { - Packages.de.ueberdosis.util.OutputCtr.setLevel(0); // turn off debug output - var reader = Packages.de.ueberdosis.mp3info.ID3Reader(this.getFile().getAbsolutePath()); - var tag = reader.getExtendedID3Tag(); - return tag.getRuntime(); - } catch (e) { - throw "jala.Mp3#parseDuration requires id3-1.6.0d9.jar" - + " in lib/ext or modules/jala/lib directory " - + "[http://sourceforge.net/projects/mp3info/]"; - } -}; - - -/** - * Returns the file size in bytes. - * @type Number - */ -jala.Mp3.prototype.getSize = function() { - return this.getFile().getLength(); -}; - - -/** - * Returns the bit rate the file was encoded with. - * @type Number - */ -jala.Mp3.prototype.getBitRate = function() { - this.readMp3Header() - return this.getJavaObject().getBitRate(); -}; - - -/** - * Returns the channel mode the file was encoded with. - * @type String - */ -jala.Mp3.prototype.getChannelMode = function() { - this.readMp3Header() - return jala.Mp3.MODES[this.getJavaObject().getMode()]; -}; - - -/** - * Returns the frequency the file was encoded with. - * @type Number - */ -jala.Mp3.prototype.getFrequency = function() { - this.readMp3Header() - return this.getJavaObject().getFrequency(); -}; - - -/** - * Returns true if the file is (or seems to be) encoded with - * variable bit rate. FIXME: The current implementation returned - * true for all test files. - * @type Boolean - */ -jala.Mp3.prototype.isVariableBitRate = function() { - this.readMp3Header() - return this.getJavaObject().isVariableBitRate(); -}; - - -/** - * Returns the information for a field from the tags: At first the ID3v2 - * tag is checked. If it isn't present or doesn't contain the field, - * the ID3v1 tag is checked. - * @type {String} - * @private - */ -jala.Mp3.prototype.getField = function(fieldName) { - var funcName = "get" + fieldName.charAt(0).toUpperCase() + fieldName.substring(1); - var tag, value; - var getValue = function() { - if (tag[funcName] != null && tag[funcName] instanceof Function) { - return tag[funcName](); - } - return null; - }; - - if ((tag = this.getV2Tag()) != null && (value = getValue()) != null) { - return value; - } - if ((tag = this.getV1Tag()) != null && (value = getValue()) != null) { - return value; - } - return null; -}; - -/** - * Sets the value of the field with the given name to the value specified, - * in both ID3v1 and ID3v2 tags, but only if the appropriate setter method - * exists. - * @param {String} fieldName The name of the field to set - * @param {String} value The value of the field - * @private - */ -jala.Mp3.prototype.setField = function(fieldName, value) { - if (value != null) { - var funcName = "set" + fieldName.charAt(0).toUpperCase() + fieldName.substring(1); - var setValue = function(tag) { - if (tag[funcName] != null && tag[funcName] instanceof Function) { - tag[funcName](value); - } - return; - }; - - setValue(this.getV2Tag() || this.createV2Tag()); - setValue(this.getV1Tag() || this.createV1Tag()); - } - return; -}; - - -/** - * If the file doesn't contain an ID3v1 tag, this method - * creates a new ID3v1 tag object, attaches it to the file - * and returns it. If a second argument is provided, its - * values are copied into the new tag. - * - * @param {Object} tagObject optional tag whose standard - * properties are copied to the new tag. - * @type jala.Mp3.Id3v1 - */ -jala.Mp3.prototype.createV1Tag = function(tagObject) { - return this.createTag(jala.Mp3.Id3v1, tagObject); -}; - - -/** - * If the file doesn't contain an ID3v2 tag, this method - * creates a new ID3v2 tag object, attaches it to the file - * and returns it. If a second argument is provided, its - * values are copied into the new tag. - * - * @param {Object} tagObject optional tag whose standard - * properties are copied to the new tag. - * @type jala.Mp3.Id3v2 - */ -jala.Mp3.prototype.createV2Tag = function(tagObject) { - return this.createTag(jala.Mp3.Id3v2, tagObject); -}; - - -/** - * @type jala.Mp3.Id3v1 - */ -jala.Mp3.prototype.getV1Tag = function() { - return this.getTag(jala.Mp3.Id3v1); -}; - - -/** - * @type jala.Mp3.Id3v2 - */ -jala.Mp3.prototype.getV2Tag = function() { - return this.getTag(jala.Mp3.Id3v2); -}; - - -/** - * Returns true if the file contains a ID3v1 tag. - * @type Boolean - */ -jala.Mp3.prototype.hasV1Tag = function() { - return this.hasTag(jala.Mp3.Id3v1); -}; - - -/** - * Returns true if the file contains a ID3v2 tag. - * @type Boolean - */ -jala.Mp3.prototype.hasV2Tag = function() { - return this.hasTag(jala.Mp3.Id3v2); -}; - - -/** - * Removes the ID3v1 tag from the file. - */ -jala.Mp3.prototype.removeV1Tag = function() { - this.removeTag(jala.Mp3.Id3v1); -}; - - -/** - * Removes the ID3v2 tag from the file. - */ -jala.Mp3.prototype.removeV2Tag = function() { - return this.removeTag(jala.Mp3.Id3v2); -}; - - -/** @ignore */ -jala.Mp3.prototype.toString = function() { - return "[jala.Mp3 " + this.getFile() + "]"; -}; - -/** - * Returns a plain JavaScript object containing the values of - * all fields stored in either the Id3 V1 or V2 tag - * @returns An object containing the values of all fields - */ -jala.Mp3.prototype.getMetadata = function() { - var result = {}; - // generic metadata values - result.size = this.getSize(); - result.isVariableBitRate = this.isVariableBitRate(); - result.bitrate = this.getBitRate(); - result.frequency = this.getFrequency(); - result.channelMode = this.getChannelMode(); - result.duration = this.parseDuration(); - // Id3 tag values - var fields = [ - "title", - "subtitle", - "author", - "url", - "trackNumber", - "year", - "album", - "artist", - "comment", - "genre", - "copyright", - ]; - var fieldName; - for (var i=0; i get the correct encoding string from constant - encoding = jala.Mp3.TEXT_ENCODINGS[encoding]; - } - return new java.lang.String(new java.lang.String(str).getBytes(encoding)); -}; - - -/** - * Decodes a string using the given encoding. - * @param {String} str string to decode - * @param {String} encoding encoding to use - * @returns decoded string - * @type String - * @private - */ -jala.Mp3.Id3v2.prototype.decodeText = function(str, encoding) { - if (!isNaN(encoding)) { - // if encoding is the byte value -> get the correct encoding string from constant - encoding = jala.Mp3.TEXT_ENCODINGS[encoding] - } - var rawStr = new java.lang.String(str); - return "" + new java.lang.String(rawStr.getBytes(), encoding); -}; - - -/** - * This method can be used to retrieve an arbitrary text frame - * of the underlying tag. For the list of valid identifiers - * and their meaning see http://www.id3.org/ - * The identifiers vary across the sub versions of id3v2 tags, - * use getSubtype to make sure you use the correct version. - * @param {String} id Frame identifier according to Id3v2 specification - * or shortcut as defined in jala.Mp3.FIELD_MAPPING. - * @returns String contained in the frame - * @type String - * @see #getSubtype - */ -jala.Mp3.Id3v2.prototype.getTextContent = function(idStr) { - var id = idStr; - if (jala.Mp3.FIELD_MAPPING[idStr]) { - id = jala.Mp3.FIELD_MAPPING[idStr][this.getSubtype()]; - } - var frame = this.getJavaObject().getFrame(id); - if (frame) { - var body = frame.getBody(); - if (!(body instanceof Packages.org.farng.mp3.id3.FrameBodyUnsupported)) { - return this.decodeText(body.getText(), body.getObject("Text Encoding")); - } - } - return null; -} - - -/** - * This method can be used to set an arbitrary field - * of the underlying tag. For the list of valid identifiers - * and their meaning see http://www.id3.org/ - * The identifiers vary across the sub versions of id3v2 tags, - * use getSubtype to make sure you use the correct version. - * @param {String} id Frame identifier according to Id3v2 specification - * @param {String} value - * @type String - * @see #getSubtype - */ -jala.Mp3.Id3v2.prototype.setTextContent = function(idStr, val) { - var id = idStr; - if (jala.Mp3.FIELD_MAPPING[idStr]) { - id = jala.Mp3.FIELD_MAPPING[idStr][this.getSubtype()]; - } - var frame = this.getJavaObject().getFrame(id); - if (frame) { - var body = frame.getBody(); - // frame already exists, use its encoding: - body.setText(this.encodeText(val, body.getObject("Text Encoding"))); - } else { - // new frame is created, use our own encoding: - var body = new Packages.org.farng.mp3.id3["FrameBody" + id]( - this.getTextEncoding(), this.encodeText(val, this.getTextEncoding()) - ); - this.getJavaObject().setFrame(this.createFrameObject(body)); - } - return; -}; - - -/** - * Creates a new frame object that fits to the tag version. - * @param {org.farng.mp3.id3.AbstractID3v2FrameBody} body frame body object - * @returns new frame object - * @type org.farng.mp3.id.ID3v2_2 - * @private - */ -jala.Mp3.Id3v2.prototype.createFrameObject = function(body) { - var subtype = this.getSubtype(); - if (subtype == 2) { - return new Packages.org.farng.mp3.id3.ID3v2_2Frame(body); - } else if (subtype == 3) { - return new Packages.org.farng.mp3.id3.ID3v2_3Frame(body); - } else if (subtype == 4 || subtype == 0) { - return new Packages.org.farng.mp3.id3.ID3v2_4Frame(body); - } - return null; -}; - - -/** - * Returns the version number of this id3v2 (values 2 to 4 for id3v2.2 to id3v2.4) - * @returns The version number of this Id3v2 tag - * @type Number - */ -jala.Mp3.Id3v2.prototype.getSubtype = function() { - // AbstractID3v2#getRevision() only works for newly constructed tag objects, - // but not for tag objects that have been read from a file. - // so we make a class comparison to find out the subtype: - var obj = this.getJavaObject(); - if (obj instanceof Packages.org.farng.mp3.id3.ID3v2_4) { - return 4; - } else if (obj instanceof Packages.org.farng.mp3.id3.ID3v2_3) { - return 3; - } else if (obj instanceof Packages.org.farng.mp3.id3.ID3v2_2) { - return 2; - } - return 0; -}; - - -/** - * Returns the album information of the tag. - * @returns string containing album name - * @type String - */ -jala.Mp3.Id3v2.prototype.getAlbum = function() { - return this.getTextContent("album"); -}; - - -/** - * Returns the artist information of the tag. - * @returns string containing artist name - * @type String - */ -jala.Mp3.Id3v2.prototype.getArtist = function() { - return this.getTextContent("artist"); -}; - - -/** - * Returns the comment information of the tag. - * @returns string containing comment - * @type String - */ -jala.Mp3.Id3v2.prototype.getComment = function() { - var frame = this.getFrame("comment", "eng", ""); - if (frame) { - var str = frame.getBody().getText(); - return this.decodeText(str, frame.getBody().getObject("Text Encoding")); - } - return null; -}; - - -/** - * Returns the title information of the tag. - * @returns string containing title - * @type String - */ -jala.Mp3.Id3v2.prototype.getTitle = function() { - return this.getTextContent("title"); -}; - - -/** - * Returns the subtitle information of the tag. - * @returns string containing subtitle - * @type String - */ -jala.Mp3.Id3v2.prototype.getSubtitle = function() { - return this.getTextContent("subtitle"); -}; - - -/** - * Returns the track number information of the tag. - * @returns string representing track number - * @type String - */ -jala.Mp3.Id3v2.prototype.getTrackNumber = function() { - return this.getTextContent("trackNumber"); -}; - - -/** - * Returns the genre information of the tag. - * @returns string containing genre name - * @type String - */ -jala.Mp3.Id3v2.prototype.getGenre = function() { - return this.getTextContent("genre"); -}; - - -/** - * Returns the year information of the tag. - * @returns string representing year - * @type String - */ -jala.Mp3.Id3v2.prototype.getYear = function() { - return this.getTextContent("year"); -}; - - -/** - * Returns the author information of the tag. - * @returns string containing author information - * @type String - */ -jala.Mp3.Id3v2.prototype.getAuthor = function() { - return this.getTextContent("author"); -}; - - -/** - * Returns the copyright information of the tag. - * @returns The copyright information of the tag - * @type String - */ -jala.Mp3.Id3v2.prototype.getCopyright = function() { - return this.getTextContent("copyright"); -}; - - -/** - * Returns the Url stored in this tag - * @returns The url stored in this tag - * @type String - */ -jala.Mp3.Id3v2.prototype.getUrl = function() { - var frame = this.getFrame("url", ""); - if (frame) { - return frame.getBody().getUrlLink(); - } - return null; -}; - - -/** - * Sets the album information. - * @param {String} album - */ -jala.Mp3.Id3v2.prototype.setAlbum = function(album) { - this.setTextContent("album", album); - return; -}; - - -/** - * Sets the artist information. - * @param {String} artist - */ -jala.Mp3.Id3v2.prototype.setArtist = function(artist) { - this.setTextContent("artist", artist); - return; -}; - - -/** - * Sets the comment - * @param {String} comment - */ -jala.Mp3.Id3v2.prototype.setComment = function(comment) { - // comment (COMM) isn't a text frame. it supports the getText() - // method but its constructor has a different signature. - var frame = this.getFrame("comment", "eng", ""); - if (frame) { - frame.getBody().setText(this.encodeText(comment, frame.getBody().getObject("Text Encoding"))); - } else { - var body = new Packages.org.farng.mp3.id3.FrameBodyCOMM( - this.getTextEncoding(), "eng", "", this.encodeText(comment, this.getTextEncoding()) - ); - this.getJavaObject().setFrame(this.createFrameObject(body)); - } - return; -}; - - -/** - * Sets the title information - * @param {String} title - */ -jala.Mp3.Id3v2.prototype.setTitle = function(title) { - this.setTextContent("title", title); - return; -}; - - -/** - * Sets the subtitle information - * @param {String} title - */ -jala.Mp3.Id3v2.prototype.setSubtitle = function(title) { - this.setTextContent("subtitle", title); - return; -}; - - -/** - * Sets the track number information. - * @param {Number} trackNumber - */ -jala.Mp3.Id3v2.prototype.setTrackNumber = function(trackNumber) { - this.setTextContent("trackNumber", trackNumber); - return; -}; - - -/** - * Sets the genre information. A list of genre names that are compatible - * with ID3v1 tags is located in jala.Mp3.GENRES. - * @param {String} genre - */ -jala.Mp3.Id3v2.prototype.setGenre = function(genre) { - this.setTextContent("genre", genre); - return; -}; - - -/** - * Sets the year information. - * @param {Number} year - */ -jala.Mp3.Id3v2.prototype.setYear = function(year) { - this.setTextContent("year", year); - return; -}; - - -/** - * Sets the author information in this tag - * @param {String} author The author information to set - */ -jala.Mp3.Id3v2.prototype.setAuthor = function(author) { - this.setTextContent("author", author); - return; -}; - - -/** - * Sets the copyright information in this tag - * @param {String} copyright The copyright information to set - */ -jala.Mp3.Id3v2.prototype.setCopyright = function(copyright) { - this.setTextContent("copyright", copyright); - return; -}; - - -/** - * Stores the Url passed as argument in this tag. - * @param {String} url The url to store in this tag - * @param {String} desc An optiona description of the Url - */ -jala.Mp3.Id3v2.prototype.setUrl = function(url, desc) { - var frame = this.getFrame("url", ""); - if (frame) { - frame.getBody().setUrlLink(url); - } else { - var body = new Packages.org.farng.mp3.id3.FrameBodyWXXX( - this.getTextEncoding(), desc, url - ); - this.getJavaObject().setFrame(this.createFrameObject(body)); - } - return; -}; - - -/** - * Extracts the image from the tag - * @param {String} pictureType number describing picture type - * (default is 3, describing a front cover). - * @returns image as mime object - * @type helma.util.MimePart - */ -jala.Mp3.Id3v2.prototype.getImage = function(pictureType) { - // FIXME: maybe add description to arguments of getFrame? - // more testing needed... - pictureType = jala.Mp3.normalizeArg(pictureType, - jala.Mp3.PICTURE_TYPES, 3); - - var frame = this.getFrame("image", new java.lang.Character(pictureType)); - if (frame) { - var body = frame.getBody(); - var mimeType = body.getObject("MIME Type"); - var imageType = mimeType.substring(6); - var imageName = this.getAudio().getFile().getName().replace(/\.[^\.]+$/i, "") + "." + imageType; - return new Packages.helma.util.MimePart( - imageName, - body.getObject("Picture Data"), - mimeType - ); - } - return null; -}; - - -/** - * adds an image to the file. - * @param {Number} pictureType number determining picture type - * @param {String} mimeType mime type of image - * @param {Array} byteArray image binary data - * @param {String} desc optional description - * @see jala.Mp3 - */ -jala.Mp3.Id3v2.prototype.setImage = function(pictureType, mimeType, byteArray) { - pictureType = jala.Mp3.normalizeArg(pictureType, - jala.Mp3.PICTURE_TYPES, 3); - - var frame = this.getFrame("image", new java.lang.Character(pictureType)); - if (frame) { - if (mimeType && byteArray) { - // set new image data - frame.getBody().setObject("MIME Type", mimeType); - frame.getBody().setObject("Picture Data", byteArray); - } - } else { - // add new image to tag - var body = new Packages.org.farng.mp3.id3.FrameBodyAPIC( - this.getTextEncoding(), - mimeType, - new java.lang.Long(pictureType), - new java.lang.Character(pictureType), - byteArray - ); - this.getJavaObject().setFrame(this.createFrameObject(body)); - } - return; -}; - - -/** @ignore */ -jala.Mp3.Id3v2.prototype.debug = function() { - return "
    " + this.getJavaObject().toString() + "
    "; -}; - - -/** @ignore */ -jala.Mp3.Id3v2.toString = function() { - return "[jala.Mp3.Id3v2]"; -}; - -/** @ignore */ -jala.Mp3.Id3v2.prototype.toString = jala.Mp3.Id3v2.toString; - - -// FIXME: report bug in JavaMusicTag: -// if you delete a v2 tag and call save() JMT calls the delete method of an ID3v2_4 tag. -// this way a 2_2 or 2_3 tag in the file isn't found and not deleted. -// Mp3.save() has a workaround for this. - diff --git a/modules/jala/code/PodcastWriter.js b/modules/jala/code/PodcastWriter.js deleted file mode 100644 index ba7b173a..00000000 --- a/modules/jala/code/PodcastWriter.js +++ /dev/null @@ -1,130 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.PodcastWriter class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Jala dependencies - */ -app.addRepository(getProperty("jala.dir", "modules/jala") + - "/code/Rss20Writer.js"); - -/** - * @class Class to create, modify and render standard-compliant - * RSS 2.0 feeds including support for Apple's Podcast specification. - * @constructor - * @extends jala.Rss20Writer - * @param {String} header Optional XML header. - */ -jala.PodcastWriter = function(header) { - jala.Rss20Writer.apply(this, arguments); - - var CATEGORY = { - name: "itunes:category", - attributes: { - name: "text" - } - }; - - var OWNER = { - name: "itunes:owner", - value: [{ - name: "itunes:name" - }, { - name: "itunes:email" - }] - }; - - this.addNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd"); - - this.extendChannel([{ - name: "itunes:author" - }, { - name: "itunes:subtitle" - }, { - name: "itunes:summary" - }, { - name: "itunes:new-feed-url" - }, { - name: "itunes:image", - attributes: [{ - name: "href" - }] - }, { - name: "itunes:link", - attributes: [{ - name: "rel" - }, { - name: "type" - }, { - name: "href" - }] - }]); - - this.getChannel().setValue(this.createElement(OWNER)); - - this.extendItem([{ - name: "itunes:duration" - }, { - name: "itunes:subtitle" - }]); - - /** - * Add an iTunes Podcast category. - * @param {String} name The category's name. - * @param {String} subName The (optional) sub-category's name. - * @param {jala.XmlWriter.XmlElement} parent Optional parent - * element to add the category to. - */ - this.addItunesCategory = function(name, subName, parent) { - if (!parent) - parent = this.getChannel(); - var cat = this.createElement(CATEGORY); - cat.populate({attributes: {text: name}}); - if (subName) { - var subCat = this.createElement(CATEGORY); - subCat.populate({attributes: {text: subName}}); - cat.addValue(subCat); - } - parent.addValue(cat); - return; - }; - - return this; -}; - - -/** A typical XML header as default. - @type {String} - @final */ -jala.PodcastWriter.XMLHEADER = ''; diff --git a/modules/jala/code/RemoteContent.js b/modules/jala/code/RemoteContent.js deleted file mode 100644 index 6106413d..00000000 --- a/modules/jala/code/RemoteContent.js +++ /dev/null @@ -1,307 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * @fileoverview Fields and methods of the jala.RemoteContent class. - */ - -// HelmaLib dependencies -app.addRepository("modules/core/String.js"); -app.addRepository("modules/core/Object.js"); -app.addRepository("modules/core/Date.js"); -app.addRepository("modules/helma/Http.js"); - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - -/** - * Construct a new remote content handler. - * @class API to define, fetch and update content - * from a remote site. - * @param {String} url The URL string of the remote site. - * @param {Integer} method The method to retrieve the remote content. - * @param {File} storage The cache directory. - * @returns A new remote content handler. - * @extends helma.Http - * @constructor - */ -jala.RemoteContent = function(url, method, storage) { - if (typeof PropertyMgr == "undefined") - var PropertyMgr = {}; - - var NULLSTR = ""; - var key = url.md5(); - var fname = key + jala.RemoteContent.SUFFIX; - var cache; - method = (method != null ? method.toLowerCase() : null); - - // depending on the method argument the instance - // becomes extent of the appropriate remote client - switch (method) { - case jala.RemoteContent.XMLRPC: - break; - default: - helma.Http.call(this); - break; - } - - if (!storage) { - storage = jala.RemoteContent.CACHEDIR; - if (!storage.exists() || !storage.isDirectory()) - storage.mkdir(storage.getAbsolutePath()); - } - - var getCache = function() { - switch (storage.constructor) { - case HopObject: - cache = storage; - break; - - case PropertyMgr: - cache = storage.getAll(); - break; - - default: - var f = new File(storage, fname); - cache = f.exists() ? Xml.read(f) : new HopObject(); - } - return cache; - }; - - var setCache = function() { - cache.url = url; - cache.method = method; - if (!cache.interval) { - cache.interval = Date.ONEHOUR; - } - cache.lastUpdate = new Date(); - cache = cache.clone(new HopObject()); - - switch (storage.constructor) { - case HopObject: - for (var i in cache) - storage[i] = cache[i]; - break; - - case PropertyMgr: - storage.setAll(cache); - break; - - default: - var f = new File(storage, fname); - Xml.write(cache, f); - } - return; - }; - - cache = getCache(); - - /** - * Set the interval the remote content's - * cache is bound to be updated. - * @param {Number} interval The interval value in milliseconds. - */ - this.setInterval = function(interval) { - cache.interval = parseInt(interval, 10); - return; - }; - - /** - * Get an arbitrary property of the remote content. - * @param {String} key The name of the property. - * @returns The value of the property. - */ - this.get = function(key) { - return cache[key]; - } - - /** - * Get all available property names. - * @returns The list of property names. - * @type Array - */ - this.getKeys = function() { - var keys = []; - for (var i in cache) { - keys.push(i); - } - return keys.sort(); - }; - - /** - * Tests whether the remote content needs to be updated. - * @returns True if the remote content needs to be updated. - * @type Boolean - */ - this.needsUpdate = function() { - if (!cache.lastUpdate) { - return true; - } else { - var max = new Date() - cache.interval; - if (max - cache.lastUpdate > 0) { - return true; - } - } - return false; - }; - - /** - * Get the updated and cached remote content. - * @returns The content as retrieved from the remote site. - * @type String - */ - this.update = function() { - app.debug("[jala.RemoteContent] Retrieving " + url); - var result; - switch (method) { - case jala.RemoteContent.XMLRPC: - break; - default: - result = this.getUrl(url, cache.lastModified || cache.eTag); - if (result.code != 200 && cache.content) { - // preserve the content received before - result.content = cache.content; - } - result.interval = cache.interval; - cache = result; - } - setCache(); - return cache.content; - }; - - /** - * Flushes (empties) the cached remote content. - */ - this.clear = function() { - switch (storage.constructor) { - case HopObject: - for (var i in storage) - delete storage[i]; - break; - - case PropertyMgr: - storage.reset(); - break; - - default: - var f = new File(storage, fname); - f.remove(); - } - return; - }; - - /** - * Get a string representation of the remote content. - * @returns The remote content as string. - * @type String - */ - this.toString = function() { - return cache.content || NULLSTR; - }; - - /** - * Get the value of the remote content. - * @returns The remote content including response header data. - * @type Object - */ - this.valueOf = function() { - return cache; - }; - - return this; -}; - -/** - * A constant representing the HTTP retrieval method. - * @type int - * @final - */ -jala.RemoteContent.HTTP = 1; - -/** - * A constant representing the XML-RPC retrieval method. - * @type int - * @final - */ -jala.RemoteContent.XMLRPC = 2; - -/** - * The default name of the cache directory. - * @type String - * @final - */ -jala.RemoteContent.SUFFIX = ".cache"; - -/** - * The default cache directory. - * @type File - * @final - */ -jala.RemoteContent.CACHEDIR = new File(app.dir, jala.RemoteContent.SUFFIX); - -/** - * Remove all remote content from a file-based cache. - * @param {File} cache An optional target directory. - */ -jala.RemoteContent.flush = function(cache) { - jala.RemoteContent.forEach(function(rc) { - rc.clear(); - return; - }); - return; -}; - -/** - * Apply a custom method on all remote content in a file-based cache. - * @param {Function} callback The callback method to be executed - * for each remote content file. - * @param {File} cache An optional target directory. - */ -jala.RemoteContent.forEach = function(callback, cache) { - if (!cache) - cache = jala.RemoteContent.CACHEDIR; - var f, rc; - var files = cache.list(); - for (var i in files) { - f = new File(cache, files[i]); - if (!files[i].endsWith(jala.RemoteContent.SUFFIX)) - continue; - rc = new jala.RemoteContent(Xml.read(f).url); - if (callback && callback.constructor == Function) - callback(rc); - } - return; -}; - -/** - * Apply a custom method on all remote content in a file-based cache. - * @param {Function} callback The callback method to be executed - * for each remote content file. - * @param {File} cache An optional target directory. - * @deprecated Use {@link #forEach} instead. - */ -jala.RemoteContent.exec = function() { - jala.RemoteContent.forEach.apply(this, arguments); -}; diff --git a/modules/jala/code/Rss20Writer.js b/modules/jala/code/Rss20Writer.js deleted file mode 100644 index 6edc0137..00000000 --- a/modules/jala/code/Rss20Writer.js +++ /dev/null @@ -1,334 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.Rss20Writer class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * Jala dependencies - */ -app.addRepository(getProperty("jala.dir", "modules/jala") + - "/code/XmlWriter.js"); - -/** - * @class Class to create, modify and render standard-compliant - * RSS 2.0 feeds. - * @constructor - * @extends jala.XmlWriter - * @param {String} header Optional XML header. - */ -jala.Rss20Writer = function(header) { - // defines the prototype of this constructor - jala.XmlWriter.apply(this, arguments); - - // this should do the same but alas, helma throws - // an error the very first time it is executed: - //arguments.callee.prototype = new jala.XmlWriterInterface(); - - var DATEFMT = "EEE, dd MMM yyyy HH:mm:ss Z"; - - var CATEGORY = { - name: "category", - amount: Infinity, - attributes: { - name: "domain", - } - }; - - var ITEM = { - name: "item", - amount: Infinity, - value: [{ - name: "title", - required: true - }, { - name: "link", - }, { - name: "description", - }, { - name: "author", - }, { - name: "comments", - }, { - name: "enclosure", - attributes: [{ - name: "url", - required: true - }, { - name: "length", - required: true - }, { - name: "type", - required: true - }] - }, { - name: "guid", - attributes: [{ - name: "isPermaLink", - type: Boolean - }] - }, { - name: "pubDate", - type: Date, - format: DATEFMT - }, { - name: "source", - attributes: [{ - name: "url", - required: true - }] - }] - }; - - var CHANNEL = { - name: "channel", - value: [{ - name: "title", - required: true - }, { - name: "link", - required: true - }, { - name: "description", - required: true - }, { - name: "language", - }, { - name: "copyright", - }, { - name: "managingEditor", - }, { - name: "webMaster", - }, { - name: "pubDate", - type: Date, - format: DATEFMT - }, { - name: "lastBuildDate", - type: Date, - format: DATEFMT - }, { - name: "generator", - }, { - name: "docs", - }, { - name: "cloud", - attributes: [{ - name: "domain", - }, { - name: "port", - type: Number, - format: "#" - }, { - name: "path", - }, { - name: "registerProcedure", - }, { - name: "protocol", - }] - }, { - name: "ttl", - type: Number, - format: "#" - }, { - name: "rating", - }, { - name: "skipHours", - }, { - name: "skipDays", - }] - }; - - var IMAGE = { - name: "image", - value: [{ - name: "url", - required: true - }, { - name: "title", - required: true - }, { - name: "link", - required: true - }, { - name: "width", - type: Number, - format: "#" - }, { - name: "height", - type: Number, - format: "#" - }, { - name: "description", - }] - }; - - var TEXTINPUT = { - name: "textinput", - value: [{ - name: "title", - required: true - }, { - name: "description", - required: true - }, { - name: "name", - required: true - }, { - name: "link", - required: true - }] - }; - - var ROOT = { - name: "rss", - attributes: [{ - name: "version", - value: "2.0" - }] - }; - - var xmlroot = this.createElement(ROOT); - var channel = this.createElement(CHANNEL); - xmlroot.setValue(channel); - - /** - * Get the writer's root element. - * @returns The writer's root element. - * @type jala.XmlWriter.XmlElement - */ - this.getRoot = function() { - return xmlroot; - }; - - /** - * Add child elements to the channel template. - * @param {Array} ext List of additional child elements. - */ - this.extendChannel = function(ext) { - this.extend(CHANNEL, ext); - channel = this.createElement(CHANNEL); - xmlroot.setValue(channel); - return; - }; - - /** - * Get the writer's channel element. - * @returns The writer's channel element. - * @type jala.XmlWriter.XmlElement - */ - this.getChannel = function() { - return channel; - }; - - /** - * Populate the channel element with data. - * @param {Object} data An XmlWriter-compliant object structure. - * @returns The populated channel element. - * @type jala.XmlWriter.XmlElement - */ - this.setChannel = function(data) { - return channel.populate(data); - }; - - /** - * Add child elements to the item template. - * @param {Array} ext List of additional child elements. - */ - this.extendItem = function(ext) { - this.extend(ITEM, ext); - return; - }; - - /** - * Get a new and innocent item element. - * @param {Object} data An XmlWriter-compliant object structure. - * @returns A new and innocent item element. - * @type jala.XmlWriter.XmlElement - */ - this.createItem = function(data) { - var item = this.createElement(ITEM); - item.populate(data); - return item; - }; - - /** - * Add an item element to the channel element. - * @param {jala.XmlWriter.XmlElement} item The item element to add. - */ - this.addItem = function(item) { - channel.addValue(item); - return; - }; - - /** - * Add a category element to an arbitrary element. - * @param {String} name The name of the category. - * @param {String} domain The domain of the category. - * @param {jala.XmlWriter.XmlElement} parent The optional parent element. - */ - this.addCategory = function(name, domain, parent) { - if (!parent) - parent = channel; - var cat = this.createElement(CATEGORY); - cat.populate({ - value: name, - attributes: {domain: domain} - }); - parent.addValue(cat); - return; - }; - - /** - * Populate the image element with data. - * @param {Object} data An XmlWriter-compliant object structure. - */ - this.setImage = function(data) { - var image = this.createElement(IMAGE); - image.populate(data); - channel.setValue(image); - return; - }; - - /** - * Populate the textInput element with data. - * @param {Object} data An XmlWriter-compliant object structure. - */ - this.setTextInput = function(data) { - var textInput = this.createElement(TEXTINPUT); - textInput.populate(data); - channel.setValue(textInput); - return; - }; - - return this; -}; diff --git a/modules/jala/code/Utilities.js b/modules/jala/code/Utilities.js deleted file mode 100644 index cd6bd706..00000000 --- a/modules/jala/code/Utilities.js +++ /dev/null @@ -1,246 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * @fileoverview Fields and methods of the jala.Utilities class. - */ - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - -/** - * HelmaLib dependencies - */ -app.addRepository("modules/core/Number.js"); - -/** - * Construct a utility object. - * @class This class contains various convenience methods - * which do not fit in any other class. - * @returns A new utitilty object. - * @constructor - */ -jala.Utilities = function() { - return this; -}; - -/** - * Return a string representation of the utitility class. - * @returns [jala.Utilities] - * @type String - */ -jala.Utilities.toString = function() { - return "[jala.Utilities]"; -}; - -/** - * Return a string representation of the utitility object. - * @returns [jala.Utilities Object] - * @type String - */ -jala.Utilities.prototype.toString = function() { - return "[jala.Utilities Object]"; -}; - -/** - * Default utility class instance. - * @type jala.Utilities - * @final - */ -jala.util = new jala.Utilities(); - -/** - * Creates a random password with different levels of security. - * @param {Number} len The length of the password (default: 8) - * @param {Number} level The security level - *
      - *
    • 0 - containing only vowels or consonants (default)
    • - *
    • 1 - throws in a number at random position
    • - *
    • 2 - throws in a number and a special character at random position
    • - *
    - * @returns The resulting password - * @type String - */ -jala.Utilities.prototype.createPassword = function(len, level) { - len = len || 8; - level = level || 0; - - var LETTERSONLY = 0; - var WITHNUMBERS = 1; - var WITHSPECIALS = 2; - - var vowels = ['a', 'e', 'i', 'o', 'u']; - var consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']; - var specials = ['.', '#', '!', '$', '%', '&', '?']; - - var posNum = level > LETTERSONLY ? Math.floor(Math.random() * (len - 2)) : -1; - var posSpecial = level > WITHNUMBERS ? Math.floor(Math.random() * (len - 3)) : -2; - if (posNum == posSpecial) { - posSpecial += 1; - } - - res.push(); - // loop to create characters: - var i, rnd; - for (i=0; i<(len-level); i+=1) { - if(i % 2 == 0) { - // every 2nd one is a vowel - rnd = Math.floor(Math.random() * vowels.length); - res.write(vowels[rnd]); - } else { - // every 2nd one is a consonant - rnd = Math.floor(Math.random() * consonants.length); - res.write(consonants[rnd]); - } - if (i == posNum) { - // increased password security: - // throw in a number at random - rnd = Math.floor(Math.random() * specials.length); - res.write(String(rnd + 1)); - } - if (i == posSpecial) { - // increased password security: - // throw in a number at random - rnd = Math.floor(Math.random() * specials.length); - res.write(specials[rnd]); - } - } - return res.pop(); -}; - -/** - * Static field indicating a removed object property. - * @type Number - * @final - */ -jala.Utilities.VALUE_REMOVED = -1; - -/** - * Static field indicating ad added object property. - * @type Number - * @final - */ -jala.Utilities.VALUE_ADDED = 1; - -/** - * Static field indicating a modified object property. - * @type Number - * @final - */ -jala.Utilities.VALUE_MODIFIED = 2; - -/** - * Returns an array containing the properties that are - * added, removed or modified in one object compared to another. - * @param {Object} obj1 The first of two objects which should be compared - * @param {Object} obj2 The second of two objects which should be compared - * @returns An Object containing all properties that are added, removed - * or modified in the second object compared to the first. - * Each property contains a status field with an integer value - * which can be checked against the static jala.Utility fields - * VALUE_ADDED, VALUE_MODIFIED and VALUE_REMOVED. - * @type Object - */ -jala.Utilities.prototype.diffObjects = function(obj1, obj2) { - var childDiff, value1, value2; - var diff = {}; - var foundDiff = false; - - for (var propName in obj1) { - if (obj2[propName] === undefined || obj2[propName] === "" || obj2[propName] === null) { - diff[propName] = {status: jala.Utilities.VALUE_REMOVED}; - foundDiff = true; - } - } - for (var propName in obj2) { - value1 = obj1[propName]; - value2 = obj2[propName]; - if (value1 == null) { - diff[propName] = {status: jala.Utilities.VALUE_ADDED, - value: value2}; - foundDiff = true; - } else { - switch (value2.constructor) { - case HopObject: - case Object: - if (childDiff = this.diffObjects(value1, value2)) { - diff[propName] = childDiff; - foundDiff = true; - } - break; - default: - if (value2 != null && value2 !== "") { - if (value1 === null || value1 === undefined || value1 === "") { - diff[propName] = {status: jala.Utilities.VALUE_ADDED, - value: value2}; - foundDiff = true; - } else if (value1 != value2) { - diff[propName] = {status: jala.Utilities.VALUE_MODIFIED, - value: value2}; - foundDiff = true; - } - } - break; - } - } - } - return foundDiff ? diff : null; -}; - -/** - * Patches an object with a "diff" object created by the - * {@link #diffObjects} method. - * Please mind that this method is recursive, it descends - * along the "diff" object structure. - * @param {Object} obj The Object the diff should be applied to - * @param {Object} diff A "diff" object created by the {@link #diffObjects} method - * @returns The patched Object with all differences applied - * @type Object - */ -jala.Utilities.prototype.patchObject = function(obj, diff) { - var propDiff, value1; - for (var propName in diff) { - propDiff = diff[propName]; - value1 = obj[propName]; - if (propDiff.status != null) { - switch (propDiff.status) { - case jala.Utilities.VALUE_REMOVED: - // app.debug("applyDiff(): removing property " + propName); - delete obj[propName]; - break; - case jala.Utilities.VALUE_ADDED: - case jala.Utilities.VALUE_MODIFIED: - default: - // app.debug("applyDiff(): changing property " + propName + " to " + propDiff.value); - obj[propName] = propDiff.value; - break; - } - } else { - // app.debug("applyDiff(): descending to child object " + propName); - this.patchObject(value1, propDiff); - } - } - return obj; -}; diff --git a/modules/jala/code/XmlRpcRequest.js b/modules/jala/code/XmlRpcRequest.js deleted file mode 100644 index df55778a..00000000 --- a/modules/jala/code/XmlRpcRequest.js +++ /dev/null @@ -1,461 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.XmlRpcRequest class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - - -/** - * A constructor for XmlRpc request objects - * @class Instances of this class provide the necessary functionality - * for issueing XmlRpc requests to a remote service. - * @param {String} url The url of the XmlRpc entry point - * @param {String} methodName The name of the method to call - * @returns A newly created jala.XmlRpcRequest instance - * @constructor - */ -jala.XmlRpcRequest = function(url, methodName) { - /** @ignore */ - var proxy = null; - /** @ignore */ - var timeout = { - "connect": 0, - "socket": 0 - }; - /** @ignore */ - var debug = false; - /** @ignore */ - var credentials = null; - // default input and output encoding - /** @ignore */ - var inputEncoding = "UTF-8"; - /** @ignore */ - var outputEncoding = "UTF-8"; - - /** - * Returns the URL of this request - * @returns The URL of this request - * @type java.net.URL - */ - this.getUrl = function() { - return new java.net.URL(url); - }; - - /** - * Sets the proxy host and port. For Java runtimes < 1.5 this method - * sets the appropriate system properties (so this has an effect on - * all requests based on java.net.URL), for all others the proxy - * is only set for this request. - * @param {String} proxyString The proxy string in the form 'fqdn:port' - * (eg. my.proxy.com:3128) - */ - this.setProxy = function(proxyString) { - if (proxyString && proxyString.trim()) { - var idx = proxyString.indexOf(":"); - if (idx > 0) { - var host = proxyString.substring(0, idx); - var port = proxyString.substring(idx+1); - if (host != null && port != null) { - if (java.lang.Class.forName("java.net.Proxy") != null) { - // construct a proxy instance - var socket = new java.net.InetSocketAddress(host, port); - proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, socket); - } else { - // the pre jdk1.5 way: set the system properties - var sys = java.lang.System.getProperties(); - if (host) { - app.log("[Jala XmlRpc Client] WARNING: setting system http proxy to " - + host + ":" + port); - sys.put("http.proxySet", "true"); - sys.put("http.proxyHost", host); - sys.put("http.proxyPort", port); - } - } - } - } - } - return; - }; - - /** - * Returns the proxy object. This method will only return - * a value if using a java runtime > 1.5 - * @returns The proxy to use for this request - * @type java.net.Proxy - * @see #setProxy - */ - this.getProxy = function() { - return proxy; - }; - - /** - * Sets the credentials for basic http authentication to - * use with this request. - * @param {String} username The username - * @param {String} password The password - */ - this.setCredentials = function(username, password) { - var str = username + ":" + password; - credentials = str.enbase64(); - return; - }; - - /** - * Returns the credentials of this request - * @returns The base46 encoded credentials of this request - * @type String - */ - this.getCredentials = function() { - return credentials; - }; - - /** - * Sets the connection timeout to the specified milliseconds. - * @param {Number} millis The timeout to use as connection timeout - */ - this.setTimeout = function(millis) { - timeout.connect = millis; - return; - }; - - /** - * Sets the socket timeout to the specified milliseconds. - * @param {Number} millis The timeout to use as socket timeout - */ - this.setReadTimeout = function(millis) { - timeout.socket = millis; - return; - }; - - /** - * Returns the connection timeout of this request - * @returns The connection timeout value in milliseconds - * @type Number - */ - this.getTimeout = function() { - return timeout.connect; - }; - - /** - * Returns the socket timeout of this request - * @returns The socket timeout value in milliseconds - * @type Number - */ - this.getReadTimeout = function() { - return timeout.socket; - }; - - /** - * Returns the name of the remote function to call - * @returns The name of the remote function - * @type String - */ - this.getMethodName = function() { - return methodName; - }; - - /** - * Sets both input and output encoding to the - * specified encoding string - * @param {String} enc The encoding to use for - * both input and output. This must be a valid - * java encoding string. - */ - this.setEncoding = function(enc) { - inputEncoding = enc; - outputEncoding = enc; - return; - }; - - /** - * Sets the input encoding to the specified encoding string - * @param {String} enc The encoding to use for input. This must be a valid - * java encoding string. - */ - this.setInputEncoding = function(enc) { - inputEncoding = enc; - return; - }; - - /** - * Sets the output encoding to the specified encoding string - * @param {String} enc The encoding to use for output. This must be a valid - * java encoding string. - */ - this.setOutputEncoding = function(enc) { - outputEncoding = enc; - return; - }; - - /** - * Returns the input encoding - * @returns The input encoding used by this request - * @type String - */ - this.getInputEncoding = function() { - return inputEncoding; - }; - - /** - * Returns the output encoding - * @returns The output encoding used by this request - * @type String - */ - this.getOutputEncoding = function() { - return outputEncoding; - }; - - /** - * Enables or disables the debug mode. If enabled the xml source - * of both request and response is included in the result properties - * 'requestXml' and 'responseXml' - * @param {Boolean} flag True or false. - */ - this.setDebug = function(flag) { - debug = flag; - return; - }; - - /** - * Returns true if debug is enabled for this request, false otherwise - * @returns True if debugging is enabled, false otherwise - * @type Boolean - */ - this.debug = function() { - return debug == true; - }; - - return this; -}; - -/** @ignore */ -jala.XmlRpcRequest.prototype.toString = function() { - return "[Jala XmlRpc Request]"; -}; - -/** - * Calling this method executes the remote method using - * the arguments specified. - * @returns The result of this XmlRpc request - * @type Object - */ -jala.XmlRpcRequest.prototype.execute = function(/** [arg1][, arg2][, ...] */) { - // if in debug mode, log the time the request took to event log - if (app.__app__.debug() == true) { - var start = new Date(); - } - - var tz = java.util.TimeZone.getDefault(); - var reqProcessor = new Packages.org.apache.xmlrpc.XmlRpcClientRequestProcessor(tz); - var resProcessor = new Packages.org.apache.xmlrpc.XmlRpcClientResponseProcessor(tz); - // create the result object - var result = { - error: null, - result: null, - requestXml: null, - responseXml: null - }; - - // convert arguments into their appropriate java representations - var params = new java.util.Vector(); - for (var i=0;i= 1.5) { - conn.setConnectTimeout(this.getTimeout()); - conn.setReadTimeout(this.getReadTimeout()); - } else { - app.logger.debug("WARNING: timeouts can only be using a Java runtime >= 1.5"); - } - // set authentication credentials if defined - if (this.getCredentials() != null) { - conn.setRequestProperty("Authorization", "Basic " + this.getCredentials()); - } - - try { - conn.setDoOutput(true); - var outStream = conn.getOutputStream(); - outStream["write(byte[])"](requestBytes); - outStream.flush(); - outStream.close(); - - if (conn.getContentLength() > 0) { - var inStream = conn.getInputStream(); - if (this.debug() == true) { - inStream = new java.io.BufferedInputStream(conn.getInputStream()); - var outStream = new java.io.ByteArrayOutputStream(); - var buf = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024); - var bytes; - while ((bytes = inStream.read(buf)) > -1) { - outStream.write(buf, 0, bytes); - } - result.responseXml = outStream.toString(this.getInputEncoding()); - inStream.close(); - // change the inStream and don't set the input encoding of - // the response processor, since the conversion already happened above - inStream = new java.io.ByteArrayInputStream(outStream.toByteArray()); - } - resProcessor.setInputEncoding(this.getInputEncoding()); - var parsedResult = resProcessor.decodeResponse(inStream); - if (parsedResult instanceof java.lang.Exception) { - result.error = parsedResult; - } else { - result.result = jala.XmlRpcRequest.convertResult(parsedResult); - } - } - } catch (e) { - result.error = "[Jala XmlRpc Request] Error executing " + this.getMethodName() - + " with arguments " + jala.XmlRpcRequest.argumentsToString(arguments) - + ", the error is: " + e.toString(); - } - if (app.__app__.debug() == true) { - app.logger.debug("[Jala XmlRpc Request] (" + ((new Date()) - start) + " ms): executed '" - + this.getMethodName() + "' with arguments: " - + jala.XmlRpcRequest.argumentsToString(arguments)); - } - return result; -}; - -/** - * Helper method for converting a Javascript object into - * its appropriate Java object. - * @param {Object} obj The Javascript object to convert - * @returns The appropriate Java representation of the object - * @type java.lang.Object - */ -jala.XmlRpcRequest.convertArgument = function(obj) { - var result; - if (obj instanceof Array) { - // convert into Vector - result = new java.util.Vector(obj.length); - for (var i=0;i 0) { - result = new java.lang.Double(obj); - } else { - result = new java.lang.Integer(obj); - } - } else if (obj instanceof Object) { - // convert into Hashtable - result = new java.util.Hashtable(); - for (var key in obj) { - if (obj[key] != null) { - result.put(key, jala.XmlRpcRequest.convertArgument(obj[key])); - } - } - } else { - result = obj; - } - return result; -}; - -/** - * Converts a Java object into its appropriate Javascript representation. - * @param {java.lang.Object} obj The Java object to convert - * @returns The appropriate Javascript representation of the Java object - * @type Object - */ -jala.XmlRpcRequest.convertResult = function(obj) { - var result; - if (obj instanceof java.util.Vector) { - // convert into Array - result = []; - var e = obj.elements(); - while (e.hasMoreElements()) { - result.push(jala.XmlRpcRequest.convertResult(e.nextElement())); - } - } else if (obj instanceof java.util.Hashtable) { - // convert into Object - result = {}; - var e = obj.keys(); - var key; - while (e.hasMoreElements()) { - key = e.nextElement(); - result[key] = jala.XmlRpcRequest.convertResult(obj.get(key)); - } - } else if (obj instanceof java.lang.String) { - result = String(obj); - } else if (obj instanceof java.lang.Number) { - result = Number(obj); - } else if (obj instanceof java.lang.Boolean) { - result = Boolean(obj); - } else if (obj instanceof java.lang.Date) { - result = new Date(obj.getTime()); - } else { - result = obj; - } - return result; -}; - -/** - * Helper method to format an arguments array into - * a string useable for debugging output. - * @param {Object} args An arguments array - * @returns The arguments array formatted as string - * @type String - */ -jala.XmlRpcRequest.argumentsToString = function(args) { - var arr = []; - for (var i=0;i'; - var LOCALE = java.util.Locale.ENGLISH; - - var write = function(str) { - return res.write(str); - }; - - var writeln = function(str) { - res.write(str); - res.write("\n"); - return; - }; - - var getString = function(data, format) { - if (data == null) - return; - switch (data.constructor) { - case String: - return encodeXml(data); - case Number: - case Date: - if (format && data.format) - return encodeXml(data.format(format, LOCALE)); - else if (data.toUTCString) - return encodeXml(data.toUTCString()); - else - return encodeXml(data.toString()); - break; - case Object: - return null; - } - return encodeXml(data.toString()); - }; - - /** @ignore */ - var XmlElement = function(data) { - if (!data) - throw Error("Insufficient arguments to create XmlElement"); - - var children = {}; - var properties = [ - "name", - "attributes", - "type", - "required", - "format", - "readonly" - ]; - - if (data.value) { - if (data.value.constructor == Object) { - this.value = [new XmlElement(data.value)]; - } else if (data.value.constructor == Array) { - this.value = []; - for (var i in data.value) { - this.value[i] = new XmlElement(data.value[i]); - } - } else - throw Error("Cannot handle unknown type of template value"); - } - - for (var i in properties) { - var key = properties[i]; - this[key] = data[key] || null; - } - - if (this.attributes) { - this.attributes = self.clone(this.attributes); - if (this.attributes.constructor == Object) - this.attributes = [this.attributes]; - } else { - this.attributes = []; - } - - return this; - }; - - /** @ignore */ - XmlElement.toString = function() { - return "[XmlElement constructor]"; - }; - - /** @ignore */ - XmlElement.prototype.setValue = function(element) { - if (element.constructor != this.constructor) - throw Error("Invalid type for XmlElement addition"); - if (!this.value) - this.value = []; - else { - var pos = this.contains(element); - if (pos > -1) - this.value.splice(pos, 1); - } - this.addValue(element); - return this; - }; - - /** @ignore */ - XmlElement.prototype.addValue = function(element) { - if (element.constructor != this.constructor) - throw Error("Invalid type for XmlElement addition"); - if (!this.value) - this.value = []; - this.value.push(element); - return this; - }; - - /** @ignore */ - XmlElement.prototype.contains = function(element) { - if (!this.value || !element) - return -1; - for (var i in this.value) { - if (this.value[i].name == element.name) - return i; - } - return -1; - }; - - /** @ignore */ - XmlElement.prototype.populate = function(data) { - if (this.attributes) { - var value; - for (var i in this.attributes) { - var attr = this.attributes[i]; - if (!attr.name) - throw Error("Cannot populate unnamed attribute entry"); - if (data && data.attributes) - value = data.attributes[attr.name]; - if (data && (data.value || data.attributes) && !value && attr.required) { - throw Error('Missing required ' + (attr.type || Object).name + ' attribute "' + - attr.name + '" in element <' + this.name + '> (' + value + ")"); - } - if (value && attr.type && attr.type != value.constructor) { - throw Error('Type mismatch in attribute "' + - this.name + ":" + attr.name + '"'); - } - if (value) { - app.debug("populating attribute " + attr.name + - " with " + value.constructor.name + ": " + value.toSource()); - } - if (!attr.readonly) { - attr.value = getString(value, attr.format) || attr.value ; - } - } - } - - if (data && data.value) // && data.value.constructor == Object) - data = data.value; - - if (this.value && data) { - for (var i in this.value) { - var element = this.value[i]; - element.populate(data[element.name]); - } - } else { - if (!data && this.required) - throw Error('Missing required element "' + this.name + '"'); - if (data && this.type && this.type != data.constructor) { - throw Error('Type mismatch in element "' + this.name + '"'); - } - if (data) { - app.debug("populating element <" + this.name + "> with " + - (this.type || Object).name + ": " + data.toSource()); - } - if (!this.readonly) - this.value = getString(data, this.format) || this.value; - } - - return; - }; - - /** @ignore */ - XmlElement.prototype.write = function(path) { - if (!path) - path = ""; - - if (!this.value && !this.attributes) - return; - - var attrBuffer = new java.lang.StringBuffer(); - if (this.attributes) { - for (var a in this.attributes) { - var attr = this.attributes[a]; - if (attr.value) { - attrBuffer.append(" " + attr.name + '="'); - attrBuffer.append(attr.value); - attrBuffer.append('"'); - } - } - } - - var attrSize = attrBuffer.length(); - if (!this.value && attrSize < 1) - return; - - write("<" + this.name); - if (attrSize > 0) { - display = true; - write(attrBuffer.toString()); - } - if (this.value) { - write(">"); - if (this.value && this.value.constructor == Array) { - for (var i in this.value) - this.value[i].write(path+"/"+this.name); - } else - write(this.value); - write("\n"); - } else - write("/>\n"); - return; - }; - - /** @ignore */ - XmlElement.prototype.toString = function() { - return "[XmlElement: " + this.toSource() + "]"; - }; - - /** - * Get a newly created XML element. - * @param {Object} data The XML data as object tree. - * @returns The resulting XML element. - * @type jala.XmlWriter.XmlElement - */ - this.createElement = function(data) { - return new XmlElement(data); - }; - - /** - * Get the root XML element of this writer. - * @returns The root XML element. - * @type jala.XmlWriter.XmlElement - */ - this.getRoot = function() { - return new XmlElement({}); - }; - - /** - * Extend a template object. - * @param {Object} template The template object. - * @param {Object} ext The extension object. - * @returns The XML writer. - * @type jala.XmlWriter - */ - this.extend = function(template, ext) { - if (ext.constructor == Object) - ext = [ext]; - if (ext.constructor == Array) { - for (var i in ext) - template.value.push(ext[i]); - } - return this; - }; - - /** - * Add a namespace to this writer. - * @param {String} name The name of the namespace. - * @param {String} url The URL string of the namespace. - * @returns The XML root element. - * @type jala.XmlWriter.XmlElement - */ - this.addNamespace = function(name, url) { - var ref = this.getRoot(); - ref.attributes.push({ - name: "xmlns:" + name, - value: url - }); - return ref; - }; - - /** - * Write the XML to the response buffer. - */ - this.write = function() { - res.contentType = "text/xml"; - writeln(XMLHEADER); - this.getRoot().write(); - return; - }; - - /** - * Get the XML output as string. - * @returns The XML output. - * @type String - */ - this.toString = function() { - res.push(); - this.write(); - return res.pop(); - }; - - /** - * Clone this XML writer. - * @param {Object} The clone templare. - * @returns The cloned XML writer. - * @type jala.XmlWriter - */ - this.clone = function(obj) { - if (!obj || typeof obj != "object") - return obj; - var copy = new obj.constructor; - for (var i in obj) { - if (obj[i].constructor == Object || - obj[i].constructor == Array) - copy[i]= this.clone(obj[i]); - else - copy[i] = obj[i]; - } - return copy; - }; - - return this; -}; - diff --git a/modules/jala/code/all.js b/modules/jala/code/all.js deleted file mode 100644 index 049f528d..00000000 --- a/modules/jala/code/all.js +++ /dev/null @@ -1,75 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Wrapper for automatic inclusion of all Jala modules. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - /** @namespace jala */ - global.jala = {}; -} - - -(function() { - var packages = [ - "AsyncRequest", - "BitTorrent", - "Date", - "DnsClient", - "Captcha", - "Form", - "History", - "HtmlDocument", - "HopObject", - "I18n", - "ImageFilter", - "IndexManager", - "ListRenderer", - "Mp3", - "PodcastWriter", - "RemoteContent", - "Rss20Writer", - "Utilities", - "XmlRpcRequest", - "XmlWriter" - ]; - var jalaDir = getProperty("jala.dir", "modules/jala"); - for (var i in packages) { - app.addRepository(jalaDir + "/code/" + packages[i] + ".js"); - } - return; -})(); - - -/** - * Get a string representation of the Jala library. - * @returns [Jala JavaScript Application Library] - * @type String - */ -jala.toString = function() { - return "[Jala JavaScript Application Library]"; -}; diff --git a/modules/jala/docs/Global.html b/modules/jala/docs/Global.html deleted file mode 100644 index bc9833cc..00000000 --- a/modules/jala/docs/Global.html +++ /dev/null @@ -1,692 +0,0 @@ - - - - - -Global - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class Global

    -
    Object
    -   |
    -   +--Global
    -
    - - -
    -
    - -
    class - Global - - -
    - -
    - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - - <static> Boolean - - - - - isArray(<Object> val) - -
    -            - Returns true if the value passed as argument is an array. -
    - - <static> Boolean - - - - - isBoolean(<Object> val) - -
    -            - Returns true if the value passed as argument is either a boolean - literal or an instance of Boolean. -
    - - <static> Boolean - - - - - isDate(<Object> val) - -
    -            - Returns true if the value passed as argument is either a Javascript date - or an instance of java.util.Date. -
    - - <static> Boolean - - - - - isFunction(<Object> val) - -
    -            - Returns true if the value passed as argument is a function. -
    - - <static> Boolean - - - - - isNull(<Object> val) - -
    -            - Returns true if the value passed as argument is null. -
    - - <static> Boolean - - - - - isNumber(<Object> val) - -
    -            - Returns true if the value passed as argument is either a number, - an instance of Number or of java.lang.Number. -
    - - <static> Boolean - - - - - isObject(<Object> val) - -
    -            - Returns true if the value passed as argument is either a Javascript - object or an instance of java.lang.Object. -
    - - <static> Boolean - - - - - isString(<Object> val) - -
    -            - Returns true if the value passed as argument is either a string literal, - an instance of String or of java.lang.String. -
    - - <static> Boolean - - - - - isUndefined(<Object> val) - -
    -            - Returns true if the value passed as argument is undefined. -
    - - - -

    - - - - - - - - - - - - - - - - - -


    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    isArray

    -
    <static> Boolean isArray(<Object> val)
    - -
      Returns true if the value passed as argument is an array.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is an array, false otherwise -
      -
    - - - - - -
    - - -

    isBoolean

    -
    <static> Boolean isBoolean(<Object> val)
    - -
      Returns true if the value passed as argument is either a boolean - literal or an instance of Boolean.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is a boolean, false otherwise -
      -
    - - - - - -
    - - -

    isDate

    -
    <static> Boolean isDate(<Object> val)
    - -
      Returns true if the value passed as argument is either a Javascript date - or an instance of java.util.Date.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is a date, false otherwise -
      -
    - - - - - -
    - - -

    isFunction

    -
    <static> Boolean isFunction(<Object> val)
    - -
      Returns true if the value passed as argument is a function.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the argument is a function, false otherwise -
      -
    - - - - - -
    - - -

    isNull

    -
    <static> Boolean isNull(<Object> val)
    - -
      Returns true if the value passed as argument is null.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is null, false otherwise -
      -
    - - - - - -
    - - -

    isNumber

    -
    <static> Boolean isNumber(<Object> val)
    - -
      Returns true if the value passed as argument is either a number, - an instance of Number or of java.lang.Number.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is a number, false otherwise -
      -
    - - - - - -
    - - -

    isObject

    -
    <static> Boolean isObject(<Object> val)
    - -
      Returns true if the value passed as argument is either a Javascript - object or an instance of java.lang.Object.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is an object, false otherwise -
      -
    - - - - - -
    - - -

    isString

    -
    <static> Boolean isString(<Object> val)
    - -
      Returns true if the value passed as argument is either a string literal, - an instance of String or of java.lang.String.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is a string, false otherwise -
      -
    - - - - - -
    - - -

    isUndefined

    -
    <static> Boolean isUndefined(<Object> val)
    - -
      Returns true if the value passed as argument is undefined.
    - - - - -
      - Parameters: - -
        val - The value to test -
      - -
    - - - - -
      - Returns: -
        - True if the value is undefined, false otherwise -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/HopObject.html b/modules/jala/docs/HopObject.html deleted file mode 100644 index 96486a2f..00000000 --- a/modules/jala/docs/HopObject.html +++ /dev/null @@ -1,581 +0,0 @@ - - - - - -HopObject - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class HopObject

    -
    Object
    -   |
    -   +--HopObject
    -
    - - -
    -
    - -
    class - HopObject - - -
    - -
    - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - getAccessName(<Object> obj, <Number> maxLength) - -
    -            - Constructs a name from an object which - is unique in the underlying HopObject collection. -
    - -  Boolean - - - - - isClean() - -
    -            - Returns true if the internal state of this HopObject is CLEAN. -
    - -  Boolean - - - - - isDeleted() - -
    -            - Returns true if the internal state of this HopObject is DELETED. -
    - -  Boolean - - - - - isInvalid() - -
    -            - Returns true if the internal state of this HopObject is INVALID. -
    - -  Boolean - - - - - isModified() - -
    -            - Returns true if the internal state of this HopObject is MODIFIED. -
    - -  Boolean - - - - - isNew() - -
    -            - Returns true if the internal state of this HopObject is NEW. -
    - -  Boolean - - - - - isTransient() - -
    -            - Returns true if the internal state of this HopObject is TRANSIENT. -
    - -  Boolean - - - - - isVirtual() - -
    -            - Returns true if the internal state of this HopObject is VIRTUAL. -
    - - - -

    - - - - - - - - - - - - - - - - - -


    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getAccessName

    -
    String getAccessName(<Object> obj, <Number> maxLength)
    - -
      Constructs a name from an object which - is unique in the underlying HopObject collection.
    - - - - -
      - Parameters: - -
        obj - The object representing or containing the alias name. Possible object types include:
        • File
        • helma.File
        • java.io.File
        • String
        • java.lang.String
        • Packages.helma.util.MimePart
        -
      - -
        maxLength - The maximum length of the alias -
      - -
    - - - - -
      - Returns: -
        - The resulting alias -
      -
    - - - - - -
    - - -

    isClean

    -
    Boolean isClean()
    - -
      Returns true if the internal state of this HopObject is CLEAN.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as clean, false otherwise. -
      -
    - - - - - -
    - - -

    isDeleted

    -
    Boolean isDeleted()
    - -
      Returns true if the internal state of this HopObject is DELETED.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as deleted, false otherwise. -
      -
    - - - - - -
    - - -

    isInvalid

    -
    Boolean isInvalid()
    - -
      Returns true if the internal state of this HopObject is INVALID.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as invalid, false otherwise. -
      -
    - - - - - -
    - - -

    isModified

    -
    Boolean isModified()
    - -
      Returns true if the internal state of this HopObject is MODIFIED.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as modified, false otherwise. -
      -
    - - - - - -
    - - -

    isNew

    -
    Boolean isNew()
    - -
      Returns true if the internal state of this HopObject is NEW.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as new, false otherwise. -
      -
    - - - - - -
    - - -

    isTransient

    -
    Boolean isTransient()
    - -
      Returns true if the internal state of this HopObject is TRANSIENT.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as transient, false otherwise. -
      -
    - - - - - -
    - - -

    isVirtual

    -
    Boolean isVirtual()
    - -
      Returns true if the internal state of this HopObject is VIRTUAL.
    - - - - - - - -
      - Returns: -
        - True if this HopObject is marked as virtual, false otherwise. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/allclasses-frame.html b/modules/jala/docs/allclasses-frame.html deleted file mode 100644 index 34273ae9..00000000 --- a/modules/jala/docs/allclasses-frame.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - All Classes - - - - - - -

    - -All Classes -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Global -
    -
    HopObject -
    -
    jala -
    -
    jala.AsyncRequest -
    -
    jala.BitTorrent -
    -
    jala.Captcha -
    -
    jala.Date -
    -
    jala.Date.Calendar -
    -
    jala.Date.Calendar.Renderer -
    -
    jala.db -
    -
    jala.db.FileDatabase -
    -
    jala.db.RamDatabase -
    -
    jala.db.Server -
    -
    jala.DnsClient -
    -
    jala.DnsClient.Record -
    -
    jala.Form -
    -
    jala.Form.Component -
    -
    jala.Form.Component.Button -
    -
    jala.Form.Component.Checkbox -
    -
    jala.Form.Component.Date -
    -
    jala.Form.Component.Fieldset -
    -
    jala.Form.Component.File -
    -
    jala.Form.Component.Hidden -
    -
    jala.Form.Component.Image -
    -
    jala.Form.Component.Input -
    -
    jala.Form.Component.Password -
    -
    jala.Form.Component.Radio -
    -
    jala.Form.Component.Select -
    -
    jala.Form.Component.Skin -
    -
    jala.Form.Component.Submit -
    -
    jala.Form.Component.Textarea -
    -
    jala.Form.Tracker -
    -
    jala.History -
    -
    jala.HtmlDocument -
    -
    jala.I18n -
    -
    jala.ImageFilter -
    -
    jala.IndexManager -
    -
    jala.IndexManager.Job -
    -
    jala.ListRenderer -
    -
    jala.ListRenderer.ArrayList -
    -
    jala.Mp3 -
    -
    jala.Mp3.Id3v1 -
    -
    jala.Mp3.Id3v2 -
    -
    jala.PodcastWriter -
    -
    jala.RemoteContent -
    -
    jala.Rss20Writer -
    -
    jala.Utilities -
    -
    jala.XmlRpcRequest -
    -
    jala.XmlWriter -
    -
    - - - diff --git a/modules/jala/docs/allclasses-noframe.html b/modules/jala/docs/allclasses-noframe.html deleted file mode 100644 index d26edc54..00000000 --- a/modules/jala/docs/allclasses-noframe.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - -Jala 1.3 All Classes - - - - - - -

    Jala 1.3

    - -All Classes -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Global -
    -
    HopObject -
    -
    jala -
    -
    jala.AsyncRequest -
    -
    jala.BitTorrent -
    -
    jala.Captcha -
    -
    jala.Date -
    -
    jala.Date.Calendar -
    -
    jala.Date.Calendar.Renderer -
    -
    jala.db -
    -
    jala.db.FileDatabase -
    -
    jala.db.RamDatabase -
    -
    jala.db.Server -
    -
    jala.DnsClient -
    -
    jala.DnsClient.Record -
    -
    jala.Form -
    -
    jala.Form.Component -
    -
    jala.Form.Component.Button -
    -
    jala.Form.Component.Checkbox -
    -
    jala.Form.Component.Date -
    -
    jala.Form.Component.Fieldset -
    -
    jala.Form.Component.File -
    -
    jala.Form.Component.Hidden -
    -
    jala.Form.Component.Image -
    -
    jala.Form.Component.Input -
    -
    jala.Form.Component.Password -
    -
    jala.Form.Component.Radio -
    -
    jala.Form.Component.Select -
    -
    jala.Form.Component.Skin -
    -
    jala.Form.Component.Submit -
    -
    jala.Form.Component.Textarea -
    -
    jala.Form.Tracker -
    -
    jala.History -
    -
    jala.HtmlDocument -
    -
    jala.I18n -
    -
    jala.ImageFilter -
    -
    jala.IndexManager -
    -
    jala.IndexManager.Job -
    -
    jala.ListRenderer -
    -
    jala.ListRenderer.ArrayList -
    -
    jala.Mp3 -
    -
    jala.Mp3.Id3v1 -
    -
    jala.Mp3.Id3v2 -
    -
    jala.PodcastWriter -
    -
    jala.RemoteContent -
    -
    jala.Rss20Writer -
    -
    jala.Utilities -
    -
    jala.XmlRpcRequest -
    -
    jala.XmlWriter -
    -
    - - - diff --git a/modules/jala/docs/constant-values.html b/modules/jala/docs/constant-values.html deleted file mode 100644 index 8ec35f01..00000000 --- a/modules/jala/docs/constant-values.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - -Jala 1.3 Constant Values - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - -
    -

    Constant Field Values

    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - jala.Form -
    MINLENGTH"minlength"
    MAXLENGTH"maxlength"
    REQUIRE"require"
    CHECKOPTIONS"checkoptions"
    CONTENTTYPE"contenttype"
    MAXWIDTH"maxwidth"
    MINWIDTH"minwidth"
    MAXHEIGHT"maxheight"
    MINHEIGHT"minheight"
    -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - -
    - jala.IndexManager -
    MAXTRIES10
    NORMAL1
    REBUILDING2
    -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - -
    - jala.IndexManager.Job -
    ADD"add"
    REMOVE"remove"
    OPTIMIZE"optimize"
    -

    - -

    - - - - - - - - - - - - - -
    - jala.PodcastWriter -
    XMLHEADER''
    -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - -
    - jala.RemoteContent -
    HTTP1
    XMLRPC2
    SUFFIX".cache"
    -

    - -

    - - - - - - - - - - - - - - - - - - -
    - jala.Utilities -
    VALUE_ADDED1
    VALUE_MODIFIED2
    -

    - -

    - - -


    - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/help-doc.html b/modules/jala/docs/help-doc.html deleted file mode 100644 index f52b22c1..00000000 --- a/modules/jala/docs/help-doc.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - -Jala 1.3 API Help - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - -
    -
    -

    -How This API Document Is Organized

    -
    -This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

    -Class

    -
    - -

    -Each class has its own separate page. Each of these pages has three sections consisting of a class description, summary tables, and detailed member descriptions:

      -
    • Class inheritance diagram
    • Direct Subclasses
    • Class declaration
    • Class description -

      -

    • Field Summary
    • Constructor Summary
    • Method Summary -

      -

    • Field Detail
    • Constructor Detail
    • Method Detail
    -Each summary entry contains the first sentence from the detailed description for that item.
    - - -

    -Index

    -
    -The Index contains an alphabetic list of all classes, constructors, methods, and fields.
    -

    -Prev/Next

    -These links take you to the next or previous class, interface, package, or related page.

    -Frames/No Frames

    -These links show and hide the HTML frames. All pages are available with or without frames. -

    - - -This help file applies to API documentation generated using the standard doclet. - -
    -


    - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/index-all.html b/modules/jala/docs/index-all.html deleted file mode 100644 index e7b51bcf..00000000 --- a/modules/jala/docs/index-all.html +++ /dev/null @@ -1,3562 +0,0 @@ - - - - - -Index () - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - -A B C D E F G H I J K L M N O P Q R S T U V W X Y -
    - - -

    -A

    - -
    -
    ADD - -Class field in class jala.IndexManager.Job -
      -
    - -
    -
    add() - -Instance method in class jala.History -
      -
    - -
    -
    add(doc) - -Instance method in class jala.IndexManager -
      -
    - -
    -
    addCategory(name, domain, parent) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    addComponent(component) - -Instance method in class jala.Form -
      -
    - -
    -
    addItem(item) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    addItunesCategory(name, subName, parent) - -Instance method in class jala.PodcastWriter -
      -
    - -
    -
    addNamespace(name, url) - -Instance method in class jala.XmlWriter -
      -
    - -
    -
    album - -Instance field in class jala.Mp3 -
      -
    - -
    -
    argumentsToString(args) - -Class method in class jala.XmlRpcRequest -
      -
    - -
    -
    artist - -Instance field in class jala.Mp3 -
      -
    - -
    - -

    -B

    - -
    -
    backup(file) - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    bdecode(code) - -Class method in class jala.BitTorrent -
      -
    - -
    -
    bencode(obj) - -Class method in class jala.BitTorrent -
      -
    - -
    - -

    -C

    - -
    -
    CACHEDIR - -Class field in class jala.RemoteContent -
      -
    - -
    -
    calendar - -Instance field in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    callback - -Instance field in class jala.IndexManager.Job -
      -
    - -
    -
    checkLength(reqData) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    CHECKOPTIONS - -Class field in class jala.Form -
      -
    - -
    -
    checkOptions(reqData) - -Instance method in class jala.Form.Component.Select -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.Checkbox -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.Date -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.File -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.Image -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.Radio -
      -
    - -
    -
    checkRequirements(reqData) - -Instance method in class jala.Form.Component.Select -
      -
    - -
    -
    class_macro() - -Instance method in class jala.Form -
      -
    - -
    -
    class_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    clear() - -Instance method in class jala.History -
      -
    - -
    -
    clear() - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    clone(obj) - -Instance method in class jala.XmlWriter -
      -
    - -
    -
    close_macro() - -Instance method in class jala.Form -
      -
    - -
    -
    cname - -Instance field in class jala.DnsClient.Record -
      -
    - -
    -
    comment - -Instance field in class jala.Mp3 -
      -
    - -
    -
    componentSkin - -Instance field in class jala.Form -
      -
    - -
    -
    containsFileUpload() - -Instance method in class jala.Form -
      -
    - -
    -
    CONTENTTYPE - -Class field in class jala.Form -
      -
    - -
    -
    controls_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    convertArgument(obj) - -Class method in class jala.XmlRpcRequest -
      -
    - -
    -
    convertResult(obj) - -Class method in class jala.XmlRpcRequest -
      -
    - -
    -
    copyFrom(tag) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    copyFrom(tag) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    copyTables(database, tables) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    countErrors() - -Instance method in class jala.Form -
      -
    - -
    -
    countErrors() - -Instance method in class jala.Form.Tracker -
      -
    - -
    -
    create(config, dataObj) - -Class method in class jala.Form -
      -
    - -
    -
    createDomId() - -Instance method in class jala.Form -
      -
    - -
    -
    createDomId(idPart) - -Instance method in class jala.Form.Component -
      -
    - -
    -
    createElement(data) - -Instance method in class jala.XmlWriter -
      -
    - -
    -
    createItem(data) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    createOnDemand(bool) - -Instance method in class jala.db.Server -
      -
    - -
    -
    createPassword(len, level) - -Instance method in class jala.Utilities -
      -
    - -
    -
    createTag(tagClass, tagObject) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    createtime - -Instance field in class jala.IndexManager.Job -
      -
    - -
    -
    createV1Tag(tagObject) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    createV2Tag(tagObject) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    currentEnd_macro() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    currentPage_macro() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    currentStart_macro() - -Instance method in class jala.ListRenderer -
      -
    - -
    - -

    -D

    - -
    -
    date - -Class field in class jala -
      -
    - -
    -
    db - -Class field in class jala -
      -
    - -
    -
    debug() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    defaultRenderer - -Class field in class jala.ListRenderer -
      -
    - -
    -
    diffObjects(obj1, obj2) - -Instance method in class jala.Utilities -
      -
    - -
    -
    dropTable(tableName) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    dump() - -Instance method in class jala.History -
      -
    - -
    -
    dump(file, props) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    - -

    -E

    - -
    -
    email - -Instance field in class jala.DnsClient.Record -
      -
    - -
    -
    error_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    errors - -Instance field in class jala.Form.Tracker -
      -
    - -
    -
    errors - -Instance field in class jala.IndexManager.Job -
      -
    - -
    -
    evaluate() - -Instance method in class jala.AsyncRequest -
      -
    - -
    -
    exec() - -Class method in class jala.RemoteContent -
      -
    - -
    -
    execute() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    extend(subClass, superClass) - -Class method in class jala.Form -
      -
    - -
    -
    extend(template, ext) - -Instance method in class jala.XmlWriter -
      -
    - -
    -
    extendChannel(ext) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    extendItem(ext) - -Instance method in class jala.Rss20Writer -
      -
    - -
    - -

    -F

    - -
    -
    flush(cache) - -Class method in class jala.RemoteContent -
      -
    - -
    -
    forEach(callback, cache) - -Class method in class jala.RemoteContent -
      -
    - -
    -
    formatMessage(message, values) - -Instance method in class jala.I18n -
      -
    - -
    - -

    -G

    - -
    -
    gaussianBlur(radius, amount) - -Instance method in class jala.ImageFilter -
      -
    - -
    -
    genre - -Instance field in class jala.Mp3 -
      -
    - -
    -
    GENRES - -Class field in class jala.Mp3 -
      -
    - -
    -
    get(idx) - -Instance method in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    get(key) - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    get(name) - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    getAccessName(obj, maxLength) - -Instance method in class HopObject -
      -
    - -
    -
    getAccessNameFormat() - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getAlbum() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getAlbum() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getAll(elementName) - -Instance method in class jala.HtmlDocument -
      -
    - -
    -
    getArtist() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getArtist() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getAudio() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getAudio() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getAuthor() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getBaseHref() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getBitRate() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getBytes() - -Instance method in class jala.ImageFilter -
      -
    - -
    -
    getCalendar(today) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getCaptcha() - -Instance method in class jala.Captcha -
      -
    - -
    -
    getCatalog(locale) - -Instance method in class jala.I18n -
      -
    - -
    -
    getChannel() - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    getChannelMode() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getClassName() - -Instance method in class jala.Form -
      -
    - -
    -
    getCollection() - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getCollection() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getComment() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getComment() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getConnection(name, username, password, props) - -Instance method in class jala.db.Server -
      -
    - -
    -
    getConnection(props) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    getControlAttributes() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    getCopyright() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getCreationDate() - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    getCredentials() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getCurrentPage() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getData() - -Instance method in class jala.DnsClient.Record -
      -
    - -
    -
    getDataObject() - -Instance method in class jala.Form -
      -
    - -
    -
    getDirectory() - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    getDirectory() - -Instance method in class jala.db.Server -
      -
    - -
    -
    getDuration() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getEndIndex() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getErrorMessage() - -Instance method in class jala.Form -
      -
    - -
    -
    getFile() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getFrequency() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getGenre() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getGenre() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getHrefFormat() - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getImage() - -Instance method in class jala.ImageFilter -
      -
    - -
    -
    getImage(pictureType) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getInputEncoding() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getItemSkin() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getJavaObject() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getJavaObject() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getJavaObject() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getKeys() - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    getLinks() - -Instance method in class jala.HtmlDocument -
      -
    - -
    -
    getList(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getLocale() - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getLocale(localeId) - -Instance method in class jala.I18n -
      -
    - -
    -
    getLocaleGetter() - -Instance method in class jala.I18n -
      -
    - -
    -
    getMaxPages() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getMessages() - -Instance method in class jala.I18n -
      -
    - -
    -
    getMetadata() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getMethodName() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getName() - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    getName() - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    getNextLink(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getOutputEncoding() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getPageHref(page) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getPageNavigation(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getPageSize() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getPassword() - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    getPassword() - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    getPieceLength() - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    getPort() - -Instance method in class jala.db.Server -
      -
    - -
    -
    getPrevLink(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getProperties(name, username, password, props) - -Instance method in class jala.db.Server -
      -
    - -
    -
    getProperties(props) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    getProxy() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getReadTimeout() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getRenderer() - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getRenderer() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getRoot() - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    getRoot() - -Instance method in class jala.XmlWriter -
      -
    - -
    -
    getSize() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getSourceFile() - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    getStartIndex() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getSubtitle() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getSubtype() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getTag(tagClass) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    gettext(key ) - -Instance method in class jala.I18n -
      -
    - -
    -
    getTextContent(id) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getTextContent(idStr) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getTextEncoding() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getTimeout() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getTimeZone() - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    getTitle() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getTitle() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getTorrentFile() - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    getTotalPages() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getTracker() - -Instance method in class jala.Form -
      -
    - -
    -
    getTrackNumber() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getTrackNumber() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getUrl() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    getUrl() - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    getUrl(name, props) - -Instance method in class jala.db.Server -
      -
    - -
    -
    getUrl(props) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    getUrlParameterName() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getUrlParameters() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    getUsername() - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    getUsername() - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    getV1Tag() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getV2Tag() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    getValue() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    getYear() - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    getYear() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    Global - - class Global -
      -
    - -
    - -

    -H

    - -
    -
    handle(reqData, destObj) - -Instance method in class jala.Form -
      -
    - -
    -
    hasError() - -Instance method in class jala.Form -
      -
    - -
    -
    hasError() - -Instance method in class jala.Form.Tracker -
      -
    - -
    -
    hasTag(tagClass) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    hasV1Tag() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    hasV2Tag() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    help_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    HopObject - - class HopObject -
      -
    - -
    -
    host - -Instance field in class jala.DnsClient.Record -
      -
    - -
    -
    html - -Instance field in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    html - -Class field in class jala.Form -
      -
    - -
    -
    HTTP - -Class field in class jala.RemoteContent -
      -
    - -
    - -

    -I

    - -
    -
    i18n - -Class field in class jala -
      -
    - -
    -
    id_macro() - -Instance method in class jala.Form -
      -
    - -
    -
    id_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    ipAddress - -Instance field in class jala.DnsClient.Record -
      -
    - -
    -
    isAlive() - -Instance method in class jala.AsyncRequest -
      -
    - -
    -
    isArray(val) - -Class method in class Global -
      -
    - -
    -
    isBoolean(val) - -Class method in class Global -
      -
    - -
    -
    isClean() - -Instance method in class HopObject -
      -
    - -
    -
    isDate(val) - -Class method in class Global -
      -
    - -
    -
    isDeleted() - -Instance method in class HopObject -
      -
    - -
    -
    isEmail(name, value, reqData, formObj) - -Class method in class jala.Form -
      -
    - -
    -
    isFunction(val) - -Class method in class Global -
      -
    - -
    -
    isInvalid() - -Instance method in class HopObject -
      -
    - -
    -
    isModified() - -Instance method in class HopObject -
      -
    - -
    -
    isNew() - -Instance method in class HopObject -
      -
    - -
    -
    isNull(val) - -Class method in class Global -
      -
    - -
    -
    isNumber(val) - -Class method in class Global -
      -
    - -
    -
    isObject(val) - -Class method in class Global -
      -
    - -
    -
    isPublic(bool) - -Instance method in class jala.db.Server -
      -
    - -
    -
    isRunning() - -Instance method in class jala.db.Server -
      -
    - -
    -
    isString(val) - -Class method in class Global -
      -
    - -
    -
    isSubset() - -Instance method in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    isTransient() - -Instance method in class HopObject -
      -
    - -
    -
    isUndefined(val) - -Class method in class Global -
      -
    - -
    -
    isUrl(name, value, reqData, formObj) - -Class method in class jala.Form -
      -
    - -
    -
    isVariableBitRate() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    isVirtual() - -Instance method in class HopObject -
      -
    - -
    - -

    -J

    - -
    -
    jala - - class jala -
      -
    - -
    -
    jala.AsyncRequest - - class jala.AsyncRequest -
      -
    - -
    -
    jala.AsyncRequest(obj, funcName, args) - -Constructor in class jala.AsyncRequest -
      -
    - -
    -
    jala.BitTorrent - - class jala.BitTorrent -
      -
    - -
    -
    jala.BitTorrent(filePath, trackerUrl) - -Constructor in class jala.BitTorrent -
      -
    - -
    -
    jala.Captcha - - class jala.Captcha -
      -
    - -
    -
    jala.Captcha() - -Constructor in class jala.Captcha -
      -
    - -
    -
    jala.Date - - class jala.Date -
      -
    - -
    -
    jala.Date() - -Constructor in class jala.Date -
      -
    - -
    -
    jala.Date.Calendar - - class jala.Date.Calendar -
      -
    - -
    -
    jala.Date.Calendar(collection) - -Constructor in class jala.Date.Calendar -
      -
    - -
    -
    jala.Date.Calendar.Renderer - - class jala.Date.Calendar.Renderer -
      -
    - -
    -
    jala.Date.Calendar.Renderer(calendar) - -Constructor in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    jala.db - - class jala.db -
      -
    - -
    -
    jala.db.FileDatabase - - class jala.db.FileDatabase -
      -
    - -
    -
    jala.db.FileDatabase(name, directory, username, password) - -Constructor in class jala.db.FileDatabase -
      -
    - -
    -
    jala.db.RamDatabase - - class jala.db.RamDatabase -
      -
    - -
    -
    jala.db.RamDatabase(name, username, password) - -Constructor in class jala.db.RamDatabase -
      -
    - -
    -
    jala.db.Server - - class jala.db.Server -
      -
    - -
    -
    jala.db.Server(baseDir, port) - -Constructor in class jala.db.Server -
      -
    - -
    -
    jala.DnsClient - - class jala.DnsClient -
      -
    - -
    -
    jala.DnsClient(nameServer) - -Constructor in class jala.DnsClient -
      -
    - -
    -
    jala.DnsClient.Record - - class jala.DnsClient.Record -
      -
    - -
    -
    jala.DnsClient.Record(data) - -Constructor in class jala.DnsClient.Record -
      -
    - -
    -
    jala.Form - - class jala.Form -
      -
    - -
    -
    jala.Form(name, dataObj) - -Constructor in class jala.Form -
      -
    - -
    -
    jala.Form.Component - - class jala.Form.Component -
      -
    - -
    -
    jala.Form.Component(name) - -Constructor in class jala.Form.Component -
      -
    - -
    -
    jala.Form.Component.Button - - class jala.Form.Component.Button -
      -
    - -
    -
    jala.Form.Component.Button(name) - -Constructor in class jala.Form.Component.Button -
      -
    - -
    -
    jala.Form.Component.Checkbox - - class jala.Form.Component.Checkbox -
      -
    - -
    -
    jala.Form.Component.Checkbox(name) - -Constructor in class jala.Form.Component.Checkbox -
      -
    - -
    -
    jala.Form.Component.Date - - class jala.Form.Component.Date -
      -
    - -
    -
    jala.Form.Component.Date(name) - -Constructor in class jala.Form.Component.Date -
      -
    - -
    -
    jala.Form.Component.Fieldset - - class jala.Form.Component.Fieldset -
      -
    - -
    -
    jala.Form.Component.Fieldset(name) - -Constructor in class jala.Form.Component.Fieldset -
      -
    - -
    -
    jala.Form.Component.File - - class jala.Form.Component.File -
      -
    - -
    -
    jala.Form.Component.File(name) - -Constructor in class jala.Form.Component.File -
      -
    - -
    -
    jala.Form.Component.Hidden - - class jala.Form.Component.Hidden -
      -
    - -
    -
    jala.Form.Component.Hidden(name) - -Constructor in class jala.Form.Component.Hidden -
      -
    - -
    -
    jala.Form.Component.Image - - class jala.Form.Component.Image -
      -
    - -
    -
    jala.Form.Component.Image() - -Constructor in class jala.Form.Component.Image -
      -
    - -
    -
    jala.Form.Component.Input - - class jala.Form.Component.Input -
      -
    - -
    -
    jala.Form.Component.Input(name) - -Constructor in class jala.Form.Component.Input -
      -
    - -
    -
    jala.Form.Component.Password - - class jala.Form.Component.Password -
      -
    - -
    -
    jala.Form.Component.Password(name) - -Constructor in class jala.Form.Component.Password -
      -
    - -
    -
    jala.Form.Component.Radio - - class jala.Form.Component.Radio -
      -
    - -
    -
    jala.Form.Component.Radio(name) - -Constructor in class jala.Form.Component.Radio -
      -
    - -
    -
    jala.Form.Component.Select - - class jala.Form.Component.Select -
      -
    - -
    -
    jala.Form.Component.Select(name) - -Constructor in class jala.Form.Component.Select -
      -
    - -
    -
    jala.Form.Component.Skin - - class jala.Form.Component.Skin -
      -
    - -
    -
    jala.Form.Component.Skin(name) - -Constructor in class jala.Form.Component.Skin -
      -
    - -
    -
    jala.Form.Component.Submit - - class jala.Form.Component.Submit -
      -
    - -
    -
    jala.Form.Component.Submit(name) - -Constructor in class jala.Form.Component.Submit -
      -
    - -
    -
    jala.Form.Component.Textarea - - class jala.Form.Component.Textarea -
      -
    - -
    -
    jala.Form.Component.Textarea(name) - -Constructor in class jala.Form.Component.Textarea -
      -
    - -
    -
    jala.Form.Tracker - - class jala.Form.Tracker -
      -
    - -
    -
    jala.Form.Tracker(reqData) - -Constructor in class jala.Form.Tracker -
      -
    - -
    -
    jala.History - - class jala.History -
      -
    - -
    -
    jala.History() - -Constructor in class jala.History -
      -
    - -
    -
    jala.HtmlDocument - - class jala.HtmlDocument -
      -
    - -
    -
    jala.HtmlDocument(source) - -Constructor in class jala.HtmlDocument -
      -
    - -
    -
    jala.I18n - - class jala.I18n -
      -
    - -
    -
    jala.I18n() - -Constructor in class jala.I18n -
      -
    - -
    -
    jala.ImageFilter - - class jala.ImageFilter -
      -
    - -
    -
    jala.ImageFilter(img) - -Constructor in class jala.ImageFilter -
      -
    - -
    -
    jala.IndexManager - - class jala.IndexManager -
      -
    - -
    -
    jala.IndexManager(name, dir, lang) - -Constructor in class jala.IndexManager -
      -
    - -
    -
    jala.IndexManager.Job - - class jala.IndexManager.Job -
      -
    - -
    -
    jala.IndexManager.Job(type, callback) - -Constructor in class jala.IndexManager.Job -
      -
    - -
    -
    jala.ListRenderer - - class jala.ListRenderer -
      -
    - -
    -
    jala.ListRenderer(coll, renderer) - -Constructor in class jala.ListRenderer -
      -
    - -
    -
    jala.ListRenderer.ArrayList - - class jala.ListRenderer.ArrayList -
      -
    - -
    -
    jala.ListRenderer.ArrayList(arr, offset, total) - -Constructor in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    jala.Mp3 - - class jala.Mp3 -
      -
    - -
    -
    jala.Mp3(file) - -Constructor in class jala.Mp3 -
      -
    - -
    -
    jala.Mp3.Id3v1 - - class jala.Mp3.Id3v1 -
      -
    - -
    -
    jala.Mp3.Id3v1(audioObj) - -Constructor in class jala.Mp3.Id3v1 -
      -
    - -
    -
    jala.Mp3.Id3v2 - - class jala.Mp3.Id3v2 -
      -
    - -
    -
    jala.Mp3.Id3v2(audioObj) - -Constructor in class jala.Mp3.Id3v2 -
      -
    - -
    -
    jala.PodcastWriter - - class jala.PodcastWriter -
      -
    - -
    -
    jala.PodcastWriter(header) - -Constructor in class jala.PodcastWriter -
      -
    - -
    -
    jala.RemoteContent - - class jala.RemoteContent -
      -
    - -
    -
    jala.RemoteContent(url, method, storage) - -Constructor in class jala.RemoteContent -
      -
    - -
    -
    jala.Rss20Writer - - class jala.Rss20Writer -
      -
    - -
    -
    jala.Rss20Writer(header) - -Constructor in class jala.Rss20Writer -
      -
    - -
    -
    jala.Utilities - - class jala.Utilities -
      -
    - -
    -
    jala.Utilities() - -Constructor in class jala.Utilities -
      -
    - -
    -
    jala.XmlRpcRequest - - class jala.XmlRpcRequest -
      -
    - -
    -
    jala.XmlRpcRequest(url, methodName) - -Constructor in class jala.XmlRpcRequest -
      -
    - -
    -
    jala.XmlWriter - - class jala.XmlWriter -
      -
    - -
    -
    jala.XmlWriter(header) - -Constructor in class jala.XmlWriter -
      -
    - -
    - -

    -K

    - -
    -
    keys() - -Instance method in class jala.BitTorrent -
      -
    - -
    - -

    -L

    - -
    -
    label_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    length - -Instance field in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    limit_macro(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    listComponents() - -Instance method in class jala.Form -
      -
    - -
    -
    log() - -Instance method in class jala.IndexManager -
      -
    - -
    - -

    -M

    - -
    -
    markgettext(key) - -Instance method in class jala.I18n -
      -
    - -
    -
    MAXHEIGHT - -Class field in class jala.Form -
      -
    - -
    -
    MAXLENGTH - -Class field in class jala.Form -
      -
    - -
    -
    MAXTRIES - -Class field in class jala.IndexManager -
      -
    - -
    -
    MAXWIDTH - -Class field in class jala.Form -
      -
    - -
    -
    message_macro(param) - -Instance method in class jala.I18n -
      -
    - -
    -
    MINHEIGHT - -Class field in class jala.Form -
      -
    - -
    -
    MINLENGTH - -Class field in class jala.Form -
      -
    - -
    -
    MINWIDTH - -Class field in class jala.Form -
      -
    - -
    -
    MODES - -Class field in class jala.Mp3 -
      -
    - -
    -
    mx - -Instance field in class jala.DnsClient.Record -
      -
    - -
    - -

    -N

    - -
    -
    name - -Instance field in class jala.Form -
      -
    - -
    -
    name_macro() - -Instance method in class jala.Form -
      -
    - -
    -
    name_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    nameServer - -Instance field in class jala.DnsClient -
      -
    - -
    -
    needsUpdate() - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    nextLink_macro(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    ngettext(singularKey, pluralKey, amount ) - -Instance method in class jala.I18n -
      -
    - -
    -
    NORMAL - -Class field in class jala.IndexManager -
      -
    - -
    - -

    -O

    - -
    -
    offset - -Instance field in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    open_macro() - -Instance method in class jala.Form -
      -
    - -
    -
    OPTIMIZE - -Class field in class jala.IndexManager.Job -
      -
    - -
    -
    optimize() - -Instance method in class jala.IndexManager -
      -
    - -
    - -

    -P

    - -
    -
    pageNavigation_macro(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    parseDuration() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    parseOptions() - -Instance method in class jala.Form.Component.Select -
      -
    - -
    -
    parseValue(reqData) - -Instance method in class jala.Form.Component.Checkbox -
      -
    - -
    -
    parseValue(reqData) - -Instance method in class jala.Form.Component.Date -
      -
    - -
    -
    parseValue(reqData) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    patchObject(obj, diff) - -Instance method in class jala.Utilities -
      -
    - -
    -
    peek(offset) - -Instance method in class jala.History -
      -
    - -
    -
    PICTURE_TYPES - -Class field in class jala.Mp3 -
      -
    - -
    -
    pop(offset) - -Instance method in class jala.History -
      -
    - -
    -
    prevLink_macro(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    propertyGetter(name, value) - -Class method in class jala.Form -
      -
    - -
    -
    propertySetter(name, value) - -Class method in class jala.Form -
      -
    - -
    -
    push() - -Instance method in class jala.History -
      -
    - -
    - -

    -Q

    - -
    -
    query(dName, queryType) - -Instance method in class jala.DnsClient -
      -
    - -
    -
    queryMailHost(dName) - -Instance method in class jala.DnsClient -
      -
    - -
    - -

    -R

    - -
    -
    REBUILDING - -Class field in class jala.IndexManager -
      -
    - -
    -
    redirect(offset) - -Instance method in class jala.History -
      -
    - -
    -
    REMOVE - -Class field in class jala.IndexManager.Job -
      -
    - -
    -
    remove() - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    remove() - -Instance method in class jala.History -
      -
    - -
    -
    remove(id) - -Instance method in class jala.IndexManager -
      -
    - -
    -
    removeFromAudio() - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    removeTag(tagClass) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    removeV1Tag() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    removeV2Tag() - -Instance method in class jala.Mp3 -
      -
    - -
    -
    render() - -Instance method in class jala.Form -
      -
    - -
    -
    render() - -Instance method in class jala.Form.Component -
      -
    - -
    -
    render() - -Instance method in class jala.Form.Component.Fieldset -
      -
    - -
    -
    render() - -Instance method in class jala.Form.Component.Hidden -
      -
    - -
    -
    render() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    render() - -Instance method in class jala.Form.Component.Skin -
      -
    - -
    -
    render(attr, value, reqData) - -Instance method in class jala.Form.Component.Button -
      -
    - -
    -
    render(today) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    render_macro() - -Instance method in class jala.Form -
      -
    - -
    -
    render_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    render_macro(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderAsString(param) - -Instance method in class jala.Form -
      -
    - -
    -
    renderCalendar(date, body, prevMonth, nextMonth) - -Instance method in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    renderControls(attr, value) - -Instance method in class jala.Form.Component.Button -
      -
    - -
    -
    renderControls(attr, value) - -Instance method in class jala.Form.Component.Radio -
      -
    - -
    -
    renderControls(attr, value) - -Instance method in class jala.Form.Component.Submit -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Checkbox -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Date -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.File -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Hidden -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Password -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Select -
      -
    - -
    -
    renderControls(attr, value, reqData) - -Instance method in class jala.Form.Component.Textarea -
      -
    - -
    -
    renderDay(date, isExisting, isSelected) - -Instance method in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    renderDayHeader(text) - -Instance method in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    renderEditor(prefix, date, fmt) - -Instance method in class jala.Date -
      -
    - -
    -
    renderEditorAsString(prefix, date, pattern) - -Instance method in class jala.Date -
      -
    - -
    -
    renderError() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    renderHelp() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    renderImage() - -Instance method in class jala.Captcha -
      -
    - -
    -
    renderLabel() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    renderList(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderListAsString(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderNextLink(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderNextLinkAsString(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderPageNavigation(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderPageNavigationAsString(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderPrevLink(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderPrevLinkAsString(param) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    renderPrevNextLink(date) - -Instance method in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    renderRow(row) - -Instance method in class jala.Date.Calendar.Renderer -
      -
    - -
    -
    reqData - -Instance field in class jala.Form.Tracker -
      -
    - -
    -
    REQUIRE - -Class field in class jala.Form -
      -
    - -
    -
    restore(backupFile) - -Instance method in class jala.db.FileDatabase -
      -
    - -
    -
    run() - -Instance method in class jala.AsyncRequest -
      -
    - -
    -
    runScript(file, props, charset, continueOnError) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    - -

    -S

    - -
    -
    save(destObj, val) - -Instance method in class jala.Form.Component -
      -
    - -
    -
    save(filename) - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    save(outFile) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    save(tracker, destObj) - -Instance method in class jala.Form -
      -
    - -
    -
    save(tracker, destObj) - -Instance method in class jala.Form.Component.Fieldset -
      -
    - -
    -
    save(tracker, destObj) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    scrape(xpathExpr) - -Instance method in class jala.HtmlDocument -
      -
    - -
    -
    set(name, value) - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    setAccessNameFormat(fmt) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    setAlbum(album) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setAlbum(album) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setArtist(artist) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setArtist(artist) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setAuthor(author) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setBaseHref(href) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setChannel(data) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    setClassName(newClassName) - -Instance method in class jala.Form -
      -
    - -
    -
    setCollection(coll) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setComment(comment) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setComment(comment) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setCopyright(copyright) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setCreationDate(date) - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    setCredentials(username, password) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setDataObject(newDataObj) - -Instance method in class jala.Form -
      -
    - -
    -
    setDebug(flag) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setDelay(millis) - -Instance method in class jala.AsyncRequest -
      -
    - -
    -
    setEncoding(enc) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setErrorMessage(newErrorMessage) - -Instance method in class jala.Form -
      -
    - -
    -
    setGenre(genre) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setGenre(genre) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setHandler(handler) - -Instance method in class jala.I18n -
      -
    - -
    -
    setHrefFormat(fmt) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    setImage(data) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    setImage(pictureType, mimeType, byteArray) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setInputEncoding(enc) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setInterval(interval) - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    setItemSkin(name) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setLocale(loc) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    setLocaleGetter(func) - -Instance method in class jala.I18n -
      -
    - -
    -
    setMaxPages(pages) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setMessages(msgObject) - -Instance method in class jala.I18n -
      -
    - -
    -
    setMetadata(metadata) - -Instance method in class jala.Mp3 -
      -
    - -
    -
    setOutputEncoding(enc) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setPageSize(size) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setPieceLength(length) - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    setProxy(proxyString) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setReadTimeout(millis) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setRenderer(r) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    setRenderer(r) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setSubtitle(title) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setTextContent(id, val) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setTextContent(idStr, val) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setTextEncoding(encType) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setTextInput(data) - -Instance method in class jala.Rss20Writer -
      -
    - -
    -
    setTimeout(millis) - -Instance method in class jala.XmlRpcRequest -
      -
    - -
    -
    setTimeout(seconds) - -Instance method in class jala.AsyncRequest -
      -
    - -
    -
    setTimeZone(tz) - -Instance method in class jala.Date.Calendar -
      -
    - -
    -
    setTitle(title) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setTitle(title) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setTracker(newTracker) - -Instance method in class jala.Form -
      -
    - -
    -
    setTrackNumber(trackNumber) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setTrackNumber(trackNumber) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setUrl(url, desc) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    setUrlParameterName(name) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setUrlParameters(params) - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    setValue(destObj, value) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    setYear(year) - -Instance method in class jala.Mp3.Id3v1 -
      -
    - -
    -
    setYear(year) - -Instance method in class jala.Mp3.Id3v2 -
      -
    - -
    -
    sharpen(amount) - -Instance method in class jala.ImageFilter -
      -
    - -
    -
    shutdown() - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    size() - -Instance method in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    size_macro() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    start() - -Instance method in class jala.db.Server -
      -
    - -
    -
    stop() - -Instance method in class jala.db.Server -
      -
    - -
    -
    subsetSize() - -Instance method in class jala.ListRenderer.ArrayList -
      -
    - -
    -
    SUFFIX - -Class field in class jala.RemoteContent -
      -
    - -
    - -

    -T

    - -
    -
    tableExists(name) - -Instance method in class jala.db.RamDatabase -
      -
    - -
    -
    text - -Instance field in class jala.DnsClient.Record -
      -
    - -
    -
    TEXT_ENCODINGS - -Class field in class jala.Mp3 -
      -
    - -
    -
    title - -Instance field in class jala.Mp3 -
      -
    - -
    -
    toString() - -Instance method in class jala.BitTorrent -
      -
    - -
    -
    toString() - -Instance method in class jala.Captcha -
      -
    - -
    -
    toString() - -Instance method in class jala.HtmlDocument -
      -
    - -
    -
    toString() - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    toString() - -Instance method in class jala.Utilities -
      -
    - -
    -
    toString() - -Instance method in class jala.XmlWriter -
      -
    - -
    -
    totalPages_macro() - -Instance method in class jala.ListRenderer -
      -
    - -
    -
    trackNumber - -Instance field in class jala.Mp3 -
      -
    - -
    -
    translate(singularKey, pluralKey, amount) - -Instance method in class jala.I18n -
      -
    - -
    -
    type - -Instance field in class jala.DnsClient.Record -
      -
    - -
    -
    type - -Instance field in class jala.IndexManager.Job -
      -
    - -
    -
    TYPE_A - -Class field in class jala.DnsClient -
      -
    - -
    -
    TYPE_CNAME - -Class field in class jala.DnsClient -
      -
    - -
    -
    type_macro() - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    TYPE_MX - -Class field in class jala.DnsClient -
      -
    - -
    -
    TYPE_NS - -Class field in class jala.DnsClient -
      -
    - -
    -
    TYPE_PTR - -Class field in class jala.DnsClient -
      -
    - -
    -
    TYPE_SOA - -Class field in class jala.DnsClient -
      -
    - -
    -
    TYPE_TXT - -Class field in class jala.DnsClient -
      -
    - -
    -
    TYPE_WKS - -Class field in class jala.DnsClient -
      -
    - -
    - -

    -U

    - -
    -
    unsharpMask(radius, amount) - -Instance method in class jala.ImageFilter -
      -
    - -
    -
    update() - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    useSsl(bool) - -Instance method in class jala.db.Server -
      -
    - -
    -
    util - -Class field in class jala -
      -
    - -
    - -

    -V

    - -
    -
    validate(input) - -Instance method in class jala.Captcha -
      -
    - -
    -
    validate(reqData) - -Instance method in class jala.Form -
      -
    - -
    -
    validate(tracker) - -Instance method in class jala.Form.Component -
      -
    - -
    -
    validate(tracker) - -Instance method in class jala.Form.Component.Fieldset -
      -
    - -
    -
    validate(tracker) - -Instance method in class jala.Form.Component.Input -
      -
    - -
    -
    VALUE_ADDED - -Class field in class jala.Utilities -
      -
    - -
    -
    VALUE_MODIFIED - -Class field in class jala.Utilities -
      -
    - -
    -
    VALUE_REMOVED - -Class field in class jala.Utilities -
      -
    - -
    -
    valueOf() - -Instance method in class jala.RemoteContent -
      -
    - -
    -
    values - -Instance field in class jala.Form.Tracker -
      -
    - -
    - -

    -W

    - -
    -
    write() - -Instance method in class jala.XmlWriter -
      -
    - -
    - -

    -X

    - -
    -
    XMLHEADER - -Class field in class jala.PodcastWriter -
      -
    - -
    -
    XMLRPC - -Class field in class jala.RemoteContent -
      -
    - -
    - -

    -Y

    - -
    -
    year - -Instance field in class jala.Mp3 -
      -
    - -
    - -A B C D E F G H I J K L M N O P Q R S T U V W X Y - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/index.html b/modules/jala/docs/index.html deleted file mode 100644 index 8a7b7ade..00000000 --- a/modules/jala/docs/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - -Generated Javascript Documentation - - - - - - - - - - - - - - -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to <A HREF="allclasses-frame.html">Non-frame version.</A> - diff --git a/modules/jala/docs/jala.AsyncRequest.html b/modules/jala/docs/jala.AsyncRequest.html deleted file mode 100644 index 5b8f5c3d..00000000 --- a/modules/jala/docs/jala.AsyncRequest.html +++ /dev/null @@ -1,510 +0,0 @@ - - - - - -jala.AsyncRequest - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.AsyncRequest

    -
    Object
    -   |
    -   +--jala.AsyncRequest
    -
    - - -
    -
    - -
    class - jala.AsyncRequest - - -
    - -

    -
    This class is used to create requests of type "INTERNAL" - (like cron-jobs) that are processed in a separate thread and - therefor asynchronous. -
    Deprecated Use the app.invokeAsync method instead (built-in into Helma as of version 1.6)

    Defined in AsyncRequest.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.AsyncRequest - - (<Object> obj, <String> funcName, <Array> args) - -
    -             - Creates a new AsyncRequest instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - evaluate() - -
    -            - Starts this asynchronous request. -
    - -  Boolean - - - - - isAlive() - -
    -            - Returns true if the underlying thread is alive -
    - -  void - - - - - run() - -
    -            - Starts this asynchronous request. -
    - -  void - - - - - setDelay(<Number> millis) - -
    -            - Defines the delay to wait before evaluating this asynchronous request. -
    - -  void - - - - - setTimeout(<Number> seconds) - -
    -            - Sets the timeout of this asynchronous request. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.AsyncRequest

    -
    jala.AsyncRequest(<Object> obj, <String> funcName, <Array> args)
    - - -
      - Creates a new AsyncRequest instance. -
    - - - -
      - Parameters: - -
        obj - Object in whose context the method should be called -
      - -
        funcName - Name of the function to call -
      - -
        args - Array containing the arguments that should be passed to the function (optional). This option is deprecated, instead pass the arguments directly to the run() method. -
      - - -
    - - - - -
      - Returns: -
        - A new instance of AsyncRequest -
      -
    - - - - - -
      -Deprecated Use the app.invokeAsync method instead (built-in into Helma as of version 1.6)

      -
    - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    evaluate

    -
    void evaluate()
    - -
      Starts this asynchronous request.
    - - - - - - - - - - -
      - Deprecated Use run() instead

      -
    - - -
    - - -

    isAlive

    -
    Boolean isAlive()
    - -
      Returns true if the underlying thread is alive
    - - - - - - - -
      - Returns: -
        - True if the underlying thread is alive, false otherwise. -
      -
    - - - - - -
    - - -

    run

    -
    void run()
    - -
      Starts this asynchronous request. Any arguments passed to - this method will be passed to the method executed by - this AsyncRequest instance.
    - - - - - - - - - - - -
    - - -

    setDelay

    -
    void setDelay(<Number> millis)
    - -
      Defines the delay to wait before evaluating this asynchronous request.
    - - - - -
      - Parameters: - -
        millis - Milliseconds to wait -
      - -
    - - - - - - - - -
    - - -

    setTimeout

    -
    void setTimeout(<Number> seconds)
    - -
      Sets the timeout of this asynchronous request.
    - - - - -
      - Parameters: - -
        seconds - Thread-timeout. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.BitTorrent.html b/modules/jala/docs/jala.BitTorrent.html deleted file mode 100644 index 71bed863..00000000 --- a/modules/jala/docs/jala.BitTorrent.html +++ /dev/null @@ -1,879 +0,0 @@ - - - - - -jala.BitTorrent - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.BitTorrent

    -
    Object
    -   |
    -   +--jala.BitTorrent
    -
    - - -
    -
    - -
    class - jala.BitTorrent - - -
    - -

    -
    This class provides methods to create a BitTorrent - metadata file from any desired file. -
    Defined in BitTorrent.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.BitTorrent - - (<String> filePath, <String> trackerUrl) - -
    -             - Constructs a new BitTorrent file. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Object - - - - - get(<String> name) - -
    -            - Get a torrent property. -
    - -  Date - - - - - getCreationDate() - -
    -            - Get the creation date of the torrent. -
    - -  Number - - - - - getPieceLength() - -
    -            - Get the piece length of the torrent. -
    - -  helma.File - - - - - getSourceFile() - -
    -            - Returns the underlying source file. -
    - -  helma.File - - - - - getTorrentFile() - -
    -            - Returns the underlying torrent file. -
    - -  Array - - - - - keys() - -
    -            - Get all available property names. -
    - -  void - - - - - save(<String> filename) - -
    -            - Saves the torrent as file. -
    - -  void - - - - - set(<String> name, <Object> value) - -
    -            - Set a torrent property. -
    - -  void - - - - - setCreationDate(<Date> date) - -
    -            - Set the creation date of the torrent. -
    - -  void - - - - - setPieceLength(<Number> length) - -
    -            - Set the piece length of the torrent. -
    - -  String - - - - - toString() - -
    -            - Get a string representation of the torrent. -
    - - <static> Object - - - - - bdecode(<String> code) - -
    -            - The bdecode method. -
    - - <static> String - - - - - bencode(<Object> obj) - -
    -            - The bencode method. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.BitTorrent

    -
    jala.BitTorrent(<String> filePath, <String> trackerUrl)
    - - -
      - Constructs a new BitTorrent file. -
    - - - -
      - Parameters: - -
        filePath - The path to the original file. -
      - -
        trackerUrl - The URL string of the tracker. -
      - - -
    - - - - -
      - Returns: -
        - A new BitTorrent file. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    get

    -
    Object get(<String> name)
    - -
      Get a torrent property.
    - - - - -
      - Parameters: - -
        name - The name of the property. -
      - -
    - - - - -
      - Returns: -
        - The value of the property. -
      -
    - - - - - -
    - - -

    getCreationDate

    -
    Date getCreationDate()
    - -
      Get the creation date of the torrent.
    - - - - - - - -
      - Returns: -
        - The torrent's creation date. -
      -
    - - - - - -
    - - -

    getPieceLength

    -
    Number getPieceLength()
    - -
      Get the piece length of the torrent.
    - - - - - - - -
      - Returns: -
        - The torrent's piece length. -
      -
    - - - - - -
    - - -

    getSourceFile

    -
    helma.File getSourceFile()
    - -
      Returns the underlying source file.
    - - - - - - - -
      - Returns: -
        - The source file. -
      -
    - - - - - -
    - - -

    getTorrentFile

    -
    helma.File getTorrentFile()
    - -
      Returns the underlying torrent file.
    - - - - - - - -
      - Returns: -
        - The torrent file. -
      -
    - - - - - -
    - - -

    keys

    -
    Array keys()
    - -
      Get all available property names.
    - - - - - - - -
      - Returns: -
        - The list of property names. -
      -
    - - - - - -
    - - -

    save

    -
    void save(<String> filename)
    - -
      Saves the torrent as file.
    - - - - -
      - Parameters: - -
        filename - An optional name for the torrent file. If no name is given it will be composed from name of source file as defined in the torrent plus the ending ".torrent". -
      - -
    - - - - - - - - -
    - - -

    set

    -
    void set(<String> name, <Object> value)
    - -
      Set a torrent property.
    - - - - -
      - Parameters: - -
        name - The name of the property. -
      - -
        value - The property's value. -
      - -
    - - - - - - - - -
    - - -

    setCreationDate

    -
    void setCreationDate(<Date> date)
    - -
      Set the creation date of the torrent.
    - - - - -
      - Parameters: - -
        date - The desired creation date. -
      - -
    - - - - - - - - -
    - - -

    setPieceLength

    -
    void setPieceLength(<Number> length)
    - -
      Set the piece length of the torrent.
    - - - - -
      - Parameters: - -
        length - The desired piece length. -
      - -
    - - - - - - - - -
    - - -

    toString

    -
    String toString()
    - -
      Get a string representation of the torrent.
    - - - - - - - -
      - Returns: -
        - The torrent as string. -
      -
    - - - - - -
    - - -

    bdecode

    -
    <static> Object bdecode(<String> code)
    - -
      The bdecode method. Turns an encoded string into - a corresponding JavaScript object structure. - FIXME: Handle with caution...
    - - - - -
      - Parameters: - -
        code - The encoded string. -
      - -
    - - - - -
      - Returns: -
        - The decoded JavaScript structure. -
      -
    - - - - - -
    - - -

    bencode

    -
    <static> String bencode(<Object> obj)
    - -
      The bencode method. Turns an arbitrary JavaScript - object structure into a corresponding encoded - string.
    - - - - -
      - Parameters: - -
        obj - The target JavaScript object. -
      - -
    - - - - -
      - Returns: -
        - The encoded string. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Captcha.html b/modules/jala/docs/jala.Captcha.html deleted file mode 100644 index 742e675b..00000000 --- a/modules/jala/docs/jala.Captcha.html +++ /dev/null @@ -1,461 +0,0 @@ - - - - - -jala.Captcha - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Captcha

    -
    Object
    -   |
    -   +--jala.Captcha
    -
    - - -
    -
    - -
    class - jala.Captcha - - -
    - -

    -
    Wrapper class for the - JCaptcha library. - A captcha (an acronym for "completely automated public - Turing test to tell computers and humans apart") is a - type of challenge-response test used in computing to - determine whether or not the user is human. -
    Defined in Captcha.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Captcha - - () - -
    -             - Construct a new captcha. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  com.octo.captcha.Captcha - - - - - getCaptcha() - -
    -            - Get a new captcha object. -
    - -  void - - - - - renderImage() - -
    -            - Render a new captcha image. -
    - -  String - - - - - toString() - -
    -            - Get a string representation of the captcha object. -
    - -  Boolean - - - - - validate(<String> input) - -
    -            - Validate a user's input with the prompted captcha. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Captcha

    -
    jala.Captcha()
    - - -
      - Construct a new captcha. -
    - - - - - - - - -
      - Returns: -
        - A new captcha. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getCaptcha

    -
    com.octo.captcha.Captcha getCaptcha()
    - -
      Get a new captcha object.
    - - - - - - - -
      - Returns: -
        - A new captcha object. -
      -
    - - - - - -
    - - -

    renderImage

    -
    void renderImage()
    - -
      Render a new captcha image.
    - - - - - - - - - - - -
    - - -

    toString

    -
    String toString()
    - -
      Get a string representation of the captcha object.
    - - - - - - - -
      - Returns: -
        - A string representation of the captcha object. -
      -
    - - - - - -
    - - -

    validate

    -
    Boolean validate(<String> input)
    - -
      Validate a user's input with the prompted captcha.
    - - - - -
      - Parameters: - -
        input - The user's input. -
      - -
    - - - - -
      - Returns: -
        - True if the user's input matches the captcha. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Date.Calendar.Renderer.html b/modules/jala/docs/jala.Date.Calendar.Renderer.html deleted file mode 100644 index 25121432..00000000 --- a/modules/jala/docs/jala.Date.Calendar.Renderer.html +++ /dev/null @@ -1,580 +0,0 @@ - - - - - -jala.Date.Calendar.Renderer - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Date.Calendar.Renderer

    -
    Object
    -   |
    -   +--jala.Date.Calendar.Renderer
    -
    - - -
    -
    - -
    class - jala.Date.Calendar.Renderer - - -
    - -

    -
    A default renderer to use in conjunction with jala.Date.Calendar -
    Defined in Date.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  jala.Date.Calendarcalendar -
    -           The calendar utilizing this renderer instance
    -  helma.Htmlhtml -
    -           An instance of helma.Html used for rendering the calendar
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Date.Calendar.Renderer - - (<jala.Date.Calendar> calendar) - -
    -             - Returns a new instance of the default calendar renderer. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - renderCalendar(<Date> date, <String> body, <Date> prevMonth, <Date> nextMonth) - -
    -            - Renders the calendar directly to response. -
    - -  void - - - - - renderDay(<Date> date, <Boolean> isExisting, <Boolean> isSelected) - -
    -            - Renders a single day within the calendar directly to response. -
    - -  void - - - - - renderDayHeader(<String> text) - -
    -            - Renders a single cell in the calendar day header row directly to response. -
    - -  void - - - - - renderPrevNextLink(<Date> date) - -
    -            - Renders a link to the previous or next month's calendar directly to response. -
    - -  void - - - - - renderRow(<String> row) - -
    -            - Renders a single calendar row directly to response. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    calendar

    -
    jala.Date.Calendar calendar
    -
      - The calendar utilizing this renderer instance - -
    -
    - - -

    html

    -
    helma.Html html
    -
      - An instance of helma.Html used for rendering the calendar - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Date.Calendar.Renderer

    -
    jala.Date.Calendar.Renderer(<jala.Date.Calendar> calendar)
    - - -
      - Returns a new instance of the default calendar renderer. -
    - - - -
      - Parameters: - -
        calendar - The calendar utilizing this renderer -
      - - -
    - - - - -
      - Returns: -
        - A newly created instance of jala.Date.Calendar.Renderer -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    renderCalendar

    -
    void renderCalendar(<Date> date, <String> body, <Date> prevMonth, <Date> nextMonth)
    - -
      Renders the calendar directly to response.
    - - - - -
      - Parameters: - -
        date - A date object representing this calendar's month and year. Please mind that the day will be set to the last date in this month. -
      - -
        body - The rendered calendar weeks including the day header (basically the whole kernel of the table). -
      - -
        prevMonth - A date object set to the last available date of the previous month. This can be used to render a navigation link to the previous month. -
      - -
        nextMonth - A date object set to the first available date of the next month. This can be used to render a navigation link to the next month. -
      - -
    - - - - - - - - -
    - - -

    renderDay

    -
    void renderDay(<Date> date, <Boolean> isExisting, <Boolean> isSelected)
    - -
      Renders a single day within the calendar directly to response.
    - - - - -
      - Parameters: - -
        date - A date instance representing the day within the calendar. -
      - -
        isExisting - True if there is a child object in the calendar's collection to which the date cell should link to -
      - -
        isSelected - True if this calendar day should be rendered as selected day. -
      - -
    - - - - - - - - -
    - - -

    renderDayHeader

    -
    void renderDayHeader(<String> text)
    - -
      Renders a single cell in the calendar day header row directly to response.
    - - - - -
      - Parameters: - -
        text - The text to display in the header field. -
      - -
    - - - - - - - - -
    - - -

    renderPrevNextLink

    -
    void renderPrevNextLink(<Date> date)
    - -
      Renders a link to the previous or next month's calendar directly to response.
    - - - - -
      - Parameters: - -
        date - A date object set to the previous or next available month. This can be null in case there is no previous or next month. -
      - -
    - - - - - - - - -
    - - -

    renderRow

    -
    void renderRow(<String> row)
    - -
      Renders a single calendar row directly to response.
    - - - - -
      - Parameters: - -
        row - The body of the calendar row. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Date.Calendar.html b/modules/jala/docs/jala.Date.Calendar.html deleted file mode 100644 index 6dde6026..00000000 --- a/modules/jala/docs/jala.Date.Calendar.html +++ /dev/null @@ -1,911 +0,0 @@ - - - - - -jala.Date.Calendar - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Date.Calendar

    -
    Object
    -   |
    -   +--jala.Date.Calendar
    -
    - - -
    -
    - -
    class - jala.Date.Calendar - - -
    - -

    -
    This class represents a calendar based based on a grouped - collection of HopObjects. It provides several methods for rendering - the calendar plus defining locale and timezone settings. -
    Defined in Date.js

    -

    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Date.Calendar.Renderer
    -  - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Date.Calendar - - (<HopObject> collection) - -
    -             - Creates a new instance of jala.Data.Calendar -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - getAccessNameFormat() - -
    -            - Returns the format of the access name used by this calendar to access - child group objects of the collection this calendar is operating on. -
    - -  String - - - - - getCalendar(today) - -
    -            - Returns a rendered calendar -
    - -  HopObject - - - - - getCollection() - -
    -            - Returns the collection this calendar object works on -
    - -  String - - - - - getHrefFormat() - -
    -            - Returns the date formatting pattern used to render hrefs. -
    - -  java.util.Locale - - - - - getLocale() - -
    -            - Returns the locale used within this calendar instance. -
    - -  Object - - - - - getRenderer() - -
    -            - Returns the renderer used by this calendar. -
    - -  java.util.Locale - - - - - getTimeZone() - -
    -            - Returns the locale used within this calendar instance. -
    - -  void - - - - - render(today) - -
    -            - Renders the calendar using either a custom renderer defined - using setRenderer() or the default one. -
    - -  void - - - - - setAccessNameFormat(<String> fmt) - -
    -            - Sets the format of the group name to use when trying to access - child objects of the collection this calendar is operating on. -
    - -  void - - - - - setHrefFormat(<String> fmt) - -
    -            - Sets the format of the hrefs to render by this calendar - to the format pattern passed as argument. -
    - -  void - - - - - setLocale(<java.util.Locale> loc) - -
    -            - Sets the locale to use within this calendar object -
    - -  void - - - - - setRenderer(<Object> r) - -
    -            - Sets the renderer to use. -
    - -  void - - - - - setTimeZone(tz) - -
    -            - Sets the locale to use within this calendar object -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Date.Calendar

    -
    jala.Date.Calendar(<HopObject> collection)
    - - -
      - Creates a new instance of jala.Data.Calendar -
    - - - -
      - Parameters: - -
        collection - A grouped HopObject collection to work on -
      - - -
    - - - - -
      - Returns: -
        - A newly created jala.Date.Calendar instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getAccessNameFormat

    -
    String getAccessNameFormat()
    - -
      Returns the format of the access name used by this calendar to access - child group objects of the collection this calendar is operating on. - The default format is "yyyyMMdd".
    - - - - - - - -
      - Returns: -
        - The date formatting pattern used to access child objects -
      -
    - - - - - - - -
    - - -

    getCalendar

    -
    String getCalendar(today)
    - -
      Returns a rendered calendar
    - - - - - - - - - - - - - -
    - - -

    getCollection

    -
    HopObject getCollection()
    - -
      Returns the collection this calendar object works on
    - - - - - - - -
      - Returns: -
        - The HopObject collection of this calendar -
      -
    - - - - - -
    - - -

    getHrefFormat

    -
    String getHrefFormat()
    - -
      Returns the date formatting pattern used to render hrefs. The default - format is "yyyyMMdd".
    - - - - - - - -
      - Returns: -
        - The date formatting pattern -
      -
    - - - - - - - -
    - - -

    getLocale

    -
    java.util.Locale getLocale()
    - -
      Returns the locale used within this calendar instance. By default - the locale used by this calendar is the default locale of the - Java Virtual Machine running Helma.
    - - - - - - - -
      - Returns: -
        - The locale of this calendar -
      -
    - - - - - - - -
    - - -

    getRenderer

    -
    Object getRenderer()
    - -
      Returns the renderer used by this calendar.
    - - - - - - - -
      - Returns: -
        - The calendar renderer -
      -
    - - - - - - - -
    - - -

    getTimeZone

    -
    java.util.Locale getTimeZone()
    - -
      Returns the locale used within this calendar instance. By default - the timezone used by this calendar is the default timezone - of the Java Virtual Machine running Helma.
    - - - - - - - -
      - Returns: -
        - The locale of this calendar -
      -
    - - - - - - - -
    - - -

    render

    -
    void render(today)
    - -
      Renders the calendar using either a custom renderer defined - using setRenderer() or the default one.
    - - - - - - - - - - - - - -
    - - -

    setAccessNameFormat

    -
    void setAccessNameFormat(<String> fmt)
    - -
      Sets the format of the group name to use when trying to access - child objects of the collection this calendar is operating on.
    - - - - -
      - Parameters: - -
        fmt - The date format pattern to use for accessing child objects -
      - -
    - - - - - - - - - - -
    - - -

    setHrefFormat

    -
    void setHrefFormat(<String> fmt)
    - -
      Sets the format of the hrefs to render by this calendar - to the format pattern passed as argument.
    - - - - -
      - Parameters: - -
        fmt - The date format pattern to use for rendering the href -
      - -
    - - - - - - - - - - -
    - - -

    setLocale

    -
    void setLocale(<java.util.Locale> loc)
    - -
      Sets the locale to use within this calendar object
    - - - - -
      - Parameters: - -
        loc - The locale to use -
      - -
    - - - - - - - - - - -
    - - -

    setRenderer

    -
    void setRenderer(<Object> r)
    - -
      Sets the renderer to use.
    - - - - -
      - Parameters: - -
        r - The renderer to use -
      - -
    - - - - - - - - - - -
    - - -

    setTimeZone

    -
    void setTimeZone(tz)
    - -
      Sets the locale to use within this calendar object
    - - - - -
      - Parameters: - -
        loc - The locale to use -
      - -
    - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Date.html b/modules/jala/docs/jala.Date.html deleted file mode 100644 index 1c371558..00000000 --- a/modules/jala/docs/jala.Date.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - -jala.Date - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Date

    -
    Object
    -   |
    -   +--jala.Date
    -
    - - -
    -
    - -
    class - jala.Date - - -
    - -

    -
    This class provides various convenience - methods for rendering purposes. -
    Defined in Date.js

    -

    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Date.Calendar
    -  - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Date - - () - -
    -             - Constructs a new Renderings object. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - renderEditor(<String> prefix, <Date> date, <Object> fmt) - -
    -            - Renders a timestamp as set of DropDown boxes, following the - format passed as argument. -
    - -  String - - - - - renderEditorAsString(prefix, date, pattern) - -
    -            - Returns a timestamp as set of dropdown-boxes -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Date

    -
    jala.Date()
    - - -
      - Constructs a new Renderings object. -
    - - - - - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    renderEditor

    -
    void renderEditor(<String> prefix, <Date> date, <Object> fmt)
    - -
      Renders a timestamp as set of DropDown boxes, following the - format passed as argument. Every <select> - item is prefixed with a string so that it can be retrieved - easily from the values of a submitted POST request.
    - - - - -
      - Parameters: - -
        prefix - The prefix to use for all dropdown boxes, eg. "postdate" -
      - -
        date - A Date object to use as preselection (optional) -
      - -
        fmt - Array containing one parameter object for every single select box that should be rendered, with the following properties set:
        • pattern - The date format pattern that should be rendered. Valid patterns are: "dd", "MM", "yyyy", "HH", "ss".
        • firstOption - The string to use as first option, eg.: "choose a day"
        -
      - -
    - - - - - - - - -
    - - -

    renderEditorAsString

    -
    String renderEditorAsString(prefix, date, pattern)
    - -
      Returns a timestamp as set of dropdown-boxes
    - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.DnsClient.Record.html b/modules/jala/docs/jala.DnsClient.Record.html deleted file mode 100644 index ea3fdd72..00000000 --- a/modules/jala/docs/jala.DnsClient.Record.html +++ /dev/null @@ -1,484 +0,0 @@ - - - - - -jala.DnsClient.Record - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.DnsClient.Record

    -
    Object
    -   |
    -   +--jala.DnsClient.Record
    -
    - - -
    -
    - -
    class - jala.DnsClient.Record - - -
    - -

    -
    Instances of this class wrap record data as received - from the nameserver. -
    Defined in DnsClient.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Stringcname -
    -           The CNAME of this record.
    -  Stringemail -
    -           The email address responsible for a name server.
    -  Stringhost -
    -           The name of the host.
    -  StringipAddress -
    -           The IP address of the host.
    -  Stringmx -
    -           The name of the mail exchanging server.
    -  Stringtext -
    -           Descriptive text as received from the nameserver.
    -  Numbertype -
    -           The type of the nameserver record represented by this Answer instance.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.DnsClient.Record - - (<org.wonderly.net.dns.RR> data) - -
    -             - Constructs a new instance of jala.DnsClient.Record. -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  org.wonderly.net.dns.RR - - - - - getData() - -
    -            - Returns the wrapped nameserver record data -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    cname

    -
    String cname
    -
      - The CNAME of this record. This will only be set for records - of type CNAME - -
    -
    - - -

    email

    -
    String email
    -
      - The email address responsible for a name server. This property - will only be set for records of type SOA - -
    -
    - - -

    host

    -
    String host
    -
      - The name of the host. This will only be set for records - of type A, AAAA and NS. - -
    -
    - - -

    ipAddress

    -
    String ipAddress
    -
      - The IP address of the host. This will only be set for records - of type A and AAAA - -
    -
    - - -

    mx

    -
    String mx
    -
      - The name of the mail exchanging server. This is only set for - records of type MX - -
    -
    - - -

    text

    -
    String text
    -
      - Descriptive text as received from the nameserver. This is only - set for records of type TXT - -
    -
    - - -

    type

    -
    Number type
    -
      - The type of the nameserver record represented by this Answer instance. - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.DnsClient.Record

    -
    jala.DnsClient.Record(<org.wonderly.net.dns.RR> data)
    - - -
      - Constructs a new instance of jala.DnsClient.Record. -
    - - - -
      - Parameters: - -
        data - The data as received from the nameserver -
      - - -
    - - - - -
      - Returns: -
        - A newly constructed Record instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getData

    -
    org.wonderly.net.dns.RR getData()
    - -
      Returns the wrapped nameserver record data
    - - - - - - - -
      - Returns: -
        - The wrapped data -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.DnsClient.html b/modules/jala/docs/jala.DnsClient.html deleted file mode 100644 index 8f3d752f..00000000 --- a/modules/jala/docs/jala.DnsClient.html +++ /dev/null @@ -1,591 +0,0 @@ - - - - - -jala.DnsClient - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.DnsClient

    -
    Object
    -   |
    -   +--jala.DnsClient
    -
    - - -
    -
    - -
    class - jala.DnsClient - - -
    - -

    -
    This is a wrapper around the Dns Client by wonderly.org - providing methods for querying Dns servers. For more information - about the Java DNS client visit - https://javadns.dev.java.net/. - Please mind that the nameserver specified must accept queries on port - 53 TCP (the Java DNS client used doesn't support UDP nameserver queries), - and that reverse lookups are not supported. -
    Defined in DnsClient.js

    -

    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.DnsClient.Record
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  StringnameServer -
    -           Contains the IP Adress/FQDN of the name server to query.
    - <static>  <final> NumberTYPE_A -
    -           The "A" record/query type.
    - <static>  <final> NumberTYPE_CNAME -
    -           The "CNAME" record/query type.
    - <static>  <final> NumberTYPE_MX -
    -           The "MX" record/query type.
    - <static>  <final> NumberTYPE_NS -
    -           The "NS" record/query type.
    - <static>  <final> NumberTYPE_PTR -
    -           The "PTR" record/query type.
    - <static>  <final> NumberTYPE_SOA -
    -           The "SOA" record/query type.
    - <static>  <final> NumberTYPE_TXT -
    -           The "TXT" record/query type.
    - <static>  <final> NumberTYPE_WKS -
    -           The "WKS" record/query type.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.DnsClient - - (<String> nameServer) - -
    -             - Constructs a new DnsClient object. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  org.wonderly.net.dns.RR - - - - - query(<String> dName, <Number> queryType) - -
    -            - Queries the nameserver for a specific domain - and the given type of record. -
    - -  org.wonderly.net.dns.RR - - - - - queryMailHost(<String> dName) - -
    -            - Convenience method to query for the MX-records - of the domain passed as argument. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    nameServer

    -
    String nameServer
    -
      - Contains the IP Adress/FQDN of the name server to query. - -
    -
    - - -

    TYPE_A

    -
    <static> <final> Number TYPE_A
    -
      - The "A" record/query type. - -
    -
    - - -

    TYPE_CNAME

    -
    <static> <final> Number TYPE_CNAME
    -
      - The "CNAME" record/query type. - -
    -
    - - -

    TYPE_MX

    -
    <static> <final> Number TYPE_MX
    -
      - The "MX" record/query type. - -
    -
    - - -

    TYPE_NS

    -
    <static> <final> Number TYPE_NS
    -
      - The "NS" record/query type. - -
    -
    - - -

    TYPE_PTR

    -
    <static> <final> Number TYPE_PTR
    -
      - The "PTR" record/query type. - -
    -
    - - -

    TYPE_SOA

    -
    <static> <final> Number TYPE_SOA
    -
      - The "SOA" record/query type. - -
    -
    - - -

    TYPE_TXT

    -
    <static> <final> Number TYPE_TXT
    -
      - The "TXT" record/query type. - -
    -
    - - -

    TYPE_WKS

    -
    <static> <final> Number TYPE_WKS
    -
      - The "WKS" record/query type. - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.DnsClient

    -
    jala.DnsClient(<String> nameServer)
    - - -
      - Constructs a new DnsClient object. -
    - - - -
      - Parameters: - -
        nameServer - IP-Address or FQDN of nameserver to query -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    query

    -
    org.wonderly.net.dns.RR query(<String> dName, <Number> queryType)
    - -
      Queries the nameserver for a specific domain - and the given type of record.
    - - - - -
      - Parameters: - -
        dName - The domain name to query for -
      - -
        queryType - The type of records to retrieve -
      - -
    - - - - -
      - Returns: -
        - The records retrieved from the nameserver -
      -
    - - - - - -
    - - -

    queryMailHost

    -
    org.wonderly.net.dns.RR queryMailHost(<String> dName)
    - -
      Convenience method to query for the MX-records - of the domain passed as argument.
    - - - - -
      - Parameters: - -
        dName - The domain name to query for -
      - -
    - - - - -
      - Returns: -
        - The records retrieved from the nameserver -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Button.html b/modules/jala/docs/jala.Form.Component.Button.html deleted file mode 100644 index b863fff4..00000000 --- a/modules/jala/docs/jala.Form.Component.Button.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - -jala.Form.Component.Button - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Button

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Button
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Form.Component.Submit -
    -
    - - -
    -
    - -
    class - jala.Form.Component.Button - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders a button. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Button - - (<String> name) - -
    -             - Creates a new Button component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - render(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a button to the response. -
    - -  Object - - - - - renderControls(attr, value) - -
    -            - Creates a new attribute object for this button. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, checkRequirements, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Button

    -
    jala.Form.Component.Button(<String> name)
    - - -
      - Creates a new Button component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Button component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    render

    -
    void render(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a button to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - -

    renderControls

    -
    Object renderControls(attr, value)
    - -
      Creates a new attribute object for this button.
    - - - - - - - -
      - Returns: -
        - Object with all attributes set for this button. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Checkbox.html b/modules/jala/docs/jala.Form.Component.Checkbox.html deleted file mode 100644 index 283c7603..00000000 --- a/modules/jala/docs/jala.Form.Component.Checkbox.html +++ /dev/null @@ -1,460 +0,0 @@ - - - - - -jala.Form.Component.Checkbox - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Checkbox

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Checkbox
    -
    - - -
    -
    - -
    class - jala.Form.Component.Checkbox - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - checkbox. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Checkbox - - (<String> name) - -
    -             - Creates a new Checkbox component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Validates user input from checkbox. -
    - -  Number - - - - - parseValue(<Object> reqData) - -
    -            - Parses the string input from the form. -
    - -  void - - - - - renderControls(<Object> attr, <Object> value, reqData) - -
    -            - Renders an checkbox to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Checkbox

    -
    jala.Form.Component.Checkbox(<String> name)
    - - -
      - Creates a new Checkbox component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Checkbox component instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Validates user input from checkbox.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - null if everything is ok or string containing error message -
      -
    - - - - - -
    - - -

    parseValue

    -
    Number parseValue(<Object> reqData)
    - -
      Parses the string input from the form. For a checked box, the value is 1, - for an unchecked box the value is 0.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - parsed value -
      -
    - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, reqData)
    - -
      Renders an checkbox to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Date.html b/modules/jala/docs/jala.Form.Component.Date.html deleted file mode 100644 index 62a7abd3..00000000 --- a/modules/jala/docs/jala.Form.Component.Date.html +++ /dev/null @@ -1,463 +0,0 @@ - - - - - -jala.Form.Component.Date - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Date

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Date
    -
    - - -
    -
    - -
    class - jala.Form.Component.Date - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - date editor. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Date - - (<String> name) - -
    -             - Constructs a new Date component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Validates user input from a date editor. -
    - -  Date - - - - - parseValue(<Object> reqData) - -
    -            - Parses the string input from the form and converts it to a date object. -
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a textarea tag to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Date

    -
    jala.Form.Component.Date(<String> name)
    - - -
      - Constructs a new Date component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Date component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Validates user input from a date editor.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - null if everything is ok or string containing error message -
      -
    - - - - - -
    - - -

    parseValue

    -
    Date parseValue(<Object> reqData)
    - -
      Parses the string input from the form and converts it to a date object. - Throws an error if the string cannot be parsed.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - parsed date value -
      -
    - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a textarea tag to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Fieldset.html b/modules/jala/docs/jala.Form.Component.Fieldset.html deleted file mode 100644 index 9f581f95..00000000 --- a/modules/jala/docs/jala.Form.Component.Fieldset.html +++ /dev/null @@ -1,419 +0,0 @@ - - - - - -jala.Form.Component.Fieldset - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Fieldset

    -
    Object
    -   |
    -   +--jala.Form.Component.Fieldset
    -
    - - -
    -
    - -
    class - jala.Form.Component.Fieldset - - -
    - -

    -
    Instances of this class represent a form fieldset containing - numerous form components -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Fieldset - - (<String> name) - -
    -             - Constructs a new Fieldset instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - render() - -
    -            - Renders all components within the fieldset. -
    - -  void - - - - - save(<jala.Form.Tracker> tracker, <Object> destObj) - -
    -            - Saves all components within the fieldset. -
    - -  void - - - - - validate(<jala.Form.Tracker> tracker) - -
    -            - Validates all components within the fieldset. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Fieldset

    -
    jala.Form.Component.Fieldset(<String> name)
    - - -
      - Constructs a new Fieldset instance -
    - - - -
      - Parameters: - -
        name - The name of the fieldset -
      - - -
    - - - - -
      - Returns: -
        - A newly created Fieldset instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    render

    -
    void render()
    - -
      Renders all components within the fieldset.
    - - - - - - - - - - - -
    - - -

    save

    -
    void save(<jala.Form.Tracker> tracker, <Object> destObj)
    - -
      Saves all components within the fieldset.
    - - - - -
      - Parameters: - -
        tracker - -
      - -
        destObj - -
      - -
    - - - - - - - - -
    - - -

    validate

    -
    void validate(<jala.Form.Tracker> tracker)
    - -
      Validates all components within the fieldset.
    - - - - -
      - Parameters: - -
        tracker - -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.File.html b/modules/jala/docs/jala.Form.Component.File.html deleted file mode 100644 index e218bfa9..00000000 --- a/modules/jala/docs/jala.Form.Component.File.html +++ /dev/null @@ -1,425 +0,0 @@ - - - - - -jala.Form.Component.File - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.File

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.File
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Form.Component.Image -
    -
    - - -
    -
    - -
    class - jala.Form.Component.File - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - file upload. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.File - - (<String> name) - -
    -             - Creates a new File component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Validates a file upload by making sure it's there (if REQUIRE is set), - checking the file size, the content type and by trying to construct an image. -
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a file input tag to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.File

    -
    jala.Form.Component.File(<String> name)
    - - -
      - Creates a new File component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created File component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Validates a file upload by making sure it's there (if REQUIRE is set), - checking the file size, the content type and by trying to construct an image.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
        tracker - jala.Form.Tracker object storing possible error messages -
      - -
    - - - - -
      - Returns: -
        - null if everything is ok or string containing error message -
      -
    - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a file input tag to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Hidden.html b/modules/jala/docs/jala.Form.Component.Hidden.html deleted file mode 100644 index 0b2e631f..00000000 --- a/modules/jala/docs/jala.Form.Component.Hidden.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - -jala.Form.Component.Hidden - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Hidden

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Hidden
    -
    - - -
    -
    - -
    class - jala.Form.Component.Hidden - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - hidden input tag. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Hidden - - (<String> name) - -
    -             - Constructs a newly created Hidden component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - render() - -
    -            - Renders this component directly to response. -
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a hidden input tag to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, checkRequirements, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Hidden

    -
    jala.Form.Component.Hidden(<String> name)
    - - -
      - Constructs a newly created Hidden component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Hidden component instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    render

    -
    void render()
    - -
      Renders this component directly to response. For a hidden tag, this is - just an input element, no div tag or anything.
    - - - - - - - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a hidden input tag to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Image.html b/modules/jala/docs/jala.Form.Component.Image.html deleted file mode 100644 index bf6833a0..00000000 --- a/modules/jala/docs/jala.Form.Component.Image.html +++ /dev/null @@ -1,376 +0,0 @@ - - - - - -jala.Form.Component.Image - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Image

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.File
    -               |
    -               +--jala.Form.Component.Image
    -
    - - -
    -
    - -
    class - jala.Form.Component.Image - -
    extends jala.Form.Component.File - - -
    - -

    -
    Subclass of jala.Form.Component.File which renders a file upload - and validates uploaded files as images. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Image - - () - -
    -             - Creates a new Image component instance -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Validates an image upload by making sure it's there (if REQUIRE is set), - checking the file size, the content type and by trying to construct an image. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.File
    - -renderControls -
    -  - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Image

    -
    jala.Form.Component.Image()
    - - -
      - Creates a new Image component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Image component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Validates an image upload by making sure it's there (if REQUIRE is set), - checking the file size, the content type and by trying to construct an image. - If the file is an image, width and height limitations set by require are - checked.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Input.html b/modules/jala/docs/jala.Form.Component.Input.html deleted file mode 100644 index a0d3131b..00000000 --- a/modules/jala/docs/jala.Form.Component.Input.html +++ /dev/null @@ -1,1258 +0,0 @@ - - - - - -jala.Form.Component.Input - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Input

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Form.Component.Hidden, jala.Form.Component.Checkbox, jala.Form.Component.File, jala.Form.Component.Password, jala.Form.Component.Button, jala.Form.Component.Select, jala.Form.Component.Textarea, jala.Form.Component.Date -
    -
    - - -
    -
    - -
    class - jala.Form.Component.Input - - -
    - -

    -
    Instances of this class represent a single form input field. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Input - - (<String> name) - -
    -             - Creates a new input component instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkLength(<Object> reqData) - -
    -            - Checks user input for maximum length, minimum length and require - if the corresponding options have been set using the require method. -
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Checks user input against options set using the require method. -
    - -  void - - - - - class_macro() - -
    -            - Renders this component's class name. -
    - -  void - - - - - controls_macro() - -
    -            - Renders the control(s) of this component -
    - -  void - - - - - error_macro() - -
    -            - Renders this component's error message (if set) directly to response -
    - -  Object - - - - - getControlAttributes() - -
    -            - Creates a new attribute object for this element. -
    - -  String|Number|Date - - - - - getValue() - -
    -            - Retrieves the property which is edited by this component. -
    - -  void - - - - - help_macro() - -
    -            - Renders this component's help text, if set. -
    - -  void - - - - - id_macro() - -
    -            - Renders this component's id -
    - -  void - - - - - label_macro() - -
    -            - Renders this component's label. -
    - -  void - - - - - name_macro() - -
    -            - Renders this component's name -
    - -  Object - - - - - parseValue(<Object> reqData) - -
    -            - Parses the string input from the form and creates the datatype that - is edited with this component. -
    - -  void - - - - - render() - -
    -            - Renders this component including label, error and help messages directly - to response. -
    - -  void - - - - - render_macro() - -
    -            - Renders this component including label, error and help messages - directly to response -
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders the html form elements to the response. -
    - -  String - - - - - renderError() - -
    -            - If the error tracker holds an error message for this component, - it is wrapped in a div-tag and returned as a string. -
    - -  String - - - - - renderHelp() - -
    -            - If this component contains a help message, it is wrapped in - a div-tag and returned as a string. -
    - -  String - - - - - renderLabel() - -
    -            - Returns the rendered label of this component -
    - -  void - - - - - save(<jala.Form.Tracker> tracker, <Object> destObj) - -
    -            - Saves the parsed value using setValue. -
    - -  Object - - - - - setValue(<Object> destObj, <Object> value) - -
    -            - Sets a property of the object passed as argument to the given value. -
    - -  void - - - - - type_macro() - -
    -            - Renders this component's type -
    - -  void - - - - - validate(<jala.Form.Tracker> tracker) - -
    -            - Validates the input provided to this component. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Input

    -
    jala.Form.Component.Input(<String> name)
    - - -
      - Creates a new input component instance. -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html control. -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkLength

    -
    String checkLength(<Object> reqData)
    - -
      Checks user input for maximum length, minimum length and require - if the corresponding options have been set using the require method.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - String containing error message or null if everything is ok. -
      -
    - - - - - - - -
    - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Checks user input against options set using the require method.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - String containing error message or null if everything is ok. -
      -
    - - - - - - - -
    - - -

    class_macro

    -
    void class_macro()
    - -
      Renders this component's class name. - Note that this is just the class name that has been explicitly - assigned using setClassName.
    - - - - - - - - - - - - - -
    - - -

    controls_macro

    -
    void controls_macro()
    - -
      Renders the control(s) of this component
    - - - - - - - - - - - -
    - - -

    error_macro

    -
    void error_macro()
    - -
      Renders this component's error message (if set) directly to response
    - - - - - - - - - - - -
    - - -

    getControlAttributes

    -
    Object getControlAttributes()
    - -
      Creates a new attribute object for this element.
    - - - - - - - -
      - Returns: -
        - Object with properties id, name, class -
      -
    - - - - - -
    - - -

    getValue

    -
    String|Number|Date getValue()
    - -
      Retrieves the property which is edited by this component. -
        -
      • If no getter is given, the method returns the primitive property - of the data object with the same name as the component.
      • -
      • If a getter function is defined, it is executed with the scope - of the data object and the return value is used as default value. - The name of the component is passed to the getter function - as an argument.
      • -
    - - - - - - - -
      - Returns: -
        - The value of the property -
      -
    - - - - - -
    - - -

    help_macro

    -
    void help_macro()
    - -
      Renders this component's help text, if set.
    - - - - - - - - - - - -
    - - -

    id_macro

    -
    void id_macro()
    - -
      Renders this component's id
    - - - - - - - - - - - - - -
    - - -

    label_macro

    -
    void label_macro()
    - -
      Renders this component's label.
    - - - - - - - - - - - -
    - - -

    name_macro

    -
    void name_macro()
    - -
      Renders this component's name
    - - - - - - - - - - - -
    - - -

    parseValue

    -
    Object parseValue(<Object> reqData)
    - -
      Parses the string input from the form and creates the datatype that - is edited with this component. For the input component this method - is not of much use, but subclasses that edit other datatypes may use - it. For example, a date editor should convert the user input from string - to a date object.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - parsed value -
      -
    - - - - - -
    - - -

    render

    -
    void render()
    - -
      Renders this component including label, error and help messages directly - to response.
    - - - - - - - - - - - -
    - - -

    render_macro

    -
    void render_macro()
    - -
      Renders this component including label, error and help messages - directly to response
    - - - - - - - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders the html form elements to the response. - This method shall be overridden by subclasses of input component.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for the html form elements. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - -

    renderError

    -
    String renderError()
    - -
      If the error tracker holds an error message for this component, - it is wrapped in a div-tag and returned as a string.
    - - - - - - - -
      - Returns: -
        - Rendered string -
      -
    - - - - - -
    - - -

    renderHelp

    -
    String renderHelp()
    - -
      If this component contains a help message, it is wrapped in - a div-tag and returned as a string.
    - - - - - - - -
      - Returns: -
        - The rendered help message -
      -
    - - - - - -
    - - -

    renderLabel

    -
    String renderLabel()
    - -
      Returns the rendered label of this component
    - - - - - - - -
      - Returns: -
        - The rendered label of this component -
      -
    - - - - - -
    - - -

    save

    -
    void save(<jala.Form.Tracker> tracker, <Object> destObj)
    - -
      Saves the parsed value using setValue.
    - - - - -
      - Parameters: - -
        tracker - Tracker object collecting request data, error messages and parsed values. -
      - -
        destObj - (optional) object whose values will be changed. -
      - -
    - - - - - - - - - - -
    - - -

    setValue

    -
    Object setValue(<Object> destObj, <Object> value)
    - -
      Sets a property of the object passed as argument to the given value. -
    • If no setter is set at the component, the primitive property - of the data object is changed.
    • -
    • If a setter function is defined it is executed with the data object - as scope and with the name and new value provided as arguments
    • -
    • If the setter is explicitly set to null, no changes are made at all.
    - - - - -
      - Parameters: - -
        destObj - (optional) object whose values will be changed. -
      - -
        value - The value to set the property to -
      - -
    - - - - -
      - Returns: -
        - True in case the update was successful, false otherwise. -
      -
    - - - - - - - -
    - - -

    type_macro

    -
    void type_macro()
    - -
      Renders this component's type
    - - - - - - - - - - - -
    - - -

    validate

    -
    void validate(<jala.Form.Tracker> tracker)
    - -
      Validates the input provided to this component. First, - checkRequirements is called. If no error occurs, the input - is parsed using parseValue and passed on to the validator - function.
    - - - - -
      - Parameters: - -
        tracker - Tracker object collecting request data, error messages and parsed values. -
      - -
    - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Password.html b/modules/jala/docs/jala.Form.Component.Password.html deleted file mode 100644 index f450869a..00000000 --- a/modules/jala/docs/jala.Form.Component.Password.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - -jala.Form.Component.Password - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Password

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Password
    -
    - - -
    -
    - -
    class - jala.Form.Component.Password - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - password input tag. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Password - - (<String> name) - -
    -             - Constructs a newly created Password component instance -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a password input tag to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, checkRequirements, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Password

    -
    jala.Form.Component.Password(<String> name)
    - - -
      - Constructs a newly created Password component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Password component instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a password input tag to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Radio.html b/modules/jala/docs/jala.Form.Component.Radio.html deleted file mode 100644 index 117dcd14..00000000 --- a/modules/jala/docs/jala.Form.Component.Radio.html +++ /dev/null @@ -1,431 +0,0 @@ - - - - - -jala.Form.Component.Radio - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Radio

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Select
    -               |
    -               +--jala.Form.Component.Radio
    -
    - - -
    -
    - -
    class - jala.Form.Component.Radio - -
    extends jala.Form.Component.Select - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - set of radio buttons. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Radio - - (<String> name) - -
    -             - Creates a new Radio component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Validates user input from a set of radio buttons and makes sure that - option value list contains the user input. -
    - -  void - - - - - renderControls(<Object> attr, <Object> value) - -
    -            - Renders a set of radio buttons to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Select
    - -parseOptions, checkOptions -
    -  - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Radio

    -
    jala.Form.Component.Radio(<String> name)
    - - -
      - Creates a new Radio component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Radio component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Validates user input from a set of radio buttons and makes sure that - option value list contains the user input.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - null if everything is ok or string containing error message -
      -
    - - - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value)
    - -
      Renders a set of radio buttons to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Select.html b/modules/jala/docs/jala.Form.Component.Select.html deleted file mode 100644 index 9a4bdeea..00000000 --- a/modules/jala/docs/jala.Form.Component.Select.html +++ /dev/null @@ -1,524 +0,0 @@ - - - - - -jala.Form.Component.Select - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Select

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Select
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Form.Component.Radio -
    -
    - - -
    -
    - -
    class - jala.Form.Component.Select - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - dropdown element. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Select - - (<String> name) - -
    -             - Constructs a new Select component instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - checkOptions(<Object> reqData) - -
    -            - Checks user input for optiongroups: Unless require("checkoptions") - has ben set to false, the user input must exist in the option array. -
    - -  String - - - - - checkRequirements(<Object> reqData) - -
    -            - Validates user input from a dropdown element by making sure that - the option value list contains the user input. -
    - -  Array - - - - - parseOptions() - -
    -            - Creates an array of options for a dropdown element or a - group of radiobuttons. -
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a dropdown element to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Select

    -
    jala.Form.Component.Select(<String> name)
    - - -
      - Constructs a new Select component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Select component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    checkOptions

    -
    String checkOptions(<Object> reqData)
    - -
      Checks user input for optiongroups: Unless require("checkoptions") - has ben set to false, the user input must exist in the option array.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - null if everything is ok or string containing error message -
      -
    - - - - - -
    - - -

    checkRequirements

    -
    String checkRequirements(<Object> reqData)
    - -
      Validates user input from a dropdown element by making sure that - the option value list contains the user input.
    - - - - -
      - Parameters: - -
        reqData - request data -
      - -
    - - - - -
      - Returns: -
        - string containing error message or null if everything is ok. -
      -
    - - - - - - - -
    - - -

    parseOptions

    -
    Array parseOptions()
    - -
      Creates an array of options for a dropdown element or a - group of radiobuttons. If options field of this element's - config is an array, that array is returned. - If options is a function, its return value is returned.
    - - - - - - - -
      - Returns: -
        - array of options -
      -
    - - - - - -
    - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a dropdown element to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Skin.html b/modules/jala/docs/jala.Form.Component.Skin.html deleted file mode 100644 index 51fc872b..00000000 --- a/modules/jala/docs/jala.Form.Component.Skin.html +++ /dev/null @@ -1,344 +0,0 @@ - - - - - -jala.Form.Component.Skin - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Skin

    -
    Object
    -   |
    -   +--jala.Form.Component
    -         |
    -         +--jala.Form.Component.Skin
    -
    - - -
    -
    - -
    class - jala.Form.Component.Skin - -
    extends jala.Form.Component - - -
    - -

    -
    Subclass of jala.Form.Component that allows rendering a skin - within a form. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Skin - - (<String> name) - -
    -             - -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - render() - -
    -            - Renders the skin named by this component to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component
    - -createDomId, validate, save -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Skin

    -
    jala.Form.Component.Skin(<String> name)
    - - - - -
      - Parameters: - -
        name - The name of the component, used as the name of the skin -
      - - -
    - - - - -
      - Returns: -
        - A newly created Skin component instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    render

    -
    void render()
    - -
      Renders the skin named by this component to the response.
    - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Submit.html b/modules/jala/docs/jala.Form.Component.Submit.html deleted file mode 100644 index 07452f56..00000000 --- a/modules/jala/docs/jala.Form.Component.Submit.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - -jala.Form.Component.Submit - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Submit

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Button
    -               |
    -               +--jala.Form.Component.Submit
    -
    - - -
    -
    - -
    class - jala.Form.Component.Submit - -
    extends jala.Form.Component.Button - - -
    - -

    -
    Subclass of jala.Form.Component.Button which renders a submit button. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Submit - - (<String> name) - -
    -             - Creates a new Submit component instance -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Object - - - - - renderControls(attr, value) - -
    -            - Creates a new attribute object for this button. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Button
    - -render -
    -  - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, checkRequirements, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Submit

    -
    jala.Form.Component.Submit(<String> name)
    - - -
      - Creates a new Submit component instance -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Submit component -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    renderControls

    -
    Object renderControls(attr, value)
    - -
      Creates a new attribute object for this button.
    - - - - - - - -
      - Returns: -
        - Object with all attributes set for this button. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.Textarea.html b/modules/jala/docs/jala.Form.Component.Textarea.html deleted file mode 100644 index fd0de8c4..00000000 --- a/modules/jala/docs/jala.Form.Component.Textarea.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - -jala.Form.Component.Textarea - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component.Textarea

    -
    Object
    -   |
    -   +--jala.Form.Component.Input
    -         |
    -         +--jala.Form.Component.Textarea
    -
    - - -
    -
    - -
    class - jala.Form.Component.Textarea - -
    extends jala.Form.Component.Input - - -
    - -

    -
    Subclass of jala.Form.Component.Input which renders and validates a - textarea input field. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component.Textarea - - (<String> name) - -
    -             - Constructs a new Textarea component. -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - renderControls(<Object> attr, <Object> value, <Object> reqData) - -
    -            - Renders a textarea input field to the response. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Form.Component.Input
    - -validate, save, getValue, setValue, render, renderError, renderLabel, renderHelp, render_macro, controls_macro, error_macro, label_macro, help_macro, id_macro, name_macro, type_macro, class_macro, getControlAttributes, checkLength, checkRequirements, parseValue -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component.Textarea

    -
    jala.Form.Component.Textarea(<String> name)
    - - -
      - Constructs a new Textarea component. -
    - - - -
      - Parameters: - -
        name - Name of the component, used as name of the html controls. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Textarea component instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    renderControls

    -
    void renderControls(<Object> attr, <Object> value, <Object> reqData)
    - -
      Renders a textarea input field to the response.
    - - - - -
      - Parameters: - -
        attr - Basic attributes for this element. -
      - -
        value - Value to be used for rendering this element. -
      - -
        reqData - Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Component.html b/modules/jala/docs/jala.Form.Component.html deleted file mode 100644 index 205e8872..00000000 --- a/modules/jala/docs/jala.Form.Component.html +++ /dev/null @@ -1,550 +0,0 @@ - - - - - -jala.Form.Component - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Component

    -
    Object
    -   |
    -   +--jala.Form.Component
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Form.Component.Skin -
    -
    - - -
    -
    - -
    class - jala.Form.Component - - -
    - -

    - Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Form.Component.Fieldset
    - <static class>jala.Form.Component.Skin
    - <static class>jala.Form.Component.Input
    - <static class>jala.Form.Component.Password
    - <static class>jala.Form.Component.Hidden
    - <static class>jala.Form.Component.Textarea
    - <static class>jala.Form.Component.Date
    - <static class>jala.Form.Component.Select
    - <static class>jala.Form.Component.Radio
    - <static class>jala.Form.Component.Checkbox
    - <static class>jala.Form.Component.File
    - <static class>jala.Form.Component.Image
    - <static class>jala.Form.Component.Button
    - <static class>jala.Form.Component.Submit
    -  - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Component - - (name) - -
    -             - The abstract base class for all components. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - createDomId(<String> idPart) - -
    -            - Creates a DOM identifier based on the name of the form, - the name of the component and an additional string. -
    - -  void - - - - - render() - -
    -            - Function to render a component. -
    - -  void - - - - - save(destObj, val) - -
    -            - Function to save the data of a component. -
    - -  Object - - - - - validate(<jala.Form.Tracker> tracker) - -
    -            - Function to validate a component. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Component

    -
    jala.Form.Component(name)
    - - -
      - The abstract base class for all components. -
    - - - - - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    createDomId

    -
    String createDomId(<String> idPart)
    - -
      Creates a DOM identifier based on the name of the form, - the name of the component and an additional string. - The items will be chained using camel casing.
    - - - - -
      - Parameters: - -
        idPart - Optional string appended to component's id. -
      - -
    - - - - -
      - Returns: -
        - The DOM Id -
      -
    - - - - - -
    - - -

    render

    -
    void render()
    - -
      Function to render a component. - Subclasses of jala.Form.Component may override this function.
    - - - - - - - - - - - -
    - - -

    save

    -
    void save(destObj, val)
    - -
      Function to save the data of a component. - Subclasses of jala.Form.Component may override this function.
    - - - - - - - - - - - -
    - - -

    validate

    -
    Object validate(<jala.Form.Tracker> tracker)
    - -
      Function to validate a component. - Subclasses of jala.Form.Component may override this function.
    - - - - -
      - Parameters: - -
        tracker - object tracking errors and holding parsed values and request data. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.Tracker.html b/modules/jala/docs/jala.Form.Tracker.html deleted file mode 100644 index 90cfe375..00000000 --- a/modules/jala/docs/jala.Form.Tracker.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - -jala.Form.Tracker - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form.Tracker

    -
    Object
    -   |
    -   +--jala.Form.Tracker
    -
    - - -
    -
    - -
    class - jala.Form.Tracker - - -
    - -

    -
    Instances of this class can contain error-messages and values -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Objecterrors -
    -           A map containing error messages
    -  ObjectreqData -
    -           A map containing input from request data
    -  Objectvalues -
    -           A map containing parsed values (only for those fields that didn't - fail during checkRequirements method).
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form.Tracker - - (reqData) - -
    -             - A generic container for error-messages and values -
    - - - -  - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Number - - - - - countErrors() - -
    -            - Returns the number of components for which this instance has - tracked an error. -
    - -  Boolean - - - - - hasError() - -
    -            - Returns true if an error has been set for at least one component. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    errors

    -
    Object errors
    -
      - A map containing error messages - -
    -
    - - -

    reqData

    -
    Object reqData
    -
      - A map containing input from request data - -
    -
    - - -

    values

    -
    Object values
    -
      - A map containing parsed values (only for those fields that didn't - fail during checkRequirements method). - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form.Tracker

    -
    jala.Form.Tracker(reqData)
    - - -
      - A generic container for error-messages and values -
    - - - - - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    countErrors

    -
    Number countErrors()
    - -
      Returns the number of components for which this instance has - tracked an error.
    - - - - - - - -
      - Returns: -
        - Number of components that did not validate. -
      -
    - - - - - -
    - - -

    hasError

    -
    Boolean hasError()
    - -
      Returns true if an error has been set for at least one component.
    - - - - - - - -
      - Returns: -
        - true if form encountered an error. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Form.html b/modules/jala/docs/jala.Form.html deleted file mode 100644 index 2fffb0f8..00000000 --- a/modules/jala/docs/jala.Form.html +++ /dev/null @@ -1,2034 +0,0 @@ - - - - - -jala.Form - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Form

    -
    Object
    -   |
    -   +--jala.Form
    -
    - - -
    -
    - -
    class - jala.Form - - -
    - -

    -
    A class that renders forms, validates submitted form data and - stores the data in a specified object. -
    Defined in Form.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Form.Component
    - <static class>jala.Form.Tracker
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  SkincomponentSkin -
    -           Contains the default component skin
    -  Stringname -
    -           Readonly reference to the name of the form
    - <static>  <final> StringCHECKOPTIONS -
    -           Constant used by require function to define that a select or - radio component should validate only if the user input is contained - in the list of options provided.
    - <static>  <final> StringCONTENTTYPE -
    -           Constant used by require function to define that a file upload - component should validate only if the file's content type is - in the list of allowed content types provided.
    - <static>  helma.Htmlhtml -
    -           The HTML renderer used by jala.Form
    - <static>  <final> StringMAXHEIGHT -
    -           Constant used by require function to define that an image upload - component should validate only if the image's height is less than - the value provided.
    - <static>  <final> StringMAXLENGTH -
    -           Constant used by require function to define that a component - should not validate if userinput exceeds a maximum length.
    - <static>  <final> StringMAXWIDTH -
    -           Constant used by require function to define that an image upload - component should validate only if the image's width is less than - the value provided.
    - <static>  <final> StringMINHEIGHT -
    -           Constant used by require function to define that an image upload - component should validate only if the image's height is more than - the value provided.
    - <static>  <final> StringMINLENGTH -
    -           Constant used by require function to define that a component - should not validate if userinput is shorter than a given length.
    - <static>  <final> StringMINWIDTH -
    -           Constant used by require function to define that an image upload - component should validate only if the image's width is more than - the value provided.
    - <static>  <final> StringREQUIRE -
    -           Constant used by require function to define that a component - should validate only if the user did provide input.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Form - - (<String> name, <Object> dataObj) - -
    -             - Constructs a new Form instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - addComponent(<jala.Form.Component.Input> component) - -
    -            - Adds a component to this jala.Form instance -
    - -  String - - - - - class_macro() - -
    -            - Returns the class name of the form -
    - -  void - - - - - close_macro() - -
    -            - Writes the form closing tag to response -
    - -  Boolean - - - - - containsFileUpload() - -
    -            - Returns true if this instance of jala.Form contains at least - one component doing a file upload. -
    - -  Number - - - - - countErrors() - -
    -            - If this instance of jala.Form holds a jala.Form.Tracker - instance it returns the number of components that didn't - validate. -
    - -  String - - - - - createDomId() - -
    -            - Creates a DOM identifier based on the arguments passed. -
    - -  String - - - - - getClassName() - -
    -            - Returns the class name set for this form instance. -
    - -  Object - - - - - getDataObject() - -
    -            - Returns the data object containing the values used - for rendering the form. -
    - -  String - - - - - getErrorMessage() - -
    -            - Returns the general error message printed above the form - if any of the components didn't validate. -
    - -  jala.Form.Tracker - - - - - getTracker() - -
    -            - Returns the tracker object this form instance uses for collecting - error messages and parsed values. -
    - -  Boolean - - - - - handle(<Object> reqData, <Object> destObj) - -
    -            - Parses form input, applies check functions and stores the values - if the form does validate. -
    - -  Boolean - - - - - hasError() - -
    -            - Returns true if this instance of jala.Form holds a jala.Form.Tracker - instance and at least one error has been set on this tracker. -
    - -  String - - - - - id_macro() - -
    -            - Returns the id (equal to the name) of the form -
    - -  Array - - - - - listComponents() - -
    -            - Returns an array containing the components - of this jala.Form instance. -
    - -  String - - - - - name_macro() - -
    -            - Returns the name (equal to the id) of the form -
    - -  void - - - - - open_macro() - -
    -            - Writes the form opening tag to response -
    - -  void - - - - - render() - -
    -            - Renders this form including all components to response. -
    - -  void - - - - - render_macro() - -
    -            - Renders the whole form to response -
    - -  String - - - - - renderAsString(param) - -
    -            - renders the form as a string -
    - -  void - - - - - save(<jala.Form.Tracker> tracker, <Object> destObj) - -
    -            - Sets the parsed values on an object. -
    - -  void - - - - - setClassName(<String> newClassName) - -
    -            - Sets an extra classname for this form instance -
    - -  void - - - - - setDataObject(newDataObj) - -
    -            - Sets the data object which is being edited by this form. -
    - -  void - - - - - setErrorMessage(<String> newErrorMessage) - -
    -            - Sets the general error message printed above the form if any - of the components didn't validate. -
    - -  void - - - - - setTracker(<jala.Form.Tracker> newTracker) - -
    -            - Sets the tracker object this form instance uses for collecting - error messages and parsed values. -
    - -  jala.Form.Tracker - - - - - validate(<Object> reqData) - -
    -            - Validates user input from a submitted form by calling each - component's validate method. -
    - - <static> jala.Form - - - - - create(<Object> config, dataObj) - -
    -            - Parses a plain javascript object tree and configures a - new jala.Form instance according to the properties. -
    - - <static> void - - - - - extend(<Function> subClass, <Function> superClass) - -
    -            - Utility to set up the prototype, constructor, superclass and superconstructor - properties to support an inheritance strategy that can chain constructors and methods. -
    - - <static> String - - - - - isEmail(<String> name, <String> value, <Object> reqData, <jala.Form> formObj) - -
    -            - Static validator function to test values for being a valid email address. -
    - - <static> String - - - - - isUrl(<String> name, <String> value, <Object> reqData, <jala.Form> formObj) - -
    -            - Static validator function to test values for being a valid url. -
    - - <static> Object - - - - - propertyGetter(<String> name, value) - -
    -            - static default getter function used to return a field - from the data object. -
    - - <static> void - - - - - propertySetter(<String> name, <Object> value) - -
    -            - static default setter function used to change a field - of the data object. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    componentSkin

    -
    Skin componentSkin
    -
      - Contains the default component skin - -
    -
    - - -

    name

    -
    String name
    -
      - Readonly reference to the name of the form - -
    -
    - - -

    CHECKOPTIONS

    -
    <static> <final> String CHECKOPTIONS
    -
      - Constant used by require function to define that a select or - radio component should validate only if the user input is contained - in the list of options provided. - Value: "checkoptions" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    CONTENTTYPE

    -
    <static> <final> String CONTENTTYPE
    -
      - Constant used by require function to define that a file upload - component should validate only if the file's content type is - in the list of allowed content types provided. - Value: "contenttype" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    html

    -
    <static> helma.Html html
    -
      - The HTML renderer used by jala.Form - -
    -
    - - -

    MAXHEIGHT

    -
    <static> <final> String MAXHEIGHT
    -
      - Constant used by require function to define that an image upload - component should validate only if the image's height is less than - the value provided. - Value: "maxheight" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    MAXLENGTH

    -
    <static> <final> String MAXLENGTH
    -
      - Constant used by require function to define that a component - should not validate if userinput exceeds a maximum length. - Value: "maxlength" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    MAXWIDTH

    -
    <static> <final> String MAXWIDTH
    -
      - Constant used by require function to define that an image upload - component should validate only if the image's width is less than - the value provided. - Value: "maxwidth" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    MINHEIGHT

    -
    <static> <final> String MINHEIGHT
    -
      - Constant used by require function to define that an image upload - component should validate only if the image's height is more than - the value provided. - Value: "min-height" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    MINLENGTH

    -
    <static> <final> String MINLENGTH
    -
      - Constant used by require function to define that a component - should not validate if userinput is shorter than a given length. - Value: "minlength" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    MINWIDTH

    -
    <static> <final> String MINWIDTH
    -
      - Constant used by require function to define that an image upload - component should validate only if the image's width is more than - the value provided. - Value: "minwidth" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    REQUIRE

    -
    <static> <final> String REQUIRE
    -
      - Constant used by require function to define that a component - should validate only if the user did provide input. - Value: "require" - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Form

    -
    jala.Form(<String> name, <Object> dataObj)
    - - -
      - Constructs a new Form instance -
    - - - -
      - Parameters: - -
        name - The name of the form -
      - -
        dataObj - An optional object used to retrieve values to display in the form input fields contained in this Form instance. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Form instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    addComponent

    -
    void addComponent(<jala.Form.Component.Input> component)
    - -
      Adds a component to this jala.Form instance
    - - - - -
      - Parameters: - -
        component - -
      - -
    - - - - - - - - -
    - - -

    class_macro

    -
    String class_macro()
    - -
      Returns the class name of the form
    - - - - - - - -
      - Returns: -
        - The class name of this Form instance -
      -
    - - - - - -
    - - -

    close_macro

    -
    void close_macro()
    - -
      Writes the form closing tag to response
    - - - - - - - - - - - -
    - - -

    containsFileUpload

    -
    Boolean containsFileUpload()
    - -
      Returns true if this instance of jala.Form contains at least - one component doing a file upload.
    - - - - - - - - - - -
      - See:
        - jala.Form.Component#containsFileUpload
      -
    - - -
    - - -

    countErrors

    -
    Number countErrors()
    - -
      If this instance of jala.Form holds a jala.Form.Tracker - instance it returns the number of components that didn't - validate.
    - - - - - - - -
      - Returns: -
        - Number of components that didn't validate. -
      -
    - - - - - -
    - - -

    createDomId

    -
    String createDomId()
    - -
      Creates a DOM identifier based on the arguments passed. The - resulting Id will be prefixed with the name of the form. - All arguments will be chained using camel casing.
    - - - - - - - -
      - Returns: -
        - The DOM Id -
      -
    - - - - - -
    - - -

    getClassName

    -
    String getClassName()
    - -
      Returns the class name set for this form instance.
    - - - - - - - -
      - Returns: -
        - class name -
      -
    - - - - - -
    - - -

    getDataObject

    -
    Object getDataObject()
    - -
      Returns the data object containing the values used - for rendering the form.
    - - - - - - - -
      - Returns: -
        - The data object of this jala.Form instance -
      -
    - - - - - -
    - - -

    getErrorMessage

    -
    String getErrorMessage()
    - -
      Returns the general error message printed above the form - if any of the components didn't validate.
    - - - - - - - -
      - Returns: -
        - error message -
      -
    - - - - - -
    - - -

    getTracker

    -
    jala.Form.Tracker getTracker()
    - -
      Returns the tracker object this form instance uses for collecting - error messages and parsed values.
    - - - - - - - -
      - Returns: -
        - tracker object -
      -
    - - - - - -
    - - -

    handle

    -
    Boolean handle(<Object> reqData, <Object> destObj)
    - -
      Parses form input, applies check functions and stores the values - if the form does validate. Otherwise this method returns false - without saving so that the form can be reprinted with error messages.
    - - - - -
      - Parameters: - -
        reqData - input from form -
      - -
        destObj - object whose values should be chanegd -
      - -
    - - - - -
      - Returns: -
        - False if one of the checks failed, true if the element was saved correctly. -
      -
    - - - - - -
    - - -

    hasError

    -
    Boolean hasError()
    - -
      Returns true if this instance of jala.Form holds a jala.Form.Tracker - instance and at least one error has been set on this tracker.
    - - - - - - - -
      - Returns: -
        - true if an error has been encountered. -
      -
    - - - - - -
    - - -

    id_macro

    -
    String id_macro()
    - -
      Returns the id (equal to the name) of the form
    - - - - - - - -
      - Returns: -
        - The id of this Form instance -
      -
    - - - - - -
    - - -

    listComponents

    -
    Array listComponents()
    - -
      Returns an array containing the components - of this jala.Form instance.
    - - - - - - - -
      - Returns: -
        - The components of this jala.Form instance. -
      -
    - - - - - -
    - - -

    name_macro

    -
    String name_macro()
    - -
      Returns the name (equal to the id) of the form
    - - - - - - - -
      - Returns: -
        - The name of this Form instance -
      -
    - - - - - -
    - - -

    open_macro

    -
    void open_macro()
    - -
      Writes the form opening tag to response
    - - - - - - - - - - - -
    - - -

    render

    -
    void render()
    - -
      Renders this form including all components to response.
    - - - - - - - - - - - -
    - - -

    render_macro

    -
    void render_macro()
    - -
      Renders the whole form to response
    - - - - - - - - - - - -
    - - -

    renderAsString

    -
    String renderAsString(param)
    - -
      renders the form as a string
    - - - - - - - -
      - Returns: -
        - rendered form -
      -
    - - - - - -
    - - -

    save

    -
    void save(<jala.Form.Tracker> tracker, <Object> destObj)
    - -
      Sets the parsed values on an object. By default the internally - stored tracker and data objects are used, but those may be - overridden here.
    - - - - -
      - Parameters: - -
        tracker - (optional) tracker object holding parsed data from form input. -
      - -
        destObj - (optional) object whose values will be changed. By default the dataObj passed to the constructor or to setDataObject is used. -
      - -
    - - - - - - - - -
    - - -

    setClassName

    -
    void setClassName(<String> newClassName)
    - -
      Sets an extra classname for this form instance
    - - - - -
      - Parameters: - -
        newClassName - new classname -
      - -
    - - - - - - - - -
    - - -

    setDataObject

    -
    void setDataObject(newDataObj)
    - -
      Sets the data object which is being edited by this form. This object - is used to get the default values when first printing the form and - - if no other object is provided - receives the changed values in save.
    - - - - -
      - Parameters: - -
        dataObj - The object which is being edited by this form. -
      - -
    - - - - - - - - - - -
    - - -

    setErrorMessage

    -
    void setErrorMessage(<String> newErrorMessage)
    - -
      Sets the general error message printed above the form if any - of the components didn't validate.
    - - - - -
      - Parameters: - -
        newErrorMessage - error message -
      - -
    - - - - - - - - -
    - - -

    setTracker

    -
    void setTracker(<jala.Form.Tracker> newTracker)
    - -
      Sets the tracker object this form instance uses for collecting - error messages and parsed values.
    - - - - -
      - Parameters: - -
        newTracker - -
      - -
    - - - - - - - - -
    - - -

    validate

    -
    jala.Form.Tracker validate(<Object> reqData)
    - -
      Validates user input from a submitted form by calling each - component's validate method.
    - - - - -
      - Parameters: - -
        reqData - Optional submitted form data. If not specified req.data is used. -
      - -
    - - - - -
      - Returns: -
        - tracker object with error fields set. -
      -
    - - - - - -
    - - -

    create

    -
    <static> jala.Form create(<Object> config, dataObj)
    - -
      Parses a plain javascript object tree and configures a - new jala.Form instance according to the properties. - Propertynames are matched with constants and setter-functions, - the property "type" is used to create new component objects.
    - - - - -
      - Parameters: - -
        config - object tree containing config -
      - -
    - - - - -
      - Returns: -
        - A newly created jala.Form instance based on the config specified -
      -
    - - - - - -
    - - -

    extend

    -
    <static> void extend(<Function> subClass, <Function> superClass)
    - -
      Utility to set up the prototype, constructor, superclass and superconstructor - properties to support an inheritance strategy that can chain constructors and methods.
    - - - - -
      - Parameters: - -
        subClass - the object which inherits superClass' functions -
      - -
        superClass - the object to inherit -
      - -
    - - - - - - - - -
    - - -

    isEmail

    -
    <static> String isEmail(<String> name, <String> value, <Object> reqData, <jala.Form> formObj)
    - -
      Static validator function to test values for being a valid email address.
    - - - - -
      - Parameters: - -
        name - name of the property being validated. -
      - -
        value - value in form input -
      - -
        reqData - the whole request-data-object, in case properties depend on each other -
      - -
        formObj - instance of jala.Form -
      - -
    - - - - -
      - Returns: -
        - Error message or null -
      -
    - - - - - -
    - - -

    isUrl

    -
    <static> String isUrl(<String> name, <String> value, <Object> reqData, <jala.Form> formObj)
    - -
      Static validator function to test values for being a valid url.
    - - - - -
      - Parameters: - -
        name - name of the property being validated. -
      - -
        value - value in form input -
      - -
        reqData - the whole request-data-object, in case properties depend on each other -
      - -
        formObj - instance of jala.Form -
      - -
    - - - - -
      - Returns: -
        - Error message or null -
      -
    - - - - - -
    - - -

    propertyGetter

    -
    <static> Object propertyGetter(<String> name, value)
    - -
      static default getter function used to return a field - from the data object.
    - - - - -
      - Parameters: - -
        name - Name of the property. -
      - -
    - - - - - - - - -
    - - -

    propertySetter

    -
    <static> void propertySetter(<String> name, <Object> value)
    - -
      static default setter function used to change a field - of the data object.
    - - - - -
      - Parameters: - -
        name - Name of the property. -
      - -
        value - New value of the property. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.History.html b/modules/jala/docs/jala.History.html deleted file mode 100644 index 75d19aec..00000000 --- a/modules/jala/docs/jala.History.html +++ /dev/null @@ -1,635 +0,0 @@ - - - - - -jala.History - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.History

    -
    Object
    -   |
    -   +--jala.History
    -
    - - -
    -
    - -
    class - jala.History - - -
    - -

    -
    This class is an implementation of a Browser-like history - stack suitable to use in any Helma application. The difference - to a Browser's history is that this implementation ignores - POST requests and checks if Urls in the stack are still valid to - prevent eg. redirections to a HopObject's url that has been deleted. - Plus it is capable to create new "intermediate" history-stacks - and this way maintain a "history of histories" which is needed for - eg. editing sessions in a popup window that should use their own - request history without interfering with the history of the - main window. -
    Defined in History.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.History - - () - -
    -             - Constructs a new History object. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - add() - -
    -            - Initializes a new history stack, adds - it to the array of stacks (which makes it - the default one to use for further requests) - and records the current request Url. -
    - -  void - - - - - clear() - -
    -            - Clears the currently active history stack -
    - -  String - - - - - dump() - -
    -            - Returns the contents of all history stacks - as string -
    - -  String - - - - - peek(<Number> offset) - -
    -            - Retrieves the request Url at the given position - in the current history stack. -
    - -  String - - - - - pop(<Number> offset) - -
    -            - Retrieves the first valid request Url in history - stack starting with a given offset. -
    - -  void - - - - - push() - -
    -            - Records a request Url in the currently active - history stack. -
    - -  void - - - - - redirect(<Number> offset) - -
    -            - Redirects the client back to the first valid - request in history. -
    - -  void - - - - - remove() - -
    -            - Removes the current history stack -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.History

    -
    jala.History()
    - - -
      - Constructs a new History object. -
    - - - - - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    add

    -
    void add()
    - -
      Initializes a new history stack, adds - it to the array of stacks (which makes it - the default one to use for further requests) - and records the current request Url.
    - - - - - - - - - - - -
    - - -

    clear

    -
    void clear()
    - -
      Clears the currently active history stack
    - - - - - - - - - - - -
    - - -

    dump

    -
    String dump()
    - -
      Returns the contents of all history stacks - as string
    - - - - - - - -
      - Returns: -
        - The history stacks as string -
      -
    - - - - - -
    - - -

    peek

    -
    String peek(<Number> offset)
    - -
      Retrieves the request Url at the given position - in the current history stack. If no offset is given - the last Url in the stack is returned. This method - does not alter the stack contents!
    - - - - -
      - Parameters: - -
        offset - The index position in history stack to start searching at -
      - -
    - - - - -
      - Returns: -
        - The Url of the request -
      -
    - - - - - -
    - - -

    pop

    -
    String pop(<Number> offset)
    - -
      Retrieves the first valid request Url in history - stack starting with a given offset. The default offset is 1. - Any valid Url found is removed from the stack, therefor - this method alters the contents of the history stack.
    - - - - -
      - Parameters: - -
        offset - The index position in history stack to start searching at -
      - -
    - - - - -
      - Returns: -
        - The Url of the request -
      -
    - - - - - -
    - - -

    push

    -
    void push()
    - -
      Records a request Url in the currently active - history stack.
    - - - - - - - - - - - -
    - - -

    redirect

    -
    void redirect(<Number> offset)
    - -
      Redirects the client back to the first valid - request in history. Please mind that searching for - a valid Url starts at history.length - 2.
    - - - - -
      - Parameters: - -
        offset - The index position in the stack to start searching at -
      - -
    - - - - - - - - -
    - - -

    remove

    -
    void remove()
    - -
      Removes the current history stack
    - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.HtmlDocument.html b/modules/jala/docs/jala.HtmlDocument.html deleted file mode 100644 index 190b24e8..00000000 --- a/modules/jala/docs/jala.HtmlDocument.html +++ /dev/null @@ -1,483 +0,0 @@ - - - - - -jala.HtmlDocument - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.HtmlDocument

    -
    Object
    -   |
    -   +--jala.HtmlDocument
    -
    - - -
    -
    - -
    class - jala.HtmlDocument - - -
    - -

    -
    This class provides easy access to the elements of - an arbitrary HTML document. By using TagSoup, Dom4J and Jaxen - even invalid HTML can be parsed, turned into an object tree - and easily be processed with XPath expressions. -
    Defined in HtmlDocument.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.HtmlDocument - - (<String> source) - -
    -             - Construct a new HTML document. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Array - - - - - getAll(<String> elementName) - -
    -            - Retrieves all elements by name from the document. -
    - -  Array - - - - - getLinks() - -
    -            - Get all link elements of the HTML document. -
    - -  org.dom4j.tree.DefaultElement - - - - - scrape(<String> xpathExpr) - -
    -            - Get all document nodes from an XPath expression. -
    - -  String - - - - - toString() - -
    -            - Get a string representation of the HTML document. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.HtmlDocument

    -
    jala.HtmlDocument(<String> source)
    - - -
      - Construct a new HTML document. -
    - - - -
      - Parameters: - -
        source - The HTML source code. -
      - - -
    - - - - -
      - Returns: -
        - A new HTML document. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getAll

    -
    Array getAll(<String> elementName)
    - -
      Retrieves all elements by name from the document. - The returned object structure is compatible for usage - in jala.XmlWriter.
    - - - - -
      - Parameters: - -
        elementName - The name of the desired element -
      - -
    - - - - -
      - Returns: -
        - The list of available elements in the document -
      -
    - - - - - -
    - - -

    getLinks

    -
    Array getLinks()
    - -
      Get all link elements of the HTML document.
    - - - - - - - -
      - Returns: -
        - A list of link elements. -
      -
    - - - - - -
    - - -

    scrape

    -
    org.dom4j.tree.DefaultElement scrape(<String> xpathExpr)
    - -
      Get all document nodes from an XPath expression.
    - - - - -
      - Parameters: - -
        xpathExpr - An XPath expression. -
      - -
    - - - - -
      - Returns: -
        - A list of HTML elements. -
      -
    - - - - - -
    - - -

    toString

    -
    String toString()
    - -
      Get a string representation of the HTML document.
    - - - - - - - -
      - Returns: -
        - A string representation of the HTML document. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.I18n.html b/modules/jala/docs/jala.I18n.html deleted file mode 100644 index 633ca818..00000000 --- a/modules/jala/docs/jala.I18n.html +++ /dev/null @@ -1,951 +0,0 @@ - - - - - -jala.I18n - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.I18n

    -
    Object
    -   |
    -   +--jala.I18n
    -
    - - -
    -
    - -
    class - jala.I18n - - -
    - -

    -
    This class provides various functions and macros for - internationalization of Helma applications. -
    Defined in I18n.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.I18n - - () - -
    -             - Constructs a new instance of jala.I18n -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - formatMessage(<String> message, <Array> values) - -
    -            - Converts the message passed as argument into an instance - of java.text.MessageFormat, and formats it using the - replacement values passed. -
    - -  Object - - - - - getCatalog(locale) - -
    -            - Helper method to get the message catalog - corresponding to the actual locale. -
    - -  java.util.Locale - - - - - getLocale(localeId) - -
    -            - Returns the locale for the given id, which is expected to follow - the form language[_COUNTRY][_variant], where language - is a valid ISO Language Code (eg. -
    - -  Function - - - - - getLocaleGetter() - -
    -            - Get the method for retrieving the locale. -
    - -  Object - - - - - getMessages() - -
    -            - Get the message object. -
    - -  String - - - - - gettext(<String> key ) - -
    -            - Returns a localized message for the message key passed as - argument. -
    - -  String - - - - - markgettext(<String> key) - -
    -            - A simple proxy method which is used to mark a message string - for the i18n parser as to be translated. -
    - -  String - - - - - message_macro(param) - -
    -            - Returns a translated message. -
    - -  String - - - - - ngettext(<String> singularKey, <String> pluralKey, <Number> amount ) - -
    -            - Returns a localized message for the message key passed as - argument. -
    - -  void - - - - - setHandler(<Object> handler) - -
    -            - Set (overwrite) the default handler containing - the messages (ie. -
    - -  void - - - - - setLocaleGetter(<Function> func) - -
    -            - Set the method for retrieving the locale. -
    - -  void - - - - - setMessages(<Object> msgObject) - -
    -            - Overwrite the default object containing - the messages (ie. -
    - -  String - - - - - translate(singularKey, pluralKey, <Number> amount) - -
    -            - Tries to "translate" the given message key into a localized - message. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.I18n

    -
    jala.I18n()
    - - -
      - Constructs a new instance of jala.I18n -
    - - - - - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    formatMessage

    -
    String formatMessage(<String> message, <Array> values)
    - -
      Converts the message passed as argument into an instance - of java.text.MessageFormat, and formats it using the - replacement values passed.
    - - - - -
      - Parameters: - -
        message - The message to format -
      - -
        values - An optional array containing replacement values -
      - -
    - - - - -
      - Returns: -
        - The formatted message or, if the formatting fails, the message passed as argument. -
      -
    - - - - -
      - See:
        - http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html
      -
    - - -
    - - -

    getCatalog

    -
    Object getCatalog(locale)
    - -
      Helper method to get the message catalog - corresponding to the actual locale.
    - - - - - - - -
      - Returns: -
        - The message catalog. -
      -
    - - - - - -
    - - -

    getLocale

    -
    java.util.Locale getLocale(localeId)
    - -
      Returns the locale for the given id, which is expected to follow - the form language[_COUNTRY][_variant], where language - is a valid ISO Language Code (eg. "de"), COUNTRY a valid ISO - Country Code (eg. "AT"), and variant an identifier for the variant to use.
    - - - - - - - -
      - Returns: -
        - The locale for the given id -
      -
    - - - - - -
    - - -

    getLocaleGetter

    -
    Function getLocaleGetter()
    - -
      Get the method for retrieving the locale.
    - - - - - - - -
      - Returns: -
        - The getter method -
      -
    - - - - - -
    - - -

    getMessages

    -
    Object getMessages()
    - -
      Get the message object.
    - - - - - - - -
      - Returns: -
        - The object containing the messages -
      -
    - - - - - -
    - - -

    gettext

    -
    String gettext(<String> key )
    - -
      Returns a localized message for the message key passed as - argument. If no localization is found, the message key - is returned. Any additional arguments passed to this function - will be used as replacement values during message rendering. - To reference these values the message can contain placeholders - following "{number}" notation, where number must - match the number of the additional argument (starting with zero).
    - - - - -
      - Parameters: - -
        key - The message to localize -
      - -
    - - - - -
      - Returns: -
        - The translated message -
      -
    - - - - - - - -
    - - -

    markgettext

    -
    String markgettext(<String> key)
    - -
      A simple proxy method which is used to mark a message string - for the i18n parser as to be translated.
    - - - - -
      - Parameters: - -
        key - The message that should be seen by the i18n parser as to be translated. -
      - -
    - - - - -
      - Returns: -
        - The message in unmodified form -
      -
    - - - - - -
    - - -

    message_macro

    -
    String message_macro(param)
    - -
      Returns a translated message. The following macro attributes - are accepted: -
        -
      • text: The message to translate (required)
      • -
      • plural: The plural form of the message
      • -
      • values: A list of replacement values. Use a comma to separate more - than one value. Each value is either interpreted as a global property - (if it doesn't containg a dot) or as a property name of the given macro - handler object (eg. "user.name"). If the value of the property is a - HopObject or an Array this macro uses the size() resp. length of the - object, otherwise the string representation of the object will be used.
      • -
    - - - - - - - -
      - Returns: -
        - The translated message -
      -
    - - - - - - - -
    - - -

    ngettext

    -
    String ngettext(<String> singularKey, <String> pluralKey, <Number> amount )
    - -
      Returns a localized message for the message key passed as - argument. In contrast to gettext() this method - can handle plural forms based on the amount passed as argument. - If no localization is found, the appropriate message key is - returned. Any additional arguments passed to this function - will be used as replacement values during message rendering. - To reference these values the message can contain placeholders - following "{number}" notation, where number must - match the number of the additional argument (starting with zero).
    - - - - -
      - Parameters: - -
        singularKey - The singular message to localize -
      - -
        pluralKey - The plural form of the message to localize -
      - -
        amount - The amount which is used to determine whether the singular or plural form of the message should be returned. -
      - -
    - - - - -
      - Returns: -
        - The translated message -
      -
    - - - - - - - -
    - - -

    setHandler

    -
    void setHandler(<Object> handler)
    - -
      Set (overwrite) the default handler containing - the messages (ie. a vanilla EcmaScript object).
    - - - - -
      - Parameters: - -
        handler - The handler containing the message object -
      - -
    - - - - - - - - - - -
    - - -

    setLocaleGetter

    -
    void setLocaleGetter(<Function> func)
    - -
      Set the method for retrieving the locale.
    - - - - -
      - Parameters: - -
        func - The getter method -
      - -
    - - - - - - - - -
    - - -

    setMessages

    -
    void setMessages(<Object> msgObject)
    - -
      Overwrite the default object containing - the messages (ie. a vanilla EcmaScript object).
    - - - - -
      - Parameters: - -
        msgObject - The object containing the messages -
      - -
    - - - - - - - - -
    - - -

    translate

    -
    String translate(singularKey, pluralKey, <Number> amount)
    - -
      Tries to "translate" the given message key into a localized - message.
    - - - - -
      - Parameters: - -
        amount - A number to determine whether to use the singular or plural form of the message -
      - -
        key - The message to translate (required) -
      - -
        plural - The plural form of the message to translate -
      - -
    - - - - -
      - Returns: -
        - The localized message or the appropriate key if no localized message was found -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.ImageFilter.html b/modules/jala/docs/jala.ImageFilter.html deleted file mode 100644 index 5451df17..00000000 --- a/modules/jala/docs/jala.ImageFilter.html +++ /dev/null @@ -1,510 +0,0 @@ - - - - - -jala.ImageFilter - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.ImageFilter

    -
    Object
    -   |
    -   +--jala.ImageFilter
    -
    - - -
    -
    - -
    class - jala.ImageFilter - - -
    - -

    -
    This class provides several image manipulating - methods. Most of this filter library is based on filters created - by Janne Kipin for JAlbum. For more information have a look - at http://www.ratol.fi/~jakipina/java/ -
    Defined in ImageFilter.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.ImageFilter - - (<Object> img) - -
    -             - Constructs a new ImageFilter object -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - gaussianBlur(<Number> radius, <Number> amount) - -
    -            - Performs a gaussian blur operation on the image -
    - -  byte[] - - - - - getBytes() - -
    -            - Returns the wrapped image as byte array, to use eg. -
    - -  helma.image.ImageWrapper - - - - - getImage() - -
    -            - Returns the image that has been worked on -
    - -  void - - - - - sharpen(<Number> amount) - -
    -            - Sharpens the image using a plain sharpening kernel. -
    - -  void - - - - - unsharpMask(<Number> radius, <Number> amount) - -
    -            - Performs an unsharp mask operation on the image -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.ImageFilter

    -
    jala.ImageFilter(<Object> img)
    - - -
      - Constructs a new ImageFilter object -
    - - - -
      - Parameters: - -
        img - Either
        • an instance of helma.image.ImageWrapper
        • the path to the image file as String
        • an instance of helma.File representing the image file
        • an instance of java.io.File representing the image file
        -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    gaussianBlur

    -
    void gaussianBlur(<Number> radius, <Number> amount)
    - -
      Performs a gaussian blur operation on the image
    - - - - -
      - Parameters: - -
        radius - The radius -
      - -
        amount - The amount -
      - -
    - - - - - - - - -
    - - -

    getBytes

    -
    byte[] getBytes()
    - -
      Returns the wrapped image as byte array, to use eg. in conjunction - with res.writeBinary()
    - - - - - - - -
      - Returns: -
        - The wrapped image as byte array -
      -
    - - - - - -
    - - -

    getImage

    -
    helma.image.ImageWrapper getImage()
    - -
      Returns the image that has been worked on
    - - - - - - - -
      - Returns: -
        - An instance of helma.image.ImageWrapper -
      -
    - - - - - -
    - - -

    sharpen

    -
    void sharpen(<Number> amount)
    - -
      Sharpens the image using a plain sharpening kernel.
    - - - - -
      - Parameters: - -
        amount - The amount of sharpening to apply -
      - -
    - - - - - - - - -
    - - -

    unsharpMask

    -
    void unsharpMask(<Number> radius, <Number> amount)
    - -
      Performs an unsharp mask operation on the image
    - - - - -
      - Parameters: - -
        radius - The radius -
      - -
        amount - The amount -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.IndexManager.Job.html b/modules/jala/docs/jala.IndexManager.Job.html deleted file mode 100644 index a1db9cc8..00000000 --- a/modules/jala/docs/jala.IndexManager.Job.html +++ /dev/null @@ -1,447 +0,0 @@ - - - - - -jala.IndexManager.Job - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.IndexManager.Job

    -
    Object
    -   |
    -   +--jala.IndexManager.Job
    -
    - - -
    -
    - -
    class - jala.IndexManager.Job - - -
    - -

    -
    Instances of this class represent a single index - manipulation job to be processed by the index manager. -
    Defined in IndexManager.js

    See:

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Objectcallback -
    -           The data needed to process this job.
    -  Datecreatetime -
    -           The date and time at which this job was created.
    -  Numbererrors -
    -           An internal error counter which is increased whenever processing - the job failed.
    -  Numbertype -
    -           The type of the job
    - <static>  <final> NumberADD -
    -           Constant defining an add job
    - <static>  <final> NumberOPTIMIZE -
    -           Constant defining an optimizing job
    - <static>  <final> NumberREMOVE -
    -           Constant defining a removal job
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.IndexManager.Job - - (<Number> type, callback) - -
    -             - Creates a new Job instance. -
    - - - -  - - - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    callback

    -
    Object callback
    -
      - The data needed to process this job. For adding jobs this property - must contain the helma.Search.Document instance to add to - the index. For removal job this property must contain the unique identifier - of the document that should be removed from the index. For optimizing - jobs this property is null. - -
    -
    - - -

    createtime

    -
    Date createtime
    -
      - The date and time at which this job was created. - -
    -
    - - -

    errors

    -
    Number errors
    -
      - An internal error counter which is increased whenever processing - the job failed. - -
    -
    - - -

    type

    -
    Number type
    -
      - The type of the job - -
    -
    - - -

    ADD

    -
    <static> <final> Number ADD
    - -
    - - -

    OPTIMIZE

    -
    <static> <final> Number OPTIMIZE
    - -
    - - -

    REMOVE

    -
    <static> <final> Number REMOVE
    - -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.IndexManager.Job

    -
    jala.IndexManager.Job(<Number> type, callback)
    - - -
      - Creates a new Job instance. -
    - - - -
      - Parameters: - -
        type - The type of job, which can be either jala.IndexManager.Job.ADD, jala.IndexManager.Job.REMOVE or jala.IndexManager.Job.OPTIMIZE. -
      - -
        id - The Id of the job -
      - -
        data - The data needed to process the job. -
      - - -
    - - - - -
      - Returns: -
        - A newly created Job instance. -
      -
    - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.IndexManager.html b/modules/jala/docs/jala.IndexManager.html deleted file mode 100644 index 0c198138..00000000 --- a/modules/jala/docs/jala.IndexManager.html +++ /dev/null @@ -1,615 +0,0 @@ - - - - - -jala.IndexManager - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.IndexManager

    -
    Object
    -   |
    -   +--jala.IndexManager
    -
    - - -
    -
    - -
    class - jala.IndexManager - - -
    - -

    -
    This class basically sits on top of a helma.Search.Index instance - and provides methods for adding, removing and optimizing the underlying index. - All methods generate jobs that are put into an internal queue which is - processed asynchronously by a separate worker thread. This means all calls - to add(), remove() and optimize() will return immediately, but the changes to - the index will be done within a short delay. Please keep in mind to change the - status of this IndexManager instance to REBUILDING before starting to rebuild - the index, as this ensures that all add/remove/optimize jobs will stay in the - queue and will only be processed after switching the status back to NORMAL. - This ensures that objects that have been modified during a rebuilding process - are re-indexed properly afterwards. -
    Defined in IndexManager.js

    See:

      - helma.Search.createIndex
    -

    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.IndexManager.Job
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    - <static>  <final> NumberMAXTRIES -
    -           Constant defining the maximum number of tries to add/remove - an object to/from the underlying index.
    - <static>  <final> NumberNORMAL -
    -           Constant defining normal mode of this index manager.
    - <static>  <final> NumberREBUILDING -
    -           Constant defining rebuilding mode of this index manager.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.IndexManager - - (<String> name, <helma.File> dir, <String> lang) - -
    -             - Constructs a new IndexManager object. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Boolean - - - - - add(<helma.Search.Document> doc) - -
    -            - Queues the document object passed as argument for addition to the underlying - index. -
    - -  void - - - - - log() - -
    -            - Helper function that prefixes every log message with - the name of the IndexManager. -
    - -  Boolean - - - - - optimize() - -
    -            - Queues the optimization of the underlying index. -
    - -  Boolean - - - - - remove(<Number> id) - -
    -            - Queues the removal of all index documents whose identifier value ("id" by default) - matches the number passed as argument. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    MAXTRIES

    -
    <static> <final> Number MAXTRIES
    -
      - Constant defining the maximum number of tries to add/remove - an object to/from the underlying index. - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - -

    NORMAL

    -
    <static> <final> Number NORMAL
    - -
    - - -

    REBUILDING

    -
    <static> <final> Number REBUILDING
    -
      - Constant defining rebuilding mode of this index manager. - -

      -

      -
      See Also:
      Constant Field Values
      - - - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.IndexManager

    -
    jala.IndexManager(<String> name, <helma.File> dir, <String> lang)
    - - -
      - Constructs a new IndexManager object. -
    - - - -
      - Parameters: - -
        name - The name of the index, which is the name of the directory the index already resides or will be created in. -
      - -
        dir - The base directory where this index's directory is already existing or will be created in. -
      - -
        lang - The language of the documents in this index. This leads to the proper Lucene analyzer being used for indexing documents. -
      - - -
    - - - - - - - - -
      -See:
        - helma.Search.createIndex
      -
    - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    add

    -
    Boolean add(<helma.Search.Document> doc)
    - -
      Queues the document object passed as argument for addition to the underlying - index. This includes that all existing documents with the same identifier will - be removed before the object passed as argument is added.
    - - - - -
      - Parameters: - -
        doc - The document object that should be added to the underlying index. -
      - -
    - - - - -
      - Returns: -
        - True if the job was added successfully to the internal queue, false otherwise. -
      -
    - - - - -
      - See:
        - helma.Search.Document
      -
    - - -
    - - -

    log

    -
    void log()
    - -
      Helper function that prefixes every log message with - the name of the IndexManager.
    - - - - -
      - Parameters: - -
        level - An optional logging level. Accepted values -
      - -
        msg - The log message are "debug", "info", "warn" and "error". -
      - -
    - - - - - - - - -
    - - -

    optimize

    -
    Boolean optimize()
    - -
      Queues the optimization of the underlying index.
    - - - - - - - -
      - Returns: -
        - True if the optimizing job was added, false otherwise, which means that there is already an optimizing job waiting in the queue. -
      -
    - - - - - -
    - - -

    remove

    -
    Boolean remove(<Number> id)
    - -
      Queues the removal of all index documents whose identifier value ("id" by default) - matches the number passed as argument.
    - - - - -
      - Parameters: - -
        id - The identifier value -
      - -
    - - - - -
      - Returns: -
        - True if the removal job was added successfully to the queue, false otherwise. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.ListRenderer.ArrayList.html b/modules/jala/docs/jala.ListRenderer.ArrayList.html deleted file mode 100644 index fe0c4af7..00000000 --- a/modules/jala/docs/jala.ListRenderer.ArrayList.html +++ /dev/null @@ -1,547 +0,0 @@ - - - - - -jala.ListRenderer.ArrayList - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.ListRenderer.ArrayList

    -
    Object
    -   |
    -   +--jala.ListRenderer.ArrayList
    -
    - - -
    -
    - -
    class - jala.ListRenderer.ArrayList - - -
    - -

    -
    A simple wrapper around an array to use in conjunction - with jala.ListRenderer. This wrapper can either handle complete arrays - or subsections of an array. In the latter case the wrapper needs offset - and total size information as argument to mimick a complete array. -
    Defined in ListRenderer.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Numberlength -
    -           The length of this ArrayList instance.
    -  Numberoffset -
    -           The offset of this ArrayList instance.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.ListRenderer.ArrayList - - (<Array> arr, <Number> offset, <Number> total) - -
    -             - Creates a new ArrayList instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Object - - - - - get(<Number> idx) - -
    -            - Returns the element at the index position passed - as argument. -
    - -  Boolean - - - - - isSubset() - -
    -            - Returns true if this ArrayList is a subsection of a bigger array -
    - -  Number - - - - - size() - -
    -            - Returns the size of this ArrayList, which is either - the length of the wrapped array or the total size - passed as argument to the constructor (in case the wrapped - array is just a subsection). -
    - -  Number - - - - - subsetSize() - -
    -            - Returns the actual size of this ArrayList's wrapped array. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    length

    -
    Number length
    -
      - The length of this ArrayList instance. - -
    -
    - - -

    offset

    -
    Number offset
    -
      - The offset of this ArrayList instance. This might be > zero for - ArrayList instances wrapping just a subsection, that is - mimicking a bigger list. - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.ListRenderer.ArrayList

    -
    jala.ListRenderer.ArrayList(<Array> arr, <Number> offset, <Number> total)
    - - -
      - Creates a new ArrayList instance. -
    - - - -
      - Parameters: - -
        arr - The array (or a subsection of an array) to wrap -
      - -
        offset - An optional offset to use (mandatory if the array is just a subsection). -
      - -
        total - An optional total size of the array. This argument is mandatory if the wrapped array is just a subsection. -
      - - -
    - - - - -
      - Returns: -
        - A newly created ArrayList instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    get

    -
    Object get(<Number> idx)
    - -
      Returns the element at the index position passed - as argument. If the wrapped array is just a subsection - the index position passed will be corrected using - the offset.
    - - - - -
      - Parameters: - -
        idx - The index position of the element to return -
      - -
    - - - - -
      - Returns: -
        - The element at the given index position -
      -
    - - - - - -
    - - -

    isSubset

    -
    Boolean isSubset()
    - -
      Returns true if this ArrayList is a subsection of a bigger array
    - - - - - - - -
      - Returns: -
        - True if this ArrayList is a subsection of a bigger array -
      -
    - - - - - -
    - - -

    size

    -
    Number size()
    - -
      Returns the size of this ArrayList, which is either - the length of the wrapped array or the total size - passed as argument to the constructor (in case the wrapped - array is just a subsection).
    - - - - - - - -
      - Returns: -
        - The size of this ArrayList instance -
      -
    - - - - - -
    - - -

    subsetSize

    -
    Number subsetSize()
    - -
      Returns the actual size of this ArrayList's wrapped array.
    - - - - - - - -
      - Returns: -
        - The actual size of this ArrayList's wrapped array. -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.ListRenderer.html b/modules/jala/docs/jala.ListRenderer.html deleted file mode 100644 index 7a9324be..00000000 --- a/modules/jala/docs/jala.ListRenderer.html +++ /dev/null @@ -1,2339 +0,0 @@ - - - - - -jala.ListRenderer - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.ListRenderer

    -
    Object
    -   |
    -   +--jala.ListRenderer
    -
    - - -
    -
    - -
    class - jala.ListRenderer - - -
    - -

    -

    Defined in ListRenderer.js

    -

    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.ListRenderer.ArrayList
    -  - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    - <static>  <final> ObjectdefaultRenderer -
    -           Default Renderer object containing functions - used for rendering different list items (eg.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.ListRenderer - - (<HopObject|ArrayList|Array> coll, <Object> renderer) - -
    -             - -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Number - - - - - currentEnd_macro() - -
    -            - Returns the end item number in the current page -
    - -  Number - - - - - currentPage_macro() - -
    -            - Returns the current page number -
    - -  Number - - - - - currentStart_macro() - -
    -            - Returns the start item number in the current page -
    - -  String - - - - - getBaseHref() - -
    -            - Returns the base href of this ListRenderer instance -
    - -  HopObject|Array - - - - - getCollection() - -
    -            - Returns the collection this ListRenderer instance operates on -
    - -  Number - - - - - getCurrentPage() - -
    -            - Returns the current page index. -
    - -  Number - - - - - getEndIndex() - -
    -            - Returns the zero-based index position of the last item of the current page - in the collection this ListRenderer operates on. -
    - -  Number - - - - - getItemSkin() - -
    -            - Returns the name of the skin rendered for a single list item -
    - -  String - - - - - getList(<Object> param) - -
    -            - Returns the rendered list of collection items as string -
    - -  Number - - - - - getMaxPages() - -
    -            - Returns the maximum number of pages handled by this ListRenderer instance -
    - -  String - - - - - getNextLink(<Object> param) - -
    -            - Returns a rendered link to the previous page as string. -
    - -  String - - - - - getPageHref(<Number> page) - -
    -            - Returns the href of a page. -
    - -  String - - - - - getPageNavigation(<Object> param) - -
    -            - Returns the rendered page navigation bar as string -
    - -  Number - - - - - getPageSize() - -
    -            - Returns the number of items displayed on one page -
    - -  String - - - - - getPrevLink(<Object> param) - -
    -            - Returns a rendered link to the previous page as string. -
    - -  Object - - - - - getRenderer() - -
    -            - Returns the renderer used by this ListRenderer instance -
    - -  Number - - - - - getStartIndex() - -
    -            - Returns the zero-based index position of the first item of the current page - in the collection this ListRenderer operates on. -
    - -  Number - - - - - getTotalPages() - -
    -            - Returns the total number of pages handled by this ListRenderer instance - (which is the collection size divided by the page size). -
    - -  String - - - - - getUrlParameterName() - -
    -            - Returns the name of the URL parameter name containing the index - of the page to display -
    - -  String - - - - - getUrlParameters() - -
    -            - Returns any additional URL parameters included in every navigation link - rendered by this ListRenderer instance. -
    - -  Number - - - - - limit_macro(<Object> param) - -
    -            - Either renders the maximum number of items per page, or - sets the limit to a given number. -
    - -  String - - - - - nextLink_macro(<Object> param) - -
    -            - Returns a rendered link to the next page. -
    - -  String - - - - - pageNavigation_macro(<Object> param) - -
    -            - Returns the rendered page navigation bar. -
    - -  String - - - - - prevLink_macro(<Object> param) - -
    -            - Returns a rendered link to the previous page. -
    - -  void - - - - - render_macro(<Object> param) - -
    -            - Renders the current page of this list. -
    - -  void - - - - - renderList(<Object> param) - -
    -            - Renders the list of items for one page directly to response. -
    - -  String - - - - - renderListAsString(<Object> param) - -
    -            - Returns the rendered list of collection items as string -
    - -  void - - - - - renderNextLink(<Object> param) - -
    -            - Renders a link to the next page directly to response. -
    - -  String - - - - - renderNextLinkAsString(param) - -
    -            - Returns a rendered link to the previous page as string -
    - -  Object - - - - - renderPageNavigation(<Object> param) - -
    -            - Renders the page navigation bar directly to response. -
    - -  String - - - - - renderPageNavigationAsString(param) - -
    -            - Returns the rendered page navigation bar as string -
    - -  void - - - - - renderPrevLink(<Object> param) - -
    -            - Renders a link to the previous page directly to response. -
    - -  String - - - - - renderPrevLinkAsString(<Object> param) - -
    -            - Returns a rendered link to the previous page as string -
    - -  void - - - - - setBaseHref(<String> href) - -
    -            - Sets the base href of this ListRenderer instance. -
    - -  void - - - - - setCollection(<HopObject|ArrayList|Array> coll) - -
    -            - Sets the collection of this ListRenderer -
    - -  void - - - - - setItemSkin(<String> name) - -
    -            - Sets the name of the skin to render for every list item -
    - -  void - - - - - setMaxPages(<Number> pages) - -
    -            - Sets the maximum number of pages to display -
    - -  void - - - - - setPageSize(<Number> size) - -
    -            - Sets the number of items to display on a single page -
    - -  void - - - - - setRenderer(<Object> r) - -
    -            - Sets the renderer to be used by this ListRenderer instance -
    - -  void - - - - - setUrlParameterName(<String> name) - -
    -            - Sets the name of the URL parameter name containing the index of the page - to display -
    - -  void - - - - - setUrlParameters(<String> params) - -
    -            - Sets additional parameters to include in every navigation link -
    - -  Number - - - - - size_macro() - -
    -            - Returns the total number of items -
    - -  Number - - - - - totalPages_macro() - -
    -            - Returns the total number of pages -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    defaultRenderer

    -
    <static> <final> Object defaultRenderer
    -
      - Default Renderer object containing functions - used for rendering different list items (eg. page navigation, - prev/next links and list items). - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.ListRenderer

    -
    jala.ListRenderer(<HopObject|ArrayList|Array> coll, <Object> renderer)
    - - - - -
      - Parameters: - -
        coll - The collection this ListRenderer operates on, or - for backwards compatibility only - a parameter object containing the collection and any other optional configuration parameters. -
      - -
        renderer - An optional renderer to use. If this is set, any rendering method defined in this renderer overrides the default renderer. -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    currentEnd_macro

    -
    Number currentEnd_macro()
    - -
      Returns the end item number in the current page
    - - - - - - - -
      - Returns: -
        - The end item number in the current page -
      -
    - - - - - -
    - - -

    currentPage_macro

    -
    Number currentPage_macro()
    - -
      Returns the current page number
    - - - - - - - -
      - Returns: -
        - The current page number -
      -
    - - - - - -
    - - -

    currentStart_macro

    -
    Number currentStart_macro()
    - -
      Returns the start item number in the current page
    - - - - - - - -
      - Returns: -
        - The start item number in the current page -
      -
    - - - - - -
    - - -

    getBaseHref

    -
    String getBaseHref()
    - -
      Returns the base href of this ListRenderer instance
    - - - - - - - -
      - Returns: -
        - The base href of this ListRenderer instance -
      -
    - - - - - -
    - - -

    getCollection

    -
    HopObject|Array getCollection()
    - -
      Returns the collection this ListRenderer instance operates on
    - - - - - - - -
      - Returns: -
        - The collection of this ListRenderer -
      -
    - - - - - -
    - - -

    getCurrentPage

    -
    Number getCurrentPage()
    - -
      Returns the current page index. This is either the page url parameter - or the page number 1.
    - - - - - - - -
      - Returns: -
        - The current page number (starts with 1). -
      -
    - - - - - - - -
    - - -

    getEndIndex

    -
    Number getEndIndex()
    - -
      Returns the zero-based index position of the last item of the current page - in the collection this ListRenderer operates on.
    - - - - - - - -
      - Returns: -
        - The index position of the last item in the list -
      -
    - - - - - -
    - - -

    getItemSkin

    -
    Number getItemSkin()
    - -
      Returns the name of the skin rendered for a single list item
    - - - - - - - -
      - Returns: -
        - The name of the list item skin -
      -
    - - - - - -
    - - -

    getList

    -
    String getList(<Object> param)
    - -
      Returns the rendered list of collection items as string
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - -
      - Returns: -
        - The rendered list -
      -
    - - - - - - - -
    - - -

    getMaxPages

    -
    Number getMaxPages()
    - -
      Returns the maximum number of pages handled by this ListRenderer instance
    - - - - - - - -
      - Returns: -
        - The maximum number of pages -
      -
    - - - - - -
    - - -

    getNextLink

    -
    String getNextLink(<Object> param)
    - -
      Returns a rendered link to the previous page as string. For performance - reasons this method caches the rendered link in the local cache of this - ListRenderer instance.
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - -
      - Returns: -
        - A rendered link to the previous page -
      -
    - - - - - - - -
    - - -

    getPageHref

    -
    String getPageHref(<Number> page)
    - -
      Returns the href of a page. If no argument is given, the href - of the current page is returned. Any URL parameters set with - setUrlParameters() are added to the href.
    - - - - -
      - Parameters: - -
        page - The optional page number to include in the href. -
      - -
    - - - - -
      - Returns: -
        - The href of the page -
      -
    - - - - - - - -
    - - -

    getPageNavigation

    -
    String getPageNavigation(<Object> param)
    - -
      Returns the rendered page navigation bar as string
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - -
      - Returns: -
        - The rendered page navigation -
      -
    - - - - - - - -
    - - -

    getPageSize

    -
    Number getPageSize()
    - -
      Returns the number of items displayed on one page
    - - - - - - - -
      - Returns: -
        - The number of items displayed on a single page -
      -
    - - - - - -
    - - -

    getPrevLink

    -
    String getPrevLink(<Object> param)
    - -
      Returns a rendered link to the previous page as string. For performance - reasons this method caches the rendered link in the local cache of this - ListRenderer instance.
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - -
      - Returns: -
        - A rendered link to the previous page -
      -
    - - - - - - - -
    - - -

    getRenderer

    -
    Object getRenderer()
    - -
      Returns the renderer used by this ListRenderer instance
    - - - - - - - - - - - -
    - - -

    getStartIndex

    -
    Number getStartIndex()
    - -
      Returns the zero-based index position of the first item of the current page - in the collection this ListRenderer operates on.
    - - - - - - - -
      - Returns: -
        - The index position of the first item in the list -
      -
    - - - - - -
    - - -

    getTotalPages

    -
    Number getTotalPages()
    - -
      Returns the total number of pages handled by this ListRenderer instance - (which is the collection size divided by the page size).
    - - - - - - - -
      - Returns: -
        - The total number of pages -
      -
    - - - - - -
    - - -

    getUrlParameterName

    -
    String getUrlParameterName()
    - -
      Returns the name of the URL parameter name containing the index - of the page to display
    - - - - - - - -
      - Returns: -
        - The name of the page URL parameter name -
      -
    - - - - - -
    - - -

    getUrlParameters

    -
    String getUrlParameters()
    - -
      Returns any additional URL parameters included in every navigation link - rendered by this ListRenderer instance.
    - - - - - - - -
      - Returns: -
        - A string containing additional URL parameters -
      -
    - - - - - -
    - - -

    limit_macro

    -
    Number limit_macro(<Object> param)
    - -
      Either renders the maximum number of items per page, or - sets the limit to a given number.
    - - - - -
      - Parameters: - -
        param - Extra macro parameters:
        • to - The maximum number of items per page to be set.
        If no limit is set, this macro returns the current number of items per page. -
      - -
    - - - - -
      - Returns: -
        - The current maximum number of items per page -
      -
    - - - - - -
    - - -

    nextLink_macro

    -
    String nextLink_macro(<Object> param)
    - -
      Returns a rendered link to the next page.
    - - - - -
      - Parameters: - -
        param - Extra macro parameters:
        • type - The type of renderer to be applied.
        -
      - -
    - - - - -
      - Returns: -
        - A rendered link to the next page -
      -
    - - - - - - - -
    - - -

    pageNavigation_macro

    -
    String pageNavigation_macro(<Object> param)
    - -
      Returns the rendered page navigation bar.
    - - - - -
      - Parameters: - -
        param - Extra macro parameters:
        • type - The type of renderer to be applied.
        -
      - -
    - - - - -
      - Returns: -
        - The rendered page navigation bar -
      -
    - - - - - - - -
    - - -

    prevLink_macro

    -
    String prevLink_macro(<Object> param)
    - -
      Returns a rendered link to the previous page.
    - - - - -
      - Parameters: - -
        param - Extra macro parameters:
        • type - The type of renderer to be applied.
        -
      - -
    - - - - -
      - Returns: -
        - A rendered link to the previous page -
      -
    - - - - - - - -
    - - -

    render_macro

    -
    void render_macro(<Object> param)
    - -
      Renders the current page of this list.
    - - - - -
      - Parameters: - -
        param - Extra macro parameters:
        • skin - The name of the list skin to render for each item in the list.
        • type - The type of renderer to be applied.
        -
      - -
    - - - - - - - - - - -
    - - -

    renderList

    -
    void renderList(<Object> param)
    - -
      Renders the list of items for one page directly to response.
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - - - - - - - -
    - - -

    renderListAsString

    -
    String renderListAsString(<Object> param)
    - -
      Returns the rendered list of collection items as string
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - -
      - Returns: -
        - The rendered list -
      -
    - - - - - - - -
    - - -

    renderNextLink

    -
    void renderNextLink(<Object> param)
    - -
      Renders a link to the next page directly to response.
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - - - - - - - -
    - - -

    renderNextLinkAsString

    -
    String renderNextLinkAsString(param)
    - -
      Returns a rendered link to the previous page as string
    - - - - - - - -
      - Returns: -
        - A rendered link to the next page -
      -
    - - - - - - - -
    - - -

    renderPageNavigation

    -
    Object renderPageNavigation(<Object> param)
    - -
      Renders the page navigation bar directly to response. For performance reasons - this method caches the rendered page navigation in the local cache of this - ListRenderer instance.
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - - - - - - - -
    - - -

    renderPageNavigationAsString

    -
    String renderPageNavigationAsString(param)
    - -
      Returns the rendered page navigation bar as string
    - - - - - - - -
      - Returns: -
        - The rendered page navigation bar -
      -
    - - - - - - - -
    - - -

    renderPrevLink

    -
    void renderPrevLink(<Object> param)
    - -
      Renders a link to the previous page directly to response.
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - - - - - - - -
    - - -

    renderPrevLinkAsString

    -
    String renderPrevLinkAsString(<Object> param)
    - -
      Returns a rendered link to the previous page as string
    - - - - -
      - Parameters: - -
        param - Object containing extra parameters (e.g. from a macro call). -
      - -
    - - - - -
      - Returns: -
        - A rendered link to the previous page -
      -
    - - - - - - - -
    - - -

    setBaseHref

    -
    void setBaseHref(<String> href)
    - -
      Sets the base href of this ListRenderer instance. All links rendered - will start with the href passed as argument
    - - - - -
      - Parameters: - -
        href - The base href to use for rendering links -
      - -
    - - - - - - - - -
    - - -

    setCollection

    -
    void setCollection(<HopObject|ArrayList|Array> coll)
    - -
      Sets the collection of this ListRenderer
    - - - - -
      - Parameters: - -
        coll - The collection this ListRenderer instance should operate on -
      - -
    - - - - - - - - -
    - - -

    setItemSkin

    -
    void setItemSkin(<String> name)
    - -
      Sets the name of the skin to render for every list item
    - - - - -
      - Parameters: - -
        name - The name of the skin to render for every list item -
      - -
    - - - - - - - - -
    - - -

    setMaxPages

    -
    void setMaxPages(<Number> pages)
    - -
      Sets the maximum number of pages to display
    - - - - -
      - Parameters: - -
        pages - The maximum number of pages to display -
      - -
    - - - - - - - - -
    - - -

    setPageSize

    -
    void setPageSize(<Number> size)
    - -
      Sets the number of items to display on a single page
    - - - - -
      - Parameters: - -
        size - The number of items to display on one page -
      - -
    - - - - - - - - -
    - - -

    setRenderer

    -
    void setRenderer(<Object> r)
    - -
      Sets the renderer to be used by this ListRenderer instance
    - - - - -
      - Parameters: - -
        r - The renderer to use -
      - -
    - - - - - - - - -
    - - -

    setUrlParameterName

    -
    void setUrlParameterName(<String> name)
    - -
      Sets the name of the URL parameter name containing the index of the page - to display
    - - - - -
      - Parameters: - -
        name - The name of the page URL parameter -
      - -
    - - - - - - - - -
    - - -

    setUrlParameters

    -
    void setUrlParameters(<String> params)
    - -
      Sets additional parameters to include in every navigation link
    - - - - -
      - Parameters: - -
        params - A string to append to every navigation URL -
      - -
    - - - - - - - - -
    - - -

    size_macro

    -
    Number size_macro()
    - -
      Returns the total number of items
    - - - - - - - -
      - Returns: -
        - The total number of items in the collection this ListRenderer instance is working on -
      -
    - - - - - -
    - - -

    totalPages_macro

    -
    Number totalPages_macro()
    - -
      Returns the total number of pages
    - - - - - - - -
      - Returns: -
        - The total number of pages available -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Mp3.Id3v1.html b/modules/jala/docs/jala.Mp3.Id3v1.html deleted file mode 100644 index 21dedf33..00000000 --- a/modules/jala/docs/jala.Mp3.Id3v1.html +++ /dev/null @@ -1,1102 +0,0 @@ - - - - - -jala.Mp3.Id3v1 - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Mp3.Id3v1

    -
    Object
    -   |
    -   +--jala.Mp3.Id3v1
    -
    - - -
    -
    - -
    class - jala.Mp3.Id3v1 - - -
    - -

    -
    This class represents an Id3v1 tag. -
    Defined in Mp3.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Mp3.Id3v1 - - (audioObj) - -
    -             - Constructs a new Id3v1 tag from an Mp3 file -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - copyFrom(tag) - -
    -            - Copies standard fields from another tag. -
    - -  String - - - - - getAlbum() - -
    -            - Returns the album information of the tag. -
    - -  String - - - - - getArtist() - -
    -            - Returns the artist information of the tag. -
    - -  jala.Mp3 - - - - - getAudio() - -
    -            - Returns the wrapper for the underlying audio file. -
    - -  String - - - - - getComment() - -
    -            - Returns the comment information of the tag. -
    - -  String - - - - - getGenre() - -
    -            - Returns the genre information of the tag. -
    - -  org.farng.mp3.id3.AbstractID3v1 - - - - - getJavaObject() - -
    -            - Returns the java representation of the tag, - class depends on the actual library used. -
    - -  Object - - - - - getTextContent(<String> id) - -
    -            - This method could be used to retrieve an arbitrary field - of the underlying tag. -
    - -  String - - - - - getTitle() - -
    -            - Returns the title information of the tag. -
    - -  String - - - - - getTrackNumber() - -
    -            - Returns the track number information of the tag. -
    - -  String - - - - - getYear() - -
    -            - Returns the year information of the tag. -
    - -  void - - - - - setAlbum(<String> album) - -
    -            - Sets the album information. -
    - -  void - - - - - setArtist(<String> artist) - -
    -            - Sets the artist information. -
    - -  void - - - - - setComment(<String> comment) - -
    -            - Sets the comment -
    - -  void - - - - - setGenre(<String> genre) - -
    -            - Sets the genre information. -
    - -  void - - - - - setTextContent(<String> id, val) - -
    -            - This method could be used to set an arbitrary field - of the underlying tag. -
    - -  void - - - - - setTitle(<String> title) - -
    -            - Sets the title information -
    - -  void - - - - - setTrackNumber(<Number> trackNumber) - -
    -            - Sets the track number information. -
    - -  void - - - - - setYear(<Number> year) - -
    -            - Sets the year information. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Mp3.Id3v1

    -
    jala.Mp3.Id3v1(audioObj)
    - - -
      - Constructs a new Id3v1 tag from an Mp3 file -
    - - - -
      - Parameters: - -
        mp3File - -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    copyFrom

    -
    void copyFrom(tag)
    - -
      Copies standard fields from another tag.
    - - - - -
      - Parameters: - -
        src - object with getter methods for fields album, artist, comment, title, trackNumber, genre and year. -
      - -
    - - - - - - - - -
    - - -

    getAlbum

    -
    String getAlbum()
    - -
      Returns the album information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing album name -
      -
    - - - - - -
    - - -

    getArtist

    -
    String getArtist()
    - -
      Returns the artist information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing artist name -
      -
    - - - - - -
    - - -

    getAudio

    -
    jala.Mp3 getAudio()
    - -
      Returns the wrapper for the underlying audio file.
    - - - - - - - - - - - -
    - - -

    getComment

    -
    String getComment()
    - -
      Returns the comment information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing comment -
      -
    - - - - - -
    - - -

    getGenre

    -
    String getGenre()
    - -
      Returns the genre information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing genre name -
      -
    - - - - - -
    - - -

    getJavaObject

    -
    org.farng.mp3.id3.AbstractID3v1 getJavaObject()
    - -
      Returns the java representation of the tag, - class depends on the actual library used.
    - - - - - - - - - - - -
    - - -

    getTextContent

    -
    Object getTextContent(<String> id)
    - -
      This method could be used to retrieve an arbitrary field - of the underlying tag. For Id3v1 tags all information - is available through getter and setter methods, so this - implementation always returns null.
    - - - - -
      - Parameters: - -
        id - -
      - -
    - - - - -
      - Returns: -
        - null -
      -
    - - - - - -
    - - -

    getTitle

    -
    String getTitle()
    - -
      Returns the title information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing title -
      -
    - - - - - -
    - - -

    getTrackNumber

    -
    String getTrackNumber()
    - -
      Returns the track number information of the tag.
    - - - - - - - -
      - Returns: -
        - string representing track number or null if tag doesn't contain a track number. -
      -
    - - - - - -
    - - -

    getYear

    -
    String getYear()
    - -
      Returns the year information of the tag.
    - - - - - - - -
      - Returns: -
        - string representing year -
      -
    - - - - - -
    - - -

    setAlbum

    -
    void setAlbum(<String> album)
    - -
      Sets the album information.
    - - - - -
      - Parameters: - -
        album - -
      - -
    - - - - - - - - -
    - - -

    setArtist

    -
    void setArtist(<String> artist)
    - -
      Sets the artist information.
    - - - - -
      - Parameters: - -
        artist - -
      - -
    - - - - - - - - -
    - - -

    setComment

    -
    void setComment(<String> comment)
    - -
      Sets the comment
    - - - - -
      - Parameters: - -
        comment - -
      - -
    - - - - - - - - -
    - - -

    setGenre

    -
    void setGenre(<String> genre)
    - -
      Sets the genre information. A list of genre names that are valid - for ID3v1 tags is located in jala.Mp3.GENRES.
    - - - - -
      - Parameters: - -
        genre - -
      - -
    - - - - - - - - -
    - - -

    setTextContent

    -
    void setTextContent(<String> id, val)
    - -
      This method could be used to set an arbitrary field - of the underlying tag. For Id3v1 tags all information - is available through getter and setter methods, so this - implementation does nothing.
    - - - - -
      - Parameters: - -
        id - -
      - -
        value - -
      - -
    - - - - - - - - -
    - - -

    setTitle

    -
    void setTitle(<String> title)
    - -
      Sets the title information
    - - - - -
      - Parameters: - -
        title - -
      - -
    - - - - - - - - -
    - - -

    setTrackNumber

    -
    void setTrackNumber(<Number> trackNumber)
    - -
      Sets the track number information.
    - - - - -
      - Parameters: - -
        trackNumber - -
      - -
    - - - - - - - - -
    - - -

    setYear

    -
    void setYear(<Number> year)
    - -
      Sets the year information.
    - - - - -
      - Parameters: - -
        year - -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Mp3.Id3v2.html b/modules/jala/docs/jala.Mp3.Id3v2.html deleted file mode 100644 index b2b0bd1a..00000000 --- a/modules/jala/docs/jala.Mp3.Id3v2.html +++ /dev/null @@ -1,1733 +0,0 @@ - - - - - -jala.Mp3.Id3v2 - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Mp3.Id3v2

    -
    Object
    -   |
    -   +--jala.Mp3.Id3v2
    -
    - - -
    -
    - -
    class - jala.Mp3.Id3v2 - - -
    - -

    -
    This class represents an Id3v2 tag. -
    Defined in Mp3.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Mp3.Id3v2 - - (audioObj) - -
    -             - Constructs a new Id3v2 tag from an Mp3 file -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - copyFrom(tag) - -
    -            - Copies standard fields from another tag. -
    - -  String - - - - - getAlbum() - -
    -            - Returns the album information of the tag. -
    - -  String - - - - - getArtist() - -
    -            - Returns the artist information of the tag. -
    - -  jala.Mp3 - - - - - getAudio() - -
    -            - Returns the wrapper for the underlying audio file. -
    - -  String - - - - - getAuthor() - -
    -            - Returns the author information of the tag. -
    - -  String - - - - - getComment() - -
    -            - Returns the comment information of the tag. -
    - -  String - - - - - getCopyright() - -
    -            - Returns the copyright information of the tag. -
    - -  String - - - - - getGenre() - -
    -            - Returns the genre information of the tag. -
    - -  helma.util.MimePart - - - - - getImage(<String> pictureType) - -
    -            - Extracts the image from the tag -
    - -  org.farng.mp3.id3.AbstractID3v2 - - - - - getJavaObject() - -
    -            - returns the java representation of the tag, - class depends on the actual library used. -
    - -  String - - - - - getSubtitle() - -
    -            - Returns the subtitle information of the tag. -
    - -  Number - - - - - getSubtype() - -
    -            - Returns the version number of this id3v2 (values 2 to 4 for id3v2.2 to id3v2.4) -
    - -  String - - - - - getTextContent(idStr) - -
    -            - This method can be used to retrieve an arbitrary text frame - of the underlying tag. -
    - -  Number - - - - - getTextEncoding() - -
    -            - Returns the text encoding used when setting values. -
    - -  String - - - - - getTitle() - -
    -            - Returns the title information of the tag. -
    - -  String - - - - - getTrackNumber() - -
    -            - Returns the track number information of the tag. -
    - -  String - - - - - getUrl() - -
    -            - Returns the Url stored in this tag -
    - -  String - - - - - getYear() - -
    -            - Returns the year information of the tag. -
    - -  void - - - - - removeFromAudio() - -
    -            - Removes the tag from the audio file and - nulls out the wrapper. -
    - -  void - - - - - setAlbum(<String> album) - -
    -            - Sets the album information. -
    - -  void - - - - - setArtist(<String> artist) - -
    -            - Sets the artist information. -
    - -  void - - - - - setAuthor(<String> author) - -
    -            - Sets the author information in this tag -
    - -  void - - - - - setComment(<String> comment) - -
    -            - Sets the comment -
    - -  void - - - - - setCopyright(<String> copyright) - -
    -            - Sets the copyright information in this tag -
    - -  void - - - - - setGenre(<String> genre) - -
    -            - Sets the genre information. -
    - -  void - - - - - setImage(<Number> pictureType, <String> mimeType, <Array> byteArray) - -
    -            - adds an image to the file. -
    - -  void - - - - - setSubtitle(<String> title) - -
    -            - Sets the subtitle information -
    - -  String - - - - - setTextContent(idStr, val) - -
    -            - This method can be used to set an arbitrary field - of the underlying tag. -
    - -  void - - - - - setTextEncoding(<Number|String> encType) - -
    -            - sets the text encoding used when creating new frames - (the encoding type of old frames can't be changed with - JavaMusicTag) -
    - -  void - - - - - setTitle(<String> title) - -
    -            - Sets the title information -
    - -  void - - - - - setTrackNumber(<Number> trackNumber) - -
    -            - Sets the track number information. -
    - -  void - - - - - setUrl(<String> url, <String> desc) - -
    -            - Stores the Url passed as argument in this tag. -
    - -  void - - - - - setYear(<Number> year) - -
    -            - Sets the year information. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Mp3.Id3v2

    -
    jala.Mp3.Id3v2(audioObj)
    - - -
      - Constructs a new Id3v2 tag from an Mp3 file -
    - - - -
      - Parameters: - -
        mp3File - -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    copyFrom

    -
    void copyFrom(tag)
    - -
      Copies standard fields from another tag.
    - - - - -
      - Parameters: - -
        src - object with getter methods for fields album, artist, comment, title, trackNumber, genre and year. -
      - -
    - - - - - - - - -
    - - -

    getAlbum

    -
    String getAlbum()
    - -
      Returns the album information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing album name -
      -
    - - - - - -
    - - -

    getArtist

    -
    String getArtist()
    - -
      Returns the artist information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing artist name -
      -
    - - - - - -
    - - -

    getAudio

    -
    jala.Mp3 getAudio()
    - -
      Returns the wrapper for the underlying audio file.
    - - - - - - - - - - - -
    - - -

    getAuthor

    -
    String getAuthor()
    - -
      Returns the author information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing author information -
      -
    - - - - - -
    - - -

    getComment

    -
    String getComment()
    - -
      Returns the comment information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing comment -
      -
    - - - - - -
    - - -

    getCopyright

    -
    String getCopyright()
    - -
      Returns the copyright information of the tag.
    - - - - - - - -
      - Returns: -
        - The copyright information of the tag -
      -
    - - - - - -
    - - -

    getGenre

    -
    String getGenre()
    - -
      Returns the genre information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing genre name -
      -
    - - - - - -
    - - -

    getImage

    -
    helma.util.MimePart getImage(<String> pictureType)
    - -
      Extracts the image from the tag
    - - - - -
      - Parameters: - -
        pictureType - number describing picture type (default is 3, describing a front cover). -
      - -
    - - - - -
      - Returns: -
        - image as mime object -
      -
    - - - - - -
    - - -

    getJavaObject

    -
    org.farng.mp3.id3.AbstractID3v2 getJavaObject()
    - -
      returns the java representation of the tag, - class depends on the actual library used.
    - - - - - - - - - - - -
    - - -

    getSubtitle

    -
    String getSubtitle()
    - -
      Returns the subtitle information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing subtitle -
      -
    - - - - - -
    - - -

    getSubtype

    -
    Number getSubtype()
    - -
      Returns the version number of this id3v2 (values 2 to 4 for id3v2.2 to id3v2.4)
    - - - - - - - -
      - Returns: -
        - The version number of this Id3v2 tag -
      -
    - - - - - -
    - - -

    getTextContent

    -
    String getTextContent(idStr)
    - -
      This method can be used to retrieve an arbitrary text frame - of the underlying tag. For the list of valid identifiers - and their meaning see http://www.id3.org/ - The identifiers vary across the sub versions of id3v2 tags, - use getSubtype to make sure you use the correct version.
    - - - - -
      - Parameters: - -
        id - Frame identifier according to Id3v2 specification or shortcut as defined in jala.Mp3.FIELD_MAPPING. -
      - -
    - - - - -
      - Returns: -
        - String contained in the frame -
      -
    - - - - - - - -
    - - -

    getTextEncoding

    -
    Number getTextEncoding()
    - -
      Returns the text encoding used when setting values.
    - - - - - - - -
      - Returns: -
        - The text encoding -
      -
    - - - - - -
    - - -

    getTitle

    -
    String getTitle()
    - -
      Returns the title information of the tag.
    - - - - - - - -
      - Returns: -
        - string containing title -
      -
    - - - - - -
    - - -

    getTrackNumber

    -
    String getTrackNumber()
    - -
      Returns the track number information of the tag.
    - - - - - - - -
      - Returns: -
        - string representing track number -
      -
    - - - - - -
    - - -

    getUrl

    -
    String getUrl()
    - -
      Returns the Url stored in this tag
    - - - - - - - -
      - Returns: -
        - The url stored in this tag -
      -
    - - - - - -
    - - -

    getYear

    -
    String getYear()
    - -
      Returns the year information of the tag.
    - - - - - - - -
      - Returns: -
        - string representing year -
      -
    - - - - - -
    - - -

    removeFromAudio

    -
    void removeFromAudio()
    - -
      Removes the tag from the audio file and - nulls out the wrapper.
    - - - - - - - - - - - -
    - - -

    setAlbum

    -
    void setAlbum(<String> album)
    - -
      Sets the album information.
    - - - - -
      - Parameters: - -
        album - -
      - -
    - - - - - - - - -
    - - -

    setArtist

    -
    void setArtist(<String> artist)
    - -
      Sets the artist information.
    - - - - -
      - Parameters: - -
        artist - -
      - -
    - - - - - - - - -
    - - -

    setAuthor

    -
    void setAuthor(<String> author)
    - -
      Sets the author information in this tag
    - - - - -
      - Parameters: - -
        author - The author information to set -
      - -
    - - - - - - - - -
    - - -

    setComment

    -
    void setComment(<String> comment)
    - -
      Sets the comment
    - - - - -
      - Parameters: - -
        comment - -
      - -
    - - - - - - - - -
    - - -

    setCopyright

    -
    void setCopyright(<String> copyright)
    - -
      Sets the copyright information in this tag
    - - - - -
      - Parameters: - -
        copyright - The copyright information to set -
      - -
    - - - - - - - - -
    - - -

    setGenre

    -
    void setGenre(<String> genre)
    - -
      Sets the genre information. A list of genre names that are compatible - with ID3v1 tags is located in jala.Mp3.GENRES.
    - - - - -
      - Parameters: - -
        genre - -
      - -
    - - - - - - - - -
    - - -

    setImage

    -
    void setImage(<Number> pictureType, <String> mimeType, <Array> byteArray)
    - -
      adds an image to the file.
    - - - - -
      - Parameters: - -
        pictureType - number determining picture type -
      - -
        mimeType - mime type of image -
      - -
        byteArray - image binary data -
      - -
        desc - optional description -
      - -
    - - - - - - - - - - -
    - - -

    setSubtitle

    -
    void setSubtitle(<String> title)
    - -
      Sets the subtitle information
    - - - - -
      - Parameters: - -
        title - -
      - -
    - - - - - - - - -
    - - -

    setTextContent

    -
    String setTextContent(idStr, val)
    - -
      This method can be used to set an arbitrary field - of the underlying tag. For the list of valid identifiers - and their meaning see http://www.id3.org/ - The identifiers vary across the sub versions of id3v2 tags, - use getSubtype to make sure you use the correct version.
    - - - - -
      - Parameters: - -
        id - Frame identifier according to Id3v2 specification -
      - -
        value - -
      - -
    - - - - - - - - - - -
    - - -

    setTextEncoding

    -
    void setTextEncoding(<Number|String> encType)
    - -
      sets the text encoding used when creating new frames - (the encoding type of old frames can't be changed with - JavaMusicTag)
    - - - - -
      - Parameters: - -
        encType - the new encoding type as number or string -
      - -
    - - - - - - - - - - -
    - - -

    setTitle

    -
    void setTitle(<String> title)
    - -
      Sets the title information
    - - - - -
      - Parameters: - -
        title - -
      - -
    - - - - - - - - -
    - - -

    setTrackNumber

    -
    void setTrackNumber(<Number> trackNumber)
    - -
      Sets the track number information.
    - - - - -
      - Parameters: - -
        trackNumber - -
      - -
    - - - - - - - - -
    - - -

    setUrl

    -
    void setUrl(<String> url, <String> desc)
    - -
      Stores the Url passed as argument in this tag.
    - - - - -
      - Parameters: - -
        url - The url to store in this tag -
      - -
        desc - An optiona description of the Url -
      - -
    - - - - - - - - -
    - - -

    setYear

    -
    void setYear(<Number> year)
    - -
      Sets the year information.
    - - - - -
      - Parameters: - -
        year - -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Mp3.html b/modules/jala/docs/jala.Mp3.html deleted file mode 100644 index 0132fa7f..00000000 --- a/modules/jala/docs/jala.Mp3.html +++ /dev/null @@ -1,1481 +0,0 @@ - - - - - -jala.Mp3 - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Mp3

    -
    Object
    -   |
    -   +--jala.Mp3
    -
    - - -
    -
    - -
    class - jala.Mp3 - - -
    - -

    -
    This is a class representing an MP3 file - providing methods to access its metadata. - -
    Defined in Mp3.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Mp3.Id3v1
    - <static class>jala.Mp3.Id3v2
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Objectalbum -
    -           
    -  Objectartist -
    -           
    -  Objectcomment -
    -           
    -  Objectgenre -
    -           
    -  Objecttitle -
    -           
    -  ObjecttrackNumber -
    -           
    -  Objectyear -
    -           
    - <static>  <final> ArrayGENRES -
    -           Array defining valid genres in ID3v1
    - <static>  <final> ArrayMODES -
    -           Array defining mp3 modes.
    - <static>  <final> ArrayPICTURE_TYPES -
    -           Array defining valid picture types.
    - <static>  <final> ArrayTEXT_ENCODINGS -
    -           Array defining valid text encodings.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Mp3 - - (<String|File> file) - -
    -             - Constructs a new jala.Mp3 wrapper and - parses the header data of the MP3 file. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Object - - - - - createTag(<Object> tagClass, <Object> tagObject) - -
    -            - This method creates a new tag object, attaches it - to the file (thereby replacing an existing tag of - this type) and returns it. -
    - -  jala.Mp3.Id3v1 - - - - - createV1Tag(<Object> tagObject) - -
    -            - If the file doesn't contain an ID3v1 tag, this method - creates a new ID3v1 tag object, attaches it to the file - and returns it. -
    - -  jala.Mp3.Id3v2 - - - - - createV2Tag(<Object> tagObject) - -
    -            - If the file doesn't contain an ID3v2 tag, this method - creates a new ID3v2 tag object, attaches it to the file - and returns it. -
    - -  Number - - - - - getBitRate() - -
    -            - Returns the bit rate the file was encoded with. -
    - -  String - - - - - getChannelMode() - -
    -            - Returns the channel mode the file was encoded with. -
    - -  Number - - - - - getDuration() - -
    -            - The audio length of the file in seconds at best estimate - from the file info (method returns immediately). -
    - -  helma.File - - - - - getFile() - -
    -            - Returns a helma.File reference to the wrapped file. -
    - -  Number - - - - - getFrequency() - -
    -            - Returns the frequency the file was encoded with. -
    - -  org.farng.mp3.MP3File - - - - - getJavaObject() - -
    -            - Returns the underlying java object -
    - -  Object - - - - - getMetadata() - -
    -            - Returns a plain JavaScript object containing the values of - all fields stored in either the Id3 V1 or V2 tag -
    - -  Number - - - - - getSize() - -
    -            - Returns the file size in bytes. -
    - -  Object - - - - - getTag(tagClass) - -
    -            - Returns a tag object, type is specified using the class name - in jala.Mp3.*. -
    - -  jala.Mp3.Id3v1 - - - - - getV1Tag() - -
    -            - -
    - -  jala.Mp3.Id3v2 - - - - - getV2Tag() - -
    -            - -
    - -  Object - - - - - hasTag(tagClass) - -
    -            - Tells if the file contains a certain tag, type is specified - using the class name in jala.Mp3. -
    - -  Boolean - - - - - hasV1Tag() - -
    -            - Returns true if the file contains a ID3v1 tag. -
    - -  Boolean - - - - - hasV2Tag() - -
    -            - Returns true if the file contains a ID3v2 tag. -
    - -  Boolean - - - - - isVariableBitRate() - -
    -            - Returns true if the file is (or seems to be) encoded with - variable bit rate. -
    - -  Number - - - - - parseDuration() - -
    -            - Parses the audio file to extract the precise duration of the audio. -
    - -  void - - - - - removeTag(tagClass) - -
    -            - Removes a tag from the file, type is specified using the - class name in jala.Mp3.* -
    - -  void - - - - - removeV1Tag() - -
    -            - Removes the ID3v1 tag from the file. -
    - -  Object - - - - - removeV2Tag() - -
    -            - Removes the ID3v2 tag from the file. -
    - -  Boolean - - - - - save(<String|helma.File> outFile) - -
    -            - Writes changed metadata back to the source file or to a new file. -
    - -  void - - - - - setMetadata(<Object> metadata) - -
    -            - Stores the metadata passed as argument in the ID2 v1 and v2 tags - of the wrapped MP3 file. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    album

    -
    Object album
    -
      - - -
    -
    - - -

    artist

    -
    Object artist
    -
      - - -
    -
    - - -

    comment

    -
    Object comment
    -
      - - -
    -
    - - -

    genre

    -
    Object genre
    -
      - - -
    -
    - - -

    title

    -
    Object title
    -
      - - -
    -
    - - -

    trackNumber

    -
    Object trackNumber
    -
      - - -
    -
    - - -

    year

    -
    Object year
    -
      - - -
    -
    - - -

    GENRES

    -
    <static> <final> Array GENRES
    -
      - Array defining valid genres in ID3v1 - -
    -
    - - -

    MODES

    -
    <static> <final> Array MODES
    -
      - Array defining mp3 modes. - -
    -
    - - -

    PICTURE_TYPES

    -
    <static> <final> Array PICTURE_TYPES
    -
      - Array defining valid picture types. Note: Most image tagged files come with - one picture of picture type null! - The index position within the array defines the number used in the mp3 file. - -
    -
    - - -

    TEXT_ENCODINGS

    -
    <static> <final> Array TEXT_ENCODINGS
    -
      - Array defining valid text encodings. Note: UTF-8 is valid for v2.4 only. - UTF-16 with BOM doesn't work with Winamp etc - use UTF-16BE instead! - The index position within the array defines the number used in the mp3 file. - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Mp3

    -
    jala.Mp3(<String|File> file)
    - - -
      - Constructs a new jala.Mp3 wrapper and - parses the header data of the MP3 file. - The standard fields for a tag are accessible - as properties of the new object. -
    - - - -
      - Parameters: - -
        file - The mp3 file to be parsed, either as path string or as any kind of file object -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    createTag

    -
    Object createTag(<Object> tagClass, <Object> tagObject)
    - -
      This method creates a new tag object, attaches it - to the file (thereby replacing an existing tag of - this type) and returns it. Type is specified using - the class name in jala.Mp3.*. If a second - argument is provided, its values are copied into - the new tag.
    - - - - -
      - Parameters: - -
        tagClass - -
      - -
        tagObject - optional tag whose standard properties are copied to the new tag. -
      - -
    - - - - - - - - -
    - - -

    createV1Tag

    -
    jala.Mp3.Id3v1 createV1Tag(<Object> tagObject)
    - -
      If the file doesn't contain an ID3v1 tag, this method - creates a new ID3v1 tag object, attaches it to the file - and returns it. If a second argument is provided, its - values are copied into the new tag.
    - - - - -
      - Parameters: - -
        tagObject - optional tag whose standard properties are copied to the new tag. -
      - -
    - - - - - - - - -
    - - -

    createV2Tag

    -
    jala.Mp3.Id3v2 createV2Tag(<Object> tagObject)
    - -
      If the file doesn't contain an ID3v2 tag, this method - creates a new ID3v2 tag object, attaches it to the file - and returns it. If a second argument is provided, its - values are copied into the new tag.
    - - - - -
      - Parameters: - -
        tagObject - optional tag whose standard properties are copied to the new tag. -
      - -
    - - - - - - - - -
    - - -

    getBitRate

    -
    Number getBitRate()
    - -
      Returns the bit rate the file was encoded with.
    - - - - - - - - - - - -
    - - -

    getChannelMode

    -
    String getChannelMode()
    - -
      Returns the channel mode the file was encoded with.
    - - - - - - - - - - - -
    - - -

    getDuration

    -
    Number getDuration()
    - -
      The audio length of the file in seconds at best estimate - from the file info (method returns immediately). - This method calculates based on the bitrate. Therefore it - has to produce wrong results for files encoded with variable - bitrate (vbr). For these files parseDuration() can be used.
    - - - - - - - -
      - Returns: -
        - length in seconds -
      -
    - - - - - - - -
    - - -

    getFile

    -
    helma.File getFile()
    - -
      Returns a helma.File reference to the wrapped file.
    - - - - - - - - - - - -
    - - -

    getFrequency

    -
    Number getFrequency()
    - -
      Returns the frequency the file was encoded with.
    - - - - - - - - - - - -
    - - -

    getJavaObject

    -
    org.farng.mp3.MP3File getJavaObject()
    - -
      Returns the underlying java object
    - - - - - - - - - - - -
    - - -

    getMetadata

    -
    Object getMetadata()
    - -
      Returns a plain JavaScript object containing the values of - all fields stored in either the Id3 V1 or V2 tag
    - - - - - - - -
      - Returns: -
        - An object containing the values of all fields -
      -
    - - - - - -
    - - -

    getSize

    -
    Number getSize()
    - -
      Returns the file size in bytes.
    - - - - - - - - - - - -
    - - -

    getTag

    -
    Object getTag(tagClass)
    - -
      Returns a tag object, type is specified using the class name - in jala.Mp3.*.
    - - - - - - - - - - - -
    - - -

    getV1Tag

    -
    jala.Mp3.Id3v1 getV1Tag()
    - - - - - - - - - - - -
    - - -

    getV2Tag

    -
    jala.Mp3.Id3v2 getV2Tag()
    - - - - - - - - - - - -
    - - -

    hasTag

    -
    Object hasTag(tagClass)
    - -
      Tells if the file contains a certain tag, type is specified - using the class name in jala.Mp3.
    - - - - - - - - - - - -
    - - -

    hasV1Tag

    -
    Boolean hasV1Tag()
    - -
      Returns true if the file contains a ID3v1 tag.
    - - - - - - - - - - - -
    - - -

    hasV2Tag

    -
    Boolean hasV2Tag()
    - -
      Returns true if the file contains a ID3v2 tag.
    - - - - - - - - - - - -
    - - -

    isVariableBitRate

    -
    Boolean isVariableBitRate()
    - -
      Returns true if the file is (or seems to be) encoded with - variable bit rate. FIXME: The current implementation returned - true for all test files.
    - - - - - - - - - - - -
    - - -

    parseDuration

    -
    Number parseDuration()
    - -
      Parses the audio file to extract the precise duration of the audio. - The upside is that it works fine for files with variable bitrates. - The downside is that this action may take a few seconds depending on - the size of the audio file.
    - - - - - - - -
      - Returns: -
        - length in seconds -
      -
    - - - - - - - -
    - - -

    removeTag

    -
    void removeTag(tagClass)
    - -
      Removes a tag from the file, type is specified using the - class name in jala.Mp3.*
    - - - - - - - - - - - -
    - - -

    removeV1Tag

    -
    void removeV1Tag()
    - -
      Removes the ID3v1 tag from the file.
    - - - - - - - - - - - -
    - - -

    removeV2Tag

    -
    Object removeV2Tag()
    - -
      Removes the ID3v2 tag from the file.
    - - - - - - - - - - - -
    - - -

    save

    -
    Boolean save(<String|helma.File> outFile)
    - -
      Writes changed metadata back to the source file or to a new file.
    - - - - -
      - Parameters: - -
        outFile - (optional) save the modified file to a different file -
      - -
    - - - - -
      - Returns: -
        - true on success, false if the file contains tags that cannot be saved (Id3v2_2). -
      -
    - - - - - -
    - - -

    setMetadata

    -
    void setMetadata(<Object> metadata)
    - -
      Stores the metadata passed as argument in the ID2 v1 and v2 tags - of the wrapped MP3 file.
    - - - - -
      - Parameters: - -
        metadata - An object containing the fields to set and their values. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.PodcastWriter.html b/modules/jala/docs/jala.PodcastWriter.html deleted file mode 100644 index e0c9f295..00000000 --- a/modules/jala/docs/jala.PodcastWriter.html +++ /dev/null @@ -1,416 +0,0 @@ - - - - - -jala.PodcastWriter - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.PodcastWriter

    -
    Object
    -   |
    -   +--jala.XmlWriter
    -         |
    -         +--jala.Rss20Writer
    -               |
    -               +--jala.PodcastWriter
    -
    - - -
    -
    - -
    class - jala.PodcastWriter - -
    extends jala.Rss20Writer - - -
    - -

    -
    Class to create, modify and render standard-compliant - RSS 2.0 feeds including support for Apple's Podcast specification. -
    Defined in PodcastWriter.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    - <static>  <final> StringXMLHEADER -
    -           A typical XML header as default.
    -   - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.PodcastWriter - - (<String> header) - -
    -             - -
    - - - -  - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - addItunesCategory(<String> name, <String> subName, <jala.XmlWriter.XmlElement> parent) - -
    -            - Add an iTunes Podcast category. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.Rss20Writer
    - -getRoot, extendChannel, getChannel, setChannel, extendItem, createItem, addItem, addCategory, setImage, setTextInput -
    -  - -  - - - - - - - -
    Methods inherited from class jala.XmlWriter
    - -createElement, extend, addNamespace, write, toString, clone -
    -  - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    XMLHEADER

    -
    <static> <final> String XMLHEADER
    - -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.PodcastWriter

    -
    jala.PodcastWriter(<String> header)
    - - - - -
      - Parameters: - -
        header - Optional XML header. -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    addItunesCategory

    -
    void addItunesCategory(<String> name, <String> subName, <jala.XmlWriter.XmlElement> parent)
    - -
      Add an iTunes Podcast category.
    - - - - -
      - Parameters: - -
        name - The category's name. -
      - -
        subName - The (optional) sub-category's name. -
      - -
        parent - Optional parent element to add the category to. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.RemoteContent.html b/modules/jala/docs/jala.RemoteContent.html deleted file mode 100644 index 71fd9a62..00000000 --- a/modules/jala/docs/jala.RemoteContent.html +++ /dev/null @@ -1,892 +0,0 @@ - - - - - -jala.RemoteContent - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.RemoteContent

    -
    Object
    -   |
    -   +--helma.Http
    -         |
    -         +--jala.RemoteContent
    -
    - - -
    -
    - -
    class - jala.RemoteContent - -
    extends helma.Http - - -
    - -

    -
    API to define, fetch and update content - from a remote site. -
    Defined in RemoteContent.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    - <static>  <final> FileCACHEDIR -
    -           The default cache directory.
    - <static>  <final> intHTTP -
    -           A constant representing the HTTP retrieval method.
    - <static>  <final> StringSUFFIX -
    -           The default name of the cache directory.
    - <static>  <final> intXMLRPC -
    -           A constant representing the XML-RPC retrieval method.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.RemoteContent - - (<String> url, <Integer> method, <File> storage) - -
    -             - Construct a new remote content handler. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - clear() - -
    -            - Flushes (empties) the cached remote content. -
    - -  Object - - - - - get(<String> key) - -
    -            - Get an arbitrary property of the remote content. -
    - -  Array - - - - - getKeys() - -
    -            - Get all available property names. -
    - -  Boolean - - - - - needsUpdate() - -
    -            - Tests whether the remote content needs to be updated. -
    - -  void - - - - - setInterval(<Number> interval) - -
    -            - Set the interval the remote content's - cache is bound to be updated. -
    - -  String - - - - - toString() - -
    -            - Get a string representation of the remote content. -
    - -  String - - - - - update() - -
    -            - Get the updated and cached remote content. -
    - -  Object - - - - - valueOf() - -
    -            - Get the value of the remote content. -
    - - <static> void - - - - - exec() - -
    -            - Apply a custom method on all remote content in a file-based cache. -
    - - <static> void - - - - - flush(<File> cache) - -
    -            - Remove all remote content from a file-based cache. -
    - - <static> void - - - - - forEach(<Function> callback, <File> cache) - -
    -            - Apply a custom method on all remote content in a file-based cache. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    CACHEDIR

    -
    <static> <final> File CACHEDIR
    -
      - The default cache directory. - -
    -
    - - -

    HTTP

    -
    <static> <final> int HTTP
    - -
    - - -

    SUFFIX

    -
    <static> <final> String SUFFIX
    - -
    - - -

    XMLRPC

    -
    <static> <final> int XMLRPC
    - -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.RemoteContent

    -
    jala.RemoteContent(<String> url, <Integer> method, <File> storage)
    - - -
      - Construct a new remote content handler. -
    - - - -
      - Parameters: - -
        url - The URL string of the remote site. -
      - -
        method - The method to retrieve the remote content. -
      - -
        storage - The cache directory. -
      - - -
    - - - - -
      - Returns: -
        - A new remote content handler. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    clear

    -
    void clear()
    - -
      Flushes (empties) the cached remote content.
    - - - - - - - - - - - -
    - - -

    get

    -
    Object get(<String> key)
    - -
      Get an arbitrary property of the remote content.
    - - - - -
      - Parameters: - -
        key - The name of the property. -
      - -
    - - - - -
      - Returns: -
        - The value of the property. -
      -
    - - - - - -
    - - -

    getKeys

    -
    Array getKeys()
    - -
      Get all available property names.
    - - - - - - - -
      - Returns: -
        - The list of property names. -
      -
    - - - - - -
    - - -

    needsUpdate

    -
    Boolean needsUpdate()
    - -
      Tests whether the remote content needs to be updated.
    - - - - - - - -
      - Returns: -
        - True if the remote content needs to be updated. -
      -
    - - - - - -
    - - -

    setInterval

    -
    void setInterval(<Number> interval)
    - -
      Set the interval the remote content's - cache is bound to be updated.
    - - - - -
      - Parameters: - -
        interval - The interval value in milliseconds. -
      - -
    - - - - - - - - -
    - - -

    toString

    -
    String toString()
    - -
      Get a string representation of the remote content.
    - - - - - - - -
      - Returns: -
        - The remote content as string. -
      -
    - - - - - -
    - - -

    update

    -
    String update()
    - -
      Get the updated and cached remote content.
    - - - - - - - -
      - Returns: -
        - The content as retrieved from the remote site. -
      -
    - - - - - -
    - - -

    valueOf

    -
    Object valueOf()
    - -
      Get the value of the remote content.
    - - - - - - - -
      - Returns: -
        - The remote content including response header data. -
      -
    - - - - - -
    - - -

    exec

    -
    <static> void exec()
    - -
      Apply a custom method on all remote content in a file-based cache.
    - - - - -
      - Parameters: - -
        callback - The callback method to be executed for each remote content file. -
      - -
        cache - An optional target directory. -
      - -
    - - - - - - - - - - -
    - - -

    flush

    -
    <static> void flush(<File> cache)
    - -
      Remove all remote content from a file-based cache.
    - - - - -
      - Parameters: - -
        cache - An optional target directory. -
      - -
    - - - - - - - - -
    - - -

    forEach

    -
    <static> void forEach(<Function> callback, <File> cache)
    - -
      Apply a custom method on all remote content in a file-based cache.
    - - - - -
      - Parameters: - -
        callback - The callback method to be executed for each remote content file. -
      - -
        cache - An optional target directory. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Rss20Writer.html b/modules/jala/docs/jala.Rss20Writer.html deleted file mode 100644 index 5ceca0e8..00000000 --- a/modules/jala/docs/jala.Rss20Writer.html +++ /dev/null @@ -1,760 +0,0 @@ - - - - - -jala.Rss20Writer - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Rss20Writer

    -
    Object
    -   |
    -   +--jala.XmlWriter
    -         |
    -         +--jala.Rss20Writer
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.PodcastWriter -
    -
    - - -
    -
    - -
    class - jala.Rss20Writer - -
    extends jala.XmlWriter - - -
    - -

    -
    Class to create, modify and render standard-compliant - RSS 2.0 feeds. -
    Defined in Rss20Writer.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Rss20Writer - - (<String> header) - -
    -             - -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - addCategory(<String> name, <String> domain, <jala.XmlWriter.XmlElement> parent) - -
    -            - Add a category element to an arbitrary element. -
    - -  void - - - - - addItem(<jala.XmlWriter.XmlElement> item) - -
    -            - Add an item element to the channel element. -
    - -  jala.XmlWriter.XmlElement - - - - - createItem(<Object> data) - -
    -            - Get a new and innocent item element. -
    - -  void - - - - - extendChannel(<Array> ext) - -
    -            - Add child elements to the channel template. -
    - -  void - - - - - extendItem(<Array> ext) - -
    -            - Add child elements to the item template. -
    - -  jala.XmlWriter.XmlElement - - - - - getChannel() - -
    -            - Get the writer's channel element. -
    - -  jala.XmlWriter.XmlElement - - - - - getRoot() - -
    -            - Get the writer's root element. -
    - -  jala.XmlWriter.XmlElement - - - - - setChannel(<Object> data) - -
    -            - Populate the channel element with data. -
    - -  void - - - - - setImage(<Object> data) - -
    -            - Populate the image element with data. -
    - -  void - - - - - setTextInput(<Object> data) - -
    -            - Populate the textInput element with data. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.XmlWriter
    - -createElement, extend, addNamespace, write, toString, clone -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Rss20Writer

    -
    jala.Rss20Writer(<String> header)
    - - - - -
      - Parameters: - -
        header - Optional XML header. -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    addCategory

    -
    void addCategory(<String> name, <String> domain, <jala.XmlWriter.XmlElement> parent)
    - -
      Add a category element to an arbitrary element.
    - - - - -
      - Parameters: - -
        name - The name of the category. -
      - -
        domain - The domain of the category. -
      - -
        parent - The optional parent element. -
      - -
    - - - - - - - - -
    - - -

    addItem

    -
    void addItem(<jala.XmlWriter.XmlElement> item)
    - -
      Add an item element to the channel element.
    - - - - -
      - Parameters: - -
        item - The item element to add. -
      - -
    - - - - - - - - -
    - - -

    createItem

    -
    jala.XmlWriter.XmlElement createItem(<Object> data)
    - -
      Get a new and innocent item element.
    - - - - -
      - Parameters: - -
        data - An XmlWriter-compliant object structure. -
      - -
    - - - - -
      - Returns: -
        - A new and innocent item element. -
      -
    - - - - - -
    - - -

    extendChannel

    -
    void extendChannel(<Array> ext)
    - -
      Add child elements to the channel template.
    - - - - -
      - Parameters: - -
        ext - List of additional child elements. -
      - -
    - - - - - - - - -
    - - -

    extendItem

    -
    void extendItem(<Array> ext)
    - -
      Add child elements to the item template.
    - - - - -
      - Parameters: - -
        ext - List of additional child elements. -
      - -
    - - - - - - - - -
    - - -

    getChannel

    -
    jala.XmlWriter.XmlElement getChannel()
    - -
      Get the writer's channel element.
    - - - - - - - -
      - Returns: -
        - The writer's channel element. -
      -
    - - - - - -
    - - -

    getRoot

    -
    jala.XmlWriter.XmlElement getRoot()
    - -
      Get the writer's root element.
    - - - - - - - -
      - Returns: -
        - The writer's root element. -
      -
    - - - - - -
    - - -

    setChannel

    -
    jala.XmlWriter.XmlElement setChannel(<Object> data)
    - -
      Populate the channel element with data.
    - - - - -
      - Parameters: - -
        data - An XmlWriter-compliant object structure. -
      - -
    - - - - -
      - Returns: -
        - The populated channel element. -
      -
    - - - - - -
    - - -

    setImage

    -
    void setImage(<Object> data)
    - -
      Populate the image element with data.
    - - - - -
      - Parameters: - -
        data - An XmlWriter-compliant object structure. -
      - -
    - - - - - - - - -
    - - -

    setTextInput

    -
    void setTextInput(<Object> data)
    - -
      Populate the textInput element with data.
    - - - - -
      - Parameters: - -
        data - An XmlWriter-compliant object structure. -
      - -
    - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.Utilities.html b/modules/jala/docs/jala.Utilities.html deleted file mode 100644 index cd58c6e3..00000000 --- a/modules/jala/docs/jala.Utilities.html +++ /dev/null @@ -1,586 +0,0 @@ - - - - - -jala.Utilities - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.Utilities

    -
    Object
    -   |
    -   +--jala.Utilities
    -
    - - -
    -
    - -
    class - jala.Utilities - - -
    - -

    -
    This class contains various convenience methods - which do not fit in any other class. -
    Defined in Utilities.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    - <static>  <final> NumberVALUE_ADDED -
    -           Static field indicating ad added object property.
    - <static>  <final> NumberVALUE_MODIFIED -
    -           Static field indicating a modified object property.
    - <static>  <final> NumberVALUE_REMOVED -
    -           Static field indicating a removed object property.
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Utilities - - () - -
    -             - Construct a utility object. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - createPassword(<Number> len, <Number> level) - -
    -            - Creates a random password with different levels of security. -
    - -  Object - - - - - diffObjects(<Object> obj1, <Object> obj2) - -
    -            - Returns an array containing the properties that are - added, removed or modified in one object compared to another. -
    - -  Object - - - - - patchObject(<Object> obj, <Object> diff) - -
    -            - Patches an object with a "diff" object created by the - diffObjects() method. -
    - -  String - - - - - toString() - -
    -            - Return a string representation of the utitility object. -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    VALUE_ADDED

    -
    <static> <final> Number VALUE_ADDED
    - -
    - - -

    VALUE_MODIFIED

    -
    <static> <final> Number VALUE_MODIFIED
    - -
    - - -

    VALUE_REMOVED

    -
    <static> <final> Number VALUE_REMOVED
    - -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Utilities

    -
    jala.Utilities()
    - - -
      - Construct a utility object. -
    - - - - - - - - -
      - Returns: -
        - A new utitilty object. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    createPassword

    -
    String createPassword(<Number> len, <Number> level)
    - -
      Creates a random password with different levels of security.
    - - - - -
      - Parameters: - -
        len - The length of the password (default: 8) -
      - -
        level - The security level
        • 0 - containing only vowels or consonants (default)
        • 1 - throws in a number at random position
        • 2 - throws in a number and a special character at random position
        -
      - -
    - - - - -
      - Returns: -
        - The resulting password -
      -
    - - - - - -
    - - -

    diffObjects

    -
    Object diffObjects(<Object> obj1, <Object> obj2)
    - -
      Returns an array containing the properties that are - added, removed or modified in one object compared to another.
    - - - - -
      - Parameters: - -
        obj1 - The first of two objects which should be compared -
      - -
        obj2 - The second of two objects which should be compared -
      - -
    - - - - -
      - Returns: -
        - An Object containing all properties that are added, removed or modified in the second object compared to the first. Each property contains a status field with an integer value which can be checked against the static jala.Utility fields VALUE_ADDED, VALUE_MODIFIED and VALUE_REMOVED. -
      -
    - - - - - -
    - - -

    patchObject

    -
    Object patchObject(<Object> obj, <Object> diff)
    - -
      Patches an object with a "diff" object created by the - diffObjects() method. - Please mind that this method is recursive, it descends - along the "diff" object structure.
    - - - - -
      - Parameters: - -
        obj - The Object the diff should be applied to -
      - - - -
    - - - - -
      - Returns: -
        - The patched Object with all differences applied -
      -
    - - - - - -
    - - -

    toString

    -
    String toString()
    - -
      Return a string representation of the utitility object.
    - - - - - - - -
      - Returns: -
        - [jala.Utilities Object] -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.XmlRpcRequest.html b/modules/jala/docs/jala.XmlRpcRequest.html deleted file mode 100644 index c52e8de2..00000000 --- a/modules/jala/docs/jala.XmlRpcRequest.html +++ /dev/null @@ -1,1235 +0,0 @@ - - - - - -jala.XmlRpcRequest - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.XmlRpcRequest

    -
    Object
    -   |
    -   +--jala.XmlRpcRequest
    -
    - - -
    -
    - -
    class - jala.XmlRpcRequest - - -
    - -

    -
    Instances of this class provide the necessary functionality - for issueing XmlRpc requests to a remote service. -
    Defined in XmlRpcRequest.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.XmlRpcRequest - - (<String> url, <String> methodName) - -
    -             - A constructor for XmlRpc request objects -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Boolean - - - - - debug() - -
    -            - Returns true if debug is enabled for this request, false otherwise -
    - -  Object - - - - - execute() - -
    -            - Calling this method executes the remote method using - the arguments specified. -
    - -  String - - - - - getCredentials() - -
    -            - Returns the credentials of this request -
    - -  String - - - - - getInputEncoding() - -
    -            - Returns the input encoding -
    - -  String - - - - - getMethodName() - -
    -            - Returns the name of the remote function to call -
    - -  String - - - - - getOutputEncoding() - -
    -            - Returns the output encoding -
    - -  java.net.Proxy - - - - - getProxy() - -
    -            - Returns the proxy object. -
    - -  Number - - - - - getReadTimeout() - -
    -            - Returns the socket timeout of this request -
    - -  Number - - - - - getTimeout() - -
    -            - Returns the connection timeout of this request -
    - -  java.net.URL - - - - - getUrl() - -
    -            - Returns the URL of this request -
    - -  void - - - - - setCredentials(<String> username, <String> password) - -
    -            - Sets the credentials for basic http authentication to - use with this request. -
    - -  void - - - - - setDebug(<Boolean> flag) - -
    -            - Enables or disables the debug mode. -
    - -  void - - - - - setEncoding(<String> enc) - -
    -            - Sets both input and output encoding to the - specified encoding string -
    - -  void - - - - - setInputEncoding(<String> enc) - -
    -            - Sets the input encoding to the specified encoding string -
    - -  void - - - - - setOutputEncoding(<String> enc) - -
    -            - Sets the output encoding to the specified encoding string -
    - -  void - - - - - setProxy(<String> proxyString) - -
    -            - Sets the proxy host and port. -
    - -  void - - - - - setReadTimeout(<Number> millis) - -
    -            - Sets the socket timeout to the specified milliseconds. -
    - -  void - - - - - setTimeout(<Number> millis) - -
    -            - Sets the connection timeout to the specified milliseconds. -
    - - <static> String - - - - - argumentsToString(<Object> args) - -
    -            - Helper method to format an arguments array into - a string useable for debugging output. -
    - - <static> java.lang.Object - - - - - convertArgument(<Object> obj) - -
    -            - Helper method for converting a Javascript object into - its appropriate Java object. -
    - - <static> Object - - - - - convertResult(<java.lang.Object> obj) - -
    -            - Converts a Java object into its appropriate Javascript representation. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.XmlRpcRequest

    -
    jala.XmlRpcRequest(<String> url, <String> methodName)
    - - -
      - A constructor for XmlRpc request objects -
    - - - -
      - Parameters: - -
        url - The url of the XmlRpc entry point -
      - -
        methodName - The name of the method to call -
      - - -
    - - - - -
      - Returns: -
        - A newly created jala.XmlRpcRequest instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    debug

    -
    Boolean debug()
    - -
      Returns true if debug is enabled for this request, false otherwise
    - - - - - - - -
      - Returns: -
        - True if debugging is enabled, false otherwise -
      -
    - - - - - -
    - - -

    execute

    -
    Object execute()
    - -
      Calling this method executes the remote method using - the arguments specified.
    - - - - - - - -
      - Returns: -
        - The result of this XmlRpc request -
      -
    - - - - - -
    - - -

    getCredentials

    -
    String getCredentials()
    - -
      Returns the credentials of this request
    - - - - - - - -
      - Returns: -
        - The base46 encoded credentials of this request -
      -
    - - - - - -
    - - -

    getInputEncoding

    -
    String getInputEncoding()
    - -
      Returns the input encoding
    - - - - - - - -
      - Returns: -
        - The input encoding used by this request -
      -
    - - - - - -
    - - -

    getMethodName

    -
    String getMethodName()
    - -
      Returns the name of the remote function to call
    - - - - - - - -
      - Returns: -
        - The name of the remote function -
      -
    - - - - - -
    - - -

    getOutputEncoding

    -
    String getOutputEncoding()
    - -
      Returns the output encoding
    - - - - - - - -
      - Returns: -
        - The output encoding used by this request -
      -
    - - - - - -
    - - -

    getProxy

    -
    java.net.Proxy getProxy()
    - -
      Returns the proxy object. This method will only return - a value if using a java runtime > 1.5
    - - - - - - - -
      - Returns: -
        - The proxy to use for this request -
      -
    - - - - - - - -
    - - -

    getReadTimeout

    -
    Number getReadTimeout()
    - -
      Returns the socket timeout of this request
    - - - - - - - -
      - Returns: -
        - The socket timeout value in milliseconds -
      -
    - - - - - -
    - - -

    getTimeout

    -
    Number getTimeout()
    - -
      Returns the connection timeout of this request
    - - - - - - - -
      - Returns: -
        - The connection timeout value in milliseconds -
      -
    - - - - - -
    - - -

    getUrl

    -
    java.net.URL getUrl()
    - -
      Returns the URL of this request
    - - - - - - - -
      - Returns: -
        - The URL of this request -
      -
    - - - - - -
    - - -

    setCredentials

    -
    void setCredentials(<String> username, <String> password)
    - -
      Sets the credentials for basic http authentication to - use with this request.
    - - - - -
      - Parameters: - -
        username - The username -
      - -
        password - The password -
      - -
    - - - - - - - - -
    - - -

    setDebug

    -
    void setDebug(<Boolean> flag)
    - -
      Enables or disables the debug mode. If enabled the xml source - of both request and response is included in the result properties - 'requestXml' and 'responseXml'
    - - - - -
      - Parameters: - -
        flag - True or false. -
      - -
    - - - - - - - - -
    - - -

    setEncoding

    -
    void setEncoding(<String> enc)
    - -
      Sets both input and output encoding to the - specified encoding string
    - - - - -
      - Parameters: - -
        enc - The encoding to use for both input and output. This must be a valid java encoding string. -
      - -
    - - - - - - - - -
    - - -

    setInputEncoding

    -
    void setInputEncoding(<String> enc)
    - -
      Sets the input encoding to the specified encoding string
    - - - - -
      - Parameters: - -
        enc - The encoding to use for input. This must be a valid java encoding string. -
      - -
    - - - - - - - - -
    - - -

    setOutputEncoding

    -
    void setOutputEncoding(<String> enc)
    - -
      Sets the output encoding to the specified encoding string
    - - - - -
      - Parameters: - -
        enc - The encoding to use for output. This must be a valid java encoding string. -
      - -
    - - - - - - - - -
    - - -

    setProxy

    -
    void setProxy(<String> proxyString)
    - -
      Sets the proxy host and port. For Java runtimes < 1.5 this method - sets the appropriate system properties (so this has an effect on - all requests based on java.net.URL), for all others the proxy - is only set for this request.
    - - - - -
      - Parameters: - -
        proxyString - The proxy string in the form 'fqdn:port' (eg. my.proxy.com:3128) -
      - -
    - - - - - - - - -
    - - -

    setReadTimeout

    -
    void setReadTimeout(<Number> millis)
    - -
      Sets the socket timeout to the specified milliseconds.
    - - - - -
      - Parameters: - -
        millis - The timeout to use as socket timeout -
      - -
    - - - - - - - - -
    - - -

    setTimeout

    -
    void setTimeout(<Number> millis)
    - -
      Sets the connection timeout to the specified milliseconds.
    - - - - -
      - Parameters: - -
        millis - The timeout to use as connection timeout -
      - -
    - - - - - - - - -
    - - -

    argumentsToString

    -
    <static> String argumentsToString(<Object> args)
    - -
      Helper method to format an arguments array into - a string useable for debugging output.
    - - - - -
      - Parameters: - -
        args - An arguments array -
      - -
    - - - - -
      - Returns: -
        - The arguments array formatted as string -
      -
    - - - - - -
    - - -

    convertArgument

    -
    <static> java.lang.Object convertArgument(<Object> obj)
    - -
      Helper method for converting a Javascript object into - its appropriate Java object.
    - - - - -
      - Parameters: - -
        obj - The Javascript object to convert -
      - -
    - - - - -
      - Returns: -
        - The appropriate Java representation of the object -
      -
    - - - - - -
    - - -

    convertResult

    -
    <static> Object convertResult(<java.lang.Object> obj)
    - -
      Converts a Java object into its appropriate Javascript representation.
    - - - - -
      - Parameters: - -
        obj - The Java object to convert -
      - -
    - - - - -
      - Returns: -
        - The appropriate Javascript representation of the Java object -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.XmlWriter.html b/modules/jala/docs/jala.XmlWriter.html deleted file mode 100644 index 7ce2fdda..00000000 --- a/modules/jala/docs/jala.XmlWriter.html +++ /dev/null @@ -1,633 +0,0 @@ - - - - - -jala.XmlWriter - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.XmlWriter

    -
    Object
    -   |
    -   +--jala.XmlWriter
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Rss20Writer -
    -
    - - -
    -
    - -
    class - jala.XmlWriter - - -
    - -

    -
    This class defines a generic interface to write - arbitrary and validating XML source code. This is done - by first applying data objects onto template objects, - both in a specified format. Then, the resulting object - tree is transformed into XML. Moreover, template objects - can be extended with other template objects to provide - full flexibility in inheriting subclasses. -
    Defined in XmlWriter.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.XmlWriter - - (<String> header) - -
    -             - Construct a new XML writer. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  jala.XmlWriter.XmlElement - - - - - addNamespace(<String> name, <String> url) - -
    -            - Add a namespace to this writer. -
    - -  jala.XmlWriter - - - - - clone(obj) - -
    -            - Clone this XML writer. -
    - -  jala.XmlWriter.XmlElement - - - - - createElement(<Object> data) - -
    -            - Get a newly created XML element. -
    - -  jala.XmlWriter - - - - - extend(<Object> template, <Object> ext) - -
    -            - Extend a template object. -
    - -  jala.XmlWriter.XmlElement - - - - - getRoot() - -
    -            - Get the root XML element of this writer. -
    - -  String - - - - - toString() - -
    -            - Get the XML output as string. -
    - -  void - - - - - write() - -
    -            - Write the XML to the response buffer. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.XmlWriter

    -
    jala.XmlWriter(<String> header)
    - - -
      - Construct a new XML writer. -
    - - - -
      - Parameters: - -
        header - An optional XML header. -
      - - -
    - - - - -
      - Returns: -
        - A new XML writer. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    addNamespace

    -
    jala.XmlWriter.XmlElement addNamespace(<String> name, <String> url)
    - -
      Add a namespace to this writer.
    - - - - -
      - Parameters: - -
        name - The name of the namespace. -
      - -
        url - The URL string of the namespace. -
      - -
    - - - - -
      - Returns: -
        - The XML root element. -
      -
    - - - - - -
    - - -

    clone

    -
    jala.XmlWriter clone(obj)
    - -
      Clone this XML writer.
    - - - - -
      - Parameters: - -
        The - clone templare. -
      - -
    - - - - -
      - Returns: -
        - The cloned XML writer. -
      -
    - - - - - -
    - - -

    createElement

    -
    jala.XmlWriter.XmlElement createElement(<Object> data)
    - -
      Get a newly created XML element.
    - - - - -
      - Parameters: - -
        data - The XML data as object tree. -
      - -
    - - - - -
      - Returns: -
        - The resulting XML element. -
      -
    - - - - - -
    - - -

    extend

    -
    jala.XmlWriter extend(<Object> template, <Object> ext)
    - -
      Extend a template object.
    - - - - -
      - Parameters: - -
        template - The template object. -
      - -
        ext - The extension object. -
      - -
    - - - - -
      - Returns: -
        - The XML writer. -
      -
    - - - - - -
    - - -

    getRoot

    -
    jala.XmlWriter.XmlElement getRoot()
    - -
      Get the root XML element of this writer.
    - - - - - - - -
      - Returns: -
        - The root XML element. -
      -
    - - - - - -
    - - -

    toString

    -
    String toString()
    - -
      Get the XML output as string.
    - - - - - - - -
      - Returns: -
        - The XML output. -
      -
    - - - - - -
    - - -

    write

    -
    void write()
    - -
      Write the XML to the response buffer.
    - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.db.DataType.html b/modules/jala/docs/jala.db.DataType.html deleted file mode 100644 index e319ed22..00000000 --- a/modules/jala/docs/jala.db.DataType.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - -jala.db.DataType - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.0 - -
    - -
    - - -

    Class jala.db.DataType

    -
    Object
    -   |
    -   +--jala.db.DataType
    -
    - - -
    -
    - -
    class - jala.db.DataType - - -
    - -

    -
    Instances of this class represent a data type. Each instance - contains the code number as defined in java.sql.Types, the name of - the data type as defined in java.sql.Types and optional creation parameters - allowed for this data type. -
    Defined in Database.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.db.DataType - - (<Number> type, <String> typeName, <String> params) - -
    -             - Returns a newly created DataType instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  String - - - - - getParams() - -
    -            - Returns the creation parameter string of this data type -
    - -  Number - - - - - getType() - -
    -            - Returns the sql type code number as defined in java.sql.Types -
    - -  String - - - - - getTypeName() - -
    -            - Returns the type name of this data type, which can be - used in sql queries. -
    - -  Boolean - - - - - needsQuotes() - -
    -            - Returns true if values for this data type should be surrounded - by (single) quotes. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.db.DataType

    -
    jala.db.DataType(<Number> type, <String> typeName, <String> params)
    - - -
      - Returns a newly created DataType instance. -
    - - - -
      - Parameters: - -
        type - The sql code number of this data type -
      - -
        typeName - The type name of this data type, as used within sql statements -
      - -
        params - Optional creation parameters allowed for this data type. -
      - - -
    - - - - -
      - Returns: -
        - A newly created instance of DataType. -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getParams

    -
    String getParams()
    - -
      Returns the creation parameter string of this data type
    - - - - - - - -
      - Returns: -
        - The creation parameter string of this data type -
      -
    - - - - - -
    - - -

    getType

    -
    Number getType()
    - -
      Returns the sql type code number as defined in java.sql.Types
    - - - - - - - -
      - Returns: -
        - The sql type code number of this data type -
      -
    - - - - - -
    - - -

    getTypeName

    -
    String getTypeName()
    - -
      Returns the type name of this data type, which can be - used in sql queries.
    - - - - - - - -
      - Returns: -
        - The type name of this data type -
      -
    - - - - - -
    - - -

    needsQuotes

    -
    Boolean needsQuotes()
    - -
      Returns true if values for this data type should be surrounded - by (single) quotes.
    - - - - - - - -
      - Returns: -
        - True if values for this data type should be surrounded by quotes, false if not -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.0 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Wed Apr 4 17:06:49 2007
    - - diff --git a/modules/jala/docs/jala.db.FileDatabase.html b/modules/jala/docs/jala.db.FileDatabase.html deleted file mode 100644 index bde70a26..00000000 --- a/modules/jala/docs/jala.db.FileDatabase.html +++ /dev/null @@ -1,637 +0,0 @@ - - - - - -jala.db.FileDatabase - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.db.FileDatabase

    -
    Object
    -   |
    -   +--jala.db.RamDatabase
    -         |
    -         +--jala.db.FileDatabase
    -
    - - -
    -
    - -
    class - jala.db.FileDatabase - -
    extends jala.db.RamDatabase - - -
    - -

    -
    Instances of this class represent a file based in-process database -
    Important: You need the h2.jar in directory "lib/ext" - of your helma installation for this library to work, which you can get - at http://www.h2database.com/. -
    Defined in Database.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.db.FileDatabase - - (<String> name, <helma.File> directory, <String> username, <String> password) - -
    -             - Returns a newly created instance of FileDatabase. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Boolean - - - - - backup(<helma.File> file) - -
    -            - Creates a backup of this database, using the file passed as argument. -
    - -  helma.File - - - - - getDirectory() - -
    -            - Returns the directory where the database files are stored. -
    - -  String - - - - - getName() - -
    -            - Returns the name of the database. -
    - -  String - - - - - getPassword() - -
    -            - Returns the password of this database -
    - -  String - - - - - getUsername() - -
    -            - Returns the username of this database -
    - -  Boolean - - - - - remove() - -
    -            - Deletes all files of this database on disk. -
    - -  Boolean - - - - - restore(<helma.File> backupFile) - -
    -            - Restores this database using a backup on disk. -
    - - - -  - - - - - - - -
    Methods inherited from class jala.db.RamDatabase
    - -getUrl, getProperties, getConnection, shutdown, dropTable, tableExists, copyTables, runScript, dump -
    -  - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.db.FileDatabase

    -
    jala.db.FileDatabase(<String> name, <helma.File> directory, <String> username, <String> password)
    - - -
      - Returns a newly created instance of FileDatabase. -
    - - - -
      - Parameters: - -
        name - The name of the database. This name is used as prefix for all database files -
      - -
        directory - The directory where the database files should be stored in. -
      - -
        username - Optional username (defaults to "sa"). This username is used when creating the database, so the same should be used when creating subsequent instances of jala.db.FileDatabase pointing to the same database -
      - -
        password - Optional password (defaults to ""). -
      - - -
    - - - - -
      - Returns: -
        - A newly created FileDatabase instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    backup

    -
    Boolean backup(<helma.File> file)
    - -
      Creates a backup of this database, using the file passed as argument. The - result will be a zipped file containing the database files
    - - - - -
      - Parameters: - -
        file - The file to write the backup to -
      - -
    - - - - -
      - Returns: -
        - True if the database backup was created successfully, false otherwise -
      -
    - - - - - -
    - - -

    getDirectory

    -
    helma.File getDirectory()
    - -
      Returns the directory where the database files are stored.
    - - - - - - - -
      - Returns: -
        - The directory where this database is stored. -
      -
    - - - - - -
    - - -

    getName

    -
    String getName()
    - -
      Returns the name of the database. This name is used as prefix - for all files of this database in the specified directory
    - - - - - - - -
      - Returns: -
        - The name of the database -
      -
    - - - - - -
    - - -

    getPassword

    -
    String getPassword()
    - -
      Returns the password of this database
    - - - - - - - -
      - Returns: -
        - The password of this database -
      -
    - - - - - -
    - - -

    getUsername

    -
    String getUsername()
    - -
      Returns the username of this database
    - - - - - - - -
      - Returns: -
        - The username of this database -
      -
    - - - - - -
    - - -

    remove

    -
    Boolean remove()
    - -
      Deletes all files of this database on disk. Note that this also - closes the database before removing it.
    - - - - - - - -
      - Returns: -
        - True in case the database was removed successfully, false otherwise -
      -
    - - - - - -
    - - -

    restore

    -
    Boolean restore(<helma.File> backupFile)
    - -
      Restores this database using a backup on disk.
    - - - - -
      - Parameters: - -
        backupFile - The backup file to use for restore -
      - -
    - - - - -
      - Returns: -
        - True if the database was successfully restored, false otherwise -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.db.RamDatabase.html b/modules/jala/docs/jala.db.RamDatabase.html deleted file mode 100644 index da22e63e..00000000 --- a/modules/jala/docs/jala.db.RamDatabase.html +++ /dev/null @@ -1,886 +0,0 @@ - - - - - -jala.db.RamDatabase - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.db.RamDatabase

    -
    Object
    -   |
    -   +--jala.db.RamDatabase
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.db.FileDatabase -
    -
    - - -
    -
    - -
    class - jala.db.RamDatabase - - -
    - -

    -
    Instances of this class represent an in-memory sql database. -
    Important: You need the h2.jar in directory "lib/ext" - of your helma installation for this library to work, which you can get - at http://www.h2database.com/. -
    Defined in Database.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.db.RamDatabase - - (<String> name, <String> username, <String> password) - -
    -             - Returns a newly created RamDatabase instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - copyTables(<helma.Database> database, <Array> tables) - -
    -            - Copies all tables in the database passed as argument into this embedded database. -
    - -  Boolean - - - - - dropTable(<String> tableName) - -
    -            - Drops the table with the given name -
    - -  Boolean - - - - - dump(<helma.File> file, <Object> props) - -
    -            - Dumps the database schema and data into a file -
    - -  helma.Database - - - - - getConnection(props) - -
    -            - Returns a connection to this database -
    - -  String - - - - - getName() - -
    -            - Returns the name of the database -
    - -  String - - - - - getPassword() - -
    -            - Returns the password of this database -
    - -  helma.util.ResourceProperties - - - - - getProperties(<Object> props) - -
    -            - Returns a properties object containing the connection properties - for this database. -
    - -  String - - - - - getUrl(<Object> props) - -
    -            - Returns the JDBC Url to connect to this database -
    - -  String - - - - - getUsername() - -
    -            - Returns the username of this database -
    - -  Boolean - - - - - runScript(<helma.File> file, <Object> props, <String> charset, <Boolean> continueOnError) - -
    -            - Runs the script file passed as argument in the context of this database. -
    - -  void - - - - - shutdown() - -
    -            - Stops this in-process database by issueing a "SHUTDOWN" sql command. -
    - -  Boolean - - - - - tableExists(<String> name) - -
    -            - Returns true if the table exists already in the database -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.db.RamDatabase

    -
    jala.db.RamDatabase(<String> name, <String> username, <String> password)
    - - -
      - Returns a newly created RamDatabase instance. -
    - - - -
      - Parameters: - -
        name - The name of the database. If not given a private un-named database is created, that can only be accessed through this instance of jala.db.RamDatabase -
      - -
        username - Optional username (defaults to "sa"). This username is used when creating the database, so the same should be used when creating subsequent instances of jala.db.RamDatabase pointing to a named database. -
      - -
        password - Optional password (defaults to ""). -
      - - -
    - - - - -
      - Returns: -
        - A newly created instance of RamDatabase -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    copyTables

    -
    void copyTables(<helma.Database> database, <Array> tables)
    - -
      Copies all tables in the database passed as argument into this embedded database. - If any of the tables already exists in this database, they will be removed before - re-created. Please mind that this method ignores any indexes in the source database, - but respects the primary key settings.
    - - - - -
      - Parameters: - -
        database - The database to copy the tables from -
      - -
        tables - An optional array containing the names of the tables to copy. If not given all tables are copied -
      - -
    - - - - - - - - -
    - - -

    dropTable

    -
    Boolean dropTable(<String> tableName)
    - -
      Drops the table with the given name
    - - - - -
      - Parameters: - -
        tableName - The name of the table -
      - -
    - - - - -
      - Returns: -
        - True if the table was successfully dropped, false otherwise -
      -
    - - - - - -
    - - -

    dump

    -
    Boolean dump(<helma.File> file, <Object> props)
    - -
      Dumps the database schema and data into a file
    - - - - -
      - Parameters: - -
        file - The file where the database dump will be -
      - -
        props - Optional object containing connection properties -
      - -
    - - - - -
      - Returns: -
        - True in case the database was successfully dumped, false otherwise -
      -
    - - - - - -
    - - -

    getConnection

    -
    helma.Database getConnection(props)
    - -
      Returns a connection to this database
    - - - - -
      - Parameters: - -
        An - optional parameter object containing connection properties to add to the connection Url. -
      - -
    - - - - -
      - Returns: -
        - A connection to this database -
      -
    - - - - - -
    - - -

    getName

    -
    String getName()
    - -
      Returns the name of the database
    - - - - - - - -
      - Returns: -
        - The name of the database -
      -
    - - - - - -
    - - -

    getPassword

    -
    String getPassword()
    - -
      Returns the password of this database
    - - - - - - - -
      - Returns: -
        - The password of this database -
      -
    - - - - - -
    - - -

    getProperties

    -
    helma.util.ResourceProperties getProperties(<Object> props)
    - -
      Returns a properties object containing the connection properties - for this database.
    - - - - -
      - Parameters: - -
        props - An optional parameter object containing connection properties to add to the connection Url. -
      - -
    - - - - -
      - Returns: -
        - A properties object containing the connection properties -
      -
    - - - - - -
    - - -

    getUrl

    -
    String getUrl(<Object> props)
    - -
      Returns the JDBC Url to connect to this database
    - - - - -
      - Parameters: - -
        props - Optional connection properties to add -
      - -
    - - - - -
      - Returns: -
        - The JDBC url to use for connecting to this database -
      -
    - - - - - -
    - - -

    getUsername

    -
    String getUsername()
    - -
      Returns the username of this database
    - - - - - - - -
      - Returns: -
        - The username of this database -
      -
    - - - - - -
    - - -

    runScript

    -
    Boolean runScript(<helma.File> file, <Object> props, <String> charset, <Boolean> continueOnError)
    - -
      Runs the script file passed as argument in the context of this database. - Use this method to eg. create and/or populate a database.
    - - - - -
      - Parameters: - -
        file - The script file to run -
      - -
        props - Optional object containing connection properties -
      - -
        charset - Optional character set to use (defaults to "UTF-8") -
      - -
        continueOnError - Optional flag indicating whether to continue on error or not (defaults to false) -
      - -
    - - - - -
      - Returns: -
        - True in case the script was executed successfully, false otherwise -
      -
    - - - - - -
    - - -

    shutdown

    -
    void shutdown()
    - -
      Stops this in-process database by issueing a "SHUTDOWN" sql command.
    - - - - - - - - - - - -
    - - -

    tableExists

    -
    Boolean tableExists(<String> name)
    - -
      Returns true if the table exists already in the database
    - - - - -
      - Parameters: - -
        name - The name of the table -
      - -
    - - - - -
      - Returns: -
        - True if the table exists, false otherwise -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.db.Server.html b/modules/jala/docs/jala.db.Server.html deleted file mode 100644 index 5ba94fb1..00000000 --- a/modules/jala/docs/jala.db.Server.html +++ /dev/null @@ -1,850 +0,0 @@ - - - - - -jala.db.Server - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.db.Server

    -
    Object
    -   |
    -   +--jala.db.Server
    -
    - - -
    -
    - -
    class - jala.db.Server - - -
    - -

    -
    Instances of this class represent a H2 database listener that - allows multiple databases to be accessed via tcp. -
    Important: You need the h2.jar in directory "lib/ext" - of your helma installation for this library to work, which you can get - at http://www.h2database.com/. -
    Defined in Database.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.db.Server - - (<helma.File> baseDir, <Number> port) - -
    -             - Returns a new Server instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Boolean - - - - - createOnDemand(<Boolean> bool) - -
    -            - If called with boolean true as argument, this server creates databases - on-the-fly, otherwise it only accepts connections to already existing - databases. -
    - -  helma.Database - - - - - getConnection(<String> name, <String> username, <String> password, <Object> props) - -
    -            - Returns a connection to a database within this server. -
    - -  helma.File - - - - - getDirectory() - -
    -            - Returns the directory used by this server instance -
    - -  Number - - - - - getPort() - -
    -            - Returns the port this server listens on -
    - -  helma.util.ResourceProperties - - - - - getProperties(<String> name, <String> username, <String> password, <Object> props) - -
    -            - Returns a properties object containing the connection properties - of the database with the given name. -
    - -  String - - - - - getUrl(<String> name, <Object> props) - -
    -            - Returns the JDBC Url to use for connections to a given database. -
    - -  Boolean - - - - - isPublic(<Boolean> bool) - -
    -            - If called with boolean true as argument, this server accepts connections - from outside localhost. -
    - -  Boolean - - - - - isRunning() - -
    -            - Returns true if the database server is running. -
    - -  Boolean - - - - - start() - -
    -            - Starts the database server. -
    - -  Boolean - - - - - stop() - -
    -            - Stops the database server. -
    - -  Boolean - - - - - useSsl(<Boolean> bool) - -
    -            - Toggles the use of Ssl encryption within this server. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.db.Server

    -
    jala.db.Server(<helma.File> baseDir, <Number> port)
    - - -
      - Returns a new Server instance. -
    - - - -
      - Parameters: - -
        baseDir - The directory where the database files are located or should be stored -
      - -
        port - The port to listen on (defaults to 9001) -
      - -
        createOnDemand - If true this server will create non-existing databases on-the-fly, if false it only accepts connections to already existing databases in the given base directory -
      - -
        makePublic - If true this database is reachable from outside, if false it's only reachable from localhost -
      - -
        useSsl - If true SSL will be used to encrypt the connection -
      - - -
    - - - - -
      - Returns: -
        - A newly created Server instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    createOnDemand

    -
    Boolean createOnDemand(<Boolean> bool)
    - -
      If called with boolean true as argument, this server creates databases - on-the-fly, otherwise it only accepts connections to already existing - databases. This should be set before starting the server.
    - - - - -
      - Parameters: - -
        bool - If true this server creates non-existing databases on demand, if false it only allows connections to existing databases. If no argument is given, this method returns the current setting. -
      - -
    - - - - -
      - Returns: -
        - The current setting if no argument is given, or void -
      -
    - - - - - -
    - - -

    getConnection

    -
    helma.Database getConnection(<String> name, <String> username, <String> password, <Object> props)
    - -
      Returns a connection to a database within this server.
    - - - - -
      - Parameters: - -
        name - The name of the database running within this server -
      - -
        username - Optional username to use for this connection -
      - -
        password - Optional password to use for this connection -
      - -
        props - An optional parameter object containing connection properties to add to the connection Url. -
      - -
    - - - - -
      - Returns: -
        - A connection to the specified database -
      -
    - - - - - -
    - - -

    getDirectory

    -
    helma.File getDirectory()
    - -
      Returns the directory used by this server instance
    - - - - - - - -
      - Returns: -
        - The directory where the databases used by this server are located in -
      -
    - - - - - -
    - - -

    getPort

    -
    Number getPort()
    - -
      Returns the port this server listens on
    - - - - - - - -
      - Returns: -
        - The port this server listens on -
      -
    - - - - - -
    - - -

    getProperties

    -
    helma.util.ResourceProperties getProperties(<String> name, <String> username, <String> password, <Object> props)
    - -
      Returns a properties object containing the connection properties - of the database with the given name.
    - - - - -
      - Parameters: - -
        name - The name of the database -
      - -
        username - Optional username to use for this connection -
      - -
        password - Optional password to use for this connection -
      - -
        props - An optional parameter object containing connection properties to add to the connection Url. -
      - -
    - - - - -
      - Returns: -
        - A properties object containing the connection properties -
      -
    - - - - - -
    - - -

    getUrl

    -
    String getUrl(<String> name, <Object> props)
    - -
      Returns the JDBC Url to use for connections to a given database.
    - - - - -
      - Parameters: - -
        name - An optional name of a database running -
      - -
        props - Optional connection properties to add -
      - -
    - - - - -
      - Returns: -
        - The JDBC Url to use for connecting to a database within this sever -
      -
    - - - - - -
    - - -

    isPublic

    -
    Boolean isPublic(<Boolean> bool)
    - -
      If called with boolean true as argument, this server accepts connections - from outside localhost. This should be set before starting the server.
    - - - - -
      - Parameters: - -
        bool - If true this server accepts connections from outside localhost. If no argument is given, this method returns the current setting. -
      - -
    - - - - -
      - Returns: -
        - The current setting if no argument is given, or void -
      -
    - - - - - -
    - - -

    isRunning

    -
    Boolean isRunning()
    - -
      Returns true if the database server is running.
    - - - - - - - -
      - Returns: -
        - True if the database server is running -
      -
    - - - - - -
    - - -

    start

    -
    Boolean start()
    - -
      Starts the database server.
    - - - - - - - -
      - Returns: -
        - True in case the server started successfully, false otherwise -
      -
    - - - - - -
    - - -

    stop

    -
    Boolean stop()
    - -
      Stops the database server.
    - - - - - - - -
      - Returns: -
        - True if stopping the server was successful, false otherwise -
      -
    - - - - - -
    - - -

    useSsl

    -
    Boolean useSsl(<Boolean> bool)
    - -
      Toggles the use of Ssl encryption within this server. This should be set - before starting the server.
    - - - - -
      - Parameters: - -
        bool - If true SSL encryption will be used, false otherwise. If no argument is given, this method returns the current setting. -
      - -
    - - - - -
      - Returns: -
        - The current setting if no argument is given, or void -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.db.html b/modules/jala/docs/jala.db.html deleted file mode 100644 index 7551bafd..00000000 --- a/modules/jala/docs/jala.db.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - -jala.db - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala.db

    -
    Object
    -   |
    -   +--jala.db
    -
    - - -
    -
    - -
    class - jala.db - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.db.Server
    - <static class>jala.db.DataType
    - <static class>jala.db.RamDatabase
    - <static class>jala.db.FileDatabase
    -  - - - - - - - - - - - - - - - - -  - - - - - -

    - - - - - - - - - - - - - - - - - -


    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/jala.html b/modules/jala/docs/jala.html deleted file mode 100644 index eb12207c..00000000 --- a/modules/jala/docs/jala.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - -jala - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - -
    - - -

    Class jala

    -
    Object
    -   |
    -   +--jala
    -
    - - -
    -
    - -
    class - jala - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.AsyncRequest
    - <static class>jala.BitTorrent
    - <static class>jala.Captcha
    - <static class>jala.Date
    - <static class>jala.DnsClient
    - <static class>jala.Form
    - <static class>jala.History
    - <static class>jala.HtmlDocument
    - <static class>jala.I18n
    - <static class>jala.ImageFilter
    - <static class>jala.IndexManager
    - <static class>jala.ListRenderer
    - <static class>jala.Mp3
    - <static class>jala.PodcastWriter
    - <static class>jala.RemoteContent
    - <static class>jala.Rss20Writer
    - <static class>jala.Utilities
    - <static class>jala.XmlRpcRequest
    - <static class>jala.XmlWriter
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    - <static>  <final> jala.Datedate -
    -           Default date class instance.
    - <static>  Objectdb -
    -           Namespace declaration
    - <static>  <final> jala.I18ni18n -
    -           Default i18n class instance.
    - <static>  <final> jala.Utilitiesutil -
    -           Default utility class instance.
    -   - - - - - - - - - - - -  - - - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    date

    -
    <static> <final> jala.Date date
    -
      - Default date class instance. - -
    -
    - - -

    db

    -
    <static> Object db
    -
      - Namespace declaration - -
    -
    - - -

    i18n

    -
    <static> <final> jala.I18n i18n
    -
      - Default i18n class instance. - -
    -
    - - -

    util

    -
    <static> <final> jala.Utilities util
    -
      - Default utility class instance. - -
    -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-AsyncRequest.js.html b/modules/jala/docs/overview-AsyncRequest.js.html deleted file mode 100644 index 88c84e17..00000000 --- a/modules/jala/docs/overview-AsyncRequest.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - AsyncRequest.js - - - - - - -

    - -AsyncRequest.js -
    - - - - - - - - -
    jala.AsyncRequest -
    -
    - - - diff --git a/modules/jala/docs/overview-BitTorrent.js.html b/modules/jala/docs/overview-BitTorrent.js.html deleted file mode 100644 index 40186fe3..00000000 --- a/modules/jala/docs/overview-BitTorrent.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - BitTorrent.js - - - - - - -

    - -BitTorrent.js -
    - - - - - - - - -
    jala.BitTorrent -
    -
    - - - diff --git a/modules/jala/docs/overview-Captcha.js.html b/modules/jala/docs/overview-Captcha.js.html deleted file mode 100644 index a3b39db1..00000000 --- a/modules/jala/docs/overview-Captcha.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Captcha.js - - - - - - -

    - -Captcha.js -
    - - - - - - - - -
    jala.Captcha -
    -
    - - - diff --git a/modules/jala/docs/overview-Database.js.html b/modules/jala/docs/overview-Database.js.html deleted file mode 100644 index 98301afd..00000000 --- a/modules/jala/docs/overview-Database.js.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - Database.js - - - - - - -

    - -Database.js -
    - - - - - - - - - - - - - - - - -
    jala.db.FileDatabase -
    -
    jala.db.RamDatabase -
    -
    jala.db.Server -
    -
    - - - diff --git a/modules/jala/docs/overview-Date.js.html b/modules/jala/docs/overview-Date.js.html deleted file mode 100644 index 41d49a7d..00000000 --- a/modules/jala/docs/overview-Date.js.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - Date.js - - - - - - -

    - -Date.js -
    - - - - - - - - - - - - - - - - -
    jala.Date -
    -
    jala.Date.Calendar -
    -
    jala.Date.Calendar.Renderer -
    -
    - - - diff --git a/modules/jala/docs/overview-DnsClient.js.html b/modules/jala/docs/overview-DnsClient.js.html deleted file mode 100644 index cd8cfacb..00000000 --- a/modules/jala/docs/overview-DnsClient.js.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - DnsClient.js - - - - - - -

    - -DnsClient.js -
    - - - - - - - - - - - - -
    jala.DnsClient -
    -
    jala.DnsClient.Record -
    -
    - - - diff --git a/modules/jala/docs/overview-Form.js.html b/modules/jala/docs/overview-Form.js.html deleted file mode 100644 index d95bfab3..00000000 --- a/modules/jala/docs/overview-Form.js.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - Form.js - - - - - - -

    - -Form.js -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    jala.Form -
    -
    jala.Form.Component -
    -
    jala.Form.Component.Button -
    -
    jala.Form.Component.Checkbox -
    -
    jala.Form.Component.Date -
    -
    jala.Form.Component.Fieldset -
    -
    jala.Form.Component.File -
    -
    jala.Form.Component.Hidden -
    -
    jala.Form.Component.Image -
    -
    jala.Form.Component.Input -
    -
    jala.Form.Component.Password -
    -
    jala.Form.Component.Radio -
    -
    jala.Form.Component.Select -
    -
    jala.Form.Component.Skin -
    -
    jala.Form.Component.Submit -
    -
    jala.Form.Component.Textarea -
    -
    jala.Form.Tracker -
    -
    - - - diff --git a/modules/jala/docs/overview-Global.js.html b/modules/jala/docs/overview-Global.js.html deleted file mode 100644 index 0b33ab65..00000000 --- a/modules/jala/docs/overview-Global.js.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Global.js - - - - - - -

    - -Global.js -
    - - - - -
    - - - diff --git a/modules/jala/docs/overview-History.js.html b/modules/jala/docs/overview-History.js.html deleted file mode 100644 index f9a292db..00000000 --- a/modules/jala/docs/overview-History.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - History.js - - - - - - -

    - -History.js -
    - - - - - - - - -
    jala.History -
    -
    - - - diff --git a/modules/jala/docs/overview-HopObject.js.html b/modules/jala/docs/overview-HopObject.js.html deleted file mode 100644 index 5096aa7f..00000000 --- a/modules/jala/docs/overview-HopObject.js.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - HopObject.js - - - - - - -

    - -HopObject.js -
    - - - - -
    - - - diff --git a/modules/jala/docs/overview-HtmlDocument.js.html b/modules/jala/docs/overview-HtmlDocument.js.html deleted file mode 100644 index 74abea83..00000000 --- a/modules/jala/docs/overview-HtmlDocument.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - HtmlDocument.js - - - - - - -

    - -HtmlDocument.js -
    - - - - - - - - -
    jala.HtmlDocument -
    -
    - - - diff --git a/modules/jala/docs/overview-I18n.js.html b/modules/jala/docs/overview-I18n.js.html deleted file mode 100644 index 30a1f027..00000000 --- a/modules/jala/docs/overview-I18n.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - I18n.js - - - - - - -

    - -I18n.js -
    - - - - - - - - -
    jala.I18n -
    -
    - - - diff --git a/modules/jala/docs/overview-ImageFilter.js.html b/modules/jala/docs/overview-ImageFilter.js.html deleted file mode 100644 index c949f24b..00000000 --- a/modules/jala/docs/overview-ImageFilter.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - ImageFilter.js - - - - - - -

    - -ImageFilter.js -
    - - - - - - - - -
    jala.ImageFilter -
    -
    - - - diff --git a/modules/jala/docs/overview-IndexManager.js.html b/modules/jala/docs/overview-IndexManager.js.html deleted file mode 100644 index 1b4282eb..00000000 --- a/modules/jala/docs/overview-IndexManager.js.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - IndexManager.js - - - - - - -

    - -IndexManager.js -
    - - - - - - - - - - - - -
    jala.IndexManager -
    -
    jala.IndexManager.Job -
    -
    - - - diff --git a/modules/jala/docs/overview-ListRenderer.js.html b/modules/jala/docs/overview-ListRenderer.js.html deleted file mode 100644 index 9da05948..00000000 --- a/modules/jala/docs/overview-ListRenderer.js.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - ListRenderer.js - - - - - - -

    - -ListRenderer.js -
    - - - - - - - - - - - - -
    jala.ListRenderer -
    -
    jala.ListRenderer.ArrayList -
    -
    - - - diff --git a/modules/jala/docs/overview-Mp3.js.html b/modules/jala/docs/overview-Mp3.js.html deleted file mode 100644 index b20cd0ba..00000000 --- a/modules/jala/docs/overview-Mp3.js.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - Mp3.js - - - - - - -

    - -Mp3.js -
    - - - - - - - - - - - - - - - - -
    jala.Mp3 -
    -
    jala.Mp3.Id3v1 -
    -
    jala.Mp3.Id3v2 -
    -
    - - - diff --git a/modules/jala/docs/overview-PodcastWriter.js.html b/modules/jala/docs/overview-PodcastWriter.js.html deleted file mode 100644 index 266115dd..00000000 --- a/modules/jala/docs/overview-PodcastWriter.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - PodcastWriter.js - - - - - - -

    - -PodcastWriter.js -
    - - - - - - - - -
    jala.PodcastWriter -
    -
    - - - diff --git a/modules/jala/docs/overview-RemoteContent.js.html b/modules/jala/docs/overview-RemoteContent.js.html deleted file mode 100644 index 0d06a163..00000000 --- a/modules/jala/docs/overview-RemoteContent.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - RemoteContent.js - - - - - - -

    - -RemoteContent.js -
    - - - - - - - - -
    jala.RemoteContent -
    -
    - - - diff --git a/modules/jala/docs/overview-Rss20Writer.js.html b/modules/jala/docs/overview-Rss20Writer.js.html deleted file mode 100644 index ef353f62..00000000 --- a/modules/jala/docs/overview-Rss20Writer.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Rss20Writer.js - - - - - - -

    - -Rss20Writer.js -
    - - - - - - - - -
    jala.Rss20Writer -
    -
    - - - diff --git a/modules/jala/docs/overview-Utilities.js.html b/modules/jala/docs/overview-Utilities.js.html deleted file mode 100644 index df24f343..00000000 --- a/modules/jala/docs/overview-Utilities.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Utilities.js - - - - - - -

    - -Utilities.js -
    - - - - - - - - -
    jala.Utilities -
    -
    - - - diff --git a/modules/jala/docs/overview-XmlRpcRequest.js.html b/modules/jala/docs/overview-XmlRpcRequest.js.html deleted file mode 100644 index 4570873b..00000000 --- a/modules/jala/docs/overview-XmlRpcRequest.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - XmlRpcRequest.js - - - - - - -

    - -XmlRpcRequest.js -
    - - - - - - - - -
    jala.XmlRpcRequest -
    -
    - - - diff --git a/modules/jala/docs/overview-XmlWriter.js.html b/modules/jala/docs/overview-XmlWriter.js.html deleted file mode 100644 index e0a6fa19..00000000 --- a/modules/jala/docs/overview-XmlWriter.js.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - XmlWriter.js - - - - - - -

    - -XmlWriter.js -
    - - - - - - - - -
    jala.XmlWriter -
    -
    - - - diff --git a/modules/jala/docs/overview-all.js.html b/modules/jala/docs/overview-all.js.html deleted file mode 100644 index e2dce5a2..00000000 --- a/modules/jala/docs/overview-all.js.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - all.js - - - - - - -

    - -all.js -
    - - - - -
    - - - diff --git a/modules/jala/docs/overview-frame.html b/modules/jala/docs/overview-frame.html deleted file mode 100644 index 41ebf84b..00000000 --- a/modules/jala/docs/overview-frame.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - -Overview () - - - - - - -

    Jala 1.3

    - - - - -
    - - - - - -
    All Classes -

    - -Files -
    - -all.js
    - -AsyncRequest.js
    - -BitTorrent.js
    - -Captcha.js
    - -Database.js
    - -Date.js
    - -DnsClient.js
    - -Form.js
    - -Global.js
    - -History.js
    - -HopObject.js
    - -HtmlDocument.js
    - -I18n.js
    - -ImageFilter.js
    - -IndexManager.js
    - -ListRenderer.js
    - -Mp3.js
    - -PodcastWriter.js
    - -RemoteContent.js
    - -Rss20Writer.js
    - -Utilities.js
    - -XmlRpcRequest.js
    - -XmlWriter.js
    - -

    - -

    -  - - diff --git a/modules/jala/docs/overview-summary-AsyncRequest.js.html b/modules/jala/docs/overview-summary-AsyncRequest.js.html deleted file mode 100644 index 2e5de3c2..00000000 --- a/modules/jala/docs/overview-summary-AsyncRequest.js.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -


    -
    - -

    AsyncRequest.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.AsyncRequest class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.AsyncRequestThis class is used to create requests of type "INTERNAL" - (like cron-jobs) that are processed in a separate thread and - therefor asynchronous.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-BitTorrent.js.html b/modules/jala/docs/overview-summary-BitTorrent.js.html deleted file mode 100644 index d34bcb31..00000000 --- a/modules/jala/docs/overview-summary-BitTorrent.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    BitTorrent.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.BitTorrent class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.BitTorrentThis class provides methods to create a BitTorrent - metadata file from any desired file.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Captcha.js.html b/modules/jala/docs/overview-summary-Captcha.js.html deleted file mode 100644 index 70dfe35b..00000000 --- a/modules/jala/docs/overview-summary-Captcha.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Captcha.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.Captcha class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.CaptchaWrapper class for the - JCaptcha library.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Database.js.html b/modules/jala/docs/overview-summary-Database.js.html deleted file mode 100644 index d40deebf..00000000 --- a/modules/jala/docs/overview-summary-Database.js.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Database.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.db package.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.db.FileDatabaseInstances of this class represent a file based in-process database -
    Important: You need the h2.jar in directory "lib/ext" - of your helma installation for this library to work, which you can get - at http://www.h2database.com/.
    jala.db.RamDatabaseInstances of this class represent an in-memory sql database.
    jala.db.ServerInstances of this class represent a H2 database listener that - allows multiple databases to be accessed via tcp.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Date.js.html b/modules/jala/docs/overview-summary-Date.js.html deleted file mode 100644 index 45b3be62..00000000 --- a/modules/jala/docs/overview-summary-Date.js.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Date.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.Date class.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.DateThis class provides various convenience - methods for rendering purposes.
    jala.Date.CalendarThis class represents a calendar based based on a grouped - collection of HopObjects.
    jala.Date.Calendar.RendererA default renderer to use in conjunction with jala.Date.Calendar -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-DnsClient.js.html b/modules/jala/docs/overview-summary-DnsClient.js.html deleted file mode 100644 index 8eb16e9b..00000000 --- a/modules/jala/docs/overview-summary-DnsClient.js.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    DnsClient.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.DnsClient class.

    - -

    - -
    - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.DnsClientThis is a wrapper around the Dns Client by wonderly.org - providing methods for querying Dns servers.
    jala.DnsClient.RecordInstances of this class wrap record data as received - from the nameserver.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Form.js.html b/modules/jala/docs/overview-summary-Form.js.html deleted file mode 100644 index c85ee5b6..00000000 --- a/modules/jala/docs/overview-summary-Form.js.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Form.js

    - -
    - - - - -

    Summary

    -

    - - This class can be used to render forms and to validate - and store user submits. Further types of form components can be added - by subclassing jala.Form.Component.Input.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.FormA class that renders forms, validates submitted form data and - stores the data in a specified object.
    jala.Form.Component 
    jala.Form.Component.ButtonSubclass of jala.Form.Component.Input which renders a button.
    jala.Form.Component.CheckboxSubclass of jala.Form.Component.Input which renders and validates a - checkbox.
    jala.Form.Component.DateSubclass of jala.Form.Component.Input which renders and validates a - date editor.
    jala.Form.Component.FieldsetInstances of this class represent a form fieldset containing - numerous form components -
    jala.Form.Component.FileSubclass of jala.Form.Component.Input which renders and validates a - file upload.
    jala.Form.Component.HiddenSubclass of jala.Form.Component.Input which renders and validates a - hidden input tag.
    jala.Form.Component.ImageSubclass of jala.Form.Component.File which renders a file upload - and validates uploaded files as images.
    jala.Form.Component.InputInstances of this class represent a single form input field.
    jala.Form.Component.PasswordSubclass of jala.Form.Component.Input which renders and validates a - password input tag.
    jala.Form.Component.RadioSubclass of jala.Form.Component.Input which renders and validates a - set of radio buttons.
    jala.Form.Component.SelectSubclass of jala.Form.Component.Input which renders and validates a - dropdown element.
    jala.Form.Component.SkinSubclass of jala.Form.Component that allows rendering a skin - within a form.
    jala.Form.Component.SubmitSubclass of jala.Form.Component.Button which renders a submit button.
    jala.Form.Component.TextareaSubclass of jala.Form.Component.Input which renders and validates a - textarea input field.
    jala.Form.TrackerInstances of this class can contain error-messages and values -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Global.js.html b/modules/jala/docs/overview-summary-Global.js.html deleted file mode 100644 index a486ca23..00000000 --- a/modules/jala/docs/overview-summary-Global.js.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Global.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the Global prototype.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - Method Summary - -
    - - static Boolean - - - - - isArray(<Object> val) - -
    -            - Returns true if the value passed as argument is an array. -
    - - static Boolean - - - - - isBoolean(<Object> val) - -
    -            - Returns true if the value passed as argument is either a boolean - literal or an instance of Boolean. -
    - - static Boolean - - - - - isDate(<Object> val) - -
    -            - Returns true if the value passed as argument is either a Javascript date - or an instance of java.util.Date. -
    - - static Boolean - - - - - isFunction(<Object> val) - -
    -            - Returns true if the value passed as argument is a function. -
    - - static Boolean - - - - - isNull(<Object> val) - -
    -            - Returns true if the value passed as argument is null. -
    - - static Boolean - - - - - isNumber(<Object> val) - -
    -            - Returns true if the value passed as argument is either a number, - an instance of Number or of java.lang.Number. -
    - - static Boolean - - - - - isObject(<Object> val) - -
    -            - Returns true if the value passed as argument is either a Javascript - object or an instance of java.lang.Object. -
    - - static Boolean - - - - - isString(<Object> val) - -
    -            - Returns true if the value passed as argument is either a string literal, - an instance of String or of java.lang.String. -
    - - static Boolean - - - - - isUndefined(<Object> val) - -
    -            - Returns true if the value passed as argument is undefined. -
    -

    - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -


    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-History.js.html b/modules/jala/docs/overview-summary-History.js.html deleted file mode 100644 index 6f521c76..00000000 --- a/modules/jala/docs/overview-summary-History.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    History.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.History class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.HistoryThis class is an implementation of a Browser-like history - stack suitable to use in any Helma application.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-HopObject.js.html b/modules/jala/docs/overview-summary-HopObject.js.html deleted file mode 100644 index fcf4c14f..00000000 --- a/modules/jala/docs/overview-summary-HopObject.js.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    HopObject.js

    - -
    - - - - -

    Summary

    -

    - - Additional fields and methods of the HopObject class.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-HtmlDocument.js.html b/modules/jala/docs/overview-summary-HtmlDocument.js.html deleted file mode 100644 index 27b462c1..00000000 --- a/modules/jala/docs/overview-summary-HtmlDocument.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    HtmlDocument.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.HtmlDocument class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.HtmlDocumentThis class provides easy access to the elements of - an arbitrary HTML document.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-I18n.js.html b/modules/jala/docs/overview-summary-I18n.js.html deleted file mode 100644 index 4dc0d79d..00000000 --- a/modules/jala/docs/overview-summary-I18n.js.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    I18n.js

    - -
    - - - - -

    Summary

    -

    - - Methods and macros for internationalization - of Helma applications.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.I18nThis class provides various functions and macros for - internationalization of Helma applications.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-ImageFilter.js.html b/modules/jala/docs/overview-summary-ImageFilter.js.html deleted file mode 100644 index a5049352..00000000 --- a/modules/jala/docs/overview-summary-ImageFilter.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    ImageFilter.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.ImageFilter class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.ImageFilterThis class provides several image manipulating - methods.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-IndexManager.js.html b/modules/jala/docs/overview-summary-IndexManager.js.html deleted file mode 100644 index 60a323ab..00000000 --- a/modules/jala/docs/overview-summary-IndexManager.js.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    IndexManager.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.IndexManager class.

    - -

    - -
    - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.IndexManagerThis class basically sits on top of a helma.Search.Index instance - and provides methods for adding, removing and optimizing the underlying index.
    jala.IndexManager.JobInstances of this class represent a single index - manipulation job to be processed by the index manager.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-ListRenderer.js.html b/modules/jala/docs/overview-summary-ListRenderer.js.html deleted file mode 100644 index 9727f143..00000000 --- a/modules/jala/docs/overview-summary-ListRenderer.js.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    ListRenderer.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.ListRenderer class.

    - -

    - -
    - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.ListRenderer 
    jala.ListRenderer.ArrayListA simple wrapper around an array to use in conjunction - with jala.ListRenderer.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Mp3.js.html b/modules/jala/docs/overview-summary-Mp3.js.html deleted file mode 100644 index 21624a71..00000000 --- a/modules/jala/docs/overview-summary-Mp3.js.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Mp3.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.audio package.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.Mp3This is a class representing an MP3 file - providing methods to access its metadata.
    jala.Mp3.Id3v1This class represents an Id3v1 tag.
    jala.Mp3.Id3v2This class represents an Id3v2 tag.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-PodcastWriter.js.html b/modules/jala/docs/overview-summary-PodcastWriter.js.html deleted file mode 100644 index 935ed3a0..00000000 --- a/modules/jala/docs/overview-summary-PodcastWriter.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    PodcastWriter.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.PodcastWriter class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.PodcastWriterClass to create, modify and render standard-compliant - RSS 2.0 feeds including support for Apple's Podcast specification.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-RemoteContent.js.html b/modules/jala/docs/overview-summary-RemoteContent.js.html deleted file mode 100644 index 697ab0b0..00000000 --- a/modules/jala/docs/overview-summary-RemoteContent.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    RemoteContent.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.RemoteContent class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.RemoteContentAPI to define, fetch and update content - from a remote site.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Rss20Writer.js.html b/modules/jala/docs/overview-summary-Rss20Writer.js.html deleted file mode 100644 index 3705e4e6..00000000 --- a/modules/jala/docs/overview-summary-Rss20Writer.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Rss20Writer.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.Rss20Writer class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.Rss20WriterClass to create, modify and render standard-compliant - RSS 2.0 feeds.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-Utilities.js.html b/modules/jala/docs/overview-summary-Utilities.js.html deleted file mode 100644 index 98b6fa71..00000000 --- a/modules/jala/docs/overview-summary-Utilities.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Utilities.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.Utilities class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.UtilitiesThis class contains various convenience methods - which do not fit in any other class.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-XmlRpcRequest.js.html b/modules/jala/docs/overview-summary-XmlRpcRequest.js.html deleted file mode 100644 index 3287421a..00000000 --- a/modules/jala/docs/overview-summary-XmlRpcRequest.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    XmlRpcRequest.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.XmlRpcRequest class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.XmlRpcRequestInstances of this class provide the necessary functionality - for issueing XmlRpc requests to a remote service.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-XmlWriter.js.html b/modules/jala/docs/overview-summary-XmlWriter.js.html deleted file mode 100644 index f2f0e31c..00000000 --- a/modules/jala/docs/overview-summary-XmlWriter.js.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    XmlWriter.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.XmlWriter class.

    - -

    - -
    - - - - - - - - - - - - -
    - - Class Summary - -
    jala.XmlWriterThis class defines a generic interface to write - arbitrary and validating XML source code.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary-all.js.html b/modules/jala/docs/overview-summary-all.js.html deleted file mode 100644 index b45afdd9..00000000 --- a/modules/jala/docs/overview-summary-all.js.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    all.js

    - -
    - - - - -

    Summary

    -

    - - Wrapper for automatic inclusion of all Jala modules.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-summary.html b/modules/jala/docs/overview-summary.html deleted file mode 100644 index 1c059073..00000000 --- a/modules/jala/docs/overview-summary.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - -Jala 1.3 Overview - - - - - - - - - - - - - - - - - - -
    - -Jala 1.3 -
    - - -
    -
    - -

    Jala 1.3

    - -
    - - -

    - This document is the API Specification for - Jala 1.3. -

    - - - -

    Summary

    -

    - - Jala is a Helma-based library and utility project initially developed to ease the work at ORF.at's software development department. - - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - File Summary - -
    all.jsWrapper for automatic inclusion of all Jala modules.
    AsyncRequest.jsFields and methods of the jala.AsyncRequest class.
    BitTorrent.jsFields and methods of the jala.BitTorrent class.
    Captcha.jsFields and methods of the jala.Captcha class.
    Database.jsFields and methods of the jala.db package.
    Date.jsFields and methods of the jala.Date class.
    DnsClient.jsFields and methods of the jala.DnsClient class.
    Form.jsThis class can be used to render forms and to validate - and store user submits.
    Global.jsFields and methods of the Global prototype.
    History.jsFields and methods of the jala.History class.
    HopObject.jsAdditional fields and methods of the HopObject class.
    HtmlDocument.jsFields and methods of the jala.HtmlDocument class.
    I18n.jsMethods and macros for internationalization - of Helma applications.
    ImageFilter.jsFields and methods of the jala.ImageFilter class.
    IndexManager.jsFields and methods of the jala.IndexManager class.
    ListRenderer.jsFields and methods of the jala.ListRenderer class.
    Mp3.jsFields and methods of the jala.audio package.
    PodcastWriter.jsFields and methods of the jala.PodcastWriter class.
    RemoteContent.jsFields and methods of the jala.RemoteContent class.
    Rss20Writer.jsFields and methods of the jala.Rss20Writer class.
    Utilities.jsFields and methods of the jala.Utilities class.
    XmlRpcRequest.jsFields and methods of the jala.XmlRpcRequest class.
    XmlWriter.jsFields and methods of the jala.XmlWriter class.
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/overview-tree.html b/modules/jala/docs/overview-tree.html deleted file mode 100644 index 52df74e1..00000000 --- a/modules/jala/docs/overview-tree.html +++ /dev/null @@ -1,316 +0,0 @@ - - - - - -Jala 1.3 Class Hierarchy - - - - - - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    -

    Class Hierarchy

    - - - -
    - - - - - - - - - - - - - -
    -Jala 1.3 -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008
    - - diff --git a/modules/jala/docs/stylesheet.css b/modules/jala/docs/stylesheet.css deleted file mode 100644 index 7a35c0c1..00000000 --- a/modules/jala/docs/stylesheet.css +++ /dev/null @@ -1,39 +0,0 @@ -/* JSDoc style sheet */ - -/* Define colors, fonts and other style attributes here to override the defaults */ - -/* Page background color */ -body { background-color: #FFFFFF } - -/* Table colors */ -.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ -.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ -.TableRowColor { background: #FFFFFF } /* White */ - -/* Font used in left-hand frame lists */ -.FrameTitleFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } -.FrameHeadingFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } -.FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } - -/* Example of smaller, sans-serif font in frames */ -/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */ - -/* Navigation bar fonts and colors */ -.NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */ -.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */ -.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} -.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} - -.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} -.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} - -.jsdoc_ctime { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; - text-align: right } - -/* Sourcecode view */ -.sourceview { background: #FFFFFF } -.attrib { color: #DD7777 } -.comment { color: #55AA55 } -.reserved { color: #FF5555 } -.literal { color: #5555FF } - diff --git a/modules/jala/lib/dom4j-1.6.1.jar b/modules/jala/lib/dom4j-1.6.1.jar deleted file mode 100644 index c8c4dbb9..00000000 Binary files a/modules/jala/lib/dom4j-1.6.1.jar and /dev/null differ diff --git a/modules/jala/lib/id3-1.6.0d9.jar b/modules/jala/lib/id3-1.6.0d9.jar deleted file mode 100644 index 7da41c59..00000000 Binary files a/modules/jala/lib/id3-1.6.0d9.jar and /dev/null differ diff --git a/modules/jala/lib/javadns.jar b/modules/jala/lib/javadns.jar deleted file mode 100644 index 13b2ec77..00000000 Binary files a/modules/jala/lib/javadns.jar and /dev/null differ diff --git a/modules/jala/lib/jaxen-1.1-beta-8.jar b/modules/jala/lib/jaxen-1.1-beta-8.jar deleted file mode 100644 index 6b007d97..00000000 Binary files a/modules/jala/lib/jaxen-1.1-beta-8.jar and /dev/null differ diff --git a/modules/jala/lib/jid3lib-0.5.4.jar b/modules/jala/lib/jid3lib-0.5.4.jar deleted file mode 100644 index 63e5a672..00000000 Binary files a/modules/jala/lib/jid3lib-0.5.4.jar and /dev/null differ diff --git a/modules/jala/licenses/dom4j.txt b/modules/jala/licenses/dom4j.txt deleted file mode 100644 index 7cae050c..00000000 --- a/modules/jala/licenses/dom4j.txt +++ /dev/null @@ -1,40 +0,0 @@ -Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - -2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -3. The name "DOM4J" must not be used to endorse or promote - products derived from this Software without prior written - permission of MetaStuff, Ltd. For written permission, - please contact dom4j-info@metastuff.com. - -4. Products derived from this Software may not be called "DOM4J" - nor may "DOM4J" appear in their names without prior written - permission of MetaStuff, Ltd. DOM4J is a registered - trademark of MetaStuff, Ltd. - -5. Due credit should be given to the DOM4J Project - - http://www.dom4j.org - -THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules/jala/licenses/jala.txt b/modules/jala/licenses/jala.txt deleted file mode 100644 index d6456956..00000000 --- a/modules/jala/licenses/jala.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/jala/licenses/javadns.txt b/modules/jala/licenses/javadns.txt deleted file mode 100644 index 56e3f124..00000000 --- a/modules/jala/licenses/javadns.txt +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2001-2004, Gregg Wonderly -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -Neither the name of Gregg Wonderly nor the names of contributors to this -software may be used to endorse or promote products derived from this -software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/modules/jala/licenses/javamusictag.html b/modules/jala/licenses/javamusictag.html deleted file mode 100644 index 487e60aa..00000000 --- a/modules/jala/licenses/javamusictag.html +++ /dev/null @@ -1,613 +0,0 @@ - - - - GNU Lesser General Public License - GNU Project - Free Software Foundation (FSF) - - - -

    GNU Lesser General Public License

    - -

    - Version 2.1, February 1999 - -

    - -

    -

    Copyright (C) 1991, 1999 Free Software Foundation, Inc.
    -    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    -    Everyone is permitted to copy and distribute verbatim copies
    -    of this license document, but changing it is not allowed.
    -
    -    [This is the first released version of the Lesser GPL. It also counts
    -    as the successor of the GNU Library Public License, version 2, hence
    -    the version number 2.1.]
    -
    - - -

    Preamble

    - -

    - The licenses for most software are designed to take away your - freedom to share and change it. By contrast, the GNU General Public - Licenses are intended to guarantee your freedom to share and change - free software--to make sure the software is free for all its users. -

    - -

    - This license, the Lesser General Public License, applies to some - specially designated software packages--typically libraries--of the - Free Software Foundation and other authors who decide to use it. You - can use it too, but we suggest you first think carefully about whether - this license or the ordinary General Public License is the better - strategy to use in any particular case, based on the explanations below. -

    - -

    - When we speak of free software, we are referring to freedom of use, - not price. Our General Public Licenses are designed to make sure that - you have the freedom to distribute copies of free software (and charge - for this service if you wish); that you receive source code or can get - it if you want it; that you can change the software and use pieces of - it in new free programs; and that you are informed that you can do - these things. -

    - -

    - To protect your rights, we need to make restrictions that forbid - distributors to deny you these rights or to ask you to surrender these - rights. These restrictions translate to certain responsibilities for - you if you distribute copies of the library or if you modify it. -

    - -

    - For example, if you distribute copies of the library, whether gratis - or for a fee, you must give the recipients all the rights that we gave - you. You must make sure that they, too, receive or can get the source - code. If you link other code with the library, you must provide - complete object files to the recipients, so that they can relink them - with the library after making changes to the library and recompiling - it. And you must show them these terms so they know their rights. -

    - -

    - We protect your rights with a two-step method: (1) we copyright the - library, and (2) we offer you this license, which gives you legal - permission to copy, distribute and/or modify the library. -

    - -

    - To protect each distributor, we want to make it very clear that - there is no warranty for the free library. Also, if the library is - modified by someone else and passed on, the recipients should know - that what they have is not the original version, so that the original - author's reputation will not be affected by problems that might be - introduced by others. -

    - -

    - Finally, software patents pose a constant threat to the existence of - any free program. We wish to make sure that a company cannot - effectively restrict the users of a free program by obtaining a - restrictive license from a patent holder. Therefore, we insist that - any patent license obtained for a version of the library must be - consistent with the full freedom of use specified in this license. -

    - -

    - Most GNU software, including some libraries, is covered by the - ordinary GNU General Public License. This license, the GNU Lesser - General Public License, applies to certain designated libraries, and - is quite different from the ordinary General Public License. We use - this license for certain libraries in order to permit linking those - libraries into non-free programs. -

    - -

    - When a program is linked with a library, whether statically or using - a shared library, the combination of the two is legally speaking a - combined work, a derivative of the original library. The ordinary - General Public License therefore permits such linking only if the - entire combination fits its criteria of freedom. The Lesser General - Public License permits more lax criteria for linking other code with - the library. -

    - -

    - We call this license the "Lesser" General Public License because it - does Less to protect the user's freedom than the ordinary General - Public License. It also provides other free software developers Less - of an advantage over competing non-free programs. These disadvantages - are the reason we use the ordinary General Public License for many - libraries. However, the Lesser license provides advantages in certain - special circumstances. -

    - -

    - For example, on rare occasions, there may be a special need to - encourage the widest possible use of a certain library, so that it becomes - a de-facto standard. To achieve this, non-free programs must be - allowed to use the library. A more frequent case is that a free - library does the same job as widely used non-free libraries. In this - case, there is little to gain by limiting the free library to free - software only, so we use the Lesser General Public License. -

    - -

    - In other cases, permission to use a particular library in non-free - programs enables a greater number of people to use a large body of - free software. For example, permission to use the GNU C Library in - non-free programs enables many more people to use the whole GNU - operating system, as well as its variant, the GNU/Linux operating - system. -

    - -

    - Although the Lesser General Public License is Less protective of the - users' freedom, it does ensure that the user of a program that is - linked with the Library has the freedom and the wherewithal to run - that program using a modified version of the Library. -

    - -

    - The precise terms and conditions for copying, distribution and - modification follow. Pay close attention to the difference between a - "work based on the library" and a "work that uses the library". The - former contains code derived from the library, whereas the latter must - be combined with the library in order to run. -

    - -

    - -

    - -

    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    - - -

    - 0. - This License Agreement applies to any software library or other - program which contains a notice placed by the copyright holder or - other authorized party saying it may be distributed under the terms of - this Lesser General Public License (also called "this License"). - Each licensee is addressed as "you". -

    - -

    - A "library" means a collection of software functions and/or data - prepared so as to be conveniently linked with application programs - (which use some of those functions and data) to form executables. -

    - -

    - The "Library", below, refers to any such software library or work - which has been distributed under these terms. A "work based on the - Library" means either the Library or any derivative work under - copyright law: that is to say, a work containing the Library or a - portion of it, either verbatim or with modifications and/or translated - straightforwardly into another language. (Hereinafter, translation is - included without limitation in the term "modification".) -

    - -

    - "Source code" for a work means the preferred form of the work for - making modifications to it. For a library, complete source code means - all the source code for all modules it contains, plus any associated - interface definition files, plus the scripts used to control compilation - and installation of the library. -

    - -

    - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of - running a program using the Library is not restricted, and output from - such a program is covered only if its contents constitute a work based - on the Library (independent of the use of the Library in a tool for - writing it). Whether that is true depends on what the Library does - and what the program that uses the Library does. -

    - -

    - 1. - You may copy and distribute verbatim copies of the Library's - complete source code as you receive it, in any medium, provided that - you conspicuously and appropriately publish on each copy an - appropriate copyright notice and disclaimer of warranty; keep intact - all the notices that refer to this License and to the absence of any - warranty; and distribute a copy of this License along with the - Library. -

    - -

    - You may charge a fee for the physical act of transferring a copy, - and you may at your option offer warranty protection in exchange for a - fee. -

    - -

    - 2. - You may modify your copy or copies of the Library or any portion - of it, thus forming a work based on the Library, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: -

    - -

    -

      -
    • a) - The modified work must itself be a software library. -
    • b) - You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - -
    • c) - You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - -
    • d) - If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. -

      - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) -

      - -

      - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Library, - and can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based - on the Library, the distribution of the whole must be on the terms of - this License, whose permissions for other licensees extend to the - entire whole, and thus to each and every part regardless of who wrote - it. -

      - -

      - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Library. -

      - -

      - In addition, mere aggregation of another work not based on the Library - with the Library (or with a work based on the Library) on a volume of - a storage or distribution medium does not bring the other work under - the scope of this License. -

    - -

    - 3. - You may opt to apply the terms of the ordinary GNU General Public - License instead of this License to a given copy of the Library. To do - this, you must alter all the notices that refer to this License, so - that they refer to the ordinary GNU General Public License, version 2, - instead of to this License. (If a newer version than version 2 of the - ordinary GNU General Public License has appeared, then you can specify - that version instead if you wish.) Do not make any other change in - these notices. -

    - -

    - Once this change is made in a given copy, it is irreversible for - that copy, so the ordinary GNU General Public License applies to all - subsequent copies and derivative works made from that copy. -

    - -

    - This option is useful when you wish to copy part of the code of - the Library into a program that is not a library. -

    - -

    - 4. - You may copy and distribute the Library (or a portion or - derivative of it, under Section 2) in object code or executable form - under the terms of Sections 1 and 2 above provided that you accompany - it with the complete corresponding machine-readable source code, which - must be distributed under the terms of Sections 1 and 2 above on a - medium customarily used for software interchange. -

    - -

    - If distribution of object code is made by offering access to copy - from a designated place, then offering equivalent access to copy the - source code from the same place satisfies the requirement to - distribute the source code, even though third parties are not - compelled to copy the source along with the object code. -

    - -

    - 5. - A program that contains no derivative of any portion of the - Library, but is designed to work with the Library by being compiled or - linked with it, is called a "work that uses the Library". Such a - work, in isolation, is not a derivative work of the Library, and - therefore falls outside the scope of this License. -

    - -

    - However, linking a "work that uses the Library" with the Library - creates an executable that is a derivative of the Library (because it - contains portions of the Library), rather than a "work that uses the - library". The executable is therefore covered by this License. - Section 6 states terms for distribution of such executables. -

    - -

    - When a "work that uses the Library" uses material from a header file - that is part of the Library, the object code for the work may be a - derivative work of the Library even though the source code is not. - Whether this is true is especially significant if the work can be - linked without the Library, or if the work is itself a library. The - threshold for this to be true is not precisely defined by law. -

    - -

    - If such an object file uses only numerical parameters, data - structure layouts and accessors, and small macros and small inline - functions (ten lines or less in length), then the use of the object - file is unrestricted, regardless of whether it is legally a derivative - work. (Executables containing this object code plus portions of the - Library will still fall under Section 6.) -

    - -

    - Otherwise, if the work is a derivative of the Library, you may - distribute the object code for the work under the terms of Section 6. - Any executables containing that work also fall under Section 6, - whether or not they are linked directly with the Library itself. -

    - -

    - 6. - As an exception to the Sections above, you may also combine or - link a "work that uses the Library" with the Library to produce a - work containing portions of the Library, and distribute that work - under terms of your choice, provided that the terms permit - modification of the work for the customer's own use and reverse - engineering for debugging such modifications. -

    - -

    - You must give prominent notice with each copy of the work that the - Library is used in it and that the Library and its use are covered by - this License. You must supply a copy of this License. If the work - during execution displays copyright notices, you must include the - copyright notice for the Library among them, as well as a reference - directing the user to the copy of this License. Also, you must do one - of these things: -

    - -

    -

      -
    • a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - -
    • b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - -
    • c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - -
    • d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - -
    • e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. -
    - -

    - For an executable, the required form of the "work that uses the - Library" must include any data and utility programs needed for - reproducing the executable from it. However, as a special exception, - the materials to be distributed need not include anything that is - normally distributed (in either source or binary form) with the major - components (compiler, kernel, and so on) of the operating system on - which the executable runs, unless that component itself accompanies - the executable. -

    - -

    - It may happen that this requirement contradicts the license - restrictions of other proprietary libraries that do not normally - accompany the operating system. Such a contradiction means you cannot - use both them and the Library together in an executable that you - distribute. -

    - -

    - 7. You may place library facilities that are a work based on the - Library side-by-side in a single library together with other library - facilities not covered by this License, and distribute such a combined - library, provided that the separate distribution of the work based on - the Library and of the other library facilities is otherwise - permitted, and provided that you do these two things: -

    - -

    -

      -
    • a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - -
    • b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. -
    - -

    - 8. You may not copy, modify, sublicense, link with, or distribute - the Library except as expressly provided under this License. Any - attempt otherwise to copy, modify, sublicense, link with, or - distribute the Library is void, and will automatically terminate your - rights under this License. However, parties who have received copies, - or rights, from you under this License will not have their licenses - terminated so long as such parties remain in full compliance. -

    - -

    - 9. - You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify or - distribute the Library or its derivative works. These actions are - prohibited by law if you do not accept this License. Therefore, by - modifying or distributing the Library (or any work based on the - Library), you indicate your acceptance of this License to do so, and - all its terms and conditions for copying, distributing or modifying - the Library or works based on it. -

    - -

    - 10. - Each time you redistribute the Library (or any work based on the - Library), the recipient automatically receives a license from the - original licensor to copy, distribute, link with or modify the Library - subject to these terms and conditions. You may not impose any further - restrictions on the recipients' exercise of the rights granted herein. - You are not responsible for enforcing compliance by third parties with - this License. -

    - -

    - 11. - If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot - distribute so as to satisfy simultaneously your obligations under this - License and any other pertinent obligations, then as a consequence you - may not distribute the Library at all. For example, if a patent - license would not permit royalty-free redistribution of the Library by - all those who receive copies directly or indirectly through you, then - the only way you could satisfy both it and this License would be to - refrain entirely from distribution of the Library. -

    - -

    - If any portion of this section is held invalid or unenforceable under any - particular circumstance, the balance of the section is intended to apply, - and the section as a whole is intended to apply in other circumstances. -

    - -

    - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any - such claims; this section has the sole purpose of protecting the - integrity of the free software distribution system which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is willing - to distribute software through any other system and a licensee cannot - impose that choice. -

    - -

    - This section is intended to make thoroughly clear what is believed to - be a consequence of the rest of this License. -

    - -

    - 12. - If the distribution and/or use of the Library is restricted in - certain countries either by patents or by copyrighted interfaces, the - original copyright holder who places the Library under this License may add - an explicit geographical distribution limitation excluding those countries, - so that distribution is permitted only in or among countries not thus - excluded. In such case, this License incorporates the limitation as if - written in the body of this License. -

    - -

    - 13. - The Free Software Foundation may publish revised and/or new - versions of the Lesser General Public License from time to time. - Such new versions will be similar in spirit to the present version, - but may differ in detail to address new problems or concerns. -

    - -

    - Each version is given a distinguishing version number. If the Library - specifies a version number of this License which applies to it and - "any later version", you have the option of following the terms and - conditions either of that version or of any later version published by - the Free Software Foundation. If the Library does not specify a - license version number, you may choose any version ever published by - the Free Software Foundation. -

    - -

    - 14. - If you wish to incorporate parts of the Library into other free - programs whose distribution conditions are incompatible with these, - write to the author to ask for permission. For software which is - copyrighted by the Free Software Foundation, write to the Free - Software Foundation; we sometimes make exceptions for this. Our - decision will be guided by the two goals of preserving the free status - of all derivatives of our free software and of promoting the sharing - and reuse of software generally. -

    - -

    - NO WARRANTY -

    - -

    - 15. - BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. - EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR - OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY - KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE - LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME - THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -

    - -

    - 16. - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY - AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU - FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE - LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING - RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A - FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF - SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - DAMAGES. -

    - \ No newline at end of file diff --git a/modules/jala/tests/1meg.reference-win.torrent b/modules/jala/tests/1meg.reference-win.torrent deleted file mode 100644 index bfa6890a..00000000 --- a/modules/jala/tests/1meg.reference-win.torrent +++ /dev/null @@ -1 +0,0 @@ -d8:announce30:http://tracker.orf.at/announce13:creation datei1172497604e4:infod6:lengthi1048576e4:name4:1meg12:piece lengthi262144e6:pieces80:. WYT>Y. WYT>Y. WYT>Y. WYT>Yee \ No newline at end of file diff --git a/modules/jala/tests/1meg.reference.torrent b/modules/jala/tests/1meg.reference.torrent deleted file mode 100644 index 16454c90..00000000 Binary files a/modules/jala/tests/1meg.reference.torrent and /dev/null differ diff --git a/modules/jala/tests/AsyncRequest.js b/modules/jala/tests/AsyncRequest.js deleted file mode 100644 index c7033aa2..00000000 --- a/modules/jala/tests/AsyncRequest.js +++ /dev/null @@ -1,65 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -var result = undefined; - -/** - * A simple test of jala.AsyncRequest. It constructs a new AsyncRequest - * with a test function defined below that sets various properties - * of the global result object above. After evaluating the async request - * the current thread sleeps for a short period of time to wait for - * the other request to finish, and then does the testing of the result. - */ -var testAsyncRequest = function() { - var r = new jala.AsyncRequest(global, "testFunction"); - r.run("jala"); - // wait until the async request started above has finished - // before testing the result, but no longer than 1 second. - var elapsed = 0; - var interval = 5; - while (result === undefined && elapsed < 1000) { - elapsed += interval; - java.lang.Thread.sleep(interval); - } - assertNotUndefined(result); - assertEqual(result.name, "jala"); - assertEqual(result.request, req); - assertEqual(result.response, res); - assertFalse(r.isAlive()); - return; -}; - -/** - * A simple test function that assigns an object to the global - * property "result". - * @param {String} name A string to use as name - */ -var testFunction = function(name) { - result = { - name: name, - request: req, - response: res - }; - return; -}; diff --git a/modules/jala/tests/BitTorrent.js b/modules/jala/tests/BitTorrent.js deleted file mode 100644 index ac1e92bd..00000000 --- a/modules/jala/tests/BitTorrent.js +++ /dev/null @@ -1,59 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * A simple test of jala.BitTorrent. - * FIXME: Needs resolution of issue #33 - */ -var testBitTorrent = function() { - var size = 1024 * 1024; // 1 meg - var file = new java.io.File(jala.Test.getTestFile("1meg")); - var fos = new java.io.FileOutputStream(file, false); - var channel = fos.getChannel(); - var iterations = 0; - while (channel.size() < size) { - channel.write(java.nio.ByteBuffer.allocate(1024)); - } - channel.close(); - fos.close(); - - var torrent = new jala.BitTorrent(file); - // Testing against file generated with BitTorrent.app (OS X) - torrent.set("announce", "http://tracker.orf.at/announce"); - // S3 defines a multitracker list with a single tracker item - //torrent.set("announce-list", [["http://tracker.amazonaws.com:6969/announce"]]); - torrent.setCreationDate(new Date(2007, 1, 26, 14, 46, 44)); - torrent.save(); - file["delete"](); - - try { - var torrentFile = torrent.getTorrentFile(); - var refFile = new helma.File(jala.Test.getTestFile("1meg.reference.torrent")); - assertEqual(torrentFile.readAll().trim(), refFile.readAll().trim()); - } catch (x) { - throw(x); - } finally { - torrentFile.remove(); - } - return; -}; diff --git a/modules/jala/tests/Database.js b/modules/jala/tests/Database.js deleted file mode 100644 index a2b95509..00000000 --- a/modules/jala/tests/Database.js +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Contains the system's temporary directory - * @type helma.File - * @private - */ -var tmpDir = new helma.File(java.lang.System.getProperty("java.io.tmpdir")); - -/** - * Contains the server created in testServer method - * @private - */ -var server = null; - -/** - * Basic tests for jala.db.RamDatabase. All of these tests are - * valid for jala.db.FileDatabase too. - */ -var testRamDatabase = function() { - var db = new jala.db.RamDatabase("test"); - assertNotNull(db); - assertEqual(db.getName(), "test"); - assertEqual(db.getDatabasePath(), "mem:test"); - assertEqual(db.getUrl(), "jdbc:h2:mem:test"); - // test connection to database - var conn = db.getConnection(); - assertNotNull(conn); - assertTrue(conn instanceof helma.Database); - - // create a table - db.createTable("test", [ - { - name: "id", - type: java.sql.Types.INTEGER, - nullable: false, - unique: true - }, - { - name: "name", - type: java.sql.Types.VARCHAR, - length: 255 - } - ], "id"); - - // test if the table exists - assertTrue(db.tableExists("test")); - - // dump database - var dumpFile = new helma.File(tmpDir, "backup.test.sql"); - assertTrue(db.dump(dumpFile)); - assertTrue(dumpFile.exists()); - assertTrue(dumpFile.getLength() > 0); - // remove dump file again - dumpFile.remove(); - - // drop table - db.dropTable("test"); - assertFalse(db.tableExists("test")); - - // test db shutdown - db.shutdown(); - assertThrows(function() { - conn.query("select 1 = 1"); - }, Packages.org.h2.jdbc.JdbcSQLException); - return; -}; - -/** - * Basic tests for jala.db.FileDatabase that are different to - * jala.db.RamDatabase - */ -var testFileDatabase = function() { - var db = new jala.db.FileDatabase("test", tmpDir); - assertNotNull(db); - assertEqual(db.getName(), "test"); - assertEqual(db.getDirectory(), tmpDir); - - var dbDir = new helma.File(tmpDir, "test"); - assertEqual(db.getDatabasePath(), "file:" + dbDir.getAbsolutePath()); - assertEqual(db.getUrl(), "jdbc:h2:file:" + dbDir.getAbsolutePath()); - - // execute sql script (need to do that, otherwise the backup won't - // work because the database is empty) - var sqlFile = jala.Test.getTestFile("Database.script.sql"); - assertTrue(db.runScript(sqlFile)); - assertTrue(db.tableExists("test")); - - // test backup - var backupFile = new helma.File(tmpDir, "backup.zip"); - assertTrue(db.backup(backupFile)); - assertTrue(backupFile.exists()); - assertTrue(backupFile.getLength() > 0); - - // remove the database - db.remove(); - assertFalse((new helma.File(db.getDirectory(), db.getName() + ".data.db")).exists()); - assertFalse((new helma.File(db.getDirectory(), db.getName() + ".index.db")).exists()); - assertFalse((new helma.File(db.getDirectory(), db.getName() + ".trace.db")).exists()); - - // test restore - assertTrue(db.restore(backupFile)); - assertTrue(db.tableExists("test")); - - // remove backup file and database - backupFile.remove(); - db.remove(); - - return; -}; - -var testServer = function() { - server = new jala.db.Server(tmpDir); - // test default config - assertEqual(tmpDir, server.getDirectory()); - assertEqual(server.getPort(), 9092); - assertFalse(server.useSsl()); - assertFalse(server.isPublic()); - assertFalse(server.createOnDemand()); - - // test setting config properties - server.useSsl(true); - assertTrue(server.useSsl()); - server.isPublic(true); - assertTrue(server.isPublic()); - server.createOnDemand(true); - assertTrue(server.createOnDemand()); - - // reset back some of them - server.useSsl(false); - assertFalse(server.useSsl()); - server.isPublic(false); - assertFalse(server.isPublic()); - - // start the server - assertTrue(server.start()); - - // test connection properties (this also includes testing - // of server.getUrl()) - var props = server.getProperties("test", "test", "1111"); - assertEqual(props.getProperty("test.url"), "jdbc:h2:tcp://localhost:9092/test"); - assertEqual(props.getProperty("test.driver"), "org.h2.Driver"); - assertEqual(props.getProperty("test.user"), "test"); - assertEqual(props.getProperty("test.password"), "1111"); - - var conn = server.getConnection("test", "test", "1111"); - assertNotNull(conn); - - // stop the server - assertTrue(server.stop()); - // and remove the file database created above - var db = new jala.db.FileDatabase("test", tmpDir, "test", "1111"); - db.remove(); - return; -}; - -/** - * Stuff to do on cleanup - */ -var cleanup = function() { - if (server != null) { - server.stop(); - } - return; -}; diff --git a/modules/jala/tests/Database.script.sql b/modules/jala/tests/Database.script.sql deleted file mode 100644 index 7beab74d..00000000 --- a/modules/jala/tests/Database.script.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE test (id INTEGER NOT NULL, name VARCHAR(255), PRIMARY KEY (id)); -INSERT INTO test (id, name) VALUES (1, 'jala'); -INSERT INTO test (id, name) VALUES (2, 'Database'); -INSERT INTO test (id, name) VALUES (3, 'Test'); diff --git a/modules/jala/tests/DnsClient.js b/modules/jala/tests/DnsClient.js deleted file mode 100644 index 19ceb720..00000000 --- a/modules/jala/tests/DnsClient.js +++ /dev/null @@ -1,66 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -var dnsClient = new jala.DnsClient("68.12.16.25"); -var result; - -/** - * Testing default mode (A records) - */ -var testAQuery = function() { - result = dnsClient.query("nomatic.org"); - assertEqual(result.length, 1); - assertEqual(result[0].ipAddress, "213.129.249.34"); - return; -}; - -/** - * Testing SOA record queries - */ -var testSoaQuery = function() { - result = dnsClient.query("nomatic.org", jala.DnsClient.TYPE_SOA); - assertEqual(result.length, 1); - assertEqual(result[0].email, "hostmaster.nomatic.org"); - return; -}; - -/** - * Testing MX record queries - */ -var testMxQuery = function() { - result = dnsClient.query("nomatic.org", jala.DnsClient.TYPE_MX); - assertEqual(result.length, 1); - assertEqual(result[0].mx, "grace.nomatic.org"); - return; -}; - -/** - * Testing NS record queries - */ -var testNsQuery = function() { - result = dnsClient.query("nomatic.org", jala.DnsClient.TYPE_NS); - assertEqual(result.length, 3); - // can't test single records as their order changes unpredictably - return; -}; diff --git a/modules/jala/tests/Form.fileupload.doc b/modules/jala/tests/Form.fileupload.doc deleted file mode 100644 index 40b88854..00000000 Binary files a/modules/jala/tests/Form.fileupload.doc and /dev/null differ diff --git a/modules/jala/tests/Form.imageupload.jpg b/modules/jala/tests/Form.imageupload.jpg deleted file mode 100644 index 84a3d709..00000000 Binary files a/modules/jala/tests/Form.imageupload.jpg and /dev/null differ diff --git a/modules/jala/tests/Form.js b/modules/jala/tests/Form.js deleted file mode 100644 index 0fee8358..00000000 --- a/modules/jala/tests/Form.js +++ /dev/null @@ -1,460 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * a global variable containing the form instance - * @type jala.Form - */ -var form; - - -/** - * Create and configure the form object - */ -var setup = function() { - form = jala.Form.create(getConfig(), new DataObject()); - // form.render(); // show the test form - return; -}; - - -/** - * Test the form rendering mechanism - */ -var testFormRender = function() { - var html = new jala.HtmlDocument(form.renderAsString()); - var list = html.getAll("*"); - - var idx = 2; - assertEqual(list[idx].name, "form"); - assertAttribute(list[idx].attributes, "id", "test"); - assertAttribute(list[idx].attributes, "class", "form"); - assertAttribute(list[idx].attributes, "name", "test"); - assertAttribute(list[idx].attributes, "enctype", "multipart/form-data"); - assertAttribute(list[idx].attributes, "method", "post"); - - - // alias / input - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testAlias"); - assertAttribute(list[idx].attributes, "class", "component require"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testAliasControl"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testAliasControl"); - assertAttribute(list[idx].attributes, "class", "input"); - assertAttribute(list[idx].attributes, "type", "text"); - assertAttribute(list[idx].attributes, "maxlength", "10"); - assertAttribute(list[idx].attributes, "name", "alias"); - assertAttribute(list[idx].attributes, "size", "20"); - - assertEqual(list[++idx].name, "div"); - assertEqual(list[idx].value, "Enter alias."); - assertAttribute(list[idx].attributes, "class", "helpText"); - - - // desc / textarea - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testDesc"); - assertAttribute(list[idx].attributes, "class", "component require"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testDescControl"); - - assertEqual(list[++idx].name, "textarea"); - assertAttribute(list[idx].attributes, "id", "testDescControl"); - assertAttribute(list[idx].attributes, "class", "textarea"); - assertAttribute(list[idx].attributes, "name", "desc"); - assertAttribute(list[idx].attributes, "cols", "30"); - assertAttribute(list[idx].attributes, "rows", "3"); - - - - // pushdate / date - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testPushdate"); - assertAttribute(list[idx].attributes, "class", "component require"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testPushdateControl"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testPushdateControl"); - assertAttribute(list[idx].attributes, "class", "date"); - assertAttribute(list[idx].attributes, "type", "text"); - assertAttribute(list[idx].attributes, "name", "pushdate"); - - - // isonline / checkbox - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testIsonline"); - assertAttribute(list[idx].attributes, "class", "component optional"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testIsonlineControl"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testIsonlineControl"); - assertAttribute(list[idx].attributes, "type", "checkbox"); - assertAttribute(list[idx].attributes, "class", "checkbox"); - assertAttribute(list[idx].attributes, "name", "isonline"); - assertAttribute(list[idx].attributes, "value", "1"); - - - // category / select - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testCategory"); - assertAttribute(list[idx].attributes, "class", "component optional"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testCategoryControl"); - - assertEqual(list[++idx].name, "select"); - assertAttribute(list[idx].attributes, "id", "testCategoryControl"); - assertAttribute(list[idx].attributes, "class", "select"); - assertAttribute(list[idx].attributes, "name", "category"); - assertAttribute(list[idx].attributes, "size", "1"); - - assertEqual(list[++idx].name, "option"); - assertAttribute(list[idx].attributes, "value", "cat0"); - - assertEqual(list[++idx].name, "option"); - assertAttribute(list[idx].attributes, "value", "cat1"); - - assertEqual(list[++idx].name, "option"); - assertAttribute(list[idx].attributes, "value", "cat2"); - - assertEqual(list[++idx].name, "option"); - assertAttribute(list[idx].attributes, "value", "cat3"); - - - // fieldset - assertEqual(list[++idx].name, "fieldset"); - - assertEqual(list[++idx].name, "legend"); - assertEqual(list[idx].value, "a fieldset"); - - - // fileupload - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testFileupload"); - assertAttribute(list[idx].attributes, "class", "component optional"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testFileuploadControl"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testFileuploadControl"); - assertAttribute(list[idx].attributes, "class", "file"); - assertAttribute(list[idx].attributes, "type", "file"); - assertAttribute(list[idx].attributes, "accept", "application/msword"); - assertAttribute(list[idx].attributes, "name", "fileupload"); - - - // imageupload - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testImageupload"); - assertAttribute(list[idx].attributes, "class", "component optional"); - - assertEqual(list[++idx].name, "label"); - assertAttribute(list[idx].attributes, "for", "testImageuploadControl"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testImageuploadControl"); - assertAttribute(list[idx].attributes, "class", "image"); - assertAttribute(list[idx].attributes, "type", "file"); - assertAttribute(list[idx].attributes, "name", "imageupload"); - - - // submit - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testSubmit"); - assertAttribute(list[idx].attributes, "class", "component"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testSubmitControl"); - assertAttribute(list[idx].attributes, "class", "submit"); - assertAttribute(list[idx].attributes, "name", "submit"); - assertAttribute(list[idx].attributes, "value", "Submit this form"); - assertAttribute(list[idx].attributes, "type", "submit"); - - - // cancel - assertEqual(list[++idx].name, "div"); - assertAttribute(list[idx].attributes, "id", "testCancel"); - assertAttribute(list[idx].attributes, "class", "component"); - - assertEqual(list[++idx].name, "input"); - assertAttribute(list[idx].attributes, "id", "testCancelControl"); - assertAttribute(list[idx].attributes, "class", "button"); - assertAttribute(list[idx].attributes, "name", "cancel"); - assertAttribute(list[idx].attributes, "value", "Cancel edit"); - assertAttribute(list[idx].attributes, "type", "button"); - - return; -} - - -/** - * Test the form validation mechanism - */ -var testFormValidate = function() { - var reqData = getRequestData(); - - // default userinput values that should validate - var tracker = form.validate(reqData); - assertFalse(tracker.hasError()); - - // now try invalid values in userinput: - reqData["alias"] = "a"; - reqData["desc"] = ""; - reqData["pushdate"] = "17.5.2007"; - reqData["category"] = "invalidOption"; - tracker = form.validate(reqData); - assertTrue(tracker.hasError()); - assertEqual(tracker.errors["alias"], "Alias is too short."); - assertEqual(tracker.errors["desc"], "Please enter text into this field."); - assertEqual(tracker.errors["pushdate"], "This date cannot be parsed."); - assertEqual(tracker.errors["category"], "Please select a valid option."); - - // reset to default userinput: - reqData = getRequestData(); - // require a smaller image: - form.components.uploadfieldset.components.imageupload.require("maxwidth", 100, "Maximum width exceeded."); - tracker = form.validate(reqData); - assertTrue(tracker.hasError()); - assertEqual(tracker.errors["imageupload"], "Maximum width exceeded."); - // undo image restriction: - form.components.uploadfieldset.components.imageupload.require("maxwidth", 200, "Maximum width exceeded."); - tracker = form.validate(reqData); - assertFalse(tracker.hasError()); - - return; -}; - - -/** - * Test the form rendering mechanism in the case of an error - */ -var testFormRenderWithError = function() { - var reqData = getRequestData(); - reqData["alias"] = "a"; - var tracker = form.validate(reqData); - - var html = new jala.HtmlDocument(form.renderAsString()); - var list = html.getAll("*"); - assertEqual(list[4].name, "div"); - assertEqual(list[4].value, "Alias is too short."); - assertAttribute(list[4].attributes, "class", "errorText"); -}; - - -/** - * Test the form save mechanism - */ -var testFormSave = function() { - var dataObj = form.getDataObject(); - - var reqData = getRequestData(); - var tracker = form.validate(reqData); - assertFalse(tracker.hasError()); - form.save(); - assertEqual(dataObj.alias, "aliasValue"); - assertEqual(dataObj.getProperty("desc"), "descriptionValue"); - assertEqual(dataObj.pushdate.toString(), new Date(2007, 4, 17, 11, 32, 0).toString()); - assertEqual(dataObj.isonline, 1); - assertEqual(dataObj.getProperty("category"), "cat2"); - - return; -} - - - -/** - * Helper function to dump an html element to the response - * @param {Object} el - */ -var debugElement = function(el) { - res.write("" + el.name + " (" + el.value + ")
    "); - if (el.attributes) { - var attrList = el.attributes; - for (var i=0; i"); - } - } -}; - - -/** - * Helper function to assert that a given attribute exists - * in an element - * @param {Array} attrList Array with attribute objects - * @param {String} name Name of attribute - * @param {String} value Value of attribute - */ -var assertAttribute = function(attrList, name, value) { - for (var i=0; iHello, World!' + - 'foo' + - '' + - 'foobar' + - ''; - -/** - * Simple test of the HtmlDocument.getLinks method. - * An instance of HtmlDocument is created from a very - * simple HTML source. The result of getLinks is then - * evaluated and tested. - */ -var testGetLinks = function() { - var html = new jala.HtmlDocument(source); - var links = html.getLinks(); - assertEqual(links.constructor, Array); - assertEqual(links.length, 3); - assertEqual(links[0].constructor, Object); - for (var i in links) { - assertNotUndefined(links[i].url); - assertNotUndefined(links[i].text); - } - assertEqual(links[0].url, "http://localhost/1"); - assertEqual(links[0].text, "foo"); - assertEqual(links[1].url, "http://localhost/2"); - assertEqual(links[1].text, "bar"); - assertEqual(links[2].url, "http://localhost/3"); - assertEqual(links[2].text, "foobar"); - return; -}; - -/** - * Simple test of the HtmlDocument.geAll method. - * An instance of HtmlDocument is created from a very - * simple HTML source. The result of getAll is then - * evaluated and tested. - */ -var testGetAll = function() { - var names = ["html", "head", "title", "body", "h1", "a", "div", "a", "a"]; - var html = new jala.HtmlDocument(source); - var list = html.getAll("*"); - for (var i in list) { - assertNotUndefined(list[i].name); - assertEqual(list[i].name, names[i]); - } - assertEqual(list[2].value, "Test"); - assertEqual(list[4].value, "Hello, World!"); - assertEqual(list[5].value, "foo"); - assertEqual(list[7].value, "bar"); - assertEqual(list[8].value, "foobar"); - assertEqual(html.getAll("h1")[0].value, "Hello, World!"); - return; -}; diff --git a/modules/jala/tests/I18n.js b/modules/jala/tests/I18n.js deleted file mode 100644 index 4305f06a..00000000 --- a/modules/jala/tests/I18n.js +++ /dev/null @@ -1,136 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Declare which test methods should be run in which order - * @type Array - * @final - */ - -var oldMessages; - -/** - * Called before running the tests - */ -var setup = function() { - // save any currently used message bundle before - // creating the one for this test - oldMessages = jala.i18n.getMessages(); - // setup the test message bundle - var messages = {}; - messages.de_AT = { - "Hello, World!": "Hallo, Welt!", - "This is {0}.": "Das ist {0}.", - "You've got one new mail.": "Du hast eine neue E-Mail.", - "You've got {0} new mails.": "Du hast {0} neue E-Mails." - }; - // tell jala where to find the messages - jala.i18n.setMessages(messages); - // assign a method for retrieving the locale for translation - jala.i18n.setLocaleGetter(new Function("return res.meta.locale;")); - // set the locale to use by jala.i18n - res.meta.locale = new java.util.Locale("de", "AT"); - return; -}; - - -/** - * Called after tests have finished. This method will be called - * regarless whether the test succeeded or failed. - */ -var cleanup = function() { - // restore any previous message set - jala.i18n.setMessages(oldMessages); - return; -}; - -/** - * Tests for formatMessage - */ -var testFormatMessage = function() { - var msg = "Es ist jetzt {0,date,EEEE, dd. MMMM yyyy, HH:mm} Uhr."; - var args = [new Date(2007, 1, 8, 17, 58)]; - var result = jala.i18n.formatMessage(msg, args); - var expected = "Es ist jetzt Donnerstag, 08. Februar 2007, 17:58 Uhr."; - assertEqual(expected, result); - return; -}; - -/** - * Tests for gettext() - */ -var testGettext = function() { - assertEqual("Hallo, Welt!", gettext("Hello, World!")); - // test not found message key - assertEqual("Hello You!", gettext("Hello You!")); - // test gettext with additional replacement value - assertEqual("Das ist Jala I18n.", gettext("This is {0}.", "Jala I18n")); - return; -}; - -/** - * Tests for ngettext() - */ -var testNgettext = function() { - // zero - assertEqual("Du hast 0 neue E-Mails.", - ngettext("You've got one new mail.", - "You've got {0} new mails.", - 0)); - // one - assertEqual("Du hast eine neue E-Mail.", - ngettext("You've got one new mail.", - "You've got {0} new mails.", - 1)); - // more - assertEqual("Du hast 23 neue E-Mails.", - ngettext("You've got one new mail.", - "You've got {0} new mails.", - 23)); - return; -}; - -/** - * Tests for message macro - */ -var testMessageMacro = function() { - // singular - var skin = createSkin('<% message text="You\'ve got one new mail." %>'); - assertEqual("Du hast eine neue E-Mail.", renderSkinAsString(skin)); - - res.handlers.testHandler = {value: 0}; - // value replacement using testHandler - skin = createSkin('<% message text="You\'ve got {0} new mails." values="testHandler.value" %>'); - assertEqual("Du hast 0 neue E-Mails.", renderSkinAsString(skin)); - // plural including replacement using testHandler - res.handlers.testHandler.value = 23; - skin = createSkin('<% message text="You\'ve got one new mail." plural="You\'ve got {0} new mails." values="testHandler.value" %>'); - assertEqual("Du hast 23 neue E-Mails.", renderSkinAsString(skin)); - // using a value of the param object passed to the skin - // FIXME: appearently this doesn't work, but why? - /* - skin = createSkin('<% message text="You\'ve got one new mail." plural="You\'ve got {0} new mails." values="param.spam" %>'); - assertEqual("Du hast 45 neue E-Mails.", renderSkinAsString(skin, {spam: 45})); - */ -}; diff --git a/modules/jala/tests/ImageFilter.js b/modules/jala/tests/ImageFilter.js deleted file mode 100644 index cb588788..00000000 --- a/modules/jala/tests/ImageFilter.js +++ /dev/null @@ -1,100 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - -/** - * Called after tests have finished. This method will be called - * regarless whether the test succeeded or failed. - */ -var cleanup = function() { - var tempDir = new helma.File(java.lang.System.getProperty("java.io.tmpdir")); - var names = ["sharpen", "unsharpMask", "gaussianBlur"]; - var file; - for (var i=0; iSubclasses:
    -' . -# join('
    -', -# map ({"$_"} -# map ( { s/\s*(\w+)\s*/$1/; $_} @{@_->[0]}) -# ) -# ) . '

    ' -# }; -# -# $CLASS_ATTRS_MAP{with} = -# sub { -# 'This class has a \'@with\' attribute' -# }; -#}; - -# Method attributes -# eval { -# -# Uncomment this to allow the filename to be displayed for -# each function -# -# $METHOD_ATTRS_MAP{filename} = -# sub { -# '

    Filename: ' . $_[0] . '

    ' -# }; -# $CLASS_ATTRS_MAP{filename} = $METHOD_ATTRS_MAP{filename}; -# -# }; -# - diff --git a/modules/jala/util/HopKit/JSDoc/CHANGES b/modules/jala/util/HopKit/JSDoc/CHANGES deleted file mode 100644 index deae94f5..00000000 --- a/modules/jala/util/HopKit/JSDoc/CHANGES +++ /dev/null @@ -1,605 +0,0 @@ -JSDoc 1.9.9.2 -============= - -- Fixed disappearing argument list for package-style class constructors - -JSDoc 1.9.9.1 -============= - -- Fixed bug in template dir designation that caused JSDoc to crash if - run from an absolute path - -JSDoc 1.9.9 -=========== - -- Added a commandline parameter for supplying a template directory - -- Adding sorting of class names on overview-summary-$filename.js - (sf.net bug #1416564) - -- Fix for broken anchors from the overview-summary-$filename page to static - methods (SF.net bug #1416543) - -JSDoc 1.9.8.1 -============= - -- Don't touch the file source (src) when processing the file overview data - -- Pick up functions as constructors of the @class tag is used - -JSDoc 1.9.8 -=========== - -- Allow the @base tag to accept the form: @base ClassName URL (RFE 1114510) - -- Be more lenient with @param and @return types (RFE 1104728) - -- Corrected CSS error, changed "pts" to "pt" - -JSDoc 1.9.7 -=========== - -- Added "--no-lexical-privates" option to ignore locally-defined values - from within constructors - -- Fixed linking to static fields/methods - -JSDoc 1.9.6.2 -============= - -- Set correct permissions on files in packaging script - -- Fixed compile error on some versions of perl - -- Create distinct anchors for static methods and fields in HTML so that - if there is a static and instance method of the same name, the links work - correctly - -JSDoc 1.9.6.1 -============= - -- Updated unit tests for clearing of function contents - -- Removed collapsing of string literals; this was originally added for version - 1.9.5.1 to avoid segfaults, but the decision has been made that it is up - to the user to use a version of perl that doesn't segfault instead of - trying to work around it in perl code. - -- Added (experimental) @exec tag for initialization blocks that should be 'run' - -JSDoc 1.9.6 -=========== - -- Fix for incorrect return type and parameter types for static method - listing in file overview - -- Clear out unused nested functions with the preprocessor to avoid problems - -JSDoc 1.9.5.8 -============= - -- Yet another fix for __defineGetter__ and __defineSetter__ - -JSDoc 1.9.5.7 -============= - -- Fixed bug in syntax highlighting for single-line inline comments - -- Fixed bug in preprocessing of __defineGetter__ and __defineSetter__ - -JSDoc 1.9.5.6 -============= - -- Fixed incorrect listing of private classes when --private not enabled - -JSDoc 1.9.5.4 -============= - -- Corrected bug with function assignment inside constructor - -JSDoc 1.9.5.3 -============= - -- Added ability to specify different file extensions on commandline - -JSDoc 1.9.5.2 -============= - -- Fixed formatted text munging for @class description - -- Added support for @package tag to be used with XMI export - -JSDoc 1.9.5.1 -============= - -- Added collapsing of string literals during preprocessing - -JSDoc 1.9.5 -=========== - -- Added listing of global (static) methods to file overview summary, code - submitted by Jeremy Gillick - -- Allow a global variable to be defined as a class from an anonymous - function declaration - -JSDoc 1.9.4.2.1 -=============== - -- Further fix for typed parameter names starting with a dollar sign - -JSDoc 1.9.4.2 -============= - -- Added ability to handle parameter names starting with a dollar sign - -JSDoc 1.9.4.1 -============= - -- Only use the first sentence for file and class summary on the - overview pages - -- Add a non-breaking space in the overview summary tables when there is no - appropriate value to display - -JSDoc 1.9.4 -=========== - -- If there are multiple source files documented, the index page defaults - to the overview summary for the main frame - -- Made JSDoc site link open in parent frame - -- Added overview and file summary tables (similar to package overview table - in JavaDoc) - -JSDoc 1.9.3.1 -============= - -- Fixed duplicate class-tree output - -JSDoc 1.9.3 -=========== - -- Added alpha release of XML and XMI output formats - -- Upgrade a function to a class if the @base tag is used - -- Fixed issue with sub-package nested classes requiring the @addon tag - -- Added the implicit "Object" class to the inheritance tree, as well as - other classes that are referenced but not defined - -JSDoc 1.9.2.1 -============= - -- Added @addon tag, which is used when adding static methods to core classes - or classes not defined within the files being documented - -- Fix for the base class of nested classes not being properly set - -- Fix for infinite recursion when all classes are private - - -JSDoc 1.9.2 -=========== - -- Removed unecessary table from overview-summary.tmpl - -- Added the @ignore tag to allow total hiding of functions - -- Fix for incorrect marking of methods as void when the return value is - enclosed in parentheses - -- Fix so that methods with a @return tag but without a return statement - are not marked as void - -- Fixed issue with not all files being listed in the file listing - - -JSDoc 1.9.1.3 -============= - -- Fixed issue with backslashes in path - -- Fixed issue with

     tags and JavaScript code within fileoverview sections
    -
    -- Made documented versions of a method take precedence over a 
    -  non-documented version
    -
    -- Added support for prototype assignment without parentheses
    -
    -- Added new @return label {type typeLink} Description... syntax
    -
    -JSDoc 1.9.1.2
    -=============
    -
    -- Further improvements to mark_void_method
    -
    -- Improved handling of dynamically-bound methods within functions
    -
    -- Improved handling of erroneous documenting of 'this'
    -
    -- Fixed quoting on error message
    -
    -- Added a few new unit tests for testing general behaviour
    -
    -JSDoc 1.9.1.1
    -=============
    -
    -- Fix for embarrassing bug in mark_void_method
    -
    -JSDoc 1.9.1
    -===========
    -
    -- Fix for the incorrect void marking of methods that return a string literal
    -
    -- Fix to stop dynamic prototyping from adding non-dynamic classes
    -
    -- Added ability to add a link to parameter-type data, as follows:
    -    @param {TypeName http://my.link.com/} myParam Description of parameter
    -
    -JSDoc 1.9
    -=========
    -
    -- Added support for a Constant Values page like in Javadoc
    -
    -- Added support for private classes (by marking the constructor with
    -  the @private attribute)
    -
    -- Added a "File" page with links to it in the navbar. The "File" page includes
    -  the file overview if one has been supplied, as well as the source view
    -  (unless jsdoc has been invoked with the --no-sources flag)
    -
    -- Added a --no-sources commandline option to not show the sourcecode for
    -  the JavaScript files 
    -
    -- Added --package-naming commandline option, which specifies that the path 
    -  leading to each source file will be preserved. This allows for the same 
    -  filename to be used in different directories. Using the same class name
    -  in different packages is _not_ supported (yet)
    -
    -- Added JSDoc link and creation time in the footer of each page
    -
    -- Added support for @member tag to explicitly mark a method as a member of
    -  a class
    -
    -JSDoc 1.8.4
    -===========
    -
    -- Added step in prepocessing to attempt to add missing @constructor tags where
    -  the 'new' operator is used in combination with a function name elsewhere
    -  in the source.
    -
    -- Only the first @extends marking (or assignment of an instance to a sub-
    -  class's prototype) will be used in determining the base class of a class.
    -
    -- Updated test.js to show off more features of JSDoc, as well as a general 
    -  clean-up.
    -    
    -- Changed the parser to consider a method to be a class declaration if its
    -  documentation contains a @class tag (in addition to the @constructor tag)
    -
    -JSDoc 1.8.3.1
    -=============
    -
    -- Some general code cleanup and refactoring. 
    -
    -- Properly fixed marking of void/non-void methods, and at the same time
    -  re-introduced recursive regexes (this time non-dynamic, as dynamic seem
    -  to be much too unstable)
    -
    -JSDoc 1.8.3
    -===========
    -
    -- Changed the handling for __defineGetter__ and __defineSetter__
    -  to define a property instead of a method in the documentation
    -
    -- Fixed bug in parse_jsdoc_comment that didn't allow for email addresses
    -  to be entered verbatim (instead, the domain of the address was parsed
    -  as a tag)
    -
    -- Re-did the @fileoverview parsing, now other tags and inner {@link...} 
    -  tags are included. Additionally, if only one file is processed and there
    -  is no project overview file included, the file's overview (if it exists)
    -  is used as the project overview. Thanks to Robert Flaherty for input
    -  and bug reports on this issue.
    -
    -JSDoc 1.8.2.1
    -=============
    -
    -- Got rid of extra '*' with @fileoverview
    -
    -JSDoc 1.8.2
    -=============
    -
    -- Fixed bug where other @tags were included as part of the @fileoverview
    -
    -- Added support for @version in method documentation
    -
    -- Partial fix for incorrect marking of void methods
    -
    -- Made field and return @type handling more robust and flexible
    -
    -JSDoc 1.8.1
    -===========
    -
    -- Added @extends as a synonym for @base
    -
    -- Fixed doubled-up 
      tags in hierarchy tree code (thanks to Robert Flaherty) - -- Fixed bug where a class's base class would not get recorded if - there was a forward assignment of a static value to the class - (thanks to Robert Flaherty) - - -JSDoc 1.8 -========= - -- Remove the GLOBALS class if it is empty - -- Fixed case-sensitive sort in index - -- Added support for comments with long blocks of '*'s in the opening and - closing of the doc string - -- Added sourcecode view - -- Fixed bug where named anonymous functions were not recognized as methods - when assigned to prototypes - -- Allow for singletons to be declared with var - -- Allow for binding static properties to classes before they are defined - -- Added @overviewfile attribute for class documentation, inlines html or - textfiles into the documentation - -- Added beginnings of unit testing - -- Don't add 'constructor' as an instance or class property - -- Added an @overviewfile tag which can be put in an independent - jsdoc-comment block at the top of each file. This results in a project - overview page for each file with an overview, similar to JavaDoc's - package pages. - -- Added support for Mozilla's __defineGetter__ and __defineSetter__ - -- Return type for methods is now Object, and is displayed instead of the - 'function' declaration. The 'void' type is shown if no return can be - found in the function and no other type is defined. The defaulting to - Object also goes for fields, and is shown instead of the 'var' declaration - -- Allow usage of the {@link url label} construct for the @type tag - - -JSDoc 1.7.2.1 -============= - -- Fixed segfault problem in huge constructors with deconstruct_constructor - selection regex - - -JSDoc 1.7.2 -=========== - -- Added a @class tag to constructors, for providing class-specific information - -- Added handling for Singleton classes - -- Added handler for @base tag to denote inheritance - -JSDoc 1.7.1.4 -============= - -- Fixed bug introduced by refactoring of &format_link - -JSDoc 1.7.1.3 -============= - -- Added workaround in &format_link for apparent bug in some builds of - perl 5.8.0 - -- Fixed bug in handling of --recursive (was always recursive) - -JSDoc 1.7.1.2 -============= - -- Fixed problems with new preprocessor when confronted with nested classes - -JSDoc 1.7.1.1 -============= - -- Fixed bug where {@link}s inside of @params weren't processed - -JSDoc 1.7.1 -=========== - -- Added --quiet switch and message to signify ending of successful execution - -- Fixed problem with perl segfaulting on big class prototype block definitions - -- Fixed incorrectly formatted {@link}s nested in other @attributes - -- Added preprocessor for handling private methods to replace bulky - and buggy evaluate_constructor method - -JSDoc 1.7 -========= - -- Added usage of strict and warnings in JSDoc.pm - -- Added ability to set type information for method parameters - (e.g. /** @param {String} userName The name of the current user */ ) - -- Added support for class prototype initialization blocks (finally!) - -JSDoc 1.6.3.1 -============= - -- Fixed bug where static fields initialized to 0 are not picked up - -JSDoc 1.6.3 -=========== - -- Removed the constraint that a nested class constructor must be marked - with the @constructor attribute - -- Allow @constructor attribute to mark nested class constructors which would - otherwise be considered static methods - -- Allow newlines as well as semi-colon for line-endings - -- Allow a leading '$' for field names - - -JSDoc 1.6.2.1 -============= - -- Fixed splicing error for nested classes, thanks again to jdber - - -JSDoc 1.6.2 -=========== - -- Carry over overridden method description attributes even if there is - no text description to carry over - -- Improved HTML in main.tmpl - -- Fixed infinite loop and recognition for when static inner class construct is - used (thanks to jdber for the patch) - -- Added a Nested Class Summary section to the output documentation to display - inner classes - -JSDoc 1.6.1.1 -============= - -- Fixed bug in carrying over description of overridden methods - -JSDoc 1.6.1 -=========== - -- Improved the format_link function in jsdoc.pl so that {@links} will - not be made to non-existent resources, and parentheses are not placed - after a field name (as opposed to a method name) - -- Carry over method documentation for overridden methods if no new - documentation has been supplied for the method. This is in following with - javadoc functionality - -- Fixed /* functionality(whatever) bug - -- Fixed remaining problems with comments inside of parameter lists - -JSDoc 1.6 -========= - -- Big cleanup in jsdoc.pl in terms of writing templates to file - -- Fixed bug where multi-line @params don't work - -- Added filename-scoped frame, as well as the name of the filename for - each class - -- Improved the linking implementation for @link and @see to do a better job - in terms of not building broken links - -JSDoc 1.5.2 -=========== - -- Changed the name '[default context]' for non-class functions to be - GLOBALS, also made this name configurable with command-line parameters - -- Made jsdoc easily runnable from anywhere on the filesystem, without - requiring installing JSDoc.pm in the @INC - -JSDoc 1.5.1 -=========== - -- Added support for @requires in methods - -- Generic '@' attributes now work for constructors, such as @see and @throws. - Also added support for @return and @returns for constructors - -- Fixed the @link construct to allow custom labels - -- Added standard support for @author in methods as well as classes - (Thanks for Rainer Eschen for bringing me to my senses) - -- Fixed spacing for @author attributes - - -JSDoc 1.5 -=========== - -- Fixed bug that would break HTML links within documentation - -- Fixed bug in path to logo in IMG tags - -- Added support for type information for both methods and fields - -- Added suppport for @private in instance fields - -- Fixed bug where private methods would show up in the inherited methods list - in subclasses - -- Private class methods are now also supported - -- Method parameters details are displayed in the same order as the parameter - list for a method - -- Moved more info into the 'vars' member of methods, and away from the parser - -- Added @final (with synonym @const) for class and instance properties - -- Fix in parser where string literals bound to classes in a constructor were - not caught by the parser - - - -JSDoc 1.4 -========= - -- Added @attributes: @author, @deprecated, @see, @version, @requires, @throws - -- Updated pod (removed documentation for non-existant parse_jsdoc_source, -added a small example) - -- Added function to reset the parser (reset_parser) - -- Fixed bug where the same property could be bound to a class's prototype -more than once - -- Fixed bug where embedded // comments would break the parser - -- Added ability to set project name, page footer, logo and project summary -(thanks to Jeff Conrad for code and suggestions) - -- Added overview summary (thanks to Jeff Conrad for code) - -- Split up loading/parsing of sources file to prevent crashes that were caused -by overloading the regex engine - -- Added overview-tree (thanks to Jeff Conrad for the code contribution) - -- Fixed bug where some assignments of methods to instances in a constructor -would get lost - -- Fix in doc-parsing where a line with only a star and a newline would get -passed over - -- Added ability to 'hide' methods with @private - - -JSDoc 1.3 -========= - -- When a function is marked with @constructor, it will always be dealt -with as a class - -- Improved doc regex - -- Added recursive directory handling diff --git a/modules/jala/util/HopKit/JSDoc/JSDoc.pm b/modules/jala/util/HopKit/JSDoc/JSDoc.pm deleted file mode 100644 index bd7e898a..00000000 --- a/modules/jala/util/HopKit/JSDoc/JSDoc.pm +++ /dev/null @@ -1,1070 +0,0 @@ -package JSDoc; - -=head1 NAME - -JSDoc - parse JavaScript source file for JSDoc comments - -=head1 SYNOPSIS - -Create JavaScript sourcefiles commented in a manner similar to javadoc -(ie. with documentation starting with '/**' and then pass a list of references -to JavaScript source to parse_code_tree: - - /** - * This is a class for example purposes - * @param name Name for the new object - * @constructor - */ - function MyClass(name){ - this.name = name; - } - - $code_tree = parse_code_tree(@src_refs); - -A tree structure describing the code layout, inheritance and documentation -is returned - -To clear the cache of classes and functions in the parser: - - reset_parser(); - - -=head1 DESCRIPTION - -The C function requires a ref to a string holding the -souce code of a javascript object file or files. It returns a data structure -that describes the object hierarchy contained in the source file, as well -as included documentation for all fields and methods. The resulting -data structure has the following form (for each class): - - Class - | - +- classname - | - +- constructor_args - | - +- extends - | - +- constructor_detail - | - +- constructor_vars - | - +- class_methods - | | - | +- description - | | - | +- mapped_name - | | - | +- argument_list - | | - | +- vars - | - +- instance_methods - | | - | +- description - | | - | +- mapped_name - | | - | +- argument_list - | | - | +- vars - | - +- class_fields - | | - | +- field_description - | | - | +- field_name - | | - | +- field_value - | | - | +- field_vars - | - +- instance_fields - | | - | +- field_description - | | - | +- field_name - | | - | +- field_value - | | - | +- field_vars - | - +- inner_classes - | | - | +- class_name - | - +- inherits - | - +- Class - | - +- instance_fields - | - +- instance_methods - - -There is also an additional entry under the key __FILES__ that contains -keyed entries for each @tag that was defined in the first JSDoc comment -block with a @fileoverview tag. Each entry under __FILES__ is keyed by -filename, and is a hash reference. - -=head1 AUTHORS - -Gabriel Reid gab_reid@users.sourceforge.net, -Michael Mathews michael@mathews.net - -=cut - -require 5.000; -use strict; -use warnings; -use Exporter; - -# Recursion limit for recursive regexes -use constant RECURSION => 10; - -use vars qw/ @ISA @EXPORT /; - -@ISA = qw(Exporter); -@EXPORT = qw(parse_code_tree configure_parser reset_parser); - -# State -use vars qw/ %CLASSES %FUNCTIONS %CONFIG $CTX_FILE /; - -# Regexes -use vars qw/ $BAL_PAREN $BAL_BRACE $SQUOTE $DQUOTE $NONQUOTE - $FUNC_DEF $RET_FUNC_DEF $ANON_FUNCTION $LITERAL $FUNC_CALL - $JSDOC_COMMENT $MLINE_COMMENT $SLINE_COMMENT /; - -# This limits nested braces to 30 levels, but is much more -# stable than using a dynamic regex -$BAL_BRACE = qr/\{(?:[^\{\}])*\}/; -$BAL_PAREN = qr/\((?:[^()])*\)/; -for (1..RECURSION){ - $BAL_BRACE = qr/\{(?:[^\{\}]|$BAL_BRACE)*\}/; - $BAL_PAREN = qr/\((?:[^()]|$BAL_PAREN)*\)/; -} -$SQUOTE = qr{'[^'\\]*(?:\\.[^'\\]*)*'}; -$DQUOTE = qr{"[^"\\]*(?:\\.[^"\\]*)*"}; -$NONQUOTE = qr{[^"'/]}; -$FUNC_DEF = qr/function\s+\w+(?:\.\w+)*\s*$BAL_PAREN\s*$BAL_BRACE/; -$RET_FUNC_DEF = qr/function\s+(\w+(?:\.\w+)*)\s*($BAL_PAREN)\s*($BAL_BRACE)/; -$ANON_FUNCTION = qr/function\s*$BAL_PAREN\s*$BAL_BRACE/; -$LITERAL = qr/$DQUOTE|$SQUOTE|\d+/; -$FUNC_CALL = qr/(?:new\s+)?\w+(?:\.\w+)*\s*$BAL_PAREN/; -$JSDOC_COMMENT = qr{/\*\*[^*]*\*+(?:[^/*][^*]*\*+)*/}; -$MLINE_COMMENT = qr{/\*[^*]*\*+(?:[^/*][^*]*\*+)*/}; -$SLINE_COMMENT = qr{//[^\n]*}; - - -# -# Public function that returns a datastructure representing the JS classes -# and their documentation -# -sub parse_code_tree { - - &initialize_parser; - - # - # This (I mean the "<<$_>>") is pretty hacky, but I've made it this - # way to maintain backwards compatibility with anyone who's automatically - # expecting this to work when they throw an array of refs to it. If you're - # using this for your own work, please don't expect to be able to - # put the context file in like this in the future - # - for my $js_src (map { ref and ${$_} or "<<$_>>" } @_){ - if ($js_src =~ /^<<(.+)>>$/){ - $CTX_FILE = $1; - next; - } - - # perlify os line-endings - $js_src =~ s/(\r\n|\r)/\n/g; - - &parse_file_info($js_src); - $js_src = &preprocess_source($js_src); - &fetch_funcs_and_classes($js_src); - } - - &map_all_properties(); - &build_class_hierarchy(); - &set_class_constructors(); - &filter_globals; - - while (my ($classname, $class) = each %CLASSES){ - delete $class->{_class_properties}; - delete $class->{_instance_properties}; - $class->{classname} = $classname unless $classname eq '__FILES__'; - } - return \%CLASSES; -} - -# -# Parses up a a jsdoc comment into its component parts -# PARAM: The document string to be parsed -# -sub parse_jsdoc_comment { - my ($doc, $raw) = @_; - - # Remove excess '*' characters - $doc =~ s/^[*\s]*([^*].*?)[*\s]*$/$1/s; - $doc =~ s/^\s*\*//gm; - - my %parsed = (); # remember each part that is parsed - - # the first paragraph could be a summary statement - # a paragraph may follow of variable defs (variable names start with "@") - my ($summary, $variable_str) = $doc =~ - /^\s* - ( - (?:[^{@]|(?:\{[^@]))* - (?:\{\@ - (?:[^{@]|(?:\{[^@]))*)* - ) - \s* - (.*) - $/xs; - $summary =~ s/^\s*(\S.*?)\s*$/$1/s; - $parsed{summary} = $summary; - - # two types of variable def can be dealt with here: - # a @argument has a two-part value -- the arg name and a description - # all other @ only have a single value each (although there may - # be many variables with the same name) - if($variable_str) { - my %vars = (); - while ($variable_str =~ / - (?{$_} = [] for qw(instance_fields class_fields - instance_methods class_methods - inner_classes); - } - unless ($CLASSES{$class}->{extends}){ - &set_base_class($class, $1) - if $class_doc =~ /\@base\s+(\w+(?:\.\w+)*)/; - } -} - -# -# Set the base class for a given class -# -sub set_base_class { - my ($class, $base_class) = @_; - &add_class($class); - $CLASSES{$class}->{extends} = $base_class - unless $CLASSES{$class}->{extends}; -} - -# -# Add a property, either a class or instance method or field -# -sub add_property { - my ($doc, $class, $property, $value, $is_class_property) = @_; - &add_class($class); - return if $property eq 'constructor'; - my $parsed_doc = &parse_jsdoc_comment($doc); - $doc = $parsed_doc->{summary}; - my $key = $is_class_property ? '_class_properties' : '_instance_properties'; - for my $classref (@{$CLASSES{$class}->{$key}}){ - if ($classref->{property_name} eq $property){ - # Whine about rebinding functions to classes - if ($FUNCTIONS{$value}){ - warn "Already bound property '$property' to '$class'\n"; - return; - } - - # Only take on new attributes - $classref->{property_doc} ||= $doc; - $classref->{property_vars} ||= $parsed_doc->{vars}; - return; - } - } - - push @{$CLASSES{$class}->{$key}}, { - property_doc => $doc, - property_name => $property, - property_value => $value, - property_vars => $parsed_doc->{vars} - }; -} - - -# -# Add a function and its documentation to the global FUNCTION hash -# -sub add_function { - my ($doc, $function, $arg_list, $is_private) = @_; - - # clean remaining comments out of arg list - # (all others are already gone) - # Again, taken from Jeffrey Friedl's "Mastering Regular Expressions" - { - no warnings; - $arg_list =~ s/ - ($NONQUOTE+| - $DQUOTE$NONQUOTE*| - $SQUOTE$NONQUOTE*) - |$MLINE_COMMENT|$SLINE_COMMENT/$1/gx; - } - - if ($FUNCTIONS{$function}){ - warn "Function '$function' already declared\n"; - unless ($doc && !$FUNCTIONS{$function}->{documentation}->{summary}){ - return 0; - } - } - $FUNCTIONS{$function} = {}; - my $func = $FUNCTIONS{$function}; - $arg_list and $func->{argument_list} = join(" ", split("\\s+", $arg_list)) - or $func->{argument_list} = "()"; - - my $documentation = parse_jsdoc_comment($doc); - if ($documentation->{vars}->{member}){ - my ($classname) = map { s/^\s*(\S*)\s*$/$1/; $_ } - @{$documentation->{vars}->{member}}; - &add_property($doc, $classname, $function, $function, 0) - if $classname =~ /\w+/; - } - my $function_ref = $FUNCTIONS{$function}; - - $function_ref->{documentation} = $documentation; - $function_ref->{description} = $documentation->{summary}; - $function_ref->{vars} = $function_ref->{documentation}->{vars}; - $function_ref->{vars}->{filename} = $CTX_FILE; - $function_ref->{vars}->{private} = 1 if $is_private; - 1; -} - - -# -# Map all the class and instance properties to their implementation -# -sub map_all_properties { - for my $type (qw(_class_properties _instance_properties)){ - for my $class (keys %CLASSES){ - &map_single_property( - $class, - $_->{property_name}, - $_->{property_value}, - $_->{property_doc}, - $_->{property_vars}, $type eq '_class_properties') - for @{$CLASSES{$class}->{$type}} - } - } - - # Map all the unattached functions - my $classname = $CONFIG{GLOBALS_NAME} || 'GLOBALS'; - &add_class($classname); - for my $function - (grep !($FUNCTIONS{$_}->{is_mapped} || $CLASSES{$_}), keys %FUNCTIONS){ - &map_single_property( - $classname, $function, $function, '', undef, 1); - } - - # Map static inner classes - for $classname (keys %CLASSES){ - my $i = 0; - my @to_remove; - for my $cprop (@{$CLASSES{$classname}->{class_methods}}){ - my $propname = $cprop->{mapped_name}; - if ($CLASSES{"$classname.$propname"}){ - push @to_remove, $i; - push @{$CLASSES{$classname}->{inner_classes}}, - {class_name => "$classname." . $cprop->{mapped_name}}; - $FUNCTIONS{"$classname.$propname"} = - delete $FUNCTIONS{"__$classname.$propname"}; - } - $i++; - } - splice(@{$CLASSES{$classname}->{class_methods}}, $_, 1) - for reverse @to_remove; - } -} - -# -# Map a single instance or class field or method -# -sub map_single_property { - my ($class, $prop_name, $prop_val, - $description, $vars, $is_class_prop) = @_; - if (!$FUNCTIONS{$prop_val}){ - push @{$CLASSES{$class}->{$is_class_prop - ? 'class_fields' : 'instance_fields'}}, { - field_name => $prop_name, - field_description => $description, - field_value => $prop_val, - field_vars => $vars }; - return; - } - my %method; - my $function = $FUNCTIONS{$prop_val}; - $function->{is_mapped} = 1; - $method{mapped_name} = $prop_name; - - $method{$_} = $function->{$_} for - qw/ argument_list description vars /; - - push @{$CLASSES{$class}->{$is_class_prop - ? 'class_methods' - : 'instance_methods'}}, \%method; -} - - - -# -# Build up the full hierarchy of classes, including figuring out -# what methods are overridden by subclasses, etc -# PARAM: The JS source code -# -sub build_class_hierarchy { - # Find out what is inherited - for my $class (map($CLASSES{$_}, sort keys %CLASSES)){ - my $superclassname = $class->{extends}; - !$superclassname and next; - my $superclass = $CLASSES{$superclassname}; - $class->{inherits} = {}; - while ($superclass){ - $class->{inherits}->{$superclassname} = {}; - my @instance_fields; - my @instance_methods; - - &handle_instance_methods($superclass, $superclassname, - $class, \@instance_methods); - - &handle_instance_fields($superclass, $superclassname, - $class, \@instance_fields); - - $superclassname = $superclass->{extends}; - $superclass = $superclassname ? $CLASSES{$superclassname} : undef; - } - } -} - -# -# This is just a helper function for build_class_hierarchy -# because that function was getting way oversized -# -sub handle_instance_methods { - my ($superclass, $superclassname, $class, $instance_methods) = @_; - if ($superclass->{instance_methods}){ - INSTANCE_METHODS: - for my $base_method (@{$superclass->{instance_methods}}){ - for my $method (@{$class->{instance_methods}}){ - if ($$base_method{mapped_name} eq $$method{mapped_name}){ - - # Carry over the description for overridden methods with - # no description (to be javadoc compliant) - if (($base_method->{description} or $base_method->{vars}) - and not $method->{description}){ - - $method->{description} = $base_method->{description}; - for my $varkey (keys(%{$base_method->{vars}})){ - $method->{vars}->{$varkey} - = $base_method->{vars}->{$varkey} - unless $method->{vars}->{$varkey}; - } - } - next INSTANCE_METHODS; - } - } - for (keys %{$class->{inherits}}){ - my $inherited = $class->{inherits}->{$_}; - for my $method (@{$inherited->{instance_methods}}){ - next INSTANCE_METHODS - if $$base_method{mapped_name} eq $method; - } - } - push @$instance_methods, $$base_method{mapped_name}; - } - $class->{inherits}->{$superclassname}->{instance_methods} - = $instance_methods; - } -} - -# -# This is just a helper function for build_class_hierarchy -# because that function was getting way oversized -# -sub handle_instance_fields { - my ($superclass, $superclassname, $class, $instance_fields) = @_; - if ($superclass->{instance_fields}){ - INSTANCE_FIELDS: - for my $base_field (@{$superclass->{instance_fields}}){ - for my $field (@{$class->{instance_fields}}){ - next INSTANCE_FIELDS if $field eq $base_field; - } - push @$instance_fields, $base_field->{field_name}; - } - $class->{inherits}->{$superclassname}->{instance_fields} - = $instance_fields; - } -} - -# -# Set all the class constructors -# -sub set_class_constructors { - for my $classname (keys %CLASSES){ - my $constructor = $FUNCTIONS{$classname}; - $CLASSES{$classname}->{constructor_args} = - $constructor->{argument_list}; - $CLASSES{$classname}->{constructor_detail} - = $constructor->{description}; - - $CLASSES{$classname}->{constructor_vars} = $constructor->{vars} || {}; - } -} - -# -# Clear out everything from the parsed classes and functions -# -sub reset_parser { - %CLASSES = (); - %FUNCTIONS = (); -} - -# -# Set global parameters for the parser -# -sub configure_parser { - %CONFIG = @_; -} - -# -# Set the initial defaults for the parser -# -sub initialize_parser { - $CONFIG{GLOBALS_NAME} ||= 'GLOBALS'; -} - -# -# Run through the source and convert 'confusing' JavaScript constructs -# into ones that are understood by the parser, as well as stripping -# out unwanted comment blocks. -# -# For example: -# -# Foo.prototype = { -# bar: function(){ return "Eep!"; }, -# baz: "Ha!" -# } -# -# becomes -# -# Foo.prototype.bar = function(){ return "Eep!"; }; -# Foo.prototype.baz = "Ha!"; -# -sub preprocess_source { - my ($src) = @_; - - # Make all the @extends tags into @base tags - $src =~ s/\@extends\b/\@base/g; - - # This had better not break anything! - $src = &deconstruct_getset($src); - - # Convert: - # /** @constructor */ - # Foo.Bar = function(){...} - # to: - # /** @constroctor */ - # Foo.Bar = function(){} - # /** @constructor */ - # function Foo.Bar(){...} - # - # Note that we have to keep the original declaration so that Foo.Bar - # can be recognized as a nested class. Yes, I know it's bad... - $src =~ s! - ($JSDOC_COMMENT\s*) - (?:var\s*)?(\w+(?:\.\w+)*?) - \s*= - (\s*function)(?=\s*($BAL_PAREN)\s*\{) - !index($1, '@constructor') == -1 ? "$1$2 = $3" : "$1$2 = function$4 {};\n$1$3 $2"!egx; - - # remove all uninteresting comments, but only if they're not inside - # of other comments - # (adapted from Jeffrey Friedl's "Mastering Regular Expressions" - { - no warnings; - $src =~ s/ - ($NONQUOTE+| - $JSDOC_COMMENT$NONQUOTE*| - $DQUOTE$NONQUOTE*| - $SQUOTE$NONQUOTE*) - |$MLINE_COMMENT|$SLINE_COMMENT/$1/gx; - - 1 while $src =~ s/$JSDOC_COMMENT\s*($JSDOC_COMMENT)/$1/g; - } - - # Alter the prototype-initialization blocks - $src =~ s/ - (\w+(?:\.\w+)*)\.prototype - \s*=\s*($BAL_BRACE)/deconstruct_prototype($1, $2)/egx; - - # Mark all constructors based on 'new' statements - my %seen; - my @classnames = grep { not $seen{$_}++ } - $src =~ /\bnew\s+(\w+(?:\.\w+)*)\s*\(/g; - for my $cname (@classnames){ - $src =~ s/($JSDOC_COMMENT?) - (?=\s*function\s+\Q$cname\E\s*$BAL_PAREN - \s*$BAL_BRACE) - /&annotate_comment($1, '@constructor')/ex; - } - - $src =~ s/ - ($JSDOC_COMMENT?)\s* - (function\s+\w+(?:\.\w+)*\s*$BAL_PAREN\s*) - ($BAL_BRACE) - /&deconstruct_constructor($1, "$2$3")/egx; - - $src =~ s! - (?:var\s+)?(\w+(?:\.\w+)*) - \s*=\s* - new\s+ - ($ANON_FUNCTION)!&deconstruct_singleton($1, $2)!egx; - - $src = &remove_dynamic_bindings($src); - - # Mark all void methods with "@type void" - $src =~ s/($JSDOC_COMMENT?)\s* - ((?: - (?:function\s+\w+(?:\.\w+)*\s*$BAL_PAREN\s*) - | - (?:\w+(?:\.\w+)*\s*=\s*function\s*(?:\w+\s*)?$BAL_PAREN\s*) - )$BAL_BRACE) - /&mark_void_method($1, $2)/egx; - - # Clear nested functions (will save trouble later on) - $src =~ s/($JSDOC_COMMENT?)\s* - (\w+(?:\.\w+)*\s*=\s*)? - (function(?:\s+\w+(?:\.\w+)*)?\s*$BAL_PAREN\s*) - ($BAL_BRACE) - /&clear_nested($1, $2, $3, $4)/egx; - - return $src; -} - -sub clear_nested { - my ($doc, $assign_to, $declaration, $funcbody) = @_; - $assign_to ||= ''; - if ($doc =~ /^(?=.*\@constructor|\@class)(?=.*\@exec)/){ - warn "\@constructor or \@class can't be used together with \@exec\n"; - } - if ($doc !~ /\@(constructor|class|exec)/ - or $assign_to =~ /^\w+\.prototype\./) { - return "$doc\n$assign_to$declaration" . "{}\n"; - } elsif ($doc =~ /\@(constructor|class)/) { - return "$doc\n$assign_to$declaration$funcbody"; - } else { - my @visible_funcs = $funcbody =~ / - ((?:$JSDOC_COMMENT)? - (?:\w+\.\w+(?:\.\w+)*)\s*=\s* - (?: - $FUNC_DEF - | - $ANON_FUNCTION - | - $FUNC_CALL - | - \w+ - )\s*;)/gx; - return join("\n", @visible_funcs); - } -} - -# -# Remove dynamic binding. -# Change this: -# -# function MyFunc(class){ -# var x = 2; -# class.prototype.func = function(){}; -# return x; -# } -# -# to: -# -# function MyFunc(class){ -# var x = 2; -# -# return x; -# } -# -# and change this: -# -# function BindMethod(obj){ -# obj.someFunc = function(){ return null; }; -# return obj; -# } -# -# to: -# -# function BindMethod(obj){ -# -# return obj; -# } -# -sub remove_dynamic_bindings { - my ($src) = @_; - while ($src =~ /$RET_FUNC_DEF/g){ - my ($fname, $params, $definition) = ($1, $2, $3); - next unless $definition =~ /\bfunction\b|\w+\.prototype\./; - my @params = split(/\s*,\s*/, substr($params, 1, length($params) - 2)); - for my $param (@params){ - $src =~ s/\b$param\.prototype\.[^;\n]*[;\n]//g; - $src =~ s/\b$param\.\w+ = $ANON_FUNCTION//g; - } - } - $src; -} - -# -# Annotate a method as being void if no @type can be found, and there is no -# statement to return a value in the method itself. -# -sub mark_void_method { - my ($doc, $funcdef) = @_; - return "$doc\n$funcdef" if $doc =~ /\@(constructor|type|returns?)\b/; - my ($fbody) = $funcdef =~ /^[^{]*($BAL_BRACE)/; - $fbody =~ s/$FUNC_DEF/function x(){}/g; - $fbody =~ s/$ANON_FUNCTION/function (){}/g; - $doc = &annotate_comment($doc, '@type void') - if $fbody !~ /\breturn\s+(?:(?:\w+)|(?:(["']).*?\1)|$BAL_PAREN)/; - "$doc\n$funcdef"; -} - -# -# A helper to change singleton declarations like -# -# MySingleton = new function(){this.x=function(){}} -# -# into: -# -# function MySingleton(){} -# MySingleton.prototype.x = function(){}; -# -sub deconstruct_singleton { - my ($classname, $definition) = @_; - $definition =~ s/function\s*$BAL_PAREN\s*\{(.*)\}\s*$/$1/s; - $definition =~ s/\bthis\./$classname.prototype\./g; - qq# - function $classname(){} - $definition; - #; -} - -# -# A helper to preprocess_source, change prototype-initialization -# blocks into multiple prototype-property assignments -# -sub deconstruct_prototype { - my ($class, $src) = @_; - $src =~ s/^\{(.*)\}$/$1/s; - $src =~ s! - (\w+) - \s*:\s* - ( - $ANON_FUNCTION - | - $FUNC_DEF - | - $FUNC_CALL - | - $LITERAL - | - \w+ - ) - \s*,? - !$class.prototype.$1 = $2;!gsx; - - $src; -} - -# -# Unpacks a constructor into separate calls -# -sub deconstruct_constructor { - my ($doc, $func_def) = @_; - return "$doc$func_def" unless $doc =~ /\@(constructor|class)/; - my ($classname) = $func_def =~ /function\s+(\w+(?:\.\w+)*)/; - $func_def =~ s/ - (\{.*\})$ - /&deconstruct_inner_constructor($classname, $1)/esx; - "$doc$func_def"; -} - -sub deconstruct_inner_constructor { - my ($classname, $inner_src) = @_; - $inner_src = substr($inner_src, 1, -1); - my @doc_n_fnames = $inner_src =~ /($JSDOC_COMMENT?)\s*function\s+(\w+)/g; - - unless ($CONFIG{NO_LEXICAL_PRIVATES}){ - $inner_src =~ s/ - ($JSDOC_COMMENT)? - \s* - var - \s+ - (\w+)/&annotate_comment($1) . "\n$classname\.prototype\.$2"/egx; - - $inner_src =~ s/ - ($JSDOC_COMMENT)?\s* - ^\s* - function - \s+ - (\w+) - /&annotate_comment($1) . - "\n$classname\.prototype\.$2 = function"/egmx; - } - - { - no warnings; - $inner_src =~ s/ - ($JSDOC_COMMENT\s*)? - ^\s*this(?=\.) - /$1$classname.prototype/gmx; - } - - # Replace all bindings of private methods to public names - for (my $i = 0; $i < @doc_n_fnames; $i += 2) - { - my ($doc, $fname) = @doc_n_fnames[$i, $i + 1]; - $inner_src =~ s/ - ($JSDOC_COMMENT\s* - $classname\.prototype\.\w+) - \s*=\s* - $fname\s*[\n;] - /$1 = function(){}/gx; - - $inner_src =~ s/ - ($classname\.prototype\.\w+) - \s*=\s* - $fname\s*[\n;] - /$doc\n$1 = function(){}/gx; - } - "{}\n$inner_src"; -} - -# -# Deconstruct mozilla's __defineGetter__ and __defineSetter__ -# (Yes, I know this goes against my principles...) -# -sub deconstruct_getset { - my ($src) = @_; - # Crack open the assignments for define(Getter|Setter) - my $crack = sub { - my $code = shift; $code =~ s/^.(.*).$/$1/s; - my ($name) = split ",", $code; - $name = ($name =~ /.*?(['"])([^'"]+)\1/)[1]; - $name; - }; - for my $prefix ('get', 'set'){ - my $fname = "define\u${prefix}ter"; - $src =~ s/ - (\w+(?:\.\w+)* - \.prototype) - \.__${fname}__\s*($BAL_PAREN)/ - my $name = $crack->($2); - "$1.$name = null"/gex; - } - $src; -} - - -# -# Add an annotation (@tag) to a documentation block. The block is assumed to -# be a valid JSDoc documentation block ==> /^\/\*\*.*\*\/$/ -# and no checking is done to verify this -# -sub annotate_comment { - my $annotation = $_[1] || '@private'; - return "\n/** $annotation */" unless $_[0]; - substr($_[0], 0, -2) . " \n$annotation \n*/"; -} - -# -# This is here to stop perl from segfaulting from deep recursion in regexes -# The first character in the text _should_ be open_token, as everything -# before open_token will be discarded, unless there is no matching text -# at all. -# -sub find_balanced_block { - my ($open_token, $close_token, $text) = @_; - my ($count, $open, $close) = (0, 0, 0); - return ('', $text) unless $text =~ /\Q$open_token\E/; - $text =~ s/^.*?(?=\Q$open_token\E)//s; - for (split //, $text){ - $count++; - $open++ if $_ eq $open_token; - $close++ if $_ eq $close_token; - last unless ($open != $close); - } - warn "Unbalanced block\n" if ($open != $close); - (substr($text, 0, $count), substr($text, $count)); -} - -# -# Remove the $CONFIG{GLOBALS_NAME} class if it doesn't contain anything -# -sub filter_globals { - my $global = $CLASSES{$CONFIG{GLOBALS_NAME}}; - delete $CLASSES{$CONFIG{GLOBALS_NAME}} if - not (defined $global->{constructor_args} || - defined $global->{constructor_detail}) - && not (@{$global->{instance_methods}} || - @{$global->{instance_fields}} || - @{$global->{class_methods}} || - @{$global->{class_fields}}); - - # Also get rid of extra info under the '__files__' key - delete $CLASSES{__FILES__}->{$_} for qw(constructor_params constructor_args - constructor_detail class_methods - constructor_vars); -} - - -# -# Try to grab the first block comment from the file that has a @fileoverview -# tag in it, and get the file info from there -# -sub parse_file_info { - my ($src) = @_; - my %fileinfo = ( src => $src ); - while ($src =~ /($JSDOC_COMMENT)/g){ - local $_ = substr($1, 3, length($1) - 5); # Get the actual content - if (/\@fileoverview\b/){ - my $doc = parse_jsdoc_comment($_, 1); - %fileinfo = (%{$doc->{vars}}, %fileinfo); - last; - } - } - $CLASSES{__FILES__}->{$CTX_FILE} = \%fileinfo if $CTX_FILE; -} - -1; diff --git a/modules/jala/util/HopKit/JSDoc/JSDoc/XMI.pm b/modules/jala/util/HopKit/JSDoc/JSDoc/XMI.pm deleted file mode 100644 index 77b5e0af..00000000 --- a/modules/jala/util/HopKit/JSDoc/JSDoc/XMI.pm +++ /dev/null @@ -1,291 +0,0 @@ -package JSDoc::XMI; - -use strict; -use warnings; -use HTML::Template; -use Data::Dumper; - -=head1 DESCRIPTION - - @packages - - @classes - $classname - $classid - $classuuid - $classvisibility (public|protected|private) - - @specializationids - $specializationid - - $generalizationid - - @attributes - $attributeid - $attributeuuid - $attributename - $attributevisibility (public|protected|private) - $ownerscope (instance|classifier) - $classid - $typeid - - @methods - $methodid - $methoduuid - $methodname - $methodvisibility (public|protected|private) - $ownerscope (instance|classifier) - $returnid - $returnuuid - $returntypeid - - @datatypes - $datatypeid - $datatypeuuid - $datatypename - - @generalizations - $generalizationid - $generalizationuuid - $generalizationchild - $generalizationparent - -=cut - -sub new { - my ($package, $location) = @_; - bless { - location => "${location}JSDoc/", - idcounter => 2, - types => {}, - classes => {}, - generalizations => {} - }, $package; -} - -sub output { - my ($self, $classes) = @_; - - my $template = HTML::Template->new( - filename => $self->{location} . 'xmi.tmpl', - die_on_bad_params => 1); - - my @packages = $self->get_packages($classes); - my @datatypes = $self->get_datatypes; - my @generalizations = $self->get_generalizations; - - $template->param( - packages => \@packages, - datatypes => \@datatypes, - generalizations => \@generalizations ); - return $template->output; -} - -sub get_id { - 'xmi.' . shift->{idcounter}++; -} - -sub get_uuid { - my @chars = ('A'..'Z', 'a'..'z', 0..9); - my @uuid; - for (1..32){ - push @uuid, $chars[rand(@chars)]; - } - join("", @uuid); -} - -sub get_packages { - my ($self, $classes) = @_; - my %packages; - push(@{$packages{$_->{package}}}, $_) - for $self->get_classes($classes); - map { - name => $_, - classes => $packages{$_}, - packageid => $self->get_id, - packageuuid => $self->get_uuid - }, keys %packages; -} - -sub get_classes { - my ($self, $classes) = @_; - my @classes; - - # Store all the class-ids before we start on anything else - $self->add_class($_) for keys %$classes; - - for my $cname (keys %$classes){ - my $class = { - classname => $cname, - classid => $self->add_class($cname), - classuuid => $self->get_uuid, - classvisibility => - defined($classes->{$cname}->{constructor_vars}->{private}) - ? 'private' : 'public' - }; - $class->{attributes} = $self->get_attributes( - $class->{classid}, - $classes->{$cname}); - - $class->{methods} = $self->get_methods( - $class->{classid}, - $classes->{$cname}); - - $class->{generalizationid} = - $self->get_generalizationid($classes->{$cname}); - - $class->{package} = - defined($classes->{$cname}->{constructor_vars}->{package}) - ? $classes->{$cname}->{constructor_vars}->{package}->[0] : ''; - - push @classes, $class; - } - - for my $class (@classes){ - $class->{specializationids} = $self->get_specializationids($class); - } - - @classes; -} - -sub get_methods { - my ($self, $classid, $class) = @_; - my @methods; - - for my $k (qw(instance class)){ - for my $method (@{$class->{"${k}_methods"}}){ - my $type = defined($method->{vars}->{type}) - ? $method->{vars}->{type}->[0] : 'Object'; - my $meth = { - methodid => $self->get_id, - methoduuid => $self->get_uuid, - methodname => $method->{mapped_name}, - methodvisibility => - defined($method->{vars}->{private}) - ? 'private' : 'public', - ownerscope => - $k eq 'class' ? 'classifier' : 'instance', - returnid => $self->get_id, - returnuuid => $self->get_uuid, - returntypeid => $self->add_type($type) - }; - push @methods, $meth; - } - } - return \@methods; -} - -sub get_attributes { - my ($self, $classid, $class) = @_; - my @attributes; - for my $k (qw(instance class)){ - for my $field (@{$class->{"${k}_fields"}}){ - my $type = defined($field->{field_vars}->{type}) - ? $field->{field_vars}->{type}->[0] : 'Object'; - my $attr = { - attributeid => $self->get_id, - attributeuuid => $self->get_uuid, - attributename => $field->{field_name}, - attributevisibility => - defined($field->{field_vars}->{private}) - ? 'private' : 'public', - ownerscope => - $k eq 'class' ? 'classifier' : 'instance', - classid => $classid, - typeid => $self->add_type($type) - }; - push @attributes, $attr; - } - } - \@attributes; -} - -sub get_generalizationid { - my ($self, $class) = @_; - - if ($class->{extends}){ - return $self->add_generalization( - $class->{classname}, - $class->{extends}); - } - ''; -} - -sub get_specializationids { - my ($self, $class) = @_; - my $cname = $class->{classname}; - my $cid = $self->add_class($cname); - - my @specializationids; - - for my $id (keys %{$self->{generalizations}}){ - my $generalization = $self->{generalizations}->{$id}; - if ($generalization->{parent} eq $cid){ - push @specializationids, { specializationid => $id }; - } - } - \@specializationids; -} - -sub get_datatypes { - my ($self) = @_; - my @datatypes; - - while (my ($type, $id) = each(%{$self->{types}})){ - push @datatypes, { - datatypeid => $id, - datatypeuuid => $self->get_uuid, - datatypename => $type }; - } - @datatypes; -} - -sub get_generalizations { - my ($self) = @_; - my @generalizations; - - while (my ($id, $generalization) = each(%{$self->{generalizations}})){ - push @generalizations, { - generalizationid => $id, - generalizationuuid => $self->get_uuid, - generalizationchild => $generalization->{parent}, - generalizationparent => $generalization->{child}}; - } - @generalizations; -} - -sub add_type { - my ($self, $type) = @_; - $type =~ s/^\s*(\S+)\s*$/$1/; - if (defined($self->{classes}->{$type})){ - return $self->add_class($type); - } elsif (defined($self->{types}->{$type})){ - return $self->{types}->{$type}; - } - $self->{types}->{$type} = $self->get_id; -} - -sub add_class { - my ($self, $class) = @_; - $class =~ s/^\s*(\S+)\s*$/$1/; - if (defined($self->{classes}->{$class})){ - return $self->{classes}->{$class}; - } - $self->{classes}->{$class} = $self->get_id; -} - -sub add_generalization { - my ($self, $subclassname, $superclassname) = @_; - my $subclassid = $self->add_class($subclassname); - my $superclassid = $self->add_class($superclassname); - - my $generalization = { - child => $subclassid, - parent => $superclassid }; - - my $generalizationid = $self->get_id; - $self->{generalizations}->{$generalizationid} = $generalization; - $generalizationid; -} - -1; diff --git a/modules/jala/util/HopKit/JSDoc/JSDoc/XML.pm b/modules/jala/util/HopKit/JSDoc/JSDoc/XML.pm deleted file mode 100644 index aa07f307..00000000 --- a/modules/jala/util/HopKit/JSDoc/JSDoc/XML.pm +++ /dev/null @@ -1,72 +0,0 @@ -package JSDoc::XML; - -use strict; -use warnings; -use HTML::Template; - -sub new { - my ($package, $location) = @_; - bless { location => "${location}JSDoc/" }, $package; -} - -sub output { - my ($self, $classes) = @_; - my @classes = _preprocess( - grep {defined($_->{classname})} values %$classes); - my $template = HTML::Template->new( - filename => $self->{location} . 'xml.tmpl', - die_on_bad_params => 1); - - $template->param(classes => \@classes); - return $template->output; -} - -sub _preprocess { - my @classes = @_; - for (@classes){ - $_->{inherits} = _preprocess_inherits($_->{inherits}); - $_->{constructor_vars} = _preprocess_vars($_->{constructor_vars}); - for my $method (@{$_->{instance_methods}}, @{$_->{class_methods}}){ - $method->{vars} = _preprocess_vars($method->{vars}); - } - for my $field (@{$_->{instance_fields}}, @{$_->{class_fields}}){ - $field->{field_vars} = _preprocess_vars($field->{field_vars}); - } - } - @classes; -} - -sub _preprocess_inherits { - my ($inherits) = @_; - my @inherits; - for my $class (keys %$inherits){ - my $inherit = { - class => $class, - methods => [map { name => $_ }, - @{$inherits->{$class}->{instance_methods}}]}; - push @inherits, $inherit; - } - \@inherits; -} - -sub _preprocess_vars { - my ($vars) = @_; - return $vars if ref($vars) eq 'ARRAY'; - my @vars; - for my $key (keys %$vars){ - my $var; - if (ref($vars->{$key}) eq 'ARRAY'){ - $var = { - '@name' => $key, - values => [map { val => $_ }, @{$vars->{$key}}] }; - } else { - $var = { - '@name' => $key, - values => [ { val => $vars->{$key} } ] }; - } - push @vars, $var; - } - \@vars; -} - -1; diff --git a/modules/jala/util/HopKit/JSDoc/JSDoc/xmi.tmpl b/modules/jala/util/HopKit/JSDoc/JSDoc/xmi.tmpl deleted file mode 100644 index 7aa07d5f..00000000 --- a/modules/jala/util/HopKit/JSDoc/JSDoc/xmi.tmpl +++ /dev/null @@ -1,250 +0,0 @@ - - - - - JSDoc XMI Export - 0.1 - - - - - - JSDoc - - - - - - - - - - - " - xmi.uuid=""> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - return - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/jala/util/HopKit/JSDoc/JSDoc/xml.tmpl b/modules/jala/util/HopKit/JSDoc/JSDoc/xml.tmpl deleted file mode 100644 index 0757ac73..00000000 --- a/modules/jala/util/HopKit/JSDoc/JSDoc/xml.tmpl +++ /dev/null @@ -1,128 +0,0 @@ - - - - - " - extends="" > - - - - - - ]]> - - - - - - ]]> - - - - - ]]> - - - - - - ]]> - - - - - - - - - - - - ]]> - ]]> - - - - - ]]> - - - - - - - - - - - - ]]> - - - - - - ]]> - - - - - - - - - - - - - - - - ]]> - ]]> - - - - - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/jala/util/HopKit/JSDoc/JavaScript/Syntax/HTML.pm b/modules/jala/util/HopKit/JSDoc/JavaScript/Syntax/HTML.pm deleted file mode 100644 index 909facb7..00000000 --- a/modules/jala/util/HopKit/JSDoc/JavaScript/Syntax/HTML.pm +++ /dev/null @@ -1,95 +0,0 @@ -package JavaScript::Syntax::HTML; - -=head1 NAME - -JavaScript::Syntax::HTML - Convert JavaScript sourcecode to HTML - -=head1 SYNOPSIS - - use JavaScript::Syntax::HTML qw(to_html to_html_document); - my $html_fragment = to_html($js_src); - my $html_doc = output_html_document($js_src); - -=head1 DESCRIPTION - -JavaScript::Syntax::HTML processes JavaScript code and outputs HTML with -all reserved words marked up. - -The to_html method only outputs an HTML fragment (no or tags), -and only marks up the reserved words with CSS styles. - -The to_html_document method outputs a full HTML document, and does include -style information for the reserved words markup. - -The style classes that can be defined for use with to_html are C, -C, and C. - -=head1 AUTHOR - -Gabriel Reid gab_reid@users.sourceforge.net - -=cut - -use warnings; -use strict; -use Exporter; - -our @ISA = qw(Exporter); -our @EXPORT_OK = qw(to_html to_html_document); - -sub to_html { - local $_ = shift; - s/\&/&/g; - s//>/g; - s/ - ((?:\/\*.*?\*\/) - | - (?:\/\/[^\n]*$)) - | - ('[^']*'|"[^"]*") - | - \b(function|for|if|while|return|else|prototype|this)\b - / get_substitution($1, $2, $3) /egsxm; - $_; -} - -sub get_substitution { - my ($comment, $stringliteral, $resword) = @_; - my $content; - if ($comment){ - $comment =~ s/(\@\w+)\b/get_span('attrib', $1)/eg; - return get_span('comment', $comment); - } elsif ($stringliteral){ - return get_span('literal', $stringliteral); - } elsif ($resword){ - return get_span('reserved', $resword); - } -} - -sub get_span { - my ($class, $inner) = @_; - qq($inner); -} - -sub to_html_document { - my ($src) = @_; - $src = &to_html($src); - qq( - - - - - -
      -$src
      -	
      - -); -} diff --git a/modules/jala/util/HopKit/JSDoc/README b/modules/jala/util/HopKit/JSDoc/README deleted file mode 100644 index cb34ca75..00000000 --- a/modules/jala/util/HopKit/JSDoc/README +++ /dev/null @@ -1,30 +0,0 @@ -README for jsdoc.pl - -jsdoc.pl is a script that produces javadoc-style documentation from well-formed -JavaScript sourcefiles. At the moment, this means it supports sourcefiles where -all functions are mapped to a class using prototype-based inheritance. -Anonymous function definitions -(e.g. Circle.prototype.getRadius = function(){ ...} ) are supported. - -This application requires Perl5, as well as one non-standard addon module: - - HTML::Template, which is available from CPAN (cpan.org) - -Invocation is simple: Just run the application, giving one or more well-formed -OO JavaScript sourcefilename(s) as arguments. A sample JS sourcefile, test.js, -is given along with this application. An example of running the application is -shown below: - - $ ./jsdoc.pl test.js - -OR - perl jsdoc.pl test.js - -Further information about using JsDoc can be found at -http://jsdoc.sourceforge.net - -If there are any questions, comments, problems or anything else, please mail -the jsdoc-user mailing list; more information can be found at -http://sourceforge.net/mail/?group_id=30801. This application has been -successfully tested on Linux (Debian and Redhat), and Windows 2000 with -ActivePerl. - diff --git a/modules/jala/util/HopKit/JSDoc/TODO b/modules/jala/util/HopKit/JSDoc/TODO deleted file mode 100644 index 414e805b..00000000 --- a/modules/jala/util/HopKit/JSDoc/TODO +++ /dev/null @@ -1,46 +0,0 @@ -TODO for JSDoc - -- XML / XMI export - -- Improve the --package-naming option so that there are separate namespaces - for each package (so that you can have the same class name defined in - different packages) - -- Fix some spacing/table issues in the navbar in the templates (use a td - border in the stylesheet to debug) - -- Introduce a more generalized system for generating the navbar - -- Handle additional information (such as @see) for fields - -- Uncallable methods/functions should be marked as private, or show the scope - from which they can be called - -- Dynamic handling of assignment of prototype to a temp variable (preprocessor) - -- Add support for interfaces, but first this has to be better defined - -- Top-level var documenting (maybe add a '@global' tag to force toplevel vars - to be documented - -- Add an FAQ, more and better documentation - -- Java port (someday...) - -- Make a more polished API for using other doclets, like javadoc - -- Add a deprecated page, make deprecated support more like javadoc - -- Add support for js files without .js extension - -- Support for a time stamp - -- Some of the ->{vars} are set to undef, should always be an empty map - -- Add command line params --dump-tree, --dump-xml - -- Add command line param --stylesheet - -- Make navbar links selective so they are never broken - -- Update the help doc diff --git a/modules/jala/util/HopKit/JSDoc/TestJSDoc.pl b/modules/jala/util/HopKit/JSDoc/TestJSDoc.pl deleted file mode 100644 index aa35933f..00000000 --- a/modules/jala/util/HopKit/JSDoc/TestJSDoc.pl +++ /dev/null @@ -1,679 +0,0 @@ -#!/usr/bin/perl - -package JSDoc; -# -# Unit testing of JSDoc -# -# Run with 'perl TestJSDoc.pl' or './TestJSDoc.pl' -# - -use strict; -use warnings; - - - -use JSDoc; -use Data::Dumper; -use Test::More qw(no_plan); - -$|++; - -# parse_jsdoc_comment -diag("Testing parse_jsdoc_comment"); -is_deeply(parse_jsdoc_comment(''), {summary => ''}, - "Ensure only summary is filled in"); - -is(parse_jsdoc_comment('')->{summary}, '', 'Empty comment value'); - - -is(parse_jsdoc_comment( - '************************* test *************')->{summary}, - 'test', 'long leading and trailing stars'); - - -# annotate_comment -diag("Testing annotate_comment"); -is(annotate_comment, "\n/** \@private */", 'annotate_comment w/o arg'); -like(annotate_comment("/** This is a test */"), - qr#^/\s*\*\*\s*This is a test\s+\@private\s*\*/\s*$#, - 'annotate_comment w/ arg'); -like(annotate_comment("/** This is a test */", '@testtag value'), - qr#^/\s*\*\*\s*This is a test\s+\@testtag\svalue\s*\*/\s*$#, - 'annotate_comment w/ tag argument'); - -# find_balanced_block -diag("Testing find_balanced_block"); -my @blocks = ( - # basic simple input - ['{', '}', '{ this is in the braces } {this is after}{{', - ['{ this is in the braces }', ' {this is after}{{'] , - 'basic input'], - - # discard leading chars before opening char - ['{', '}', 'discard {inner} after', - ['{inner}', ' after'], 'discard leading chars'], - - # empty input string - ['{', '}', '', - ['', ''], 'empty input string'], - - # nothing to match at all - ['{', '}', 'there is nothing to match', - ['', 'there is nothing to match'], 'nothing to match'], - ); -for my $test (@blocks){ - my @args = @{$test}[0..2]; - my ($expect, $explain) = @{$test}[3,4]; - is_deeply([find_balanced_block(@args)], $expect, $explain); -} - -# -# Test the @member tag -# -diag('Testing the @member tag'); -reset_parser(); -my $src = q# -/** @constructor */ -function Foo(){ - this.x = function(){return null;}; -} -/** Unrelated */ -function myfunc(){return null;} -#; -my $classes = parse_code_tree(\$src); -my %method_names = map { $_->{mapped_name} => 1 } - @{$classes->{Foo}->{instance_methods}}; -ok(not(defined($method_names{myfunc})), - 'Unrelated method is not added to class without @member tag'); -reset_parser(); -$src = q# -/** @constructor */ -function Foo(){ - this.x = function(){return null;}; -} -/** - * @member Foo - */ -function myfunc(){return null;} -#; -$classes = parse_code_tree(\$src); -%method_names = map { $_->{mapped_name} => 1 } - @{$classes->{Foo}->{instance_methods}}; -ok(defined($method_names{myfunc}), - 'Add method marked with @member to class'); -reset_parser(); - -# -# preprocess_source -# - -diag("Testing preprocess_source"); - -# Make sure that: -# -# Foo.prototype = { -# bar: function(){ return "Eep!"; }, -# baz: "Ha!" -# } -# -# becomes: -# -# Foo.prototype.bar = function(){ return "Eep!"; }; -# Foo.prototype.baz = "Ha!"; - -my $before = q/ - Foo.prototype = { - bar: function(){ return "Eep!"; }, - baz: "Ha!" - } /; - -my $after_re = qr/^\s*(?:$JSDOC_COMMENT)?\s*Foo.prototype.bar - \s*=\s* - function\(\s*\)\s*\{[^\}]*}\s*;\s* - Foo\.prototype\.baz\s*=\s*"[^"]+"\s*;\s*$/x; - -like(preprocess_source($before), $after_re, - 'Unpack prototype block assignment'); - -# -# Make sure that: -# -# /** @constructor */ -# Foo.Bar = function(){this.x = 2;var y = 3;} -# becomes: -# /** @constructor */ -# Foo.Bar = function(){}; -# -# /** @constructor */ -# function Foo.Bar(){} -# -# Foo.Bar.prototype.x = 2; -# -# /** @private */ -# Foo.Bar.prototype.y = 3; -# -$before = q# - /** @constructor */ - Foo.Bar = function(){this.x = 2; var y = 3; }#; -$after_re = qr{ - ^\s*/\*\*\s*\@constructor\s*\*/\s* - Foo\.Bar\s*=\s*function\s*\(\s*\)\s*\{\s*\}\s*;\s* - /\*\*\s*\@constructor\s*\*/\s* - function\s+Foo\.Bar\s*\(\s*\)\s*\{\s*\} - \s* - Foo\.Bar\.prototype\.x\s*=\s*2\s*;\s* - /\*\*\s*\@private\s*\*/\s* - Foo\.Bar\.prototype\.y\s*=\s*3\s*;\s*$ - }x; -like(preprocess_source($before), $after_re, - 'Unpack nested class'); - -# -# Make sure that: -# MySingleton = new function(){this.x=function(){}} -# and -# var MySingleton = new function(){this.x=function(){}} -# become: -# function MySingleton(){} -# MySingleton.prototype.x = function(){}; -# -$before = q# MySingleton = new function(){this.x=function(){}} #; -$after_re = qr{ - ^\s*(?:$JSDOC_COMMENT)? - \s*function\s*MySingleton\s*\(\)\s*\{\s*\}\s* - (?:$JSDOC_COMMENT)?\s* - MySingleton\.prototype\.x\s*=\s*function\s*\(\s*\)\s*\{\s*\}\s*;\s*$}x; -like(preprocess_source($before), $after_re, - 'Unpack singleton'); - -# Same thing, but with var before the declaration -$before = q#var MySingleton = new function(){this.x=function(){}} #; -like(preprocess_source($before), $after_re, - "Unpack var'd singleton"); - - -# -# Test unpacking a constructor into a bunch of -# prototype-based declarations -# - -$before = q# - /** - * @constructor - */ - function MyClass(){ - /** Private variable 'x' */ - var x = 3; - /** - * This is my function - */ - this.myFunction = function(){ return null; }; - - /** - * This is a private function - */ - function myPrivateFunction(x){ - return null; - } - } -#; -$after_re = qr{ - /\*\*\s* - \*\s*\@constructor\s* - \*/\s* - function\s+MyClass\s*\(\s*\)\s*\{\s*\}\s* - - /\*\*\s*Private\svariable\s'x'\s* - \@private\s*\*/\s* - MyClass\.prototype\.x\s*=\s*3\s*;\s* - - /\*\*\s* - \*\s*This\sis\smy\sfunction\s*\*/\s* - MyClass\.prototype\.myFunction\s*=\s*function\s*\(\s*\)\s*\{ - [^\}]*\}\s*;\s* - - /\*\*\s* - \*\s*This\sis\sa\sprivate\sfunction\s* - \@private\s*\*/\s* - MyClass\.prototype\.myPrivateFunction\s*=\s*function\(\s*x\s*\)\s* - \{[^\}]*\}\s*$ -}x; - -like(preprocess_source($before), $after_re, - 'Testing unpacking a constructor into prototype-based assignments'); - - -# -# Test the marking of void methods -# -$before = q'function MyFunc(){}'; -$after_re = qr{/\*\*\s*\@type\s+void\s*\*/\s*function\s+MyFunc\s*\(\)\{\}}; -like(preprocess_source($before), $after_re, - "Testing basic marking of void method without a docstring"); - -$before = q' -/** Method */ -function MyFunc(){} -'; -$after_re = qr{/\*\*\s*Method\s+\@type\s+void\s*\*/\s* - function\s+MyFunc\(\)\{\}}x; -like(preprocess_source($before), $after_re, - "Testing basic marking of void methods"); - -$before = '/** Method */ - Shape.prototype.MyFunc = function(){}'; -$after_re = qr{ - /\*\*\s* - Method\s+ - \@type\s+void\s* - \*/\s*Shape\.prototype\.MyFunc\s*=\s*function\(\)\{\}}x; -like(preprocess_source($before), $after_re, - "Testing marking of void anonymous method"); - -$before = 'Shape.prototype.MyFunc = function(){return null;}'; -$after_re = qr{^\s*Shape\.prototype\.MyFunc\s*= - \s*function\(\)\{[^\}]*\}}x; -like(preprocess_source($before), $after_re, - "Testing marking of void anonymous method"); - -$before = "function x(){return null;}"; -$after_re = qr{\s*function\sx\(\)\s*\{[^\}]*\}\s*$}; -like(preprocess_source($before), $after_re, - "Leave non-void methods without docstrings alone"); - -$before = "/** My test function */\nfunction x(){return null;}"; -$after_re = qr{\s*/\*\*\s*My\stest\sfunction\s*\*/\s* - function\sx\(\)\s*\{[^\}]*\}\s*$}x; -like(preprocess_source($before), $after_re, - "Leave non-void methods with docstrings alone"); - -reset_parser(); -$src = q# -/** - * @constructor - */ -function MyClass(){ - this.af = afunc; - this.bf = bfunc; - this.cf = cfunc; - function afunc(){} - function bfunc(){} - function cfunc(){} -} -#; -$classes = parse_code_tree(\$src); -ok(eq_set( - [ map { $_->{mapped_name} } - @{$classes->{MyClass}->{instance_methods}}], - ['af', 'bf', 'cf', 'afunc', 'bfunc', 'cfunc']), - "Ensure instance methods in constructor are correctly assigned"); - - - -reset_parser(); -$src = 'function MyFunction(){ return ""; }'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{GLOBALS}->{class_methods}->[0]->{vars}->{type}), - "Ensure a function returning an empty string is not marked as void"); - -reset_parser(); -$src = 'function A(){ var x = "x"; }'; -$classes = parse_code_tree(\$src); -ok($classes->{GLOBALS}->{class_methods}->[0]->{vars}->{type}->[0] eq 'void', - "Ensure a global void is void"); - -reset_parser(); -$src = 'function A(c){ c.someFunc = function(){ return 2; }; }'; -$classes = parse_code_tree(\$src); -ok($classes->{GLOBALS}->{class_methods}->[0]->{vars}->{type}->[0] eq 'void', - "Ensure inner function definitions don't affect the return type"); - -reset_parser(); -$src = 'function A(c){ c.someFunc = function(){ return 2; }; return ""; }'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{GLOBALS}->{class_methods}->[0]->{vars}->{type}->[0]), - "Ensure inner-function measures don't affect non-void functions"); - -reset_parser(); -$src = '/** @return {int} Description */function f(){}'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{GLOBALS}->{class_methods}->[0]->{vars}->{type}->[0]), - 'Methods with a @return tag but no return statement are not marked void'); - -reset_parser(); -$src = 'function f(){ return (true ? "t" : "f");}'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{GLOBALS}->{class_methods}->[0]->{vars}->{type}->[0]), - "Non-void with non-trivial return statement is not marked as void"); - -# -# Try huge constructor input -# -my @testsrc = (q# -/** - * @class This is class information - * @constructor - */ - function MyClass(){ - -#); -for (1..30){ - push @testsrc, " - /** This is a private method */ - function f$_(){ return null; } - - /** - * THis is function number $_ - * \@return Nothing - */ - this.func$_ = function(){if(true){if(false){return null;}}} ;\n"; -} -push @testsrc, "\n}\n"; -my $testsrc = join("\n", @testsrc); -# This could crash everything -preprocess_source($testsrc); -pass("Process huge constructor with preprocess_source"); - - -# -# Huge constructor with unbalanced input -# -@testsrc = (q# -/** - * @class This is class information - * @constructor - */ - function MyClass(){ - -#); -for (1..100){ - push @testsrc, " - /** - * THis is function number $_ - * \@return Nothing - */ - this.func$_ = function(){if(true){if(false){return null;}};\n"; -} -push @testsrc, "\n}\n"; -$testsrc = join("\n", @testsrc); -# This could crash everything -preprocess_source($testsrc); -pass("Process huge unbalanced constructor with preprocess_source"); - -# -# deconstruct_mozilla_getset -# -$before = 'MyClass.prototype.__defineGetter__("myProp", function(){return null;});'; -$after_re = qr{ - ^\s*MyClass\.prototype\.myProp\s*=\s*null\s*;\s*$}x; - #\s*function\s*\(\s*\)\s*\{\s*return\s+null\s*;\s*\}\s*;\s*$}x; - -like(deconstruct_getset($before), $after_re, - "Testing behaviour of __defineGetter__"); -like(preprocess_source($before), $after_re, - "Testing behaviour of __defineGetter__ in preprocess_source"); - -$before = 'MyClass.prototype.__defineSetter__("myProp", function(){return null;});'; -$after_re = qr{ - ^\s*MyClass\.prototype\.myProp\s*=\s*null\s*;\s*$}x; - -like(deconstruct_getset($before), $after_re, - "Testing behaviour of __defineSetter__"); -like(preprocess_source($before), $after_re, - "Testing behaviour of __defineSetter__ in preprocess_source"); - -reset_parser(); -$src = " - function MyFunc(theclass){ - var x = 2; - theclass.prototype.f = function(){}; - return x; - } - MyClass.prototype.f = function(){}; -"; -$classes = parse_code_tree(\$src); -ok(not(defined($classes->{theclass})), - "Ensure that dynamic prototyping doesn't add classes"); -ok(defined($classes->{MyClass}), - "Ensure that normal classes are added with static prototyping"); - -# -# miscellaneous tests -# -diag("Miscellaneous tests"); -reset_parser(); -$src = " - /** \@constructor */ - function A(){} - /** \@constructor */ - function C(){} - /** \@constructor - \@extends A - */ - function B(){} - B.prototype = new C();"; - -$classes = parse_code_tree(\$src); -is($classes->{B}->{extends}, 'A', - "Test that the first extends marking is the good one, others are ignored"); - -reset_parser(); -$src = "function A(){ this.n = function(){return 2};} - var a = new A(); "; -$classes = parse_code_tree(\$src); -ok(defined($classes->{A}), - "Functions are later used with 'new' must be treated as a constructor"); - -ok(!defined($classes->{this}), "'this' cannot be added as a class"); - - -# -# Ensure using the @base tag automatically qualifies a function as a class, -# even if the base class isn't defined -# -reset_parser(); -$src = '/** @base SomeOtherClass */ -function MyClass(){}'; -$classes = parse_code_tree(\$src); -ok(defined($classes->{MyClass}), - 'A function must be upgraded to a class if the @base tag is used'); - -# -# Allow an anonymous function to be assigned to a global variable, -# resulting in a new class -# -reset_parser(); -$src = ' -/** - * Some function - * @constructor - */ -var SomeClass = function(){ this.x = 2; } -'; -$classes = parse_code_tree(\$src); -ok(defined($classes->{SomeClass}), - "Allow anonymous function to be assigned to a global variable"); - -# -# Make sure that dynamically binding methods to a object at a later time -# do not affect the documentation -# -reset_parser(); -$src = ' -function AddCallback(obj){ - obj.callback = function(){ return null; }; -}'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{obj}), - "Don't add passed-in objects as classes when doing dynamic binding"); - -reset_parser(); -$src = ' -/** @constructor */ -function A(){} -A.prototype.setup = A_Setup; -A.prototype.tearDown = A_TearDown; -function A_Setup(){ - this.callback = function(){ return null; }; -} -function A_TearDown(){ - this.tornDown = true; -}'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{this}), - "Don't add 'this' as a class when dynamically adding methods in a method"); - -# -# Test block prototype assignment -# -diag("Test block prototype assignment"); -reset_parser(); -$src = ' -SomeClass.prototype = { - funcA: function(){ return null; }, - valA: 3, - funcB: function(){ return null; }, - valB: "just testing", - funcC: function(){} -};'; -$classes = parse_code_tree(\$src); -ok(eq_set( - [ map { $_->{mapped_name} } - @{$classes->{SomeClass}->{instance_methods}}], - ['funcA', 'funcB', 'funcC']), - "Ensure instance methods are assigned in prototype definition block"); -ok(eq_set( - [ map { $_->{field_name} } - @{$classes->{SomeClass}->{instance_fields}}], - ['valA', 'valB']), - "Ensure instance fields are assigned in prototype definition block"); - -# -# Test prototype assignment -# -diag("Test prototype assignment"); -reset_parser(); -$src = ' -function Base(){} -function Sub(){} -Sub.prototype = new Base(); -'; -$classes = parse_code_tree(\$src); -ok($classes->{Sub}->{extends} eq 'Base', - "Prototype assignment results in inheritance"); - -reset_parser(); -$src = ' -function Base(){} -function Sub(){} -Sub.prototype = new Base; -'; -$classes = parse_code_tree(\$src); -ok($classes->{Sub}->{extends} eq 'Base', - "Prototype assignment results in inheritance (2)"); - -# -# Test the handling of methods defined more than once -# -reset_parser(); -$src = ' -function f(){} -/** doc */ -function f(){} -'; -$classes = parse_code_tree(\$src); -ok($classes->{GLOBALS}->{class_methods}->[0]->{description} eq 'doc', - "In case of double function definition, the one with most info wins"); - -reset_parser(); -$src = ' -/** doc */ -function f(){} -function f(){} -'; -$classes = parse_code_tree(\$src); -ok($classes->{GLOBALS}->{class_methods}->[0]->{description} eq 'doc', - "In case of double function definition, the one with most info wins (2)"); - -# -# Make sure that extra JSDoc-style comment blocks are not viewed as source -# -reset_parser(); -$src = ' -/** @constructor */ -function x(){} - -/** more doc -function y(){} -*/ - -/** @constructor */ -function z(){} -'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{GLOBALS}->{class_methods}->[0]), - "Ignore JSDoc in extra JSDoc-comment blocks"); - - -# -# Test the behaviour of the @ignore tag -# -reset_parser(); -$src = ' -/** This method is normal */ -function Normal(){} - -/** @ignore */ -function Hidden(){} -'; -$classes = parse_code_tree(\$src); -my %fnames = map { $_->{mapped_name} => 1 } - @{$classes->{GLOBALS}->{class_methods}}; -ok(defined $fnames{Normal}, "A normal method is picked up and documented"); -ok(!defined $fnames{Hidden}, 'An @ignored method is not picked up'); - -# -# Test the behaviour of the @addon tag -# -reset_parser(); -$src = ' -/** - * Should be ignored - */ -ClassOne.funcOne = function(){}; - -/** - * Should not be ignored - * @addon - */ -ClassTwo.funcOne = function(){}; - -ClassThree.prototype = new Object(); -ClassThree.funcThree = function(){}'; -$classes = parse_code_tree(\$src); -ok(!defined($classes->{ClassOne}), - 'Extensions to undefined classes/objects without @addon are ignored'); -ok(defined($classes->{ClassTwo}), - 'Extensions to undefined classes/objects with @addon are not ignored'); -ok($classes->{ClassThree}->{class_methods}->[0]->{mapped_name} eq 'funcThree', - 'Class methods without @addon work on pre-defined classes'); - -# -# Ensure enclosing package-classes are still recognized without using @addon -# -reset_parser(); -$src = ' -/** - * @constructor - */ -package.MyClass = function MyClass(){} - -package.MyClass.prototype.foo = function foo(){} -'; -$classes = parse_code_tree(\$src); -ok(defined($classes->{package}), - 'Super-package-classes must be recognized without the @addon tag'); -ok(defined($classes->{'package.MyClass'}), - 'Sub-package-classes must be recognized without the @addon tag'); - - diff --git a/modules/jala/util/HopKit/JSDoc/jsdoc.pl b/modules/jala/util/HopKit/JSDoc/jsdoc.pl deleted file mode 100644 index 8ef004bd..00000000 --- a/modules/jala/util/HopKit/JSDoc/jsdoc.pl +++ /dev/null @@ -1,1282 +0,0 @@ -#!/usr/bin/perl -w - -# -# This program makes use of the JSDoc module to make a JavaDoc equivalent -# for JavaScript. The template that is used is based on the JavaDoc -# doclet. This program only needs to be invoked with one or more -# JS OO sourcefiles as command-line args. -# - -use strict; -use HTML::Template; -use File::Copy; -use File::Basename; -use Getopt::Long; -use File::Find; -use lib dirname($0); -use JSDoc; -use JSDoc::XML; -use JSDoc::XMI; -use JavaScript::Syntax::HTML qw(to_html); - - -use constant LOCATION => dirname($0) . '/'; -use constant MAIN_TMPL => "main.tmpl"; -use constant ALLCLASSES_TMPL => 'allclasses-frame.tmpl'; -use constant ALLCLASSES_NOFRAME_TMPL => 'allclasses-noframe.tmpl'; -use constant OVERVIEW_FRAME_TMPL => 'overview-frame.tmpl'; -use constant TREE_TMPL => 'overview-tree.tmpl'; -use constant OVERVIEW_TMPL => 'overview-summary.tmpl'; -use constant INDEX_TMPL => 'index.tmpl'; -use constant DEFAULT_DEST_DIR => 'js_docs_out/'; -use constant STYLESHEET => 'stylesheet.css'; -use constant HELP_TMPL => 'help-doc.tmpl'; -use constant INDEX_ALL_TMPL => 'index-all.tmpl'; -use constant CONSTANTS_TMPL => 'constant-values.tmpl'; - -use vars qw/ $CLASSES $DEFAULT_CLASSNAME @CLASSNAMES @INDEX %TMPL_CACHE - %CLASS_ATTRS_MAP %METHOD_ATTRS_MAP %FILE_ATTRS_MAP %OPTIONS - @FILENAMES %FILE_OVERVIEWS $TIME $CURRENT_CLASS /; - -# -# Begin main execution -# - -&parse_cmdline; -&initialize_param_maps; -$TIME = localtime(); -do '.jsdoc_config'; -warn "Error parsing config file: $@\n" if $@; - -my @sources; - -mkdir($OPTIONS{OUTPUT}) - or die "Can't create output directory $OPTIONS{OUTPUT}: $!\n" - unless (-e $OPTIONS{OUTPUT} && -d $OPTIONS{OUTPUT}); - - -if (@ARGV < 1 || $OPTIONS{HELP} || !(@sources = &load_sources())){ - warn "No sourcefiles supplied\n" if !$OPTIONS{HELP}; - &show_usage(); - exit(1); -} - -# Parse the code tree -&configure_parser( - GLOBALS_NAME => $OPTIONS{GLOBALS_NAME}, - NO_LEXICAL_PRIVATES => $OPTIONS{NO_LEXICAL_PRIVATES}); -$CLASSES = &parse_code_tree(@sources); -%FILE_OVERVIEWS = %{delete $CLASSES->{__FILES__}}; -die "Nothing to document, exiting\n" unless keys %{$CLASSES}; - -if ($OPTIONS{FORMAT} eq 'html'){ - &output_html; -} elsif ($OPTIONS{FORMAT} eq 'xml') { - &output_xml; -} elsif ($OPTIONS{FORMAT} eq 'xmi'){ - &output_xmi; -} else { - die "Unknown data format '$OPTIONS{FORMAT}'\n"; -} - -&_log('Completed generating documentation'); - -# -# End main execution -# - - -# -# Output a single template -# -sub output_template { - my ($tmplname, $outname, $params, $relaxed) = (@_); - - $OPTIONS{TEMPLATEDIR} =~ s/(\S+)\/$/$1/; - - $tmplname = $OPTIONS{TEMPLATEDIR} . "/$tmplname"; - die "Template file '$tmplname' not found" unless -e $tmplname; - - # Caching templates seems to improve performance quite a lot - if (!$TMPL_CACHE{$tmplname}){ - $TMPL_CACHE{$tmplname} = new HTML::Template( - die_on_bad_params => !$relaxed, - filename => $tmplname); - } - my $tmpl = $TMPL_CACHE{$tmplname}; - $tmpl->param($params); - $outname = sprintf('%s%s', $OPTIONS{OUTPUT}, mangle($outname)); - &print_file($outname, $tmpl->output); -} - - -# -# Output data to a file -# -sub print_file { - my ($fname, $data) = @_; - open FILE, ">$fname" - or die "Couldn't open '$fname' to write: $!\n"; - print FILE $data; - close FILE; -} - -# -# Output HTML documentation in the output directory -# -sub output_html { - &output_class_templates(); - &output_index_template(); - &output_aux_templates(); - &output_tree_template(); -} - -# -# Output XMI in the output directory -# -sub output_xmi { - my $xmi = JSDoc::XMI->new(LOCATION); - &print_file("$OPTIONS{OUTPUT}/jsdoc.xmi", $xmi->output($CLASSES)); -} - -# -# Output XML in the output directory -# -sub output_xml { - my $xml = JSDoc::XML->new(LOCATION); - &print_file("$OPTIONS{OUTPUT}/jsdoc.xml", $xml->output($CLASSES)); -} - -# -# Gather information for each class and output its template -# -sub output_class_templates { - - # Note the class name for later, including classes that aren't defined - # but are used for inheritance - my %seen; - @CLASSNAMES = sort { lc $a->{classname} cmp lc $b->{classname}} - grep { !$seen{$_->{classname}}++ } - (map {classname => $_} , - grep { not defined $CLASSES->{$_}->{constructor_vars}->{private} - or $OPTIONS{PRIVATE} } - keys %$CLASSES), - (map { classname => $_ }, grep { !defined($$CLASSES{$_}) } - map { $_->{extends} } grep { defined($_->{extends}) } - values %$CLASSES); - die "Nothing to document, exiting\n" unless @CLASSNAMES; - - @FILENAMES = map {filename => $_, mangledfilename => mangle($_)}, - sort {lc($a) cmp lc($b)} grep {length $_} keys %FILE_OVERVIEWS; - for (my $i = 0; $i < @CLASSNAMES; $i++){ - my $classname = $CLASSNAMES[$i]->{classname}; - $CURRENT_CLASS = $classname; - next unless $$CLASSES{$classname}; - - # Template Parameters - my ($class, $subclasses, $class_summary, @constructor_params, - $next_class, $prev_class, $constructor_attrs, $constructor_detail); - - $class= $$CLASSES{$classname}; - &add_to_index($class, $classname); - - # Set up the constructor and class information - &resolve_synonyms($class->{constructor_vars}); - &format_vars($class->{constructor_vars}); - @constructor_params = - &fetch_args($class->{constructor_vars}, - \$class->{constructor_args}); - $constructor_attrs = - &format_method_attributes($class->{constructor_vars}); - $constructor_detail = - &resolve_inner_links($class->{constructor_detail}); - $class_summary = &format_class_attributes($class->{constructor_vars}); - $class_summary = &resolve_inner_links($class_summary); - - # Navbar information - $next_class = $i + 1 < @CLASSNAMES - ? $CLASSNAMES[$i + 1]->{classname} - : undef; - $prev_class = $i > 0 ? $CLASSNAMES[$i - 1]->{classname} : undef; - - # Find all the direct subclasses - $subclasses = join( ',', - map qq| $_|, - @{&find_subclasses($classname)}); - - my $superclass = $class->{extends} || ''; - - if ($$CLASSES{$superclass}){ - $superclass = "$superclass" - unless (!$OPTIONS{PRIVATE} - && $$CLASSES{$superclass}->{constructor_vars}->{private}); - } - - my $file_overview = $class->{constructor_vars}->{filename} ? - sprintf('overview-summary-%s.html', - mangle($class->{constructor_vars}->{filename})) - : ''; - - &output_template(MAIN_TMPL, "$classname.html", { - next_class => $next_class, - prev_class => $prev_class, - file_overview => $file_overview, - superclass => $superclass, - constructor_args => $class->{constructor_args}, - constructor_params => \@constructor_params, - constructor_attrs => $constructor_attrs, - constructor_returns => $class->{constructor_vars}->{returns}[0], - class_summary => $class_summary, - class_attribs => $class->{constructor_vars}->{private} ? - '<private>' : '', - constructor_detail => $constructor_detail, - constructor_summary => &get_summary($constructor_detail), - classname => $classname, - subclasses => $subclasses, - class_tree => &build_class_tree($classname, $CLASSES), - fields => &map_fields($class), - methods => &map_methods($class), - method_inheritance => &map_method_inheritance($class), - field_inheritance => &map_field_inheritance($class), - inner_classes => $class->{inner_classes}, - project_name => $OPTIONS{PROJECT_NAME}, - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME - }, 1); - } -} - -# -# Handle cleaning up / resolving inner links in FILE_OVERVIEWS -# -sub process_file_overviews { - for my $filename (map{$_->{filename}} @FILENAMES){ - my $overview = $FILE_OVERVIEWS{$filename}; - my $src = $overview->{src}; - $overview->{src} = ''; - format_vars($overview); - $overview = - resolve_inner_links($FILE_OVERVIEWS{$filename}); - $overview->{src} = $src; - $FILE_OVERVIEWS{$filename} = $overview; - } -} - -# -# Output all the non-class template files -# -sub output_aux_templates(){ - - unless ($OPTIONS{LOGO} and -f $OPTIONS{LOGO} and -r $OPTIONS{LOGO}){ - $OPTIONS{LOGO} and warn "Can't read $OPTIONS{LOGO}"; - $OPTIONS{LOGO} = ''; - } - $OPTIONS{LOGO} and copy $OPTIONS{LOGO}, $OPTIONS{OUTPUT}; - - &process_file_overviews; - $DEFAULT_CLASSNAME = - (grep { - defined($$CLASSES{$_->{classname}}) } @CLASSNAMES)[0]->{classname}; - - my $summary = &get_overall_summary; - - &output_classes_frames_templates; - &output_multiple_files_templates if @FILENAMES > 1; - &output_index_and_help_templates($summary); - &output_overview_summaries($summary); - &output_const_summary(); - my $stylesheet = LOCATION . STYLESHEET; - if ($OPTIONS{TEMPLATEDIR} ne LOCATION){ - $stylesheet = $OPTIONS{TEMPLATEDIR} . '/' . STYLESHEET; - die "Stylesheet '$stylesheet' not found" unless -e $stylesheet; - } - copy ($stylesheet, $OPTIONS{OUTPUT} . STYLESHEET); -} - -sub get_overall_summary { - my $summary; - if ($OPTIONS{PROJECT_SUMMARY}){ - if (-f $OPTIONS{PROJECT_SUMMARY} and - open SUMMARY, $OPTIONS{PROJECT_SUMMARY}){ - local $/ = undef; - $summary = ; - close SUMMARY; - } else { - warn "Can't open $OPTIONS{PROJECT_SUMMARY}"; - } - } elsif (@FILENAMES == 1) { - # If we only have one file and it has an overview, use that overview - my $filename = $FILENAMES[0]->{filename}; - if ($FILE_OVERVIEWS{$filename}->{fileoverview}){ - $summary = $FILE_OVERVIEWS{$filename}->{fileoverview}[0]; - $summary .= "

      "; - - while (my ($name, $val) = each %{$FILE_OVERVIEWS{$filename}}){ - $summary .= &{$FILE_ATTRS_MAP{$name}}($val) - if $FILE_ATTRS_MAP{$name}; - } - } - } - $summary; -} - -# -# Output the main (default) page and the help template -# -sub output_index_and_help_templates { - - my ($summary) = @_; - - # Output the main index template - &output_template(INDEX_TMPL, 'index.html', { - DEFAULT_CLASSNAME => @FILENAMES > 1 - ? 'overview-summary' - : $DEFAULT_CLASSNAME, - multifile => @FILENAMES > 1 }); - - # Output the help document template - &output_template(HELP_TMPL, 'help-doc.html', { - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME, - project_name => $OPTIONS{PROJECT_NAME} }); - -} - -# -# Output the frames listing all the classes -# -sub output_classes_frames_templates { - my $classnamesref = - [ grep { defined($$CLASSES{$_->{classname}}) } @CLASSNAMES ]; - my $params = { - filename => 'All Classes', - fname_link => 'All Classes', - CLASSNAMES => $classnamesref }; - if (@FILENAMES < 2){ - $params->{project_name} = $OPTIONS{PROJECT_NAME}; - $params->{logo} = basename($OPTIONS{LOGO}); - } - &output_template(ALLCLASSES_TMPL, 'allclasses-frame.html', $params); - - &output_template(ALLCLASSES_NOFRAME_TMPL, 'allclasses-noframe.html', { - CLASSNAMES => $classnamesref, - project_name => $OPTIONS{PROJECT_NAME}, - logo => basename($OPTIONS{LOGO}) }); - -} - -# -# Output the overview summary templates -# -sub output_overview_summaries { - my ($summary) = @_; - - my @overviews = map { - name => $_, - link => &mangle("overview-summary-$_.html"), - overview => - get_summary( - $FILE_OVERVIEWS{$_}{fileoverview}[0] || ' ') - }, sort {lc($a) cmp lc($b)} keys(%FILE_OVERVIEWS); - - &output_template(OVERVIEW_TMPL, 'overview-summary.html', { - generic => 1, - project_name => $OPTIONS{PROJECT_NAME}, - project_title => $OPTIONS{PROJECT_NAME}, - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME, - project_summary => $summary, - is_file_summary => 0, - overviews => \@overviews }); - - for my $filename (keys %FILE_OVERVIEWS){ - my @classes = grep { - ($$CLASSES{$_}->{constructor_vars}->{filename} || '') eq $filename - } keys %$CLASSES; - my @class_overviews = sort { lc($a->{name}) cmp lc($b->{name}) } - map { - name => $_, - link => "$_.html", - overview => get_summary( - $CLASSES->{$_}->{constructor_vars}->{class}[0] || ' ') - }, grep { !$CLASSES->{$_}->{constructor_vars}->{private} - || $OPTIONS{PRIVATE} } @classes; - my %overview = %{$FILE_OVERVIEWS{$filename}}; - my $src = delete $overview{src}; - my $summary = $overview{fileoverview}[0] || - "No overview generated for '$filename'"; - $summary .= "

      "; - while (my ($name, $val) = each %overview){ - $summary .= &{$FILE_ATTRS_MAP{$name}}($val) - if $FILE_ATTRS_MAP{$name}; - } - my @methods = - map { - is_private => $_->{is_private}, - method_summary => $_->{method_summary}, - is_class_method => $_->{is_class_method}, - method_anchor => - sprintf('%s%s', $_->{is_class_method} ? '!s!' : '', - $_->{method_name}), - method_arguments=> $_->{method_arguments}, - method_name => $_->{method_name}, - type => $_->{type}, - file_link => $OPTIONS{GLOBALS_NAME} . ".html" - }, @{&map_methods($$CLASSES{$OPTIONS{GLOBALS_NAME}}, $filename)}; - - &output_template(OVERVIEW_TMPL, "overview-summary-$filename.html", { - generic => 0, - sourcecode => $OPTIONS{NO_SRC} ? '' : &to_html($src), - project_name => $OPTIONS{PROJECT_NAME}, - project_title => $filename, - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME, - project_summary => $summary, - is_file_summary => 1, - methods => \@methods, - overviews => \@class_overviews }); - } - -} - -# -# Output a summary page about the 'static constant' field values for all -# classes -# -sub output_const_summary { - my @static_params; - for my $classname (sort { uc($a) cmp uc($b) } keys %$CLASSES){ - my $class = $CLASSES->{$classname}; - my @statics = grep { $_->{field_value} =~ /^(?:\d+)|(?:(['"]).*\1)$/} - grep { $_->{field_vars}->{final}} @{$class->{class_fields}}; - if (@statics){ - push @static_params, { - classname => $classname, - static_values => [map { - name => $_->{field_name}, - value => $_->{field_value}, - classname => $classname}, @statics] }; - } - } - &output_template(CONSTANTS_TMPL, 'constant-values.html', { - project_name => $OPTIONS{PROJECT_NAME}, - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME, - classnames => [map {name => $_->{classname}}, @static_params], - static_finals => \@static_params - } - ) if @static_params; -} - -# -# Method to handle outputting file overview template if -# more than one sourcefile is being processed -# -sub output_multiple_files_templates { - &output_template(OVERVIEW_FRAME_TMPL, 'overview-frame.html', { - logo => basename($OPTIONS{LOGO}), - project_name => $OPTIONS{PROJECT_NAME}, - filenames => \@FILENAMES }); - - for my $fname (map { $_->{filename}} @FILENAMES){ - my @classes = grep { - ($$CLASSES{$_}->{constructor_vars}->{filename} || '') eq $fname - } keys %$CLASSES; - - #methods under GLOBAL (detached) class - my @methods; - for (my $i = 0; $i < @CLASSNAMES; $i++){ - if($CLASSNAMES[$i]->{classname} eq $OPTIONS{GLOBALS_NAME}){ - my $class = $$CLASSES{$CLASSNAMES[$i]->{classname}}; - for my $method ( - sort {lc $a->{mapped_name} cmp lc $b->{mapped_name} } - @{$class->{class_methods}}){ - if(defined($fname) - && $fname eq $method->{vars}->{filename}){ - $method->{filename} = $fname; - push(@methods, $method); - } - } - last; - } - } - - &output_template(ALLCLASSES_TMPL, - sprintf('overview-%s.html', $fname), { - filename => $fname, - fname_link => $FILE_OVERVIEWS{$fname} - ? sprintf('%s', - mangle($fname), $fname) - : $fname, - CLASSNAMES => [map {classname => $_}, - grep { !$$CLASSES{$_}->{constructor_vars}->{private} - || $OPTIONS{PRIVATE} } sort @classes] }); - } -} - -# -# Mangle a file path so that it can be used as a filename -# -sub mangle { - local $_ = shift; - tr{/\\}{_}; - $_; -} - -# -# Build the tree representation of the inheritance -# PARAM: Name of the class -# -sub build_class_tree { - my $classname = shift; - my $class = $$CLASSES{$classname}; - my $tree = ""; - my @family; - push @family, $classname; - while ($class->{extends} and $class->{extends} ne ""){ - my $base = $class->{extends}; - if ($$CLASSES{$base}){ - $base = "$base" - unless (!$OPTIONS{PRIVATE} - && $$CLASSES{$base}->{constructor_vars}->{private}); - } elsif ($class->{constructor_vars}->{base}){ - if (my ($bcname, $url) = - $class->{constructor_vars}->{base}->[0] - =~ /^(\S+)\s(\S.*)$/){ - $base = "$base"; - } - } - push @family, $base; - $class = $$CLASSES{$class->{extends}}; - } - push @family, "Object"; - my $indent = 3; - $tree = (pop @family) . "\n"; - my $name = $_; - while ($name = pop (@family)){ - my $instr = " " x $indent; - $tree .= sprintf "%s|\n%s+--%s%s%s\n", $instr, $instr, - $name eq $classname ? "" : "", $name, - $name eq $classname ? "" : ""; - $indent += 6; - } - $tree; -} - -# -# Shown if no commandline args are given -# -sub show_usage(){ - print qq{Usage: jsdoc [OPTIONS] + - - -h | --help Show this message and exit - -r | --recursive Recurse through given directories - -p | --private Show private methods and fields - -d | --directory Specify output directory (defaults to js_docs_out) - -q | --quiet Suppress normal output - - --page-footer Specify (html) footer string that will be added to - all docs - --project-name Specify project name for that will be added to docs - --logo Specify a path to a logo to be used in the docs - --project-summary Specify a path to a text file that contains an - overview summary of the project - - --no-sources Don't include the source code view - - --extensions Provide a comma-separated list of file extensions - to be considered as JavaScript source files - - --package-naming Use package-style naming (i.e. keep directory names - in the file path). This is useful if you have multiple - files with the same name, but in different directories. - This option is only useful if --recursive is also used. - - --globals-name Specify a 'class name' under which all unattached - methods will be classified. The defaults to GLOBALS - - --format Set the output format. The options are html, xml - and xmi, defaulting to html. The others are currently - alpha software. - - --template-dir Provide another directory containing HTML templates - - --no-lexical-privates Ignore "private" variables and functions that are - lexically defined within constructors - - \n}; - -} - -# -# Take all the command line args as filenames and add them to @SOURCESFILES -# -sub load_sources(){ - my (@filenames, @sources); - my $ext_re = sprintf('%s', - join '|', split /\s*,\s*/, $OPTIONS{EXTENSIONS}); - for my $arg (@ARGV){ - if (-d $arg) { - $arg =~ s/(.*[^\/])$/$1\//; - find( { - wanted => sub { - push @filenames, { - name => $_, - relname => $OPTIONS{PACKAGENAMING} - ? substr($_, length($arg)) - : (fileparse($_))[0] - } if ((-f and -r and /.+\.$ext_re$/oi) && - (/^\Q$arg\E[^\/]+$/ || $OPTIONS{RECURSIVE})) - }, - no_chdir => 1 }, $arg); - } elsif (-f $arg){ - my $relname = (fileparse($arg))[0]; - push @filenames, { name => $arg, relname => $relname }; - } - } - for (@filenames){ - &_log(sprintf 'Loading sources from %s', $_->{name}); - open SRC, '<', $_->{name} - or (warn sprintf("Can't open %s, skipping: $!\n", $_->{name}) - and next); - local $/ = undef; - push @sources, $_->{relname}; - push @sources, \; - close SRC; - } - @sources; -} - -# -# Once all sources have been parsed, finds all subclasses -# of $classname -# -sub find_subclasses(){ - my ($classname) = @_; - my @subclasses; - for my $class (keys %$CLASSES){ - my $subclassname = $$CLASSES{$class}->{extends}; - if ($$CLASSES{$class}->{extends} and - $$CLASSES{$class}->{extends} eq $classname){ - push @subclasses, $class; - } - } - \@subclasses; -} - -# -# Make a summary of a description, cutting it off either at the first -# double newline or the first period followed by whitespace. -# PARAM: $description -# -sub get_summary { - my ($description) = @_; - my $summary; - if ($description){ - ($summary) = $description =~ /^(.*?(?:[?!.](?=\s)|\n\n)).*$/gs - or $summary = $description; - } else { - $summary = ""; - } - $summary; -} - - -# -# Set up all the instance and class methods for one template -# PARAM: A reference to a class -# PARAM: Optional filename, only maps methods for that file (used for GLOBAL) -# -sub map_methods{ - my ($class, $fname) = @_; - my @methods; - for my $mtype (qw(instance_methods class_methods)){ - next unless $class->{$mtype}; - - for my $method ( - sort {lc $a->{mapped_name} cmp lc $b->{mapped_name} } - @{$class->{$mtype}}){ - next if $fname && $fname ne $method->{vars}->{filename}; - &resolve_synonyms($method->{vars}); - next if (!$OPTIONS{PRIVATE} && $method->{vars}->{private}); - - $method->{vars}->{returns}[0] = - $method->{vars}->{returns}[0] || $method->{vars}->{return}; - - my @args = &fetch_args($method->{vars}, \$method->{argument_list}); - @args = map { &format_vars($_); $_ } @args; - - &format_vars($method->{vars}); - my $desc = &resolve_inner_links($method->{description}); - my $type = &map_return_type($method); - my $ret = $method->{vars}->{returns}[0]; - my $attrs = &format_method_attributes($method->{vars}); - - push @methods, { - method_description => $desc, - method_summary => &get_summary($desc), - method_name => $method->{mapped_name}, - method_arguments => $method->{argument_list}, - method_params => \@args, - method_returns => $ret, - is_class_method => $mtype eq 'class_methods', - is_private => defined($method->{vars}->{private}), - attributes => $attrs, - type => $type }; - } - } - \@methods; -} - -# -# Map a function return type -# -sub map_return_type { - my ($method) = @_; - #return 'Object' unless $method->{vars}->{type}[0]; - my $name = 'Object'; - my $link = ''; - if (defined($method->{vars}->{type})){ - $name = $method->{vars}->{type}[0]; - } elsif (defined($method->{vars}->{returns}[0])){ - if ($method->{vars}->{returns}[0] =~ s/\s*\{(\S+)(?:\s+([^}]+))?\}//){ - $name = $1; - $link = $2; - } - $method->{vars}->{type} = [$name]; - } - $name =~ s/^\s*(\S.*?)\s*$/$1/; - if ($$CLASSES{$name} || $link){ - $link ||= "$name.html"; - return qq|$name|; - } - $name; -} - -# -# Set up all the instance and class methods for one template -# PARAM: A reference to a class -# -sub map_fields { - my $class = shift; - my @fields; - # Set up the instance fields - for my $type (qw(instance_fields class_fields)){ - next unless $class->{$type}; - for (sort {lc $a->{field_name} cmp lc $b->{field_name} } - @{$class->{$type}}){ - - &resolve_synonyms($_->{field_vars}); - next if (!$OPTIONS{PRIVATE} && $_->{field_vars}->{private}); - my $description = &resolve_inner_links($_->{field_description}); - my $const_link = ($_->{field_vars}->{final} && - ($_->{field_value} =~ /^\-?\d+(\.\d+)?$/ - || $_->{field_value} =~ /^(["']).*\1$/)) - ? $class->{classname} : ''; - push @fields, { - field_name => $_->{field_name}, - field_description => $description, - field_summary => &get_summary($description), - is_final => defined($_->{field_vars}->{final}), - is_private => defined($_->{field_vars}->{private}), - is_class_field => $type eq 'class_fields', - type => &map_field_type($_), - const_link => $const_link}; - } - } - \@fields; -} - -# -# Map a field type -# -sub map_field_type { - my ($field) = @_; - return 'Object' unless $field->{field_vars}->{type}[0]; - my $name = $field->{field_vars}->{type}[0]; - $name =~ s/^\s*(\S.*?)\s*$/$1/; - return qq|$name| if $$CLASSES{$name}; - $name; -} - -# -# Map all the inherited methods to a template parameter -# PARAM: A reference to a class -# -sub map_method_inheritance { - my $class = shift; - my @method_inheritance; - # Set up the inherited methods - if ($class->{inherits}){ - my $superclassname = $class->{extends}; - my $superclass = $$CLASSES{$superclassname}; - while ($superclass){ - if (!$superclass->{constructor_vars}->{private} - || $OPTIONS{PRIVATE}){ - my $methods = - $class->{inherits}->{$superclassname}->{instance_methods}; - push @method_inheritance, { - superclass_name => $superclassname, - inherited_methods => join(', ', - map(qq|$_|, - &filter_private_methods( - $methods, $superclassname)))} - if ($methods and @$methods); - } - $superclassname = $superclass->{extends}; - $superclass = $superclassname ? $$CLASSES{$superclassname} : undef; - } - } - \@method_inheritance; -} - -# -# Map all the inherited fields to a template parameter -# PARAM: A reference to a class -# -sub map_field_inheritance { - my $class = shift; - my @field_inheritance; - # Set up the inherited fields - if ($class->{inherits}){ - my $superclassname = $class->{extends}; - my $superclass = $$CLASSES{$superclassname}; - while ($superclass){ - if (!$superclass->{constructor_vars}->{private} - || $OPTIONS{PRIVATE}){ - my $fields = - $class->{inherits}->{$superclassname}->{instance_fields}; - push @field_inheritance, { - superclass_name => $superclassname, - inherited_fields => join(', ', - map(qq|$_|, - &filter_private_fields($fields, $superclassname)))} - if ($fields and @$fields); - } - $superclassname = $superclass->{extends}; - $superclass = $superclassname ? $$CLASSES{$superclassname} : undef; - } - } - \@field_inheritance; -} - -# -# Filter out private inherited methods -# -sub filter_private_methods { - my ($methods, $superclassname) = @_; - my @visible_methods; - for my $method(@$methods){ - for my $super_method - (@{$$CLASSES{$superclassname}->{instance_methods}}){ - push @visible_methods, $method - if $method eq $super_method->{mapped_name} and - (!$super_method->{vars}->{private} || $OPTIONS{PRIVATE}); - } - } - @visible_methods; -} - -# -# Filter out private inherited fields -# -sub filter_private_fields { - my ($fields, $superclassname) = @_; - my @visible_fields; - for my $field (@$fields){ - for my $super_field(@{$$CLASSES{$superclassname}->{instance_fields}}){ - push @visible_fields, $field - if $field eq $super_field->{field_name} and - (!$super_field->{field_vars}->{private} - || $OPTIONS{PRIVATE}); - } - } - @visible_fields; -} - -# -# Adds a class's information to the global INDEX list -# -sub add_to_index { - my ($class, $classname) = @_; - push @INDEX, { - name => $classname, - class => $classname, - type => '', linkname => '' - }; - - if (!$class->{constructor_args}){ - $class->{constructor_args} = ''; - } else { - push @INDEX, { - name => "$classname$class->{constructor_args}", - class => $classname, - type => 'Constructor in ', - linkname => 'constructor_detail' }; - } - for my $mtype (qw(class_methods instance_methods)){ - my $type = sprintf('%s method in ', - $mtype eq 'class_methods' ? 'Class' : 'Instance'); - push @INDEX, { - name => "$_->{mapped_name}$_->{argument_list}", - class => $classname, - type => $type, - linkname => $_->{mapped_name}} - for grep { - not($_->{vars}->{private} and not $OPTIONS{PRIVATE}) - } @{$class->{$mtype}}; - - } - for my $ftype (qw(class_fields instance_fields)){ - my $type = sprintf('%s field in ', - $ftype eq 'class_fields' ? 'Class' : 'Instance'); - push @INDEX, { - name => $_->{field_name}, - class => $classname, - type => $type, - linkname => $_->{field_name}} - for grep { - not($_->{field_vars}->{private} and not $OPTIONS{PRIVATE}) - } @{$class->{$ftype}}; - } -} - -# -# Outputs the index page -# -sub output_index_template { - @INDEX = sort {lc $a->{name} cmp lc $b->{name}} @INDEX; - my %letters; - for my $item (@INDEX){ - my $letter = uc(substr($item->{name}, 0, 1)); - $letter = uc(substr($item->{class}, 0, 1)) if $letter eq ''; - push @{$letters{$letter}}, $item; - } - - my $letter_list = [map {letter_name => $_}, - sort {lc $a cmp lc $b} keys %letters]; - &output_template(INDEX_ALL_TMPL, 'index-all.html', { - letters => $letter_list, - project_name => $OPTIONS{PROJECT_NAME}, - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME, - index_list => [map { - letter => $_->{letter_name}, - value => $letters{$_->{letter_name}} - }, @{$letter_list}] }); -} - -# -# Recursively builds up the overview tree -# -sub build_tree { - my $parentclassname = shift || ''; - my $ret = ""; - for my $cname (map {$_->{classname}} @CLASSNAMES) { - next if $cname eq $OPTIONS{GLOBALS_NAME}; - my $class = $$CLASSES{$cname}; - my $parent = $class->{extends} || '-'; - if ((!$parentclassname && $parent eq '-') - or ($parent eq $parentclassname)) { - $ret .= $$CLASSES{$cname} ? qq{ -
    • - - $cname
    • - } : qq{ -
    • - $cname
    • - }; - my $childrentree .= &build_tree($cname); - $ret = "$ret$childrentree" if $childrentree; - } - } - $ret = "
        $ret
      " unless not $ret; - if ($parentclassname eq ''){ - $ret = qq{
      • Object
      • $ret
      }; - } - $ret; -} - -# -# Outputs the overview tree -# -sub output_tree_template { - my $tree = &build_tree(); - &output_template(TREE_TMPL, 'overview-tree.html', { - classtrees => $tree, - project_name => $OPTIONS{PROJECT_NAME}, - page_footer => $OPTIONS{PAGE_FOOTER}, - ctime => $TIME }, 1); -} - -# -# Formats additional non-standard attributes for methods according to user -# configuration -# -sub format_method_attributes { - my ($attrs) = shift; - my $attributes = ''; - while (my ($name, $val) = each %{$attrs}) { - $attributes .= &{$METHOD_ATTRS_MAP{$name}}($val) - if $METHOD_ATTRS_MAP{$name}; - } - $attributes; -} - -# -# Formats additional non-standard attributes for classes according to user -# configuration -# -sub format_class_attributes { - my ($attrs) = shift; - my $attributes; - if ($attrs->{class} && @{ $attrs->{class} }){ - $attributes = sprintf('
      %s
      ', $attrs->{class}[0] || '') - } - while (my ($name, $val) = each %{$attrs}) { - $attributes .= &{$CLASS_ATTRS_MAP{$name}}($val) - if $CLASS_ATTRS_MAP{$name}; - } - $attributes; -} - -# -# Parses the command line options -# -sub parse_cmdline { - $OPTIONS{OUTPUT} = DEFAULT_DEST_DIR; - $OPTIONS{PROJECT_NAME} = ''; - $OPTIONS{COPYRIGHT} = ''; - $OPTIONS{PROJECT_SUMMARY} = ''; - $OPTIONS{LOGO} = ''; - $OPTIONS{GLOBALS_NAME} = 'GLOBALS'; - $OPTIONS{FORMAT} = 'html'; - $OPTIONS{EXTENSIONS} = 'js'; - $OPTIONS{TEMPLATEDIR} = LOCATION; - GetOptions( - 'private|p' => \$OPTIONS{PRIVATE}, - 'directory|d=s' => \$OPTIONS{OUTPUT}, - 'help|h' => \$OPTIONS{HELP}, - 'recursive|r' => \$OPTIONS{RECURSIVE}, - 'page-footer=s' => \$OPTIONS{PAGE_FOOTER}, - 'project-name=s' => \$OPTIONS{PROJECT_NAME}, - 'project-summary=s' => \$OPTIONS{PROJECT_SUMMARY}, - 'logo=s' => \$OPTIONS{LOGO}, - 'globals-name=s' => \$OPTIONS{GLOBALS_NAME}, - 'quiet|q' => \$OPTIONS{QUIET}, - 'no-sources' => \$OPTIONS{NO_SRC}, - 'package-naming' => \$OPTIONS{PACKAGENAMING}, - 'format=s' => \$OPTIONS{FORMAT}, - 'extensions=s' => \$OPTIONS{EXTENSIONS}, - 'no-lexical-privates' => \$OPTIONS{NO_LEXICAL_PRIVATES}, - 'template-dir=s' => \$OPTIONS{TEMPLATEDIR}); - $OPTIONS{OUTPUT} =~ s/([^\/])$/$1\//; -} - -# -# Resolves links for {@link } items -# -sub resolve_inner_links { - my $doc = shift; - $doc =~ s{\{\@link\s+([^\}]+)\}}{&format_link($1)}eg if $doc; - return $doc; -} - - -# -# Formats a {@link } item -# -sub format_link { - my ($link) = shift; - die unless $CURRENT_CLASS; - $link =~ s/^\s*(.*?)\s*$/$1/; - $link =~ s/<[^>]*>//g; - my ($class, $method, $label, $url); - my $class_re = qr/\w+(?:\.\w+)*/; - unless ((($class, $method, $label) = - $link =~ /^($class_re)?#($class_re)\s*(.*)$/) - or (($class, $label) = $link =~ /^($class_re)(?:\s+(.*))?$/)){ - if (($url, $label) = $link =~ /^(https?:\/\/\S+)\s+(.*?)\s*$/){ - return "$label"; - } else { - return $link; - } - } - if ($class){ - unless ($$CLASSES{$class}){ - warn "\@link can't find reference $class\n"; - return $link; - } - } - if (!$method){ - $label = $class unless $label; - qq{$label}; - } else { - my $clss = $CLASSES->{$class || $CURRENT_CLASS}; - my @methods = (@{$clss->{instance_methods}}, - @{$clss->{class_methods}}); - my @fields = (@{$clss->{instance_fields}}, @{$clss->{class_fields}}); - my @statics = (@{$clss->{class_methods}}, @{$clss->{class_fields}}); - my $ismethod = grep { $_->{mapped_name} eq $method } @methods; - my $isfield = grep { $_->{field_name} eq $method } @fields - unless $ismethod; - my $isstatic = grep { - ($_->{field_name} || $_->{mapped_name}) eq $method } @statics; - if ($class){ - $label = "$class.$method" . ($ismethod ? '()' : '') unless $label; - if ($ismethod or $isfield){ - $method = ($isstatic ? "!s!" : "") . $method; - qq{$label}; - } else { - warn "\@link can't find reference $method in $class\n"; - $link; - } - } else { - $label = $method . ($ismethod ? "()" : "") unless $label; - $method = ($isstatic ? "!s!" : "") . $method; - qq{$label}; - } - } -} - - -# -# Initializes the customizable maps for @attributes -# -sub initialize_param_maps { - %CLASS_ATTRS_MAP = ( - author => - sub { - 'Author: ' . - join(', ', @{$_[0]}) . "
      " - }, - deprecated => - sub { - 'Deprecated ' . ($_[0] ? $_[0]->[0] : '') . - "

      "; - }, - see => - sub { - 'See:
        - ' . - join('
        - ', map {&format_link($_)} @{$_[0]}) . "
      " - }, - version => - sub { - 'Version: ' . - join(', ', @{$_[0]}) . '

      ' - }, - requires => - sub { - 'Requires:
        - ' . - join('
        - ', map {&format_link($_)} @{$_[0]}) . "
      " - }, - filename => - sub { - sprintf 'Defined in %s

      ', - sprintf("%s", - mangle($_[0]), $_[0]); - }, - overviewfile => - sub { - my ($content, $fh) = ""; - my $fname = $_[0][0] or return ''; - unless(open $fh, "$fname"){ - warn "Can't open overview file '$fname' : $!\n"; - return ''; - } - { local $/ = undef; $content .= <$fh> } - close $fh or warn "Couldn't close overview file '$fname'\n"; - # Crude manner to strip out extra HTML - $content =~ s/(.*)<\/body>/$1/si; - "$content
      "; - } - ); - - %METHOD_ATTRS_MAP = ( - throws => - sub { - "Throws:
        - " . - join("
        - ", @{$_[0]}) . "
      " - }, - ); - $METHOD_ATTRS_MAP{exception} = $METHOD_ATTRS_MAP{throws}; - $METHOD_ATTRS_MAP{$_} = $CLASS_ATTRS_MAP{$_} for qw(author version - deprecated see requires); - $FILE_ATTRS_MAP{$_} = $CLASS_ATTRS_MAP{$_} for qw(author version - see requires); -} - -# -# Parse the @param or @argument values into name/value pairs and -# return the list of them -# -sub fetch_args { - my ($vars, $arg_list_ref) = @_; - return unless $vars and $$arg_list_ref; - my (@args, %used); - for my $arg (split /\W+(?{param}}){ - my ($type, $link, $name, $value) = - /(?: - \{\s* - (\S+) # type name - (?:\s+(\S+)\s*)? # optional link - \})? - \s* - (\$?\w+) # parameter name - (.*) # description - /x; - next unless $name eq $arg; - $used{$name} = 1; - $type ||= ''; - if ($$CLASSES{$type} || $link){ - $link ||= "$type.html"; - $type = qq|$type| ; - } - my $type_regex = qr{\Q$arg\E\b}; - $$arg_list_ref =~ s/(? $name, vardescrip => $value}; - } - } - for (@{$vars->{param}}){ - my ($type, $link, $name, $value) - = /(?:\{\s*(\S+)(?:\s+(\S+)\s*)?\})?\s*(\$?\w+)(.*)/; - next if $used{$name}; - push @args, { varname => $name, vardescrip => $value }; - } - @args; -} - -sub resolve_synonyms { - my ($item) = @_; - $item->{param} = $item->{param} || $item->{argument}; - $item->{returns} = $item->{return} || $item->{returns}; - $item->{final} = $item->{final} || $item->{const}; -} - -# -# Log a message to STDOUT if the --quiet switch is not used -# -sub _log { - print $_[0], "\n" unless $OPTIONS{QUIET}; -} - -# -# Takes a vars hash and resolves {@link}s within it -# -sub format_vars { - my ($vars) = @_; - for my $key (keys %$vars){ - if (ref($vars->{$key}) eq 'ARRAY'){ - for (0..$#{$vars->{$key}}){ - $vars->{$key}->[$_] = &resolve_inner_links($vars->{$key}->[$_]); - } - } else { - $vars->{$key} = &resolve_inner_links($vars->{$key}); - } - } -} - diff --git a/modules/jala/util/HopKit/JSDoc/templates/allclasses-frame.tmpl b/modules/jala/util/HopKit/JSDoc/templates/allclasses-frame.tmpl deleted file mode 100644 index e2a4ce31..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/allclasses-frame.tmpl +++ /dev/null @@ -1,37 +0,0 @@ - - - - - -<TMPL_VAR NAME="project_name"> <TMPL_VAR NAME="filename"> - - - - - - - "/> - -

      - - -
      - - - - - - - - -
      .html" TARGET="classFrame"> -
      -
      - - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/allclasses-noframe.tmpl b/modules/jala/util/HopKit/JSDoc/templates/allclasses-noframe.tmpl deleted file mode 100644 index 6da363c1..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/allclasses-noframe.tmpl +++ /dev/null @@ -1,36 +0,0 @@ - - - - -<TMPL_VAR NAME="project_name"> All Classes - - - - - - - "/> - -

      - -All Classes -
      - - - - - - - - -
      .html" > -
      -
      - - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/constant-values.tmpl b/modules/jala/util/HopKit/JSDoc/templates/constant-values.tmpl deleted file mode 100644 index fb4307c4..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/constant-values.tmpl +++ /dev/null @@ -1,151 +0,0 @@ - - - - -<TMPL_VAR NAME="project_name"> Constant Values - - - - - - - - - - - - - - - - - - -
      - - -
      - - -
      -

      Constant Field Values

      -
      -
        - -
      • ">
      • -
        -
      - -
      - - - "> - - - - - - - - - - - -
      - .html"> -
      .html#">
      -

      - -

      - - -


      - - - - - - - - - - - - - -
      - - -
      - - -
      - - - -
      Documentation generated by JSDoc on
      - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/help-doc.tmpl b/modules/jala/util/HopKit/JSDoc/templates/help-doc.tmpl deleted file mode 100644 index 5f70ef3c..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/help-doc.tmpl +++ /dev/null @@ -1,160 +0,0 @@ - - - - -<TMPL_VAR NAME="project_name"> API Help - - - - - - - - - - - - - - - - - - -
      - - -
      - - -
      -
      -

      -How This API Document Is Organized

      -
      -This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

      -Class

      -
      - -

      -Each class has its own separate page. Each of these pages has three sections consisting of a class description, summary tables, and detailed member descriptions:

        -
      • Class inheritance diagram
      • Direct Subclasses
      • Class declaration
      • Class description -

        -

      • Field Summary
      • Constructor Summary
      • Method Summary -

        -

      • Field Detail
      • Constructor Detail
      • Method Detail
      -Each summary entry contains the first sentence from the detailed description for that item.
      - - -

      -Index

      -
      -The Index contains an alphabetic list of all classes, constructors, methods, and fields.
      -

      -Prev/Next

      -These links take you to the next or previous class, interface, package, or related page.

      -Frames/No Frames

      -These links show and hide the HTML frames. All pages are available with or without frames. -

      - - -This help file applies to API documentation generated using the standard doclet. - -
      -


      - - - - - - - - - - - - - -
      - - -
      - - -
      - - - -
      Documentation generated by JSDoc on
      - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/index-all.tmpl b/modules/jala/util/HopKit/JSDoc/templates/index-all.tmpl deleted file mode 100644 index 262a1e22..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/index-all.tmpl +++ /dev/null @@ -1,142 +0,0 @@ - - - - - -Index () - - - - - - - - - - - - - - - - - - -
      - - -
      - - - - __"> -
      - - -__">

      -

      - -
      -
      .html#"> - - class .html"> -
        -
      -
      -
      -
      - - __"> - -
      - - - - - - - - - - - - -
      - - -
      - - -
      - - - -
      Documentation generated by JSDoc on
      - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/index.tmpl b/modules/jala/util/HopKit/JSDoc/templates/index.tmpl deleted file mode 100644 index 1899a483..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/index.tmpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - -Generated Javascript Documentation - - - - - - - - - - - -.html" name="classFrame"> - - -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to <A HREF="allclasses-frame.html">Non-frame version.</A> - diff --git a/modules/jala/util/HopKit/JSDoc/templates/main.tmpl b/modules/jala/util/HopKit/JSDoc/templates/main.tmpl deleted file mode 100644 index b89866e3..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/main.tmpl +++ /dev/null @@ -1,448 +0,0 @@ - - - - - -<TMPL_VAR name="classname"> - - - - - - - - - - - - - - - - - - - - - -
      - - -
      - -
      - - -

      Class

      -
      - -
      -
      - Direct Known Subclasses: -
      - -
      -
      -
      - -
      -
      - -
       class - - -
      extends - - -
      - -

      - -

      -
      -
      - - - - - - - - - - - - - - -
      -Nested Class Summary
      - <static class>.html">
      -  -
      - - - - - - - - - - - - - - - - - - - -
      - Field Summary
      - <private> <static>  <final> !s!"> -
      -           
      -   -
      - - - -   - - - - - - - -
      Fields inherited from class .html">
      - -
      -  -
      -
      - - - - - - - - - - - - - - -
      -Constructor Summary
      - - - .html#()"> - - - -
      -             - -
      -
      - - -  - - - - - - - - - - - - - - - - -
      -Method Summary
      - - <static> <private>   - - - - - !s!"> - -
      -            - -
      -
      - - - - - - - - - -
      Methods inherited from class .html">
      - - -
      -  -
      -

      - - - - - - - - - - -
      Field Detail
      - - - !s!
      "> -

      -
      <private> <static> <final>  
      - -
      -
      - - - - - - - - - - - -
      - Constructor Detail -
      - -()">

      -

      -
      - - -
        - -
      -
      - - -
        - Parameters: - -
          - -
        -
        - -
      -
      - - - -
        - Returns: -
          - -
        -
      -
      - - - - -
        - -
      -
      -
      - - - - - - - - - - - - -
      - Method Detail -
      - - - - !s!
      "> -

      -
      <static>  <private>  
      - -
      -
      - - - -
        - Parameters: - -
          - -
        -
        -
      -
      - - - -
        - Returns: -
          - -
        -
      -
      - - - -
        - -
      -
      - -
      - -
      - - - - - - - - - - - - - - - - - - - - -
      - - -
      - - - -
      - - - -
      Documentation generated by JSDoc on
      - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/overview-frame.tmpl b/modules/jala/util/HopKit/JSDoc/templates/overview-frame.tmpl deleted file mode 100644 index 5097ca4c..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/overview-frame.tmpl +++ /dev/null @@ -1,43 +0,0 @@ - - - - -Overview () - - - - - - - "/> - -

      - - - - -
      - - - - - -
      All Classes -

      - -Files -
      - -.html" TARGET="packageFrame">
      -
      -

      - -

      -  - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/overview-summary.tmpl b/modules/jala/util/HopKit/JSDoc/templates/overview-summary.tmpl deleted file mode 100644 index 504c1f76..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/overview-summary.tmpl +++ /dev/null @@ -1,222 +0,0 @@ - - - - -<tmpl_var name="project_name"> Overview - - - - - - - - - - - - - - - - - - -
      - - -
      - - -


      -
      - -

      - -

      JSDoc Documentation

      -
      -
      - - -

      - This document is the API Specification for - . -

      -
      -
      - -

      Summary

      -

      - - - - No summary generated for these documents. - -

      - -
      - - - - - - - - - - - - -
      - - Class Summary - - File Summary - -
      ">
      -
      -
      - - - - - - - - - - - - - - - - -
      - - Method Summary - -
      - - static private   - - - - - #"> - -
      -            - -
      -

      - - - - -

      -
      -
      - - - - - - - - - - - - - - -
      - -
      - - -
      - - - -
      Documentation generated by JSDoc on
      - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/overview-tree.tmpl b/modules/jala/util/HopKit/JSDoc/templates/overview-tree.tmpl deleted file mode 100644 index 47968010..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/overview-tree.tmpl +++ /dev/null @@ -1,121 +0,0 @@ - - - - - -<TMPL_VAR name="project_name"> Class Hierarchy - - - - - - - - - - - - - - - - - - -
      - -
      - - -
      -

      Class Hierarchy

      - - - -
      - - - - - - - - - - - - - -
      - -
      - - -
      - - - -
      Documentation generated by JSDoc on
      - - diff --git a/modules/jala/util/HopKit/JSDoc/templates/stylesheet.css b/modules/jala/util/HopKit/JSDoc/templates/stylesheet.css deleted file mode 100644 index 7a35c0c1..00000000 --- a/modules/jala/util/HopKit/JSDoc/templates/stylesheet.css +++ /dev/null @@ -1,39 +0,0 @@ -/* JSDoc style sheet */ - -/* Define colors, fonts and other style attributes here to override the defaults */ - -/* Page background color */ -body { background-color: #FFFFFF } - -/* Table colors */ -.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ -.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ -.TableRowColor { background: #FFFFFF } /* White */ - -/* Font used in left-hand frame lists */ -.FrameTitleFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } -.FrameHeadingFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } -.FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } - -/* Example of smaller, sans-serif font in frames */ -/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */ - -/* Navigation bar fonts and colors */ -.NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */ -.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */ -.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} -.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} - -.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} -.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} - -.jsdoc_ctime { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; - text-align: right } - -/* Sourcecode view */ -.sourceview { background: #FFFFFF } -.attrib { color: #DD7777 } -.comment { color: #55AA55 } -.reserved { color: #FF5555 } -.literal { color: #5555FF } - diff --git a/modules/jala/util/HopKit/JSDoc/test.js b/modules/jala/util/HopKit/JSDoc/test.js deleted file mode 100644 index 72e3fde5..00000000 --- a/modules/jala/util/HopKit/JSDoc/test.js +++ /dev/null @@ -1,505 +0,0 @@ -/** - * @fileoverview This file is to be used for testing the JSDoc parser - * It is not intended to be an example of good JavaScript OO-programming, - * nor is it intended to fulfill any specific purpose apart from - * demonstrating the functionality of the - * {@link http://sourceforge.net/projects/jsdoc JSDoc} parser - * - * @author Gabriel Reid gab_reid@users.sourceforge.net - * @version 0.1 - */ - - -/** - * Construct a new Shape object. - * @class This is the basic Shape class. - * It can be considered an abstract class, even though no such thing - * really existing in JavaScript - * @constructor - * @throws MemoryException if there is no more memory - * @throws GeneralShapeException rarely (if ever) - * @return A new shape - */ -function Shape(){ - - /** - * This is an example of a function that is not given as a property - * of a prototype, but instead it is assigned within a constructor. - * For inner functions like this to be picked up by the parser, the - * function that acts as a constructor must be denoted with - * the @constructor tag in its comment. - * @type String - */ - this.getClassName = function(){ - return "Shape"; - } - - /** - * This is a private method, just used here as an example - */ - function addReference(){ - // Do nothing... - } - -} - -/** - * Create a new Hexagon instance. - * @extends Shape - * @class Hexagon is a class that is a logical sublcass of - * {@link Shape} (thanks to the @extends tag), but in - * reality it is completely unrelated to Shape. - * @param {int} sideLength The length of one side for the new Hexagon - */ -function Hexagon(sideLength) { -} - - -/** - * This is an unattached (static) function that adds two integers together. - * @param {int} One The first number to add - * @param {int http://jsdoc.sourceforge.net/} Two The second number to add - * @author Gabriel Reid - * @deprecated So you shouldn't use it anymore! - */ -function Add(One, Two){ - return One + Two; -} - - -/** - * The color of this shape - * @type Color - */ -Shape.prototype.color = null; - -/** - * The border of this shape. - * @type int - */ -Shape.prototype.border = null; - -/* - * The assignment of function implementations for Shape, documentation will - * be taken over from the method declaration. - */ - -Shape.prototype.getCoords = Shape_GetCoords; - -Shape.prototype.getColor = Shape_GetColor; - -Shape.prototype.setCoords = Shape_SetCoords; - -Shape.prototype.setColor = Shape_SetColor; - -/* - * These are all the instance method implementations for Shape - */ - -/** - * Get the coordinates of this shape. It is assumed that we're always talking - * about shapes in a 2D location here. - * @requires Shape The shape class - * @returns A Coordinate object representing the location of this Shape - * @type Coordinate - */ -function Shape_GetCoords(){ - return this.coords; -} - -/** - * Get the color of this shape. - * @see #setColor - * @type Color - */ -function Shape_GetColor(){ - return this.color; -} - -/** - * Set the coordinates for this Shape - * @param {Coordinate} coordinates The coordinates to set for this Shape - */ -function Shape_SetCoords(coordinates){ - this.coords = coordinates; -} - -/** - * Set the color for this Shape - * @param {Color} color The color to set for this Shape - * @param other There is no other param, but it can still be documented if - * optional parameters are used - * @throws NonExistantColorException (no, not really!) - * @see #getColor - */ -function Shape_SetColor(color){ - this.color = color; -} - -/** - * Clone this shape - * @returns A copy of this shape - * @type Shape - * @author Gabriel Reid - */ -Shape.prototype.clone = function(){ - return new Shape(); -} - -/** - * Create a new Rectangle instance. - * @class A basic rectangle class, inherits from Shape. - * This class could be considered a concrete implementation class - * @constructor - * @param {int} width The optional width for this Rectangle - * @param {int} height Thie optional height for this Rectangle - * @author Gabriel Reid - * @see Shape Shape is the base class for this - */ -function Rectangle(width, // This is the width - height // This is the height - ){ - if (width){ - this.width = width; - if (height){ - this.height = height; - } - } -} - - -/* Inherit from Shape */ -Rectangle.prototype = new Shape(); - -/** - * Value to represent the width of the Rectangle. - *
      Text in bold and italic and a - * link to SourceForge - * @private - * @type int - */ -Rectangle.prototype.width = 0; - -/** - * Value to represent the height of the Rectangle - * @private - * @type int - */ -Rectangle.prototype.height = 0; - -/** - * Get the type of this object. - * @type String - */ -Rectangle.prototype.getClassName= function(){ - return "Rectangle"; -} - -/* - * These are all the instance method implementations for Rectangle - */ - -Rectangle.prototype.getWidth = Rectangle_GetWidth; - -Rectangle.prototype.getHeight = Rectangle_GetHeight; - -Rectangle.prototype.setWidth = Rectangle_SetWidth; - -Rectangle.prototype.setHeight = Rectangle_SetHeight; - -Rectangle.prototype.getArea = Rectangle_GetArea; - - -/** - * Get the value of the width for the Rectangle - * @type int - * @see #setWidth - */ -function Rectangle_GetWidth(){ - return this.width; -} - -/** - * Get the value of the height for the Rectangle. - * Another getter is the {@link Shape#getColor} method in the - * {@link Shape base Shape class}. - * @return The height of this Rectangle - * @type int - * @see #setHeight - */ -function Rectangle_GetHeight(){ - return this.height; -} - -/** - * Set the width value for this Rectangle. - * @param {int} width The width value to be set - * @see #getWidth - */ -function Rectangle_SetWidth(width){ - this.width = width; -} - -/** - * Set the height value for this Rectangle. - * @param {int} height The height value to be set - * @see #getHeight - */ -function Rectangle_SetHeight(height){ - this.height = height; -} - -/** - * Get the value for the total area of this Rectangle - * @return total area of this Rectangle - * @type int - */ -function Rectangle_GetArea(){ - return width * height; -} - - -/** - * Create a new Square instance. - * @class A Square is a subclass of {@link Rectangle} - * @param {int} width The optional width for this Rectangle - * @param {int} height The optional height for this Rectangle - */ -function Square(width, height){ - if (width){ - this.width = width; - if (height){ - this.height = height; - } - } - -} - -/* Square is a subclass of Rectangle */ -Square.prototype = new Rectangle(); - - -/* - * The assignment of function implementation for Shape. - */ -Square.prototype.setWidth = Square_SetWidth; - -Square.prototype.setHeight = Square_SetHeight; - - - -/** - * Set the width value for this Square. - * @param {int} width The width value to be set - * @see #getWidth - */ -function Square_SetWidth(width){ - this.width = this.height = width; -} - -/** - * Set the height value for this Square - * Sets the {@link Rectangle#height height} attribute in the Rectangle. - * @param {int} height The height value to be set - */ -function Square_SetHeight(height){ - this.height = this.width = height; -} - - -/** - * Create a new Circle instance based on a radius. - * @class Circle class is another subclass of Shape - * @param {int} radius The optional radius of this Circle - */ -function Circle(radius){ - if (radius){ - this.radius = radius; - } -} - -/* Circle inherits from Shape */ -Circle.prototype = new Shape(); - -/** - * The radius value for this Circle - * @private - * @type int - */ -Circle.prototype.radius = 0; - -/** - * A very simple class (static) field that is also a constant - * @final - * @type float - */ -Circle.PI = 3.14; - -Circle.createCircle = Circle_CreateCircle; - -Circle.prototype.getRadius = Circle_GetRadius; - -Circle.prototype.setRadius = Circle_SetRadius; - -/** - * Get the radius value for this Circle - * @type int - * @see #setRadius - */ -function Circle_GetRadius(){ - return this.radius; -} - -/** - * Set the radius value for this Circle - * @param {int} radius The radius value to set - * @see #getRadius - */ -function Circle_SetRadius(radius){ - this.radius = radius; -} - -/** - * An example of a class (static) method that acts as a factory for Circle - * objects. Given a radius value, this method creates a new Circle. - * @param {int} radius The radius value to use for the new Circle. - * @type Circle - */ -function Circle_CreateCircle(radius){ - return new Circle(radius); -} - - -/** - * Create a new Coordinate instance based on x and y grid data. - * @class Coordinate is a class that can encapsulate location information. - * @param {int} x The optional x portion of the Coordinate - * @param {int} y The optinal y portion of the Coordinate - */ -function Coordinate(x, y){ - if (x){ - this.x = x; - if (y){ - this.y = y; - } - } -} - -/** - * The x portion of the Coordinate - * @type int - * @see #getX - * @see #setX - */ -Coordinate.prototype.x = 0; - -/** - * The y portion of the Coordinate - * @type int - * @see #getY - * @see #setY - */ -Coordinate.prototype.y = 0; - -Coordinate.prototype.getX = Coordinate_GetX; -Coordinate.prototype.getY = Coordinate_GetY; -Coordinate.prototype.setX = Coordinate_SetX; -Coordinate.prototype.setY = Coordinate_SetY; - -/** - * Gets the x portion of the Coordinate. - * @type int - * @see #setX - */ -function Coordinate_GetX(){ - return this.x; -} - -/** - * Get the y portion of the Coordinate. - * @type int - * @see #setY - */ -function Coordinate_GetY(){ - return this.y; -} - -/** - * Sets the x portion of the Coordinate. - * @param {int} x The x value to set - * @see #getX - */ -function Coordinate_SetX(x){ - this.x = x; -} - -/** - * Sets the y portion of the Coordinate. - * @param {int} y The y value to set - * @see #getY - */ -function Coordinate_SetY(y){ - this.y = y; -} - -/** - * @class This class exists to demonstrate the assignment of a class prototype - * as an anonymous block. - */ -function ShapeFactory(){ -} - -ShapeFactory.prototype = { - /** - * Creates a new {@link Shape} instance. - * @return A new {@link Shape} - * @type Shape - */ - createShape: function(){ - return new Shape(); - } -} - -/** - * An example of a singleton class - */ -MySingletonShapeFactory = new function(){ - - /** - * Get the next {@link Shape} - * @type Shape - * @return A new {@link Shape} - */ - this.getShape = function(){ - return null; - } - -} - - -/** - * Create a new Foo instance. - * @class This is the Foo class. It exists to demonstrate 'nested' classes. - * @constructor - * @see Foo.Bar - */ -function Foo(){} - -/** - * Creates a new instance of Bar. - * @class This class exists to demonstrate 'nested' classes. - * @constructor - * @see Foo.Bar - */ -function Bar(){} - -/** - * Nested class - * @constructor - */ -Foo.Bar = function(){this.x = 2;} - -Foo.Bar.prototype = new Bar(); - -Foo.Bar.prototype.y = '3'; - diff --git a/modules/jala/util/HopKit/build.bat b/modules/jala/util/HopKit/build.bat deleted file mode 100755 index 886c2ba2..00000000 --- a/modules/jala/util/HopKit/build.bat +++ /dev/null @@ -1,69 +0,0 @@ -:: -:: Jala Project [http://opensvn.csie.org/traccgi/jala] -:: -:: Copyright 2004 ORF Online und Teletext GmbH -:: -:: Licensed under the Apache License, Version 2.0 (the ``License''); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an ``AS IS'' BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -:: -:: $Revision$ -:: $LastChangedBy$ -:: $LastChangedDate$ -:: $HeadURL$ -:: - - -@echo off - -rem This is build.bat for Ant 1.7 - -rem Define the path to the ANT binary directory -rem (traling slash is mandatory!) -rem set ANT_HOME=%PROGRAMFILES%\Apache Group\apache-ant-1.7.0\bin\ - -rem Set this to the directory of your Helma installation if necessary -set HELMA_HOME="" - -rem ========================================================================== -rem No need to edit anything past here - -rem store path of this script as BUILD_HOME -set BUILD_HOME=%~dp0 - -rem Set this to the directory of your Helma installation -if "%HELMA_HOME%"=="""" set HELMA_HOME="%BUILD_HOME%/../../../.." - -rem Slurp the command line arguments. This loop allows for an unlimited number -rem of arguments (up to the command line limit, anyway). -set ANT_CMD_LINE_ARGS=%1 -if ""%1""=="""" goto runAnt -shift -:setupArgs -if ""%1""=="""" goto runAnt -if ""%1""==""-noclasspath"" goto runAnt -set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 -shift -goto setupArgs - -:runAnt - -rem ---- if there is no build.xml in the working directory, use the library -rem ---- in this directory -if not exist ".\build.xml" ( - set ANT_CMD_LINE_ARGS=-file "%BUILD_HOME%lib.xml" %ANT_CMD_LINE_ARGS% -) - -echo BUILD_HOME: %BUILD_HOME% - -ant -Dant.home=. -Dbasedir=. -lib "%BUILD_HOME%\lib;%HELMA_HOME%\lib" -propertyfile "%CD%\build.properties" %ANT_CMD_LINE_ARGS% - -:end diff --git a/modules/jala/util/HopKit/build.gradle b/modules/jala/util/HopKit/build.gradle deleted file mode 100644 index f8c9778e..00000000 --- a/modules/jala/util/HopKit/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -dependencies { - // FIXME: Seems to be not used, anymore…? - runtimeOnly 'bsf:bsf:2.4.0' -} - -jar.enabled = false -compileJava.enabled = false -compileTestJava.enabled = false -processResources.enabled = false -processTestResources.enabled = false -test.enabled = false - -tasks.register('deps', Copy) { - from sourceSets.main.runtimeClasspath - into 'lib' -} diff --git a/modules/jala/util/HopKit/build.sh b/modules/jala/util/HopKit/build.sh deleted file mode 100755 index 691439c6..00000000 --- a/modules/jala/util/HopKit/build.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -## -## Jala Project [http://opensvn.csie.org/traccgi/jala] -## -## Copyright 2004 ORF Online und Teletext GmbH -## -## Licensed under the Apache License, Version 2.0 (the ``License''); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an ``AS IS'' BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## -## $Revision: 3 $ -## $LastChangedBy: tobi $ -## $LastChangedDate: 2007-01-19 14:33:08 +0100 (Fri, 19 Jan 2007) $ -## $HeadURL: https://robert@opensvn.csie.org/jala/trunk/util/HopKit/build.bat $ -## - -# Uncomment and set this to the directory of your Helma installation -# if you installed jala in a different subdirectory than "modules/jala" -# HELMA_HOME="path/to/helma/installation" - -#-------------------------------------------- -# No need to change anything below -# buildfile for ant 1.7.0 -#-------------------------------------------- -if test -z "${ANT_HOME}" ; then - echo "ERROR: ANT_HOME not found in your environment." - echo "Please, set the ANT_HOME variable in your environment to match the" - echo "location of the Apache Ant installation you want to use." - exit -fi - -#---- store path of this script as BUILD_HOME -BUILD_HOME=$(dirname $0) -if [ "${BUILD_HOME:0:1}" != "/" ] ; then - # convert to absolute path - BUILD_HOME=${PWD}/${BUILD_HOME} -fi -export BUILD_HOME - -#---- store HELMA_HOME if not defined above -if [ -z "$HELMA_HOME" ] ; then - HELMA_HOME=$BUILD_HOME/../../../.. -fi - -#---- Slurp the command line arguments. -while [ $# -ne 0 ] -do - ANT_CMD_LINE_ARGS="${ANT_CMD_LINE_ARGS} $1" - shift -done - -#---- if there is no build.xml in the working directory, use the lib.xml -#---- in this directory -if test ! -f ${PWD}/build.xml ; then - BUILD_XML="${BUILD_HOME}/lib.xml" -else - BUILD_XML="${PWD}/build.xml" -fi - -${ANT_HOME}/bin/ant -Dant.home="${BUILD_HOME}" -Dbasedir="${PWD}" -lib "${BUILD_HOME}/lib:${HELMA_HOME}/lib" -propertyfile "${PWD}/build.properties" -file $BUILD_XML ${ANT_CMD_LINE_ARGS} - -exit diff --git a/modules/jala/util/HopKit/js.bat b/modules/jala/util/HopKit/js.bat deleted file mode 100755 index b9c5fa64..00000000 --- a/modules/jala/util/HopKit/js.bat +++ /dev/null @@ -1,107 +0,0 @@ -:: -:: Jala Project [http://opensvn.csie.org/traccgi/jala] -:: -:: Copyright 2004 ORF Online und Teletext GmbH -:: -:: Licensed under the Apache License, Version 2.0 (the ``License''); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an ``AS IS'' BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -:: -:: $Revision$ -:: $LastChangedBy$ -:: $LastChangedDate$ -:: $HeadURL$ -:: - - -@echo off - -set HOPKIT=%~dp0 - -set JAVA=java -set JSJAR="%HOPKIT%\lib\js.jar" -set JSTOOLS=org.mozilla.javascript.tools - -goto %1 - - -rem -- S H E L L -- -:shell - -if "%2"=="" ( - %JAVA% -cp "%JSJAR%" "%JSTOOLS%.shell.Main" -) else ( - %JAVA% -cp "%JSJAR%" "%JSTOOLS%.shell.Main" "%2" -) - -goto end - - -rem -- T E S T -- -:test - - -rem -- C O M P I L E -- -:compile - -%JAVA% -cp "%JSJAR%" "%JSTOOLS%.jsc.Main" -nosource "%2" - -goto end - - -rem -- L I N T -- -:lint - -%JAVA% -cp "%JSJAR%" "%JSTOOLS%.shell.Main jslint.js" "%2" - -goto end - - -rem -- D O C S -- -:docs - -if "%3"=="" ( - set DOCDIR=docs -) else ( - set DOCDIR=%3 -) - -"%HOPKIT%\JSDoc\jsdoc.pl" -q -r -d "%DOCDIR%" --template-dir "%HOPKIT%/JSDoc/templates" --package-naming --globals-name Global --project-name "%2" --project-summary "./.jsdoc/summary.html" . - -goto end - - -rem -- M I N I F Y -- -:minify - -"%HOPKIT%\jsmin" "%2" - - -rem -- P A C K -- -:pack - - -rem -- H E L P -- -:help - -echo Currently the following build targets are supported: -echo docs - Create JSDoc API documentation. -echo help - Output this information. -echo compile - Compile a JavaScript file as Java class. -echo lint - Apply JavaScript Lint to a file. -echo minify - Minify JavaScript source files. -rem echo pack - Pack and obsfucate JavaScript source files. -echo shell - Start Rhino's interactive JavaScript shell. -echo test - Apply unit tests to JavaScript code. - - -rem -- E N D -- -:end diff --git a/modules/jala/util/HopKit/lib.xml b/modules/jala/util/HopKit/lib.xml deleted file mode 100644 index 99a166af..00000000 --- a/modules/jala/util/HopKit/lib.xml +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - validate failed: error(s) in javascript code. - - - - diff --git a/modules/jala/util/HopKit/lib/bsf-2.4.0.jar b/modules/jala/util/HopKit/lib/bsf-2.4.0.jar deleted file mode 100644 index 2288c36e..00000000 Binary files a/modules/jala/util/HopKit/lib/bsf-2.4.0.jar and /dev/null differ diff --git a/modules/jala/util/HopKit/scripts/MessageParser.js b/modules/jala/util/HopKit/scripts/MessageParser.js deleted file mode 100644 index 06e1a34c..00000000 --- a/modules/jala/util/HopKit/scripts/MessageParser.js +++ /dev/null @@ -1,478 +0,0 @@ -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH. -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @fileoverview - * MessageParser script that extracts all gettext message macros - * out of skin files and all calls of gettext functions - * (that is "gettext", "ngettext" and "_") out of function - * files and directly generates a .pot file from it. - * If an argument "-o" is given and it is followed by - * a path to a file, the output is written to this file. - * Any other argument is interpreted as directory or file - * that should be parsed. - */ - - -/** - * @constructor - */ -var Message = function(id, pluralId) { - this.id = id && String(id); - this.pluralId = pluralId && String(pluralId); - this.locations = []; - return this; -}; - -/** - * Static method that constructs a message key by - * which a message can be identified in the messages map. - * @param {String} id The message Id - * @param {String} pluralId The plural message Id - * @returns The generated message key - * @type String - */ -Message.getKey = function(id, pluralId) { - if (id && pluralId) { - return id + pluralId; - } else { - return id; - } -}; - -/** - * Encloses the string passed as argument in quotes - * and wraps the string if it is longer than 80 characters. - * @param {String} str The string to format - * @param {Boolean} wrap If true the message string will be splitted in - * parts where each one is max. 80 characters long - * @returns The formatted string. - * @type String - */ -Message.formatId = function(str, wrap) { - var escapeQuotes = function(s) { - return s.replace(/(^|[^\\])"/g, '$1\\"'); - }; - - var len = 80; - var buf = new java.lang.StringBuffer(); - if (wrap == true && str.length > len) { - buf.append('""\n'); - var offset = 0; - while (offset < str.length) { - buf.append('"'); - buf.append(escapeQuotes(str.substring(offset, offset += len))); - buf.append('"'); - buf.append("\n"); - } - return buf.toString(); - } else { - buf.append('"'); - buf.append(escapeQuotes(str)); - buf.append('"\n'); - } - return buf.toString(); -}; - -/** - * Adds a new location to this Message instance. - * @param {String} filePath The path to the file this message - * is located in. - * @param {Number} lineNum The line number at which this message - * was found at - */ -Message.prototype.addLocation = function(filePath, lineNum) { - const basePath = java.nio.file.Paths.get(java.io.File(app.dir).getCanonicalPath()); - const locationPath = java.nio.file.Paths.get(filePath); - const relativePath = basePath.relativize(locationPath); - this.locations.push(relativePath + ":" + lineNum); -}; - -/** - * Writes this Message instance as .po compatible string to - * the StringBuffer passed as argument. - * @param {java.lang.StringBuffer} buf The StringBuffer instance - * to write into - */ -Message.prototype.write = function(buf) { - for (var i=0;i -1 - || (this.pluralId != null && this.pluralId.indexOf("{") > -1)) { - buf.append("#, java-format\n"); - } - buf.append('msgid '); - buf.append(Message.formatId(this.id)); - if (this.pluralId != null) { - buf.append('msgid_plural '); - buf.append(Message.formatId(this.pluralId)); - buf.append('msgstr[0] ""\nmsgstr[1] ""\n') - } else { - buf.append('msgstr ""\n') - } - buf.append("\n"); - return; -}; - -/** - * @constructor - */ -var MessageParser = function() { - this.messages = {}; - return this; -}; - -/** - * Object containing the accepted function names, currently - * supported are "gettext", "ngettext" and "_". This is used - * as a lookup map during function file parsing. - * @type Object - */ -MessageParser.FUNCTION_NAMES = { - "_": true, - "gettext": true, - "ngettext": true, - "markgettext": true, - "cgettext": true -}; - -/** - * The name of the gettext macro - * @type String - */ -MessageParser.MACRO_NAME = "message"; - -/** - * The name of the macro attribute that will be interpreted - * as gettext attribute. - * @type String - */ -MessageParser.ATTRIBUTE_NAME = MessageParser.MACRO_NAME; - -/** - * A regular expression for parsing macros in a skin. The result - * of this regular expression contains: - * result[1] = macro handler name (can be empty for global macros) - * result[2] = macro name - * result[3] = the macro's attributes - * @type RegExp - */ -MessageParser.REGEX_MACRO = /<%\s*(?:([\w]+)\.)?([\w]+)\s+([^%]+?)\s*%>/gm; - -/** - * A regular expression for parsing the attributes of a macro. The result - * of this regular expression contains: - * result[1] = attribute name - * result[2] = attribute value - * @type RegExp - */ -MessageParser.REGEX_PARAM = /([\w]*)\s*=\s*["'](.*?)["']\s*(?=\w+=|$)/gm; - -/** - * Calculates the line number in the string passed as argument - * at which the specified index position is located. - * @param {String} str The source string - * @param {Number} idx The index position to get the line number for. - * @returns The line number of the index position in the source string. - * @type Number - */ -MessageParser.getLineNum = function(str, idx) { - return str.substring(0, idx).split(/.*(?:\r\n|\n\r|\r|\n)/).length; -}; - -/** - * Parses the file passed as argument. If the file - * is a directory, this method recurses down the directory - * tree and parses all skin and function files. - * @param {java.io.File} file The file or directory to start at. - * @param {String} encoding The encoding to use - */ -MessageParser.prototype.parse = function(file, encoding) { - if (file.isDirectory()) { - var list = file.list(); - for (var i=0;i -1) { - switch (String(fName.substring(dotIdx+1))) { - case "skin": - print("Parsing skin file " + file.getCanonicalPath() + "..."); - this.parseSkinFile(file, encoding); - break; - case "hac": - case "js": - print("Parsing function file " + file.getCanonicalPath() + "..."); - this.parseFunctionFile(file, encoding); - break; - default: - break; - } - } - } - return; -}; - -/** @ignore */ -MessageParser.prototype.toString = function() { - return "[Jala Message Parser]"; -}; - -/** - * Parses a .js file and creates Message instances for all - * calls of "gettext", "ngettext", "markgettext" and "_". - * @param {java.io.File} file The function file to parse - * @param {String} encoding The encoding to use - */ -MessageParser.prototype.parseFunctionFile = function(file, encoding) { - var fis = new java.io.FileInputStream(file); - var isr = new java.io.InputStreamReader(fis, encoding || "UTF-8"); - var reader = new java.io.BufferedReader(isr); - var tokenizer = new java.io.StreamTokenizer(reader); - var messages = [], stack = []; - var c; - while ((c = tokenizer.nextToken()) != java.io.StreamTokenizer.TT_EOF) { - switch (c) { - case java.io.StreamTokenizer.TT_WORD: - if (MessageParser.FUNCTION_NAMES[tokenizer.sval] == true) { - stack.push({name: tokenizer.sval, lineNr: tokenizer.lineno()}); - } else if (stack.length > 0) { - // it's something else than a string argument inside a gettext method call - // so finalize the argument parsing here as we aren't interested in that - messages.push(stack.pop()); - } - break; - case java.io.StreamTokenizer.TT_NUMBER: - break; - default: - if (stack.length > 0) { - if ("\u0028".charCodeAt(0) == c) { - // start of arguments (an opening bracket) - stack[stack.length-1].args = []; - } else if ("\u0029".charCodeAt(0) == c) { - // end of arguments (a closing bracket) - messages.push(stack.pop()); - } else if ("\u0022".charCodeAt(0) == c || "\u0027".charCodeAt(0) == c) { - // a quoted string argument - stack[stack.length-1].args.push(tokenizer.sval); - } - } - break; - } - } - if (messages.length > 0) { - var msgParam, key, msg; - for (var i=0;i 0) { - if (msgParam.name === "cgettext" || msgParam.name === "markgettext") { - msgParam.args[0] = cgettext.getKey(msgParam.args[0], msgParam.args[1]); - delete msgParam.args[1]; - } - key = Message.getKey(msgParam.args[0]); - if (!(msg = this.messages[key])) { - this.messages[key] = msg = new Message(msgParam.args[0], msgParam.args[1]); - } - if (!msg.pluralId && msgParam.args.length > 1) { - msg.pluralId = msgParam.args[1]; - } - msg.addLocation(file.getCanonicalPath(), msgParam.lineNr); - } - } - } - fis.close(); - isr.close(); - reader.close(); - return; -}; - -/** - * Parses a skin file and creates Message instances for - * all macros which name is either "message" or - * that have attributes named "message" and optional - * "plural" - * @param {java.io.File} file The skin file to parse - * @param {String} encoding The encoding to use - */ -MessageParser.prototype.parseSkinFile = function(file, encoding) { - var self = this; - var source = readFile(file.getAbsolutePath(), encoding || "UTF-8"); - - var checkNestedMacros = function(iterator) { - var macros = []; - while (iterator.hasNext()) { - macro = iterator.next(); - if (macro && macro.constructor !== String) { - macros.push(macro); - } - } - processMacros(macros); - } - - var processMacros = function(macros) { - var re = gettext_macro.REGEX; - var id, pluralId, name, args, param, key, msg; - for (let macro of macros) { - id = pluralId = null; - name = macro.getName(); - param = macro.getNamedParams(); - if (param) { - checkNestedMacros(param.values().iterator()); - if (name === MessageParser.MACRO_NAME) { - id = param.get("text"); - pluralId = param.get("plural"); - } else if (param.containsKey("message") === MessageParser.ATTRIBUTE_NAME) { - id = param.get("message"); - pluralId = param.get("plural"); - } - } - args = macro.getPositionalParams(); - if (args) { - checkNestedMacros(args.iterator()); - if (name === "gettext" || name === "markgettext") { - id = cgettext.getKey(args.get(0), param && param.get("context")); - } else if (name === "ngettext") { - id = args.get(0); - pluralId = args.get(1); - } - } - if (id != null) { - if (id.constructor !== String) { - continue; - } - // create new Message instance or update the existing one - id = id.replace(re, String.SPACE); - pluralId && (pluralId = pluralId.replace(re, String.SPACE)); - key = Message.getKey(id); - if (!(msg = self.messages[key])) { - self.messages[key] = msg = new Message(id, pluralId, file.getCanonicalPath()); - } - msg.addLocation(file.getCanonicalPath(), MessageParser.getLineNum(source, macro.start)); - } - } - } - - var skin = createSkin(source); - if (skin.hasMainskin()) { - processMacros(skin.getMacros()); - } - for (let name of skin.getSubskinNames()) { - var subskin = skin.getSubskin(name); - processMacros(subskin.getMacros()); - } - return; -} - -/** - * Prints a standard Header of a .po file - * FIXME: Allow custom header (template?) - * FIXME: why the hell is Plural-Forms ignored in poEdit? - * @see http://drupal.org/node/17564 - */ -MessageParser.prototype.getPotString = function() { - var date = new Date; - var buf = new java.lang.StringBuffer(); - buf.append('#\n'); - buf.append('# The Antville Project\n'); - buf.append('# http://code.google.com/p/antville\n'); - buf.append('#\n'); - buf.append('# Copyright 2001-' + date.getFullYear() + ' by the Workers of Antville.\n'); - buf.append('#\n'); - buf.append("# Licensed under the Apache License, Version 2.0 (the ``License''\n"); - buf.append('# you may not use this file except in compliance with the License.\n'); - buf.append('# You may obtain a copy of the License at\n'); - buf.append('#\n'); - buf.append('# http://www.apache.org/licenses/LICENSE-2.0\n'); - buf.append('#\n'); - buf.append('# Unless required by applicable law or agreed to in writing, software\n'); - buf.append("# distributed under the License is distributed on an ``AS IS'' BASIS,\n"); - buf.append('# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'); - buf.append('# See the License for the specific language governing permissions and\n'); - buf.append('# limitations under the License.\n'); - buf.append('#\n\n'); - buf.append('#, fuzzy\n'); - buf.append('msgid ""\n'); - buf.append('msgstr ""\n'); - buf.append('"Project-Id-Version: Antville-' + Root.VERSION + '\\n"\n'); - buf.append('"Report-Msgid-Bugs-To: mail@antville.org\\n"\n'); - var sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mmZ"); - buf.append('"POT-Creation-Date: ' + sdf.format(new java.util.Date()) + '\\n"\n'); - buf.append('"PO-Revision-Date: ' + sdf.format(new java.util.Date()) + '\\n"\n'); - //buf.append('"Last-Translator: FULL NAME \\n"\n'); - buf.append('"Language-Team: The Antville People \\n"\n'); - buf.append('"MIME-Version: 1.0\\n"\n'); - buf.append('"Content-Type: text/plain; charset=utf-8\\n"\n'); - buf.append('"Content-Transfer-Encoding: 8bit\\n"\n'); - buf.append('"Plural-Forms: nplurals=2; plural=(n != 1);\\n"\n'); - buf.append('\n'); - - // sort all messages by their singular key - var keys = []; - for (var i in this.messages) { - keys[keys.length] = this.messages[i].id; - } - keys.sort(); - // add all the messages - for (var i=0;ijava -cp rhino.jar org.mozilla.javascript.tools.shell.Main PoParser.js [namespace] - * - * The accepted arguments are: - *
        - *
      • input: Either a single .po file or a directory containing multiple files
      • - *
      • output: The directory where to put the generated message files
      • - *
      • namespace: An optional namespace in which the generated message object will reside - * (eg. if the namespace is called "jala", the messages will be stored in global.jala.messages)
      • - *
      - */ - - -/** - * Constructs a new PoParser instance. - * @class Instances of this class can generate JavaScript message files out - * of GNU Gettext .po files for use with jala.I18n (and possibly other internationalization - * environments too). - * @param {String} handler An optional namespace where the parsed messages should be stored - * @returns A newly created instance of PoParser - * @constructor - */ -var PoParser = function(namespace) { - /** - * An array containing the parsed messages - * @type Array - */ - this.messages = []; - - /** - * The locale key string (eg. "de_AT") of the .po file - * @type String - */ - this.localeKey = null; - - /** - * The namespace (optional) where to store the generated messages - * @type String - */ - this.namespace = namespace; - return this; -}; - -/** - * A regular expression for splitting the contents of a .po file into - * single lines - * @type RegExp - */ -PoParser.REGEX_LINES = /\r\n|\r|\n|\u0085|\u2028|\u2029/; - -/** - * A regular expression for parsing singular message keys - * @type RegExp - */ -PoParser.REGEX_MSGID = /^\s*msgid(?!_plural)\s+\"(.*)\"\s*$/; - -/** - * A regular expression for parsing plural message keys - * @type RegExp - */ -PoParser.REGEX_MSGID_PLURAL = /^\s*msgid_plural\s+\"(.*)\"\s*$/; - -/** - * A regular expression for parsing message key continuations - * @type RegExp - */ -PoParser.REGEX_MSG_CONT = /^\s*\"(.*)\"\s*$/; - -/** - * A regular expression for parsing a message translation - * @type RegExp - */ -PoParser.REGEX_MSGSTR = /^\s*msgstr(?:\[(\d)\])?\s+\"(.*)\"\s*$/; - -/** - * A regular expression used to detect lines other than whitespace - * and comments - * @type RegExp - */ -PoParser.REGEX_DATA = /^\s*msg/; - -PoParser.isData = function(str) { - return PoParser.REGEX_DATA.test(str); -}; - -/** - * Reads the file passed as argument, assuming that it is UTF-8 encoded - * @param {java.io.File} file The file to read - * @returns The contents of the file - * @type java.lang.String - */ -PoParser.readFile = function(file) { - var inStream = new java.io.InputStreamReader(new java.io.FileInputStream(file), "UTF-8"); - var buffer = new java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 2048); - var read = 0; - var r = 0; - while ((r = inStream.read(buffer, read, buffer.length - read)) > -1) { - read += r; - if (read == buffer.length) { - // grow input buffer - var newBuffer = new java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, buffer.length * 2); - java.lang.System.arraycopy(buffer, 0, newBuffer, 0, buffer.length); - buffer = newBuffer; - } - } - inStream.close(); - return new java.lang.String(buffer, 0, read); -} - -/** - * Parses the PO file passed as argument into the messages array - * of this PoParser instance. - * @param {java.io.File} file The .po file to parse - */ -PoParser.prototype.parse = function(file) { - // parse the locale key out of the file name - var fileName = file.getName(); - if (!(this.localeKey = fileName.substring(0, fileName.indexOf(".")))) { - throw "Invalid PO file name: " + fileName; - } - - // read the PO file content and parse it into messages - var content = PoParser.readFile(file); - var start = new Date(); - var lines = content.split(PoParser.REGEX_LINES); - var idx = -1; - var line = null; - var m, value, nr; - var msg; - - var hasMoreLines = function() { - return idx < lines.length - 1; - }; - - var nextLine = function() { - return (line = lines[idx += 1]) != null; - }; - - var getContinuation = function(str) { - var nLine; - while ((nLine = lines[idx + 1]) != null) { - if ((m = nLine.match(PoParser.REGEX_MSG_CONT)) != null) { - str += m[1]; - nextLine(); - } else { - break; - } - } - return str; - } - - while (nextLine()) { - if ((m = line.match(PoParser.REGEX_MSGID)) != null) { - value = getContinuation(m[1]); - if (value) { - msg = this.messages[this.messages.length] = new Message(value); - } - } else if ((m = line.match(PoParser.REGEX_MSGID_PLURAL)) != null) { - value = getContinuation(m[1]); - if (value && msg != null) { - msg.pluralKey = value; - } - } else if ((m = line.match(PoParser.REGEX_MSGSTR)) != null) { - nr = m[1]; - value = getContinuation(m[2]); - if (value && msg != null) { - nr = parseInt(nr, 10); - msg.translations[nr || 0] = value; - } - } - } - return; -}; - -/** - * Converts the array containing the parsed messages into a message - * catalog script file and saves it on disk. - * @param {java.io.File} outputDir The directory where the message - * file should be saved - */ -PoParser.prototype.writeToFile = function(output) { - var buf = new java.lang.StringBuffer(); - // write header - buf.append('/**\n'); - buf.append(' * Instantiate the messages namespace if it\'s not already existing\n'); - buf.append(' */\n'); - var objPath = ""; - if (this.namespace) { - objPath += this.namespace; - buf.append('if (!global.' + objPath + ') {\n'); - buf.append(' global.' + objPath + ' = {};\n'); - buf.append('}\n'); - objPath += "."; - } - objPath += "messages"; - buf.append('if (!global.' + objPath + ') {\n'); - buf.append(' global.' + objPath + ' = {};\n'); - buf.append('}\n\n'); - - buf.append('/**\n'); - buf.append(' * Messages for locale "' + this.localeKey + '"\n'); - buf.append(' */\n'); - var fname = objPath + "." + this.localeKey + ".js"; - objPath += "['" + this.localeKey + "']"; - buf.append('global.' + objPath + ' = {\n'); - // write messages - for (var i=0;i [namespace]"); - print(": Either a single .po file or a directory containing .po files"); - print(": The directory where the generated messages files should be stored"); - print("[namespace]: An optional global namespace where the messages should be"); - print(" stored (eg. a namespace like 'jala' will lead to messages"); - print(" stored in global.jala.messages by their locale."); - quit(); -} - -var input = new java.io.File(arguments[0]); -var output = new java.io.File(arguments[1]); -var namespace = arguments[2]; - -// check if the output destination is a directory -if (output.isFile()) { - print("Invalid arguments: the output destination must be a directory."); - quit(); -} - -if (namespace && namespace.indexOf(".") != -1) { - print("Invalid arguments: Please don't specify complex object paths, as this"); - print("would corrupt the messages file."); - quit(); -} - -// parse the PO file(s) and create the message catalog files -var parser; -if (input.isDirectory()) { - var files = input.listFiles(); - var file; - for (var i=0;i. - - var myReport = JSLINT.report(option); - - If the option is true, then the report will be limited to only errors. -*/ - -String.prototype.entityify = function () { - return this. - replace(/&/g, '&'). - replace(//g, '>'); -}; - -String.prototype.isAlpha = function () { - return (this >= 'a' && this <= 'z\uffff') || - (this >= 'A' && this <= 'Z\uffff'); -}; - - -String.prototype.isDigit = function () { - return (this >= '0' && this <= '9'); -}; - - -// We build the application inside a function so that we produce only a single -// global variable. The function will be invoked, its return value is the JSLINT -// function itself. - -var JSLINT; -JSLINT = function () { - - var anonname, - -// browser contains a set of global names which are commonly provided by a -// web browser environment. - - browser = { - alert: true, - blur: true, - clearInterval: true, - clearTimeout: true, - close: true, - closed: true, - confirm: true, - defaultStatus: true, - document: true, - event: true, - focus: true, - frames: true, - history: true, - Image: true, - length: true, - location: true, - moveBy: true, - moveTo: true, - name: true, - navigator: true, - onblur: true, - onerror: true, - onfocus: true, - onload: true, - onresize: true, - onunload: true, - open: true, - opener: true, - parent: true, - print: true, - prompt: true, - resizeBy: true, - resizeTo: true, - screen: true, - scroll: true, - scrollBy: true, - scrollTo: true, - self: true, - setInterval: true, - setTimeout: true, - status: true, - top: true, - window: true, - XMLHttpRequest: true - }, - funlab, funstack, functions, globals, - -// konfab contains the global names which are provided to a Konfabulator widget. - - konfab = { - alert: true, - animator: true, - appleScript: true, - beep: true, - bytesToUIString: true, - chooseColor: true, - chooseFile: true, - chooseFolder: true, - convertPathToHFS: true, - convertPathToPlatform: true, - closeWidget: true, - CustomAnimation: true, - escape: true, - FadeAnimation: true, - focusWidget: true, - form: true, - include: true, - isApplicationRunning: true, - iTunes: true, - konfabulatorVersion: true, - log: true, - MoveAnimation: true, - openURL: true, - play: true, - popupMenu: true, - print: true, - prompt: true, - reloadWidget: true, - resolvePath: true, - resumeUpdates: true, - RotateAnimation: true, - runCommand: true, - runCommandInBg: true, - saveAs: true, - savePreferences: true, - showWidgetPreferences: true, - sleep: true, - speak: true, - suppressUpdates: true, - tellWidget: true, - unescape: true, - updateNow: true, - yahooCheckLogin: true, - yahooLogin: true, - yahooLogout: true, - COM: true, - filesystem: true, - preferenceGroups: true, - preferences: true, - screen: true, - system: true, - URL: true, - XMLDOM: true, - XMLHttpRequest: true - }, - lines, lookahead, member, noreach, option, prevtoken, stack, - -// standard contains the global names that are provided by standard JavaScript. - - standard = { - Array: true, - Boolean: true, - Date: true, - decodeURI: true, - decodeURIComponent: true, - encodeURI: true, - encodeURIComponent: true, - Error: true, - escape: true, - 'eval': true, - EvalError: true, - Function: true, - isFinite: true, - isNaN: true, - Math: true, - Number: true, - Object: true, - parseInt: true, - parseFloat: true, - RangeError: true, - ReferenceError: true, - RegExp: true, - String: true, - SyntaxError: true, - TypeError: true, - unescape: true, - URIError: true - }, - syntax = {}, token, verb, -/* - xmode is used to adapt to the exceptions in XML parsing. It can have these - states: - false .js script file - " A " attribute - ' A ' attribute - content The content of a script tag - CDATA A CDATA block -*/ - xmode, -/* - xtype identifies the type of document being analyzed. It can have these - states: - false .js script file - html .html file - widget .kon Konfabulator file -*/ - xtype, -// token - tx = /^([(){}[.,:;'"~]|\](\]>)?|\?>?|==?=?|\/(\*(global|extern)*|=|)|\*[\/=]?|\+[+=]?|-[-=]?|%[=>]?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=%\?]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+-]?[0-9]+)?)/, -// string ending in single quote - sx = /^((\\[^\x00-\x1f]|[^\x00-\x1f'\\])*)'/, - sxx = /^(([^\x00-\x1f'])*)'/, -// string ending in double quote - qx = /^((\\[^\x00-\x1f]|[^\x00-\x1f"\\])*)"/, - qxx = /^(([^\x00-\x1f"])*)"/, -// regular expression - rx = /^(\\[^\x00-\x1f]|\[(\\[^\x00-\x1f]|[^\x00-\x1f\\\/])*\]|[^\x00-\x1f\\\/\[])+\/[gim]*/, -// star slash - lx = /\*\/|\/\*/, -// global identifier - gx = /^([a-zA-Z_$][a-zA-Z0-9_$]*)/, -// identifier - ix = /^([a-zA-Z_$][a-zA-Z0-9_$]*$)/, -// global separators - hx = /^[\x00-\x20,]*(\*\/)?/, -// whitespace - wx = /^\s*(\/\/.*\r*$)?/; - -// Make a new object that inherits from an existing object. - - function object(o) { - function F() {} - F.prototype = o; - return new F(); - } - -// Produce an error warning. - - function warning(m, x, y) { - var l, c, t = typeof x === 'object' ? x : token; - if (typeof x === 'number') { - l = x; - c = y || 0; - } else { - if (t.id === '(end)') { - t = prevtoken; - } - l = t.line || 0; - c = t.from || 0; - } - JSLINT.errors.push({ - id: '(error)', - reason: m, - evidence: lines[l] || '', - line: l, - character: c - }); - if (option.passfail) { - JSLINT.errors.push(null); - throw null; - } - } - - function error(m, x, y) { - warning(m, x, y); - JSLINT.errors.push(null); - throw null; - } - - -// lexical analysis - - var lex = function () { - var character, from, line, s; - -// Private lex methods - - function nextLine() { - line += 1; - if (line >= lines.length) { - return false; - } - character = 0; - s = lines[line]; - return true; - } - -// Produce a token object. The token inherits from a syntax symbol. - - function it(type, value) { - var t; - if (type === '(punctuator)') { - t = syntax[value]; - } else if (type === '(identifier)') { - t = syntax[value]; - if (!t || typeof t != 'object') { - t = syntax[type]; - } - } else { - t = syntax[type]; - } - if (!t || typeof t != 'object') { - error("Unrecognized symbol: '" + value + "' " + type); - } - t = object(t); - if (value || type === '(string)') { - t.value = value; - } - t.line = line; - t.character = character; - t.from = from; - return t; - } - -// Public lex methods - - return { - init: function (source) { - if (typeof source === 'string') { - lines = source.split('\n'); - if (lines.length == 1) { - lines = lines[0].split('\r'); - } - } else { - lines = source; - } - line = 0; - character = 0; - from = 0; - s = lines[0]; - }, - -// token -- this is called by advance to get the next token. - - token: function () { - var c, i, l, r, t; - - function string(x) { - var a, j; - r = x.exec(s); - if (r) { - t = r[1]; - l = r[0].length; - s = s.substr(l); - character += l; - if (xmode == 'script') { - if (t.indexOf('<\/') >= 0) { - warning( - 'Expected "...<\\/..." and instead saw "...<\/...".', token); - } - } - return it('(string)', r[1]); - } else { - for (j = 0; j < s.length; j += 1) { - a = s.charAt(j); - if (a < ' ') { - if (a === '\n' || a === '\r') { - break; - } - error("Control character in string: " + - s.substring(0, j), line, character + j); - } - } - error("Unclosed string: " + s, line, character); - } - } - - for (;;) { - if (!s) { - return it(nextLine() ? '(endline)' : '(end)', ''); - } - r = wx.exec(s); - if (!r || !r[0]) { - break; - } - l = r[0].length; - s = s.substr(l); - character += l; - if (s) { - break; - } - } - from = character; - r = tx.exec(s); - if (r) { - t = r[0]; - l = t.length; - s = s.substr(l); - character += l; - c = t.substr(0, 1); - -// identifier - - if (c.isAlpha() || c === '_' || c === '$') { - return it('(identifier)', t); - } - -// number - - if (c.isDigit()) { - if (token.id === '.') { - warning( - "A decimal fraction should have a zero before the decimal point.", - token); - } - if (!isFinite(Number(t))) { - warning("Bad number: '" + t + "'.", - line, character); - } - if (s.substr(0, 1).isAlpha()) { - error("Space is required after a number: '" + - t + "'.", line, character); - } - if (c === '0' && t.substr(1,1).isDigit()) { - warning("Don't use extra leading zeros: '" + - t + "'.", line, character); - } - if (t.substr(t.length - 1) === '.') { - warning( - "A trailing decimal point can be confused with a dot: '" + t + "'.", - line, character); - } - return it('(number)', t); - } - -// string - - if (t === '"') { - return (xmode === '"' || xmode === 'string') ? - it('(punctuator)', t) : - string(xmode === 'xml' ? qxx : qx); - } - if (t === "'") { - return (xmode === "'" || xmode === 'string') ? - it('(punctuator)', t) : - string(xmode === 'xml' ? sxx : sx); - } - -// unbegun comment - - if (t === '/*') { - for (;;) { - i = s.search(lx); - if (i >= 0) { - break; - } - if (!nextLine()) { - error("Unclosed comment.", token); - } - } - character += i + 2; - if (s.substr(i, 1) === '/') { - error("Nested comment."); - } - s = s.substr(i + 2); - return this.token(); - } - -// /*extern - - if (t === '/*extern' || t === '/*global') { - for (;;) { - r = hx.exec(s); - if (r) { - l = r[0].length; - s = s.substr(l); - character += l; - if (r[1] === '*/') { - return this.token(); - } - } - if (s) { - r = gx.exec(s); - if (r) { - l = r[0].length; - s = s.substr(l); - character += l; - globals[r[1]] = true; - } else { - error("Bad extern identifier: '" + - s + "'.", line, character); - } - } else if (!nextLine()) { - error("Unclosed comment."); - } - } - } - -// punctuator - - return it('(punctuator)', t); - } - error("Unexpected token: " + (t || s.substr(0, 1)), - line, character); - }, - -// skip -- skip past the next occurrence of a particular string. -// If the argument is empty, skip to just before the next '<' character. -// This is used to ignore HTML content. Return false if it isn't found. - - skip: function (to) { - if (token.id) { - if (!to) { - to = ''; - if (token.id.substr(0, 1) === '<') { - lookahead.push(token); - return true; - } - } else if (token.id.indexOf(to) >= 0) { - return true; - } - } - prevtoken = token; - token = syntax['(error)']; - for (;;) { - var i = s.indexOf(to || '<'); - if (i >= 0) { - character += i + to.length; - s = s.substr(i + to.length); - return true; - } - if (!nextLine()) { - break; - } - } - return false; - }, - -// regex -- this is called by parse when it sees '/' being used as a prefix. - - regex: function () { - var l, r = rx.exec(s), x; - if (r) { - l = r[0].length; - character += l; - s = s.substr(l); - x = r[1]; - return it('(regex)', x); - } - error("Bad regular expression: " + s); - } - }; - }(); - - function builtin(name) { - return standard[name] === true || - globals[name] === true || - ((xtype === 'widget' || option.widget) && konfab[name] === true) || - ((xtype === 'html' || option.browser) && browser[name] === true); - } - - function addlabel(t, type) { - if (t) { - if (typeof funlab[t] === 'string') { - switch (funlab[t]) { - case 'var': - case 'var*': - if (type === 'global') { - funlab[t] = 'var*'; - return; - } - break; - case 'global': - if (type === 'var') { - warning('Var ' + t + - ' was used before it was declared.', prevtoken); - return; - } - if (type === 'var*' || type === 'global') { - return; - } - break; - case 'function': - case 'parameter': - if (type === 'global') { - return; - } - break; - } - warning("Identifier '" + t + "' already declared as " + - funlab[t], prevtoken); - } - funlab[t] = type; - } - } - - -// We need a peek function. If it has an argument, it peeks that much farther -// ahead. It is used to distinguish -// for ( var i in ... -// from -// for ( var i = ... - - function peek(i) { - var j = 0, t; - if (token == syntax['(error)']) { - return token; - } - if (typeof i === 'undefined') { - i = 0; - } - while (j <= i) { - t = lookahead[j]; - if (!t) { - t = lookahead[j] = lex.token(); - } - j += 1; - } - return t; - } - - - var badbreak = {')': true, ']': true, '++': true, '--': true}; - -// Produce the next token. It looks for programming errors. - - function advance(id, t) { - var l; - switch (prevtoken.id) { - case '(number)': - if (token.id === '.') { - warning( -"A dot following a number can be confused with a decimal point.", prevtoken); - } - break; - case '-': - if (token.id === '-' || token.id === '--') { - warning("Confusing minusses."); - } - break; - case '+': - if (token.id === '+' || token.id === '++') { - warning("Confusing plusses."); - } - break; - } - if (prevtoken.type === '(string)' || prevtoken.identifier) { - anonname = prevtoken.value; - } - - if (id && token.value != id) { - if (t) { - if (token.id === '(end)') { - warning("Unmatched '" + t.id + "'.", t); - } else { - warning("Expected '" + id + "' to match '" + - t.id + "' from line " + (t.line + 1) + - " and instead saw '" + token.value + "'."); - } - } else { - warning("Expected '" + id + "' and instead saw '" + - token.value + "'."); - } - } - prevtoken = token; - for (;;) { - token = lookahead.shift() || lex.token(); - if (token.id === ''); - } else { - error("Unexpected token '') { - if (xmode === 'CDATA') { - xmode = 'script'; - } else { - error("Unexpected token ']]>"); - } - } else if (token.id !== '(endline)') { - break; - } - if (xmode === '"' || xmode === "'") { - error("Missing '" + xmode + "'.", prevtoken); - } - l = !xmode && !option.laxLineEnd && - (prevtoken.type == '(string)' || prevtoken.type == '(number)' || - prevtoken.type == '(identifier)' || badbreak[prevtoken.id]); - } - if (l && token.id != '{' && token.id != '}' && token.id != ']') { - warning( - "Line breaking error: '" + - prevtoken.value + "'.", prevtoken); - } - if (xtype === 'widget' && xmode === 'script' && token.id) { - l = token.id.charAt(0); - if (l === '<' || l === '&') { - token.nud = token.led = null; - token.lbp = 0; - token.reach = true; - } - } - } - - - function advanceregex() { - token = lex.regex(); - } - - - function beginfunction(i) { - var f = {'(name)': i, '(line)': token.line + 1, '(context)': funlab}; - funstack.push(funlab); - funlab = f; - functions.push(funlab); - } - - - function endfunction() { - funlab = funstack.pop(); - } - - -// This is the heart of JSLINT, the Pratt parser. In addition to parsing, it -// is looking for ad hoc lint patterns. We add to Pratt's model .fud, which is -// like nud except that it is only used on the first token of a statement. -// Having .fud makes it much easier to define JavaScript. I retained Pratt's -// nomenclature, even though it isn't very descriptive. - -// .nud Null denotation -// .fud First null denotation -// .led Left denotation -// lbp Left binding power -// rbp Right binding power - -// They are key to the parsing method called Top Down Operator Precedence. - - function parse(rbp, initial) { - var l, left, o; - if (token.id && token.id === '/') { - if (prevtoken.id != '(' && prevtoken.id != '=' && - prevtoken.id != ':' && prevtoken.id != ',' && - prevtoken.id != '=') { - warning( -"Expected to see a '(' or '=' or ':' or ',' preceding a regular expression literal, and instead saw '" + - prevtoken.value + "'.", prevtoken); - } - advanceregex(); - } - if (token.id === '(end)') { - warning("Unexpected early end of program", prevtoken); - } - advance(); - if (initial) { - anonname = 'anonymous'; - verb = prevtoken.value; - } - if (initial && prevtoken.fud) { - prevtoken.fud(); - } else { - if (prevtoken.nud) { - o = prevtoken.exps; - left = prevtoken.nud(); - } else { - if (token.type === '(number)' && prevtoken.id === '.') { - warning( -"A leading decimal point can be confused with a dot: ." + token.value, - prevtoken); - } - error("Expected an identifier and instead saw '" + - prevtoken.id + "'.", prevtoken); - } - while (rbp < token.lbp) { - o = token.exps; - advance(); - if (prevtoken.led) { - left = prevtoken.led(left); - } else { - error("Expected an operator and instead saw '" + - prevtoken.id + "'."); - } - } - if (initial && !o) { - warning( -"Expected an assignment or function call and instead saw an expression.", - prevtoken); - } - } - if (l) { - funlab[l] = 'label'; - } - if (left && left.id === 'eval') { - warning("evalError", left); - } - return left; - } - - -// Parasitic constructors for making the symbols that will be inherited by -// tokens. - - function symbol(s, p) { - return syntax[s] || (syntax[s] = {id: s, lbp: p, value: s}); - } - - - function delim(s) { - return symbol(s, 0); - } - - - function stmt(s, f) { - var x = delim(s); - x.identifier = x.reserved = true; - x.fud = f; - return x; - } - - - function blockstmt(s, f) { - var x = stmt(s, f); - x.block = true; - return x; - } - - - function prefix(s, f) { - var x = symbol(s, 150); - x.nud = (typeof f === 'function') ? f : function () { - parse(150); - return this; - }; - return x; - } - - - function prefixname(s, f) { - var x = prefix(s, f); - x.identifier = x.reserved = true; - return x; - } - - - function type(s, f) { - var x = delim(s); - x.type = s; - x.nud = f; - return x; - } - - - function reserve(s, f) { - var x = type(s, f); - x.identifier = x.reserved = true; - return x; - } - - - function reservevar(s) { - return reserve(s, function () { - return this; - }); - } - - - function infix(s, f, p) { - var x = symbol(s, p); - x.led = (typeof f === 'function') ? f : function (left) { - return [f, left, parse(p)]; - }; - return x; - } - - - function assignop(s, f) { - symbol(s, 20).exps = true; - return infix(s, function (left) { - if (left) { - if (left.id === '.' || left.id === '[' || - (left.identifier && !left.reserved)) { - parse(19); - return left; - } - if (left == syntax['function']) { - if (option.jscript) { - parse(19); - return left; - } else { - warning( -"Expected an identifier in an assignment, and instead saw a function invocation.", - prevtoken); - } - } - } - error("Bad assignment.", this); - }, 20); - } - - - function suffix(s, f) { - var x = symbol(s, 150); - x.led = function (left) { - if (option.plusplus) { - warning(this.id + " is considered harmful.", this); - } - return [f, left]; - }; - return x; - } - - - function optionalidentifier() { - if (token.reserved) { - warning("Expected an identifier and instead saw '" + - token.id + "' (a reserved word)."); - } - if (token.identifier) { - advance(); - return prevtoken.value; - } - } - - - function identifier() { - var i = optionalidentifier(); - if (i) { - return i; - } - if (prevtoken.id === 'function' && token.id === '(') { - warning("Missing name in function statement."); - } else { - error("Expected an identifier and instead saw '" + - token.value + "'.", token); - } - } - - - function reachable(s) { - var i = 0, t; - if (token.id != ';' || noreach) { - return; - } - for (;;) { - t = peek(i); - if (t.reach) { - return; - } - if (t.id != '(endline)') { - if (t.id === 'function') { - warning( -"Inner functions should be listed at the top of the outer function.", t); - break; - } - warning("Unreachable '" + t.value + "' after '" + s + - "'.", t); - break; - } - i += 1; - } - } - - - function statement() { - var t = token; - while (t.id === ';') { - warning("Unnecessary semicolon", t); - advance(';'); - t = token; - if (t.id === '}') { - return; - } - } - if (t.identifier && !t.reserved && peek().id === ':') { - advance(); - advance(':'); - addlabel(t.value, 'live*'); - if (!token.labelled) { - warning("Label '" + t.value + - "' on unlabelable statement '" + token.value + "'.", - token); - } - if (t.value.toLowerCase() == 'javascript') { - warning("Label '" + t.value + - "' looks like a javascript url.", - token); - } - token.label = t.value; - t = token; - } - parse(0, true); - if (!t.block) { - if (token.id != ';') { - warning("Missing ';'", prevtoken.line, - prevtoken.from + prevtoken.value.length); - } else { - advance(';'); - } - } - } - - - function statements() { - while (!token.reach) { - statement(); - } - } - - - function block() { - var t = token; - if (token.id === '{') { - advance('{'); - statements(); - advance('}', t); - } else { - warning("Missing '{' before '" + token.value + "'."); - noreach = true; - statement(); - noreach = false; - } - verb = null; - } - - -// An identity function, used by string and number tokens. - - function idValue() { - return this; - } - - - function countMember(m) { - if (typeof member[m] === 'number') { - member[m] += 1; - } else { - member[m] = 1; - } - } - - -// Common HTML attributes that carry scripts. - - var scriptstring = { - onblur: true, - onchange: true, - onclick: true, - ondblclick: true, - onfocus: true, - onkeydown: true, - onkeypress: true, - onkeyup: true, - onload: true, - onmousedown: true, - onmousemove: true, - onmouseout: true, - onmouseover: true, - onmouseup: true, - onreset: true, - onselect: true, - onsubmit: true, - onunload: true - }; - - -// XML types. Currently we support html and widget. - - var xmltype = { - HTML: { - doBegin: function (n) { - if (!option.cap) { - warning("HTML case error."); - } - xmltype.html.doBegin(); - } - }, - html: { - doBegin: function (n) { - xtype = 'html'; - xmltype.html.script = false; - }, - doTagName: function (n, p) { - var i, t = xmltype.html.tag[n], x; - if (!t) { - error('Unrecognized tag: <' + n + '>. ' + - (n === n.toLowerCase() ? - 'Did you mean <' + n.toLowerCase() + '>?' : '')); - } - x = t.parent; - if (x) { - if (x.indexOf(' ' + p + ' ') < 0) { - error('A <' + n + '> must be within <' + x + '>', - prevtoken); - } - } else { - i = stack.length; - do { - if (i <= 0) { - error('A <' + n + '> must be within the body', - prevtoken); - } - i -= 1; - } while (stack[i].name !== 'body'); - } - xmltype.html.script = n === 'script'; - return t.simple; - }, - doAttribute: function (n, a) { - if (n === 'script') { - if (a === 'src') { - xmltype.html.script = false; - return 'string'; - } else if (a === 'language') { - warning("The 'language' attribute is deprecated", - prevtoken); - return false; - } - } - return scriptstring[a] && 'script'; - }, - doIt: function (n) { - return xmltype.html.script ? 'script' : - n !== 'html' && xmltype.html.tag[n].special && 'special'; - }, - tag: { - a: {}, - abbr: {}, - acronym: {}, - address: {}, - applet: {}, - area: {simple: true, parent: ' map '}, - b: {}, - base: {simple: true, parent: ' head '}, - bdo: {}, - big: {}, - blockquote: {}, - body: {parent: ' html noframes '}, - br: {simple: true}, - button: {}, - caption: {parent: ' table '}, - center: {}, - cite: {}, - code: {}, - col: {simple: true, parent: ' table colgroup '}, - colgroup: {parent: ' table '}, - dd: {parent: ' dl '}, - del: {}, - dfn: {}, - dir: {}, - div: {}, - dl: {}, - dt: {parent: ' dl '}, - em: {}, - embed: {}, - fieldset: {}, - font: {}, - form: {}, - frame: {simple: true, parent: ' frameset '}, - frameset: {parent: ' html frameset '}, - h1: {}, - h2: {}, - h3: {}, - h4: {}, - h5: {}, - h6: {}, - head: {parent: ' html '}, - html: {}, - hr: {simple: true}, - i: {}, - iframe: {}, - img: {simple: true}, - input: {simple: true}, - ins: {}, - kbd: {}, - label: {}, - legend: {parent: ' fieldset '}, - li: {parent: ' dir menu ol ul '}, - link: {simple: true, parent: ' head '}, - map: {}, - menu: {}, - meta: {simple: true, parent: ' head noscript '}, - noframes: {parent: ' html body '}, - noscript: {parent: ' html head body frameset '}, - object: {}, - ol: {}, - optgroup: {parent: ' select '}, - option: {parent: ' optgroup select '}, - p: {}, - param: {simple: true, parent: ' applet object '}, - pre: {}, - q: {}, - samp: {}, - script: {parent: -' head body p div span abbr acronym address bdo blockquote cite code del dfn em ins kbd pre samp strong th td var '}, - select: {}, - small: {}, - span: {}, - strong: {}, - style: {parent: ' head ', special: true}, - sub: {}, - sup: {}, - table: {}, - tbody: {parent: ' table '}, - td: {parent: ' tr '}, - textarea: {}, - tfoot: {parent: ' table '}, - th: {parent: ' tr '}, - thead: {parent: ' table '}, - title: {parent: ' head '}, - tr: {parent: ' table tbody thead tfoot '}, - tt: {}, - u: {}, - ul: {}, - 'var': {} - } - }, - widget: { - doBegin: function (n) { - xtype = 'widget'; - }, - doTagName: function (n, p) { - var t = xmltype.widget.tag[n]; - if (!t) { - error('Unrecognized tag: <' + n + '>. '); - } - var x = t.parent; - if (x.indexOf(' ' + p + ' ') < 0) { - error('A <' + n + '> must be within <' + x + '>', prevtoken); - } - }, - doAttribute: function (n, a) { - var t = xmltype.widget.tag[a]; - if (!t) { - error('Unrecognized attribute: <' + n + ' ' + a + '>. '); - } - var x = t.parent; - if (x.indexOf(' ' + n + ' ') < 0) { - error('Attribute ' + a + ' does not belong in <' + - n + '>'); - } - return t.script ? 'script' : a === 'name' ? 'define' : 'string'; - }, - doIt: function (n) { - var x = xmltype.widget.tag[n]; - return x && x.script && 'script'; - }, - tag: { - "about-box": {parent: ' widget '}, - "about-image": {parent: ' about-box '}, - "about-text": {parent: ' about-box '}, - "about-version": {parent: ' about-box '}, - action: {parent: ' widget ', script: true}, - alignment: {parent: ' image text textarea window '}, - author: {parent: ' widget '}, - autoHide: {parent: ' scrollbar '}, - bgColor: {parent: ' text textarea '}, - bgOpacity: {parent: ' text textarea '}, - checked: {parent: ' image '}, - clipRect: {parent: ' image '}, - color: {parent: ' about-text about-version shadow text textarea '}, - contextMenuItems: {parent: ' frame image text textarea window '}, - colorize: {parent: ' image '}, - columns: {parent: ' textarea '}, - company: {parent: ' widget '}, - copyright: {parent: ' widget '}, - data: {parent: ' about-text about-version text textarea '}, - debug: {parent: ' widget '}, - defaultValue: {parent: ' preference '}, - defaultTracking: {parent: ' widget '}, - description: {parent: ' preference '}, - directory: {parent: ' preference '}, - editable: {parent: ' textarea '}, - enabled: {parent: ' menuItem '}, - extension: {parent: ' preference '}, - file: {parent: ' action preference '}, - fillMode: {parent: ' image '}, - font: {parent: ' about-text about-version text textarea '}, - frame: {parent: ' frame window '}, - group: {parent: ' preference '}, - hAlign: {parent: ' frame image scrollbar text textarea '}, - height: {parent: ' frame image scrollbar text textarea window '}, - hidden: {parent: ' preference '}, - hLineSize: {parent: ' frame '}, - hOffset: {parent: ' about-text about-version frame image scrollbar shadow text textarea window '}, - hotkey: {parent: ' widget '}, - hRegistrationPoint: {parent: ' image '}, - hslAdjustment: {parent: ' image '}, - hslTinting: {parent: ' image '}, - hScrollBar: {parent: ' frame '}, - icon: {parent: ' preferenceGroup '}, - image: {parent: ' about-box frame window widget '}, - interval: {parent: ' action timer '}, - key: {parent: ' hotkey '}, - kind: {parent: ' preference '}, - level: {parent: ' window '}, - lines: {parent: ' textarea '}, - loadingSrc: {parent: ' image '}, - max: {parent: ' scrollbar '}, - maxLength: {parent: ' preference '}, - menuItem: {parent: ' contextMenuItems '}, - min: {parent: ' scrollbar '}, - minimumVersion: {parent: ' widget '}, - minLength: {parent: ' preference '}, - missingSrc: {parent: ' image '}, - modifier: {parent: ' hotkey '}, - name: {parent: ' hotkey image preference preferenceGroup text textarea timer window '}, - notSaved: {parent: ' preference '}, - onContextMenu: {parent: ' frame image text textarea window ', script: true}, - onDragDrop: {parent: ' frame image text textarea ', script: true}, - onDragEnter: {parent: ' frame image text textarea ', script: true}, - onDragExit: {parent: ' frame image text textarea ', script: true}, - onFirstDisplay: {parent: ' window ', script: true}, - onGainFocus: {parent: ' textarea window ', script: true}, - onKeyDown: {parent: ' hotkey text textarea ', script: true}, - onKeyPress: {parent: ' textarea ', script: true}, - onKeyUp: {parent: ' hotkey text textarea ', script: true}, - onImageLoaded: {parent: ' image ', script: true}, - onLoseFocus: {parent: ' textarea window ', script: true}, - onMouseDown: {parent: ' frame image text textarea ', script: true}, - onMouseEnter: {parent: ' frame image text textarea ', script: true}, - onMouseExit: {parent: ' frame image text textarea ', script: true}, - onMouseMove: {parent: ' frame image text ', script: true}, - onMouseUp: {parent: ' frame image text textarea ', script: true}, - onMouseWheel: {parent: ' frame ', script: true}, - onMultiClick: {parent: ' frame image text textarea window ', script: true}, - onSelect: {parent: ' menuItem ', script: true}, - onTimerFired: {parent: ' timer ', script: true}, - onValueChanged: {parent: ' scrollbar ', script: true}, - opacity: {parent: ' frame image scrollbar shadow text textarea window '}, - option: {parent: ' preference widget '}, - optionValue: {parent: ' preference '}, - order: {parent: ' preferenceGroup '}, - orientation: {parent: ' scrollbar '}, - pageSize: {parent: ' scrollbar '}, - preference: {parent: ' widget '}, - preferenceGroup: {parent: ' widget '}, - remoteAsync: {parent: ' image '}, - requiredPlatform: {parent: ' widget '}, - rotation: {parent: ' image '}, - scrollX: {parent: ' frame '}, - scrollY: {parent: ' frame '}, - secure: {parent: ' preference textarea '}, - scrollbar: {parent: ' text textarea '}, - shadow: {parent: ' about-text text window '}, - size: {parent: ' about-text about-version text textarea '}, - spellcheck: {parent: ' textarea '}, - src: {parent: ' image '}, - srcHeight: {parent: ' image '}, - srcWidth: {parent: ' image '}, - style: {parent: ' about-text about-version preference text textarea '}, - text: {parent: ' frame window '}, - textarea: {parent: ' frame window '}, - timer: {parent: ' widget '}, - thumbColor: {parent: ' scrollbar '}, - ticking: {parent: ' timer '}, - ticks: {parent: ' preference '}, - tickLabel: {parent: ' preference '}, - tileOrigin: {parent: ' image '}, - title: {parent: ' menuItem preference preferenceGroup window '}, - tooltip: {parent: ' image text textarea '}, - tracking: {parent: ' image '}, - trigger: {parent: ' action '}, - truncation: {parent: ' text '}, - type: {parent: ' preference '}, - useFileIcon: {parent: ' image '}, - vAlign: {parent: ' frame image scrollbar text textarea '}, - value: {parent: ' preference scrollbar '}, - version: {parent: ' widget '}, - visible: {parent: ' frame image scrollbar text textarea window '}, - vLineSize: {parent: ' frame '}, - vOffset: {parent: ' about-text about-version frame image scrollbar shadow text textarea window '}, - vRegistrationPoint: {parent: ' image '}, - vScrollBar: {parent: ' frame '}, - width: {parent: ' frame image scrollbar text textarea window '}, - window: {parent: ' widget '}, - zOrder: {parent: ' frame image scrollbar text textarea '} - } - } - }; - - function xmlword(tag) { - var w = token.value; - if (!token.identifier) { - if (token.id === '<') { - error(tag ? "Expected < and saw '<'" : "Missing '>'", - prevtoken); - } else { - warning("Missing quotes", prevtoken); - } - } - advance(); - while (token.id === '-' || token.id === ':') { - w += token.id; - advance(); - if (!token.identifier) { - error('Bad name: ' + w + token.value); - } - w += token.value; - advance(); - } - return w; - } - - function xml() { - var a, e, n, q, t; - xmode = 'xml'; - stack = []; - for (;;) { - switch (token.value) { - case '<': - advance('<'); - t = token; - n = xmlword(true); - t.name = n; - if (!xtype) { - if (xmltype[n]) { - xmltype[n].doBegin(); - n = xtype; - e = false; - } else { - error("Unrecognized <" + n + ">"); - } - } else { - if (option.cap && xtype === 'html') { - n = n.toLowerCase(); - } - e = xmltype[xtype].doTagName(n, stack[stack.length - 1].type); - } - t.type = n; - for (;;) { - if (token.id === '/') { - advance('/'); - e = true; - break; - } - if (token.id && token.id.substr(0, 1) === '>') { - break; - } - a = xmlword(); - switch (xmltype[xtype].doAttribute(n, a)) { - case 'script': - xmode = 'string'; - advance('='); - q = token.id; - if (q !== '"' && q !== "'") { - error('Missing quote.'); - } - xmode = q; - advance(q); - statements(); - if (token.id !== q) { - error( - 'Missing close quote on script attribute'); - } - xmode = 'xml'; - advance(q); - break; - case 'value': - advance('='); - if (!token.identifier && - token.type != '(string)' && - token.type != '(number)') { - error('Bad value: ' + token.value); - } - advance(); - break; - case 'string': - advance('='); - if (token.type !== '(string)') { - error('Bad value: ' + token.value); - } - advance(); - break; - case 'define': - advance('='); - if (token.type !== '(string)') { - error('Bad value: ' + token.value); - } - addlabel(token.value, 'global'); - advance(); - break; - default: - if (token.id === '=') { - advance('='); - if (!token.identifier && - token.type != '(string)' && - token.type != '(number)') { - } - advance(); - } - } - } - switch (xmltype[xtype].doIt(n)) { - case 'script': - xmode = 'script'; - advance('>'); - statements(); - xmode = 'xml'; - break; - case 'special': - e = true; - n = ''; - if (!lex.skip(n)) { - error("Missing " + n, t); - } - break; - default: - lex.skip('>'); - } - if (!e) { - stack.push(t); - } - break; - case ''); - } - if (t.name != n) { - error('Expected and instead saw '); - } - if (token.id !== '>') { - error("Expected '>'"); - } - lex.skip('>'); - break; - case '') { - break; - } - if (token.id === '<' || token.id === '(end)') { - error("Missing '>'.", prevtoken); - } - } - lex.skip('>'); - break; - case ''); - break; - case '<%': - lex.skip('%>'); - break; - case '') { - break; - } - if (token.id === '' || token.id === '(end)') { - error("Missing '?>'.", prevtoken); - } - } - lex.skip('?>'); - break; - case '<=': - case '<<': - case '<<=': - error("Expected '<'."); - break; - case '(end)': - return; - } - if (!lex.skip('')) { - if (stack.length) { - t = stack.pop(); - error('Missing ', t); - } - return; - } - advance(); - } - } - - -// Build the syntax table by declaring the syntactic elements of the language. - - type('(number)', idValue); - type('(string)', idValue); - - syntax['(identifier)'] = { - type: '(identifier)', - lbp: 0, - identifier: true, - nud: function () { - if (option.undef && !builtin(this.value) && - xmode !== '"' && xmode !== "'") { - var c = funlab; - while (!c[this.value]) { - c = c['(context)']; - if (!c) { - warning("Undefined variable: " + this.value, - prevtoken); - break; - } - } - } - addlabel(this.value, 'global'); - return this; - }, - led: function () { - error("Expected an operator and instead saw '" + - token.value + "'."); - } - }; - - type('(regex)', function () { - return [this.id, this.value, this.flags]; - }); - - delim('(endline)'); - delim('(begin)'); - delim('(end)').reach = true; - delim(''); - delim('?>'); - delim('(error)').reach = true; - delim('}').reach = true; - delim(')'); - delim(']'); - delim(']]>').reach = true; - delim('"').reach = true; - delim("'").reach = true; - delim(';'); - delim(':').reach = true; - delim(','); - reservevar('eval'); - reserve('else'); - reserve('case').reach = true; - reserve('default').reach = true; - reserve('catch'); - reserve('finally'); - reservevar('arguments'); - reservevar('false'); - reservevar('Infinity'); - reservevar('NaN'); - reservevar('null'); - reservevar('this'); - reservevar('true'); - reservevar('undefined'); - assignop('=', 'assign', 20); - assignop('+=', 'assignadd', 20); - assignop('-=', 'assignsub', 20); - assignop('*=', 'assignmult', 20); - assignop('/=', 'assigndiv', 20).nud = function () { - warning( - "A regular expression literal can be confused with '/='."); - }; - assignop('%=', 'assignmod', 20); - assignop('&=', 'assignbitand', 20); - assignop('|=', 'assignbitor', 20); - assignop('^=', 'assignbitxor', 20); - assignop('<<=', 'assignshiftleft', 20); - assignop('>>=', 'assignshiftright', 20); - assignop('>>>=', 'assignshiftrightunsigned', 20); - infix('?', function (left) { - parse(10); - advance(':'); - parse(10); - }, 30); - - infix('||', 'or', 40); - infix('&&', 'and', 50); - infix('|', 'bitor', 70); - infix('^', 'bitxor', 80); - infix('&', 'bitand', 90); - infix('==', function (left) { - var t = token; - if ( (t.type === '(number)' && !+t.value) || - (t.type === '(string)' && !t.value) || - t.type === 'true' || t.type === 'false' || - t.type === 'undefined' || t.type === 'null') { - warning("Use '===' to compare with '" + t.value + "'.", t); - } - return ['==', left, parse(100)]; - }, 100); - infix('===', 'equalexact', 100); - infix('!=', function (left) { - var t = token; - if ( (t.type === '(number)' && !+t.value) || - (t.type === '(string)' && !t.value) || - t.type === 'true' || t.type === 'false' || - t.type === 'undefined' || t.type === 'null') { - warning("Use '!==' to compare with '" + t.value + "'.", t); - } - return ['!=', left, parse(100)]; - }, 100); - infix('!==', 'notequalexact', 100); - infix('<', 'less', 110); - infix('>', 'greater', 110); - infix('<=', 'lessequal', 110); - infix('>=', 'greaterequal', 110); - infix('<<', 'shiftleft', 120); - infix('>>', 'shiftright', 120); - infix('>>>', 'shiftrightunsigned', 120); - infix('in', 'in', 120); - infix('instanceof', 'instanceof', 120); - infix('+', 'addconcat', 130); - prefix('+', 'num'); - infix('-', 'sub', 130); - prefix('-', 'neg'); - infix('*', 'mult', 140); - infix('/', 'div', 140); - infix('%', 'mod', 140); - - suffix('++', 'postinc'); - prefix('++', 'preinc'); - syntax['++'].exps = true; - - suffix('--', 'postdec'); - prefix('--', 'predec'); - syntax['--'].exps = true; - prefixname('delete', function () { - parse(0); - }).exps = true; - - - prefix('~', 'bitnot'); - prefix('!', 'not'); - prefixname('typeof', 'typeof'); - prefixname('new', function () { - var c = parse(155), - i; - if (c) { - if (c.identifier) { - c['new'] = true; - switch (c.value) { - case 'Object': - warning('Use the object literal notation {}.', prevtoken); - break; - case 'Array': - warning('Use the array literal notation [].', prevtoken); - break; - case 'Number': - case 'String': - case 'Boolean': - warning("Do not use the " + c.value + - " function as a constructor.", prevtoken); - break; - case 'Function': - if (!option.evil) { - warning('The Function constructor is eval.'); - } - break; - default: - i = c.value.substr(0, 1); - if (i < 'A' || i > 'Z') { - warning( - 'A constructor name should start with an uppercase letter.', c); - } - } - } else { - if (c.id !== '.' && c.id !== '[' && c.id !== '(') { - warning('Bad constructor', prevtoken); - } - } - } else { - warning('Weird construction.', this); - } - if (token.id === '(') { - advance('('); - if (token.id !== ')') { - for (;;) { - parse(10); - if (token.id !== ',') { - break; - } - advance(','); - } - } - advance(')'); - } else { - warning("Missing '()' invoking a constructor."); - } - return syntax['function']; - }); - syntax['new'].exps = true; - - infix('.', function (left) { - var m = identifier(); - if (typeof m === 'string') { - countMember(m); - } - if (!option.evil && left && left.value === 'document' && - (m === 'write' || m === 'writeln')) { - warning("document.write can be a form of eval.", left); - } - this.left = left; - this.right = m; - return this; - }, 160); - - infix('(', function (left) { - var n = 0, p = []; - if (left && left.type === '(identifier)') { - if (left.value.match(/^[A-Z](.*[a-z].*)?$/)) { - if (left.value !== 'Number' && left.value !== 'String') { - warning("Missing 'new' prefix when invoking a constructor", - left); - } - } - } - if (token.id !== ')') { - for (;;) { - p[p.length] = parse(10); - n += 1; - if (token.id !== ',') { - break; - } - advance(','); - } - } - advance(')'); - if (typeof left === 'object') { - if (left.value == 'parseInt' && n == 1) { - warning("Missing radix parameter", left); - } - if (!option.evil) { - if (left.value == 'eval' || left.value == 'Function') { - warning("eval is evil", left); - } else if (p[0] && p[0].id === '(string)' && - (left.value === 'setTimeout' || - left.value === 'setInterval')) { - warning( - "Implied eval is evil. Use a function argument instead of a string", left); - } - } - if (!left.identifier && left.id !== '.' && - left.id !== '[' && left.id !== '(') { - warning('Bad invocation.', left); - } - - } - return syntax['function']; - }, 155).exps = true; - - prefix('(', function () { - parse(0); - advance(')', this); - }); - - infix('[', function (left) { - var e = parse(0); - if (e && e.type === '(string)') { - countMember(e.value); - if (ix.test(e.value)) { - var s = syntax[e.value]; - if (!s || !s.reserved) { - warning("This is better written in dot notation.", e); - } - } - } - advance(']', this); - this.left = left; - this.right = e; - return this; - }, 160); - - prefix('[', function () { - if (token.id === ']') { - advance(']'); - return; - } - for (;;) { - parse(10); - if (token.id === ',') { - advance(','); - if (token.id === ']' || token.id === ',') { - warning('Extra comma.', prevtoken); - } - } else { - advance(']', this); - return; - } - } - }, 160); - - (function (x) { - x.nud = function () { - var i; - if (token.id === '}') { - advance('}'); - return; - } - for (;;) { - i = optionalidentifier(true); - if (!i && (token.id === '(string)' || token.id === '(number)')) { - i = token.id; - advance(); - } - if (!i) { - error("Expected an identifier and instead saw '" + - token.value + "'."); - } - if (typeof i.value === 'string') { - countMember(i.value); - } - advance(':'); - parse(10); - if (token.id === ',') { - advance(','); - if (token.id === ',' || token.id === '}') { - warning("Extra comma."); - } - } else { - advance('}', this); - return; - } - } - }; - x.fud = function () { - error( - "Expected to see a statement and instead saw a block."); - }; - })(delim('{')); - - - function varstatement() { - var i, n; - for (;;) { - n = identifier(); - if (!option.redef) { - for (i = funstack.length - 1; i >= 0; i -= 1) { - if (funstack[i][n]) { - warning("Redefinition of '" + n + "'.", prevtoken); - break; - } - } - } - addlabel(n, 'var'); - if (token.id === '=') { - advance('='); - parse(20); - } - if (token.id === ',') { - advance(','); - } else { - return; - } - } - } - - - stmt('var', varstatement); - - stmt('new', function () { - error("'new' should not be used as a statement"); - }); - - - function functionparams() { - var t = token; - advance('('); - if (token.id === ')') { - advance(')'); - return; - } - for (;;) { - addlabel(identifier(), 'parameter'); - if (token.id === ',') { - advance(','); - } else { - advance(')', t); - return; - } - } - } - - - blockstmt('function', function () { - var i = identifier(); - addlabel(i, 'var*'); - beginfunction(i); - addlabel(i, 'function'); - functionparams(); - block(); - endfunction(); - }); - - prefixname('function', function () { - var i = optionalidentifier() || ('"' + anonname + '"'); - beginfunction(i); - addlabel(i, 'function'); - functionparams(); - block(); - endfunction(); - }); - - blockstmt('if', function () { - var t = token; - advance('('); - parse(20); - advance(')', t); - block(); - if (token.id === 'else') { - advance('else'); - if (token.id === 'if' || token.id === 'switch') { - statement(); - } else { - block(); - } - } - }); - - blockstmt('try', function () { - var b; - block(); - if (token.id === 'catch') { - advance('catch'); - beginfunction('"catch"'); - functionparams(); - block(); - endfunction(); - b = true; - } - if (token.id === 'finally') { - advance('finally'); - beginfunction('"finally"'); - block(); - endfunction(); - return; - } else if (!b) { - error("Expected 'catch' or 'finally' and instead saw '" + - token.value + "'."); - } - }); - - blockstmt('while', function () { - var t= token; - advance('('); - parse(20); - advance(')', t); - block(); - }).labelled = true; - - reserve('with'); - - blockstmt('switch', function () { - var t = token; - advance('('); - var g = false; - parse(20); - advance(')', t); - t = token; - advance('{'); - for (;;) { - switch (token.id) { - case 'case': - switch (verb) { - case 'break': - case 'case': - case 'continue': - case 'return': - case 'switch': - case 'throw': - break; - default: - warning( - "Expected a 'break' statement before 'case'.", - prevtoken); - } - advance('case'); - parse(20); - g = true; - advance(':'); - verb = 'case'; - break; - case 'default': - switch (verb) { - case 'break': - case 'continue': - case 'return': - case 'throw': - break; - default: - warning( - "Expected a 'break' statement before 'default'.", - prevtoken); - } - advance('default'); - g = true; - advance(':'); - break; - case '}': - advance('}', t); - return; - case '(end)': - error("Missing '}'."); - return; - default: - if (prevtoken.id !== ':') { - error("Missing ':' on a case clause", prevtoken); - } - if (g) { - statements(); - } else { - error("Expected to see 'case' and instead saw '" + - token.value + "'."); - } - } - } - }).labelled = true; - - stmt('debugger', function () { - if (!option.debug) { - warning("All debugger statements should be removed."); - } - }); - - stmt('do', function () { - block(); - advance('while'); - var t = token; - advance('('); - parse(20); - advance(')', t); - }).labelled = true; - - blockstmt('for', function () { - var t = token; - advance('('); - if (peek(token.id === 'var' ? 1 : 0).id === 'in') { - if (token.id === 'var') { - advance('var'); - addlabel(identifier(), 'var'); - } else { - advance(); - } - advance('in'); - parse(20); - advance(')', t); - block(); - return; - } else { - if (token.id != ';') { - if (token.id === 'var') { - advance('var'); - varstatement(); - } else { - for (;;) { - parse(0); - if (token.id !== ',') { - break; - } - advance(','); - } - } - } - advance(';'); - if (token.id != ';') { - parse(20); - } - advance(';'); - if (token.id === ';') { - error("Expected to see ')' and instead saw ';'"); - } - if (token.id != ')') { - for (;;) { - parse(0); - if (token.id !== ',') { - break; - } - advance(','); - } - } - advance(')', t); - block(); - } - }).labelled = true; - - - function nolinebreak(t) { - if (t.line !== token.line) { - warning("Statement broken badly.", t); - } - } - - - stmt('break', function () { - nolinebreak(this); - if (funlab[token.value] === 'live*') { - advance(); - } - reachable('break'); - }); - - - stmt('continue', function () { - nolinebreak(this); - if (funlab[token.id] === 'live*') { - advance(); - } - reachable('continue'); - }); - - - stmt('return', function () { - nolinebreak(this); - if (token.id != ';' && !token.reach) { - parse(20); - } - reachable('return'); - }); - - - stmt('throw', function () { - nolinebreak(this); - parse(20); - reachable('throw'); - }); - - -// Superfluous reserved words - - reserve('abstract'); - reserve('boolean'); - reserve('byte'); - reserve('char'); - reserve('class'); - reserve('const'); - reserve('double'); - reserve('enum'); - reserve('export'); - reserve('extends'); - reserve('final'); - reserve('float'); - reserve('goto'); - reserve('implements'); - reserve('import'); - reserve('int'); - reserve('interface'); - reserve('long'); - reserve('native'); - reserve('package'); - reserve('private'); - reserve('protected'); - reserve('public'); - reserve('short'); - reserve('static'); - reserve('super'); - reserve('synchronized'); - reserve('throws'); - reserve('transient'); - reserve('void'); - reserve('volatile'); - - -// The actual JSLINT function itself. - - var j = function (s, o) { - option = o; - if (!o) { - option = {}; - } - JSLINT.errors = []; - globals = {}; - functions = []; - xmode = false; - xtype = ''; - stack = null; - funlab = {}; - member = {}; - funstack = []; - lookahead = []; - lex.init(s); - - prevtoken = token = syntax['(begin)']; - try { - advance(); - if (token.value.charAt(0) === '<') { - xml(); - } else { - statements(); - advance('(end)'); - } - } catch (e) { - if (e) { - JSLINT.errors.push({ - reason: "JSLint error: " + e.description, - line: token.line, - character: token.from, - evidence: token.value - }); - } - } - return JSLINT.errors.length === 0; - }; - - -// Report generator. - - j.report = function (option) { - var a = [], c, cc, f, i, k, o = [], s; - - function detail(h) { - if (s.length) { - o.push('
      ' + h + ':  ' + s.sort().join(', ') + - '
      '); - } - } - - k = JSLINT.errors.length; - if (k) { - o.push( - '
      Error:
      '); - for (i = 0; i < k; i += 1) { - c = JSLINT.errors[i]; - if (c) { - o.push('

      Problem at line ' + (c.line + 1) + - ' character ' + (c.character + 1) + - ': ' + c.reason.entityify() + - '

      ' + c.evidence.entityify() + - '

      '); - } - } - o.push('
      '); - if (!c) { - return o.join(''); - } - } - - if (!option) { - for (k in member) { - a.push(k); - } - if (a.length) { - a = a.sort(); - o.push( - ''); - for (i = 0; i < a.length; i += 1) { - o.push(''); - } - o.push('
      MembersOccurrences
      ', a[i], '', member[a[i]], - '
      '); - } - for (i = 0; i < functions.length; ++i) { - f = functions[i]; - for (k in f) { - if (f[k] === 'global') { - c = f['(context)']; - for (;;) { - cc = c['(context)']; - if (!cc) { - if ((!funlab[k] || funlab[k] === 'var?') && - !builtin(k)) { - funlab[k] = 'var?'; - f[k] = 'global?'; - } - break; - } - if (c[k] === 'parameter!' || c[k] === 'var!') { - f[k] = 'var.'; - break; - } - if (c[k] === 'var' || c[k] === 'var*' || - c[k] === 'var!') { - f[k] = 'var.'; - c[k] = 'var!'; - break; - } - if (c[k] === 'parameter') { - f[k] = 'var.'; - c[k] = 'parameter!'; - break; - } - c = cc; - } - } - } - } - s = []; - for (k in funlab) { - c = funlab[k]; - if (typeof c === 'string' && c.substr(0, 3) === 'var') { - if (c === 'var?') { - s.push('' + k + ' (?)'); - } else { - s.push('' + k + ''); - } - } - } - detail('Global'); - if (functions.length) { - o.push('
      Function:
        '); - } - for (i = 0; i < functions.length; i += 1) { - f = functions[i]; - o.push('
      1. ' + (f['(name)'] || '') + ''); - s = []; - for (k in f) { - if (k.charAt(0) != '(') { - switch (f[k]) { - case 'parameter': - s.push('' + k + ''); - break; - case 'parameter!': - s.push('' + k + - ' (closure)'); - break; - } - } - } - detail('Parameter'); - s = []; - for (k in f) { - if (k.charAt(0) != '(') { - switch(f[k]) { - case 'var': - s.push('' + k + - ' (unused)'); - break; - case 'var*': - s.push('' + k + ''); - break; - case 'var!': - s.push('' + k + - ' (closure)'); - break; - case 'var.': - s.push('' + k + - ' (outer)'); - break; - } - } - } - detail('Var'); - s = []; - c = f['(context)']; - for (k in f) { - if (k.charAt(0) != '(' && f[k].substr(0, 6) === 'global') { - if (f[k] === 'global?') { - s.push('' + k + ' (?)'); - } else { - s.push('' + k + ''); - } - } - } - detail('Global'); - s = []; - for (k in f) { - if (k.charAt(0) != '(' && f[k] === 'label') { - s.push(k); - } - } - detail('Label'); - o.push('
      2. '); - } - if (functions.length) { - o.push('
      '); - } - } - return o.join(''); - }; - - return j; - -}(); \ No newline at end of file diff --git a/modules/jala/util/HopKit/scripts/jsmin.js b/modules/jala/util/HopKit/scripts/jsmin.js deleted file mode 100644 index 1ef29cf1..00000000 --- a/modules/jala/util/HopKit/scripts/jsmin.js +++ /dev/null @@ -1,316 +0,0 @@ -/* jsmin.js - 2006-08-31 -Author: Franck Marcia -This work is an adaptation of jsminc.c published by Douglas Crockford. -Permission is hereby granted to use the Javascript version under the same -conditions as the jsmin.c on which it is based. - -jsmin.c -2006-05-04 - -Copyright (c) 2002 Douglas Crockford (www.crockford.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -The Software shall be used for Good, not Evil. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Update: - add level: - 1: minimal, keep linefeeds if single - 2: normal, the standard algorithm - 3: agressive, remove any linefeed and doesn't take care of potential - missing semicolons (can be regressive) - store stats - jsmin.oldSize - jsmin.newSize -*/ - -String.prototype.has = function(c) { - return this.indexOf(c) > -1; -}; - -function jsmin(comment, input, level) { - - if (input === undefined) { - input = comment; - comment = ''; - level = 2; - } else if (level === undefined || level < 1 || level > 3) { - level = 2; - } - - if (comment.length > 0) { - comment += '\n'; - } - - var a = '', - b = '', - EOF = -1, - LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', - DIGITS = '0123456789', - ALNUM = LETTERS + DIGITS + '_$\\', - theLookahead = EOF; - - - /* isAlphanum -- return true if the character is a letter, digit, underscore, - dollar sign, or non-ASCII character. - */ - - function isAlphanum(c) { - return c != EOF && (ALNUM.has(c) || c.charCodeAt(0) > 126); - } - - - /* get -- return the next character. Watch out for lookahead. If the - character is a control character, translate it to a space or - linefeed. - */ - - function get() { - - var c = theLookahead; - if (get.i == get.l) { - return EOF; - } - theLookahead = EOF; - if (c == EOF) { - c = input.charAt(get.i); - ++get.i; - } - if (c >= ' ' || c == '\n') { - return c; - } - if (c == '\r') { - return '\n'; - } - return ' '; - } - - get.i = 0; - get.l = input.length; - - - /* peek -- get the next character without getting it. - */ - - function peek() { - theLookahead = get(); - return theLookahead; - } - - - /* next -- get the next character, excluding comments. peek() is used to see - if a '/' is followed by a '/' or '*'. - */ - - function next() { - - var c = get(); - if (c == '/') { - switch (peek()) { - case '/': - for (;;) { - c = get(); - if (c <= '\n') { - return c; - } - } - break; - case '*': - get(); - for (;;) { - switch (get()) { - case '*': - if (peek() == '/') { - get(); - return ' '; - } - break; - case EOF: - throw 'Error: Unterminated comment.'; - } - } - break; - default: - return c; - } - } - return c; - } - - - /* action -- do something! What you do is determined by the argument: - 1 Output A. Copy B to A. Get the next B. - 2 Copy B to A. Get the next B. (Delete A). - 3 Get the next B. (Delete B). - action treats a string as a single character. Wow! - action recognizes a regular expression if it is preceded by ( or , or =. - */ - - function action(d) { - - var r = []; - - if (d == 1) { - r.push(a); - } - - if (d < 3) { - a = b; - if (a == '\'' || a == '"') { - for (;;) { - r.push(a); - a = get(); - if (a == b) { - break; - } - if (a <= '\n') { - throw 'Error: unterminated string literal: ' + a; - } - if (a == '\\') { - r.push(a); - a = get(); - } - } - } - } - - b = next(); - - if (b == '/' && '(,=:[!&|'.has(a)) { - r.push(a); - r.push(b); - for (;;) { - a = get(); - if (a == '/') { - break; - } else if (a =='\\') { - r.push(a); - a = get(); - } else if (a <= '\n') { - throw 'Error: unterminated Regular Expression literal'; - } - r.push(a); - } - b = next(); - } - - return r.join(''); - } - - - /* m -- Copy the input to the output, deleting the characters which are - insignificant to JavaScript. Comments will be removed. Tabs will be - replaced with spaces. Carriage returns will be replaced with - linefeeds. - Most spaces and linefeeds will be removed. - */ - - function m() { - - var r = []; - a = '\n'; - - r.push(action(3)); - - while (a != EOF) { - switch (a) { - case ' ': - if (isAlphanum(b)) { - r.push(action(1)); - } else { - r.push(action(2)); - } - break; - case '\n': - switch (b) { - case '{': - case '[': - case '(': - case '+': - case '-': - r.push(action(1)); - break; - case ' ': - r.push(action(3)); - break; - default: - if (isAlphanum(b)) { - r.push(action(1)); - } else { - if (level == 1 && b != '\n') { - r.push(action(1)); - } else { - r.push(action(2)); - } - } - } - break; - default: - switch (b) { - case ' ': - if (isAlphanum(a)) { - r.push(action(1)); - break; - } - r.push(action(3)); - break; - case '\n': - if (level == 1 && a != '\n') { - r.push(action(1)); - } else { - switch (a) { - case '}': - case ']': - case ')': - case '+': - case '-': - case '"': - case '\'': - if (level == 3) { - r.push(action(3)); - } else { - r.push(action(1)); - } - break; - default: - if (isAlphanum(a)) { - r.push(action(1)); - } else { - r.push(action(3)); - } - } - } - break; - default: - r.push(action(1)); - break; - } - } - } - - return r.join(''); - } - - jsmin.oldSize = input.length; - ret = m(input); - jsmin.newSize = ret.length; - - return comment + ret; - -} diff --git a/modules/jala/util/Test/build.gradle b/modules/jala/util/Test/build.gradle deleted file mode 100644 index 7e596efa..00000000 --- a/modules/jala/util/Test/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -dependencies { - runtimeOnly 'org.subethamail:subethasmtp-smtp:1.2' - runtimeOnly 'org.subethamail:subethasmtp-wiser:1.2' -} - -jar.enabled = false -compileJava.enabled = false -compileTestJava.enabled = false -processResources.enabled = false -processTestResources.enabled = false -test.enabled = false - -tasks.register('deps', Copy) { - from sourceSets.main.runtimeClasspath - into 'code' -} diff --git a/modules/jala/util/Test/code/Global/Root.js b/modules/jala/util/Test/code/Global/Root.js deleted file mode 100644 index 86713cc7..00000000 --- a/modules/jala/util/Test/code/Global/Root.js +++ /dev/null @@ -1,53 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Module dependencies - */ -app.addRepository("modules/core/HopObject.js"); -app.addRepository("modules/core/Array.js"); -app.addRepository("modules/helma/File.js"); - -/** - * Test runner - */ -Root.prototype.jala_test_action = function() { - res.handlers.test = new jala.Test(); - if (req.isGet() && req.data.test) { - res.handlers.test.execute(req.data.test); - } else if (req.isPost() && (req.data.test_array || req.data.test)) { - res.handlers.test.execute(req.data.test_array || req.data.test); - } - renderSkin("jala.Test"); - return; -}; - -/** - * External stylesheet for test runner - */ -Root.prototype.jala_test_css_action = function() { - res.contentType = "text/css"; - renderSkin("jala.Test#stylesheet"); - return; -}; diff --git a/modules/jala/util/Test/code/Global/jala.Test.js b/modules/jala/util/Test/code/Global/jala.Test.js deleted file mode 100644 index f171da68..00000000 --- a/modules/jala/util/Test/code/Global/jala.Test.js +++ /dev/null @@ -1,1598 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * @fileoverview Fields and methods of the jala.Test class. - */ - - -// Define the global namespace for Jala modules -if (!global.jala) { - global.jala = {}; -} - -/** - * HelmaLib dependencies - */ -app.addRepository("modules/core/String.js"); -app.addRepository("modules/helma/Http.js"); - -/** - * Jala dependencies - */ -app.addRepository(getProperty("jala.dir", "modules/jala") + - "/code/Database.js"); - -/** - * Constructs a new Test instance. - * @class Provides various methods for automated tests. - * This is essentially a port of JSUnit (http://www.edwardh.com/jsunit/) - * suitable for testing Helma applications. - * @param {Number} capacity The capacity of the cache - * @constructor - */ -jala.Test = function() { - - /** - * Contains the number of tests that were executed - * @type Number - */ - this.testsRun = 0; - - /** - * Contains the number of tests that failed - * @type Boolean - */ - this.testsFailed = 0; - - /** - * Contains the number of test functions that passed - * @type Number - */ - this.functionsPassed = 0; - - /** - * Contains the number of test functions that failed - * @type Number - */ - this.functionsFailed = 0; - - /** - * An Array containing the results of this Test instance. - * @type Array - */ - this.results = []; - - return this; -}; - - - -/************************************************************* - ***** S T A T I C F I E L D S A N D M E T H O D S ***** - *************************************************************/ - - -/** - * Constant indicating "passed" status - * @type String - * @final - */ -jala.Test.PASSED = "passed"; - -/** - * Constant indicating "failed" status - * @type String - * @final - */ -jala.Test.FAILED = "failed"; - -/** - * Helper method useable for displaying a value - * @param {Object} The value to render - * @returns The value rendered as string - * @type String - */ -jala.Test.valueToString = function(val) { - res.push(); - if (val === null) { - res.write("null"); - } else if (val === undefined) { - res.write("undefined"); - } else { - if (typeof(val) == "function") { - // functions can be either JS methods or Java classes - // the latter throws an exception when trying to access a property - try { - res.write(val.name || val); - } catch (e) { - res.write(val); - } - } else { - if (val.constructor && val.constructor == String) { - res.write('"' + encode(val.head(200)) + '"'); - } else { - res.write(val.toString()); - } - res.write(" ("); - if (val.constructor && val.constructor.name != null) { - res.write(val.constructor.name); - } else { - res.write(typeof(val)); - } - res.write(")"); - } - } - return res.pop(); -}; - -/** - * Returns the directory containing the test files. - * The location of the directory is either defined by the - * application property "jala.testDir" or expected to be one level - * above the application directory (and named "tests") - * @returns The directory containing the test files - * @type helma.File - */ -jala.Test.getTestsDirectory = function() { - var dir; - if (getProperty("jala.testDir") != null) { - dir = new helma.File(getProperty("jala.testDir")); - } - if (!dir || !dir.exists()) { - var appDir = new helma.File(app.dir); - dir = new helma.File(appDir.getParent(), "tests"); - if (!dir.exists()) - return null; - } - return dir; -}; - -/** - * Returns an array containing the test files located - * in the directory. - * @returns An array containing the names of all test files - * @type Array - */ -jala.Test.getTestFiles = function() { - var dir; - if ((dir = jala.Test.getTestsDirectory()) != null) { - return dir.list(/.*\.js$/).sort(); - } - return null; -}; - -/** - * Returns the testfile with the given name - * @param {String} fileName The name of the test file - * @returns The test file - * @type helma.File - */ -jala.Test.getTestFile = function(fileName) { - var dir = jala.Test.getTestsDirectory(); - if (dir != null) { - return new helma.File(dir, fileName); - } - return null; -}; - -/** - * @param {Number} nr The number of arguments to be expected - * @param {Object} args The arguments array. - * @returns True in case the number of arguments matches - * the expected amount, false otherwise. - * @type Boolean - */ -jala.Test.evalArguments = function(args, argsExpected) { - if (!(args.length == argsExpected || - (args.length == argsExpected + 1 && typeof(args[0]) == "string"))) { - throw new jala.Test.ArgumentsException("Insufficient arguments passed to assertion function"); - } - return; -}; - -/** - * Returns true if the arguments array passed as argument - * contains an additional comment. - * @param {Array} args The arguments array to check for an existing comment. - * @param {Number} argsExpected The number of arguments expected by the - * assertion function. - * @returns True if the arguments contain a comment, false otherwise. - * @type Boolean - */ -jala.Test.argsContainComment = function(args, argsExpected) { - return !(args.length <= argsExpected - || (args.length == argsExpected + 1 && typeof(args[0]) != "string")) -}; - -/** - * Cuts out the comment from the arguments array passed - * as argument and returns it. CAUTION: this actually modifies - * the arguments array! - * @param {Array} args The arguments array. - * @returns The comment, if existing. Null otherwise. - * @type String - */ -jala.Test.getComment = function(args, argsExpected) { - if (jala.Test.argsContainComment(args, argsExpected)) - return args[0]; - return null; -}; - -/** - * Returns the argument on the index position in the array - * passed as arguments. This method respects an optional comment - * at the beginning of the arguments array. - * @param {Array} args The arguments to retrieve the non-comment - * value from. - * @param {Number} idx The index position on which the value to - * retrieve is to be expected if no comment is existing. - * @returns The non-comment value, or null. - * @type Object - */ -jala.Test.getValue = function(args, argsExpected, idx) { - return jala.Test.argsContainComment(args, argsExpected) ? args[idx+1] : args[idx]; -}; - - -/** - * Creates a stack trace and parses it for display. - * @param {java.lang.StackTraceElement} trace The trace to parse. If not given - * a stacktrace will be generated - * @returns The parsed stack trace - * @type String - */ -jala.Test.getStackTrace = function(trace) { - /** - * Private method for filtering out only JS parts of the stack trace - * @param {Object} name - */ - var accept = function(name) { - return name.endsWith(".js") || name.endsWith(".hac") || - name.endsWith(".hsp"); - }; - - // create exception and fill in stack trace - if (!trace) { - var ex = new Packages.org.mozilla.javascript.EvaluatorException(""); - ex.fillInStackTrace(); - trace = ex.getStackTrace(); - } - var stack = []; - var el, fileName, lineNumber; - // parse the stack trace and keep only the js elements - var inTrace = false; - for (var i=trace.length; i>0; i--) { - el = trace[i-1]; - fileName = el.getFileName(); - lineNumber = el.getLineNumber(); - if (fileName != null && lineNumber > -1 && accept(fileName)) { - if (fileName.endsWith(res.meta.currentTest)) { - inTrace = true; - } - if (inTrace == true) { - // ignore all trace lines that refer to jala.Test - if (fileName.endsWith("jala.Test.js")) { - break; - } - stack.push("at " + fileName + ":" + lineNumber); - } - } - } - return stack.reverse().join("\n"); -}; - -/** - * Adds all assertion methods, the http client, test database manager and - * smpt server to the per-thread global object. - * @private - */ -jala.Test.prepareTestScope = function() { - // define global assertion functions - for (var i in jala.Test.prototype) { - if (i.indexOf("assert") == 0) { - global[i] = jala.Test.prototype[i]; - } - } - // add global include method - global.include = function(file) { - jala.Test.include(global, file); - return; - }; - // instantiate a global HttpClient - global.httpClient = new jala.Test.HttpClient(); - // instantiate the test database manager - global.testDatabases = new jala.Test.DatabaseMgr(); - // instantiate the smtp server - global.smtpServer = new jala.Test.SmtpServer(); - return; -}; - -/** - * Evaluates a javascript file in the global test scope. This method can be used - * to include generic testing code in test files. This method is available as - * global method "include" for all test methods - * @param {Object} scope The scope in which the file should be evaluated - * @param {String} fileName The name of the file to include, including the path - */ -jala.Test.include = function(scope, file) { - var file = new helma.File(file); - var fileName = file.getName(); - if (file.canRead() && file.exists()) { - var cx = Packages.org.mozilla.javascript.Context.enter(); - var code = new java.lang.String(file.readAll() || ""); - cx.evaluateString(scope, code, fileName, 1, null); - } - return; -}; - - - -/******************************* - ***** E X C E P T I O N S ***** - *******************************/ - - -/** - * Creates a new Exception instance - * @class Base exception class - * @returns A newly created Exception instance - * @constructor - */ -jala.Test.Exception = function Exception() { - return this; -}; - -/** @ignore */ -jala.Test.Exception.prototype.toString = function() { - return "[jala.Test.Exception: " + this.message + "]"; -}; - -/** - * Creates a new TestException instance - * @class Instances of this exception are thrown whenever an - * assertion function fails - * @param {String} comment An optional comment - * @param {String} message The failure message - * @returns A newly created TestException instance - * @constructor - */ -jala.Test.TestException = function TestException(comment, message) { - this.functionName = null; - this.comment = comment; - this.message = message; - this.stackTrace = jala.Test.getStackTrace(); - return this; -}; -jala.Test.TestException.prototype = new jala.Test.Exception(); - -/** @ignore */ -jala.Test.TestException.prototype.toString = function() { - return "[jala.Test.TestException in " + this.functionName + - ": " + this.message + "]"; -}; - -/** - * Creates a new ArgumentsException instance - * @class Instances of this exception are thrown whenever an assertion - * function is called with incorrect or insufficient arguments - * @param {String} message The failure message - * @returns A newly created ArgumentsException instance - * @constructor - */ -jala.Test.ArgumentsException = function ArgumentsException(message) { - this.functionName = null; - this.message = message; - this.stackTrace = jala.Test.getStackTrace(); - return this; -}; -jala.Test.ArgumentsException.prototype = new jala.Test.Exception(); - -/** @ignore */ -jala.Test.ArgumentsException.prototype.toString = function() { - return "[jala.Test.ArgumentsException in " + this.functionName + - ": " + this.message + "]"; -}; - -/** - * Creates a new EvaluatorException instance - * @class Instances of this exception are thrown when attempt - * to evaluate the test code fails. - * @param {String} message The failure message, or an Error previously - * thrown. - * @param {String} exception An optional nested Error - * @returns A newly created EvaluatorException instance - * @constructor - */ -jala.Test.EvaluatorException = function EvaluatorException(message, exception) { - this.functionName = null; - this.message = null; - this.stackTrace = null; - this.fileName = null; - this.lineNumber = null; - - if (arguments.length == 1 && arguments[0] instanceof Error) { - this.message = ""; - exception = arguments[0]; - } else { - this.message = message; - } - - if (exception != null) { - this.name = exception.name; - if (exception.rhinoException != null) { - var e = exception.rhinoException; - this.message += e.details(); - this.stackTrace = jala.Test.getStackTrace(e.getStackTrace()); - } else if (exception instanceof Error) { - this.message = exception.message; - } - if (!this.stackTrace) { - // got no stack trace, so add at least filename and line number - this.fileName = exception.fileName || null; - this.lineNumber = exception.lineNumber || null; - } - } - - return this; -}; -jala.Test.EvaluatorException.prototype = new jala.Test.Exception(); - -/** @ignore */ -jala.Test.EvaluatorException.prototype.toString = function() { - return "[jala.Test.EvaluatorException: " + this.message + "]"; -}; - - - -/************************************************* - ***** R E S U L T C O N S T R U C T O R S ***** - *************************************************/ - - -/** - * Constructs a new TestResult instance - * @class Instances of this class represent the result of the execution - * of a single test file - * @param {String} testFileName The name of the excecuted test file - * @returns A new TestResult instance - * @constructor - */ -jala.Test.TestResult = function(testFileName) { - this.name = testFileName; - this.elapsed = 0; - this.status = jala.Test.PASSED; - this.log = []; - return this; -}; - -/** - * Constructs a new TestFunctionResult instance - * @class Instances of this class represent the result of the successful - * execution of a single test function (failed executions will be represented - * as Exceptions in the log of a test result). - * @param {String} functionName The name of the excecuted test function - * @param {Date} startTime A Date instance marking the begin of the test - * @returns A new TestFunctionResult instance - * @constructor - */ -jala.Test.TestFunctionResult = function(functionName, startTime) { - this.functionName = functionName; - this.elapsed = (new Date()) - startTime; - return this; -}; - - - -/************************************************* - ***** P R O T O T Y P E F U N C T I O N S ***** - *************************************************/ - - -/** - * Executes a single test file - * @param {helma.File} testFile The file containing the test to run - */ -jala.Test.prototype.executeTest = function(testFile) { - var testFileName = testFile.getName(); - // store the name of the current test in res.meta.currentTest - // as this is needed in getStackTrace - res.meta.currentTest = testFileName; - - var cx = Packages.org.mozilla.javascript.Context.enter(); - var code = new java.lang.String(testFile.readAll() || ""); - var testResult = new jala.Test.TestResult(testFileName); - global.testFunctionIdents = []; - try { - // prepare the test scope - jala.Test.prepareTestScope(); - // evaluate the test file in the per-thread which is garbage - // collected at the end of the test run - cx.evaluateString(global, code, testFileName, 1, null); - for (var ident in global) { - if (ident.startsWith("test") && (global[ident] instanceof Function)) { - testFunctionIdents.push(ident); - } - } - var start = new Date(); - // run all test methods defined in the array "tests" - var functionName; - for (var i=0;i 0) { - for (var i=0;i 0) { - var fileName, skinParam; - for (var i=0;i= 301 && result.code <= 303 && result.location != null) { - // received a redirect location, so follow it - result = this.executeRequest("GET", result.location); - } - return result; -}; - -/** - * Convenience method for requesting the url passed as argument - * using method GET - * @param {String} url The url to request - * @param {Object} param A parameter object to use with this request - * @return An object containing response values - * @see helma.Http.prototype.getUrl - */ -jala.Test.HttpClient.prototype.getUrl = function(url, param) { - return this.executeRequest("GET", url, param); -}; - -/** - * Convenience method for submitting a form. - * @param {String} url The url to request - * @param {Object} param A parameter object to use with this request - * @return An object containing response values - * @see helma.Http.prototype.getUrl - */ -jala.Test.HttpClient.prototype.submitForm = function(url, param) { - return this.executeRequest("POST", url, param); -}; - -/** @ignore */ -jala.Test.HttpClient.prototype.toString = function() { - return "[jala.Test.HttpClient]"; -}; - - - - -/***************************************************** - ***** T E S T D A T A B A S E M A N A G E R ***** - *****************************************************/ - - -/** - * Returns a newly created DatabaseMgr instance - * @class Instances of this class allow managing test databases - * and switching a running application to an in-memory test - * database to use within a unit test. - * @returns A newly created instance of DatabaseMgr - * @constructor - */ -jala.Test.DatabaseMgr = function() { - /** - * Map containing all test databases - */ - this.databases = {}; - - /** - * Map containing the original datasource - * properties that were temporarily deactivated - * by activating a test database - */ - this.dbSourceProperties = {}; - - return this; -}; - -jala.Test.DatabaseMgr.prototype.toString = function() { - return "[jala.Test DatabaseMgr]"; -}; - -/** - * Returns a newly initialized in-memory test database with the given name - * @param {String} name The name of the test database - * @returns The newly initialized test database - * @type jala.db.RamDatabase - */ -jala.Test.DatabaseMgr.prototype.initDatabase = function(name) { - return new jala.db.RamDatabase(name); -}; - -/** - * Switches the application to the test database passed as argument. - * In addition this method clears the application cache and invalidates - * the root object. - * @param {jala.db.RamDatabase} testDb The test database to switch to. - * @param {String} dbSourceName Optional name of the application's database - * source that will be replaced by the test database. - */ -jala.Test.DatabaseMgr.prototype.switchToDatabase = function(testDb, dbSourceName) { - var dbName = dbSourceName || testDb.getName(); - // switch the datasource to the test database - var dbSource = app.getDbSource(dbName); - var oldProps = dbSource.switchProperties(testDb.getProperties()); - // store the old db properties in this manager for use in stopAll() - this.databases[dbName] = testDb; - this.dbSourceProperties[dbName] = oldProps; - // clear the application cache and invalidate root - app.clearCache(); - root.invalidate(); - return; -}; - -/** - * Switches the application datasource with the given name - * to a newly created in-memory database. In addition this method - * also clears the application cache and invalidates the root - * object to ensure that everything is re-retrieved from the - * test database. - * This method can be called with a second boolean argument indicating - * that tables used by the application should be created in the in-memory - * database (excluding any data). - * @param {String} dbSourceName The name of the application database - * source as defined in db.properties - * @param {Boolean} copyTables If true this method also copies all - * tables in the source database to the test database (excluding - * indexes). - * @param {Array} tables An optional array containing table names that - * should be created in the test database. If not specified this method - * collects all tables that are mapped in the application. - * @returns The test database - * @type jala.db.RamDatabase - */ -jala.Test.DatabaseMgr.prototype.startDatabase = function(dbSourceName, copyTables, tables) { - try { - var testDb = this.initDatabase(dbSourceName); - // switch the datasource to the test database - var dbSource = app.getDbSource(dbSourceName); - if (copyTables === true) { - if (tables === null || tables === undefined) { - // collect the table names of all relational prototypes - tables = []; - var protos = app.getPrototypes(); - for (let proto of protos) { - var dbMap = proto.getDbMapping(); - if (dbMap.isRelational()) { - tables.push(dbMap.getTableName()); - } - } - } - testDb.copyTables(dbSource, tables); - } - this.switchToDatabase(testDb); - return testDb; - } catch (e) { - throw new jala.Test.EvaluatorException("Unable to switch to test database because of ", e); - } -}; - -/** - * Stops all registered test databases and and reverts the application - * to its original datasource(s) as defined in db.properties file. - * In addition this method rolls back all pending changes within the request, - * clears the application cache and invalidates the root object - * to ensure no traces of the test database are left behind. - */ -jala.Test.DatabaseMgr.prototype.stopAll = function() { - // throw away all pending transactions - res.rollback(); - try { - // loop over all registered databases and revert the appropriate - // datasource back to the original database - var testDb, dbSource; - for (var dbSourceName in this.databases) { - testDb = this.databases[dbSourceName]; - dbSource = app.getDbSource(dbSourceName); - dbSource.switchProperties(this.dbSourceProperties[dbSourceName]); - testDb.shutdown(); - } - // clear the application cache and invalidate root - app.clearCache(); - root.invalidate(); - } catch (e) { - throw new jala.Test.EvaluatorException("Unable to stop test databases because of ", e); - } - return; -}; - - - -/********************************* - ***** S M T P S E R V E R ***** - *********************************/ - - -/** - * Creates a new SmtpServer instance - * @class Instances of this class represent an SMTP server listening on - * localhost. By default jala.Test will create a global variable called - * "smtpServer" that contains an instance of this class. To use the server call - * {@link #start} in a test method (eg. in the basic setup method) and - * {@link #stop} in the cleanup method. - * @param {Number} port Optional port to listen on (defaults to 25) - * @returns A newly created SmtpServer instance - * @constructor - */ -jala.Test.SmtpServer = function(port) { - var server = null; - - var oldSmtpServer = null; - - /** - * Starts the SMTP server. Note that this method switches the SMTP server as - * defined in app.properties of the tested application or server.properties - * to "localhost" to ensure that all mails sent during tests are received - * by this server. The SMTP server definition is switched back to the - * original when {@link #stop} is called. - */ - this.start = function() { - server = new Packages.org.subethamail.wiser.Wiser() - // listen only on localhost - server.setHostname("localhost"); - if (port != null && !isNaN(port)) { - server.setPort(port); - } - // switch smtp property of tested application - oldSmtpServer = getProperty("smtp"); - app.__app__.getProperties().put("smtp", "localhost"); - server.start(); - return; - }; - - /** - * Stops the SMTP server and switches the "smtp" property of the tested - * application back to the value defined in app or server.properties - */ - this.stop = function() { - server.stop(); - server = null; - // switch back to original SMTP server address - var props = app.__app__.getProperties(); - if (oldSmtpServer != null) { - props.put("smtp", oldSmtpServer); - } else { - props.remove("smtp"); - } - return; - }; - - /** - * Returns an array containing all mails received by the server, - * where each one is an instance of {@link jala.Test.SmtpServer.Message} - * @returns An array with all messages - * @type Array - */ - this.getMessages = function() { - var it = server.getMessages().listIterator(); - var result = []; - while (it.hasNext()) { - result.push(new jala.Test.SmtpServer.Message(it.next())); - } - return result; - }; - - return this; -}; - -/** @ignore */ -jala.Test.SmtpServer.prototype.toString = function() { - return "[Jala Test SmtpServer]"; -}; - -/** - * Creates a new Mail instance - * @class Instances of this class represent a mail message received - * by the SMTP server - * @param {org.subethamail.wiser.WiserMessage} message The message - * as received by the SMTP server - * @returns A newly created Mail instance - * @constructor - */ -jala.Test.SmtpServer.Message = function(message) { - /** - * The wrapped message as MimeMessage instance - * @type javax.mail.internet.MimeMessage - * @private - */ - var mimeMessage = message.getMimeMessage(); - - /** - * Returns the wrapped message - * @type org.subethamail.wiser.WiserMessage - */ - this.getMessage = function() { - return message; - }; - - /** - * Returns the wrapped message as MimeMessage - * @type javax.mail.internet.MimeMessage - */ - this.getMimeMessage = function() { - return mimeMessage; - }; - - return this; -}; - -/** @ignore */ -jala.Test.SmtpServer.Message.prototype.toString = function() { - return "[Jala Test Mail]"; -}; - -/** - * Returns an array containing all senders of this mail - * @returns An array with all senders of this mail - * @type Array - */ -jala.Test.SmtpServer.Message.prototype.getFrom = function() { - var result = []; - this.getMimeMessage().getFrom().forEach(function(addr) { - result.push(addr.toString()) - }); - return result; -}; - -/** - * Returns an array containing all recipients of this mail - * @returns An array with all recipients of this mail - * @type Array - */ -jala.Test.SmtpServer.Message.prototype.getTo = function() { - var type = Packages.javax.mail.internet.MimeMessage.RecipientType.TO; - var result = []; - this.getMimeMessage().getRecipients(type).forEach(function(addr) { - result.push(addr.toString()) - }); - return result; -}; - -/** - * Returns an array containing all CC recipients of this mail - * @returns An array with all CC recipients of this mail - * @type Array - */ -jala.Test.SmtpServer.Message.prototype.getCc = function() { - var type = Packages.javax.mail.internet.MimeMessage.RecipientType.CC; - var result = []; - this.getMimeMessage().getRecipients(type).forEach(function(addr) { - result.push(addr.toString()) - }); - return result; -}; - -/** - * Returns an array with all reply-to addresses of this mail - * @returns An array with all reply-to addresses of this mail - * @type Array - */ -jala.Test.SmtpServer.Message.prototype.getReplyTo = function() { - var result = []; - this.getMimeMessage().getReplyTo().forEach(function(addr) { - result.push(addr.toString()) - }); - return result; -}; - -/** - * Returns the encoding of this mail as defined in the "Content-Transfer-Encoding" - * header field - * @returns The encoding of this mail - * @type String - */ -jala.Test.SmtpServer.Message.prototype.getEncoding = function() { - return this.getMimeMessage().getEncoding(); -}; - -/** - * Returns the subject of this mail - * @returns The subject of this mail - * @type String - */ -jala.Test.SmtpServer.Message.prototype.getSubject = function() { - return this.getMimeMessage().getSubject(); -}; - -/** - * Returns the content of this mail - * @returns The content of this mail - */ -jala.Test.SmtpServer.Message.prototype.getContent = function() { - return this.getMimeMessage().getContent(); -}; - -/** - * Returns the content type of this mail as defined in the "Content-Type" - * header field - * @returns The content type of this mail - * @type String - */ -jala.Test.SmtpServer.Message.prototype.getContentType = function() { - return this.getMimeMessage().getContentType(); -}; diff --git a/modules/jala/util/Test/code/Global/jala.Test.skin b/modules/jala/util/Test/code/Global/jala.Test.skin deleted file mode 100644 index e03b8647..00000000 --- a/modules/jala/util/Test/code/Global/jala.Test.skin +++ /dev/null @@ -1,294 +0,0 @@ -<% -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// -%> - - - -Jala Unit Test Runner -" /> - - - -
      -
      Jala Unit Test Runner
      -
      <% test.directory prefix="Tests: " %>
      -
      -
      -
      -
      "> - <% test.list prefix='

      Available Tests

      ' %> -
      -
      -
      - - - - - - - - - - - - - -
      TestsFunctions
      <% test.testsRun %> run<% test.functionsPassed %> passed
      <% test.testsFailed %> failed<% test.functionsFailed %> failed
      - <% test.results %> -
      -
      - - - - - -<% #result ------------------------------------------------------------------ %> - -

      Results of '<% param.name %>':

      -<% param.log prefix="
      " suffix="
      " %> - - - -<% #item -------------------------------------------------------------------- %> - -
    • - /><% param.name %> -
    • - - - -<% #logFailed --------------------------------------------------------------- %> - -
      Error
      -
      - <% param.functionName prefix='' suffix='()' %> -
      <% param.name suffix=": " %><% param.message %>
      -
      <% param.comment %>
      -
      <% param.fileName prefix="at " %><% param.lineNumber prefix=":" %>
      -
      <% param.stackTrace encoding="html" %>
      -
      - - - -<% #logPassed --------------------------------------------------------------- %> - -
      Passed
      -
      <% param.functionName %>()(in <% param.elapsed %> ms)
      - - - -<% #stylesheet -------------------------------------------------------------- %> - -body { - font-family: Verdana, Arial, Helvetica; - font-size: 0.85em; - margin: 0; - padding: 0; -} - -a { - text-decoration: none; - color: #333; -} - -a:hover { - text-decoration: underline; -} - -div.header { - background-color: #aaa; - border-bottom: 1px solid #333; - font-size: 18px; - font-weight: bold; - color: #ddd; - padding: 10px 20px; -} - -div.header div.title { - float: left; - font-size: 18px; - font-weight: bold; - color: #ddd; -} - -div.header div.directory { - text-align: right; - font-size: 11px; - font-weight: normal; - color: #eee; - padding: 5px; -} - -div.main { - margin: 20px; -} - -div.footer { - margin-top: 400px; - padding: 10px 0 10px 20px; - clear: both; - background-color: #eee; - font-size: 0.7em; - color: #999; -} - -div.list { - float: left; - width: 200px; - padding-right: 30px; - border-right: 1px solid #ccc; -} - -div.list h4 { - margin: 0; - padding: 0 0 10px 0; - font-size: 1em; -} - -div.list form { - margin: 0; - padding: 0; -} - -div.list ul { - list-style-type: none; - margin: 0; - padding: 0; -} - -div.list ul li { - padding: 0; - margin-top:1px; - font-size: 0.95em; -} - -div.list .submit { - margin: 15px 0 0 0; - padding: 0 10px; - border: 1px solid gray; -} - -div.result { - margin-left: 250px; - padding-left: 20px; -} - -/** statistics **/ - -table.statistics { - xborder: 1px solid black; - border-collapse: collapse; -} - -table.statistics th { - text-align: left; - font-size: 0.9em; -} - -table.statistics td { - padding-right: 15px; - color: #666; -} - -table.statistics span.passed { - color: #009900; - font-weight: bold; -} - -table.statistics span.failed { - color: #cc0000; - font-weight: bold; -} - -/** result formattings **/ - -div.result h4 { - font-size: 1em; - font-weight: bold; - border-top: 1px solid #ccc; - padding-top: 20px; -} - -dt { - float: left; -} - -dt.test { - width: 70px; - padding: 2px 10px; -} - -dt.passed { - background-color:#33cc33; - font-size: 0.9em; -} - -dt.error { - background-color:#cc0000; - color: #efefef; - font-size: 0.9em; -} - -dd { - font-size: 0.95em; - margin: 0 0 10px 100px; - padding: 2px; -} - - -span.title, span.function { - width: 200px; - padding-right:10px; -} - -span.function { - font-style: italic; -} - -span.elapsed { - font-size: 0.9em; -} diff --git a/modules/jala/util/Test/code/subethasmtp-smtp-1.2.jar b/modules/jala/util/Test/code/subethasmtp-smtp-1.2.jar deleted file mode 100644 index 3af4aa44..00000000 Binary files a/modules/jala/util/Test/code/subethasmtp-smtp-1.2.jar and /dev/null differ diff --git a/modules/jala/util/Test/code/subethasmtp-wiser-1.2.jar b/modules/jala/util/Test/code/subethasmtp-wiser-1.2.jar deleted file mode 100644 index 200cf39e..00000000 Binary files a/modules/jala/util/Test/code/subethasmtp-wiser-1.2.jar and /dev/null differ diff --git a/modules/jala/util/Test/code/subethasmtp.license.txt b/modules/jala/util/Test/code/subethasmtp.license.txt deleted file mode 100644 index 8b3eb3ad..00000000 --- a/modules/jala/util/Test/code/subethasmtp.license.txt +++ /dev/null @@ -1,204 +0,0 @@ -SubEthaSMTP - A SMTP mail server -Copyright (C) 2006-2007 SubEthaMail.org - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/jala/util/Test/docs/Root.html b/modules/jala/util/Test/docs/Root.html deleted file mode 100644 index 22ffee06..00000000 --- a/modules/jala/util/Test/docs/Root.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - - -Root - - - - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - -
      - - -

      Class Root

      -
      Object
      -   |
      -   +--Root
      -
      - - -
      -
      - -
      class - Root - - -
      - -
      - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - -
      -Method Summary
      - -  void - - - - - jala_test_action() - -
      -            - Test runner -
      - -  void - - - - - jala_test_css_action() - -
      -            - External stylesheet for test runner -
      - - - -

      - - - - - - - - - - - - - - - - - -


      - - - - - - - - - - - - -
      - Method Detail -
      - - - - -

      jala_test_action

      -
      void jala_test_action()
      - -
        Test runner
      - - - - - - - - - - - -
      - - -

      jala_test_css_action

      -
      void jala_test_css_action()
      - -
        External stylesheet for test runner
      - - - - - - - - - - - -
      - - - - - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - - - -
      - - - -
      Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
      - - diff --git a/modules/jala/util/Test/docs/allclasses-frame.html b/modules/jala/util/Test/docs/allclasses-frame.html deleted file mode 100644 index 277e728e..00000000 --- a/modules/jala/util/Test/docs/allclasses-frame.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - All Classes - - - - - - -

      - -All Classes -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      jala -
      -
      jala.Test -
      -
      jala.Test.ArgumentsException -
      -
      jala.Test.DatabaseMgr -
      -
      jala.Test.EvaluatorException -
      -
      jala.Test.Exception -
      -
      jala.Test.HttpClient -
      -
      jala.Test.SmtpServer -
      -
      jala.Test.SmtpServer.Message -
      -
      jala.Test.TestException -
      -
      jala.Test.TestFunctionResult -
      -
      jala.Test.TestResult -
      -
      Root -
      -
      - - - diff --git a/modules/jala/util/Test/docs/allclasses-noframe.html b/modules/jala/util/Test/docs/allclasses-noframe.html deleted file mode 100644 index 7c79845a..00000000 --- a/modules/jala/util/Test/docs/allclasses-noframe.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - -Jala Test All Classes - - - - - - -

      Jala Test

      - -All Classes -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      jala -
      -
      jala.Test -
      -
      jala.Test.ArgumentsException -
      -
      jala.Test.DatabaseMgr -
      -
      jala.Test.EvaluatorException -
      -
      jala.Test.Exception -
      -
      jala.Test.HttpClient -
      -
      jala.Test.SmtpServer -
      -
      jala.Test.SmtpServer.Message -
      -
      jala.Test.TestException -
      -
      jala.Test.TestFunctionResult -
      -
      jala.Test.TestResult -
      -
      Root -
      -
      - - - diff --git a/modules/jala/util/Test/docs/constant-values.html b/modules/jala/util/Test/docs/constant-values.html deleted file mode 100644 index 519a296e..00000000 --- a/modules/jala/util/Test/docs/constant-values.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - -Jala Test Constant Values - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - - -
      -

      Constant Field Values

      -
      - - -
      - - - - - - - - - - - - - - - - - - - -
      - jala.Test -
      PASSED"passed"
      FAILED"failed"
      -

      - -

      - - -


      - - - - - - - - - - - - - -
      -Jala Test - -
      - - -
      - - - -
      Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
      - - diff --git a/modules/jala/util/Test/docs/help-doc.html b/modules/jala/util/Test/docs/help-doc.html deleted file mode 100644 index 8ecda993..00000000 --- a/modules/jala/util/Test/docs/help-doc.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - -Jala Test API Help - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - - -
      -
      -

      -How This API Document Is Organized

      -
      -This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

      -Class

      -
      - -

      -Each class has its own separate page. Each of these pages has three sections consisting of a class description, summary tables, and detailed member descriptions:

        -
      • Class inheritance diagram
      • Direct Subclasses
      • Class declaration
      • Class description -

        -

      • Field Summary
      • Constructor Summary
      • Method Summary -

        -

      • Field Detail
      • Constructor Detail
      • Method Detail
      -Each summary entry contains the first sentence from the detailed description for that item.
      - - -

      -Index

      -
      -The Index contains an alphabetic list of all classes, constructors, methods, and fields.
      -

      -Prev/Next

      -These links take you to the next or previous class, interface, package, or related page.

      -Frames/No Frames

      -These links show and hide the HTML frames. All pages are available with or without frames. -

      - - -This help file applies to API documentation generated using the standard doclet. - -
      -


      - - - - - - - - - - - - - -
      -Jala Test - -
      - - -
      - - - -
      Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
      - - diff --git a/modules/jala/util/Test/docs/index-all.html b/modules/jala/util/Test/docs/index-all.html deleted file mode 100644 index 96b11df9..00000000 --- a/modules/jala/util/Test/docs/index-all.html +++ /dev/null @@ -1,771 +0,0 @@ - - - - - -Index () - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - - -A D E F G I J L N P R S T V -
      - - -

      -A

      - -
      -
      argsContainComment(args, argsExpected) - -Class method in class jala.Test -
        -
      - -
      -
      assertEqual(val1, val2) - -Instance method in class jala.Test -
        -
      - -
      -
      assertEqualFile(val, file) - -Instance method in class jala.Test -
        -
      - -
      -
      assertFalse(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertMatch(val, rxp) - -Instance method in class jala.Test -
        -
      - -
      -
      assertNaN(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertNotEqual(val1, val2) - -Instance method in class jala.Test -
        -
      - -
      -
      assertNotNaN(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertNotNull(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertNotUndefined(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertNull(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertStringContains(val, str) - -Instance method in class jala.Test -
        -
      - -
      -
      assertThrows(func, exception) - -Instance method in class jala.Test -
        -
      - -
      -
      assertTrue(val) - -Instance method in class jala.Test -
        -
      - -
      -
      assertUndefined(val) - -Instance method in class jala.Test -
        -
      - -
      - -

      -D

      - -
      -
      databases - -Instance field in class jala.Test.DatabaseMgr -
        -
      - -
      -
      dbSourceProperties - -Instance field in class jala.Test.DatabaseMgr -
        -
      - -
      -
      directory_macro() - -Instance method in class jala.Test -
        -
      - -
      - -

      -E

      - -
      -
      elapsed - -Instance field in class jala.Test.TestFunctionResult -
        -
      - -
      -
      elapsed - -Instance field in class jala.Test.TestResult -
        -
      - -
      -
      evalArguments(args, argsExpected) - -Class method in class jala.Test -
        -
      - -
      -
      execute(what) - -Instance method in class jala.Test -
        -
      - -
      -
      executeRequest(method, url, param) - -Instance method in class jala.Test.HttpClient -
        -
      - -
      -
      executeTest(testFile) - -Instance method in class jala.Test -
        -
      - -
      -
      executeTestFunction(functionName, scope) - -Instance method in class jala.Test -
        -
      - -
      - -

      -F

      - -
      -
      FAILED - -Class field in class jala.Test -
        -
      - -
      -
      functionName - -Instance field in class jala.Test.TestFunctionResult -
        -
      - -
      -
      functionsFailed - -Instance field in class jala.Test -
        -
      - -
      -
      functionsPassed - -Instance field in class jala.Test -
        -
      - -
      - -

      -G

      - -
      -
      getCc() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getClient() - -Instance method in class jala.Test.HttpClient -
        -
      - -
      -
      getComment(args, argsExpected) - -Class method in class jala.Test -
        -
      - -
      -
      getContent() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getContentType() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getCookies() - -Instance method in class jala.Test.HttpClient -
        -
      - -
      -
      getEncoding() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getFrom() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getMessage() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getMessages() - -Instance method in class jala.Test.SmtpServer -
        -
      - -
      -
      getMimeMessage() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getReplyTo() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getStackTrace(trace) - -Class method in class jala.Test -
        -
      - -
      -
      getSubject() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getTestFile(fileName) - -Class method in class jala.Test -
        -
      - -
      -
      getTestFiles() - -Class method in class jala.Test -
        -
      - -
      -
      getTestsDirectory() - -Class method in class jala.Test -
        -
      - -
      -
      getTo() - -Instance method in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      getUrl(url, param) - -Instance method in class jala.Test.HttpClient -
        -
      - -
      -
      getValue(args, argsExpected, idx) - -Class method in class jala.Test -
        -
      - -
      - -

      -I

      - -
      -
      include(scope, file) - -Class method in class jala.Test -
        -
      - -
      - -

      -J

      - -
      -
      jala - - class jala -
        -
      - -
      -
      jala.Test - - class jala.Test -
        -
      - -
      -
      jala.Test() - -Constructor in class jala.Test -
        -
      - -
      -
      jala.Test.ArgumentsException - - class jala.Test.ArgumentsException -
        -
      - -
      -
      jala.Test.ArgumentsException(message) - -Constructor in class jala.Test.ArgumentsException -
        -
      - -
      -
      jala.Test.DatabaseMgr - - class jala.Test.DatabaseMgr -
        -
      - -
      -
      jala.Test.DatabaseMgr() - -Constructor in class jala.Test.DatabaseMgr -
        -
      - -
      -
      jala.Test.EvaluatorException - - class jala.Test.EvaluatorException -
        -
      - -
      -
      jala.Test.EvaluatorException(message, exception) - -Constructor in class jala.Test.EvaluatorException -
        -
      - -
      -
      jala.Test.Exception - - class jala.Test.Exception -
        -
      - -
      -
      jala.Test.Exception() - -Constructor in class jala.Test.Exception -
        -
      - -
      -
      jala.Test.HttpClient - - class jala.Test.HttpClient -
        -
      - -
      -
      jala.Test.HttpClient() - -Constructor in class jala.Test.HttpClient -
        -
      - -
      -
      jala.Test.SmtpServer - - class jala.Test.SmtpServer -
        -
      - -
      -
      jala.Test.SmtpServer(port) - -Constructor in class jala.Test.SmtpServer -
        -
      - -
      -
      jala.Test.SmtpServer.Message - - class jala.Test.SmtpServer.Message -
        -
      - -
      -
      jala.Test.SmtpServer.Message(message) - -Constructor in class jala.Test.SmtpServer.Message -
        -
      - -
      -
      jala.Test.TestException - - class jala.Test.TestException -
        -
      - -
      -
      jala.Test.TestException(comment, message) - -Constructor in class jala.Test.TestException -
        -
      - -
      -
      jala.Test.TestFunctionResult - - class jala.Test.TestFunctionResult -
        -
      - -
      -
      jala.Test.TestFunctionResult(functionName, startTime) - -Constructor in class jala.Test.TestFunctionResult -
        -
      - -
      -
      jala.Test.TestResult - - class jala.Test.TestResult -
        -
      - -
      -
      jala.Test.TestResult(testFileName) - -Constructor in class jala.Test.TestResult -
        -
      - -
      -
      jala_test_action() - -Instance method in class Root -
        -
      - -
      -
      jala_test_css_action() - -Instance method in class Root -
        -
      - -
      - -

      -L

      - -
      -
      list_macro() - -Instance method in class jala.Test -
        -
      - -
      -
      log - -Instance field in class jala.Test.TestResult -
        -
      - -
      - -

      -N

      - -
      -
      name - -Instance field in class jala.Test.TestResult -
        -
      - -
      - -

      -P

      - -
      -
      PASSED - -Class field in class jala.Test -
        -
      - -
      - -

      -R

      - -
      -
      renderResult(result) - -Instance method in class jala.Test -
        -
      - -
      -
      renderResults() - -Instance method in class jala.Test -
        -
      - -
      -
      results - -Instance field in class jala.Test -
        -
      - -
      -
      results_macro() - -Instance method in class jala.Test -
        -
      - -
      -
      Root - - class Root -
        -
      - -
      - -

      -S

      - -
      -
      setCookies(arr) - -Instance method in class jala.Test.HttpClient -
        -
      - -
      -
      start() - -Instance method in class jala.Test.SmtpServer -
        -
      - -
      -
      startDatabase(dbSourceName, copyTables, tables) - -Instance method in class jala.Test.DatabaseMgr -
        -
      - -
      -
      status - -Instance field in class jala.Test.TestResult -
        -
      - -
      -
      stop() - -Instance method in class jala.Test.SmtpServer -
        -
      - -
      -
      stopAll() - -Instance method in class jala.Test.DatabaseMgr -
        -
      - -
      -
      submitForm(url, param) - -Instance method in class jala.Test.HttpClient -
        -
      - -
      - -

      -T

      - -
      -
      testsFailed - -Instance field in class jala.Test -
        -
      - -
      -
      testsRun - -Instance field in class jala.Test -
        -
      - -
      -
      toString() - -Instance method in class jala.Test.DatabaseMgr -
        -
      - -
      - -

      -V

      - -
      -
      valueToString(val) - -Class method in class jala.Test -
        -
      - -
      - -A D E F G I J L N P R S T V - - - - - - - - - - - - - - -
      -Jala Test - -
      - - -
      - - - -
      Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
      - - diff --git a/modules/jala/util/Test/docs/index.html b/modules/jala/util/Test/docs/index.html deleted file mode 100644 index 8a7b7ade..00000000 --- a/modules/jala/util/Test/docs/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - -Generated Javascript Documentation - - - - - - - - - - - - - - -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to <A HREF="allclasses-frame.html">Non-frame version.</A> - diff --git a/modules/jala/util/Test/docs/jala.Test.ArgumentsException.html b/modules/jala/util/Test/docs/jala.Test.ArgumentsException.html deleted file mode 100644 index a0393e46..00000000 --- a/modules/jala/util/Test/docs/jala.Test.ArgumentsException.html +++ /dev/null @@ -1,276 +0,0 @@ - - - - - -jala.Test.ArgumentsException - - - - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - -
      - - -

      Class jala.Test.ArgumentsException

      -
      Object
      -   |
      -   +--jala.Test.Exception
      -         |
      -         +--jala.Test.ArgumentsException
      -
      - - -
      -
      - -
      class - jala.Test.ArgumentsException - -
      extends jala.Test.Exception - - -
      - -

      -
      Instances of this exception are thrown whenever an assertion - function is called with incorrect or insufficient arguments -
      Defined in Global/jala.Test.js

      -

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - -
      -Constructor Summary
      - - - jala.Test.ArgumentsException - - (<String> message) - -
      -             - Creates a new ArgumentsException instance -
      - - - -  - - - - - -

      - - - - - - - - - - - - - - - -
      - Constructor Detail -
      - -

      -jala.Test.ArgumentsException

      -
      jala.Test.ArgumentsException(<String> message)
      - - -
        - Creates a new ArgumentsException instance -
      - - - -
        - Parameters: - -
          message - The failure message -
        - - -
      - - - - -
        - Returns: -
          - A newly created ArgumentsException instance -
        -
      - - - - - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - - - -
      - - - -
      Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
      - - diff --git a/modules/jala/util/Test/docs/jala.Test.DatabaseMgr.html b/modules/jala/util/Test/docs/jala.Test.DatabaseMgr.html deleted file mode 100644 index ee77071e..00000000 --- a/modules/jala/util/Test/docs/jala.Test.DatabaseMgr.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - -jala.Test.DatabaseMgr - - - - - - - - - - - - - - - - - - - - - -
      -Jala Test - -
      - -
      - - -

      Class jala.Test.DatabaseMgr

      -
      Object
      -   |
      -   +--jala.Test.DatabaseMgr
      -
      - - -
      -
      - -
      class - jala.Test.DatabaseMgr - - -
      - -

      -
      Instances of this class allow managing test databases - and switching a running application to an in-memory test - database to use within a unit test. -
      Defined in Global/jala.Test.js

      -

      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - Field Summary
      -  Objectdatabases -
      -           Map containing all test databases
      -  ObjectdbSourceProperties -
      -           Map containing the original datasource - properties that were temporarily deactivated - by activating a test database
      -   - - - - - - - - - - - - - - - - - -
      -Constructor Summary
      - - - jala.Test.DatabaseMgr - - () - -
      -             - Returns a newly created DatabaseMgr instance -
      - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -Method Summary
      - -  jala.db.RamDatabase - - - - - startDatabase(<String> dbSourceName, <Boolean> copyTables, <Array> tables) - -
      -            - Switches the application datasource with the given name - to a newly created in-memory database. -
      - -  void - - - - - stopAll() - -
      -            - Stops all registered test databases and and reverts the application - to its original datasource(s) as defined in db.properties file. -
      - -  Object - - - - - toString() - -
      -            - -
      - - - -

      - - - - - - - - - - -
      Field Detail
      - - - -

      databases

      -
      Object databases
      -
        - Map containing all test databases - -
      -
      - - -

      dbSourceProperties

      -
      Object dbSourceProperties
      -
        - Map containing the original datasource - properties that were temporarily deactivated - by activating a test database - -
      -
      - - - - - - - - - - - - -
      - Constructor Detail -
      - -

      -jala.Test.DatabaseMgr

      -
      jala.Test.DatabaseMgr()
      - - -
        - Returns a newly created DatabaseMgr instance -
      - - - -
    - - - - -
      - Returns: -
        - A newly created instance of DatabaseMgr -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    startDatabase

    -
    jala.db.RamDatabase startDatabase(<String> dbSourceName, <Boolean> copyTables, <Array> tables)
    - -
      Switches the application datasource with the given name - to a newly created in-memory database. In addition this method - also clears the application cache and invalidates the root - object to ensure that everything is re-retrieved from the - test database. - This method can be called with a second boolean argument indicating - that tables used by the application should be created in the in-memory - database (excluding any data).
    - - - - -
      - Parameters: - -
        dbSourceName - The name of the application database source as defined in db.properties -
      - -
        copyTables - If true this method also copies all tables in the source database to the test database (excluding indexes). -
      - -
        tables - An optional array containing table names that should be created in the test database. If not specified this method collects all tables that are mapped in the application. -
      - -
    - - - - -
      - Returns: -
        - The test database -
      -
    - - - - - -
    - - -

    stopAll

    -
    void stopAll()
    - -
      Stops all registered test databases and and reverts the application - to its original datasource(s) as defined in db.properties file. - In addition this method commits all pending changes within the request, - cleares the application cache and invalidates the root object - to ensure no traces of the test database are left behind.
    - - - - - - - - - - - -
    - - -

    toString

    -
    Object toString()
    - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.EvaluatorException.html b/modules/jala/util/Test/docs/jala.Test.EvaluatorException.html deleted file mode 100644 index d6b8fbb1..00000000 --- a/modules/jala/util/Test/docs/jala.Test.EvaluatorException.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - -jala.Test.EvaluatorException - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.EvaluatorException

    -
    Object
    -   |
    -   +--jala.Test.Exception
    -         |
    -         +--jala.Test.EvaluatorException
    -
    - - -
    -
    - -
    class - jala.Test.EvaluatorException - -
    extends jala.Test.Exception - - -
    - -

    -
    Instances of this exception are thrown when attempt - to evaluate the test code fails. -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.EvaluatorException - - (<String> message, <String> exception) - -
    -             - Creates a new EvaluatorException instance -
    - - - -  - - - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.EvaluatorException

    -
    jala.Test.EvaluatorException(<String> message, <String> exception)
    - - -
      - Creates a new EvaluatorException instance -
    - - - -
      - Parameters: - -
        message - The failure message, or an Error previously thrown. -
      - -
        exception - An optional nested Error -
      - - -
    - - - - -
      - Returns: -
        - A newly created EvaluatorException instance -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.Exception.html b/modules/jala/util/Test/docs/jala.Test.Exception.html deleted file mode 100644 index 8145120c..00000000 --- a/modules/jala/util/Test/docs/jala.Test.Exception.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - -jala.Test.Exception - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.Exception

    -
    Object
    -   |
    -   +--jala.Test.Exception
    -
    - -
    -
    - Direct Known Subclasses: -
    - jala.Test.EvaluatorException, jala.Test.ArgumentsException, jala.Test.TestException -
    -
    - - -
    -
    - -
    class - jala.Test.Exception - - -
    - -

    -
    Base exception class -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.Exception - - () - -
    -             - Creates a new Exception instance -
    - - - -  - - - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.Exception

    -
    jala.Test.Exception()
    - - -
      - Creates a new Exception instance -
    - - - - - - - - -
      - Returns: -
        - A newly created Exception instance -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.HttpClient.html b/modules/jala/util/Test/docs/jala.Test.HttpClient.html deleted file mode 100644 index cbdc5838..00000000 --- a/modules/jala/util/Test/docs/jala.Test.HttpClient.html +++ /dev/null @@ -1,593 +0,0 @@ - - - - - -jala.Test.HttpClient - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.HttpClient

    -
    Object
    -   |
    -   +--jala.Test.HttpClient
    -
    - - -
    -
    - -
    class - jala.Test.HttpClient - - -
    - -

    -
    Instances of this class represent a http client useable for - testing, as any session cookies received by the tested application - are stored and used for subsequent requests, allowing simple "walkthrough" - tests. -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.HttpClient - - () - -
    -             - Constructs a new HttpClient instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Object - - - - - executeRequest(<String> method, <String> url, <Object> param) - -
    -            - Sends a HTTP request to the Url passed as argument -
    - -  helma.Http - - - - - getClient() - -
    -            - Returns the http client used -
    - -  Array - - - - - getCookies() - -
    -            - Returns the cookies set for this http client -
    - -  Object - - - - - getUrl(<String> url, <Object> param) - -
    -            - Convenience method for requesting the url passed as argument - using method GET -
    - -  void - - - - - setCookies(<Array> arr) - -
    -            - Sets the cookie to use for subsequent requests using this client -
    - -  Object - - - - - submitForm(<String> url, <Object> param) - -
    -            - Convenience method for submitting a form. -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.HttpClient

    -
    jala.Test.HttpClient()
    - - -
      - Constructs a new HttpClient instance -
    - - - - - - - - -
      - Returns: -
        - A newly constructed HttpClient -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    executeRequest

    -
    Object executeRequest(<String> method, <String> url, <Object> param)
    - -
      Sends a HTTP request to the Url passed as argument
    - - - - -
      - Parameters: - -
        method - The HTTP method to use -
      - -
        url - The url to request -
      - -
        param - A parameter object to use with this request -
      - -
    - - - - -
      - Returns: -
        - An object containing response values -
      -
    - - - - -
      - See:
        - helma.Http.prototype.getUrl
      -
    - - -
    - - -

    getClient

    -
    helma.Http getClient()
    - -
      Returns the http client used
    - - - - - - - -
      - Returns: -
        - The http client used -
      -
    - - - - - -
    - - -

    getCookies

    -
    Array getCookies()
    - -
      Returns the cookies set for this http client
    - - - - - - - -
      - Returns: -
        - The cookies to use for subsequent requests -
      -
    - - - - - -
    - - -

    getUrl

    -
    Object getUrl(<String> url, <Object> param)
    - -
      Convenience method for requesting the url passed as argument - using method GET
    - - - - -
      - Parameters: - -
        url - The url to request -
      - -
        param - A parameter object to use with this request -
      - -
    - - - - -
      - Returns: -
        - An object containing response values -
      -
    - - - - -
      - See:
        - helma.Http.prototype.getUrl
      -
    - - -
    - - -

    setCookies

    -
    void setCookies(<Array> arr)
    - -
      Sets the cookie to use for subsequent requests using this client
    - - - - -
      - Parameters: - -
        arr - The cookie object as received from helma.Http.getUrl -
      - -
    - - - - - - - - -
    - - -

    submitForm

    -
    Object submitForm(<String> url, <Object> param)
    - -
      Convenience method for submitting a form.
    - - - - -
      - Parameters: - -
        url - The url to request -
      - -
        param - A parameter object to use with this request -
      - -
    - - - - -
      - Returns: -
        - An object containing response values -
      -
    - - - - -
      - See:
        - helma.Http.prototype.getUrl
      -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.SmtpServer.Message.html b/modules/jala/util/Test/docs/jala.Test.SmtpServer.Message.html deleted file mode 100644 index 1093292f..00000000 --- a/modules/jala/util/Test/docs/jala.Test.SmtpServer.Message.html +++ /dev/null @@ -1,705 +0,0 @@ - - - - - -jala.Test.SmtpServer.Message - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.SmtpServer.Message

    -
    Object
    -   |
    -   +--jala.Test.SmtpServer.Message
    -
    - - -
    -
    - -
    class - jala.Test.SmtpServer.Message - - -
    - -

    -
    Instances of this class represent a mail message received - by the SMTP server -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.SmtpServer.Message - - (<org.subethamail.wiser.WiserMessage> message) - -
    -             - Creates a new Mail instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Array - - - - - getCc() - -
    -            - Returns an array containing all CC recipients of this mail -
    - -  Object - - - - - getContent() - -
    -            - Returns the content of this mail -
    - -  String - - - - - getContentType() - -
    -            - Returns the content type of this mail as defined in the "Content-Type" - header field -
    - -  String - - - - - getEncoding() - -
    -            - Returns the encoding of this mail as defined in the "Content-Transfer-Encoding" - header field -
    - -  Array - - - - - getFrom() - -
    -            - Returns an array containing all senders of this mail -
    - -  org.subethamail.wiser.WiserMessage - - - - - getMessage() - -
    -            - Returns the wrapped message -
    - -  javax.mail.internet.MimeMessage - - - - - getMimeMessage() - -
    -            - Returns the wrapped message as MimeMessage -
    - -  Array - - - - - getReplyTo() - -
    -            - Returns an array with all reply-to addresses of this mail -
    - -  String - - - - - getSubject() - -
    -            - Returns the subject of this mail -
    - -  Array - - - - - getTo() - -
    -            - Returns an array containing all recipients of this mail -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.SmtpServer.Message

    -
    jala.Test.SmtpServer.Message(<org.subethamail.wiser.WiserMessage> message)
    - - -
      - Creates a new Mail instance -
    - - - -
      - Parameters: - -
        message - The message as received by the SMTP server -
      - - -
    - - - - -
      - Returns: -
        - A newly created Mail instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getCc

    -
    Array getCc()
    - -
      Returns an array containing all CC recipients of this mail
    - - - - - - - -
      - Returns: -
        - An array with all CC recipients of this mail -
      -
    - - - - - -
    - - -

    getContent

    -
    Object getContent()
    - -
      Returns the content of this mail
    - - - - - - - -
      - Returns: -
        - The content of this mail -
      -
    - - - - - -
    - - -

    getContentType

    -
    String getContentType()
    - -
      Returns the content type of this mail as defined in the "Content-Type" - header field
    - - - - - - - -
      - Returns: -
        - The content type of this mail -
      -
    - - - - - -
    - - -

    getEncoding

    -
    String getEncoding()
    - -
      Returns the encoding of this mail as defined in the "Content-Transfer-Encoding" - header field
    - - - - - - - -
      - Returns: -
        - The encoding of this mail -
      -
    - - - - - -
    - - -

    getFrom

    -
    Array getFrom()
    - -
      Returns an array containing all senders of this mail
    - - - - - - - -
      - Returns: -
        - An array with all senders of this mail -
      -
    - - - - - -
    - - -

    getMessage

    -
    org.subethamail.wiser.WiserMessage getMessage()
    - -
      Returns the wrapped message
    - - - - - - - - - - - -
    - - -

    getMimeMessage

    -
    javax.mail.internet.MimeMessage getMimeMessage()
    - -
      Returns the wrapped message as MimeMessage
    - - - - - - - - - - - -
    - - -

    getReplyTo

    -
    Array getReplyTo()
    - -
      Returns an array with all reply-to addresses of this mail
    - - - - - - - -
      - Returns: -
        - An array with all reply-to addresses of this mail -
      -
    - - - - - -
    - - -

    getSubject

    -
    String getSubject()
    - -
      Returns the subject of this mail
    - - - - - - - -
      - Returns: -
        - The subject of this mail -
      -
    - - - - - -
    - - -

    getTo

    -
    Array getTo()
    - -
      Returns an array containing all recipients of this mail
    - - - - - - - -
      - Returns: -
        - An array with all recipients of this mail -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.SmtpServer.html b/modules/jala/util/Test/docs/jala.Test.SmtpServer.html deleted file mode 100644 index c8d06ecc..00000000 --- a/modules/jala/util/Test/docs/jala.Test.SmtpServer.html +++ /dev/null @@ -1,434 +0,0 @@ - - - - - -jala.Test.SmtpServer - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.SmtpServer

    -
    Object
    -   |
    -   +--jala.Test.SmtpServer
    -
    - - -
    -
    - -
    class - jala.Test.SmtpServer - - -
    - -

    -
    Instances of this class represent an SMTP server listening on - localhost. By default jala.Test will create a global variable called - "smtpServer" that contains an instance of this class. To use the server call - start() in a test method (eg. in the basic setup method) and - stop() in the cleanup method. -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Test.SmtpServer.Message
    -  - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.SmtpServer - - (<Number> port) - -
    -             - Creates a new SmtpServer instance -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  Array - - - - - getMessages() - -
    -            - Returns an array containing all mails received by the server, - where each one is an instance of jala.Test.SmtpServer.Message -
    - -  void - - - - - start() - -
    -            - Starts the SMTP server. -
    - -  void - - - - - stop() - -
    -            - Stops the SMTP server and switches the "smtp" property of the tested - application back to the value defined in app or server.properties -
    - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.SmtpServer

    -
    jala.Test.SmtpServer(<Number> port)
    - - -
      - Creates a new SmtpServer instance -
    - - - -
      - Parameters: - -
        port - Optional port to listen on (defaults to 25) -
      - - -
    - - - - -
      - Returns: -
        - A newly created SmtpServer instance -
      -
    - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    getMessages

    -
    Array getMessages()
    - - - - - - - - - -
      - Returns: -
        - An array with all messages -
      -
    - - - - - -
    - - -

    start

    -
    void start()
    - -
      Starts the SMTP server. Note that this method switches the SMTP server as - defined in app.properties of the tested application or server.properties - to "localhost" to ensure that all mails sent during tests are received - by this server. The SMTP server definition is switched back to the - original when stop() is called.
    - - - - - - - - - - - -
    - - -

    stop

    -
    void stop()
    - -
      Stops the SMTP server and switches the "smtp" property of the tested - application back to the value defined in app or server.properties
    - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.TestException.html b/modules/jala/util/Test/docs/jala.Test.TestException.html deleted file mode 100644 index 98f158fe..00000000 --- a/modules/jala/util/Test/docs/jala.Test.TestException.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - -jala.Test.TestException - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.TestException

    -
    Object
    -   |
    -   +--jala.Test.Exception
    -         |
    -         +--jala.Test.TestException
    -
    - - -
    -
    - -
    class - jala.Test.TestException - -
    extends jala.Test.Exception - - -
    - -

    -
    Instances of this exception are thrown whenever an - assertion function fails -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.TestException - - (<String> comment, <String> message) - -
    -             - Creates a new TestException instance -
    - - - -  - - - - - -

    - - - - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.TestException

    -
    jala.Test.TestException(<String> comment, <String> message)
    - - -
      - Creates a new TestException instance -
    - - - -
      - Parameters: - -
        comment - An optional comment -
      - -
        message - The failure message -
      - - -
    - - - - -
      - Returns: -
        - A newly created TestException instance -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.TestFunctionResult.html b/modules/jala/util/Test/docs/jala.Test.TestFunctionResult.html deleted file mode 100644 index 44590e95..00000000 --- a/modules/jala/util/Test/docs/jala.Test.TestFunctionResult.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - -jala.Test.TestFunctionResult - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.TestFunctionResult

    -
    Object
    -   |
    -   +--jala.Test.TestFunctionResult
    -
    - - -
    -
    - -
    class - jala.Test.TestFunctionResult - - -
    - -

    -
    Instances of this class represent the result of the successful - execution of a single test function (failed executions will be represented - as Exceptions in the log of a test result). -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Objectelapsed -
    -           
    -  ObjectfunctionName -
    -           
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.TestFunctionResult - - (<String> functionName, <Date> startTime) - -
    -             - Constructs a new TestFunctionResult instance -
    - - - -  - - - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    elapsed

    -
    Object elapsed
    -
      - - -
    -
    - - -

    functionName

    -
    Object functionName
    -
      - - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.TestFunctionResult

    -
    jala.Test.TestFunctionResult(<String> functionName, <Date> startTime)
    - - -
      - Constructs a new TestFunctionResult instance -
    - - - -
      - Parameters: - -
        functionName - The name of the excecuted test function -
      - -
        startTime - A Date instance marking the begin of the test -
      - - -
    - - - - -
      - Returns: -
        - A new TestFunctionResult instance -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.TestResult.html b/modules/jala/util/Test/docs/jala.Test.TestResult.html deleted file mode 100644 index 9b631c3b..00000000 --- a/modules/jala/util/Test/docs/jala.Test.TestResult.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - -jala.Test.TestResult - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test.TestResult

    -
    Object
    -   |
    -   +--jala.Test.TestResult
    -
    - - -
    -
    - -
    class - jala.Test.TestResult - - -
    - -

    -
    Instances of this class represent the result of the execution - of a single test file -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  Objectelapsed -
    -           
    -  Objectlog -
    -           
    -  Objectname -
    -           
    -  Objectstatus -
    -           
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test.TestResult - - (<String> testFileName) - -
    -             - Constructs a new TestResult instance -
    - - - -  - - - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    elapsed

    -
    Object elapsed
    -
      - - -
    -
    - - -

    log

    -
    Object log
    -
      - - -
    -
    - - -

    name

    -
    Object name
    -
      - - -
    -
    - - -

    status

    -
    Object status
    -
      - - -
    -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test.TestResult

    -
    jala.Test.TestResult(<String> testFileName)
    - - -
      - Constructs a new TestResult instance -
    - - - -
      - Parameters: - -
        testFileName - The name of the excecuted test file -
      - - -
    - - - - -
      - Returns: -
        - A new TestResult instance -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.Test.html b/modules/jala/util/Test/docs/jala.Test.html deleted file mode 100644 index 73a857e7..00000000 --- a/modules/jala/util/Test/docs/jala.Test.html +++ /dev/null @@ -1,2008 +0,0 @@ - - - - - -jala.Test - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala.Test

    -
    Object
    -   |
    -   +--jala.Test
    -
    - - -
    -
    - -
    class - jala.Test - - -
    - -

    -
    Provides various methods for automated tests. - This is essentially a port of JSUnit (http://www.edwardh.com/jsunit/) - suitable for testing Helma applications. -
    Defined in Global/jala.Test.js

    -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Test.Exception
    - <static class>jala.Test.TestException
    - <static class>jala.Test.ArgumentsException
    - <static class>jala.Test.EvaluatorException
    - <static class>jala.Test.TestResult
    - <static class>jala.Test.TestFunctionResult
    - <static class>jala.Test.HttpClient
    - <static class>jala.Test.DatabaseMgr
    - <static class>jala.Test.SmtpServer
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Field Summary
    -  NumberfunctionsFailed -
    -           Contains the number of test functions that failed
    -  NumberfunctionsPassed -
    -           Contains the number of test functions that passed
    -  Arrayresults -
    -           An Array containing the results of this Test instance.
    -  BooleantestsFailed -
    -           Contains the number of tests that failed
    -  NumbertestsRun -
    -           Contains the number of tests that were executed
    - <static>  <final> StringFAILED -
    -           Constant indicating "failed" status
    - <static>  <final> StringPASSED -
    -           Constant indicating "passed" status
    -   - - - - - - - - - - - - - - - - - -
    -Constructor Summary
    - - - jala.Test - - () - -
    -             - Constructs a new Test instance. -
    - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - -  void - - - - - assertEqual(<Object> val1, <Object> val2) - -
    -            - Checks if the values passed as arguments are equal. -
    - -  void - - - - - assertEqualFile(<Object> val, <String|helma.File> file) - -
    -            - Checks if the value passed as argument equals the content of a file on disk. -
    - -  void - - - - - assertFalse(<Object> val) - -
    -            - Checks if the value passed as argument is boolean false. -
    - -  void - - - - - assertMatch(<String> val, <RegExp> rxp) - -
    -            - Checks if the regular expression matches the string. -
    - -  void - - - - - assertNaN(<Object> val) - -
    -            - Checks if the value passed as argument is NaN. -
    - -  void - - - - - assertNotEqual(<Object> val1, <Object> val2) - -
    -            - Checks if the values passed as arguments are not equal. -
    - -  void - - - - - assertNotNaN(<Object> val) - -
    -            - Checks if the value passed as argument is not NaN. -
    - -  void - - - - - assertNotNull(<Object> val) - -
    -            - Checks if the value passed as argument is not null. -
    - -  void - - - - - assertNotUndefined(<Object> val) - -
    -            - Checks if the value passed as argument is not undefined. -
    - -  void - - - - - assertNull(<Object> val) - -
    -            - Checks if the value passed as argument is null. -
    - -  void - - - - - assertStringContains(<String> val, <String> str) - -
    -            - Checks if the value passed as argument contains the pattern specified. -
    - -  void - - - - - assertThrows(<Object> func, <Object> exception) - -
    -            - Checks if the function passed as argument throws a defined exception. -
    - -  void - - - - - assertTrue(<Object> val) - -
    -            - Checks if the value passed as argument is boolean true. -
    - -  void - - - - - assertUndefined(<Object> val) - -
    -            - Checks if the value passed as argument is undefined. -
    - -  String - - - - - directory_macro() - -
    -            - Returns the absolute path to the directory containing the tests -
    - -  void - - - - - execute(<String|Array> what) - -
    -            - Main test execution function -
    - -  void - - - - - executeTest(<helma.File> testFile) - -
    -            - Executes a single test file -
    - -  Object - - - - - executeTestFunction(<String> functionName, <helma.scripting.rhino.GlobalObject> scope) - -
    -            - Executes a single test function -
    - -  void - - - - - list_macro() - -
    -            - Renders the list of available tests -
    - -  void - - - - - renderResult(result) - -
    -            - Renders the result of a single test -
    - -  void - - - - - renderResults() - -
    -            - Renders the results of all tests done by this test instance - to response. -
    - -  void - - - - - results_macro() - -
    -            - Renders the test results -
    - - <static> Boolean - - - - - argsContainComment(<Array> args, <Number> argsExpected) - -
    -            - Returns true if the arguments array passed as argument - contains an additional comment. -
    - - <static> Boolean - - - - - evalArguments(<Object> args, argsExpected) - -
    -            - -
    - - <static> String - - - - - getComment(<Array> args, argsExpected) - -
    -            - Cuts out the comment from the arguments array passed - as argument and returns it. -
    - - <static> String - - - - - getStackTrace(<java.lang.StackTraceElement> trace) - -
    -            - Creates a stack trace and parses it for display. -
    - - <static> helma.File - - - - - getTestFile(<String> fileName) - -
    -            - Returns the testfile with the given name -
    - - <static> Array - - - - - getTestFiles() - -
    -            - Returns an array containing the test files located - in the directory. -
    - - <static> helma.File - - - - - getTestsDirectory() - -
    -            - Returns the directory containing the test files. -
    - - <static> Object - - - - - getValue(<Array> args, argsExpected, <Number> idx) - -
    -            - Returns the argument on the index position in the array - passed as arguments. -
    - - <static> void - - - - - include(<Object> scope, file) - -
    -            - Evaluates a javascript file in the global test scope. -
    - - <static> String - - - - - valueToString(val) - -
    -            - Helper method useable for displaying a value -
    - - - -

    - - - - - - - - - - -
    Field Detail
    - - - -

    functionsFailed

    -
    Number functionsFailed
    -
      - Contains the number of test functions that failed - -
    -
    - - -

    functionsPassed

    -
    Number functionsPassed
    -
      - Contains the number of test functions that passed - -
    -
    - - -

    results

    -
    Array results
    -
      - An Array containing the results of this Test instance. - -
    -
    - - -

    testsFailed

    -
    Boolean testsFailed
    -
      - Contains the number of tests that failed - -
    -
    - - -

    testsRun

    -
    Number testsRun
    -
      - Contains the number of tests that were executed - -
    -
    - - -

    FAILED

    -
    <static> <final> String FAILED
    - -
    - - -

    PASSED

    -
    <static> <final> String PASSED
    - -
    - - - - - - - - - - - - -
    - Constructor Detail -
    - -

    -jala.Test

    -
    jala.Test()
    - - -
      - Constructs a new Test instance. -
    - - - -
      - Parameters: - -
        capacity - The capacity of the cache -
      - - -
    - - - - - - - - -
    - - - - - - - - - - - - -
    - Method Detail -
    - - - - -

    assertEqual

    -
    void assertEqual(<Object> val1, <Object> val2)
    - -
      Checks if the values passed as arguments are equal.
    - - - - -
      - Parameters: - -
        val1 - The value that should be compared to the second argument. -
      - -
        val2 - The value that should be compared to the first argument. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertEqualFile

    -
    void assertEqualFile(<Object> val, <String|helma.File> file)
    - -
      Checks if the value passed as argument equals the content of a file on disk.
    - - - - -
      - Parameters: - -
        val - The value that should be compared with the content of the file on disk. -
      - -
        file - Either a file name (including a path), or an instance of helma.File representing the file to use for comparison. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertFalse

    -
    void assertFalse(<Object> val)
    - -
      Checks if the value passed as argument is boolean false.
    - - - - -
      - Parameters: - -
        val - The value that should be boolean false. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertMatch

    -
    void assertMatch(<String> val, <RegExp> rxp)
    - -
      Checks if the regular expression matches the string.
    - - - - -
      - Parameters: - -
        val - The string that should contain the regular expression pattern -
      - -
        rxp - The regular expression that should match the value -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertNaN

    -
    void assertNaN(<Object> val)
    - -
      Checks if the value passed as argument is NaN.
    - - - - -
      - Parameters: - -
        val - The value that should be NaN. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertNotEqual

    -
    void assertNotEqual(<Object> val1, <Object> val2)
    - -
      Checks if the values passed as arguments are not equal.
    - - - - -
      - Parameters: - -
        val1 - The value that should be compared to the second argument. -
      - -
        val2 - The value that should be compared to the first argument. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertNotNaN

    -
    void assertNotNaN(<Object> val)
    - -
      Checks if the value passed as argument is not NaN.
    - - - - -
      - Parameters: - -
        val - The value that should be not NaN. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertNotNull

    -
    void assertNotNull(<Object> val)
    - -
      Checks if the value passed as argument is not null.
    - - - - -
      - Parameters: - -
        val - The value that should be not null. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertNotUndefined

    -
    void assertNotUndefined(<Object> val)
    - -
      Checks if the value passed as argument is not undefined.
    - - - - -
      - Parameters: - -
        val - The value that should be not undefined. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertNull

    -
    void assertNull(<Object> val)
    - -
      Checks if the value passed as argument is null.
    - - - - -
      - Parameters: - -
        val - The value that should be null. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertStringContains

    -
    void assertStringContains(<String> val, <String> str)
    - -
      Checks if the value passed as argument contains the pattern specified.
    - - - - -
      - Parameters: - -
        val - The string that should contain the pattern -
      - -
        str - The string that should be contained -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertThrows

    -
    void assertThrows(<Object> func, <Object> exception)
    - -
      Checks if the function passed as argument throws a defined exception.
    - - - - -
      - Parameters: - -
        func - The function to call -
      - -
        exception - Optional object expected to be thrown when executing the function -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertTrue

    -
    void assertTrue(<Object> val)
    - -
      Checks if the value passed as argument is boolean true.
    - - - - -
      - Parameters: - -
        val - The value that should be boolean true. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    assertUndefined

    -
    void assertUndefined(<Object> val)
    - -
      Checks if the value passed as argument is undefined.
    - - - - -
      - Parameters: - -
        val - The value that should be undefined. -
      - -
    - - - - - - - -
      - Throws:
        - jala.Test.ArgumentsException
        - jala.Test.TestException
      -
    - - -
    - - -

    directory_macro

    -
    String directory_macro()
    - -
      Returns the absolute path to the directory containing the tests
    - - - - - - - -
      - Returns: -
        - The path to the tests directory -
      -
    - - - - - -
    - - -

    execute

    -
    void execute(<String|Array> what)
    - -
      Main test execution function
    - - - - -
      - Parameters: - -
        what - Either the name of a single test file or an array containing the names of several function files that should be executed. -
      - -
    - - - - - - - - -
    - - -

    executeTest

    -
    void executeTest(<helma.File> testFile)
    - -
      Executes a single test file
    - - - - -
      - Parameters: - -
        testFile - The file containing the test to run -
      - -
    - - - - - - - - -
    - - -

    executeTestFunction

    -
    Object executeTestFunction(<String> functionName, <helma.scripting.rhino.GlobalObject> scope)
    - -
      Executes a single test function
    - - - - -
      - Parameters: - -
        functionName - The name of the test function to execute -
      - -
        scope - The scope to execute the test method in -
      - -
    - - - - - - - - -
    - - -

    list_macro

    -
    void list_macro()
    - -
      Renders the list of available tests
    - - - - - - - - - - - -
    - - -

    renderResult

    -
    void renderResult(result)
    - -
      Renders the result of a single test
    - - - - -
      - Parameters: - -
        The - result to render -
      - -
    - - - - - - - - -
    - - -

    renderResults

    -
    void renderResults()
    - -
      Renders the results of all tests done by this test instance - to response.
    - - - - - - - - - - - -
    - - -

    results_macro

    -
    void results_macro()
    - -
      Renders the test results
    - - - - - - - - - - - -
    - - -

    argsContainComment

    -
    <static> Boolean argsContainComment(<Array> args, <Number> argsExpected)
    - -
      Returns true if the arguments array passed as argument - contains an additional comment.
    - - - - -
      - Parameters: - -
        args - The arguments array to check for an existing comment. -
      - -
        argsExpected - The number of arguments expected by the assertion function. -
      - -
    - - - - -
      - Returns: -
        - True if the arguments contain a comment, false otherwise. -
      -
    - - - - - -
    - - -

    evalArguments

    -
    <static> Boolean evalArguments(<Object> args, argsExpected)
    - - - - -
      - Parameters: - -
        args - The arguments array. -
      - -
        nr - The number of arguments to be expected -
      - -
    - - - - -
      - Returns: -
        - True in case the number of arguments matches the expected amount, false otherwise. -
      -
    - - - - - -
    - - -

    getComment

    -
    <static> String getComment(<Array> args, argsExpected)
    - -
      Cuts out the comment from the arguments array passed - as argument and returns it. CAUTION: this actually modifies - the arguments array!
    - - - - -
      - Parameters: - -
        args - The arguments array. -
      - -
    - - - - -
      - Returns: -
        - The comment, if existing. Null otherwise. -
      -
    - - - - - -
    - - -

    getStackTrace

    -
    <static> String getStackTrace(<java.lang.StackTraceElement> trace)
    - -
      Creates a stack trace and parses it for display.
    - - - - -
      - Parameters: - -
        trace - The trace to parse. If not given a stacktrace will be generated -
      - -
    - - - - -
      - Returns: -
        - The parsed stack trace -
      -
    - - - - - -
    - - -

    getTestFile

    -
    <static> helma.File getTestFile(<String> fileName)
    - -
      Returns the testfile with the given name
    - - - - -
      - Parameters: - -
        fileName - The name of the test file -
      - -
    - - - - -
      - Returns: -
        - The test file -
      -
    - - - - - -
    - - -

    getTestFiles

    -
    <static> Array getTestFiles()
    - -
      Returns an array containing the test files located - in the directory.
    - - - - - - - -
      - Returns: -
        - An array containing the names of all test files -
      -
    - - - - - -
    - - -

    getTestsDirectory

    -
    <static> helma.File getTestsDirectory()
    - -
      Returns the directory containing the test files. - The location of the directory is either defined by the - application property "jala.testDir" or expected to be one level - above the application directory (and named "tests")
    - - - - - - - -
      - Returns: -
        - The directory containing the test files -
      -
    - - - - - -
    - - -

    getValue

    -
    <static> Object getValue(<Array> args, argsExpected, <Number> idx)
    - -
      Returns the argument on the index position in the array - passed as arguments. This method respects an optional comment - at the beginning of the arguments array.
    - - - - -
      - Parameters: - -
        args - The arguments to retrieve the non-comment value from. -
      - -
        idx - The index position on which the value to retrieve is to be expected if no comment is existing. -
      - -
    - - - - -
      - Returns: -
        - The non-comment value, or null. -
      -
    - - - - - -
    - - -

    include

    -
    <static> void include(<Object> scope, file)
    - -
      Evaluates a javascript file in the global test scope. This method can be used - to include generic testing code in test files. This method is available as - global method "include" for all test methods
    - - - - -
      - Parameters: - -
        scope - The scope in which the file should be evaluated -
      - -
        fileName - The name of the file to include, including the path -
      - -
    - - - - - - - - -
    - - -

    valueToString

    -
    <static> String valueToString(val)
    - -
      Helper method useable for displaying a value
    - - - - -
      - Parameters: - -
        The - value to render -
      - -
    - - - - -
      - Returns: -
        - The value rendered as string -
      -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/jala.html b/modules/jala/util/Test/docs/jala.html deleted file mode 100644 index 05de1f60..00000000 --- a/modules/jala/util/Test/docs/jala.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - -jala - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - -
    - - -

    Class jala

    -
    Object
    -   |
    -   +--jala
    -
    - - -
    -
    - -
    class - jala - - -
    - -
    - - - - - - - - - - - - - - -
    -Nested Class Summary
    - <static class>jala.Test
    -  - - - - - - - - - - - - - - - - -  - - - - - -

    - - - - - - - - - - - - - - - - - -


    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test - -
    - - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/overview-Global_Global.js.html b/modules/jala/util/Test/docs/overview-Global_Global.js.html deleted file mode 100644 index f002fa10..00000000 --- a/modules/jala/util/Test/docs/overview-Global_Global.js.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Global/Global.js - - - - - - -

    - -Global/Global.js -
    - - - - -
    - - - diff --git a/modules/jala/util/Test/docs/overview-Global_Root.js.html b/modules/jala/util/Test/docs/overview-Global_Root.js.html deleted file mode 100644 index 3edefc66..00000000 --- a/modules/jala/util/Test/docs/overview-Global_Root.js.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Global/Root.js - - - - - - -

    - -Global/Root.js -
    - - - - -
    - - - diff --git a/modules/jala/util/Test/docs/overview-Global_jala.Test.js.html b/modules/jala/util/Test/docs/overview-Global_jala.Test.js.html deleted file mode 100644 index 2a6b7249..00000000 --- a/modules/jala/util/Test/docs/overview-Global_jala.Test.js.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - Global/jala.Test.js - - - - - - -

    - -Global/jala.Test.js -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    jala.Test -
    -
    jala.Test.ArgumentsException -
    -
    jala.Test.DatabaseMgr -
    -
    jala.Test.EvaluatorException -
    -
    jala.Test.Exception -
    -
    jala.Test.HttpClient -
    -
    jala.Test.SmtpServer -
    -
    jala.Test.SmtpServer.Message -
    -
    jala.Test.TestException -
    -
    jala.Test.TestFunctionResult -
    -
    jala.Test.TestResult -
    -
    - - - diff --git a/modules/jala/util/Test/docs/overview-frame.html b/modules/jala/util/Test/docs/overview-frame.html deleted file mode 100644 index fef01bd7..00000000 --- a/modules/jala/util/Test/docs/overview-frame.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - -Overview () - - - - - - -

    Jala Test

    - - - - -
    - - - - - -
    All Classes -

    - -Files -
    - -Global/jala.Test.js
    - -Global/Root.js
    - -

    - -

    -  - - diff --git a/modules/jala/util/Test/docs/overview-summary-Global_Global.js.html b/modules/jala/util/Test/docs/overview-summary-Global_Global.js.html deleted file mode 100644 index 3eaeafd8..00000000 --- a/modules/jala/util/Test/docs/overview-summary-Global_Global.js.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - -jala.Test Overview - - - - - - - - - - - - - - - - - - -
    - -jala.Test -
    - - -


    -
    - -

    Global/Global.js

    - -
    - - - - -

    Summary

    -

    - - No overview generated for 'Global/Global.js'

    - -

    - -
    - - - - - - - - -
    //
    -// Jala Project [http://opensvn.csie.org/traccgi/jala]
    -//
    -// Copyright 2004 ORF Online und Teletext GmbH
    -//
    -// Licensed under the Apache License, Version 2.0 (the ``License'');
    -// you may not use this file except in compliance with the License.
    -// You may obtain a copy of the License at
    -//
    -//    http://www.apache.org/licenses/LICENSE-2.0
    -//
    -// Unless required by applicable law or agreed to in writing, software
    -// distributed under the License is distributed on an ``AS IS'' BASIS,
    -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -// See the License for the specific language governing permissions and
    -// limitations under the License.
    -//
    -// $Revision$
    -// $LastChangedBy$
    -// $LastChangedDate$
    -// $HeadURL$
    -//
    -
    -
    -/**
    - * Module dependencies
    - */
    -app.addRepository("modules/core/HopObject.js");
    -app.addRepository("modules/helma/File.js");
    -
    -/**
    - * Test runner
    - */
    -Root.prototype.runner_action = function() {
    -   res.handlers.test = new jala.Test();
    -   if (req.isGet() && req.data.test) {
    -      res.handlers.test.execute(req.data.test);
    -   } else if (req.isPost() && (req.data.test_array || req.data.test)) {
    -      res.handlers.test.execute(req.data.test_array || req.data.test);
    -   }
    -   renderSkin("jala.Test.main");
    -   return;
    -};
    -
    -/**
    - * External stylesheet for test runner
    - */
    -Root.prototype.jala_Test_stylesheet_action = function() {
    -   res.contentType = "text/css";
    -   renderSkin("jala.Test.stylesheet");
    -   return;
    -};
    -
    -
    - - - - - - - - - - - - - - - -
    -jala.Test -
    - - -
    - - - -
    Documentation generated by JSDoc on Mon Feb 12 14:40:38 2007
    - - diff --git a/modules/jala/util/Test/docs/overview-summary-Global_Root.js.html b/modules/jala/util/Test/docs/overview-summary-Global_Root.js.html deleted file mode 100644 index fbee4bcd..00000000 --- a/modules/jala/util/Test/docs/overview-summary-Global_Root.js.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - -Jala Test Overview - - - - - - - - - - - - - - - - - - -
    - -Jala Test -
    - - -
    -
    - -

    Global/Root.js

    - -
    - - - - -

    Summary

    -

    - - No overview generated for 'Global/Root.js'

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/overview-summary-Global_jala.Test.js.html b/modules/jala/util/Test/docs/overview-summary-Global_jala.Test.js.html deleted file mode 100644 index 8e23ecac..00000000 --- a/modules/jala/util/Test/docs/overview-summary-Global_jala.Test.js.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - -Jala Test Overview - - - - - - - - - - - - - - - - - - -
    - -Jala Test -
    - - -
    -
    - -

    Global/jala.Test.js

    - -
    - - - - -

    Summary

    -

    - - Fields and methods of the jala.Test class.

    - -

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - Class Summary - -
    jala.TestProvides various methods for automated tests.
    jala.Test.ArgumentsExceptionInstances of this exception are thrown whenever an assertion - function is called with incorrect or insufficient arguments -
    jala.Test.DatabaseMgrInstances of this class allow managing test databases - and switching a running application to an in-memory test - database to use within a unit test.
    jala.Test.EvaluatorExceptionInstances of this exception are thrown when attempt - to evaluate the test code fails.
    jala.Test.ExceptionBase exception class -
    jala.Test.HttpClientInstances of this class represent a http client useable for - testing, as any session cookies received by the tested application - are stored and used for subsequent requests, allowing simple "walkthrough" - tests.
    jala.Test.SmtpServerInstances of this class represent an SMTP server listening on - localhost.
    jala.Test.SmtpServer.MessageInstances of this class represent a mail message received - by the SMTP server -
    jala.Test.TestExceptionInstances of this exception are thrown whenever an - assertion function fails -
    jala.Test.TestFunctionResultInstances of this class represent the result of the successful - execution of a single test function (failed executions will be represented - as Exceptions in the log of a test result).
    jala.Test.TestResultInstances of this class represent the result of the execution - of a single test file -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/overview-summary.html b/modules/jala/util/Test/docs/overview-summary.html deleted file mode 100644 index cd3cb6cb..00000000 --- a/modules/jala/util/Test/docs/overview-summary.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - -Jala Test Overview - - - - - - - - - - - - - - - - - - -
    - -Jala Test -
    - - -
    -
    - -

    Jala Test

    - -
    - - -

    - This document is the API Specification for - Jala Test. -

    - - - -

    Summary

    -

    - - No summary generated for these documents. - -

    - -
    - - - - - - - - - - - - - - - - - -
    - - File Summary - -
    Global/jala.Test.jsFields and methods of the jala.Test class.
    Global/Root.js 
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -Jala Test -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/overview-tree.html b/modules/jala/util/Test/docs/overview-tree.html deleted file mode 100644 index 22e0d0fd..00000000 --- a/modules/jala/util/Test/docs/overview-tree.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - -Jala Test Class Hierarchy - - - - - - - - - - - - - - - - - - -
    -Jala Test -
    - - -
    -

    Class Hierarchy

    - - - -
    - - - - - - - - - - - - - -
    -Jala Test -
    - - -
    - - - -
    Documentation generated by JSDoc on Tue Jan 8 15:50:17 2008
    - - diff --git a/modules/jala/util/Test/docs/stylesheet.css b/modules/jala/util/Test/docs/stylesheet.css deleted file mode 100644 index 7a35c0c1..00000000 --- a/modules/jala/util/Test/docs/stylesheet.css +++ /dev/null @@ -1,39 +0,0 @@ -/* JSDoc style sheet */ - -/* Define colors, fonts and other style attributes here to override the defaults */ - -/* Page background color */ -body { background-color: #FFFFFF } - -/* Table colors */ -.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ -.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ -.TableRowColor { background: #FFFFFF } /* White */ - -/* Font used in left-hand frame lists */ -.FrameTitleFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } -.FrameHeadingFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } -.FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, san-serif } - -/* Example of smaller, sans-serif font in frames */ -/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */ - -/* Navigation bar fonts and colors */ -.NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */ -.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */ -.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} -.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} - -.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} -.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} - -.jsdoc_ctime { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; - text-align: right } - -/* Sourcecode view */ -.sourceview { background: #FFFFFF } -.attrib { color: #DD7777 } -.comment { color: #55AA55 } -.reserved { color: #FF5555 } -.literal { color: #5555FF } - diff --git a/modules/jala/util/Test/tests/selftest.js b/modules/jala/util/Test/tests/selftest.js deleted file mode 100644 index 5e175b6e..00000000 --- a/modules/jala/util/Test/tests/selftest.js +++ /dev/null @@ -1,169 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Declare which test methods should be run in which order - * @type Array - * @final - */ - -/** - * Test for jala.Test.evalArguments - */ -var testEvalArguments = function testEvalArguments() { - var args; - // test arguments without a comment - args = [true, false, 1, "one", new Date()]; - jala.Test.evalArguments(args, 5); - // test arguments with a comment - args = ["a comment", true, false, 1, "one", new Date()]; - jala.Test.evalArguments(args, 5); - return; -}; - -/** - * Test for jala.Test.containsComment - */ -var testArgsContainComment = function testArgsContainComment() { - var args = ["a comment", true]; - if (jala.Test.argsContainComment(args, 1) !== true) { - throw new jala.Test.TestException(null, - "Argument array is supposed to contain a comment, but doesn't"); - } - return; -}; - -/** - * Test for jala.Test.getComment - */ -var testGetComment = function testGetComment() { - var args = ["a comment", true]; - if (jala.Test.getComment(args, 1) !== args[0]) { - throw new jala.Test.TestException(null, "Couldn't get comment"); - } - return; -}; - -/** - * Test for jala.Test.getValue - */ -var testGetValue = function testGetValue() { - var args = ["a comment", 1, 2, 3]; - if (jala.Test.getValue(args, 3, 1) !== args[2]) { - throw new jala.Test.TestException("Couldn't get correct argument value"); - } - return; -}; - -/** - * Testing assertion functions - */ -var testBasicAssertionFunctions = function testAssertionFunctions() { - assertTrue("just a comment", true); - assertFalse("just a comment", false); - assertEqual(1, 1); - assertEqualArrays("asserting arrays", [1,2,3], [1,2,3]); - assertEqualArrays(["1","2"], ["1","2"]); - assertNotEqual(1, 2); - assertNull(null); - assertNotNull(true); - assertUndefined(undefined); - assertNotUndefined(true); - assertNaN("one"); - assertNotNaN(1); - assertStringContains("just a self test", "self"); - assertMatch("just a self test", /^just/); - return; -}; - -/** - * Testing assertThrows - */ -var testAssertThrows = function testAssertThrows() { - // throw undefined (yes, you can do that...) - assertThrows(function() { - throw undefined; - }, undefined); - // throw custom javascript object - assertThrows(function() { - throw new jala.Test.TestException("", "message"); - }, jala.Test.TestException); - // throw string - assertThrows(function() { - throw "my message"; - }, "my message"); - // throw java exception - assertThrows(function() { - var x = new java.util.Vector(0); - res.debug(x.get(1)); - }, java.lang.ArrayIndexOutOfBoundsException); - // throw anything, but don't check further - assertThrows(function() { - throw new Date(); - }); - // don't throw an expected exception - assertThrows(function() { - assertThrows(function() { - return; - }, "oy"); - }, jala.Test.TestException); - return; -}; - -var testInclude = function() { - var dir = java.lang.System.getProperty("java.io.tmpdir"); - var content = "var INCLUDED = true;"; - // create include file with the above content - var file = new helma.File(dir, "testInclude." + (new Date()).getTime()); - file.open(); - file.write(content); - file.close(); - include(file); - // now include the file and test if everything works - assertTrue(global["INCLUDED"]); - // finally remove the include file again - file.remove(); - return; -}; - -/** - * Testing testAssertEqualFile - */ -var testAssertEqualFile = function testAssertEqualFile() { - var str = "This is just a simple test\r\n"; - var dir = java.lang.System.getProperty("java.io.tmpdir"); - // create test file and write the string into the file - var testFile = new helma.File(dir, "testAssertEqualFile." + (new Date()).getTime()); - testFile.open(); - testFile.write(str); - testFile.close(); - // test string comparison - assertEqualFile(str, testFile); - // test byte array comparison - var arr = new java.lang.String(str).getBytes(); - assertEqualFile(arr, testFile); - // finally, remove testFile again - testFile.remove(); - return; -}; diff --git a/modules/jala/util/Test/tests/skeleton.js b/modules/jala/util/Test/tests/skeleton.js deleted file mode 100644 index 8cd7cf58..00000000 --- a/modules/jala/util/Test/tests/skeleton.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Prefix all test-functions with "test" - */ - -/** - * Called before running the tests - */ -var setup = function() { - return; -}; - -/** - * Called after all tests have finished - */ -var cleanup = function() { - return; -}; diff --git a/modules/jala/util/XmlRpcClient/Global/Feedback.js b/modules/jala/util/XmlRpcClient/Global/Feedback.js deleted file mode 100644 index 98c0a36e..00000000 --- a/modules/jala/util/XmlRpcClient/Global/Feedback.js +++ /dev/null @@ -1,85 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Error- and Confirmation message container - * @class Instances of this class can contain numerous error- and confirm messages - * and function as a macro handler object. - * @constructor - * @returns A newly created Feedback instance - * @type Feedback - */ -var Feedback = function() { - this.errors = {}; - this.messages = {}; - this.isError = false; - return this; -}; - -/** - * Adds the message with the given name to the list of errors and - * sets the isError flag to true. - * @param {String} name The name of the message - * @param {msg} msg The message to use - */ -Feedback.prototype.setError = function(name, msg) { - this.errors[name] = msg; - this.isError = true; - return; -}; - -/** - * Adds the message with the given name to the list of confirmation messages - * and sets the isError flag to true. - * @param {String} name The name of the message - * @param {msg} msg The message to use - */ -Feedback.prototype.setMessage = function(name, msg) { - this.messages[name] = msg; - return; -}; - -/** - * Returns the message with the given name - * @returns The message with the given name - * @type String - */ -Feedback.prototype.message_macro = function(param) { - if (param.name != null) { - return this.messages[param.name]; - } - return; -}; - -/** - * Returns the error message with the given name - * @returns The error message with the given name - * @type String - */ -Feedback.prototype.error_macro = function(param) { - if (param.name != null) { - return this.errors[param.name]; - } - return; -}; diff --git a/modules/jala/util/XmlRpcClient/Global/Global.js b/modules/jala/util/XmlRpcClient/Global/Global.js deleted file mode 100644 index 1f8c3b3f..00000000 --- a/modules/jala/util/XmlRpcClient/Global/Global.js +++ /dev/null @@ -1,362 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Dependencies - */ -app.addRepository("modules/core/String.js"); -app.addRepository(getProperty("jala.dir", "modules/jala") + - "/code/XmlRpcRequest.js"); - -/** - * A safe eval method that uses a standard Javascript scope - * without any Helma specifics for evaluation. This method - * does a double evaluation: first it evaluates the code - * in a separate javascript scope without any Helma specifics, and only - * if that doesn't throw an exception it evaluates the expression in the - * application scope, so that objects constructed during evaluation - * belong to the correct scope (and eg. testing with instanceof returns - * the expected result). Keep in mind that due to the double - * evaluation using this method is quite costly. - * @param {String} code The code to evaluate - * @returns The result of the evaluated code - */ -var safeEval = function(code) { - var context = new Packages.org.mozilla.javascript.Context(); - try { - context.enter(); - // first evaluation in separate scope - context.evaluateString(safeEval.SCOPE, code, null, 0, null); - return eval(code); - } finally { - context.exit(); - } -}; -safeEval.SCOPE = Packages.org.mozilla.javascript.Context.getCurrentContext().initStandardObjects(); - -/** - * Returns true if the value passed as argument is a string. Since - * this value might be constructed using the safeEval's scope - * this method tests both the application's scope and the safe one. - * @param {Object} val The value to test - * @returns True if the value is a string, false otherwise - */ -var isString = function(val) { - return typeof(val) == "string" || - val instanceof java.lang.String || - val instanceof String; -}; - -/** - * Returns true if the value passed as argument is a boolean. Since - * this value might be constructed using the safeEval's scope - * this method tests both the application's scope and the safe one. - * @param {Object} val The value to test - * @returns True if the value is a boolean, false otherwise - */ -var isBoolean = function(val) { - return typeof(val) == "boolean" || - val instanceof Boolean; -}; - -/** - * Returns true if the value passed as argument is a number. Since - * this value might be constructed using the safeEval's scope - * this method tests both the application's scope and the safe one. - * @param {Object} val The value to test - * @returns True if the value is a number, false otherwise - */ -var isNumber = function(val) { - return typeof(val) == "number" || - val instanceof java.lang.Integer || - val instanceof Number; -}; - -/** - * Returns true if the value passed as argument is null. - * @param {Object} val The value to test - * @returns True if the value is null, false otherwise - */ -var isNull = function(val) { - return val === null; -}; - -/** - * Returns true if the value passed as argument is undefined. - * @param {Object} val The value to test - * @returns True if the value is undefined, false otherwise - */ -var isUndefined = function(val) { - return val === undefined; -}; - -/** - * Returns true if the value passed as argument is an array. Since - * this value might be constructed using the safeEval's scope - * this method tests both the application's scope and the safe one. - * @param {Object} val The value to test - * @returns True if the value is an array, false otherwise - */ -var isArray = function(val) { - return val instanceof Array; -}; - -/** - * Returns true if the value passed as argument is a date. Since - * this value might be constructed using the safeEval's scope - * this method tests both the application's scope and the safe one. - * @param {Object} val The value to test - * @returns True if the value is a date, false otherwise - */ -var isDate = function(val) { - return val instanceof Date || - val instanceof java.util.Date; -}; - -/** - * Returns true if the value passed as argument is an object. Since - * this value might be constructed using the safeEval's scope - * this method tests both the application's scope and the safe one. - * @param {Object} val The value to test - * @returns True if the value is an object, false otherwise - */ -var isObject = function(val) { - return val instanceof Object || - val instanceof java.lang.Object; -}; - -/** - * Parses the argument string passed into an array containing - * evaluated arguments. The string can contain object and array literals, - * strings, numbers and dates (using standard Javascript syntax). - * @param {String} str The string to parse - * @returns The parsed arguments - * @type Array - */ -var parseArguments = function(str) { - var result = []; - var c, literalLevel = 0; - var buf = new java.lang.StringBuffer(); - for (var i=0;i 0) { - result.push(evalArgument(buf.toString())); - } - return result; -}; - -/** - * Parses a single argument string using the safeEval's method - * eval(). This way users can't do any harm since all they have is - * a plain Javascript environment without any Helma specifics. - * @param {String} str The string to evaluate - * @returns The evaluated argument - */ -var evalArgument = function(str) { - if (str) { - str = str.trim(); - return safeEval("(" + str + ")"); - } - return null; -}; - -/** - * Returns the object passed as argument as formatted JSOn compatible - * string. - * @param {Object} obj The object to format as string - * @returns The formatted string - */ -var prettyPrint = function(obj) { - - var pad = function(str) { - return " ".repeat((lvl) * 6) + str; - }; - - var printString = function(str) { - return '"' + encode(str) + '"'; - }; - - var printInteger = function(nr) { - return nr.toString(); - }; - - var printBoolean = function(bool) { - return bool.toString(); - }; - - var printUndefined = function() { - return "undefined"; - }; - - var printNull = function() { - return "null"; - }; - - var printDate = function(date) { - return date.toString(); - }; - - var printArray = function(arr) { - var buf = new java.lang.StringBuffer(); - buf.append("["); - lvl += 1; - for (var i=0;i 0) { - buf.append(","); - } - buf.append("\n"); - buf.append(pad(printValue(arr[i]))); - } - lvl -= 1; - buf.append("\n"); - buf.append(pad("]")); - return buf.toString(); - }; - - var printObject = function(obj) { - var buf = new java.lang.StringBuffer(); - buf.append("{"); - lvl += 1; - var first = true; - for (var i in obj) { - if (first) { - first = !first; - } else { - buf.append(","); - } - buf.append("\n"); - buf.append(pad(printString(i) + ": ")); - buf.append(printValue(obj[i])); - } - lvl -= 1; - buf.append("\n"); - buf.append(pad("}")); - return buf.toString(); - }; - - var printValue = function(val) { - if (isArray(val)) { - return printArray(val); - } else if (isDate(val)) { - return printDate(val); - } else if (isString(val)) { - return printString(val); - } else if (isNumber(val)) { - return printInteger(val); - } else if (isBoolean(val)) { - return printBoolean(val); - } else if (isNull(val)) { - return printNull(); - } else if (isUndefined(val)) { - return printUndefined(); - } else if (isObject(val)) { - return printObject(val); - } else if (val.toString != null) { - return val.toString(); - } - return; - }; - - var lvl = 0; - return printValue(obj); -}; - -/** - * Returns the xml source passed as argument as readable string - * with appropriate linefeeds and indents. This method uses a - * regular expression instead of converting the xml source into - * a DOM tree to be able to format invalid xml which might be useful - * for debugging. - * @param {String} xmlSource The XML source for format - * @returns The formatted source - */ -var prettyPrintXml = function(xmlSource) { - var pad = function(str) { - res.write(" ".repeat((lvl) * 6) + encode(str)); - }; - - // remove all linefeeds and carriage returns - var xml = xmlSource.replace(/\r\n|\n\r|\n|\r/g, ""); - var re = /<(\/?)([^>]+)[^<]+(?=<|$)/gm; - var lvl = 0; - var match; - var tag, prevTag; - res.push(); - while (match = re.exec(xml)) { - tag = match[2]; - if (!match[1]) { - // opening or contentless tag - if (match.index > 0) { - res.write("\n"); - lvl += 1; - } - pad(match[0]); - if (tag.indexOf("/") > -1) { - lvl -= 1; - } - } else { - // closing tag - if (tag == prevTag) { - lvl -= 1; - res.encode(match[0]); - } else { - res.write("\n"); - pad(match[0]); - lvl -= 1; - } - } - prevTag = tag; - } - return res.pop(); -}; - -/** - * Basic selection macro useable for checkboxes - * and select dropdowns. This macro checks if - * req.data[param.name] equals param.value, and if - * true it writes the specified param.attribute in - * the form 'attribute="attribute"' to response. - */ -var selection_macro = function(param) { - if (req.data[param.name] == param.value) { - res.write(" "); - res.write(param.attribute); - res.write('="'); - res.write(param.attribute); - res.write('"'); - } - return; -}; diff --git a/modules/jala/util/XmlRpcClient/Global/XmlRpcCall.js b/modules/jala/util/XmlRpcClient/Global/XmlRpcCall.js deleted file mode 100644 index 0a216921..00000000 --- a/modules/jala/util/XmlRpcClient/Global/XmlRpcCall.js +++ /dev/null @@ -1,146 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Wrapper for making XmlRpc calls to remote servers. - * @class Instances of this class can make calls to remote - * XmlRpc servers, plus function as macro handlers for displaying - * results, errors etc. - * @param {String} url The url of the entry-point - * @param {String} methodName The name of the method to call (eg. "xmlrpcclient.echo") - * @param {Array} args An array containing arguments to pass to the remote function - * @returns A newly created XmlRpcCall instance - * @type XmlRpcCall - */ -var XmlRpcCall = function(url, methodName) { - this.request = new jala.XmlRpcRequest(url, methodName); - this.result = null; - return this; -}; - -/** - * Executes the XmlRpc call - */ -XmlRpcCall.prototype.execute = function() { - this.args = arguments; - this.response = jala.XmlRpcRequest.prototype.execute.apply(this.request, arguments); - return; -}; - -/** @ignore */ -XmlRpcCall.prototype.toString = function() { - return "[XmlRpcCall]"; -}; - -/** - * Returns the Url of this XmlRpcCall instance. - * @returns The url of this call - * @type String - */ -XmlRpcCall.prototype.url_macro = function() { - return this.url; -}; - -/** - * Returns the method name of this XmlRpcCall instance. - * @returns The method name of this call - * @type String - */ -XmlRpcCall.prototype.method_macro = function() { - return this.methodName; -}; - -/** - * Displays the arguments of this XmlRpcCall instance. - */ -XmlRpcCall.prototype.arguments_macro = function() { - var arg; - for (var i=0;i'); - res.write('
    ' + i + " "); - if (isArray(arg)) { - res.write("(Array)"); - } else if (isDate(arg)) { - res.write("(Date)"); - } else if (isString(arg)) { - res.write("(String)"); - } else if (isNumber(arg)) { - res.write("(Integer)"); - } else if (isBoolean(arg)) { - res.write("(Boolean)"); - } else if (isNull(arg)) { - res.write("(null)"); - } else if (isUndefined(arg)) { - res.write("(undefined)"); - } else if (isObject(arg)) { - res.write("(Object)"); - } else { - res.write("(unknown type)"); - } - res.write('
    \n
    ');
    -      res.write(prettyPrint(arg));
    -      res.write("
    "); - } - return; -}; - -/** - * Returns the result of this XmlRpcCall instance. - * @returns The result as human readable string - * @type String - */ -XmlRpcCall.prototype.result_macro = function() { - if (this.response.result != null) { - return prettyPrint(this.response.result); - } - return; -}; - -/** - * Returns the error of this XmlRpcCall instance, if any. - * @returns The error string - * @type String - */ -XmlRpcCall.prototype.error_macro = function() { - if (this.response.error != null) { - return this.response.error; - } - return; -}; - -/** - * Displays the xml source of either request or response - * @param {Object} param A parameter object containing the - * macro attributes - */ -XmlRpcCall.prototype.xml_macro = function(param) { - var xml = this.response[param.of + "Xml"]; - if (xml != null) { - res.write("
    ");
    -      res.write(prettyPrintXml(xml));
    -      res.write("
    "); - } - return; -}; diff --git a/modules/jala/util/XmlRpcClient/README b/modules/jala/util/XmlRpcClient/README deleted file mode 100644 index 31fae511..00000000 --- a/modules/jala/util/XmlRpcClient/README +++ /dev/null @@ -1,59 +0,0 @@ -This is the README file for the XmlRpcClient application as part of -version 1.0 of the Jala Javascript Library. - - -About XmlRpcClient ------------------- - -The XmlRpcClient is a small Helma application useful to test and debug XmlRpc -requests. - - -Installation ------------- - -To install the application add the following to the apps.properties file in -your Helma installation directory: - -xmlrpcclient -xmlrpcclient.repository.0 = ./modules/jala/util/XmlRpcClient - - -Usage Instructions ------------------- - -To access the XmlRpcClient point your browser to the URL - -http://your.server.domain[:port]/xmlrpcclient - -(replace "your.server.domain" with the domain of your server, and the ":port" -section with the port number if not 80). Then fill out the form with at least -the URL of the XmlRpc service and the method name (both are required). - -Optionally you can pass various arguments to the remote method using standard -Javascript literal notation, eg.: - -String: "a string" -Number: 1 -Boolean: true|false -Objec: {name: "jala"} -Array: [1, 2, "three", 4] -Date: new Date(2007, 0, 22, 15, 10) - -By default the XmlRpc client uses UTF-8 as encoding for request and response, -which you can change to ISO-8859-1 if necessary. If you select the "Show Xml" -checkbox the result shown will also contain the Xml source of the request and -response, which is useful for debugging. - -At last you can tell the client to use a specific HTTP proxy for the requests, -which you must define in the form "fqdn:port", eg. "my.proxy.com:3128". - - -Contact, Bugs and Feedback --------------------------- - -The Jala Project is currently hosted at https://OpenSVN.csie.org/traccgi/jala/ -providing all necessary information about Subversion access, Ticketing, Releases -etc. - -For immediate contact you can reach the developers via jaladev AT gmail.com. diff --git a/modules/jala/util/XmlRpcClient/Root/Root.js b/modules/jala/util/XmlRpcClient/Root/Root.js deleted file mode 100644 index 11b2eea6..00000000 --- a/modules/jala/util/XmlRpcClient/Root/Root.js +++ /dev/null @@ -1,84 +0,0 @@ -// -// Jala Project [http://opensvn.csie.org/traccgi/jala] -// -// Copyright 2004 ORF Online und Teletext GmbH -// -// Licensed under the Apache License, Version 2.0 (the ``License''); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an ``AS IS'' BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Revision$ -// $LastChangedBy$ -// $LastChangedDate$ -// $HeadURL$ -// - - -/** - * Main action - */ -Root.prototype.main_action = function() { - res.handlers.xmlrpc = {}; - res.handlers.feedback = new Feedback(); - if (req.isPost()) { - if (!req.data.url) { - res.handlers.feedback.setError("url", "Please enter the URL of the XmlRpc entry point"); - } - if (!req.data.method) { - res.handlers.feedback.setError("method", "Please specify the method to call"); - } - try { - var args = parseArguments(req.data.args); - } catch (e) { - res.handlers.feedback.setError("arguments", "The method arguments are invalid"); - } - if (!res.handlers.feedback.isError) { - var xmlRpcCall = new XmlRpcCall(req.data.url, req.data.method); - xmlRpcCall.request.setEncoding(req.data.encoding); - xmlRpcCall.request.setProxy(req.data.proxy); - xmlRpcCall.request.setDebug(req.data.debug == 1); - if (app.properties.username != null && app.properties.password != null) { - xmlRpcCall.request.setCredentials(app.properties.username, app.properties.password); - } - XmlRpcCall.prototype.execute.apply(xmlRpcCall, args); - res.handlers.xmlrpc = xmlRpcCall; - } - } - this.renderSkin("main"); - return; -}; - -/** - * Main XmlRpc action. The only supported method name is "echo". - * If no additional arguments are given this action - * returns "echo" to the client. A single additional argument is returned - * as-is, multiple additional arguments are returned as array. - */ -Root.prototype.main_action_xmlrpc = function(methodName) { - switch (methodName) { - case "echo": - if (arguments.length == 1) { - return "echo"; - } else if (arguments.length == 2) { - return arguments[1]; - } else { - var result = []; - for (var i=1;i - - -Jala XmlRpc Client - - - - -
    Jala XmlRpc Client
    -
    -
    -
    <% feedback.error name="url" prefix='
    ' suffix="
    " %>" />
    - Example: http://localhost:8080/xmlrpcclient/
    -
    <% feedback.error name="method" prefix='
    ' suffix="
    " %>" />
    - Example: echo
    -
    <% feedback.error name="arguments" prefix='
    ' suffix="
    " %>" />
    - Example: "eins", 123, true, new Date(), {test: {me: "please"}}, ["a", ["b", "c"]]
    -
    -
    />
    -

    - Example: my.proxy.com:3128
    -

    (* = required)
    - - <% xmlrpc.arguments prefix="
    Arguments" suffix="
    " %> - - <% xmlrpc.error prefix='
    Error' suffix="
    " %> - - <% xmlrpc.result prefix='
    Result
    ' suffix="
    " %> - - <% xmlrpc.xml of="request" prefix="
    Request XML" suffix="
    " %> - - <% xmlrpc.xml of="response" prefix="
    Response XML" suffix="
    " %> - -
    -
    - - \ No newline at end of file diff --git a/modules/tools/Global/helma.Inspector.js b/modules/tools/Global/helma.Inspector.js deleted file mode 100644 index 03a46e2b..00000000 --- a/modules/tools/Global/helma.Inspector.js +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2005 Helma Software. All Rights Reserved. - * - * $RCSfile: helma.Inspector.js,v $ - * $Author: czv $ - * $Revision: 1.5 $ - * $Date: 2006/04/24 11:12:40 $ - */ - -// take care of any dependencies -app.addRepository('modules/core/String.js'); -app.addRepository('modules/core/Number.js'); -app.addRepository('modules/helma/Html.js'); - -if (!global.helma) { - global.helma = {}; -} - -helma.Inspector = function(hopObj) { - if (!hopObj) - hopObj == root; - - var version = "4.0"; - var children = []; - var properties = []; - var collections = []; - - var html = new helma.Html(); - var keySorter = new String.Sorter("key"); - var idSorter = new Number.Sorter("id"); - - var skins = { - child: createSkin(helma.Inspector.child_skin), - collection: createSkin(helma.Inspector.collection_skin), - date: createSkin(helma.Inspector.date_skin), - editor: createSkin(helma.Inspector.editor_skin), - property: createSkin(helma.Inspector.property_skin) - }; - - var genOptions = function(start, end, selected) { - res.push(); - for (var i=start; i<=end; i+=1) { - res.write(""); - if (i < 10) - res.write("0"); - res.write(i); - res.write("\n"); - } - return res.pop(); - }; - - this.render = function() { - for (var i in hopObj) { - var obj = { - key: i, - value: hopObj[i] - }; - if (hopObj[i]) { - if (obj.value._prototype && - obj.value._prototype == "HopObject") - collections.push(obj); - else - properties.push(obj); - } - } - properties.sort(keySorter); - collections.sort(keySorter); - - var n = hopObj.size(); - for (var i=0; i cols="40" rows="1"><% param.value encoding="form" %>
    \ -\ -\ -\ -\ -\ -\ -\ -'; - -HopObject.prototype[ (app.properties['inspectorAction'] || 'inspector') +'_action' ] = function() { - if (!helma.auth('inspector')) - res.abort(); - if (typeof helma == "undefined" || !helma.Inspector) { - res.write("Could not create instance of helma.Inspector "); - res.write("(probably due to missing helmaLib v4.0+)"); - return; - } - var inspector = new helma.Inspector(this); - inspector.action(); - return; -}; - -helma.lib = "Inspector"; -helma.dontEnum(helma.lib); -for (var i in helma[helma.lib]) - helma[helma.lib].dontEnum(i); -for (var i in helma[helma.lib].prototype) - helma[helma.lib].prototype.dontEnum(i); -delete helma.lib; diff --git a/modules/tools/Global/helma.Inspector.main.skin b/modules/tools/Global/helma.Inspector.main.skin deleted file mode 100644 index da240f2c..00000000 --- a/modules/tools/Global/helma.Inspector.main.skin +++ /dev/null @@ -1,157 +0,0 @@ - - - - - -helma.Inspector v<% inspector.version %> - - - - - - -

    <% inspector.title %>

    -
    <% inspector.path %><% inspector.title %>

    - - - - - - - - - - - -
    - - - - -<% inspector.children default='' %> -
    <% inspector.childProto default="child" %> objects
    none
    -
    - - - - -<% inspector.properties %> -
    properties
    -
    - - - - -<% inspector.collections default='' %> -
    collections
    none
    -
    - - - diff --git a/modules/tools/Global/helma.Markup.js b/modules/tools/Global/helma.Markup.js deleted file mode 100644 index 1bad0279..00000000 --- a/modules/tools/Global/helma.Markup.js +++ /dev/null @@ -1,807 +0,0 @@ -/* -* Copyright (C) 2004 Hannes Wallnoefer -*/ - -//////////////////////////////////////////////////////////////////////// -// Html element functions -//////////////////////////////////////////////////////////////////////// - -if (!global.helma) { - global.helma = {}; -} - -helma.Markup = {}; - -helma.Markup.element = function(name, attributes, content) { - if (!name) { - throw "helma.Markup.element called without element name"; - } - // open tag - res.write("<"); - res.write(name); - if (attributes) { - for (var i in attributes) { - if (typeof(attributes[i]) == "undefined") - continue; - res.write(" "); - res.write(i); - res.write("=\""); - res.write(encodeForm(attributes[i])); - res.write("\""); - } - } - // if no child objects create empty element and return - if (typeof(content) == "undefined") { - res.write(" />"); - return; - } - res.write(">"); - - // write content - res.write(content); - - // close tag - res.write(""); -} - -helma.Markup.Element = function(name, attributes, children) { - return new MarkupElement(name, attributes, children); -} - -helma.Markup.form = function(attributes, content) { - this.element("form", attributes, content); -} - -helma.Markup.Form = function(attributes, children) { - return new MarkupElement("form", attributes, children); -} - -helma.Markup.textarea = function(attributes, content) { - this.element("textarea", attributes, encodeForm(content)); -} - -helma.Markup.Textarea = function(attributes, children) { - return new HtmlTextarea(attributes, children); -} - -helma.Markup.input = function(attributes, content) { - this.element("input", attributes, content); -} - -helma.Markup.Input = function(attributes, children) { - return new MarkupElement("input", attributes, children); -} - -helma.Markup.button = function(attributes, content) { - if (!attributes) - attributes = {}; - attributes.type = "button"; - this.element("input", attributes, content); -} - -helma.Markup.Button = function(attributes, children) { - if (!attributes) - attributes = {}; - attributes.type = "button"; - return new MarkupElement("input", attributes, children); -} - -helma.Markup.submit = function(attributes, content) { - if (!attributes) - attributes = {}; - attributes.type = "submit"; - this.element("input", attributes, content); -} - -helma.Markup.Submit = function(attributes, children) { - if (!attributes) - attributes = {}; - attributes.type = "submit"; - return new MarkupElement("input", attributes, children); -} - -helma.Markup.hidden = function(attributes, content) { - if (!attributes) - attributes = {}; - attributes.type = "hidden"; - this.element("input", attributes, content); -} - -helma.Markup.Hidden = function(attributes, children) { - if (!attributes) - attributes = {}; - attributes.type = "hidden"; - return new MarkupElement("input", attributes, children); -} - -helma.Markup.file = function(attributes, content) { - if (!attributes) - attributes = {}; - attributes.type = "file"; - this.element("input", attributes, content); -} - -helma.Markup.File = function(attributes, children) { - if (!attributes) - attributes = {}; - attributes.type = "file"; - return new MarkupElement("input", attributes, children); -} - -helma.Markup.password = function(attributes, content) { - if (!attributes) - attributes = {}; - attributes.type = "password"; - this.element("input", attributes, content); -} - -helma.Markup.Password = function(attributes, children) { - if (!attributes) - attributes = {}; - attributes.type = "password"; - return new MarkupElement("input", attributes, children); -} - -helma.Markup.checkbox = function(attributes, content) { - if (!attributes) - attributes = {}; - attributes.type = "checkbox"; - if (!attributes.checked) - delete(attributes.checked); - this.element("input", attributes, content); -} - -helma.Markup.Checkbox = function(attributes, children) { - if (!attributes) - attributes = {}; - attributes.type = "checkbox"; - if (!attributes.checked) - delete(attributes.checked); - return new MarkupElement("input", attributes, children); -} - -helma.Markup.select = function(attributes, children, selected, firstLine) { - res.write(new HtmlSelect(attributes, children, selected, firstLine)); -} - -helma.Markup.Select = function(attributes, children, selected, firstLine) { - return new HtmlSelect(attributes, children, selected, firstLine); -} - -helma.Markup.head = function(attributes, content) { - this.element("head", attributes, content); -} - -helma.Markup.Head = function(attributes, children) { - return new MarkupElement("head", attributes, children); -} - -helma.Markup.title = function(attributes, content) { - this.element("title", attributes, content); -} - -helma.Markup.Title = function(attributes, children) { - return new MarkupElement("title", attributes, children); -} - -helma.Markup.body = function(attributes, content) { - this.element("body", attributes, content); -} - -helma.Markup.Body = function(attributes, children) { - return new MarkupElement("body", attributes, children); -} - -helma.Markup.div = function(attributes, content) { - this.element("div", attributes, content); -} - -helma.Markup.Div = function(attributes, children) { - return new MarkupElement("div", attributes, children); -} - -helma.Markup.p = function(attributes, content) { - this.element("p", attributes, content); -} - -helma.Markup.P = function(attributes, children) { - return new MarkupElement("p", attributes, children); -} - -helma.Markup.b = function(attributes, content) { - this.element("b", attributes, content); -} - -helma.Markup.B = function(attributes, children) { - return new MarkupElement("b", attributes, children); -} - -helma.Markup.span = function(attributes, content) { - this.element("span", attributes, content); -} - -helma.Markup.Span = function(attributes, children) { - return new MarkupElement("span", attributes, children); -} - -helma.Markup.img = function(attributes) { - this.element("img", attributes); -} - -helma.Markup.Img = function(attributes) { - return new MarkupElement("img", attributes); -} - -helma.Markup.script = function(attributes, content) { - this.element("script", attributes, content); -} - -helma.Markup.Script = function(attributes, children) { - return new MarkupElement("script", attributes, children); -} - -helma.Markup.ul = function(attributes, content) { - this.element("ul", attributes, content); -} - -helma.Markup.Ul = function(attributes, children) { - return new MarkupElement("ul", attributes, children); -} - -helma.Markup.ol = function(attributes, content) { - this.element("ol", attributes, content); -} - -helma.Markup.Ol = function(attributes, children) { - return new MarkupElement("ol", attributes, children); -} - -helma.Markup.li = function(attributes, content) { - this.element("li", attributes, content); -} - -helma.Markup.Li = function(attributes, children) { - return new MarkupElement("li", attributes, children); -} - - -helma.Markup.a = function(attributes, content) { - this.element("a", attributes, content); -} - -helma.Markup.link = helma.Markup.a; - -helma.Markup.A = function(attributes, children) { - return new MarkupElement("a", attributes, children); -} - -helma.Markup.table = function(attributes, content) { - this.element("table", attributes, content); -} - -helma.Markup.Table = function(attributes, children) { - return new MarkupElement("table", attributes, children); -} - -helma.Markup.Colgroup = function(attributes, children) { - return new MarkupElement("colgroup", attributes, children); -} - -helma.Markup.colgroup = function(attributes, content) { - this.element("colgroup", attributes, content); -} - -helma.Markup.Col = function(attributes, children) { - return new MarkupElement("col", attributes, children); -} - -helma.Markup.col = function(attributes, content) { - this.element("col", attributes, content); -} - -helma.Markup.tr = function(attributes, content) { - this.element("tr", attributes, content); -} - -helma.Markup.Tr = function(attributes, children) { - return new MarkupElement("tr", attributes, children); -} - -helma.Markup.th = function(attributes, content) { - this.element("th", attributes, content); -} - -helma.Markup.Th = function(attributes, children) { - return new MarkupElement("th", attributes, children); -} - -helma.Markup.td = function(attributes, content) { - this.element("td", attributes, content); -} - -helma.Markup.Td = function(attributes, children) { - return new MarkupElement("td", attributes, children); -} - -helma.Markup.h1 = function(attributes, content) { - this.element("h1", attributes, content); -} - -helma.Markup.H1 = function(attributes, children) { - return new MarkupElement("h1", attributes, children); -} - -helma.Markup.h2 = function(attributes, content) { - this.element("h2", attributes, content); -} - -helma.Markup.H2 = function(attributes, children) { - return new MarkupElement("h2", attributes, children); -} - -helma.Markup.h3 = function(attributes, content) { - this.element("h3", attributes, content); -} - -helma.Markup.H3 = function(attributes, children) { - return new MarkupElement("h3", attributes, children); -} - -helma.Markup.h4 = function(attributes, content) { - this.element("h4", attributes, content); -} - -helma.Markup.H4 = function(attributes, children) { - return new MarkupElement("h4", attributes, children); -} - -helma.Markup.h5 = function(attributes, content) { - this.element("h5", attributes, content); -} - -helma.Markup.H5 = function(attributes, children) { - return new MarkupElement("h5", attributes, children); -} - -helma.Markup.h6 = function(attributes, content) { - this.element("h6", attributes, content); -} - -helma.Markup.H6 = function(attributes, children) { - return new MarkupElement("h6", attributes, children); -} - -helma.Markup.pre = function(attributes, content) { - this.element("pre", attributes, content); -} - -helma.Markup.Pre = function(attributes, children) { - return new MarkupElement("pre", attributes, children); -} - -helma.Markup.br = function(attributes) { - this.element("br", attributes); -} - -helma.Markup.Br = function(attributes, children) { - return new MarkupElement("br", attributes, children); -} - -helma.Markup.openTag = function(name, attributes) { - if (!name) { - throw "helma.Markup.openTag called without element name"; - } - res.write("<"); - res.write(name); - if (attributes) { - for (var i in attributes) { - if (typeof(attributes[i]) == "undefined") - continue; - res.write(" "); - res.write(i); - res.write("=\""); - res.write(encodeForm(attributes[i])); - res.write("\""); - } - } - res.write(">"); -} - -helma.Markup.closeTag = function(name) { - res.write(""); -} - - -/** - * utility object to provide an easy way - * for programmatically creating an x/html table. - * @param Number the number of columns in the table - * @param Object the table's, its rows' and cells' attributes - * @return Object an instance of TableWriter - */ -helma.Markup.TableWriter = function(numberOfColumns, attr) { - this.ncols = numberOfColumns; - if (isNaN(this.ncols)) - throw "Illegal argument in TableWriter(): first argument must be a number"; - if (this.ncols < 1) - throw "Illegal argument in TableWriter(): first argument must be > 1"; - this.written = 0; - // if no attributes object given, create an empty one - if (!attr) - attr = {}; - if (!attr.trEven) attr.trEven = attr.tr; - if (!attr.trOdd) attr.trOdd = attr.tr; - if (!attr.trHead) attr.trHead = attr.trEven; - if (!attr.tdEven) attr.tdEven = attr.td; - if (!attr.tdOdd) attr.tdOdd = attr.td; - if (!attr.thEven) attr.thEven = attr.th; - if (!attr.thOdd) attr.thOdd = attr.th; - this.attr = attr; - - // write header row? set to true to use "th" tags for first row - this.writeHeader = false; - // write to string buffer rather than response? - this.writeString = false; - - /** - * Write a table cell. - * @param String the table cell content as text - * @param attr an optional attributes holder for the td tag - */ - this.write = function(text, attr) { - // set up some variables - var isHeaderRow = (this.writeHeader && this.written < this.ncols); - var isNewRow = (this.written % this.ncols == 0); - var isEvenRow = ((this.written / this.ncols) % 2 == 0); - var isEvenCol = ((this.written % this.ncols) % 2 == 0); - // write out table and table row tags - if (this.written == 0) { - if (this.writeString) - res.push(); - helma.Markup.openTag("table", this.attr.table); - helma.Markup.openTag("tr", this.attr.trHead); - } else if (isNewRow) { - helma.Markup.closeTag("tr"); - if (isEvenRow) - helma.Markup.openTag("tr", this.attr.trEven); - else - helma.Markup.openTag("tr", this.attr.trOdd); - } - // get the attribute object for the table cell - if (!attr) { - // no explicit attribute given - if (isEvenCol) - attr = isHeaderRow ? this.attr.thEven : this.attr.tdEven; - else - attr = isHeaderRow ? this.attr.thOdd : this.attr.tdOdd; - } - // write out table cell tag - helma.Markup.openTag(isHeaderRow ? "th" : "td", attr); - // write out table cell contents - if (text) - res.write(text); - // close table cell - helma.Markup.closeTag(isHeaderRow ? "th" : "td"); - if (attr && !isNaN(attr.colspan)) - this.written += attr.colspan; - else - this.written += 1; - return; - }; - - /** - * Close all open table tags. - */ - this.close = function() { - if (this.written > 0) { - while (this.written++ % this.ncols != 0) - res.write(""); - res.write(""); - this.written = 0; - } - if (this.writeString) - return res.pop(); - return; - }; - return this; -} - - -//////////////////////////////////////////////////////////////////////// -// MarkupElement is the base class for all elements -//////////////////////////////////////////////////////////////////////// - -/** - * Element constructor. Takes a name, - * a map of attributes and an array of child - * elements as arguments. - */ -function MarkupElement(name, attributes, children) { - if (!attributes) - attributes = {}; - this.attr = attributes; - // if (name && !this._elementName) { - this._elementName = name; - // } else { - if (attributes && attributes.name) { - this.name = attributes.name; - // this.attr.name = name; - } - - this.map = {}; - - this.add(children); - - this.initValueProperty(); -} - -/** - * Add a new child element - */ -MarkupElement.prototype.add = function(child) { - if (typeof(child) == "undefined") { - return; - } - // initialize child array if necessary - if (!this.children) { - this.children = []; - } - if (child instanceof Array) { - for (var i in child) { - this.add(child[i]); - } - return; - } - // add new child - this.children.push(child); - // register child if it has a name property - if (child) { - if (child.name && !this.map[child.name]) { - this.map[child.name] = child; - } - // register grandchilds unless the name slot is already taken - for (var i in child.map) { - var c = child.map[i]; - if (c && c.name && !this.map[c.name]) { - this.map[c.name] = c; - } - } - // set parent property in child - child.parent = this; - } -} - -MarkupElement.prototype.firstChild = function() { - return this.children ? this.children[0] : undefined; -} - -MarkupElement.prototype.lastChild = function() { - return this.children ? this.children[this.children.length - 1] : undefined; -} - - -/** - * Render the element to the response buffer. - */ -MarkupElement.prototype.render = function(writer) { - if (!writer) - writer = res; - - this.processValueProperty(); - // open tag - if (this._elementName) { - writer.write("<"); - writer.write(this._elementName); - for (var i in this.attr) { - if (typeof(this.attr[i]) == "undefined") - continue; - writer.write(" "); - writer.write(i); - writer.write("=\""); - writer.write(encodeForm(this.attr[i])); - writer.write("\""); - } - // render type attribute if set - if (this._type) { - writer.write(" type=\""); - writer.write(this._type); - writer.write("\""); - } - // if no child objects create empty element and return - if (typeof(this.children) == "undefined") { - writer.write(" />"); - return; - } - writer.write(">"); - } - - // write child elements - if (typeof(this.children) != "undefined") { - if (this.children instanceof Array) { - for (var i in this.children) { - if (typeof(this.children[i]) instanceof MarkupElement) { - this.children[i].render(); - } else if (this.children[i]) { - writer.write(this.children[i]); - } - } - } else { - writer.write(this.children); - } - } - - // close tag - if (this._elementName) { - writer.write(""); - } -} - -/** - * Return an object containing the rendered child elements - * of this element keyed by element name. This is suitable - * for rendering the elements of a markup object through - * a skin, using the object returned by this function as macro - * handler. - */ -MarkupElement.prototype.renderMap = function() { - var map = {}; - if (this.children && typeof(this.children) == "object") { - for (var i in this.children) { - if (typeof(this.children[i]) == "object") { - var comp = this.children[i]; - map[comp.name] = comp.toString(); - } - } - } - return map; -} - -/** - * Return an array containing the rendered child elements - * of this element keyed index position. This is suitable - * for those cases where we want to print out a markup - * object's elements programmatically. - */ -MarkupElement.prototype.renderArray = function() { - var list = []; - if (this.children && typeof(this.children) == "object") { - for (var i in this.children) { - if (typeof(this.children[i]) == "object") { - var comp = this.children[i]; - list.push(comp.toString()); - } - } - } - return list; -} - -/** - * Render the element to a string. - */ -MarkupElement.prototype.toString = function() { - res.push(); - this.render(res); - return res.pop(); -} - -/** - * Recursively populate this object and its child objects, - * reading values from the argument object. - */ -MarkupElement.prototype.populate = function(obj) { - // if no object passed populate from req.data - if (!obj) - obj = req.data; - - // set value - if (this.name && this._type != "submit") - this.value = obj[this.name]; - - // populate named child elements - for (var i in this.map) { - if (typeof(this.map[i]) == "object" && this.map[i].populate) { - this.map[i].populate(obj); - } - } -} - -/** - * Recursively validate this element and its child elements. - */ -MarkupElement.prototype.validate = function() { - // apply constraints - if (this.constraints) { - for (var i in this.constraints) { - this.contstraints[i].apply(this); - } - } - - // validate child elements - for (var i in this.map) { - if (typeof(this.map[i]) == "object" && this.map[i].validate) { - this.map[i].validate(); - } - } -} - -/** - * Set up this Element's value property. - */ -MarkupElement.prototype.initValueProperty = function() { - this.value = this.attr.value; -} - -/** - * Process this Element's value property. - */ -MarkupElement.prototype.processValueProperty = function() { - this.attr.value = this.value; -} - -//////////////////////////////////////////////////////////////////////// -// MarkupElement subclasses for Html form elements. -//////////////////////////////////////////////////////////////////////// - - -/** - * Html textarea - */ -function HtmlTextarea(attributes, children) { - this.constructor("textarea", attributes, children); -} -HtmlTextarea.prototype = new MarkupElement("textarea"); - -/** - * Set up this Textarea's value property. - */ -HtmlTextarea.prototype.initValueProperty = function() { - if (typeof(this.attr.value) != "undefined") - this.value = this.attr.value; - else if (this.children && this.children.length > 0) - this.value = this.children[0]; -} - -/** - * Process this Textarea's value property. - */ -HtmlTextarea.prototype.processValueProperty = function() { - this.children = [encodeForm(this.value)]; -} - -/** - * Select list - */ -function HtmlSelect(attributes, children, selectedValue, firstLine) { - var options = []; - if (firstLine) - options.push(new MarkupElement("option", {value: ""}, "")); - if (children instanceof Array) { - for (var i in children) { - var child = children[i]; - var value, display; - if (child instanceof Array && child.length == 2) { - value = child[0]; - display = child[1]; - } else if (child.value != null && child.display != null) { - value = child.value; - display = child.display; - } else { - display = child; - value = i; - } - var attr = {value: value}; - if (value == selectedValue) - attr.selected = "selected"; - options.push(new MarkupElement("option", attr, display)); - } - } - this.constructor("select", attributes, options); -} -HtmlSelect.prototype = new MarkupElement("select"); - diff --git a/modules/tools/Global/helma.auth.js b/modules/tools/Global/helma.auth.js deleted file mode 100644 index 9e2abc50..00000000 --- a/modules/tools/Global/helma.auth.js +++ /dev/null @@ -1,91 +0,0 @@ -if (!global.helma) { - global.helma = {}; -} - -/** - * Performs basic admin level access checking for the specifed realm - * @param String realm for which access should be checked and bootstrapped - * @return true if access id verified, otherwise renders login form with bootstrapping instructions - */ -helma.auth = function(realm) { - - // helper function, checks if the client host matches an allowed host pattern, - // hostnames are converted, wildcards are only allowed in ip-addresses - var hostIsAllowed = function() { - if (!getProperty(realm+'AccessAllowed')) - return true; - else if (getProperty(realm+'AccessAllowed') == 'false') - return false; - var filter = new Packages.helma.util.InetAddressFilter(); - var str = getProperty(realm+'AccessAllowed'); - if (str != null && str != "") { - var arr = str.split(","); - for (var i in arr) { - str = new java.lang.String(arr[i]); - try { - filter.addAddress(str.trim()); - } catch (a) { - try { - str = java.net.InetAddress.getByName(str.trim()).getHostAddress(); - filter.addAddress(str); - } catch (b) { - app.log("error using address " + arr[i] + ": " + b); - } - } - } - } - return filter.matches(java.net.InetAddress.getByName(req.data.http_remotehost)); - } - - // Check if current session is authenticated for this realm - if (session.data[realm+'Authenticated'] && hostIsAllowed()) - return true; - - // Otherwise, guide to properly configure access authentication for this realm - res.data.fontface = 'Trebuchet MS, Verdana, sans-serif'; - res.data.href = path[path.length-1].href(req.action); - var pw = getProperty('adminAccess'); - var param = {}; - var accessAllowed = true; - if (req.data.username && req.data.password) { - if (pw && hostIsAllowed()) { - if (pw == Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(req.data.username + "-" + req.data.password)) { - session.data[realm+'Authenticated'] = true; - res.redirect(res.data.href); - } else { - param.message = 'Sorry, wrong password!'; - } - } else { - param.message = 'Currently, '+ realm + ' access is not allowed!
    '; - if (!pw) param.message += '\ - The adminAccess property is not set.
    \ - Before proceeding, add the following line to your app.properties or server.properties file:\ -

    adminAccess=' - + Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(req.data.username + "-" + req.data.password); - else param.message += 'The '+ realm +'AccessAllowed property does not match your host.
    \ - Before proceeding, remove this property from your app.properties or server.properties file \ - or include your host as follows:

    ' - + realm +'AccessAllowed=' + req.data.http_remotehost; - } - } - res.data.header = 'Authentication for '+ realm +' access'; - renderSkin('helma.auth.login', param); - return false; -} -helma.dontEnum('auth'); - -/** - * Invalidates a previously authenticated realm - * @param String realm for which an authentication should be invalidated - * @return true if an authenticated realm was invalidated, otherwise false - */ -helma.invalidate = function(realm) { - if (session.data[realm+'Authenticated']) { - delete session.data[realm+'Authenticated']; - return true; - } - else { - return false; - } -} -helma.dontEnum('invalidate'); diff --git a/modules/tools/Global/helma.auth.login.skin b/modules/tools/Global/helma.auth.login.skin deleted file mode 100644 index 0e519599..00000000 --- a/modules/tools/Global/helma.auth.login.skin +++ /dev/null @@ -1,23 +0,0 @@ - - - -<% response.title %> - - - -<% response.header prefix="

    " suffix="

    " %> -<% param.message prefix="

    " suffix="

    " %> -
    -

    Please enter the administrators username and password to proceed:

    -

    Username:

    -

    Password:

    - -
    - - diff --git a/modules/tools/Global/helma.shell.js b/modules/tools/Global/helma.shell.js deleted file mode 100644 index df1252ea..00000000 --- a/modules/tools/Global/helma.shell.js +++ /dev/null @@ -1,60 +0,0 @@ -if (!global.helma) { - global.helma = {}; -} - -/** - * Checks shell access, renders the shell skin and evaluates submitted shell commands and scripts - */ -helma.shell = function(realm) { - if (req.data.done) { - helma.invalidate('shell'); - helma.invalidate('sqlshell'); - helma.invalidate('inspector'); - res.redirect(this.href()); - } - if (!helma.auth('shell')) - res.abort(); - res.data.fontface = 'Trebuchet MS, Verdana, sans-serif'; - res.data.href = this.href(); - res.data.commands = encodeForm(req.data.commands); - var evalcode = req.data.command || req.data.commands; - if (!evalcode && helma.Inspector) { - if (!session.data.inspectorAuthenticated) - session.data.inspectorAuthenticated = true; - evalcode = '(new helma.Inspector(this)).action();"
    ";'; - } - if (evalcode) { - try { - var startTime = new Date(); - var evalResult = eval(evalcode); - var stopTime = new Date(); - res.write(evalResult); - if (req.data.commands) { - res.write('

    ') - res.write('') - res.write('Script evaluated in ' + (stopTime.getTime() - startTime.getTime()) +' milliseconds.'); - res.write('
    '); - } else if (!req.data.command) { - res.write('
    '); - } - } catch ( e ) { - res.write(''); - if ( e.javaException ) { - var s = new java.io.StringWriter(); - e.javaException.printStackTrace( new java.io.PrintWriter( s ) ); - res.write( s.toString() ); - } else { - res.write( format( e + '
    ' + e.fileName + ', lineNumber = ' + e.lineNumber ) ); - } - res.write('
    '); - if (req.data.commands) res.write('
    '); - } - } - if (!req.data.command) renderSkin('helma.shell'); -} -helma.dontEnum('shell'); - -/** - * Checks shell access, renders the shell skin and evaluates submitted shell commands and scripts - */ -HopObject.prototype[ (app.properties['shellAction'] || 'shell') +'_action' ] = helma.shell; diff --git a/modules/tools/Global/helma.shell.skin b/modules/tools/Global/helma.shell.skin deleted file mode 100644 index 5b436bd7..00000000 --- a/modules/tools/Global/helma.shell.skin +++ /dev/null @@ -1,124 +0,0 @@ - - -
    -
    - - -
    - -
    -
    - -
    - - -
    diff --git a/modules/tools/Global/helma.sqlshell.js b/modules/tools/Global/helma.sqlshell.js deleted file mode 100644 index d2808832..00000000 --- a/modules/tools/Global/helma.sqlshell.js +++ /dev/null @@ -1,753 +0,0 @@ -if (!global.helma) { - global.helma = {}; -} - -helma.sqlshell = {}; - -/** -* Get the helma datasource with the given name -*/ -helma.sqlshell.getDatasource = function(name) { - return app.getDbSource(name); -} - -/** - * Get an array of names of all defined data sources suitable for use - * in html.select macro. - */ -helma.sqlshell.getDatasources = function() { - var dbmap = app.getDbProperties(); - var sources = []; - for (var i in dbmap) { - var dot = i.indexOf("."); - if (dot > -1 && i.lastIndexOf(".url") == i.length-4) { - var source = i.substring(0, dot); - sources.push([source, source]); - } - } - return sources; -} - -helma.sqlshell.getRepositories = function() { - var rep = []; - var repos = app.getRepositories(); - for (var i in repos) { - if (repos[i].getClass() == Packages.helma.framework.repository.FileRepository) - rep.push([i, repos[i].name]); - } - return rep; -} - -helma.sqlshell.getProtoRepositories = function(protoName) { - var rep = []; - var proto = app.getPrototype(protoName); - if (proto) { - var repos = proto.getRepositories(); - for (var i in repos) { - if (repos[i].getClass() == Packages.helma.framework.repository.FileRepository) - rep.push([i, repos[i].name]); - } - } - return rep; -} - -/** -* Main action to set the Helma Dbsource, display forms, perform queries. -*/ -helma.sqlshell.main = function() { - // If done, end sqlshell session - if (req.data.done) { - helma.invalidate('sqlshell'); - if (session.data.sqlShellReturnUrl) { - var targetUrl = session.data.sqlShellReturnUrl; - delete session.data.sqlShellReturnUrl; - } else { - var targetUrl = path.href(); - } - res.redirect(targetUrl); - } - - // Check if sqlshell is called from the shell tool - if (req.data.introFrom) { - session.data.sqlShellReturnUrl = req.data.introFrom; - if (session.data.shellAuthenticated) - session.data.sqlshellAuthenticated = true; - } - - // Check authentication - if (!helma.auth('sqlshell')) - res.abort(); - - // Handle authenticated requests - res.handlers.html = helma.sqlshell.html; - var param = {}; - param.datasource = req.data.datasource; - res.data.fontface = 'Verdana, sans-serif'; - /* if (req.data.schema) - session.data.sqlshellSchema = req.data.schema; - if (req.data.datasource) - session.data.sqlshellDatasource = req.data.datasource; */ - var dsource = req.data.datasource ? - helma.sqlshell.getDatasource(req.data.datasource) : null; - if (dsource) { - (new helma.sqlshell.Datasource(dsource)).main(); - } else { - if (req.data.datasource && req.isPost()) { - param.message = "Sorry, data source " + req.data.datasource + - " is not defined for this application."; - } - res.data.header = "Choose data source"; - res.data.datasources = helma.sqlshell.getDatasources(); - res.data.body = renderSkinAsString("helma.sqlshell.selectdb", param); - renderSkin("helma.sqlshell.page"); - } -} - -helma.sqlshell.Datasource = function(datasource) { - this.datasource = datasource; - this.name = datasource.name; - return this; -} - -/** -* Get an array of schema names defined in the current database. -*/ -helma.sqlshell.Datasource.prototype.getSchemas = function(meta) { - // get available schemas and set up an array for the drop down box: - var schemas = []; - var t = meta.getSchemas(); - while (t.next()) { - var s = t.getString(1); - schemas.push([s, s]); - } - return schemas; -} - -/** - * Get table names and set up an array for the drop down box - */ -helma.sqlshell.Datasource.prototype.getTables = function(meta, schema) { - var tables = [["", ""]]; - var t = meta.getTables (null, schema, "%", null); - while (t.next()) { - var table = t.getString (3); - tables.push([table, table]); - } - return tables; -} - -helma.sqlshell.Datasource.prototype.getColumns = function(meta, schema, table) { - var columns = []; - var t = meta.getColumns(null, schema, table, "%"); - while (t.next()) { - columns.push(t.getString(4)); - } - return columns; -} - -helma.sqlshell.Datasource.prototype.getPrototypes = function() { - var protos = [["", ""]]; - var protomap = app.getPrototypes(); - for (var i in protomap) { - if (protomap[i].lowerCaseName != "global") { - protos.push([protomap[i].name, protomap[i].name]); - } - } - return protos.sort(function(a, b) {return a < b ? -1 : 1;}); -} - -helma.sqlshell.Datasource.prototype.href = function(name) { - var href = path.href(req.action) + "?datasource="; - href += encode(req.data.datasource); - href += "&schema="; - href += encode(req.data.schema); - href += "&tab="; - href += req.data.tab; - return href; -} - -helma.sqlshell.Datasource.prototype.href_macro = function(param) { - return this.href(param.name); -} - -helma.sqlshell.colors = { - explore: "#bd9", query: "#db9", map: "#9bd" -} - -helma.sqlshell.Datasource.prototype.main = function() { - res.handlers.datasource = this; - if (!req.data.tab) { - req.data.tab = "explore"; - } - res.data.tabcolor = helma.sqlshell.colors[req.data.tab]; - - var param = new Object(); - param.action = this.href(); - - // get connection - var con = this.datasource.getConnection(); - - // get database meta data - var meta = con.getMetaData(); - - res.data.datasources = helma.sqlshell.getDatasources(); - res.data.schemas = this.getSchemas(meta); - var schema = req.data.schema; - res.data.tables = this.getTables(meta, schema); - - if (req.data.action) { - app.data.repositories = helma.sqlshell.getRepositories(); - if (req.data.action == "createproto" ) { - var repos = app.repositories[req.data.repository]; - var file = new File(repos.directory.toString(), req.data.protoname); - if (file.mkdir()) { - - renderSkin(this.getSkin("closePopup"), { - parentUrl: this.href() + "&prototype=" + req.data.protoname, - message: "

    Created directory " + file + "

    " + - "

    Please wait for prototypes to be updated...

    " - } ); - return; - } else { - res.debug("Couldn't create directory: " + file); - res.data.body = renderSkinAsString(this.getSkin("newproto")); - } - } else if (req.data.action == "extras") { - var p = {}; - var t = app.getPrototype(req.data.target); - var target = t && t.dbMapping ? t.dbMapping.tableName : null; - p.targetColumns = this.getColumns(meta, schema, target).toSource(); - p.localColumns = this.getColumns(meta, schema, req.data.__sqlshell_table__).toSource(); - res.data.body = renderSkinAsString(this.getSkin(req.data.action), p); - } else if (req.data.action == "generate") { - if (req.data.create) { - renderSkin(this.getSkin("closePopup"), { - parentUrl: this.href() + "&prototype=" + req.data.__sqlshell_prototype__, - message: "

    Created type mapping " + file + "

    " + - "

    Please wait for prototypes to be updated...

    " - } ); - } else { - var fields = {}; - var s = new java.lang.StringBuffer(); - for (var i in req.data) { - if (i.indexOf("maptype_") == 0) { - fields[i.substring(8)] = req.data[i]; - } - s.append(""); - } - if (req.data.__sqlshell_create__) { - // res.data.body = renderSkinAsString(this.getSkin("generate"), p); - var repos = app.getPrototype(req.data.__sqlshell_prototype__).repositories; - var resName = "type.properties"; - for (var i in repos) { - var resource = repos[i].getResource(resName); - if (resource && resource.exists()) { - if (resource.getClass() == Packages.helma.framework.repository.FileResource) { - var file = new File(resource.getName()); - var backup = new File(resource.getName() + ".bak"); - if (backup.exists()) { - var n = 1; - do { - backup = new File(resource.getName() + ".bak." + n++) - } while (backup.exists()); - } - if (!file.renameTo(backup)) { - res.debug("ERROR: Couldn't create backup for " + resource); - } - } else { - res.debug("WARNING: Couldn't move " + resource); - } - } - } - var file = new File(repos[req.data.__sqlshell_repository__].getResource(resName).getName()); - file.open(); - file.writeln("# Created by Helma SqlShell at " + new Date()); - if (req.data.__sqlshell_extends__) - file.writeln("_extends = " + req.data.__sqlshell_extends__); - if (req.data.__sqlshell_primaryKey__) - file.writeln("_id = " + req.data.__sqlshell_primaryKey__); - if (req.data.__sqlshell_protoColumn__) - file.writeln("_prototype = " + req.data.__sqlshell_protoColumn__); - if (req.data.__sqlshell_nameColumn__) - file.writeln("_name = " + req.data.__sqlshell_nameColumn__); - file.writeln(""); - for (var i in fields) { - var propType = parseInt(fields[i]); - var propName = req.data[i]; - if (!propName) continue; - file.write(propName); - file.write(" = "); - switch (propType) { - case 0: - file.writeln(req.data[i]); - break; - case 1: - file.writeln("object(" + req.data["target_" + i] + ")"); - break; - case 2: - file.writeln("collection(" + req.data["target_" + i] + ")"); - break; - case 3: - file.writeln("mountpoint(" + req.data["target_" + i] + ")"); - break; - default: - res.debug(i + ": " + fields[i]); - } - for (var m in this.mappingOptions) { - if (this.mappingOptions[m] <= propType && req.data[i + "_" + m]) { - file.write(propName); - file.write("."); - file.write(m.replace("_", ".")); - file.write(" = "); - file.writeln(req.data[i + "_" + m]); - } - } - file.writeln(""); - } - file.close(); - res.data.body = "Successfully created mapping in " + file; - } else { - var p = {}; - p.data = s.toString(); - res.data.repositories = helma.sqlshell.getProtoRepositories(req.data.__sqlshell_prototype__); - res.data.body = renderSkinAsString(this.getSkin("generate"), p); - } - } - } else { - res.data.body = renderSkinAsString(this.getSkin(req.data.action)); - } - } else { - // should we display type info on some table? - if (req.data.tab == "explore") { - param.body = this.explore(meta, schema, param); - } else if (req.data.tab == "query") { - param.body = this.query(con, param); - } else if (req.data.tab == "map") { - param.body = this.map(meta, schema, con, param); - } - // render the inner page skin and then the whole page - res.data.body = renderSkinAsString("helma.sqlshell.main", param); - } - - renderSkin("helma.sqlshell.page"); -} - -helma.sqlshell.Datasource.prototype.explore = function(meta, schema, param) { - res.push(); - renderSkin(this.getSkin("explore"), param); - if (req.data.__sqlshell_table__) { - var tableStyle = { table: { "class": "explore" }, td: { "class": "explore" } }; - var t = meta.getColumns(null, schema, req.data.__sqlshell_table__, "%"); - var writer = new helma.Markup.TableWriter(6, tableStyle); - writer.writeHeader = true; - var columnNames = ["Column Name", "Column Type", "Column Size", - "Nullable", "Default Value", "Extras"]; - for (var c in columnNames) { - writer.write(columnNames[c]); - } - while (t.next()) { - writer.write(t.getString(4)); - writer.write(t.getString(6)); - writer.write(t.getString(7)); - writer.write(t.getString(18)); - writer.write(t.getString(13)); - writer.write(t.getString(12)); - } - writer.close(); - } - return res.pop(); -} - -helma.sqlshell.Datasource.prototype.query = function(con, param) { - // some SQL has been submitted - evaluate it - if (req.data.sql) { - var query = req.data.sql.trim(); - - con.setReadOnly(false); - var stmt = con.createStatement(); - var value; - try { - value = stmt.execute(query); - if (!value) { - param.updated = stmt.getUpdateCount(); - } else { - var rs = stmt.getResultSet(); - var rsmeta = rs.getMetaData(); - var ncol = rsmeta.getColumnCount(); - - res.push(); - var tableStyle = { table: { "class": "query" }, td: { "class": "query" } }; - var writer = new helma.Markup.TableWriter(ncol, tableStyle); - writer.writeHeader = true; - for (var i=1; i<=ncol; i++) { - writer.write(rsmeta.getColumnName(i)); - } - - while (rs.next()) { - for (var i=1; i<=ncol; i++) { - writer.write(encode(rs.getString(i))); - } - } - - writer.close(); - param.resultset = res.pop(); - } - } catch (error) { - param.message = "Error: " + error; - } - } - return renderSkinAsString(this.getSkin("query"), param); -} - -helma.sqlshell.Datasource.prototype.map = function(meta, schema, con, param) { - // for (var i in req.data) res.debug(i); - res.push(); - res.data.prototypes = this.getPrototypes(); - var proto = app.getPrototype(req.data.__sqlshell_prototype__); - if (proto) { - var tableStyle = { table: { "class": "map" }, td: { "class": "map" } }; - var dbmap = proto.getDbMapping(); - if (!req.data.__sqlshell_table__ || - req.data.__sqlshell_prototype__ != req.data.previousProto) { - req.data.__sqlshell_table__ = dbmap.tableName; - } - param.tableSelect = renderSkinAsString(createSkin('Map to table \ - <% html.select name="__sqlshell_table__" options="response.tables" \ - onchange="document.forms.tab.submit();"%>')); - } - renderSkin(this.getSkin("map"), param); - if (proto) { - var maptypes = ["Primitive", "Reference", "Collection", "Mountpoint"]; - var tableStyle = { table: { "class": "map" }, td: { "class": "map" } }; - if (req.data.__sqlshell_table__) { - var primKey = ""; - try { - var k = meta.getPrimaryKeys(null, schema, req.data.__sqlshell_table__); - if (k.next()) { - primKey = k.getString(4); - } - if (k.next()) { - helma.Markup.p({"class": "error"}, "Table has composed primary key!"); - } - } catch (error) { - helma.Markup.p({"class": "error"}, "Error retrieving primary key: " + error); - } - var t = meta.getColumns(null, schema, req.data.__sqlshell_table__, "%"); - var columns = []; - res.data.columns = [["", ""]]; - while (t.next()) { - var colname = t.getString(4); - columns.push(colname); - res.data.columns.push([colname, colname]); - } - var writer = new helma.Markup.TableWriter(2, tableStyle); - writer.write("Extends "); - var ext = dbmap.getExtends() || app.getPrototype("hopobject").name; - writer.write(helma.Markup.Select({name: "__sqlshell_extends__"}, res.data.prototypes, ext)); - writer.write("Primary key column "); - writer.write(helma.Markup.Select({name: "__sqlshell_primaryKey__"}, res.data.columns, primKey)); - writer.write("Prototype column "); - writer.write(helma.Markup.Select({name: "__sqlshell_protoColumn__"}, res.data.columns, dbmap.prototypeField)); - writer.write("Name column "); - writer.write(helma.Markup.Select({name: "__sqlshell_nameColumn__"}, res.data.columns, dbmap.nameField)); - writer.close(); - tableStyle = { table: { "class": "map", id: "maptable" }, td: { "class": "map" } }; - writer = new helma.Markup.TableWriter(5, tableStyle); - writer.writeHeader = true; - var headers = ["Column Name", "Property Name", "Mapping", - "Target Prototype", "Extras"]; - for (var c in headers) { - writer.write(headers[c]); - } - for (var col in columns) { - var colname = columns[col]; - // if (colname == primKey) continue; - var rel = dbmap.columnNameToRelation(colname); - var value = rel && rel.propName ? rel.propName : this.toCamelCase(colname); - var type = rel ? rel.refType : 0; - var targetDisplay = type > 0 ? '': ' style="display: none;"'; - var target = rel && rel.targetType ? rel.targetType.typeName : ""; - writer.write(colname); - writer.write(''); - writer.write(helma.Markup.Select({name: "maptype_" + colname, - onchange: "toggleEditor(this)"}, maptypes, type)); - writer.write('
    ' + - helma.Markup.Select({name: "target_" + colname}, res.data.prototypes, target) + '
    '); - var buffer = new java.lang.StringBuffer(); - var config = rel ? wrapJavaMap(rel.config) : {}; - for (var i in this.mappingOptions) { - // var name = i.replace('_', '.'); - var name = colname + "_" + i; - buffer.append(helma.Markup.Hidden({id: name, name: name, value: config[i] }).toString()); - } - buffer.append(helma.Markup.A({href: this.href() + "&action=extras&col=" + colname, - id:"extralink_" + colname, style: type > 0 ? '': 'display: none;', - onclick: "openExtraEditor(this.href, '" + colname + "'); return false;"}, - "edit").toString()); - writer.write(buffer); - /* writer.write(helma.Markup.A({href: this.href() + "&action=extras&col=" + colname, - id:"extralink_" + colname, style: type > 0 ? '': 'display: none;', - onclick: "openPopup(this.href, 'extras'); return false;"}, - "edit")); */ - } - var props = dbmap.getPropertyNames(); - var collectionCount = 0; - for (var p in props) { - var rel = dbmap.propertyToRelation(props[p]); - if (rel.refType < 1 || (rel.dbField && rel.dbField != primKey)) { - continue; - } - var propName = rel.propName; - var target = rel.targetType ? rel.targetType.typeName : ""; - var type = rel.refType; - if (type == 2 && !rel.dbField) { - // helma does not separate between collections and mountpoints internally - type = 3; - } - var colname = "collection_" + (collectionCount++); - writer.write(""); - writer.write(''); - writer.write(helma.Markup.Select({name: "maptype_" + colname, - onchange: "toggleEditor(this)"}, maptypes, type)); - writer.write('
    ' + - helma.Markup.Select({name: "target_" + colname}, res.data.prototypes, target) + '
    '); - var buffer = new java.lang.StringBuffer(); - var config = wrapJavaMap(rel.config); - for (var i in this.mappingOptions) { - // var name = i.replace('_', '.'); - var name = colname + "_" + i; - buffer.append(helma.Markup.Hidden({id: name, name: name, value: config[i] }).toString()); - } - buffer.append(helma.Markup.A({href: this.href() + "&action=extras&col=" + colname, - id:"extralink_" + colname, - onclick: "openExtraEditor(this.href, '" + colname + "'); return false;"}, - "edit").toString()); - writer.write(buffer); - } - writer.close(); - // FIXME: MAJOR HACK ********************************** - res.writeln(''); - // END OF MAJOR HACK ********************************** - helma.Markup.a({href: "#", onclick:'return appendTableRow("maptable");'}, "Add Collection"); - res.write(" "); - helma.Markup.submit({name: "generateMapping", - onclick:"submitFormToPopup(document.forms.tab, '" + this.href() + "&action=generate', 'generate',500,350); return false;", - value: "Generate Mapping"}); - - } - } - return res.pop(); -} - -helma.sqlshell.Datasource.prototype.mappingOptions = { - local: 1, - foreign: 1, - order: 2, - accessname: 2, - group: 2, - group_order: 2, - group_prototype: 2, - filter: 2, - filter_additionalTables: 2, - loadmode: 1, - cachemode: 2, - maxsize: 2, - hints: 2, - logicalOperator: 2, - readonly: 2, - "private": 2 -} - -helma.sqlshell.Datasource.prototype.toCamelCase = function(str) { - var s = str.toLowerCase().split(/[-_]/); - str = s[0]; - for (var i=1; iSQL:
    \ -
    \ - \ - \ - <% param.message prefix="

    " suffix="

    " %>\ - <% param.updated prefix="

    "\ - prefix="Statement executed, "\ - suffix=" row(s) affected

    " %>\ - <% param.resultset %>'); - - case "explore": return createSkin('
    Describe Table \ - <% html.select name="__sqlshell_table__" options="response.tables" \ - onchange="document.forms.tab.submit();" %>\ -
    \ - <% param.tableheader prefix="

    " suffix="

    " %>\ - <% param.tableinfo %>'); - - case "map": return createSkin('
    Prototype \ - <% html.select name="__sqlshell_prototype__" options="response.prototypes" \ - onchange="document.forms.tab.submit();" %>\ - [new]\ - <% param.tableSelect %> \ - \ - \ - \ -
    '); - - case "newproto": return createSkin('
    \ - Prototype Name:

    \ - Create in Repository:
    <% html.select name="repository" options="app.repositories" %>

    \ - \ -
    '); - - case "extras": return createSkin('
    \ -

    Extra parameters for ' + req.data.col + '

    \ - \ - \ -
    \ - \ -
    '); - - case "generate": return createSkin('
    \ - Create type.properties in Repository:
    <% html.select name="__sqlshell_repository__"\ - options="response.repositories" %>

    \ - \ - <% param.data %>\ -
    '); - - case "closePopup": return createSkin('\ - \ - \ - \ - closing window\ - \ - \ - \ - <% param.message %>\ - \ - '); - - default: return createSkin("No skin defined for " + name); - } -} - -helma.sqlshell.Datasource.href = - -HopObject.prototype[ (app.properties['sqlshellAction'] || 'sqlshell') +'_action' ] = helma.sqlshell.main; - - -helma.dontEnum('sqlshell'); - - - - -//////////////////////////////////////////////////////////////////////// -// Macro handler for Html tags -//////////////////////////////////////////////////////////////////////// - -helma.sqlshell.html = { - - tablink_macro: function(param) { - var href = req.action + "?datasource="; - href += encode(req.data.datasource); - href += "&schema="; - href += encode(req.data.schema); - href += "&tab="; - href += param.name; - var attr = { href: href, "class": "tab" }; - if (req.data.tab == param.name) { - attr["class"] += " activetab"; - } else { - attr["class"] += " passivetab"; - } - helma.Markup.element("a", attr, param.name); - }, - - select_macro: function(param) { - if (!param.name) { - throw "dropDown macro requires name attribute"; - } - if (!param.options) { - throw "dropDown macro requires options attribute"; - } - var opts = param.options.split("."); - if (opts.length != 2) { - throw "options attribute must be of the form 'handler.options'"; - } - var handler = this.getHandler(opts[0]); - if (!handler) { - throw "handler '"+opts[0]+" not found - " + - "valid options are (response|request|session|app)"; - } - var options = handler[opts[1]]; - if (!options) { - throw param.options+" is not defined "; - } - if (options.length == 0) { - return; - } - var attr = {}; - for (var i in param) { - if (i != "options" && i != "prefix" && i != "suffix") { - attr[i] = param[i]; - } - } - helma.Markup.select(attr, options, req.data[param.name], param.firstoption); - }, - - getHandler: function (handlerName) { - switch (handlerName) { - case "response": - return res.data; - case "request": - return req.data; - case "session": - return session.data; - case "app": - return app.data; - } - return null; - } -} diff --git a/modules/tools/Global/helma.sqlshell.main.skin b/modules/tools/Global/helma.sqlshell.main.skin deleted file mode 100644 index 4c33095d..00000000 --- a/modules/tools/Global/helma.sqlshell.main.skin +++ /dev/null @@ -1,30 +0,0 @@ -

    Helma Sql Shell

    - -
    -
    - - <% html.select name="datasource" options="response.datasources" - prefix="Data Source: " onchange="document.forms.datasource.submit(); %> -    - <% html.select name="schema" options="response.schemas" - prefix="Schema: " onchange="document.forms.datasource.submit(); %> -
    -
    - -
    - -
    -<% html.tablink name="explore" %> -<% html.tablink name="query" %> -<% html.tablink name="map" %> -
    - - - - - -<% param.body %> - -

    - -
    diff --git a/modules/tools/Global/helma.sqlshell.page.skin b/modules/tools/Global/helma.sqlshell.page.skin deleted file mode 100644 index a6718273..00000000 --- a/modules/tools/Global/helma.sqlshell.page.skin +++ /dev/null @@ -1,207 +0,0 @@ - - - - -Helma SqlShell <% response.title %> - - - - - - - -<% response.header prefix="

    " suffix="

    " %> - -<% response.body %> - - diff --git a/modules/tools/Global/helma.sqlshell.selectdb.skin b/modules/tools/Global/helma.sqlshell.selectdb.skin deleted file mode 100644 index 27eb9977..00000000 --- a/modules/tools/Global/helma.sqlshell.selectdb.skin +++ /dev/null @@ -1,10 +0,0 @@ -

    Data sources are defined in db.properties files either at server or application level.

    - -<% param.message prefix="

    " suffix="

    " %> - -
    -Please enter a valid data source name: - <% html.select name="datasource" options="response.datasources" %> -    - -
    \ No newline at end of file diff --git a/renovate.json b/renovate.json deleted file mode 100644 index fd76f22d..00000000 --- a/renovate.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - - "extends": [ - "config:recommended", - "mergeConfidence:all-badges", - "npm:unpublishSafe", - ":disableRateLimiting", - ":pinVersions", - ":semanticCommitsDisabled" - ], - - "osvVulnerabilityAlerts": true, - - "vulnerabilityAlerts": { - "labels": ["security", "urgent"], - "automerge": true - }, - - "labels": ["dependency"], - - "packageRules": [ - { - "description": "Label Helma core packages", - "matchFiles": ["build.gradle"], - "addLabels": ["core"] - }, - { - "description": "Label major version bumps", - "matchUpdateTypes": ["major"], - "addLabels": ["major"] - }, - { - "description": "Label packages required at runtime", - "matchDepTypes": ["dependencies"], - "addLabels": ["runtime"] - }, - { - "description": "Group Jetty packages", - "matchPackagePrefixes": ["org.eclipse.jetty"], - "groupName": "Jetty packages" - }, - { - "description": "Group Lucene packages", - "matchPackagePrefixes": ["org.apache.lucene"], - "groupName": "Lucene packages" - } - ] -} - diff --git a/server.properties b/server.properties new file mode 100644 index 00000000..ce1ef12f --- /dev/null +++ b/server.properties @@ -0,0 +1,27 @@ +# The SMTP server to use for sending mails. Set and +# uncomment this line before trying to send mails from +# Helma applications. +# +# smtp=mail.yourdomain.com + + +# Some examples for server-wide locale settings +# (please refer to http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html +# for country codes, resp. http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt +# for language codes). +# +# country = AT +# language = de +# +# country = UK +# language = en +# +# country = FR +# language = fr +# +# country = CZ +# language = cs + +# list ip addresses for admin-application here: +allowAdmin=127.0.0.1, 192.168.0.1 + diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 5fd2dc60..00000000 --- a/settings.gradle +++ /dev/null @@ -1,21 +0,0 @@ -rootProject.name = 'helma' - -// Copy task ignores multiple files per default -// See https://github.com/gradle/gradle/issues/11176 -org.apache.tools.ant.DirectoryScanner.removeDefaultExclude('**/.git') -org.apache.tools.ant.DirectoryScanner.removeDefaultExclude('**/.git/**') -org.apache.tools.ant.DirectoryScanner.removeDefaultExclude('**/.gitignore') - -include 'launcher' -include 'modules' -include 'jala' -include 'hopKit' -include 'test' - -project(':modules').projectDir = file('modules/helma') -project(':jala').projectDir = file('modules/jala') -project(':hopKit').projectDir = file('modules/jala/util/HopKit') -project(':test').projectDir = file('modules/jala/util/Test') - -// Rename this project to prevent redundancy and renaming of main project (VSC does not care, though) -project(':modules').name = 'modules' diff --git a/src/Acme/IntHashtable.java b/src/Acme/IntHashtable.java new file mode 100644 index 00000000..a4dcae34 --- /dev/null +++ b/src/Acme/IntHashtable.java @@ -0,0 +1,396 @@ +// IntHashtable - a Hashtable that uses ints as the keys +// +// This is 90% based on JavaSoft's java.util.Hashtable. +// +// Visit the ACME Labs Java page for up-to-date versions of this and other +// fine Java utilities: http://www.acme.com/java/ + +package Acme; + +import java.util.*; + +/// A Hashtable that uses ints as the keys. +//

    +// Use just like java.util.Hashtable, except that the keys must be ints. +// This is much faster than creating a new Integer for each access. +//

    +// Fetch the software.
    +// Fetch the entire Acme package. +//

    +// @see java.util.Hashtable + +public class IntHashtable extends Dictionary implements Cloneable + { + /// The hash table data. + private IntHashtableEntry table[]; + + /// The total number of entries in the hash table. + private int count; + + /// Rehashes the table when count exceeds this threshold. + private int threshold; + + /// The load factor for the hashtable. + private float loadFactor; + + /// Constructs a new, empty hashtable with the specified initial + // capacity and the specified load factor. + // @param initialCapacity the initial number of buckets + // @param loadFactor a number between 0.0 and 1.0, it defines + // the threshold for rehashing the hashtable into + // a bigger one. + // @exception IllegalArgumentException If the initial capacity + // is less than or equal to zero. + // @exception IllegalArgumentException If the load factor is + // less than or equal to zero. + public IntHashtable( int initialCapacity, float loadFactor ) + { + if ( initialCapacity <= 0 || loadFactor <= 0.0 ) + throw new IllegalArgumentException(); + this.loadFactor = loadFactor; + table = new IntHashtableEntry[initialCapacity]; + threshold = (int) ( initialCapacity * loadFactor ); + } + + /// Constructs a new, empty hashtable with the specified initial + // capacity. + // @param initialCapacity the initial number of buckets + public IntHashtable( int initialCapacity ) + { + this( initialCapacity, 0.75f ); + } + + /// Constructs a new, empty hashtable. A default capacity and load factor + // is used. Note that the hashtable will automatically grow when it gets + // full. + public IntHashtable() + { + this( 101, 0.75f ); + } + + /// Returns the number of elements contained in the hashtable. + public int size() + { + return count; + } + + /// Returns true if the hashtable contains no elements. + public boolean isEmpty() + { + return count == 0; + } + + /// Returns an enumeration of the hashtable's keys. + // @see IntHashtable#elements + public synchronized Enumeration keys() + { + return new IntHashtableEnumerator( table, true ); + } + + /// Returns an enumeration of the elements. Use the Enumeration methods + // on the returned object to fetch the elements sequentially. + // @see IntHashtable#keys + public synchronized Enumeration elements() + { + return new IntHashtableEnumerator( table, false ); + } + + /// Returns true if the specified object is an element of the hashtable. + // This operation is more expensive than the containsKey() method. + // @param value the value that we are looking for + // @exception NullPointerException If the value being searched + // for is equal to null. + // @see IntHashtable#containsKey + public synchronized boolean contains( Object value ) + { + if ( value == null ) + throw new NullPointerException(); + IntHashtableEntry tab[] = table; + for ( int i = tab.length ; i-- > 0 ; ) + { + for ( IntHashtableEntry e = tab[i] ; e != null ; e = e.next ) + { + if ( e.value.equals( value ) ) + return true; + } + } + return false; + } + + /// Returns true if the collection contains an element for the key. + // @param key the key that we are looking for + // @see IntHashtable#contains + public synchronized boolean containsKey( int key ) + { + IntHashtableEntry tab[] = table; + int hash = key; + int index = ( hash & 0x7FFFFFFF ) % tab.length; + for ( IntHashtableEntry e = tab[index] ; e != null ; e = e.next ) + { + if ( e.hash == hash && e.key == key ) + return true; + } + return false; + } + + /// Gets the object associated with the specified key in the + // hashtable. + // @param key the specified key + // @returns the element for the key or null if the key + // is not defined in the hash table. + // @see IntHashtable#put + public synchronized Object get( int key ) + { + IntHashtableEntry tab[] = table; + int hash = key; + int index = ( hash & 0x7FFFFFFF ) % tab.length; + for ( IntHashtableEntry e = tab[index] ; e != null ; e = e.next ) + { + if ( e.hash == hash && e.key == key ) + return e.value; + } + return null; + } + + /// A get method that takes an Object, for compatibility with + // java.util.Dictionary. The Object must be an Integer. + public Object get( Object okey ) + { + if ( ! ( okey instanceof Integer ) ) + throw new InternalError( "key is not an Integer" ); + Integer ikey = (Integer) okey; + int key = ikey.intValue(); + return get( key ); + } + + /// Rehashes the content of the table into a bigger table. + // This method is called automatically when the hashtable's + // size exceeds the threshold. + protected void rehash() + { + int oldCapacity = table.length; + IntHashtableEntry oldTable[] = table; + + int newCapacity = oldCapacity * 2 + 1; + IntHashtableEntry newTable[] = new IntHashtableEntry[newCapacity]; + + threshold = (int) ( newCapacity * loadFactor ); + table = newTable; + + for ( int i = oldCapacity ; i-- > 0 ; ) + { + for ( IntHashtableEntry old = oldTable[i] ; old != null ; ) + { + IntHashtableEntry e = old; + old = old.next; + + int index = ( e.hash & 0x7FFFFFFF ) % newCapacity; + e.next = newTable[index]; + newTable[index] = e; + } + } + } + + /// Puts the specified element into the hashtable, using the specified + // key. The element may be retrieved by doing a get() with the same key. + // The key and the element cannot be null. + // @param key the specified key in the hashtable + // @param value the specified element + // @exception NullPointerException If the value of the element + // is equal to null. + // @see IntHashtable#get + // @return the old value of the key, or null if it did not have one. + public synchronized Object put( int key, Object value ) + { + // Make sure the value is not null. + if ( value == null ) + throw new NullPointerException(); + + // Makes sure the key is not already in the hashtable. + IntHashtableEntry tab[] = table; + int hash = key; + int index = ( hash & 0x7FFFFFFF ) % tab.length; + for ( IntHashtableEntry e = tab[index] ; e != null ; e = e.next ) + { + if ( e.hash == hash && e.key == key ) + { + Object old = e.value; + e.value = value; + return old; + } + } + + if ( count >= threshold ) + { + // Rehash the table if the threshold is exceeded. + rehash(); + return put( key, value ); + } + + // Creates the new entry. + IntHashtableEntry e = new IntHashtableEntry(); + e.hash = hash; + e.key = key; + e.value = value; + e.next = tab[index]; + tab[index] = e; + ++count; + return null; + } + + /// A put method that takes an Object, for compatibility with + // java.util.Dictionary. The Object must be an Integer. + public Object put( Object okey, Object value ) + { + if ( ! ( okey instanceof Integer ) ) + throw new InternalError( "key is not an Integer" ); + Integer ikey = (Integer) okey; + int key = ikey.intValue(); + return put( key, value ); + } + + /// Removes the element corresponding to the key. Does nothing if the + // key is not present. + // @param key the key that needs to be removed + // @return the value of key, or null if the key was not found. + public synchronized Object remove( int key ) + { + IntHashtableEntry tab[] = table; + int hash = key; + int index = ( hash & 0x7FFFFFFF ) % tab.length; + for ( IntHashtableEntry e = tab[index], prev = null ; e != null ; prev = e, e = e.next ) + { + if ( e.hash == hash && e.key == key ) + { + if ( prev != null ) + prev.next = e.next; + else + tab[index] = e.next; + --count; + return e.value; + } + } + return null; + } + + /// A remove method that takes an Object, for compatibility with + // java.util.Dictionary. The Object must be an Integer. + public Object remove( Object okey ) + { + if ( ! ( okey instanceof Integer ) ) + throw new InternalError( "key is not an Integer" ); + Integer ikey = (Integer) okey; + int key = ikey.intValue(); + return remove( key ); + } + + /// Clears the hash table so that it has no more elements in it. + public synchronized void clear() + { + IntHashtableEntry tab[] = table; + for ( int index = tab.length; --index >= 0; ) + tab[index] = null; + count = 0; + } + + /// Creates a clone of the hashtable. A shallow copy is made, + // the keys and elements themselves are NOT cloned. This is a + // relatively expensive operation. + public synchronized Object clone() + { + try + { + IntHashtable t = (IntHashtable) super.clone(); + t.table = new IntHashtableEntry[table.length]; + for ( int i = table.length ; i-- > 0 ; ) + t.table[i] = ( table[i] != null ) ? + (IntHashtableEntry) table[i].clone() : null; + return t; + } + catch ( CloneNotSupportedException e) + { + // This shouldn't happen, since we are Cloneable. + throw new InternalError(); + } + } + + /// Converts to a rather lengthy String. + public synchronized String toString() + { + int max = size() - 1; + StringBuffer buf = new StringBuffer(); + Enumeration k = keys(); + Enumeration e = elements(); + buf.append( "{" ); + + for ( int i = 0; i <= max; ++i ) + { + String s1 = k.nextElement().toString(); + String s2 = e.nextElement().toString(); + buf.append( s1 + "=" + s2 ); + if ( i < max ) + buf.append( ", " ); + } + buf.append( "}" ); + return buf.toString(); + } + } + + +class IntHashtableEntry + { + int hash; + int key; + Object value; + IntHashtableEntry next; + + protected Object clone() + { + IntHashtableEntry entry = new IntHashtableEntry(); + entry.hash = hash; + entry.key = key; + entry.value = value; + entry.next = ( next != null ) ? (IntHashtableEntry) next.clone() : null; + return entry; + } + } + + +class IntHashtableEnumerator implements Enumeration + { + boolean keys; + int index; + IntHashtableEntry table[]; + IntHashtableEntry entry; + + IntHashtableEnumerator( IntHashtableEntry table[], boolean keys ) + { + this.table = table; + this.keys = keys; + this.index = table.length; + } + + public boolean hasMoreElements() + { + if ( entry != null ) + return true; + while ( index-- > 0 ) + if ( ( entry = table[index] ) != null ) + return true; + return false; + } + + public Object nextElement() + { + if ( entry == null ) + while ( ( index-- > 0 ) && ( ( entry = table[index] ) == null ) ) + ; + if ( entry != null ) + { + IntHashtableEntry e = entry; + entry = e.next; + return keys ? new Integer( e.key ) : e.value; + } + throw new NoSuchElementException( "IntHashtableEnumerator" ); + } + } diff --git a/src/Acme/JPM/Encoders/GifEncoder.java b/src/Acme/JPM/Encoders/GifEncoder.java new file mode 100644 index 00000000..18022542 --- /dev/null +++ b/src/Acme/JPM/Encoders/GifEncoder.java @@ -0,0 +1,691 @@ +// GifEncoder - write out an image as a GIF +// +// Transparency handling and variable bit size courtesy of Jack Palevich. +// +// Copyright (C)1996,1998 by Jef Poskanzer . All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// Visit the ACME Labs Java page for up-to-date versions of this and other +// fine Java utilities: http://www.acme.com/java/ + +package Acme.JPM.Encoders; + +import java.util.*; +import java.io.*; +import java.awt.Image; +import java.awt.image.*; + +/// Write out an image as a GIF. +//

    +// Fetch the software.
    +// Fetch the entire Acme package. +//

    +// @see ToGif + +public class GifEncoder extends ImageEncoder + { + + private boolean interlace = false; + + /// Constructor from Image. + // @param img The image to encode. + // @param out The stream to write the GIF to. + public GifEncoder( Image img, OutputStream out ) throws IOException + { + super( img, out ); + } + + /// Constructor from Image with interlace setting. + // @param img The image to encode. + // @param out The stream to write the GIF to. + // @param interlace Whether to interlace. + public GifEncoder( Image img, OutputStream out, boolean interlace ) throws IOException + { + super( img, out ); + this.interlace = interlace; + } + + /// Constructor from ImageProducer. + // @param prod The ImageProducer to encode. + // @param out The stream to write the GIF to. + public GifEncoder( ImageProducer prod, OutputStream out ) throws IOException + { + super( prod, out ); + } + + /// Constructor from ImageProducer with interlace setting. + // @param prod The ImageProducer to encode. + // @param out The stream to write the GIF to. + public GifEncoder( ImageProducer prod, OutputStream out, boolean interlace ) throws IOException + { + super( prod, out ); + this.interlace = interlace; + } + + + int width, height; + int[][] rgbPixels; + + void encodeStart( int width, int height ) throws IOException + { + this.width = width; + this.height = height; + rgbPixels = new int[height][width]; + } + + void encodePixels( + int x, int y, int w, int h, int[] rgbPixels, int off, int scansize ) + throws IOException + { + // Save the pixels. + for ( int row = 0; row < h; ++row ) + System.arraycopy( + rgbPixels, row * scansize + off, + this.rgbPixels[y + row], x, w ); + + } + + Acme.IntHashtable colorHash; + + void encodeDone() throws IOException + { + int transparentIndex = -1; + int transparentRgb = -1; + // Put all the pixels into a hash table. + colorHash = new Acme.IntHashtable(); + int index = 0; + for ( int row = 0; row < height; ++row ) + { + int rowOffset = row * width; + for ( int col = 0; col < width; ++col ) + { + int rgb = rgbPixels[row][col]; + boolean isTransparent = ( ( rgb >>> 24 ) < 0x80 ); + if ( isTransparent ) + { + if ( transparentIndex < 0 ) + { + // First transparent color; remember it. + transparentIndex = index; + transparentRgb = rgb; + } + else if ( rgb != transparentRgb ) + { + // A second transparent color; replace it with + // the first one. + rgbPixels[row][col] = rgb = transparentRgb; + } + } + GifEncoderHashitem item = + (GifEncoderHashitem) colorHash.get( rgb ); + if ( item == null ) + { + if ( index >= 256 ) + throw new IOException( "too many colors for a GIF" ); + item = new GifEncoderHashitem( + rgb, 1, index, isTransparent ); + ++index; + colorHash.put( rgb, item ); + } + else + ++item.count; + } + } + + // Figure out how many bits to use. + int logColors; + if ( index <= 2 ) + logColors = 1; + else if ( index <= 4 ) + logColors = 2; + else if ( index <= 16 ) + logColors = 4; + else + logColors = 8; + + // Turn colors into colormap entries. + int mapSize = 1 << logColors; + byte[] reds = new byte[mapSize]; + byte[] grns = new byte[mapSize]; + byte[] blus = new byte[mapSize]; + for ( Enumeration e = colorHash.elements(); e.hasMoreElements(); ) + { + GifEncoderHashitem item = (GifEncoderHashitem) e.nextElement(); + reds[item.index] = (byte) ( ( item.rgb >> 16 ) & 0xff ); + grns[item.index] = (byte) ( ( item.rgb >> 8 ) & 0xff ); + blus[item.index] = (byte) ( item.rgb & 0xff ); + } + + GIFEncode( + out, width, height, interlace, (byte) 0, transparentIndex, + logColors, reds, grns, blus ); + } + + byte GetPixel( int x, int y ) throws IOException + { + GifEncoderHashitem item = + (GifEncoderHashitem) colorHash.get( rgbPixels[y][x] ); + if ( item == null ) + throw new IOException( "color not found" ); + return (byte) item.index; + } + + static void writeString( OutputStream out, String str ) throws IOException + { + byte[] buf = str.getBytes(); + out.write( buf ); + } + + // Adapted from ppmtogif, which is based on GIFENCOD by David + // Rowley . Lempel-Zim compression + // based on "compress". + + int Width, Height; + boolean Interlace; + int curx, cury; + int CountDown; + int Pass = 0; + + void GIFEncode( + OutputStream outs, int Width, int Height, boolean Interlace, byte Background, int Transparent, int BitsPerPixel, byte[] Red, byte[] Green, byte[] Blue ) + throws IOException + { + byte B; + int LeftOfs, TopOfs; + int ColorMapSize; + int InitCodeSize; + int i; + + this.Width = Width; + this.Height = Height; + this.Interlace = Interlace; + ColorMapSize = 1 << BitsPerPixel; + LeftOfs = TopOfs = 0; + + // Calculate number of bits we are expecting + CountDown = Width * Height; + + // Indicate which pass we are on (if interlace) + Pass = 0; + + // The initial code size + if ( BitsPerPixel <= 1 ) + InitCodeSize = 2; + else + InitCodeSize = BitsPerPixel; + + // Set up the current x and y position + curx = 0; + cury = 0; + + // Write the Magic header + writeString( outs, "GIF89a" ); + + // Write out the screen width and height + Putword( Width, outs ); + Putword( Height, outs ); + + // Indicate that there is a global colour map + B = (byte) 0x80; // Yes, there is a color map + // OR in the resolution + B |= (byte) ( ( 8 - 1 ) << 4 ); + // Not sorted + // OR in the Bits per Pixel + B |= (byte) ( ( BitsPerPixel - 1 ) ); + + // Write it out + Putbyte( B, outs ); + + // Write out the Background colour + Putbyte( Background, outs ); + + // Pixel aspect ratio - 1:1. + //Putbyte( (byte) 49, outs ); + // Java's GIF reader currently has a bug, if the aspect ratio byte is + // not zero it throws an ImageFormatException. It doesn't know that + // 49 means a 1:1 aspect ratio. Well, whatever, zero works with all + // the other decoders I've tried so it probably doesn't hurt. + Putbyte( (byte) 0, outs ); + + // Write out the Global Colour Map + for ( i = 0; i < ColorMapSize; ++i ) + { + Putbyte( Red[i], outs ); + Putbyte( Green[i], outs ); + Putbyte( Blue[i], outs ); + } + + // Write out extension for transparent colour index, if necessary. + if ( Transparent != -1 ) + { + Putbyte( (byte) '!', outs ); + Putbyte( (byte) 0xf9, outs ); + Putbyte( (byte) 4, outs ); + Putbyte( (byte) 1, outs ); + Putbyte( (byte) 0, outs ); + Putbyte( (byte) 0, outs ); + Putbyte( (byte) Transparent, outs ); + Putbyte( (byte) 0, outs ); + } + + // Write an Image separator + Putbyte( (byte) ',', outs ); + + // Write the Image header + Putword( LeftOfs, outs ); + Putword( TopOfs, outs ); + Putword( Width, outs ); + Putword( Height, outs ); + + // Write out whether or not the image is interlaced + if ( Interlace ) + Putbyte( (byte) 0x40, outs ); + else + Putbyte( (byte) 0x00, outs ); + + // Write out the initial code size + Putbyte( (byte) InitCodeSize, outs ); + + // Go and actually compress the data + compress( InitCodeSize+1, outs ); + + // Write out a Zero-length packet (to end the series) + Putbyte( (byte) 0, outs ); + + // Write the GIF file terminator + Putbyte( (byte) ';', outs ); + } + + // Bump the 'curx' and 'cury' to point to the next pixel + void BumpPixel() + { + // Bump the current X position + ++curx; + + // If we are at the end of a scan line, set curx back to the beginning + // If we are interlaced, bump the cury to the appropriate spot, + // otherwise, just increment it. + if ( curx == Width ) + { + curx = 0; + + if ( ! Interlace ) + ++cury; + else + { + switch( Pass ) + { + case 0: + cury += 8; + if ( cury >= Height ) + { + ++Pass; + cury = 4; + } + break; + + case 1: + cury += 8; + if ( cury >= Height ) + { + ++Pass; + cury = 2; + } + break; + + case 2: + cury += 4; + if ( cury >= Height ) + { + ++Pass; + cury = 1; + } + break; + + case 3: + cury += 2; + break; + } + } + } + } + + static final int EOF = -1; + + // Return the next pixel from the image + int GIFNextPixel() throws IOException + { + byte r; + + if ( CountDown == 0 ) + return EOF; + + --CountDown; + + r = GetPixel( curx, cury ); + + BumpPixel(); + + return r & 0xff; + } + + // Write out a word to the GIF file + void Putword( int w, OutputStream outs ) throws IOException + { + Putbyte( (byte) ( w & 0xff ), outs ); + Putbyte( (byte) ( ( w >> 8 ) & 0xff ), outs ); + } + + // Write out a byte to the GIF file + void Putbyte( byte b, OutputStream outs ) throws IOException + { + outs.write( b ); + } + + + // GIFCOMPR.C - GIF Image compression routines + // + // Lempel-Ziv compression based on 'compress'. GIF modifications by + // David Rowley (mgardi@watdcsu.waterloo.edu) + + // General DEFINEs + + static final int BITS = 12; + + static final int HSIZE = 5003; // 80% occupancy + + // GIF Image compression - modified 'compress' + // + // Based on: compress.c - File compression ala IEEE Computer, June 1984. + // + // By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) + // Jim McKie (decvax!mcvax!jim) + // Steve Davies (decvax!vax135!petsd!peora!srd) + // Ken Turkowski (decvax!decwrl!turtlevax!ken) + // James A. Woods (decvax!ihnp4!ames!jaw) + // Joe Orost (decvax!vax135!petsd!joe) + + int n_bits; // number of bits/code + int maxbits = BITS; // user settable max # bits/code + int maxcode; // maximum code, given n_bits + int maxmaxcode = 1 << BITS; // should NEVER generate this code + + final int MAXCODE( int n_bits ) + { + return ( 1 << n_bits ) - 1; + } + + int[] htab = new int[HSIZE]; + int[] codetab = new int[HSIZE]; + + int hsize = HSIZE; // for dynamic table sizing + + int free_ent = 0; // first unused entry + + // block compression parameters -- after all codes are used up, + // and compression rate changes, start over. + boolean clear_flg = false; + + // Algorithm: use open addressing double hashing (no chaining) on the + // prefix code / next character combination. We do a variant of Knuth's + // algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime + // secondary probe. Here, the modular division first probe is gives way + // to a faster exclusive-or manipulation. Also do block compression with + // an adaptive reset, whereby the code table is cleared when the compression + // ratio decreases, but after the table fills. The variable-length output + // codes are re-sized at this point, and a special CLEAR code is generated + // for the decompressor. Late addition: construct the table according to + // file size for noticeable speed improvement on small files. Please direct + // questions about this implementation to ames!jaw. + + int g_init_bits; + + int ClearCode; + int EOFCode; + + void compress( int init_bits, OutputStream outs ) throws IOException + { + int fcode; + int i /* = 0 */; + int c; + int ent; + int disp; + int hsize_reg; + int hshift; + + // Set up the globals: g_init_bits - initial number of bits + g_init_bits = init_bits; + + // Set up the necessary values + clear_flg = false; + n_bits = g_init_bits; + maxcode = MAXCODE( n_bits ); + + ClearCode = 1 << ( init_bits - 1 ); + EOFCode = ClearCode + 1; + free_ent = ClearCode + 2; + + char_init(); + + ent = GIFNextPixel(); + + hshift = 0; + for ( fcode = hsize; fcode < 65536; fcode *= 2 ) + ++hshift; + hshift = 8 - hshift; // set hash code range bound + + hsize_reg = hsize; + cl_hash( hsize_reg ); // clear hash table + + output( ClearCode, outs ); + + outer_loop: + while ( (c = GIFNextPixel()) != EOF ) + { + fcode = ( c << maxbits ) + ent; + i = ( c << hshift ) ^ ent; // xor hashing + + if ( htab[i] == fcode ) + { + ent = codetab[i]; + continue; + } + else if ( htab[i] >= 0 ) // non-empty slot + { + disp = hsize_reg - i; // secondary hash (after G. Knott) + if ( i == 0 ) + disp = 1; + do + { + if ( (i -= disp) < 0 ) + i += hsize_reg; + + if ( htab[i] == fcode ) + { + ent = codetab[i]; + continue outer_loop; + } + } + while ( htab[i] >= 0 ); + } + output( ent, outs ); + ent = c; + if ( free_ent < maxmaxcode ) + { + codetab[i] = free_ent++; // code -> hashtable + htab[i] = fcode; + } + else + cl_block( outs ); + } + // Put out the final code. + output( ent, outs ); + output( EOFCode, outs ); + } + + // output + // + // Output the given code. + // Inputs: + // code: A n_bits-bit integer. If == -1, then EOF. This assumes + // that n_bits =< wordsize - 1. + // Outputs: + // Outputs code to the file. + // Assumptions: + // Chars are 8 bits long. + // Algorithm: + // Maintain a BITS character long buffer (so that 8 codes will + // fit in it exactly). Use the VAX insv instruction to insert each + // code in turn. When the buffer fills up empty it and start over. + + int cur_accum = 0; + int cur_bits = 0; + + int masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, + 0x001F, 0x003F, 0x007F, 0x00FF, + 0x01FF, 0x03FF, 0x07FF, 0x0FFF, + 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; + + void output( int code, OutputStream outs ) throws IOException + { + cur_accum &= masks[cur_bits]; + + if ( cur_bits > 0 ) + cur_accum |= ( code << cur_bits ); + else + cur_accum = code; + + cur_bits += n_bits; + + while ( cur_bits >= 8 ) + { + char_out( (byte) ( cur_accum & 0xff ), outs ); + cur_accum >>= 8; + cur_bits -= 8; + } + + // If the next entry is going to be too big for the code size, + // then increase it, if possible. + if ( free_ent > maxcode || clear_flg ) + { + if ( clear_flg ) + { + maxcode = MAXCODE(n_bits = g_init_bits); + clear_flg = false; + } + else + { + ++n_bits; + if ( n_bits == maxbits ) + maxcode = maxmaxcode; + else + maxcode = MAXCODE(n_bits); + } + } + + if ( code == EOFCode ) + { + // At EOF, write the rest of the buffer. + while ( cur_bits > 0 ) + { + char_out( (byte) ( cur_accum & 0xff ), outs ); + cur_accum >>= 8; + cur_bits -= 8; + } + + flush_char( outs ); + } + } + + // Clear out the hash table + + // table clear for block compress + void cl_block( OutputStream outs ) throws IOException + { + cl_hash( hsize ); + free_ent = ClearCode + 2; + clear_flg = true; + + output( ClearCode, outs ); + } + + // reset code table + void cl_hash( int hsize ) + { + for ( int i = 0; i < hsize; ++i ) + htab[i] = -1; + } + + // GIF Specific routines + + // Number of characters so far in this 'packet' + int a_count; + + // Set up the 'byte output' routine + void char_init() + { + a_count = 0; + } + + // Define the storage for the packet accumulator + byte[] accum = new byte[256]; + + // Add a character to the end of the current packet, and if it is 254 + // characters, flush the packet to disk. + void char_out( byte c, OutputStream outs ) throws IOException + { + accum[a_count++] = c; + if ( a_count >= 254 ) + flush_char( outs ); + } + + // Flush the packet to disk, and reset the accumulator + void flush_char( OutputStream outs ) throws IOException + { + if ( a_count > 0 ) + { + outs.write( a_count ); + outs.write( accum, 0, a_count ); + a_count = 0; + } + } + + } + +class GifEncoderHashitem + { + + public int rgb; + public int count; + public int index; + public boolean isTransparent; + + public GifEncoderHashitem( int rgb, int count, int index, boolean isTransparent ) + { + this.rgb = rgb; + this.count = count; + this.index = index; + this.isTransparent = isTransparent; + } + + } diff --git a/src/Acme/JPM/Encoders/ImageEncoder.java b/src/Acme/JPM/Encoders/ImageEncoder.java new file mode 100644 index 00000000..9b5e8e56 --- /dev/null +++ b/src/Acme/JPM/Encoders/ImageEncoder.java @@ -0,0 +1,271 @@ +// ImageEncoder - abstract class for writing out an image +// +// Copyright (C) 1996 by Jef Poskanzer . All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// Visit the ACME Labs Java page for up-to-date versions of this and other +// fine Java utilities: http://www.acme.com/java/ + +package Acme.JPM.Encoders; + +import java.util.*; +import java.io.*; +import java.awt.Image; +import java.awt.image.*; + +/// Abstract class for writing out an image. +//

    +// A framework for classes that encode and write out an image in +// a particular file format. +//

    +// This provides a simplified rendition of the ImageConsumer interface. +// It always delivers the pixels as ints in the RGBdefault color model. +// It always provides them in top-down left-right order. +// If you want more flexibility you can always implement ImageConsumer +// directly. +//

    +// Fetch the software.
    +// Fetch the entire Acme package. +//

    +// @see GifEncoder +// @see PpmEncoder +// @see Acme.JPM.Decoders.ImageDecoder + +public abstract class ImageEncoder implements ImageConsumer + { + + protected OutputStream out; + + private ImageProducer producer; + private int width = -1; + private int height = -1; + private int hintflags = 0; + private boolean started = false; + private boolean encoding; + private IOException iox; + private static final ColorModel rgbModel = ColorModel.getRGBdefault(); + private Hashtable props = null; + + /// Constructor. + // @param img The image to encode. + // @param out The stream to write the bytes to. + public ImageEncoder( Image img, OutputStream out ) throws IOException + { + this( img.getSource(), out ); + } + + /// Constructor. + // @param producer The ImageProducer to encode. + // @param out The stream to write the bytes to. + public ImageEncoder( ImageProducer producer, OutputStream out ) throws IOException + { + this.producer = producer; + this.out = out; + } + + + // Methods that subclasses implement. + + /// Subclasses implement this to initialize an encoding. + abstract void encodeStart( int w, int h ) throws IOException; + + /// Subclasses implement this to actually write out some bits. They + // are guaranteed to be delivered in top-down-left-right order. + // One int per pixel, index is row * scansize + off + col, + // RGBdefault (AARRGGBB) color model. + abstract void encodePixels( + int x, int y, int w, int h, int[] rgbPixels, int off, int scansize ) + throws IOException; + + /// Subclasses implement this to finish an encoding. + abstract void encodeDone() throws IOException; + + + // Our own methods. + + /// Call this after initialization to get things going. + public synchronized void encode() throws IOException + { + encoding = true; + iox = null; + producer.startProduction( this ); + while ( encoding ) + try + { + wait(); + } + catch ( InterruptedException e ) {} + if ( iox != null ) + throw iox; + } + + private boolean accumulate = false; + private int[] accumulator; + + private void encodePixelsWrapper( + int x, int y, int w, int h, int[] rgbPixels, int off, int scansize ) + throws IOException + { + if ( ! started ) + { + started = true; + encodeStart( width, height ); + if ( ( hintflags & TOPDOWNLEFTRIGHT ) == 0 ) + { + accumulate = true; + accumulator = new int[width * height]; + } + } + if ( accumulate ) + for ( int row = 0; row < h; ++row ) + System.arraycopy( + rgbPixels, row * scansize + off, + accumulator, ( y + row ) * width + x, + w ); + else + encodePixels( x, y, w, h, rgbPixels, off, scansize ); + } + + private void encodeFinish() throws IOException + { + if ( accumulate ) + { + encodePixels( 0, 0, width, height, accumulator, 0, width ); + accumulator = null; + accumulate = false; + } + } + + private synchronized void stop() + { + encoding = false; + notifyAll(); + } + + + // Methods from ImageConsumer. + + public void setDimensions( int width, int height ) + { + this.width = width; + this.height = height; + } + + public void setProperties( Hashtable props ) + { + this.props = props; + } + + public void setColorModel( ColorModel model ) + { + // Ignore. + } + + public void setHints( int hintflags ) + { + this.hintflags = hintflags; + } + + public void setPixels( + int x, int y, int w, int h, ColorModel model, byte[] pixels, + int off, int scansize ) + { + int[] rgbPixels = new int[w]; + for ( int row = 0; row < h; ++row ) + { + int rowOff = off + row * scansize; + for ( int col = 0; col < w; ++col ) + rgbPixels[col] = model.getRGB( pixels[rowOff + col] & 0xff ); + try + { + encodePixelsWrapper( x, y + row, w, 1, rgbPixels, 0, w ); + } + catch ( IOException e ) + { + iox = e; + stop(); + return; + } + } + } + + public void setPixels( + int x, int y, int w, int h, ColorModel model, int[] pixels, + int off, int scansize ) + { + if ( model == rgbModel ) + { + try + { + encodePixelsWrapper( x, y, w, h, pixels, off, scansize ); + } + catch ( IOException e ) + { + iox = e; + stop(); + return; + } + } + else + { + int[] rgbPixels = new int[w]; + for ( int row = 0; row < h; ++row ) + { + int rowOff = off + row * scansize; + for ( int col = 0; col < w; ++col ) + rgbPixels[col] = model.getRGB( pixels[rowOff + col] ); + try + { + encodePixelsWrapper( x, y + row, w, 1, rgbPixels, 0, w ); + } + catch ( IOException e ) + { + iox = e; + stop(); + return; + } + } + } + } + + public void imageComplete( int status ) + { + producer.removeConsumer( this ); + if ( status == ImageConsumer.IMAGEABORTED ) + iox = new IOException( "image aborted" ); + else + { + try + { + encodeFinish(); + encodeDone(); + } + catch ( IOException e ) + { + iox = e; + } + } + stop(); + } + + } diff --git a/src/FESI/AST/ASTAllocationExpression.java b/src/FESI/AST/ASTAllocationExpression.java new file mode 100644 index 00000000..20017f57 --- /dev/null +++ b/src/FESI/AST/ASTAllocationExpression.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTAllocationExpression.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTAllocationExpression extends SimpleNode { + public ASTAllocationExpression(int id) { + super(id); + } + + public ASTAllocationExpression(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTAllocationExpression(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTAllocationExpression(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTAndExpressionSequence.java b/src/FESI/AST/ASTAndExpressionSequence.java new file mode 100644 index 00000000..3232ec54 --- /dev/null +++ b/src/FESI/AST/ASTAndExpressionSequence.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTAndExpressionSequence.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTAndExpressionSequence extends SimpleNode { + public ASTAndExpressionSequence(int id) { + super(id); + } + + public ASTAndExpressionSequence(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTAndExpressionSequence(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTAndExpressionSequence(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTAssignmentExpression.java b/src/FESI/AST/ASTAssignmentExpression.java new file mode 100644 index 00000000..f1528f62 --- /dev/null +++ b/src/FESI/AST/ASTAssignmentExpression.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTAssignmentExpression.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTAssignmentExpression extends SimpleNode { + public ASTAssignmentExpression(int id) { + super(id); + } + + public ASTAssignmentExpression(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTAssignmentExpression(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTAssignmentExpression(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTBinaryExpressionSequence.java b/src/FESI/AST/ASTBinaryExpressionSequence.java new file mode 100644 index 00000000..fa9c3d7f --- /dev/null +++ b/src/FESI/AST/ASTBinaryExpressionSequence.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTBinaryExpressionSequence.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTBinaryExpressionSequence extends SimpleNode { + public ASTBinaryExpressionSequence(int id) { + super(id); + } + + public ASTBinaryExpressionSequence(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTBinaryExpressionSequence(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTBinaryExpressionSequence(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTBreakStatement.java b/src/FESI/AST/ASTBreakStatement.java new file mode 100644 index 00000000..69ad9d8f --- /dev/null +++ b/src/FESI/AST/ASTBreakStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTBreakStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTBreakStatement extends SimpleNode { + public ASTBreakStatement(int id) { + super(id); + } + + public ASTBreakStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTBreakStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTBreakStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTCompositeReference.java b/src/FESI/AST/ASTCompositeReference.java new file mode 100644 index 00000000..aa3fc24d --- /dev/null +++ b/src/FESI/AST/ASTCompositeReference.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTCompositeReference.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTCompositeReference extends SimpleNode { + public ASTCompositeReference(int id) { + super(id); + } + + public ASTCompositeReference(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTCompositeReference(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTCompositeReference(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTConditionalExpression.java b/src/FESI/AST/ASTConditionalExpression.java new file mode 100644 index 00000000..dfd727bb --- /dev/null +++ b/src/FESI/AST/ASTConditionalExpression.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTConditionalExpression.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTConditionalExpression extends SimpleNode { + public ASTConditionalExpression(int id) { + super(id); + } + + public ASTConditionalExpression(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTConditionalExpression(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTConditionalExpression(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTContinueStatement.java b/src/FESI/AST/ASTContinueStatement.java new file mode 100644 index 00000000..6a7570b8 --- /dev/null +++ b/src/FESI/AST/ASTContinueStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTContinueStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTContinueStatement extends SimpleNode { + public ASTContinueStatement(int id) { + super(id); + } + + public ASTContinueStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTContinueStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTContinueStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTEmptyExpression.java b/src/FESI/AST/ASTEmptyExpression.java new file mode 100644 index 00000000..a5749a6e --- /dev/null +++ b/src/FESI/AST/ASTEmptyExpression.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTEmptyExpression.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTEmptyExpression extends SimpleNode { + public ASTEmptyExpression(int id) { + super(id); + } + + public ASTEmptyExpression(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTEmptyExpression(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTEmptyExpression(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTExpressionList.java b/src/FESI/AST/ASTExpressionList.java new file mode 100644 index 00000000..9a12e43c --- /dev/null +++ b/src/FESI/AST/ASTExpressionList.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTExpressionList.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTExpressionList extends SimpleNode { + public ASTExpressionList(int id) { + super(id); + } + + public ASTExpressionList(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTExpressionList(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTExpressionList(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTForInStatement.java b/src/FESI/AST/ASTForInStatement.java new file mode 100644 index 00000000..6e7b3319 --- /dev/null +++ b/src/FESI/AST/ASTForInStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTForInStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTForInStatement extends SimpleNode { + public ASTForInStatement(int id) { + super(id); + } + + public ASTForInStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTForInStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTForInStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTForStatement.java b/src/FESI/AST/ASTForStatement.java new file mode 100644 index 00000000..17beb278 --- /dev/null +++ b/src/FESI/AST/ASTForStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTForStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTForStatement extends SimpleNode { + public ASTForStatement(int id) { + super(id); + } + + public ASTForStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTForStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTForStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTForVarInStatement.java b/src/FESI/AST/ASTForVarInStatement.java new file mode 100644 index 00000000..b0128297 --- /dev/null +++ b/src/FESI/AST/ASTForVarInStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTForVarInStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTForVarInStatement extends SimpleNode { + public ASTForVarInStatement(int id) { + super(id); + } + + public ASTForVarInStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTForVarInStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTForVarInStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTForVarStatement.java b/src/FESI/AST/ASTForVarStatement.java new file mode 100644 index 00000000..7f56b6d7 --- /dev/null +++ b/src/FESI/AST/ASTForVarStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTForVarStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTForVarStatement extends SimpleNode { + public ASTForVarStatement(int id) { + super(id); + } + + public ASTForVarStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTForVarStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTForVarStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTFormalParameterList.java b/src/FESI/AST/ASTFormalParameterList.java new file mode 100644 index 00000000..28f7b66d --- /dev/null +++ b/src/FESI/AST/ASTFormalParameterList.java @@ -0,0 +1,39 @@ +/* Generated By:JJTree: Do not edit this line. ASTFormalParameterList.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTFormalParameterList extends SimpleNode { + public ASTFormalParameterList(int id) { + super(id); + } + + public ASTFormalParameterList(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTFormalParameterList(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTFormalParameterList(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + // JMCL + public String [] getArguments() { + int n = jjtGetNumChildren(); + String [] args = new String[n]; + for (int i=0; i"; + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTIfStatement.java b/src/FESI/AST/ASTIfStatement.java new file mode 100644 index 00000000..d611ccdf --- /dev/null +++ b/src/FESI/AST/ASTIfStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTIfStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTIfStatement extends SimpleNode { + public ASTIfStatement(int id) { + super(id); + } + + public ASTIfStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTIfStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTIfStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTLiteral.java b/src/FESI/AST/ASTLiteral.java new file mode 100644 index 00000000..1fc0f46c --- /dev/null +++ b/src/FESI/AST/ASTLiteral.java @@ -0,0 +1,210 @@ +/* Generated By:JJTree: Do not edit this line. ASTLiteral.java */ + +package FESI.AST; + +import FESI.Parser.*; +import FESI.Data.*; +import FESI.Exceptions.*; + + +public class ASTLiteral extends SimpleNode { + + private ESValue theValue = null; + + public ASTLiteral(int id) { + super(id); + } + + public ASTLiteral(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTLiteral(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTLiteral(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + // JMCL + public ESValue getValue() { + return theValue; + } + + static final int hexval(char c) throws ProgrammingError { + switch(c) + { + case '0' : + return 0; + case '1' : + return 1; + case '2' : + return 2; + case '3' : + return 3; + case '4' : + return 4; + case '5' : + return 5; + case '6' : + return 6; + case '7' : + return 7; + case '8' : + return 8; + case '9' : + return 9; + + case 'a' : + case 'A' : + return 10; + case 'b' : + case 'B' : + return 11; + case 'c' : + case 'C' : + return 12; + case 'd' : + case 'D' : + return 13; + case 'e' : + case 'E' : + return 14; + case 'f' : + case 'F' : + return 15; + } + + throw new ProgrammingError("Illegal hex or unicode constant"); // Should never come here + } + static final int octval(char c) throws ProgrammingError { + switch(c) + { + case '0' : + return 0; + case '1' : + return 1; + case '2' : + return 2; + case '3' : + return 3; + case '4' : + return 4; + case '5' : + return 5; + case '6' : + return 6; + case '7' : + return 7; + case '8' : + return 8; + case '9' : + return 9; + + case 'a' : + case 'A' : + return 10; + case 'b' : + case 'B' : + return 11; + case 'c' : + case 'C' : + return 12; + case 'd' : + case 'D' : + return 13; + case 'e' : + case 'E' : + return 14; + case 'f' : + case 'F' : + return 15; + } + + throw new ProgrammingError("Illegal octal constant"); // Should never come here + } + + public void setStringValue(String image) { + int l = image.length(); + StringBuffer sb = new StringBuffer(l); + for (int i=0; i='0' && c <= '7') { + c = (char)(octval(image.charAt(i))); + if ((image.length()>i) && + (image.charAt(i+1)>='0') && (image.charAt(i+1)<='7')) { + i++; + c = (char) ((c<<4) | octval(image.charAt(i))); + } + } + } + sb.append(c); + } + theValue = new ESString(sb.toString()); + } + public void setDecimalValue(String image) { + try { + theValue = new ESNumber(Long.parseLong(image)); + } catch (NumberFormatException e) { + Double value = new Double(image); + theValue = new ESNumber(value.doubleValue()); + } + } + public void setOctalValue(String image) { + try { + String imageWithout0 = image.substring(1); + theValue = new ESNumber(Long.parseLong(imageWithout0,8)); + } catch (NumberFormatException e) { + Double value = new Double(image); + theValue = new ESNumber(value.doubleValue()); + } + } + public void setHexValue(String image) { + try { + String imageWithout0x = image.substring(2); + theValue = new ESNumber(Long.parseLong(imageWithout0x,16)); + } catch (NumberFormatException e) { + Double value = new Double(image); + theValue = new ESNumber(value.doubleValue()); + } + } + public void setFloatingPointValue(String image) { + Double value = new Double(image); + theValue = new ESNumber(value.doubleValue()); + } + public void setBooleanValue(boolean value) { + theValue = ESBoolean.makeBoolean(value); + } + public void setNullValue() { + theValue = ESNull.theNull; + } + + public String toString() { + return "[" + theValue.toString() + "]"; + } + +} \ No newline at end of file diff --git a/src/FESI/AST/ASTOperator.java b/src/FESI/AST/ASTOperator.java new file mode 100644 index 00000000..b39355af --- /dev/null +++ b/src/FESI/AST/ASTOperator.java @@ -0,0 +1,44 @@ +/* Generated By:JJTree: Do not edit this line. ASTOperator.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTOperator extends SimpleNode { + + private int operatorCode = EOF; + + public ASTOperator(int id) { + super(id); + } + + public ASTOperator(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTOperator(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTOperator(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + // JMCL + public void setOperator(int operatorCode) { + this.operatorCode = operatorCode; + } + public int getOperator() { + return operatorCode; + } + + public String toString() { + return "<" + tokenImage[operatorCode] + ">"; + } + +} \ No newline at end of file diff --git a/src/FESI/AST/ASTOrExpressionSequence.java b/src/FESI/AST/ASTOrExpressionSequence.java new file mode 100644 index 00000000..435885e7 --- /dev/null +++ b/src/FESI/AST/ASTOrExpressionSequence.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTOrExpressionSequence.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTOrExpressionSequence extends SimpleNode { + public ASTOrExpressionSequence(int id) { + super(id); + } + + public ASTOrExpressionSequence(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTOrExpressionSequence(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTOrExpressionSequence(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTPostfixExpression.java b/src/FESI/AST/ASTPostfixExpression.java new file mode 100644 index 00000000..87039b7d --- /dev/null +++ b/src/FESI/AST/ASTPostfixExpression.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTPostfixExpression.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTPostfixExpression extends SimpleNode { + public ASTPostfixExpression(int id) { + super(id); + } + + public ASTPostfixExpression(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTPostfixExpression(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTPostfixExpression(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTProgram.java b/src/FESI/AST/ASTProgram.java new file mode 100644 index 00000000..eaf5ecbb --- /dev/null +++ b/src/FESI/AST/ASTProgram.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTProgram.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTProgram extends SimpleNode { + public ASTProgram(int id) { + super(id); + } + + public ASTProgram(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTProgram(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTProgram(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTPropertyIdentifierReference.java b/src/FESI/AST/ASTPropertyIdentifierReference.java new file mode 100644 index 00000000..a1b3cf55 --- /dev/null +++ b/src/FESI/AST/ASTPropertyIdentifierReference.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTPropertyIdentifierReference.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTPropertyIdentifierReference extends SimpleNode { + public ASTPropertyIdentifierReference(int id) { + super(id); + } + + public ASTPropertyIdentifierReference(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTPropertyIdentifierReference(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTPropertyIdentifierReference(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTPropertyValueReference.java b/src/FESI/AST/ASTPropertyValueReference.java new file mode 100644 index 00000000..aabaf213 --- /dev/null +++ b/src/FESI/AST/ASTPropertyValueReference.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTPropertyValueReference.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTPropertyValueReference extends SimpleNode { + public ASTPropertyValueReference(int id) { + super(id); + } + + public ASTPropertyValueReference(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTPropertyValueReference(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTPropertyValueReference(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTReturnStatement.java b/src/FESI/AST/ASTReturnStatement.java new file mode 100644 index 00000000..065ae925 --- /dev/null +++ b/src/FESI/AST/ASTReturnStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTReturnStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTReturnStatement extends SimpleNode { + public ASTReturnStatement(int id) { + super(id); + } + + public ASTReturnStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTReturnStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTReturnStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTStatement.java b/src/FESI/AST/ASTStatement.java new file mode 100644 index 00000000..b3637fd7 --- /dev/null +++ b/src/FESI/AST/ASTStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTStatement extends SimpleNode { + public ASTStatement(int id) { + super(id); + } + + public ASTStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTStatementList.java b/src/FESI/AST/ASTStatementList.java new file mode 100644 index 00000000..092c55dc --- /dev/null +++ b/src/FESI/AST/ASTStatementList.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTStatementList.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTStatementList extends SimpleNode { + public ASTStatementList(int id) { + super(id); + } + + public ASTStatementList(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTStatementList(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTStatementList(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTThisReference.java b/src/FESI/AST/ASTThisReference.java new file mode 100644 index 00000000..5ed38f5e --- /dev/null +++ b/src/FESI/AST/ASTThisReference.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTThisReference.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTThisReference extends SimpleNode { + public ASTThisReference(int id) { + super(id); + } + + public ASTThisReference(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTThisReference(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTThisReference(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTUnaryExpression.java b/src/FESI/AST/ASTUnaryExpression.java new file mode 100644 index 00000000..7d94dfec --- /dev/null +++ b/src/FESI/AST/ASTUnaryExpression.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTUnaryExpression.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTUnaryExpression extends SimpleNode { + public ASTUnaryExpression(int id) { + super(id); + } + + public ASTUnaryExpression(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTUnaryExpression(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTUnaryExpression(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTVariableDeclaration.java b/src/FESI/AST/ASTVariableDeclaration.java new file mode 100644 index 00000000..88ab3a34 --- /dev/null +++ b/src/FESI/AST/ASTVariableDeclaration.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTVariableDeclaration.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTVariableDeclaration extends SimpleNode { + public ASTVariableDeclaration(int id) { + super(id); + } + + public ASTVariableDeclaration(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTVariableDeclaration(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTVariableDeclaration(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTWhileStatement.java b/src/FESI/AST/ASTWhileStatement.java new file mode 100644 index 00000000..4ab28485 --- /dev/null +++ b/src/FESI/AST/ASTWhileStatement.java @@ -0,0 +1,28 @@ +/* Generated By:JJTree: Do not edit this line. ASTWhileStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTWhileStatement extends SimpleNode { + public ASTWhileStatement(int id) { + super(id); + } + + public ASTWhileStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTWhileStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTWhileStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } +} \ No newline at end of file diff --git a/src/FESI/AST/ASTWithStatement.java b/src/FESI/AST/ASTWithStatement.java new file mode 100644 index 00000000..d8ca850a --- /dev/null +++ b/src/FESI/AST/ASTWithStatement.java @@ -0,0 +1,40 @@ +/* Generated By:JJTree: Do not edit this line. ASTWithStatement.java */ + +package FESI.AST; + +import FESI.Parser.*; + +public class ASTWithStatement extends SimpleNode { + + Object evaluationSource = null; + + public ASTWithStatement(int id) { + super(id); + } + + public ASTWithStatement(EcmaScript p, int id) { + super(p, id); + } + + public static Node jjtCreate(int id) { + return new ASTWithStatement(id); + } + + public static Node jjtCreate(EcmaScript p, int id) { + return new ASTWithStatement(p, id); + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + // JMCL + public void setEvaluationSource(Object evaluationSource) { + this.evaluationSource = evaluationSource; + } + + public Object getEvaluationSource() { + return evaluationSource; + } +} \ No newline at end of file diff --git a/src/FESI/AST/EcmaScriptDumpVisitor.java b/src/FESI/AST/EcmaScriptDumpVisitor.java new file mode 100644 index 00000000..860a2909 --- /dev/null +++ b/src/FESI/AST/EcmaScriptDumpVisitor.java @@ -0,0 +1,263 @@ +package FESI.AST; + +import FESI.Parser.*; + +public class EcmaScriptDumpVisitor implements EcmaScriptVisitor +{ + private int indent = 0; + + private String indentString() { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < indent; ++i) { + sb.append(" "); + } + return sb.toString(); + } + + public Object visit(SimpleNode node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTProgram node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTStatementList node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTFunctionDeclaration node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTFormalParameterList node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTVariableDeclaration node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTIfStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTWhileStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTForStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTForInStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTForVarStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTForVarInStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTContinueStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTBreakStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTReturnStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTWithStatement node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTThisReference node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTCompositeReference node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTFunctionCallParameters node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTPropertyIdentifierReference node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTPropertyValueReference node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTAllocationExpression node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTOperator node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTPostfixExpression node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTUnaryExpression node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTBinaryExpressionSequence node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTOrExpressionSequence node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTAndExpressionSequence node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTConditionalExpression node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTAssignmentExpression node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTExpressionList node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTEmptyExpression node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTLiteral node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + public Object visit(ASTIdentifier node, Object data) { + System.out.println(indentString() + node); + ++indent; + data = node.childrenAccept(this, data); + --indent; + return data; + } + +} \ No newline at end of file diff --git a/src/FESI/AST/EcmaScriptTreeConstants.java b/src/FESI/AST/EcmaScriptTreeConstants.java new file mode 100644 index 00000000..fe8d6322 --- /dev/null +++ b/src/FESI/AST/EcmaScriptTreeConstants.java @@ -0,0 +1,81 @@ +/* Generated By:JJTree: Do not edit this line. EcmaScriptTreeConstants.java */ + +package FESI.AST; + +public interface EcmaScriptTreeConstants +{ + public int JJTLITERAL = 0; + public int JJTIDENTIFIER = 1; + public int JJTVOID = 2; + public int JJTTHISREFERENCE = 3; + public int JJTCOMPOSITEREFERENCE = 4; + public int JJTFUNCTIONCALLPARAMETERS = 5; + public int JJTPROPERTYVALUEREFERENCE = 6; + public int JJTPROPERTYIDENTIFIERREFERENCE = 7; + public int JJTALLOCATIONEXPRESSION = 8; + public int JJTOPERATOR = 9; + public int JJTPOSTFIXEXPRESSION = 10; + public int JJTUNARYEXPRESSION = 11; + public int JJTBINARYEXPRESSIONSEQUENCE = 12; + public int JJTANDEXPRESSIONSEQUENCE = 13; + public int JJTOREXPRESSIONSEQUENCE = 14; + public int JJTCONDITIONALEXPRESSION = 15; + public int JJTASSIGNMENTEXPRESSION = 16; + public int JJTEXPRESSIONLIST = 17; + public int JJTSTATEMENT = 18; + public int JJTSTATEMENTLIST = 19; + public int JJTVARIABLEDECLARATION = 20; + public int JJTIFSTATEMENT = 21; + public int JJTWHILESTATEMENT = 22; + public int JJTFORSTATEMENT = 23; + public int JJTEMPTYEXPRESSION = 24; + public int JJTFORVARSTATEMENT = 25; + public int JJTFORINSTATEMENT = 26; + public int JJTFORVARINSTATEMENT = 27; + public int JJTCONTINUESTATEMENT = 28; + public int JJTBREAKSTATEMENT = 29; + public int JJTRETURNSTATEMENT = 30; + public int JJTWITHSTATEMENT = 31; + public int JJTFUNCTIONDECLARATION = 32; + public int JJTFORMALPARAMETERLIST = 33; + public int JJTPROGRAM = 34; + + + public String[] jjtNodeName = { + "Literal", + "Identifier", + "void", + "ThisReference", + "CompositeReference", + "FunctionCallParameters", + "PropertyValueReference", + "PropertyIdentifierReference", + "AllocationExpression", + "Operator", + "PostfixExpression", + "UnaryExpression", + "BinaryExpressionSequence", + "AndExpressionSequence", + "OrExpressionSequence", + "ConditionalExpression", + "AssignmentExpression", + "ExpressionList", + "Statement", + "StatementList", + "VariableDeclaration", + "IfStatement", + "WhileStatement", + "ForStatement", + "EmptyExpression", + "ForVarStatement", + "ForInStatement", + "ForVarInStatement", + "ContinueStatement", + "BreakStatement", + "ReturnStatement", + "WithStatement", + "FunctionDeclaration", + "FormalParameterList", + "Program", + }; +} diff --git a/src/FESI/AST/EcmaScriptVisitor.java b/src/FESI/AST/EcmaScriptVisitor.java new file mode 100644 index 00000000..116eb4ac --- /dev/null +++ b/src/FESI/AST/EcmaScriptVisitor.java @@ -0,0 +1,42 @@ +/* Generated By:JJTree: Do not edit this line. EcmaScriptVisitor.java */ + +package FESI.AST; + +public interface EcmaScriptVisitor +{ + public Object visit(SimpleNode node, Object data); + public Object visit(ASTLiteral node, Object data); + public Object visit(ASTIdentifier node, Object data); + public Object visit(ASTThisReference node, Object data); + public Object visit(ASTCompositeReference node, Object data); + public Object visit(ASTFunctionCallParameters node, Object data); + public Object visit(ASTPropertyValueReference node, Object data); + public Object visit(ASTPropertyIdentifierReference node, Object data); + public Object visit(ASTAllocationExpression node, Object data); + public Object visit(ASTOperator node, Object data); + public Object visit(ASTPostfixExpression node, Object data); + public Object visit(ASTUnaryExpression node, Object data); + public Object visit(ASTBinaryExpressionSequence node, Object data); + public Object visit(ASTAndExpressionSequence node, Object data); + public Object visit(ASTOrExpressionSequence node, Object data); + public Object visit(ASTConditionalExpression node, Object data); + public Object visit(ASTAssignmentExpression node, Object data); + public Object visit(ASTExpressionList node, Object data); + public Object visit(ASTStatement node, Object data); + public Object visit(ASTStatementList node, Object data); + public Object visit(ASTVariableDeclaration node, Object data); + public Object visit(ASTIfStatement node, Object data); + public Object visit(ASTWhileStatement node, Object data); + public Object visit(ASTForStatement node, Object data); + public Object visit(ASTEmptyExpression node, Object data); + public Object visit(ASTForVarStatement node, Object data); + public Object visit(ASTForInStatement node, Object data); + public Object visit(ASTForVarInStatement node, Object data); + public Object visit(ASTContinueStatement node, Object data); + public Object visit(ASTBreakStatement node, Object data); + public Object visit(ASTReturnStatement node, Object data); + public Object visit(ASTWithStatement node, Object data); + public Object visit(ASTFunctionDeclaration node, Object data); + public Object visit(ASTFormalParameterList node, Object data); + public Object visit(ASTProgram node, Object data); +} diff --git a/src/FESI/AST/JJTEcmaScriptState.java b/src/FESI/AST/JJTEcmaScriptState.java new file mode 100644 index 00000000..023928ed --- /dev/null +++ b/src/FESI/AST/JJTEcmaScriptState.java @@ -0,0 +1,123 @@ +/* Generated By:JJTree: Do not edit this line. JJTEcmaScriptState.java */ + +package FESI.AST; + +public class JJTEcmaScriptState { + private java.util.Stack nodes; + private java.util.Stack marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + public JJTEcmaScriptState() { + nodes = new java.util.Stack(); + marks = new java.util.Stack(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + public boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called + automatically by the parser's ReInit() method. */ + public void reset() { + nodes.removeAllElements(); + marks.removeAllElements(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call + this after a successful parse. */ + public Node rootNode() { + return (Node)nodes.elementAt(0); + } + + /* Pushes a node on to the stack. */ + public void pushNode(Node n) { + nodes.push(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + public Node popNode() { + if (--sp < mk) { + mk = ((Integer)marks.pop()).intValue(); + } + return (Node)nodes.pop(); + } + + /* Returns the node currently on the top of the stack. */ + public Node peekNode() { + return (Node)nodes.peek(); + } + + /* Returns the number of children on the stack in the current node + scope. */ + public int nodeArity() { + return sp - mk; + } + + + public void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = ((Integer)marks.pop()).intValue(); + } + + + public void openNodeScope(Node n) { + marks.push(new Integer(mk)); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of + children. That number of nodes are popped from the stack and + made the children of the definite node. Then the definite node + is pushed on to the stack. */ + public void closeNodeScope(Node n, int num) { + mk = ((Integer)marks.pop()).intValue(); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All + the nodes that have been pushed since the node was opened are + made children of the the conditional node, which is then pushed + on to the stack. If the condition is false the node is not + constructed and they are left on the stack. */ + public void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = ((Integer)marks.pop()).intValue(); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = ((Integer)marks.pop()).intValue(); + node_created = false; + } + } +} diff --git a/src/FESI/AST/Node.java b/src/FESI/AST/Node.java new file mode 100644 index 00000000..18fa417a --- /dev/null +++ b/src/FESI/AST/Node.java @@ -0,0 +1,37 @@ +/* Generated By:JJTree: Do not edit this line. Node.java */ + +package FESI.AST; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public interface Node { + + /** This method is called after the node has been made the current + node. It indicates that child nodes can now be added to it. */ + public void jjtOpen(); + + /** This method is called after all the child nodes have been + added. */ + public void jjtClose(); + + /** This pair of methods are used to inform the node of its + parent. */ + public void jjtSetParent(Node n); + public Node jjtGetParent(); + + /** This method tells the node to add its argument to the node's + list of children. */ + public void jjtAddChild(Node n, int i); + + /** This method returns a child node. The children are numbered + from zero, left to right. */ + public Node jjtGetChild(int i); + + /** Return the number of children the node has. */ + public int jjtGetNumChildren(); + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data); +} \ No newline at end of file diff --git a/src/FESI/AST/SimpleNode.java b/src/FESI/AST/SimpleNode.java new file mode 100644 index 00000000..3e74dec2 --- /dev/null +++ b/src/FESI/AST/SimpleNode.java @@ -0,0 +1,129 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ + +package FESI.AST; + +import FESI.Parser.*; +import FESI.Exceptions.*; + +public abstract class SimpleNode implements Node, EcmaScriptConstants { + protected Node parent; + protected Node[] children; + protected int id; + protected EcmaScript parser; + protected int line = 0; // JMCL + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(EcmaScript p, int i) { + this(i); + parser = p; + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { parent = n; } + public Node jjtGetParent() { return parent; } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + /** Accept the visitor. **/ + public Object jjtAccept(EcmaScriptVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + /** Accept the visitor. **/ + public Object childrenAccept(EcmaScriptVisitor visitor, Object data) { + if (children != null) { + for (int i = 0; i < children.length; ++i) { + children[i].jjtAccept(visitor, data); + } + } + return data; + } + + /* You can override these two methods in subclasses of SimpleNode to + customize the way the node appears when the tree is dumped. If + your output uses more than one line you should override + toString(String), otherwise overriding toString() is probably all + you need to do. */ + + // JMCL + public String toString() { + return EcmaScriptTreeConstants.jjtNodeName[id]; + } + public String toString(String prefix) { return prefix + toString(); } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (int i = 0; i < children.length; ++i) { + SimpleNode n = (SimpleNode)children[i]; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } + + // JMCL + public void setLineNumber(int line) { + this.line = line; + } + + public int getLineNumber() { + return line; + } + + public void assertNoChildren() { + if (jjtGetNumChildren()>0) { + throw new ProgrammingError("AST Should have no children"); + } + } + public void assertOneChild() { + if (jjtGetNumChildren()!=1) { + throw new ProgrammingError("AST Should have 1 child"); + } + } + public void assertTwoChildren() { + if (jjtGetNumChildren()!=2) { + throw new ProgrammingError("AST Should have 2 children"); + } + } + public void assertThreeChildren() { + if (jjtGetNumChildren()!=3) { + throw new ProgrammingError("AST Should have 3 children"); + } + } + public void assertFourChildren() { + if (jjtGetNumChildren()!=4) { + throw new ProgrammingError("AST Should have 4 children"); + } + } + +} \ No newline at end of file diff --git a/src/FESI/ClassFile/Attribute.java b/src/FESI/ClassFile/Attribute.java new file mode 100644 index 00000000..a484b19e --- /dev/null +++ b/src/FESI/ClassFile/Attribute.java @@ -0,0 +1,111 @@ +/* + * + * @(#) Attribute.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.Attribute + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.UTF8Constant; + +/** + *

    + * The Attribute class is an abstract base class for all Attribute types + * found in the Java VM ClassFile format specification. This is a simple + * implementationd designed to support the minimal functionaliuty required + * to emit a valid ClassFile stream. + *

    + */ + +abstract class Attribute { + + final static String SOURCEFILE = "SourceFile"; + final static String CONSTANTVALUE = "ConstantValue"; + final static String LOCALVARIABLETABLE = "LocalVariableTable"; + final static String EXCEPTIONS = "Exceptions"; + final static String LINENUMBERTABLE = "LineNumberTable"; + final static String CODE = "Code"; + + private UTF8Constant name; + private ClassFile classFile; + + /** + *

    Construct an Attribute, enter it into the ConstantPool.

    + */ + + protected Attribute(String n, ClassFile cf) { + UTF8Constant utf8 = (UTF8Constant) + cf.match(ConstantPoolEntry.CONSTANT_UTF8, (Object)n); + + if (utf8 == null) utf8 = new UTF8Constant(n, cf); + + name = utf8; + classFile = cf; + } + + /** + * @return the ClassFile this Attribute is contained within + */ + + ClassFile getClassFile() { return classFile; } + + /** + * @return the "name" of the Attribute. + */ + + String getName() { return name.getString(); } + + /** + * @return get the index of this Attribute in the ConstantPool + */ + + short getNameConstantPoolIndex() { + return name.getConstantPoolIndex(); + } + + /** + * @return the length of the attribute as defined by the concrete subclass. + */ + + abstract int getLength(); + + /** + *

    write the concrete Attribute subclass to the stream

    + * + * @throws IOException + */ + + abstract void write(DataOutputStream dos) throws IOException; + + /** + *

    Compare this Attribute with the object and return equality.

    + * + * @return is it equal + */ + + abstract public boolean equals(Object o); + +} diff --git a/src/FESI/ClassFile/ClassConstant.java b/src/FESI/ClassFile/ClassConstant.java new file mode 100644 index 00000000..2e8dac53 --- /dev/null +++ b/src/FESI/ClassFile/ClassConstant.java @@ -0,0 +1,111 @@ +/* + * + * @(#) ClassConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.ClassConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.UTF8Constant; + +class ClassConstant extends ConstantPoolEntry { + + private UTF8Constant name; + + /** + *

    Construct a CONSTANT_CLASS constant pool entry

    + */ + + ClassConstant(String className, ClassFile cf) { + super(CONSTANT_CLASS, cf); + + name = cf.addUTF8Constant(ClassFile.fullyQualifiedForm(className)); + + addToConstantPool(); + } + + /** + *

    write the CONSTANT_CLASS to the stream

    + * + * @param dos the stream. + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + + if (debug()) { + System.err.println(getConstantPoolIndex() + + " CLASS: " + + name.getConstantPoolIndex() + ); + } + + dos.writeByte(getTag()); + dos.writeShort(name.getConstantPoolIndex()); + } + + /** + *

    return the class represented by the CONSTANT_CLASS

    + * + * @return the name of the class + */ + + String getClassName() { return name.getString(); } + + /** + *

    returns the Class object for the class represented by the constant.

    + * + * @return The java.lang.Class object for the class. + */ + + Class getClassObject() throws ClassNotFoundException { + return Class.forName(name.getString()); + } + + /** + *

    compare the object, by name or value.

    + * + * @param the object for comparison + * + * @return object equality. + */ + + public boolean equals(Object o) { + if (o == null) return false; + + if (o instanceof String) { + return ((String)o).equals(name.getString()); + } else if (o instanceof ClassConstant) { + ClassConstant cc = (ClassConstant)o; + + return name.getString().equals(cc.getClassName()); + } + + return false; + } +} diff --git a/src/FESI/ClassFile/ClassFile.java b/src/FESI/ClassFile/ClassFile.java new file mode 100644 index 00000000..9e82d9c2 --- /dev/null +++ b/src/FESI/ClassFile/ClassFile.java @@ -0,0 +1,469 @@ +/* + * + * @(#) ClassFile.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.ClassFile + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import java.util.Vector; + +import FESI.ClassFile.Attribute; +import FESI.ClassFile.ClassConstant; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.FieldDesc; +import FESI.ClassFile.MethodDesc; + +/** + *

    + * The ClassFile class is designed to provide lightweight, minimal support + * for the runtime construction of Java VM ClassFile's, or Class + * implementations. + *

    + *

    + * The ClassFile provides API's to construct an in-core description of a + * Java class implementation, and subsequently write that description to + * a stream which may then be either loaded into the VM via a ClassLoader + * or written to some persistent store. + *

    + *

    + * It should be noted that the ClassFile provide little or no validation of + * the Class it describes during the construction of that description, and + * therefore users of this class and package should be familiar with the + * contents of the Java VM Specification published by Addison-Wesley. + *

    + */ + +final class ClassFile { + + /** + *

    the magic number for Java VM class files.

    + */ + + final private static int MAGIC = 0xcafebabe; + + /** + *

    the major and minor version numbers for Java VM class files.

    + */ + + final private static short MAJOR = 45; + final private static short MINOR = 3; + + /** + *

    the access flags constants for Java VM class files.

    + */ + + final static short ACC_PUBLIC = 0x0001; + final static short ACC_FINAL = 0x0010; + final static short ACC_SUPER = 0x0020; + final static short ACC_INTERFACE = 0x0200; + final static short ACC_ABSTRACT = 0x0400; + + /* + * inst vars represent the format of the classfile itself. + */ + + private Vector constantPool = new Vector(1); + + private short accessFlags = (short)(ACC_PUBLIC | ACC_SUPER); + + private ClassConstant thisClass; + private ClassConstant superClass; + + private Vector interfaces; + private Vector fields; + private Vector methods; + private Vector attributes; + + /** + * @return are we debuging (used to print audit trail). + */ + + static boolean debug() { return false; } + + /** + *

    Construct a new ClassFile object.

    + * + * @param tClass name of "this" class + * + * @param sClass name of superclass + * + */ + + ClassFile(String tClass, String sClass) { + thisClass = addClassConstant(tClass); + superClass = addClassConstant(sClass); + } + + /** + *

    Write the constant pool to the stream

    + * + * @param dos the stream to write to. + */ + + private void writeConstantPool(DataOutputStream dos) throws IOException { + + if (debug()) System.err.println("write constant pool: " + constantPool.size()); + + dos.writeShort(constantPool.size() + 1); // for index zero + + for (int i = 0; i < constantPool.size(); i++) { + ((ConstantPoolEntry)constantPool.elementAt(i)).write(dos); + } + } + + /** + *

    Write the list of interfaces to the stream

    + * + * @param dos the stream to write to. + */ + + private void writeInterfaces(DataOutputStream dos) throws IOException { + if (interfaces != null) { + if (debug()) System.err.println("write interfaces: " + interfaces.size()); + dos.writeShort(interfaces.size()); + + for (int i = 0; i < interfaces.size(); i++) { + dos.writeShort( + ((ConstantPoolEntry)interfaces.elementAt(i)).getConstantPoolIndex() + ); + } + } else dos.writeShort(0); + } + + /** + *

    Write the list of Fields defs to the stream

    + * + * @param dos the stream to write to. + */ + + private void writeFields(DataOutputStream dos) throws IOException { + if (fields != null) { + if (debug()) System.err.println("write fields: " + fields.size()); + + dos.writeShort(fields.size()); + + for (int i = 0; i < fields.size(); i++) { + ((FieldDesc)fields.elementAt(i)).write(dos); + } + } else dos.writeShort(0); + } + + /** + *

    Write the list of Method defs to the stream.

    + * + * @param dos the stream to write to. + */ + + private void writeMethods(DataOutputStream dos) throws IOException { + if (methods != null) { + if (debug()) System.err.println("write methods: " + methods.size()); + + dos.writeShort(methods.size()); + + for (int i = 0; i < methods.size(); i++) { + ((MethodDesc)methods.elementAt(i)).write(dos); + } + } else dos.writeShort(0); + + } + + /** + *

    Write the list of Attributes to the stream

    + * + * @param dos the stream to write to. + */ + + private void writeAttributes(DataOutputStream dos) throws IOException { + if (attributes != null) { + if (debug()) System.err.println("write attributes: " + attributes.size()); + + dos.writeShort(attributes.size()); + + for (int i = 0; i < attributes.size(); i++) { + ((Attribute)attributes.elementAt(i)).write(dos); + } + } else dos.writeShort(0); + } + + /** + *

    Write the ClassFile to the Stream

    + * + * @param os the stream to write to. + */ + + public synchronized void write(OutputStream os) throws IOException { + DataOutputStream dos = new DataOutputStream(os); + + try { + dos.writeInt(MAGIC); + + dos.writeShort(MINOR); + dos.writeShort(MAJOR); + + writeConstantPool(dos); + + if (debug()) System.err.println("access: " + accessFlags); + + dos.writeShort(accessFlags); + + dos.writeShort(thisClass.getConstantPoolIndex()); + dos.writeShort(superClass.getConstantPoolIndex()); + + writeInterfaces(dos); + + writeFields(dos); + + writeMethods(dos); + + writeAttributes(dos); + + dos.close(); // all done! + } catch (IOException ioe) { + System.err.println("Bad IO"); + } catch (Exception e) { + System.err.println("Oops"); + } + } + + /** + *

    Add an entry to the Constant Pool.

    + * + * @param cpe the new constant pool entry + * + * @return the index of the new entry in the pool + */ + + public synchronized short addConstantPoolEntry(ConstantPoolEntry cpe) { + if (!constantPool.contains(cpe)) constantPool.addElement(cpe); + + return (short)(constantPool.indexOf(cpe) + 1); + } + + /** + *

    Find a matching Constant Pool Entry.

    + * + * @param tag The tag value of the constant pool entries to match on. + * @param value The value to match on. + * + * @return the matching entry or null. + */ + + synchronized ConstantPoolEntry match(byte tag, Object value) { + for (int i = 0; i < constantPool.size(); i++) { + ConstantPoolEntry cpe = (ConstantPoolEntry)constantPool.elementAt(i); + + if (cpe.getTag() == tag && cpe.equals(value)) + return cpe; + } + + return null; + } + + /** + * @return the current value of the accessFlags. + */ + + public synchronized short getAccessFlags() { return accessFlags; } + + /** + *

    modify the value of the Class File's access flags

    + * + * @param newf the new flag values. [NOT VALIDATED] + */ + + public synchronized void setAccessFlags(short newf) { + + // TODO - verify new flag combination. + + accessFlags = newf; + } + + /** + * @param newMethod the method desc to add to the class file. + */ + + public synchronized void addMethodDesc(MethodDesc newMethod) { + if (methods == null) methods = new Vector(1); + + methods.addElement(newMethod); + } + + /** + * @param newField the field desc to add to the class file. + */ + + public synchronized void addFieldDesc(FieldDesc newField) { + if (fields == null) fields = new Vector(1); + + fields.addElement(newField); + } + + /** + * @param sConstant add a CONSTANT_STRING to the ClassFile. + * + * @param sConstant the string value to add. + * + * @return The new StringConstant + */ + + public StringConstant addStringConstant(String sConstant) { + UTF8Constant c = (UTF8Constant)match(ConstantPoolEntry.CONSTANT_UTF8, sConstant); + + if (c == null) { + c = new UTF8Constant(sConstant, this); + } + + StringConstant s = new StringConstant(c, this); + + return s; + } + + /** + *

    Add a new CONSTANT_INTEGER to the Constant Pool

    + * + * @param iConstant the integer value to add. + * + * @return the new IntegerConstant. + */ + + public IntegerConstant addIntegerConstant(int iConstant) { + IntegerConstant c = (IntegerConstant)match(ConstantPoolEntry.CONSTANT_INTEGER, new Integer(iConstant)); + + if (c == null) { + c = new IntegerConstant(iConstant, this); + } + + return c; + } + + /** + *

    Add a new UTF8_CONSTANT to the constant pool

    + * + * @param sConstant the string to add. + * + * @return the new UUTF8Constant + */ + + public UTF8Constant addUTF8Constant(String sConstant) { + UTF8Constant c = (UTF8Constant)match(ConstantPoolEntry.CONSTANT_UTF8, sConstant); + + if (c == null) { + c = new UTF8Constant(sConstant, this); + } + + return c; + } + + /** + *

    add a new CONSTANT_CLASS to the Constant Pool

    + * + * @param classConstant the name of the class to add + * + * @return the newly ClassConstant + */ + + public ClassConstant addClassConstant(String classConstant) { + ClassConstant c = (ClassConstant)match(ConstantPoolEntry.CONSTANT_CLASS, classConstant); + + if (c == null) { + c = new ClassConstant(classConstant, this); + } + + return c; + } + + /** + *

    add a CONSTANT_METHOD to the constant pool

    + * + * @param cName the name of the defining class + * @param mName the method name + * @param tName the fully qualified type descriptor for the method + * + * @return the new created CONSTANT_METHOD + */ + + public MethodConstant addMethodConstant(String cName, String mName, String tName) { + return new MethodConstant(cName, mName, tName, this); + } + + /** + * + * + * @param cName the name of the defining class + * @param fName the name of the field + * @param tName the fully qualified type descriptor of the field + * + * @return the new created CONSTANT_FIELD + */ + + public FieldConstant addFieldConstant(String cName, String fName, String tName) { + return new FieldConstant(cName, fName, tName, this); + } + + /** + *

    add the name of an interface this class implements to the constant pool

    + * + * @param iName the name of the interface + */ + + public void addInterface(String iName) { + if (interfaces == null) interfaces = new Vector(1); + + interfaces.addElement((Object)addClassConstant(iName)); + } + + /** + *

    + * convenience routine to take a type name and map it to the internal form. + * java.lang.Object -> java/lang/Object + *

    + * + * @param str the string to map + * + * @return the mapped string value. + */ + + public static String fullyQualifiedForm(String str) { + return str.replace('.', '/'); + } + + + /** + *

    + * convenience routine to construct type descriptors from fully + * qualified names, e.g: java.lang.Object => Ljava/lang/Object; + *

    + * + * @param str name of a java "type" + * + * @return the class descriptor. + */ + + public static String fieldType(String str) { + return "L" + ClassFile.fullyQualifiedForm(str) + ";"; + } + +} diff --git a/src/FESI/ClassFile/Code.java b/src/FESI/ClassFile/Code.java new file mode 100644 index 00000000..9639c761 --- /dev/null +++ b/src/FESI/ClassFile/Code.java @@ -0,0 +1,702 @@ +/* + * + * @(#) Code.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.Code + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + + +import java.io.DataOutputStream; +import java.io.IOException; + +import java.util.Vector; + +import FESI.ClassFile.Attribute; +import FESI.ClassFile.ClassConstant; + +/** + *

    + * The Code attribute is defined to describe the implementation for each + * Method Implementation in a class. In particular it contains the byte + * codes and exception information. + *

    + */ + +final class Code extends Attribute { + + final static byte OP_NOP = (byte) 0x00; + final static byte OP_ACONST_NULL = (byte) 0x01; + + // int consts + + final static byte OP_ICONST_m1 = (byte) 0x02; + final static byte OP_ICONST_0 = (byte) 0x03; + final static byte OP_ICONST_1 = (byte) 0x04; + final static byte OP_ICONST_2 = (byte) 0x05; + final static byte OP_ICONST_3 = (byte) 0x06; + final static byte OP_ICONST_4 = (byte) 0x07; + final static byte OP_ICONST_5 = (byte) 0x08; + + // long consts + + final static byte OP_LCONST_0 = (byte) 0x09; + final static byte OP_LCONST_1 = (byte) 0x0A; + + // float consts + + final static byte OP_FCONST_0 = (byte) 0x0B; + final static byte OP_FCONST_1 = (byte) 0x0C; + final static byte OP_FCONST_2 = (byte) 0x0D; + + // double consts + + final static byte OP_DCONST_0 = (byte) 0x0E; + final static byte OP_DCONST_1 = (byte) 0x0F; + + final static byte OP_BIPUSH = (byte) 0x10; + final static byte OP_SIPUSH = (byte) 0x11; + + final static byte OP_LDC = (byte) 0x12; + final static byte OP_LDC_WIDE = (byte) 0x13; + final static byte OP_LDC2_WIDE = (byte) 0x14; + + + // typed loads local + + final static byte OP_ILOAD = (byte) 0x15; + final static byte OP_LLOAD = (byte) 0x16; + final static byte OP_FLOAD = (byte) 0x17; + final static byte OP_DLOAD = (byte) 0x18; + final static byte OP_ALOAD = (byte) 0x19; + + // int loads + + final static byte OP_ILOAD_0 = (byte) 0x1A; + final static byte OP_ILOAD_1 = (byte) 0x1B; + final static byte OP_ILOAD_2 = (byte) 0x1C; + final static byte OP_ILOAD_3 = (byte) 0x1D; + + // long loads + + final static byte OP_LLOAD_0 = (byte) 0x1E; + final static byte OP_LLOAD_1 = (byte) 0x1F; + final static byte OP_LLOAD_2 = (byte) 0x20; + final static byte OP_LLOAD_3 = (byte) 0x21; + + // float loads + + final static byte OP_FLOAD_0 = (byte) 0x22; + final static byte OP_FLOAD_1 = (byte) 0x23; + final static byte OP_FLOAD_2 = (byte) 0x24; + final static byte OP_FLOAD_3 = (byte) 0x25; + + // double loads + + final static byte OP_DLOAD_0 = (byte) 0x26; + final static byte OP_DLOAD_1 = (byte) 0x27; + final static byte OP_DLOAD_2 = (byte) 0x28; + final static byte OP_DLOAD_3 = (byte) 0x29; + + // ref loads + + final static byte OP_ALOAD_0 = (byte) 0x2A; + final static byte OP_ALOAD_1 = (byte) 0x2B; + final static byte OP_ALOAD_2 = (byte) 0x2C; + final static byte OP_ALOAD_3 = (byte) 0x2D; + + final static byte OP_IALOAD = (byte) 0x2E; + final static byte OP_LALOAD = (byte) 0x2F; + + // array loads + + final static byte OP_FALOAD = (byte) 0x30; + final static byte OP_DALOAD = (byte) 0x31; + final static byte OP_AALOAD = (byte) 0x32; + final static byte OP_BALOAD = (byte) 0x33; + final static byte OP_CALOAD = (byte) 0x34; + final static byte OP_SALOAD = (byte) 0x35; + + final static byte OP_ISTORE = (byte) 0x36; + final static byte OP_LSTORE = (byte) 0x37; + final static byte OP_FSTORE = (byte) 0x38; + final static byte OP_DSTORE = (byte) 0x39; + final static byte OP_ASTORE = (byte) 0x3A; + + // int stores + + final static byte OP_ISTORE_0 = (byte) 0x3B; + final static byte OP_ISTORE_1 = (byte) 0x3C; + final static byte OP_ISTORE_2 = (byte) 0x3D; + final static byte OP_ISTORE_3 = (byte) 0x3E; + + // long stores + + final static byte OP_LSTORE_0 = (byte) 0x3F; + final static byte OP_LSTORE_1 = (byte) 0x40; + final static byte OP_LSTORE_2 = (byte) 0x41; + final static byte OP_LSTORE_3 = (byte) 0x42; + + // float stores + + final static byte OP_FSTORE_0 = (byte) 0x43; + final static byte OP_FSTORE_1 = (byte) 0x44; + final static byte OP_FSTORE_2 = (byte) 0x45; + final static byte OP_FSTORE_3 = (byte) 0x46; + + // double stores + + final static byte OP_DSTORE_0 = (byte) 0x47; + final static byte OP_DSTORE_1 = (byte) 0x48; + final static byte OP_DSTORE_2 = (byte) 0x49; + final static byte OP_DSTORE_3 = (byte) 0x4A; + + // ref stores + + final static byte OP_ASTORE_0 = (byte) 0x4B; + final static byte OP_ASTORE_1 = (byte) 0x4C; + final static byte OP_ASTORE_2 = (byte) 0x4D; + final static byte OP_ASTORE_3 = (byte) 0x4E; + + final static byte OP_IASTORE = (byte) 0x4F; + + // array stores + + final static byte OP_LASTORE = (byte) 0x50; + final static byte OP_FASTORE = (byte) 0x51; + final static byte OP_DASTORE = (byte) 0x52; + final static byte OP_AASTORE = (byte) 0x53; + final static byte OP_BASTORE = (byte) 0x54; + final static byte OP_CASTORE = (byte) 0x55; + final static byte OP_SASTORE = (byte) 0x56; + + final static byte OP_POP = (byte) 0x57; + final static byte OP_POP2 = (byte) 0x58; + + // dup's + + final static byte OP_DUP = (byte) 0x59; + final static byte OP_DUP_X1 = (byte) 0x5A; + final static byte OP_DUP_X2 = (byte) 0x5B; + final static byte OP_DUP2 = (byte) 0x5C; + final static byte OP_DUP2_X1 = (byte) 0x5D; + final static byte OP_DUP2_X2 = (byte) 0x5E; + final static byte OP_SWAP = (byte) 0x5F; + + // arith + + final static byte OP_IADD = (byte) 0x60; + final static byte OP_LADD = (byte) 0x61; + final static byte OP_FADD = (byte) 0x62; + final static byte OP_DADD = (byte) 0x63; + + final static byte OP_ISUB = (byte) 0x64; + final static byte OP_LSUB = (byte) 0x65; + final static byte OP_FSUB = (byte) 0x66; + final static byte OP_DSUB = (byte) 0x67; + + final static byte OP_IMUL = (byte) 0x68; + final static byte OP_LMUL = (byte) 0x69; + final static byte OP_FMUL = (byte) 0x6A; + final static byte OP_DMUL = (byte) 0x6B; + + final static byte OP_IDIV = (byte) 0x6C; + final static byte OP_FDIV = (byte) 0x6E; + final static byte OP_LDIV = (byte) 0x6D; + final static byte OP_DDIV = (byte) 0x6F; + + // arith misc + + final static byte OP_IREM = (byte) 0x70; + final static byte OP_LREM = (byte) 0x71; + final static byte OP_FREM = (byte) 0x72; + final static byte OP_DREM = (byte) 0x73; + + final static byte OP_INEG = (byte) 0x74; + final static byte OP_LNEG = (byte) 0x75; + final static byte OP_FNEG = (byte) 0x76; + final static byte OP_DNEG = (byte) 0x77; + + final static byte OP_ISHL = (byte) 0x78; + final static byte OP_LSHL = (byte) 0x79; + + final static byte OP_ISHR = (byte) 0x7A; + final static byte OP_LSHR = (byte) 0x7B; + + final static byte OP_IUSHR = (byte) 0x7C; + final static byte OP_LUSHR = (byte) 0x7D; + + final static byte OP_IAND = (byte) 0x7E; + final static byte OP_LAND = (byte) 0x7F; + + final static byte OP_IOR = (byte) 0x80; + final static byte OP_LOR = (byte) 0x81; + + final static byte OP_IXOR = (byte) 0x82; + final static byte OP_LXOR = (byte) 0x83; + + // local int += const + + final static byte OP_IINC = (byte) 0x84; + + // int conversions + + final static byte OP_I2L = (byte) 0x85; + final static byte OP_I2F = (byte) 0x86; + final static byte OP_I2D = (byte) 0x87; + + // long conversions + + final static byte OP_L2I = (byte) 0x88; + final static byte OP_L2F = (byte) 0x89; + final static byte OP_L2D = (byte) 0x8A; + + // float conversions + + final static byte OP_F2I = (byte) 0x8B; + final static byte OP_F2L = (byte) 0x8C; + final static byte OP_F2D = (byte) 0x8D; + + // double conversions + + final static byte OP_D2I = (byte) 0x8E; + final static byte OP_D2L = (byte) 0x8F; + final static byte OP_D2F = (byte) 0x90; + + // int conversions + + final static byte OP_I2B = (byte) 0x91; + final static byte OP_I2C = (byte) 0x92; + final static byte OP_I2S = (byte) 0x93; + + // long comparision's + + final static byte OP_LCMP = (byte) 0x94; + + // float comparision's + + final static byte OP_FCMPL = (byte) 0x95; + final static byte OP_FCMPG = (byte) 0x96; + + // double comparision's + + final static byte OP_DCMPL = (byte) 0x97; + final static byte OP_DCMPG = (byte) 0x98; + + // int to zero comparisions + + final static byte OP_IFEQ = (byte) 0x99; + final static byte OP_IFNE = (byte) 0x9A; + final static byte OP_IFLT = (byte) 0x9B; + final static byte OP_IFGE = (byte) 0x9C; + final static byte OP_IFGT = (byte) 0x9D; + final static byte OP_IFLE = (byte) 0x9E; + + // int to int comparision's + + final static byte OP_IFICMPEQ = (byte) 0x9F; + final static byte OP_IFICMPNE = (byte) 0xA0; + final static byte OP_IFICMPLT = (byte) 0xA1; + final static byte OP_IFICMPGE = (byte) 0xA2; + final static byte OP_IFICMPGT = (byte) 0xA3; + final static byte OP_IFICMPLE = (byte) 0xA4; + + // ref comparisions + + final static byte OP_IFACMPEQ = (byte) 0xA5; + final static byte OP_IFACMPNE = (byte) 0xA6; + + // goto + + final static byte OP_GOTO = (byte) 0xA7; + + final static byte OP_JSR = (byte) 0xA8; + + final static byte OP_RET = (byte) 0xA9; + + final static byte OP_TABLESWITCH = (byte) 0xAA; + + final static byte OP_LOOKUP_SWITCH = (byte) 0xAB; + + + // return's + + final static byte OP_IRETURN = (byte) 0xAC; + final static byte OP_LRETURN = (byte) 0xAD; + final static byte OP_FRETURN = (byte) 0xAE; + final static byte OP_DRETURN = (byte) 0xAF; + final static byte OP_ARETURN = (byte) 0xB0; + final static byte OP_RETURN = (byte) 0xB1; + + + // getfield's + + final static byte OP_GETSTATIC = (byte) 0xB2; + final static byte OP_GETFIELD = (byte) 0xB4; + + // invoke virtual + + final static byte OP_INVOKE_VIRTUAL = (byte) 0xB6; + + // invoke static + + final static byte OP_INVOKE_STATIC = (byte) 0xB8; + + // method invocation + + final static byte OP_INVOKE_SPECIAL = (byte) 0xB7; + + // invoke interface + + final static byte OP_INVOKE_INTERFACE = (byte) 0xB9; + + // new + + final static byte OP_NEW = (byte) 0xBB; + + // array misc + + final static byte OP_NEWARRAY = (byte) 0xBD; + + final static byte ARRAY_T_BOOLEAN = (byte) 0x4; + final static byte ARRAY_T_CHAR = (byte) 0x5; + final static byte ARRAY_T_FLOAT = (byte) 0x6; + final static byte ARRAY_T_DOUBLE = (byte) 0x7; + final static byte ARRAY_T_BYTE = (byte) 0x8; + final static byte ARRAY_T_SHORT = (byte) 0x9; + final static byte ARRAY_T_INT = (byte) 0xA; + final static byte ARRAY_T_LONG = (byte) 0xB; + + // putfield's + + final static byte OP_PUTSTATIC = (byte) 0xB3; + final static byte OP_PUTFIELD = (byte) 0xB5; + + // array's + + final static byte OP_ANEWARRAY = (byte) 0xBD; + final static byte OP_ARRAYLENGTH = (byte) 0xBE; + + // exceptions + + final static byte OP_ATHROW = (byte) 0xBF; + + // cast + + final static byte OP_CHECKCAST = (byte) 0xC0; + + // instanceof + + final static byte OP_INSTANCEOF = (byte) 0xC1; + + // monitor + + final static byte OP_MONITOR_ENTER = (byte) 0xC2; + final static byte OP_MONITOR_EXIT = (byte) 0xC3; + + // wide + + final static byte OP_WIDE = (byte) 0xC4; + + // arrays + + final static byte OP_MULTI_NEW_ARRAY = (byte) 0xC5; + + // compare to null + + final static byte OP_IFNULL = (byte) 0xc6; + final static byte OP_IFNONNULL = (byte) 0xc7; + + // goto wide + + final static byte OP_GOTO_WIDE = (byte) 0xc8; + + final static byte OP_JSR_WIDE = (byte) 0xc9; + + + /* + * inst vars + */ + + private Vector attributes; + + private int length = 12; // starting value + + private short currentPC; + + private short maxLocals; + + private short maxStack; + + private Vector byteCodes = new Vector(1); + + private Vector exceptions; + + /** + *

    construct a Code Attribute

    + * + * @param locals number of words used to describe local vars + * @param maxstack max number of stack words used. + * + */ + + Code(ClassFile cf, short locals, short stack) { + super(CODE, cf); + + maxLocals = (locals >= 0 ? locals : 0); + maxStack = (stack > 2 ? stack : 2); + } + + /** + *

    write the code attribute to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + int i; + + dos.writeShort(getNameConstantPoolIndex()); + dos.writeInt(getLength()); + dos.writeShort(maxStack); + dos.writeShort(maxLocals); + + // write the code ... + + dos.writeInt(byteCodes.size()); + + for (i = 0; i < byteCodes.size(); i++) { + dos.writeByte(((Byte)byteCodes.elementAt(i)).byteValue()); + } + + // write exceptions (if any) + + if (exceptions != null) { + dos.writeShort(exceptions.size()); + + for (i = 0; i < exceptions.size(); i++) { + ((ExceptionTableEntry)exceptions.elementAt(i)).write(dos); + } + } else dos.writeShort(0); + + // write attributes (if any) + + if (attributes != null) { + dos.writeShort(attributes.size()); + + for (i = 0; i < attributes.size(); i ++) { + ((Attribute)attributes.elementAt(i)).write(dos); + } + } else dos.writeShort(0); + } + + /** + *

    returns the length of the Code attribute in bytes

    + * + * @return the length of the attribute. + */ + + int getLength() { return length; } + + /** + * @return object equality. + */ + + public boolean equals(Object o) { + return ((Object)this).equals(o); + } + + /** + * @return the current PC offset from the start of the method. + */ + + short getCurrentPC() { return currentPC; } + + /** + *

    + * adds per Code attribute, can be used for SourceFile, LocalVariable, + * and LineNumberTable attributes etc. + *

    + * + * @param attr Attribte to be added. + */ + + void addAttribute(Attribute attr) { + if (attributes == null) attributes = new Vector(1); + + attributes.addElement(attr); + length += attr.getLength() + 6; // sizeof(Attribute) + } + + /** + *

    + * Adds an entry to the Exception handler table for this Code attribute. + * An entry describes the start and stop pc offset within the Code fragment + * for which an exception handler is provided, the start pc of the handler + * code within the fragment itself, and the class of the exception type + * for this handler. + *

    + * + * @param start start pc offset for this exception handler range + * @param stop stop pc offset for this exception handler range + * @param handler handler pc start offset for this exception + * @param ct CONSTANT_CLASS describing the exception class handled + */ + + void addExceptionTableEntry(short start, short stop, + short handler, ClassConstant ct) { + exceptions.addElement( + new ExceptionTableEntry(start, stop, handler, ct) + ); + + length += 8; // sizeof(ExceptionTableEntry) + } + + /** + *

    add an opcode to the implementation

    + */ + + void addOp(byte opCode) { + byteCodes.addElement(new Byte(opCode)); + currentPC++; + length++; + } + + /** + *

    add an opcode and a 1 byte operand

    + */ + + void addOp1(byte opCode, byte op1) { + byteCodes.addElement(new Byte(opCode)); + byteCodes.addElement(new Byte(op1)); + currentPC += 2; + length += 2; + } + + /** + *

    add an opcode and 2, 1 byte operands

    + */ + + void addOp2(byte opCode, byte op1, byte op2) { + byteCodes.addElement(new Byte(opCode)); + byteCodes.addElement(new Byte(op1)); + byteCodes.addElement(new Byte(op2)); + currentPC += 3; + length += 3; + } + + /** + *

    add an opcode and 4, 1 byte operands

    + */ + + void addOp4(byte opCode, byte op1, byte op2, byte op3, byte op4) { + byteCodes.addElement(new Byte(opCode)); + byteCodes.addElement(new Byte(op1)); + byteCodes.addElement(new Byte(op2)); + byteCodes.addElement(new Byte(op3)); + byteCodes.addElement(new Byte(op4)); + currentPC += 5; + length += 5; + + } + + /** + *

    add an opcode and a 2 byte operand

    + */ + + void addOpShort(byte opCode,short op) { + addOp2(opCode, + (byte)((op >>> 8) & 0xff), + (byte)( op & 0xff) + ); + } + + /** + *

    add an opcode and a 4 byte operand

    + */ + + void addOpInt(byte opCode,int op) { + addOp4(opCode, + (byte)((op >>> 24) & 0xff), + (byte)((op >>> 16) & 0xff), + (byte)((op >>> 8) & 0xff), + (byte)( op & 0xff) + ); + } + + /** + *

    increment the local word count

    + * + * @param n the number of local words to increment by. + */ + + void incrLocals(short n) { maxLocals += n; } + + /** + *

    increment the max operand stack word count

    + * + * @param n the number of words to increment the max stack count by + */ + + void incrMaxStack(short n) { maxStack += n; } +} + +/* + * private implementation class to represent exception table entries. + */ + +final class ExceptionTableEntry { + private short startPC; + private short stopPC; + private short handlerPC; + private ClassConstant exceptionType; + + /* + * construct and Exception Table Entry + */ + + ExceptionTableEntry(short start, short stop, + short handler, ClassConstant eType) { + super(); + + startPC = start; + stopPC = stop; + handlerPC = handler; + exceptionType = eType; + } + + /* + * wrote the exception table entry to the stream + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeShort(startPC); + dos.writeShort(stopPC); + dos.writeShort(handlerPC); + if (exceptionType != null) + dos.writeShort(exceptionType.getConstantPoolIndex()); + else + dos.writeShort(0); + } +} \ No newline at end of file diff --git a/src/FESI/ClassFile/ConstantPoolEntry.java b/src/FESI/ClassFile/ConstantPoolEntry.java new file mode 100644 index 00000000..726543e2 --- /dev/null +++ b/src/FESI/ClassFile/ConstantPoolEntry.java @@ -0,0 +1,133 @@ +/* + * + * @(#) ConstantPoolEntry.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.ConstantPoolEntry + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; + +/** + *

    + * The ConstantPoolEntry is an abstract base class representing common + * behaviors of specific subtypes, as defined below and in the VM spec. + *

    + * + *

    + * In particular this class handles, equality, sharing, output and indexing + * of all subtypes. + *

    + */ + +abstract class ConstantPoolEntry { + + /* + * subtype tag values. + */ + + final static byte CONSTANT_UTF8 = 1; + final static byte CONSTANT_UNICODE = 2; + final static byte CONSTANT_INTEGER = 3; + final static byte CONSTANT_FLOAT = 4; + final static byte CONSTANT_LONG = 5; + final static byte CONSTANT_DOUBLE = 6; + final static byte CONSTANT_CLASS = 7; + final static byte CONSTANT_STRING = 8; + final static byte CONSTANT_FIELDREF = 9; + final static byte CONSTANT_METHODREF = 10; + final static byte CONSTANT_INTERFACEMETHODREF = 11; + final static byte CONSTANT_NAMEANDTYPE = 12; + + /* + * + */ + + private byte tag; + + private ClassFile classFile; + + private short index = -1; + + /** + *

    construct the CPE, set the type tag and class file

    + */ + + ConstantPoolEntry(byte t, ClassFile cf) { + tag = t; + classFile = cf; + } + + /** + * + */ + + byte getTag() { return tag; } + + /** + * @return the CPE's constant pool index. + */ + + short getConstantPoolIndex() { + if (index == -1) index = classFile.addConstantPoolEntry(this); + + return (short)index; + } + + /** + * @return the Class File this CPE is contained within. + */ + + ClassFile getClassFile() { return classFile; }; + + /** + *

    * write the CPE to the stream

    + * + * @throws IOException + */ + + abstract void write(DataOutputStream dos) throws IOException; + + /** + *

    test the CPE for equality

    + * + * @return object's equality. + */ + + public abstract boolean equals(Object o); + + /** + *

    add the CPE into the Class File's constant pool

    + */ + + protected void addToConstantPool() { + if (index == -1) index = classFile.addConstantPoolEntry(this); + } + + /** + * @return are we in debug mode? + */ + + protected static boolean debug() { return ClassFile.debug(); } +} diff --git a/src/FESI/ClassFile/ConstantValue.java b/src/FESI/ClassFile/ConstantValue.java new file mode 100644 index 00000000..fbbe4d9d --- /dev/null +++ b/src/FESI/ClassFile/ConstantValue.java @@ -0,0 +1,157 @@ +/* + * + * @(#) ConstantValue.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.ConstantValue + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.Attribute; +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.IntegerConstant; +import FESI.ClassFile.FloatConstant; +import FESI.ClassFile.DoubleConstant; +import FESI.ClassFile.LongConstant; +import FESI.ClassFile.StringConstant; + +/** + *

    + * This class provides Constant Pool support for all the simple constant + * value data types supported in the class file format. + *

    + */ + +class ConstantValue extends Attribute { + + private ConstantPoolEntry constant; + + /** + *

    construct an Attribute describing a Constant

    + * + * @param cf the class file + * @param cpe the cpe of the constant + */ + + private ConstantValue(ClassFile cf, ConstantPoolEntry cpe) { + super(Attribute.CONSTANTVALUE, cf); + constant = cpe; + } + + /** + *

    Integer Constant

    + * + * @param cf the class file + * @param ic the Integer Constant + */ + + ConstantValue(ClassFile cf, IntegerConstant ic) { + this(cf, (ConstantPoolEntry)ic); + } + + /** + *

    Long Constant

    + * + * @param cf the class file + * @param lc the Long Constant + */ + + ConstantValue(ClassFile cf, LongConstant lc) { + this(cf, (ConstantPoolEntry)lc); + } + + /** + *

    Float Constant

    + * + * @param cf the class file + * @param fc the Float Constant + */ + + ConstantValue(ClassFile cf, FloatConstant fc) { + this(cf, (ConstantPoolEntry)fc); + } + + /** + *

    Double Constant

    + * + * @param cf the class file + * @param dc the Double Constant + */ + + ConstantValue(ClassFile cf, DoubleConstant dc) { + this(cf, (ConstantPoolEntry)dc); + } + + /** + *

    String Constant

    + * + * @param cf the class file + * @param sc the String Constant + */ + + ConstantValue(ClassFile cf, StringConstant sc) { + this(cf, (ConstantPoolEntry)sc); + } + + /** + * @return the length of this ConstantValue Attribute (minus header) + */ + + int getLength() { return 2; } + + /** + * @return the CPE of the constant represented + */ + + ConstantPoolEntry getConstant() { return constant; } + + /** + * @return the CPE type tag of the constant represented + */ + + byte getConstantTag() { return constant.getTag(); } + + /** + *

    write the Attribute to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeShort(getNameConstantPoolIndex()); + dos.writeInt(getLength()); + dos.writeShort(constant.getConstantPoolIndex()); + } + + /** + * @return the objects equality. + */ + + public boolean equals(Object o) { + return constant.equals(o); + } +} diff --git a/src/FESI/ClassFile/DoubleConstant.java b/src/FESI/ClassFile/DoubleConstant.java new file mode 100644 index 00000000..f821e165 --- /dev/null +++ b/src/FESI/ClassFile/DoubleConstant.java @@ -0,0 +1,91 @@ +/* + * + * @(#) DoubleConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.DoubleConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; + +/** + *

    implements a DOUBLE_CONSTANT CPE

    + */ + +class DoubleConstant extends ConstantPoolEntry { + + private double doubler; + + /** + *

    construct a DOUBLE_CONSTANT CPE

    + * + * @param d the double constant + * @param cf the class file + */ + + DoubleConstant(double d, ClassFile cf) { + super(CONSTANT_DOUBLE, cf); + + doubler = d; + + addToConstantPool(); + } + + /** + *

    write the constant CPE to the stream

    + * + * @param dos the stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeDouble(doubler); + } + + /** + * @return the double constant value. + */ + + double getValue() { return doubler; } + + /** + * @return the object's equality. + */ + + public boolean equals(Object o) { + if (o instanceof Double) { + return doubler == ((Double)o).doubleValue(); + } else if (o instanceof DoubleConstant) { + DoubleConstant dc = (DoubleConstant)o; + + return doubler == dc.getValue(); + } + + return false; + } +} diff --git a/src/FESI/ClassFile/EventAdaptorClassFile.java b/src/FESI/ClassFile/EventAdaptorClassFile.java new file mode 100644 index 00000000..2d6c7384 --- /dev/null +++ b/src/FESI/ClassFile/EventAdaptorClassFile.java @@ -0,0 +1,809 @@ +/* + * + * @(#) EncapsulatedEventAdaptorClassFile.java 1.3@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.EncapsulatedEventAdaptorClassFile + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + +package FESI.ClassFile; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.FileOutputStream; +import java.io.OutputStream; + +import java.io.IOException; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import java.util.Vector; + +import FESI.Interpreter.EventAdaptor; +import FESI.Interpreter.EventAdaptorGenerator; + +import FESI.ClassFile.Attribute; +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ClassConstant; +import FESI.ClassFile.Code; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.Exceptions; +import FESI.ClassFile.IntegerConstant; +import FESI.ClassFile.FieldDesc; +import FESI.ClassFile.FieldConstant; +import FESI.ClassFile.MethodDesc; +import FESI.ClassFile.MethodConstant; +import FESI.ClassFile.StringConstant; + +/** + *

    + * This class is used by the EventAdaptorGenerator to author the + * implementation of the EventAdaptor classes that it is responsible + * for generating and loading. + *

    + * + *

    + * This class wraps all the ClassFile generic support classes and provides + * the adaptor specific implemenetation. + *

    + * + * @see FESI.Interpreter.EventAdaptorGenerator + */ + +public final class EventAdaptorClassFile { + + private static String superClassName = + "FESI.Interpreter.EventAdaptor"; + + /* + * + */ + + private String listenerName; + private Class listenerClass; + + private String adaptorName; + private ClassFile classFile; + + private Method[] listenerMethods; + + /* + * + */ + + private StringConstant listenerNameConst; + + private FieldConstant methodsField; + private FieldConstant clazzField; + + private MethodConstant fireMethod; + private MethodConstant crackedFireMethod; + + private MethodConstant forNameMethod; + + private MethodConstant getMethodsMethod; + + /** + *

    + * This statis function creates the class file implementation and writes + * it to the stream for loading ... + *

    + * + * @param className the name of the adaptor class to synthesize. + * @param os the stream to write the class file into + * @exception IOException If any IO error occured during class loading + * @exception ClassNotFoundException If the class could not be loaded + * + * @returns + */ + + public EventAdaptorClassFile(String className, OutputStream os) + throws IOException, ClassNotFoundException { + + adaptorName = className; + listenerName = EventAdaptorGenerator.getBaseNameFromAdaptorName(className); + + listenerClass = Class.forName(listenerName); + + listenerMethods = listenerClass.getMethods(); + + classFile = new ClassFile(className, superClassName); + + // generate the misc class descriptions ... + + generateClassSundries(); + + // generate the class initializer + + generateInitializer(); + + // now the constructor ... + + generateConstructor(); + + // now the methods ... + + generateListenerMethods(); + + // write the resulting adaptor class to the stream provided. + + write(os); + } + + /** + * Are we running debug for this Adaptor generation? + */ + + private boolean debug() { return false; } + + /** + * Generate misc constant pool entries etc etc ... + */ + + private void generateClassSundries() { + + // the adaptor implements the Listener interface. + + classFile.addInterface(ClassFile.fullyQualifiedForm(listenerName)); + + listenerNameConst = classFile.addStringConstant(listenerName); + + /* + * private static java.lang.reflect.Method[] methods; + */ + + classFile.addFieldDesc( + new FieldDesc( + "methods", + "[Ljava/lang/reflect/Method;", + (short)(FieldDesc.ACC_STATIC | FieldDesc.ACC_PRIVATE), + classFile, + (Attribute[])null + ) + ); + + methodsField = classFile.addFieldConstant(adaptorName, + "methods", + "[Ljava/lang/reflect/Method;" + ); + + /* + * java.lang.reflect.Method[] java.lang.reflect.Method.getMethods(); + */ + + getMethodsMethod = classFile.addMethodConstant( + "java/lang/Class", + "getMethods", + "()[Ljava/lang/reflect/Method;" + ); + + /* + * java.lang.Class java.lang.Class.forName(); + */ + + forNameMethod = classFile.addMethodConstant( + "java/lang/Class", + "forName", + "(Ljava/lang/String;)Ljava/lang/Class;" + ); + /* + * private static java.lang.Class clazz; + */ + + classFile.addFieldDesc( + new FieldDesc( + "clazz", + "Ljava/lang/Class;", + (short)(FieldDesc.ACC_STATIC | FieldDesc.ACC_PRIVATE), + classFile, + (Attribute[])null + ) + ); + + clazzField = classFile.addFieldConstant(adaptorName, + "clazz", + "Ljava/lang/Class;" + ); + + /* + * these are superclass methods called from listener stubs ... + */ + + fireMethod = classFile.addMethodConstant( + adaptorName, + "fire", + "(Ljava/util/EventObject;Ljava/lang/reflect/Method;)V" + ); + + crackedFireMethod = classFile.addMethodConstant( + adaptorName, + "fire", + "([Ljava/lang/Object;Ljava/lang/reflect/Method;)V" + ); + + /* + * stub out base class abstract method: + * + * public static Class getListenerClass() { return clazz; } + * + */ + + Code c = new Code(classFile, (short)1, (short)2); + + c.addOpShort(Code.OP_GETSTATIC, clazzField.getConstantPoolIndex()); + c.addOp (Code.OP_ARETURN); + + Code[] ary = { c }; + + classFile.addMethodDesc( + new MethodDesc( + "getListenerClass", + "()Ljava/lang/Class;", + (short)MethodDesc.ACC_PUBLIC, + classFile, + ary + ) + ); + } + + /** + *

    Generate class Initializer method

    + */ + + private void generateInitializer() { + Code c = new Code(classFile, (short)0, (short)3); + Code[] ary = { c }; + short i = listenerNameConst.getConstantPoolIndex(); + + + // clazz = Class.forName( ); + + if (i <= 255) + c.addOp1(Code.OP_LDC, (byte)i); + else + c.addOpShort(Code.OP_LDC_WIDE, i); + + c.addOpShort(Code.OP_INVOKE_STATIC, + forNameMethod.getConstantPoolIndex() + ); + + c.addOp(Code.OP_DUP); + + c.addOpShort(Code.OP_PUTSTATIC, + clazzField.getConstantPoolIndex() + ); + + + // methods = clazz.getMethods(); + + c.addOpShort(Code.OP_INVOKE_VIRTUAL, + getMethodsMethod.getConstantPoolIndex() + ); + + c.addOpShort(Code.OP_PUTSTATIC, + methodsField.getConstantPoolIndex() + ); + + c.addOp (Code.OP_RETURN); + + classFile.addMethodDesc( + new MethodDesc( + "", + "()V", + (short)(MethodDesc.ACC_PRIVATE | MethodDesc.ACC_STATIC), + classFile, + ary + ) + ); + } + + /** + * Author the no-args public constructor for this Adaptor + * + * public void () { super(); } + */ + + private void generateConstructor() { + Code c = new Code(classFile, (short)1, (short)2); + Code[] ary = { c }; + MethodConstant mc; + + // get a MethodConstant for the superclass constructor + + mc = classFile.addMethodConstant( + ClassFile.fullyQualifiedForm(superClassName), + "", + "()V" + ); + + // push this onto the stack + + c.addOp (Code.OP_ALOAD_0); + + // call the superclass constructor + + c.addOpShort(Code.OP_INVOKE_SPECIAL, mc.getConstantPoolIndex()); + + c.addOp (Code.OP_RETURN); + + + // now add a method to the class file describing the constructor ... + + classFile.addMethodDesc( + new MethodDesc( + "", + "()V", + (short)MethodDesc.ACC_PUBLIC, + classFile, + ary + ) + ); + } + + /** + * Author the Listener Method Stubs for the EventListener interface + * this class is adapting to the EventListener interface. + */ + + private void generateListenerMethods() { + for (int i = 0; i < listenerMethods.length; i++) { + + /* we can only generate code for EventListener methods of + * the form: + * + * void ( ) + * or: + * void ( {} ) + * + * if we dont match these patterns we drop the method on the + * floor. + */ + + if (!Void.TYPE.equals(listenerMethods[i].getReturnType())) { + System.err.println( + "Detected unexpected method signature: " + + listenerMethods[i] + + " in interface: " + + listenerName + ); + } else { + Class[] lmParams = listenerMethods[i].getParameterTypes(); + Class[] lmExceptions = listenerMethods[i].getExceptionTypes(); + + + if (lmParams != null && + lmParams.length == 1 && + java.util.EventObject.class.isAssignableFrom(lmParams[0])) { + generateSimpleListenerMethodStub(listenerMethods[i], + lmParams[0], + lmExceptions, + i + ); + } else { + generateCrackedListenerMethodStub(listenerMethods[i], + lmParams, + lmExceptions, + i + ); + } + } + } + } + + /** + * Generate a simple EventListener interface method stub + */ + + private void generateSimpleListenerMethodStub(Method listenerMethod, Class listenerParam, Class[] listenerExceptions, int listenerMethodTableIndex) { + Code c = new Code(classFile, (short)2, (short)4); + Attribute[] ary; + + /* + * public void ( e) + * { + * EncapsulatedEvent t = new EncapsulatedEvent(e); + * Method m = findListenerMethod(); + * + * fire(t, m); + * } + */ + + c.addOp (Code.OP_ALOAD_0); // this + c.addOp (Code.OP_ALOAD_1); // event object + + c.addOpShort(Code.OP_GETSTATIC, + methodsField.getConstantPoolIndex() + ); + + if (listenerMethodTableIndex <= 255) { + c.addOp1(Code.OP_BIPUSH, (byte)listenerMethodTableIndex); + } else { + short i = classFile.addIntegerConstant(listenerMethodTableIndex).getConstantPoolIndex(); + + if (i <= 255) + c.addOp1(Code.OP_LDC, (byte)i); + else + c.addOpShort(Code.OP_LDC_WIDE, i); + } + + c.addOp (Code.OP_AALOAD); + + c.addOpShort(Code.OP_INVOKE_VIRTUAL, + fireMethod.getConstantPoolIndex() + ); // call fire(); + + c.addOp (Code.OP_RETURN); // get out of here + + if (listenerExceptions != null && listenerExceptions.length > 0) { + ary = new Attribute[2]; + + ary[1] = new Exceptions(listenerExceptions, classFile); + } else { + ary = new Attribute[1]; + } + + ary[0] = c; + + // define the listener method + + classFile.addMethodDesc( + new MethodDesc( + listenerMethod.getName(), + "(" + ClassFile.fieldType(listenerParam.getName()) + ")V", + (short)(listenerMethod.getModifiers() & ~MethodDesc.ACC_ABSTRACT), + classFile, + ary + ) + ); + } + + /** + * Generate a cracked EventListener interface method stub + */ + + private void generateCrackedListenerMethodStub(Method listenerMethod, Class[] listenerParams, Class[] listenerExceptions, int listenerMethodTableIndex) { + Code c = new Code(classFile, + (short)(listenerParams.length * 2 + 1), + (short)9 + ); + Attribute[] ary; + String methodPDesc = ""; + boolean wasDoubleWord; // was the last param processed double? + + c.addOp (Code.OP_ALOAD_0); // this + + /* + * For cracked Event listener methods we construct an array of Objects + * to contain the cracked actual parameters ... primitive types are + * wrapped in a container object suitable for their type. + */ + + if (listenerParams.length <= 255) { + c.addOp1(Code.OP_BIPUSH, (byte)listenerParams.length); + } else { + short i = classFile.addIntegerConstant(listenerParams.length).getConstantPoolIndex(); + + if (i <= 255) + c.addOp1(Code.OP_LDC, (byte)i); + else + c.addOpShort(Code.OP_LDC_WIDE, (short)i); + } + + c.addOpShort(Code.OP_ANEWARRAY, + classFile.addClassConstant("java.lang.Object").getConstantPoolIndex() + ); + + /* + * we've now constructed and array of java/lang/Object ... now populate + * it with the actual params. + */ + + int lvarIdx = 1; // because locals[0] == this + + /* + * for each formal parameter, generate code to load the actual + * param from this methods local vars, then if it is a primitive + * type, then construct a container object and initialize it + * to the primitives value. + * + * as a side effect of this loop we also construct the methods + * descriptor to optimise processing of the type info + */ + + for (int i = 0; i < listenerParams.length; i++, lvarIdx += (wasDoubleWord ? 2 : 1)) { + + c.addOp(Code.OP_DUP); // the array reference + + if (lvarIdx <= 255) { // the array index + c.addOp1(Code.OP_BIPUSH, (byte)i); + } else { + short ic = classFile.addIntegerConstant(i).getConstantPoolIndex(); + if (ic < 255) + c.addOp1(Code.OP_LDC, (byte)ic); + else + c.addOpShort(Code.OP_LDC_WIDE, (short)ic); + } + + /* + * get the param value onto TOS + * as a side effect gather method descriptor string. + */ + + String s = processParam(c, listenerParams[i], lvarIdx); + + c.addOp(Code.OP_AASTORE); // arrayref, index, value + + wasDoubleWord = s.equals("J") || s.equals("D"); + + methodPDesc += s; + } + + // that's the array constructed ... now lets call my superclass fire + + // but first we need to tell that method which listener is firing ... + + c.addOpShort(Code.OP_GETSTATIC, + methodsField.getConstantPoolIndex() + ); + + if (listenerMethodTableIndex <= 255) { + c.addOp1(Code.OP_BIPUSH, (byte)listenerMethodTableIndex); + } else { + short i = classFile.addIntegerConstant(listenerMethodTableIndex).getConstantPoolIndex(); + + if (i <= 255) + c.addOp1(Code.OP_LDC, (byte)i); + else + c.addOpShort(Code.OP_LDC_WIDE, i); + } + + c.addOp (Code.OP_AALOAD); // this, array, method + + // now we can call the fire method + + c.addOpShort(Code.OP_INVOKE_VIRTUAL, + crackedFireMethod.getConstantPoolIndex() + ); // call fire(); + + c.addOp (Code.OP_RETURN); // get out of here + + if (listenerExceptions != null && listenerExceptions.length > 0) { + ary = new Attribute[2]; + + ary[1] = new Exceptions(listenerExceptions, classFile); + } else { + ary = new Attribute[1]; + } + + ary[0] = c; + + // define the listener method + + classFile.addMethodDesc( + new MethodDesc( + listenerMethod.getName(), + "(" + methodPDesc + ")V", + (short)(listenerMethod.getModifiers() & ~MethodDesc.ACC_ABSTRACT), + classFile, + ary + ) + ); + } + + /* + * This method is used to generate code for cracked event listener + * stubs. Its job is to generate code to load the appropriate parameter + * data type onto the stack, create a wrapper object if needed and leave + * the appropriate value on TOS for storing into the objects array. + */ + + private String processParam(Code c, Class pClass, int pIdx) { + ClassConstant cc = null; + MethodConstant mc = null; + byte ldOpCode = Code.OP_ALOAD; // load ref by default + byte convOpCode = 0; + boolean singleWordParam = true; + Class pType = pClass; + boolean isPrimitive; + boolean isArrayRef; + + String pDesc = ""; + + // is this an array reference? + + while (pType.isArray()) { // side - effect: construct array param desc + pType = pType.getComponentType(); + pDesc += "["; + } + + isPrimitive = pType.isPrimitive(); + isArrayRef = pClass.isArray(); + + if (isPrimitive) { // builtin datatype + if (pType.equals(java.lang.Long.TYPE)) { + pDesc += "J"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Long"); + + mc = classFile.addMethodConstant( + "java/lang/Long", + "", + "(J)V" + ); + + ldOpCode = Code.OP_LLOAD; + singleWordParam = false; + } + } else if (pType.equals(java.lang.Float.TYPE)) { + pDesc += "F"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Float"); + + mc = classFile.addMethodConstant( + "java/lang/Float", + "", + "(F)V" + ); + + ldOpCode = Code.OP_FLOAD; + } + } else if (pType.equals(java.lang.Double.TYPE)) { + pDesc += "D"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Double"); + + mc = classFile.addMethodConstant( + "java/lang/Double", + "", + "(D)V" + ); + + ldOpCode = Code.OP_DLOAD; + singleWordParam = false; + } + } else { // integer, array or objref computational types ... + + ldOpCode = Code.OP_ILOAD; + + if (pType.equals(java.lang.Boolean.TYPE)) { + pDesc += "Z"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Boolean"); + + mc = classFile.addMethodConstant( + "java/lang/Boolean", + "", + "(Z)V" + ); + + convOpCode = Code.OP_I2B; + } + } else if (pType.equals(java.lang.Character.TYPE)) { + pDesc += "C"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Character"); + + mc = classFile.addMethodConstant( + "java/lang/Character", + "", + "(C)V" + ); + + convOpCode = Code.OP_I2C; + } + } else if (pType.equals(java.lang.Byte.TYPE)) { + pDesc += "B"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Byte"); + + mc = classFile.addMethodConstant( + "java/lang/Character", + "", + "(C)V" + ); + + convOpCode = Code.OP_I2B; + } + } else if (pType.equals(java.lang.Short.TYPE)) { + pDesc += "S"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Short"); + + mc = classFile.addMethodConstant( + "java/lang/Short", + "", + "(S)V" + ); + + convOpCode = Code.OP_I2S; + } + } else if (pType.equals(java.lang.Integer.TYPE)) { + pDesc += "I"; + + if (!isArrayRef) { + cc = classFile.addClassConstant("java/lang/Integer"); + + mc = classFile.addMethodConstant( + "java/lang/Integer", + "", + "(I)V" + ); + } + } + } + } else { // handle descriptors for non-primitives ... + pDesc += ClassFile.fieldType(pType.getName()); + } + + // now load the param value onto TOS ... + + if (pIdx < 255) + c.addOp1(ldOpCode, (byte)pIdx); + else { + c.addOp(Code.OP_WIDE); + c.addOpShort(ldOpCode, (short)pIdx); + } + + if (isPrimitive && !isArrayRef) { // additional processing for primitives + if (convOpCode != 0) { // narrow Int? + c.addOp(convOpCode); // then widen the reference + } + + // we now have the param's value of TOS, + // construct a container object for it + + c.addOpShort(Code.OP_NEW, (short)cc.getConstantPoolIndex()); + + if (singleWordParam) { + c.addOp(Code.OP_DUP_X1); // this, , this + c.addOp(Code.OP_SWAP); // this, + } else { + c.addOp(Code.OP_DUP_X2); // this, , this + c.addOp(Code.OP_DUP_X2); // this, this, , this + c.addOp(Code.OP_POP); // this, this, + } + + c.addOpShort(Code.OP_INVOKE_SPECIAL, mc.getConstantPoolIndex()); + } + + // param value on TOS + + return pDesc; // type descriptor - side effect + } + + /** + *

    write the class file to the stream

    + * + * @param os the output stream + * + * @throws IOException + */ + + private void write(OutputStream os) throws IOException { + classFile.write(os); + } +} \ No newline at end of file diff --git a/src/FESI/ClassFile/Exceptions.java b/src/FESI/ClassFile/Exceptions.java new file mode 100644 index 00000000..c11ecb1a --- /dev/null +++ b/src/FESI/ClassFile/Exceptions.java @@ -0,0 +1,160 @@ +/* + * + * @(#) Exceptions.java 1.3@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.Exceptions + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.Attribute; +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ClassConstant; + +/** + *

    + * The Exceptions class extends the Attribute class to enumerate the + * exception types generated by method implementations in a class file + *

    + */ + +class Exceptions extends Attribute { + + private ClassConstant[] exceptions; + + /** + *

    construct an Exceptions attribute that enumerates the exceptions

    + * + * @param exs[] an array of exception class constants + * @param cf the containing class file + */ + + Exceptions(ClassConstant[] exs, ClassFile cf) { + super(Attribute.EXCEPTIONS, cf); + + // we should validate that the ClassConstants are all + // subclasses of Exception here ... + + exceptions = exs; + } + + /** + *

    construct an Exceptions attribute that enumerates the exceptions

    + * + * @param exs[] an array of exception class types + * @param cf the containing class file + * + */ + Exceptions(Class[] exs, ClassFile cf) { + super(Attribute.EXCEPTIONS, cf); + + // we should validate that the ClassConstants are all + // subclasses of Exception here ... + + ClassConstant[] cc = new ClassConstant[exs.length]; + + for (int i = 0; i < exs.length; i++) + cc[i] = cf.addClassConstant(exs[i].getName()); + + exceptions = cc; + } + + /** + *

    write the Exceptions attribute to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeShort(getNameConstantPoolIndex()); + dos.writeInt(getLength()); + + if (exceptions != null && exceptions.length > 0) { + dos.writeShort(exceptions.length); + + for (int i = 0; i < exceptions.length; i++) { + dos.writeShort(exceptions[i].getConstantPoolIndex()); + } + } else dos.writeShort(0); + } + + /** + * @return the Object's equality + */ + + public boolean equals(Object o) { + if (o instanceof Exceptions) { + Exceptions other = (Exceptions)o; + + if (exceptions.length == other.exceptions.length) { + for (int i = 0; i < exceptions.length; i++) { + if (!exceptions[i].equals(other.exceptions[i])) + return false; + } + + return true; + } + } + + return false; + } + + /** + * @return the length of the Attribute in bytes + */ + + int getLength() { return exceptions.length * 2 + 2; } + + /** + *

    adds exception class to the attribute.

    + * + * @param a class constant to add to the attribute + * + */ + + void addException(ClassConstant ex) { + + // should verify that ClassConstant is exception subclass and not + // already in the attribute + + if (exceptions == null) { + exceptions = new ClassConstant[1]; + + exceptions[0] = ex; + } else { + ClassConstant[] temp = new ClassConstant[exceptions.length + 1]; + int i; + + for (i = 0; i < exceptions.length; i++) { + temp[i] = exceptions[i]; + } + + temp[i] = ex; + + exceptions = temp; + } + } +} diff --git a/src/FESI/ClassFile/FieldConstant.java b/src/FESI/ClassFile/FieldConstant.java new file mode 100644 index 00000000..59dfea99 --- /dev/null +++ b/src/FESI/ClassFile/FieldConstant.java @@ -0,0 +1,49 @@ +/* + * + * @(#) FieldConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.FieldConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.RefConstant; + +/** + *

    implements a CONSTANT_FIELDREF CPE

    + */ + +final class FieldConstant extends RefConstant { + + /** + *

    construct a CONSTANT_FIELDREF CPE

    + * + * @param cName the class name + * @param nName the name of the field + * @param tName the type descriptor for the field + * @param cf the class file + */ + + FieldConstant(String cName, String nName, String tName, ClassFile cf) { + super(CONSTANT_FIELDREF, cName, nName, tName, cf); + } +} diff --git a/src/FESI/ClassFile/FieldDesc.java b/src/FESI/ClassFile/FieldDesc.java new file mode 100644 index 00000000..27ec3ceb --- /dev/null +++ b/src/FESI/ClassFile/FieldDesc.java @@ -0,0 +1,107 @@ +/* + * + * @(#) FieldDesc.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.FieldDesc + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.UTF8Constant; +import FESI.ClassFile.Attribute; + +/** + *

    + * Implements the field_info structure of a class file, used to describe + * the attributes of all fields implemented by this class. The class provides + * minimal support to write the formatted structure to the stream. + *

    + */ + +final class FieldDesc { + + final static short ACC_PUBLIC = 0x0001; + final static short ACC_PRIVATE = 0x0002; + final static short ACC_PROTECTED = 0x0004; + final static short ACC_STATIC = 0x0008; + final static short ACC_FINAL = 0x0010; + final static short ACC_VOLATILE = 0x0040; + final static short ACC_TRANSIENT = 0x0080; + + private UTF8Constant name; + private UTF8Constant descriptor; + + private short accessFlags; + + private ClassFile classFile; + + private Attribute[] attributes; + + /** + *

    construct a descriptor for a field.

    + * + * @param field name + * @param desc its type descriptor + * @param flags access flags + * @param cf the class file + * @param attrs any associated attributes + * + */ + + FieldDesc(String field, String desc, short flags, ClassFile cf, Attribute[] attrs) { + super(); + + // we would validate here ... + + name = new UTF8Constant(field, cf); + descriptor = new UTF8Constant(desc, cf); + accessFlags = flags; + classFile = cf; + attributes = attrs; + } + + /** + *

    write the field to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeShort(accessFlags); + dos.writeShort(name.getConstantPoolIndex()); + dos.writeShort(descriptor.getConstantPoolIndex()); + + if (attributes != null && attributes.length == 0) { + dos.writeShort(attributes.length); + + for (int i = 0; i < attributes.length; i++) { + attributes[i].write(dos); + } + } else dos.writeShort(0); + } +} diff --git a/src/FESI/ClassFile/FloatConstant.java b/src/FESI/ClassFile/FloatConstant.java new file mode 100644 index 00000000..ab0e260b --- /dev/null +++ b/src/FESI/ClassFile/FloatConstant.java @@ -0,0 +1,93 @@ +/* + * + * @(#) FloatConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.FloatConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; + + /** + *

    provides minimal support for FLOAT_CONSTANT CPE

    + */ + +class FloatConstant extends ConstantPoolEntry { + + private float floating; + + /** + *

    construct a CONSTANT_FLOAT

    + * + * @param f the float value + * @param cf the class file + */ + + FloatConstant(float f, ClassFile cf) { + super(CONSTANT_FLOAT, cf); + + floating = f; + + addToConstantPool(); + } + + /** + *

    write the CONSTANT_FLOAT to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeFloat(floating); + } + + /** + *

    return the value of the constant

    + * + * @return the value of the CONSTANT_FLOAT + */ + + float getValue() { return floating; } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof Float) { + return floating == ((Float)o).floatValue(); + } else if (o instanceof FloatConstant) { + FloatConstant fc = (FloatConstant)o; + + return floating == fc.getValue(); + } + + return false; + } +} diff --git a/src/FESI/ClassFile/IntegerConstant.java b/src/FESI/ClassFile/IntegerConstant.java new file mode 100644 index 00000000..ce14be27 --- /dev/null +++ b/src/FESI/ClassFile/IntegerConstant.java @@ -0,0 +1,91 @@ +/* + * + * @(#) IntegerConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.IntegerConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; + +/** + *

    this class provides minimal support for the CONSTANT_INTEGER CPE

    + */ + +class IntegerConstant extends ConstantPoolEntry { + + private int integer; + + /** + *

    construct a CONSTANT_INTEGER CPE

    + * + * @param i the integer constant + * @param cf the class file + */ + + IntegerConstant(int i, ClassFile cf) { + super(CONSTANT_INTEGER, cf); + + integer = i; + + addToConstantPool(); + } + + /** + *

    write the CONSTANT_INTEGER to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeInt(integer); + } + + /** + * @return the value of the CONSTANT_INTEGER + */ + + int getValue() { return integer; } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof Integer) { + return integer == ((Integer)o).intValue(); + } else if (o instanceof IntegerConstant) { + IntegerConstant ic = (IntegerConstant)o; + + return integer == ic.getValue(); + } + + return false; + } +} diff --git a/src/FESI/ClassFile/InterfaceMethodConstant.java b/src/FESI/ClassFile/InterfaceMethodConstant.java new file mode 100644 index 00000000..a5c6dd38 --- /dev/null +++ b/src/FESI/ClassFile/InterfaceMethodConstant.java @@ -0,0 +1,50 @@ +/* + * + * @(#) InterfaceMethodConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.InterfaceMethodConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.RefConstant; + +/** + *

    this class provides minimal support for CONSTANT_INTERFACEMETHODREF CPE's

    + */ + +class InterfaceMethodConstant extends RefConstant { + + /** + *

    construct a CONSTANT_INTERFACEMETHODREF

    + * + * @param cName name of interface + * @param nName name of method + * @param tName method type descriptor + * @param cf class file + * + */ + + InterfaceMethodConstant(String cName, String nName, String tName, ClassFile cf) { + super(CONSTANT_INTERFACEMETHODREF, cName, nName, tName, cf); + } +} diff --git a/src/FESI/ClassFile/LongConstant.java b/src/FESI/ClassFile/LongConstant.java new file mode 100644 index 00000000..8a1a1713 --- /dev/null +++ b/src/FESI/ClassFile/LongConstant.java @@ -0,0 +1,91 @@ +/* + * + * @(#) LongConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.LongConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; + +/** + *

    this class provides minimal support for CONSTANT_LONG CPE's

    + */ + +class LongConstant extends ConstantPoolEntry { + + private long longish; + + /** + *

    construct a CONSTANT_LONG

    + * + * @param l the long constant + * @param cf the class file + */ + + LongConstant(long l, ClassFile cf) { + super(CONSTANT_LONG, cf); + + longish = l; + + addToConstantPool(); + } + + /** + *

    write the CONSTANT_LONG to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeLong(longish); + } + + /** + * @return the long constant value + */ + + long getValue() { return longish; } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof Long) { + return longish == ((Long)o).longValue(); + } else if (o instanceof LongConstant) { + LongConstant lc = (LongConstant)o; + + return longish == lc.getValue(); + } + + return false; + } +} diff --git a/src/FESI/ClassFile/MethodConstant.java b/src/FESI/ClassFile/MethodConstant.java new file mode 100644 index 00000000..eb30187e --- /dev/null +++ b/src/FESI/ClassFile/MethodConstant.java @@ -0,0 +1,49 @@ +/* + * + * @(#) MethodConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.MethodConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.RefConstant; + +/** + *

    this class provides minimal support for the CONSTANT_METHODREF CPE

    + */ + +class MethodConstant extends RefConstant { + + /** + *

    construct a CONSTANT_METHODREF

    + * + * @param cName the name of the implementing class + * @param nName the name of the method + * @param tName the type descriptor of the method + * @param cf the class file + */ + + MethodConstant(String cName, String nName, String tName, ClassFile cf) { + super(CONSTANT_METHODREF, cName, nName, tName, cf); + } +} diff --git a/src/FESI/ClassFile/MethodDesc.java b/src/FESI/ClassFile/MethodDesc.java new file mode 100644 index 00000000..4fd3cd84 --- /dev/null +++ b/src/FESI/ClassFile/MethodDesc.java @@ -0,0 +1,104 @@ +/* + * + * @(#) MethodDesc.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.MethodDesc + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.UTF8Constant; +import FESI.ClassFile.Attribute; + +/** + *

    this class provides minimal support for method_info structures

    + */ + +final class MethodDesc { + + final static short ACC_PUBLIC = 0x0001; + final static short ACC_PRIVATE = 0x0002; + final static short ACC_PROTECTED = 0x0004; + final static short ACC_STATIC = 0x0008; + final static short ACC_FINAL = 0x0010; + final static short ACC_SYNCHRONIZED = 0x0020; + final static short ACC_NATIVE = 0x0100; + final static short ACC_ABSTRACT = 0x0400; + + private UTF8Constant name; + private UTF8Constant descriptor; + + private short accessFlags; + + private ClassFile classFile; + + private Attribute[] attributes; + + /** + *

    construct a descriptor for a method

    + * + * @param method the name of the method + * @param desc a type descriptor for its signature + * @param flags access flags + * @param cf the class file + * @param attrs arbitrary attributes + * + */ + + MethodDesc(String method, String desc, short flags, ClassFile cf, Attribute[] attrs) { + super(); + + // we would validate here ... + + name = new UTF8Constant(method, cf); + descriptor = new UTF8Constant(desc, cf); + accessFlags = flags; + classFile = cf; + attributes = attrs; + } + + /** + *

    write the method to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeShort(accessFlags); + dos.writeShort(name.getConstantPoolIndex()); + dos.writeShort(descriptor.getConstantPoolIndex()); + + if (attributes != null && attributes.length > 0) { + dos.writeShort(attributes.length); + + for (int i = 0; i < attributes.length; i++) { + attributes[i].write(dos); + } + } else dos.writeShort(0); + } +} diff --git a/src/FESI/ClassFile/NameAndTypeConstant.java b/src/FESI/ClassFile/NameAndTypeConstant.java new file mode 100644 index 00000000..1db88c26 --- /dev/null +++ b/src/FESI/ClassFile/NameAndTypeConstant.java @@ -0,0 +1,115 @@ +/* + * + * @(#) NameAndTypeConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.NameAndTypeConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.UTF8Constant; + +/** + *

    this class provides minimal support for NAME_AND_TYPE CPE's

    + */ + +class NameAndTypeConstant extends ConstantPoolEntry { + + private UTF8Constant name; + private UTF8Constant desc; + + /** + *

    construct a CONSTANT_NAMEANDTYPE CPE

    + * + * @param n the name + * @param d the type + * @param cf the class file + */ + + NameAndTypeConstant(String n, String d, ClassFile cf) { + super(CONSTANT_NAMEANDTYPE, cf); + + name = new UTF8Constant(n, cf); + desc = new UTF8Constant(d, cf); + + addToConstantPool(); + } + + /** + *

    write the CPE to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + + if (debug()) { + System.err.println(getConstantPoolIndex() + + " NAME: " + + name.getConstantPoolIndex() + + " TYPE: " + + desc.getConstantPoolIndex() + ); + } + + dos.writeByte(getTag()); + dos.writeShort(name.getConstantPoolIndex()); + dos.writeShort(desc.getConstantPoolIndex()); + } + + /** + * @return the name string + */ + + String getName() { return name.getString(); } + + /** + * @return the type descriptor string + */ + + String getDescriptor() { return desc.getString(); } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof String) { + return name.getString().equals(o) || + desc.getString().equals(o); + } else if (o instanceof NameAndTypeConstant) { + NameAndTypeConstant nandt = (NameAndTypeConstant)o; + + return name.equals(nandt.getName()) && + desc.equals(nandt.getDescriptor()); + + } + + return false; + } +} diff --git a/src/FESI/ClassFile/RefConstant.java b/src/FESI/ClassFile/RefConstant.java new file mode 100644 index 00000000..6a871378 --- /dev/null +++ b/src/FESI/ClassFile/RefConstant.java @@ -0,0 +1,112 @@ +/* + * + * @(#) RefConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.RefConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.ClassConstant; +import FESI.ClassFile.NameAndTypeConstant; + +/** + *

    + * this base class provides minimal support for METHODREF, FIELDREF, and + * INTERFACEMETHODREF CPE's + *

    + */ + +class RefConstant extends ConstantPoolEntry { + + private ClassConstant clazz; + private NameAndTypeConstant nandt; + + /** + *

    construct a CPE

    + * + * @param t the CPE tag value + * @param cName the class name + * @param nName the name of the referenced field or method + * @param tName the type descriptor of the field or method + * @param cf the class file + * + */ + + protected RefConstant(byte t, String cName, + String nName, String tName, ClassFile cf) { + super(t, cf); + + clazz = new ClassConstant(cName, cf); + nandt = new NameAndTypeConstant(nName, tName, cf); + + addToConstantPool(); + } + + /** + *

    write the referenced object to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeShort(clazz.getConstantPoolIndex()); + dos.writeShort(nandt.getConstantPoolIndex()); + } + + /** + * @return the class constant for the referenced object + */ + + ClassConstant getClassObject() { return clazz; } + + /** + * @return the name and type CPE for the referenced object + */ + + NameAndTypeConstant getNameAndType() { return nandt; } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof String) { + return ((String)o).equals(nandt.getName()); + } else if (o instanceof RefConstant) { + RefConstant rc = (RefConstant)o; + + return clazz.equals(rc.getClassObject()) && + nandt.equals(rc.getNameAndType()); + } + + return false; + } + +} diff --git a/src/FESI/ClassFile/StringConstant.java b/src/FESI/ClassFile/StringConstant.java new file mode 100644 index 00000000..28dca795 --- /dev/null +++ b/src/FESI/ClassFile/StringConstant.java @@ -0,0 +1,105 @@ +/* + * + * @(#) StringConstant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.StringConstant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; +import FESI.ClassFile.UTF8Constant; + +/** + *

    this class provides minimal support for CONSTANT_STRING CPE's

    + */ + +final class StringConstant extends ConstantPoolEntry { + + private UTF8Constant string; + + /** + *

    construct a CONSTANT_STRING CPE

    + * + * @param str the constant + * @param cf the class file + */ + + StringConstant(String str, ClassFile cf) { + super(CONSTANT_STRING, cf); + + string = new UTF8Constant(str, cf); + + addToConstantPool(); + } + + /** + *

    construct a CONSTANT_STRING CPE

    + * + * @param utf8 the utf8 constant + * @param cf the class file + */ + + StringConstant(UTF8Constant utf8, ClassFile cf) { + super(CONSTANT_STRING, cf); + + string = utf8; + + addToConstantPool(); + } + + /** + *

    write the constant to the stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeShort(string.getConstantPoolIndex()); + } + + /** + * @return the string constant + */ + + String getString() { return string.getString(); } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof String) { + return string.equals(o); + } else if (o instanceof StringConstant) { + return string.equals(((StringConstant)o).getString()); + } + + return false; + } +} diff --git a/src/FESI/ClassFile/UTF8Constant.java b/src/FESI/ClassFile/UTF8Constant.java new file mode 100644 index 00000000..35ad763f --- /dev/null +++ b/src/FESI/ClassFile/UTF8Constant.java @@ -0,0 +1,89 @@ +/* + * + * @(#) UTF8Constant.java 1.2@(#) + * + * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + *

    + * FESI.ClassFile.UTF8Constant + *

    + * + * @version 1.0 + * @author Laurence P. G. Cable + */ + + +package FESI.ClassFile; + +import java.io.DataOutputStream; +import java.io.IOException; + +import FESI.ClassFile.ClassFile; +import FESI.ClassFile.ConstantPoolEntry; + +/** + *

    this class provides minimal support for CONSTANT_UTF8 CPE's

    + */ + +class UTF8Constant extends ConstantPoolEntry { + + private String string; + + /** + *

    construct a CONSTANT_UTF8 CPE

    + * + * @param s the string + * @param cf the class file + */ + + UTF8Constant(String s, ClassFile cf) { + super(CONSTANT_UTF8, cf); + + string = s; + + addToConstantPool(); + } + + /** + *

    write the CPE to the output stream

    + * + * @param dos the output stream + * + * @throws IOException + */ + + void write(DataOutputStream dos) throws IOException { + dos.writeByte(getTag()); + dos.writeUTF(string); + } + + /** + * @return the string constant + */ + + String getString() { return string; } + + /** + * @return object equality + */ + + public boolean equals(Object o) { + if (o instanceof String) { + return string.equals((String)o); + } else if (o instanceof UTF8Constant) { + return string.equals(((UTF8Constant)o).getString()); + } + + return false; + } +} diff --git a/src/FESI/Data/ArrayObject.java b/src/FESI/Data/ArrayObject.java new file mode 100644 index 00000000..724b909f --- /dev/null +++ b/src/FESI/Data/ArrayObject.java @@ -0,0 +1,185 @@ +// ArrayObject.java +// FESI Copyright (c) Jean-Marc Lugrin, 1999 +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. + +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package FESI.Data; + +import java.util.Hashtable; +import FESI.Exceptions.*; +import FESI.Interpreter.*; + +/** + * Implements the Array EcmaScript object. This is a singleton + */ +public class ArrayObject extends BuiltinFunctionObject { + + private static final String JOINstring = ("join").intern(); + private static final int JOINhash = JOINstring.hashCode(); + private static final String LENGTHstring = ("length").intern(); + private static final int LENGTHhash = LENGTHstring.hashCode(); + private static final String ZEROstring = ("0").intern(); + private static final int ZEROhash = ZEROstring.hashCode(); + + /** + * Create a new Array object - used by makeArrayObject + * + * @param prototype Must be an ArrayPrototype + * @param evaluator the evaluator + */ + private ArrayObject(ESObject prototype, Evaluator evaluator) { + super(prototype, evaluator, "Array", 1); + } + + + // overrides + public ESValue callFunction(ESObject thisObject, + ESValue[] arguments) + throws EcmaScriptException { + return doConstruct(thisObject, arguments); + } + + + // overrides + public ESObject doConstruct(ESObject thisObject, + ESValue[] arguments) + throws EcmaScriptException { + ESObject ap = evaluator.getArrayPrototype(); + ArrayPrototype theArray = new ArrayPrototype(ap, evaluator); + if (arguments.length > 1) { + for (int i=0; i 0) { + separator = arguments[0].toString(); + } + int length = (thisObject.getProperty(ArrayObject.LENGTHstring, ArrayObject.LENGTHhash)).toInt32(); + for (int i =0; i0) buffer.append(separator); + String iString = Integer.toString(i); + ESValue value = thisObject.getProperty(iString,iString.hashCode()); + if (value!=ESUndefined.theUndefined && value!=ESNull.theNull) { + buffer.append(value.toString()); + } + } + return new ESString(buffer.toString()); + } + } + class ArrayPrototypeReverse extends BuiltinFunctionObject { + ArrayPrototypeReverse(String name, Evaluator evaluator, FunctionPrototype fp) { + super(fp, evaluator, name, 0); + } + public ESValue callFunction(ESObject thisObject, + ESValue[] arguments) + throws EcmaScriptException { + if (!(thisObject instanceof ArrayPrototype)) { + throw new EcmaScriptException ("reverse only implemented for arrays"); + } + return ((ArrayPrototype) thisObject).reverse(); + } + } + class ArrayPrototypeSort extends BuiltinFunctionObject { + ArrayPrototypeSort(String name, Evaluator evaluator, FunctionPrototype fp) { + super(fp, evaluator, name, 1); + } + public ESValue callFunction(ESObject thisObject, + ESValue[] arguments) + throws EcmaScriptException { + if (!(thisObject instanceof ArrayPrototype)) { + throw new EcmaScriptException ("sort only implemented for arrays"); + } + ESValue compareFn = null; + if (arguments.length>0) compareFn = arguments[0]; + return ((ArrayPrototype) thisObject).sort(compareFn); + } + } + + arrayObject.putHiddenProperty("prototype",arrayPrototype); + arrayObject.putHiddenProperty(LENGTHstring,new ESNumber(1)); + + arrayPrototype.putHiddenProperty("constructor",arrayObject); + arrayPrototype.putHiddenProperty("toString", + new ArrayPrototypeToString("toString", evaluator, functionPrototype)); + arrayPrototype.putHiddenProperty("join", + new ArrayPrototypeJoin("join", evaluator, functionPrototype)); + arrayPrototype.putHiddenProperty("reverse", + new ArrayPrototypeReverse("reverse", evaluator, functionPrototype)); + arrayPrototype.putHiddenProperty("sort", + new ArrayPrototypeSort("sort", evaluator, functionPrototype)); + } catch (EcmaScriptException e) { + e.printStackTrace(); + throw new ProgrammingError(e.getMessage()); + } + + evaluator.setArrayPrototype(arrayPrototype); + + return arrayObject; + } +} \ No newline at end of file diff --git a/src/FESI/Data/ArrayPrototype.java b/src/FESI/Data/ArrayPrototype.java new file mode 100644 index 00000000..c9b4d495 --- /dev/null +++ b/src/FESI/Data/ArrayPrototype.java @@ -0,0 +1,585 @@ +// ArrayPrototype.java +// FESI Copyright (c) Jean-Marc Lugrin, 1999 +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. + +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package FESI.Data; + +import FESI.Exceptions.*; +import FESI.Interpreter.*; + +import java.util.Vector; +import java.util.Enumeration; +import java.lang.reflect.Array; + +/** + * Implements the prototype and is the class of all Array objects + */ +public class ArrayPrototype extends ESObject { + + private static final String LENGTHstring = ("length").intern(); + private static final int LENGTHhash = LENGTHstring.hashCode(); + + // The array value + // We could use a non synchronized vector or directly and array + protected Vector theArray = new Vector(); + + /** + * Create a new empty array + * @param prototype the ArrayPrototype + * @param evaluator The evaluator + */ + public ArrayPrototype(ESObject prototype, Evaluator evaluator) { + super(prototype, evaluator); + } + + // overrides + public String getESClassName() { + return "Array"; + } + + /** + * Return a Java array object which is the object to pass to Java routines + * called by FESI. + * @ param componentType the type of the component of the array + * @return a java array object + */ + public Object toJavaArray(Class componentType) throws EcmaScriptException { + int l = size(); + Object array = Array.newInstance(componentType, l); + if (l ==0) return array; + for (int i =0; i0) { + Vector reversed = new Vector(size); + reversed.setSize(size); + for (int i = 0, j=size-1; i b) return a number > 0; + * if (a == b) return 0; + * if (a < b) return a number < 0. + **/ + int compare(ESValue a, ESValue b) throws EcmaScriptException; + } + + static class DefaultComparer implements Comparer { + public int compare(ESValue v1, ESValue v2) throws EcmaScriptException { + ESValue v1p = v1.toESPrimitive(ESValue.EStypeNumber); + ESValue v2p = v2.toESPrimitive(ESValue.EStypeNumber); + if (v1p == ESUndefined.theUndefined && v2p == ESUndefined.theUndefined) return 0; + if (v1p == ESUndefined.theUndefined ) return 1; + if (v2p == ESUndefined.theUndefined ) return -1; + //System.out.println("v1p = " + v1 + " v2p = " + v2); + String s1 = v1.toString(); + String s2 = v2.toString(); + //System.out.println("s1 = " + s1 + " s2 = " + s2); + return s1.compareTo(s2); + } + } + + /** + * This is the main sort() routine. It performs a quicksort on the elements + * of array a between the element from and the element to. + * The Comparer argument c is used to perform + * comparisons between elements of the array. + **/ + private void sort(int from, int to, + Comparer c) throws EcmaScriptException + { + // If there is nothing to sort, return + if (theArray.size() < 2) return; + + // This is the basic quicksort algorithm, stripped of frills that can make + // it faster but even more confusing than it already is. You should + // understand what the code does, but don't have to understand just + // why it is guaranteed to sort the array... + // Note the use of the compare() method of the Comparer object. + int i = from, j = to; + ESValue center = (ESValue) theArray.elementAt((from + to) / 2); + do { + ESValue ai = (ESValue) theArray.elementAt(i); + ESValue aj = (ESValue) theArray.elementAt(j); + while((i < to) && (c.compare(center, ai) > 0)) { i++; ai = (ESValue) theArray.elementAt(i);} + while((j > from) && (c.compare(center, aj) < 0)) {j--; aj = (ESValue) theArray.elementAt(j);} + if (i < j) { + Object tmp = ai; theArray.setElementAt(aj,i); theArray.setElementAt(tmp, j); + } + if (i <= j) { i++; j--; } + } while(i <= j); + if (from < j) sort(from, j, c); // recursively sort the rest + if (i < to) sort(i, to, c); + } + + /** + * Sort the array with a specified compare routine + * @param compareFn A function returning a comparer + * @return the sorted array (in place) + */ + public ESValue sort(ESValue compareFn) throws EcmaScriptException { + if ((compareFn != null) && + (!(compareFn instanceof FunctionPrototype))) { + throw new EcmaScriptException("Compare function not a function: " + compareFn); + } + Comparer c = null; + if (compareFn != null) + c = new FunctionComparer((FunctionPrototype) compareFn); + else + c = new DefaultComparer(); + + sort(0, theArray.size()-1, c); + return this; + } + + // overrides + public void putProperty(String propertyName, ESValue propertyValue, int hash) + throws EcmaScriptException { + if (hash==LENGTHhash && propertyName.equals(LENGTHstring)) { + int length = (int) (((ESPrimitive) propertyValue).doubleValue()); + if (length<0) { + throw new EcmaScriptException("Invalid length value: " + propertyValue); + } + theArray.setSize(length); + } else { + int index = -1; // indicates not a valid index value + try { + index = Integer.parseInt(propertyName); // should be uint + } catch (NumberFormatException e) { + } + if (index<0) { + super.putProperty(propertyName, propertyValue, hash); + } else { + putProperty(index, propertyValue); + } + } + } + + // overrides + public void putProperty(int index, ESValue propertyValue) + throws EcmaScriptException { + + if (index>=theArray.size()) { + theArray.setSize(index+1); + } + theArray.setElementAt(propertyValue, index); + } + + // overrides + public ESValue getPropertyInScope(String propertyName, ScopeChain previousScope, int hash) + throws EcmaScriptException { + if (hash==LENGTHhash && propertyName.equals(LENGTHstring)) { + return new ESNumber(theArray.size()); + } + if (hasProperty(propertyName, hash)) { + return getProperty(propertyName, hash); + } + if (previousScope == null) { + throw new EcmaScriptException("global variable '" + propertyName + "' does not have a value"); + } else { + return previousScope.getValue(propertyName, hash); + } + } + + // overrides + public ESValue getProperty(String propertyName, int hash) + throws EcmaScriptException { + if (hash==LENGTHhash && propertyName.equals(LENGTHstring)) { + return new ESNumber(theArray.size()); + } else { + int index = -1; // indicates not a valid index value + try { + index = Integer.parseInt(propertyName); // should be uint + } catch (NumberFormatException e) { + } + if (index<0) { + return super.getProperty(propertyName, hash); + } else { + return getProperty(index); + } + } + } + + // overrides + public ESValue getProperty(int index) + throws EcmaScriptException { + Object theElement = null; + if (index Skip elements which were never set (are null), as Netscape + * SHOULD USE SUPER INSTEAD ! + * @return the enumerator + */ + public Enumeration getProperties() { + return new Enumeration() { + Enumeration props = properties.keys(); + Object currentKey = null; + int currentHash = 0; + int nextIndex = 0; + boolean inside = false; + ESObject prototype = ArrayPrototype.this.getPrototype(); + public boolean hasMoreElements() { + // Check if hasMoreElements was already called + if (currentKey != null) return true; + + // Check if a numeric key is appropriate + while ( (nextIndex