Compare commits

...

433 commits
v1.7.2 ... main

Author SHA1 Message Date
38181e8e00
Update repo URL 2025-03-01 19:32:20 +01:00
8adbd23569
Bump year of copyright notice 2025-03-01 19:32:06 +01:00
e3a7732837
Escape HTML elements in commit messages 2025-03-01 19:21:42 +01:00
d9d3c9b863
Add release notes generated with git-cliff
All checks were successful
Release / release (push) Successful in 31s
2025-03-01 16:57:02 +01:00
808bc48ab9
Run the build workflow when itself has changed
All checks were successful
Build / build (push) Successful in 23s
2025-02-28 22:15:00 +01:00
6ebdd6aa31
Leave aside compiling for different Java versions for now 2025-02-28 22:15:00 +01:00
2ff29317e5
Gradle is installed on the runner 2025-02-28 22:09:55 +01:00
84333d05cd
Use fully qualified URL for setup-java action 2025-02-28 22:04:48 +01:00
3a8997ca5c
Initial commit
Some checks failed
Build / build (11) (push) Failing after 0s
Build / build (17) (push) Failing after 0s
Build / build (21) (push) Failing after 0s
2025-02-28 21:58:08 +01:00
8212600d40
Add deploy script usable with rsync and a restricted SSH key 2025-02-28 21:43:19 +01:00
1bb5a093da
Re-enable creating the release at Github after install of gh client
All checks were successful
Release / build (push) Successful in 26s
2025-02-15 19:49:13 +01:00
2c6dd96cd7
Merge branch 'main' into renovate/commons-codec-commons-codec-1.x 2025-02-15 18:39:26 +01:00
6f6ea55b7b Update dependency com.google.code.gson:gson to v2.12.1 2025-02-15 17:36:51 +00:00
b1a14ad87b Update dependency commons-logging:commons-logging to v1.3.5 2025-02-15 17:36:40 +00:00
d1ead6e081 Update Jetty packages to v9.4.57.v20241219 2025-02-15 17:36:29 +00:00
94557dd28e Update dependency gradle to v8.12.1 2025-02-15 17:35:46 +00:00
5bfcd0b6ea
Distinguish the (currently bogus) GitHub release workflows by name
All checks were successful
Release / build (push) Successful in 26s
2025-02-15 16:43:05 +01:00
70337bda40
Add a custom name for the release workflow 2025-02-15 16:43:05 +01:00
ff4b4b0f07
Set the release title to today’s date as formatted string 2025-02-15 16:43:05 +01:00
156db3ee98
Try Forgejo action to create a release 2025-02-15 15:25:36 +01:00
45adacd5cd
Use name and URL of actual production environment 2025-02-15 15:25:13 +01:00
dd9e473310
Fix botched test of required Java version 2025-02-09 13:23:21 +01:00
e2e67cf2cc Update dependency commons-codec:commons-codec to v1.18.0 2025-01-27 18:13:44 +00:00
f7add5ec47
Looks like setting the LOG_LEVEL variable in the env section does not work
Setting it before the npx command does
2025-01-03 16:20:01 +01:00
0fc7d91348
Always save the Renovate log 2025-01-03 16:16:27 +01:00
1341c241bd
Replace Renovate autodiscovery with explicitly setting the repository 2025-01-03 16:16:27 +01:00
6d355fc5bd
Allow manual trigger of Renovate workflow 2025-01-03 15:55:49 +01:00
d18513fb76
Downgrade upload-artifact action again
v4 causes an error
2025-01-03 15:55:09 +01:00
d10f8d6d90
Replace elaborate checks for Java version with single one for Java 11 2025-01-03 15:54:42 +01:00
66fa98353e
Add the actual version string to helma.main.Server again 2025-01-03 15:54:42 +01:00
c2b37a8243
Update workflows for Forgejo runner 2025-01-03 13:35:33 +01:00
0c9b00dbb1 Merge pull request 'Update actions/upload-artifact action to v4' (#122) from renovate/major-github-artifact-actions into helma-🐜
Reviewed-on: #122
2025-01-03 12:01:15 +00:00
c1e9371f6b Update .github/workflows/renovate.yml 2025-01-03 11:59:50 +00:00
3284a1ca19 Update actions/upload-artifact action to v4 2025-01-03 11:57:30 +00:00
cbb6599ce0 Add Renovate workflow 2025-01-03 11:46:46 +00:00
49c1be97bb
Merge pull request #75 from antville/renovate/org.mozilla-rhino-1.x
Update dependency org.mozilla:rhino to v1.8.0
2025-01-03 11:08:53 +01:00
31bdcc6c27
Merge remote-tracking branch 'origin/renovate/org.mozilla-rhino-1.x' into renovate/org.mozilla-rhino-1.x 2025-01-03 11:01:24 +01:00
bdd4f7e280
Merge remote-tracking branch 'origin/helma-🐜' into helma-🐜 2025-01-03 10:49:14 +01:00
154a4a916a
Merge pull request #117 from antville/renovate/gradle-8.x
Update dependency gradle to v8.12
2025-01-03 10:44:22 +01:00
renovate[bot]
28887aaccd
Update dependency org.mozilla:rhino to v1.8.0 2025-01-03 09:32:00 +00:00
a00e2f730a
Merge pull request #118 from antville/renovate/jetty-packages
Update Jetty packages to v9.4.56.v20240826
2025-01-03 10:31:18 +01:00
9c2c603d4a
Merge pull request #110 from antville/renovate/com.github.jk1.dependency-license-report-2.x
Update plugin com.github.jk1.dependency-license-report to v2.9
2025-01-03 10:24:46 +01:00
b0260259ea
Merge pull request #111 from antville/renovate/commons-net-commons-net-3.x
Update dependency commons-net:commons-net to v3.11.1
2025-01-03 10:18:45 +01:00
renovate[bot]
d3098c892f
Update dependency commons-net:commons-net to v3.11.1 2025-01-03 09:12:13 +00:00
a5fa58dc3d
Merge pull request #119 from antville/renovate/commons-logging-commons-logging-1.x
Update dependency commons-logging:commons-logging to v1.3.4
2025-01-03 10:11:30 +01:00
20ea2a8fb9
Merge pull request #120 from antville/renovate/commons-codec-commons-codec-1.x
Update dependency commons-codec:commons-codec to v1.17.1
2025-01-03 10:09:28 +01:00
de34e49fc0
Merge pull request #121 from antville/renovate/gradle-actions-4.x
Update gradle/actions action to v4
2025-01-03 10:03:26 +01:00
f7fe09a294
Switch to rhino-all.jar, Helma needs the full Rhino experience 2025-01-03 09:53:53 +01:00
renovate[bot]
4ebbcb01ae
Update dependency org.mozilla:rhino to v1.8.0 2025-01-03 08:07:29 +00:00
renovate[bot]
e93c501149
Update dependency gradle to v8.12 2024-12-20 17:56:06 +00:00
renovate[bot]
3809198380
Update Jetty packages to v9.4.56.v20240826 2024-09-03 19:04:35 +00:00
renovate[bot]
65ac2df0ba
Update dependency commons-logging:commons-logging to v1.3.4 2024-08-19 14:24:50 +00:00
renovate[bot]
12e7f298ad
Update plugin com.github.jk1.dependency-license-report to v2.9 2024-08-15 18:27:04 +00:00
3365a2ef58
Fix ExecReload setting in service configuration 2024-08-08 23:00:08 +02:00
44f2375749
Update URL of stage environment 2024-08-08 19:35:22 +02:00
renovate[bot]
a975930192
Update gradle/actions action to v4 2024-08-03 22:55:47 +00:00
renovate[bot]
a54b27c4aa
Update dependency commons-codec:commons-codec to v1.17.1 2024-07-16 02:34:32 +00:00
608fd695c4
Switch to tasks.register() to define custom tasks 2024-06-15 23:08:45 +02:00
87675fd6cd
Fix deprecation warning for Java plugin conventions 2024-06-15 23:01:45 +02:00
efb7ad89b3
Add static fields for build date and commit hash 2024-06-15 22:43:26 +02:00
5de4616df0
Use main website as environment 2024-06-15 21:37:17 +02:00
bd70d2fb62
Disable automatic deployment 2024-06-15 21:37:17 +02:00
0f8bace3dd
Keep the lib/ext directory around 2024-06-15 21:37:17 +02:00
c1ad40ef72
Remove over-complicated launch and tasks configuration in favor of Gradle plugin
Starting run/debug tasks with the plugin works out of the box;
one just has to avoid the default “Run and Debug” button.
2024-06-15 21:37:17 +02:00
6b694a83ed
Add setup for Gradle debugging in VS Codium 2024-06-15 21:37:16 +02:00
79b7e8092b
Decouple update task from install
Now that Gradle runs Helma with the configured dependencies, updating the installation directory has become less crucial
2024-06-15 21:37:16 +02:00
196794cd93
Reorder the tasks 2024-06-15 21:37:16 +02:00
ed56cf72f7
Slightly modify the version string (still a date representation) 2024-06-15 21:37:16 +02:00
3a9c14898b
Update run configuration to always use the correct dependencies 2024-06-15 21:37:16 +02:00
82c32bb448
Slightly modify the format of the build date 2024-06-15 21:37:16 +02:00
def303c069
Define Java versions in a more general way 2024-06-15 12:19:28 +02:00
64bcb63e4a
Merge pull request #116 from antville/revert-112-renovate/gradle-8.x
Revert "Update dependency gradle to v8.8"
2024-06-14 23:01:39 +02:00
55dbc0359c
Revert "Update dependency gradle to v8.8" 2024-06-14 23:00:48 +02:00
f2feef4332
Use generic name for the staging server 2024-06-01 22:28:24 +02:00
14ccdf0691
Add deployment workflow 2024-06-01 20:54:35 +02:00
4ae840d3c9
Add reusable workflow for setting up SSH agent 2024-06-01 20:21:36 +02:00
132f8f4d7d
Revert "Bump minimum Java version to 17 (LTS)"
This reverts commit ebf9b22f55.
2024-06-01 18:56:08 +02:00
048cdc39f5
Merge pull request #112 from antville/renovate/gradle-8.x
Update dependency gradle to v8.8
2024-06-01 15:52:15 +02:00
renovate[bot]
6d7774fd2e
Update dependency gradle to v8.8 2024-05-31 23:22:22 +00:00
0e8ce1d7a7
Slightly reconfigure, reword and format workflow config 2024-05-31 13:14:34 +02:00
57642f6f10
Use today’s date as release title 2024-05-30 20:25:44 +02:00
dd0bdc62ec
Fix setup of GitHub token 2024-05-30 20:22:14 +02:00
renovate[bot]
656a023b27
Update dependency com.google.code.gson:gson to v2.11.0 2024-05-30 20:22:13 +02:00
7c52b6ba46
Add release action 2024-05-30 20:22:13 +02:00
47f7b19fe9
Merge remote-tracking branch 'origin/helma-🐜' into helma-🐜 2024-05-30 18:48:34 +02:00
ebf9b22f55
Bump minimum Java version to 17 (LTS) 2024-05-25 19:34:10 +02:00
399f81c1dc
Merge pull request #107 from antville/resolve-java-warnings
Resolve java warnings
2024-05-25 18:52:37 +02:00
d02dd85a45
Merge pull request #108 from antville/fix-javadoc-warnings
Fix JavaDoc warnings
2024-05-25 18:52:36 +02:00
0bfa585cb9
Replace new Boolean() with Boolean.valueOf()
Signed-off-by: Tobi Schäfer <interface@p3k.org>
2024-05-25 18:52:35 +02:00
8ffb7b0b08
Replace new Integer() with Integer.valueOf()
Signed-off-by: Tobi Schäfer <interface@p3k.org>
2024-05-25 18:52:34 +02:00
a68c478dd5
Replace new Double() with Double.valueOf()
Signed-off-by: Tobi Schäfer <interface@p3k.org>
2024-05-25 18:52:34 +02:00
77ea53d949
Fix JavaDoc warnings 2024-05-25 18:52:33 +02:00
2ff75f7879
Replace new Long() with Long.valueOf()
Signed-off-by: Tobi Schäfer <interface@p3k.org>
2024-05-25 18:52:33 +02:00
052bfc0db1
Update README.md
Minor edits
2024-05-25 18:52:32 +02:00
63c5aec4df
Add tasks to set up SSH agent and publish installation 2024-05-25 18:50:11 +02:00
cfbfea51d7
Create staging.yml 2024-05-25 18:50:10 +02:00
bca560e577
Do not run the update task in CI context 2024-05-25 18:50:09 +02:00
7f8c776c57
Upgrade the project dir only selectively on install 2024-05-25 18:50:08 +02:00
7fa9b805d6
Update renovate.json
Group Lucene packages
2024-05-25 18:50:08 +02:00
renovate[bot]
2ecd5b4e36
Update dependency gradle to v8.7 2024-05-25 18:50:07 +02:00
d23268095a
Gradle has an issue with the date-based version string 2024-05-25 18:50:06 +02:00
daf8da61b1 Add tasks to set up SSH agent and publish installation 2024-05-19 01:22:13 +02:00
db4dfd0ba7 Create staging.yml 2024-05-18 23:31:25 +02:00
f0ac6cdb5f Do not run the update task in CI context 2024-05-18 23:31:25 +02:00
d7f9882596 Upgrade the project dir only selectively on install 2024-05-18 23:11:45 +02:00
d6b7c97518 Update renovate.json
Group Lucene packages
2024-05-18 23:11:45 +02:00
renovate[bot]
b984877877 Update dependency gradle to v8.7 2024-05-18 23:11:45 +02:00
1a1b676604 Gradle has an issue with the date-based version string 2024-05-18 17:34:32 +02:00
46dd4a2c31
Merge pull request #102 from antville/renovate/jetty-packages
Update Jetty packages to v9.4.54.v20240208
2024-05-18 17:29:47 +02:00
renovate[bot]
ee2384f35a
Update Jetty packages to v9.4.54.v20240208 2024-05-18 15:19:19 +00:00
d25b8d207e
Update renovate.json
Group Jetty packages
2024-05-18 17:18:31 +02:00
f4cd065c59
Merge pull request #95 from antville/renovate/commons-codec-commons-codec-1.x
Update dependency commons-codec:commons-codec to v1.17.0
2024-05-18 17:12:42 +02:00
4b7f3b216d
Merge pull request #99 from antville/renovate/com.github.jk1.dependency-license-report-2.x
Update plugin com.github.jk1.dependency-license-report to v2.7
2024-05-18 17:07:36 +02:00
23f09d2d4f
Merge pull request #100 from antville/renovate/commons-logging-commons-logging-1.x
Update dependency commons-logging:commons-logging to v1.3.2
2024-05-18 17:01:09 +02:00
renovate[bot]
b6ed068e26
Update plugin com.github.jk1.dependency-license-report to v2.7 2024-05-18 14:51:24 +00:00
e96c224abc
Merge pull request #101 from antville/renovate/maven-dom4j-dom4j-vulnerability
Update dependency dom4j:dom4j to v20040902 [SECURITY]
2024-05-18 16:51:23 +02:00
renovate[bot]
519adc3d37
Update dependency commons-codec:commons-codec to v1.17.0 2024-05-18 14:49:57 +00:00
renovate[bot]
7d57badb94
Update dependency commons-logging:commons-logging to v1.3.2 2024-05-18 14:49:48 +00:00
renovate[bot]
b0e319f3dd
Update dependency dom4j:dom4j to v20040902 [SECURITY] 2024-05-18 14:49:45 +00:00
b8abe5a355
Fix Gradle task dependencies 2024-05-18 16:47:39 +02:00
7fa3f48cff
Pin dependency to version number 2024-05-18 16:47:38 +02:00
d64ca1c7a8
Do not exclude apps directory in Codium 2024-05-18 16:47:37 +02:00
eae2848e9e
Update Codium extensions for Java support 2024-05-18 16:47:36 +02:00
581b17bc72
Update renovate.json 2024-03-24 14:05:18 +01:00
ab116b2af9
Update renovate.json 2024-03-24 14:01:21 +01:00
d7ab9ff461
Update renovate.json 2024-03-24 13:45:44 +01:00
renovate[bot]
fd15c4703f
Update dependency dom4j:dom4j to v20040902 [SECURITY] (#96)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-19 22:17:28 +00:00
5e1435433a
Add vulnerability alerts 2024-02-10 22:51:46 +01:00
958a3c1cfc Merge remote-tracking branch 'origin/helma-🐜' into helma-🐜 2024-01-07 00:19:24 +01:00
5a4ad8eeda JSDoc issue seems to be fixed 2024-01-07 00:16:06 +01:00
54b9002bf4
Merge pull request #91 from antville/renovate/gradle-8.x
Update dependency gradle to v8.5
2024-01-06 21:33:57 +01:00
2e45fa4b6a
Merge pull request #89 from antville/renovate/org.eclipse.jetty-jetty-servlet-9.x
Update dependency org.eclipse.jetty:jetty-servlet to v9.4.53.v20231009
2024-01-06 21:19:48 +01:00
0fec3244e3
Merge pull request #76 from antville/renovate/commons-codec-commons-codec-1.x
Update dependency commons-codec:commons-codec to v1.16.0
2024-01-06 21:19:07 +01:00
renovate[bot]
aafd5f8a4c
Update dependency org.eclipse.jetty:jetty-servlet to v9.4.53.v20231009 2024-01-06 20:16:57 +00:00
752e4a0df7
Merge pull request #90 from antville/renovate/org.eclipse.jetty-jetty-xml-9.x
Update dependency org.eclipse.jetty:jetty-xml to v9.4.53.v20231009
2024-01-06 21:16:34 +01:00
bf29398ade
Merge pull request #92 from antville/renovate/commons-net-commons-net-3.x
Update dependency commons-net:commons-net to v3.10.0
2024-01-06 21:16:21 +01:00
renovate[bot]
7555411cdc
Update dependency commons-net:commons-net to v3.10.0 2024-01-06 20:16:12 +00:00
2f34fb5e05
Merge pull request #93 from antville/renovate/commons-logging-commons-logging-1.x
Update dependency commons-logging:commons-logging to v1.3.0
2024-01-06 21:15:55 +01:00
6eb1feb5cd
Update helma.service 2024-01-05 21:52:35 +01:00
6eaf097aef Add support for images in webp format 2023-12-30 15:11:41 +01:00
renovate[bot]
48ddd69f19
Update dependency commons-logging:commons-logging to v1.3.0 2023-12-01 05:25:09 +00:00
renovate[bot]
0223cb4ffe
Update dependency gradle to v8.5 2023-11-30 05:38:49 +00:00
renovate[bot]
1fa13b9fef
Update dependency org.eclipse.jetty:jetty-xml to v9.4.53.v20231009 2023-10-10 04:56:08 +00:00
3ccf0af87b
Update renovate.json 2023-08-28 21:10:36 +02:00
0774054470
Update renovate.json 2023-08-28 20:59:58 +02:00
e6a893a52e Remove Dependabot configuration 2023-08-28 19:46:09 +02:00
renovate[bot]
50ef602d42
fix(deps): update dependency commons-codec:commons-codec to v1.16.0 2023-08-27 11:13:38 +00:00
2cff9188cb
Replace Dependabot with Renovate 2023-08-27 13:12:53 +02:00
1540c5d24f
Merge pull request #74 from antville/renovate/configure
Configure Renovate
2023-08-27 12:53:35 +02:00
renovate[bot]
db966fb4e8
Add renovate.json 2023-08-27 10:50:25 +00:00
b04b1cf4bf
Merge pull request #68 from antville/rewrite-for-each-with-for-of
Rewrite `for…each` with `for…of`
2023-08-27 12:13:56 +02:00
d2e09554cd
Merge pull request #73 from antville/jetty-xml-9.4.51-upgrade
Upgrade Jetty XML package to version 9.4.51
2023-08-27 12:11:24 +02:00
647ca18d7b Upgrade Jetty XML package to same version as Jetty servlet 2023-08-27 12:10:26 +02:00
a580f08c17 Upgrade Gradle to latest version 2023-08-27 12:06:10 +02:00
94d6b2d1a1
Merge pull request #71 from antville/dependabot/gradle/com.github.jk1.dependency-license-report-2.5
build(deps): bump com.github.jk1.dependency-license-report from 2.2 to 2.5
2023-08-27 11:36:50 +02:00
d80ad0bf33
Merge pull request #70 from antville/dependabot/gradle/commons-net-commons-net-3.9.0
build(deps): bump commons-net:commons-net from 3.8.0 to 3.9.0
2023-08-27 11:36:42 +02:00
dependabot[bot]
dbb0b6bcfd
build(deps): bump com.github.jk1.dependency-license-report
Bumps com.github.jk1.dependency-license-report from 2.2 to 2.5.

---
updated-dependencies:
- dependency-name: com.github.jk1.dependency-license-report
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-27 09:29:35 +00:00
dependabot[bot]
d419342ee9
build(deps): bump commons-net:commons-net from 3.8.0 to 3.9.0
Bumps commons-net:commons-net from 3.8.0 to 3.9.0.

---
updated-dependencies:
- dependency-name: commons-net:commons-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-27 09:29:34 +00:00
a7ee467cdc
Group Jetty packages in Dependabot PRs 2023-08-27 11:29:05 +02:00
b812b33213 Merge branch 'helma-🐜' into rewrite-for-each-with-for-of 2023-08-26 23:26:09 +02:00
0e8f04c0f5 Replace for..each loops with for..of 2023-08-26 22:32:44 +02:00
d601ec689d
Merge pull request #65 from antville/dependabot/gradle/org.eclipse.jetty-jetty-servlet-9.4.51.v20230217
build(deps): bump org.eclipse.jetty:jetty-servlet from 9.4.50.v20221201 to 9.4.51.v20230217
2023-08-26 21:44:38 +02:00
6d5288f94b
Merge pull request #64 from antville/dependabot/gradle/com.google.code.gson-gson-2.10.1
build(deps): bump com.google.code.gson:gson from 2.8.9 to 2.10.1
2023-08-26 21:40:37 +02:00
7eae3ba273
Merge pull request #66 from antville/dependabot/gradle/commons-fileupload-commons-fileupload-1.5
build(deps): bump commons-fileupload:commons-fileupload from 1.4 to 1.5
2023-08-26 21:38:29 +02:00
796a6e7337 Enable ES6 features in Rhino 2023-08-26 21:29:54 +02:00
dependabot[bot]
4ca91f5b2e
build(deps): bump commons-fileupload:commons-fileupload from 1.4 to 1.5
Bumps commons-fileupload:commons-fileupload from 1.4 to 1.5.

---
updated-dependencies:
- dependency-name: commons-fileupload:commons-fileupload
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 09:57:57 +00:00
dependabot[bot]
fb4b11a426
build(deps): bump org.eclipse.jetty:jetty-servlet
Bumps [org.eclipse.jetty:jetty-servlet](https://github.com/eclipse/jetty.project) from 9.4.50.v20221201 to 9.4.51.v20230217.
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.50.v20221201...jetty-9.4.51.v20230217)

---
updated-dependencies:
- dependency-name: org.eclipse.jetty:jetty-servlet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 09:57:54 +00:00
dependabot[bot]
7fbad44166
build(deps): bump com.google.code.gson:gson from 2.8.9 to 2.10.1
Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.8.9 to 2.10.1.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/gson/compare/gson-parent-2.8.9...gson-parent-2.10.1)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 09:57:44 +00:00
e61b654238 Reduce rsync arguments to become more compatible 2023-05-21 12:26:38 +02:00
a19eb278c7 Disable DocLint for now
Too strict, causing too many errors
2023-05-21 12:26:37 +02:00
6701ac8095
Merge pull request #41 from antville/dependabot/gradle/xerces-xercesImpl-2.12.2
build(deps): bump xercesImpl from 2.12.1 to 2.12.2
2023-05-19 15:35:13 +02:00
1b4624d437
Merge pull request #62 from antville/dependabot/gradle/com.github.jk1.dependency-license-report-2.2
build(deps): bump com.github.jk1.dependency-license-report from 2.0 to 2.2
2023-05-19 15:31:58 +02:00
5bd6e521ce
Merge pull request #52 from antville/dependabot/gradle/org.eclipse.jetty-jetty-servlet-9.4.50.v20221201
build(deps): bump jetty-servlet from 9.4.27.v20200227 to 9.4.50.v20221201
2023-05-19 15:29:31 +02:00
dependabot[bot]
090afa9656
build(deps): bump xercesImpl from 2.12.1 to 2.12.2
Bumps xercesImpl from 2.12.1 to 2.12.2.

---
updated-dependencies:
- dependency-name: xerces:xercesImpl
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-19 12:51:02 +00:00
dependabot[bot]
6c61b9a02b
build(deps): bump com.github.jk1.dependency-license-report
Bumps com.github.jk1.dependency-license-report from 2.0 to 2.2.

---
updated-dependencies:
- dependency-name: com.github.jk1.dependency-license-report
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-19 12:50:52 +00:00
58d893f044
Create helma.service
Add SystemD unit file with reasonable settings

See <https://www.baeldung.com/linux/run-java-application-as-service>
2023-05-07 01:29:35 +02:00
ec67204d51
Merge pull request #61 from antville/add-development.prerequisites
Add development prerequisites
2023-03-09 14:20:53 +01:00
a692d7718c
Add development prerequisites
Fixes #56.
Fixes #58 .
2023-03-09 14:08:42 +01:00
08a5233bc6
Merge pull request #60 from antville/59-add-support-for-jenv
Add support for jEnv
2023-03-07 00:10:47 +01:00
6a3a90c4f4 Add .java-version file 2023-03-06 23:08:46 +00:00
5fe68aef81 Add VS Code settings 2023-03-05 15:54:15 +01:00
db2ebbed9c
Merge pull request #55 from antville/54-add-support-for-prepared-sql-statements-to-databaseobject
Add DatabaseObject.executePreparedRetrieval() method
2023-03-05 13:10:25 +01:00
9a0cf1a22d Add DatabaseObject.executePreparedRetrieval() method 2023-03-05 13:00:13 +01:00
dependabot[bot]
276290add0
build(deps): bump jetty-servlet
Bumps [jetty-servlet](https://github.com/eclipse/jetty.project) from 9.4.27.v20200227 to 9.4.50.v20221201.
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.27.v20200227...jetty-9.4.50.v20221201)

---
updated-dependencies:
- dependency-name: org.eclipse.jetty:jetty-servlet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-08 09:04:43 +00:00
832a9069f1
Merge pull request #35 from antville/dependabot/gradle/com.google.code.gson-gson-2.8.9
build(deps): bump gson from 2.8.6 to 2.8.9
2021-12-11 18:05:51 +01:00
f78e37905c
Merge pull request #32 from antville/dependabot/gradle/com.github.jk1.dependency-license-report-2.0
build(deps): bump com.github.jk1.dependency-license-report from 1.16 to 2.0
2021-12-11 17:57:39 +01:00
dependabot[bot]
4bee79eca7
build(deps): bump gson from 2.8.6 to 2.8.9
Bumps [gson](https://github.com/google/gson) from 2.8.6 to 2.8.9.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/gson/compare/gson-parent-2.8.6...gson-parent-2.8.9)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 09:08:02 +00:00
411b9198e4 Change creation of HopSession cookie value
Only include one of either, IP forwarded by proxy or remote address
2021-09-05 14:55:42 +02:00
dependabot[bot]
524578e8de
build(deps): bump com.github.jk1.dependency-license-report
Bumps com.github.jk1.dependency-license-report from 1.16 to 2.0.

---
updated-dependencies:
- dependency-name: com.github.jk1.dependency-license-report
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-01 09:17:24 +00:00
4fc158d6eb Also decompress error stream if required 2021-05-24 12:29:43 +02:00
5a3514440c
Merge pull request #9 from antville/dependabot/gradle/org.mozilla-rhino-1.7.13
build(deps): bump rhino from 1.7.12 to 1.7.13
2021-05-16 13:25:38 +02:00
84f4a5f396 Merge branch 'helma-🐜' into dependabot/gradle/org.mozilla-rhino-1.7.13 2021-05-16 13:16:19 +02:00
85e8088e40 Clean up upstart files 2021-04-18 19:50:07 +02:00
e0e78b1349 Bump Gradle version 2021-04-18 19:45:34 +02:00
9d5a504702
Merge pull request #10 from antville/dependabot/gradle/commons-codec-commons-codec-1.15
build(deps): bump commons-codec from 1.14 to 1.15
2021-04-05 17:34:36 +02:00
8eb3c53818
Minor fix 2021-04-05 12:21:03 +02:00
9b63e208d9
Add myself as default assignee 2021-04-05 12:05:09 +02:00
d3c325cef4 Add Java dependency for Test app to Gradle
Version 1.2 of subethasmtp is the closest available version (1.2.1)

⚠️ Modules were not tested after upgrade
2021-04-05 11:55:20 +02:00
e54b36bb2a Add Java dependency for HopKit to Gradle
Version 2.4.0 of Bean Scripting Framework is the closest available version (Oct 2006)

⚠️ Modules were not tested after upgrade
2021-04-05 11:41:19 +02:00
34b3a5d578 Add comment to unresolved deps 2021-04-05 11:25:48 +02:00
dependabot[bot]
6ed340675a
build(deps): bump commons-codec from 1.14 to 1.15
Bumps [commons-codec](https://github.com/apache/commons-codec) from 1.14 to 1.15.
- [Release notes](https://github.com/apache/commons-codec/releases)
- [Changelog](https://github.com/apache/commons-codec/blob/master/RELEASE-NOTES.txt)
- [Commits](https://github.com/apache/commons-codec/compare/commons-codec-1.14...rel/commons-codec-1.15)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 09:24:36 +00:00
dependabot[bot]
7f23ded63d
build(deps): bump rhino from 1.7.12 to 1.7.13
Bumps [rhino](https://github.com/mozilla/rhino) from 1.7.12 to 1.7.13.
- [Release notes](https://github.com/mozilla/rhino/releases)
- [Changelog](https://github.com/mozilla/rhino/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/mozilla/rhino/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-05 09:24:32 +00:00
e8d9f05b72 Add Java dependency for MP3 module to Gradle
Version 0.5.4 of jid3lib should be the correct version

⚠️ Modules were not tested after upgrade
2021-04-05 11:22:09 +02:00
a7fece6218 Add Java dependency for HtmlDocument module to Gradle
Version 1.1-beta-8 of Jaxen should be the correct version

⚠️ Modules were not tested after upgrade
2021-04-05 11:16:42 +02:00
ed5aac7f66 Add Java dependency for HtmlDocument module to Gradle
Version 1.6.1 of Dom4J should be the correct version

⚠️ Modules were not tested after upgrade
2021-04-05 11:03:44 +02:00
9e2bf074b7 Add Java dependency for search module to Gradle
Version 2.2.0 of Lucene should be the correct version

⚠️ Modules were not tested after upgrade
2021-04-05 10:55:52 +02:00
aea04da690 Add Java dependency for charts module to Gradle
Version 2.5.7 of JXL is closest available version (2.4.3)

⚠️ Modules were not tested after upgrade
2021-04-05 10:49:51 +02:00
2f8160526c Add Java dependency for SSH module to Gradle
Build 208 of ganymed-ssh2 is closest available version (Aug 2005)

⚠️ Modules were not tested after upgrade
2021-04-05 10:49:12 +02:00
ac02b90699 Make Git ignore .idea dir 2021-04-05 10:46:45 +02:00
8b990e29ca
Merge pull request #8 from antville/dependabot/gradle/commons-net-commons-net-3.8.0
build(deps): bump commons-net from 3.6 to 3.8.0
2021-04-04 21:01:29 +02:00
926f62ec57
Merge pull request #5 from antville/dependabot/gradle/xerces-xercesImpl-2.12.1
build(deps): bump xercesImpl from 2.12.0 to 2.12.1
2021-04-04 21:00:41 +02:00
47abd0e404
Merge pull request #7 from antville/dependabot/gradle/com.github.jk1.dependency-license-report-1.16
build(deps): bump com.github.jk1.dependency-license-report from 1.13 to 1.16
2021-04-04 21:00:24 +02:00
ae2c1c6221
Bump Java version according to config 2021-04-04 20:56:21 +02:00
dependabot[bot]
b5c6afda24
build(deps): bump commons-net from 3.6 to 3.8.0
Bumps commons-net from 3.6 to 3.8.0.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-04 18:28:10 +00:00
dependabot[bot]
b7a8e68537
build(deps): bump com.github.jk1.dependency-license-report
Bumps com.github.jk1.dependency-license-report from 1.13 to 1.16.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-04 18:28:08 +00:00
dependabot[bot]
425e3671ba
build(deps): bump xercesImpl from 2.12.0 to 2.12.1
Bumps xercesImpl from 2.12.0 to 2.12.1.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-04 18:28:03 +00:00
7a5e470821
Update dependabot.yml 2021-04-04 20:27:40 +02:00
b31b0dc2a5
Create dependabot.yml 2021-04-04 20:26:17 +02:00
Robert Gaggl
4b9b78bb0f Cherry-pick 390231e8dd 2021-03-06 19:11:48 +01:00
7e39892c4a Require Java 11 2021-03-06 19:01:35 +01:00
Robert Gaggl
62291171e3 res.setCookie() now accepts boolean httponly and secure flags
httponly defaults to true, secure to false
2021-03-06 18:52:18 +01:00
97db46a66c Merge remote-tracking branch 'helma-org/master' into helma-🐜 2021-03-06 18:46:29 +01:00
8305d30bad
fix: typo 2020-06-14 11:46:05 +02:00
db18a003fe chg: updated changelog 2020-05-17 22:17:39 +02:00
2ba24ccea8 chg: gitignore licenses dir 2020-05-17 22:17:29 +02:00
244b92d750 add: xgettext and po2js tasks 2020-05-17 21:36:41 +02:00
b91ee88304 add: some colors to log output 2020-05-15 21:58:10 +02:00
dfe9c5d1a3 fix: reference to up-to-date java mail library 2020-04-12 20:19:04 +02:00
8edc9db372 fix: java.net.URLConnection not following redirects from http to https 2020-04-12 19:08:02 +02:00
df3af8fab1 add: support for gzip encoded http response 2020-04-10 20:25:05 +02:00
a5bc33db70 fix: remaining references to obsolete sun.misc.Base64Encoder 2020-04-10 20:24:33 +02:00
523d806b56 fix: return an empty string if markup is null or undefined 2020-04-05 21:33:07 +02:00
c984d3c4a2 fix: exception when trying to copy helma.xsl 2020-04-05 21:32:12 +02:00
657f66c0ce chg: merged parser code modified in antville app back into hopkit 2020-04-03 14:15:00 +02:00
0bf39c8f4b add: missing licenses for jars in helma modules 2020-03-29 12:50:32 +02:00
2721db44ae chg: replaced static licenses with automatically generated ones using gradle task 2020-03-29 12:45:47 +02:00
ae50bc562e del: obsolete entity table and test method 2020-03-27 21:13:11 +01:00
75f609d095 fix: updated list of tags according to MDN 2020-03-27 21:08:51 +01:00
9950f4df46 del: outdated list of and check for “all” tags 2020-03-27 20:10:11 +01:00
5a958b2980 fix: regression from foolishly replacing a nullstring with space 2020-03-21 20:41:28 +01:00
06eefa8e86
fix: add newline after emoji 2020-03-21 20:22:53 +01:00
d6fd0ba6f7
fix: ugly warning symbol 2020-03-21 20:22:08 +01:00
75bda31376 add: change log 2020-03-21 20:20:02 +01:00
9265d322a0 chg: slightly edited wording 2020-03-21 20:19:27 +01:00
540d0eb0fc fix: concat res.write() arguments with spaces 2020-03-21 20:05:12 +01:00
dd53c6f365 fix: undesired newlines between multiple arguments in res.writeln() 2020-03-21 19:23:18 +01:00
Daniel Ruthardt
4d92cec456 Resolves issue #115. 2020-03-21 15:53:06 +01:00
91d052af48 chg: slightly edited 2020-03-21 15:47:19 +01:00
768b7b5ed3 Merge branch 'helma-js' into helma-🐜 2020-03-21 15:46:12 +01:00
0c1f1d0beb fix: some syntax errors with the help of eslint 2020-03-21 15:35:25 +01:00
060f6461cb fix: undefined variable error 2020-03-21 14:56:45 +01:00
23fdb31348 add: support for importing code using require() method (commonjs) 2020-03-21 14:40:26 +01:00
Daniel Ruthardt
db8d239c32 Minor code simplification. 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
9960e1c919 Removed obsolete class. 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
541286dc59 Fixed issue (persistent sessions did not work anymore).
Persistent sessions did not work anymore, because the Application
(which became part of the information to be serialized at some point in
time) was not serializable.
2020-03-21 14:40:00 +01:00
Daniel Ruthardt
e0f590da98 Added missing @Deprecated annotations. (cherry picking from commit be90106b8430386d93ecba7afcd465c09e2b0125) 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
37307708fd Removed standalone MD5Encoder implementation and replaced usage of it with Apache Commons Codec. 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
5abe737912 Added syncrhonization to methods who's overridden parent methods have synchronization as well. (cherry picking from commit 36d2021fe7178d6686b5843c6f57bbf41bfd30c2) 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
468a89bd05 Fixed version requirement / version check mismatch.
Although requiring a higher version of Java, this was not yet checked
correctly in the code.
2020-03-21 14:40:00 +01:00
Daniel Ruthardt
7f3bb3a85b Added generated serial version identifiers. (cherry picking from commit abbe243d4af0636541defcc75f74400dffefc00a) 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
1acd176aa5 Fixed deprecation issues. (cherry picking from commit b50bfdfd00b380061c6baa3dab1d7d5c89e616a3) 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
7cafee58c4 Added check to make sure that all code resources are returned at any point in time (i.e. even in application startup phase, when prototype has maybe never been updated before). (cherry picking from commit 5880fc27d323b82f508e5b5234999ebbd9bbb4ad) 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
eda05c731a Resolves issue #40.
http://github.com/helma-next/helma-next/issues#issue/40
2020-03-21 14:40:00 +01:00
0929cd1e57 Removed standalone Base64 implementation and replaced usage of it with Apache Commons Codec's Base64 implementation. 2020-03-21 14:40:00 +01:00
39f565252f chg: further replaced helma’s md5 implementation with apache commons codec 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
be233eba03 Replaced Helma MD5 implementation with Apache Commons Codec. 2020-03-21 14:40:00 +01:00
f6656f7b4d chg: refactored and simplified Array.intersection() method 2020-03-21 14:40:00 +01:00
0b938bf808 chg: refactored and simplified Array.union() method 2020-03-21 14:40:00 +01:00
aa2a236d91 chg: removed code from Array.contains() method and assigned it to Array.includes() 2020-03-21 14:40:00 +01:00
90e91ee9f7 chg: simplified code 2020-03-21 14:40:00 +01:00
a0f5729e58 chg: refactored String.pad() method with builtin methods 2020-03-21 14:40:00 +01:00
708c02f670 chg: String.endsWith() method is already provided by Rhino 2020-03-21 14:40:00 +01:00
9f49ad80b9 chg: String.startsWith() method is already provided by Rhino 2020-03-21 14:40:00 +01:00
2a4ae9adcf chg: String.trim() method is already provided by Rhino 2020-03-21 14:40:00 +01:00
265cf566b7 chg: String.repeat() method is already provided by Rhino 2020-03-21 14:40:00 +01:00
Daniel Ruthardt
9f213ab7b9 Moved import-style modules back into repository-style modules. 2020-03-21 14:40:00 +01:00
8e973d1a1a fix: removed / replaced orphaned helma links 2020-03-21 14:40:00 +01:00
cdc522b22e add: group and description to custom tasks 2020-03-21 14:40:00 +01:00
c2fcc1867a chg: cast each array element to string 2020-03-21 14:40:00 +01:00
Jürg Lehni
47fecff5b4 Fix sendForward() to define Content-Range header, as required by HTML5 audio and video tags. 2020-03-21 14:40:00 +01:00
Jürg Lehni
63b4ec8512 Escape backslash (\) in SQL Strings as they can break queries unescaped. 2020-03-21 14:40:00 +01:00
8433ed4f8c chg: bumped version of commons codec jar 2020-03-21 14:40:00 +01:00
2fe0041d2d chg: bumped jetty version 2020-03-21 14:40:00 +01:00
2f27921403 add: jvm arg to prevent dock icon on macos 2020-03-21 14:40:00 +01:00
cb57b90c62 fix: line endings in archive files (zip: crlf; tar: lf) 2020-03-21 14:40:00 +01:00
88b48b46ce add: parameter for running commandline task 2020-03-21 14:39:59 +01:00
c673e8e3f2 chg: name of rhino shell task 2020-03-21 14:39:59 +01:00
d985d1be0c fix: missing jsdoc files 2020-03-21 14:39:59 +01:00
bd552751f5 chg: moved launcher source files into subproject 2020-03-21 14:39:59 +01:00
f29781e150 del: code in comments 2020-03-21 14:39:59 +01:00
9cb7d08581 fix: readmes 2020-03-21 14:39:59 +01:00
cfb31beeec chg: updated readme 2020-03-21 14:39:59 +01:00
39af201e78 del: self-made start scripts (generated by gradle now) 2020-03-21 14:39:59 +01:00
2da9bcf00b fix: error when running start scripts 2020-03-21 14:39:59 +01:00
56e9f6793b chg: moved http and xmlrpc port settings into server.properties 2020-03-21 14:39:59 +01:00
5cbeb9f01d chg: replaced ant with gradle 2020-03-21 14:39:59 +01:00
cee0be52e0 chg: set source and target of java versions to 6 2020-03-21 14:39:59 +01:00
7d6fb8f903 chg: upgrade dependencies 2020-03-21 14:39:59 +01:00
36b5ae6279 chg: get rid of main task 2020-03-21 14:39:59 +01:00
Daniel Ruthardt
f7e52dbad5 Don't assume a specific system class loader.
The issue was encountered using Oracle JDK9 on Debian stretch arm64.
2020-03-21 14:39:59 +01:00
dbbaa0fb1a fix: use file-based stream 2020-03-21 14:39:59 +01:00
74640c222a fix: exception when trying to close undefined stream in finally block 2020-03-21 14:39:59 +01:00
c07e4a9d7f chg: upgraded rhino to version 1.7.9 2020-03-21 14:39:58 +01:00
8d62f24bee chg: sorted lines 2020-03-21 14:39:58 +01:00
825ccb6463 chg: upgraded commons net lib 2020-03-21 14:39:57 +01:00
e88c4f5d8f chg: upgraded commons net lib 2020-03-21 14:39:12 +01:00
5902bf9d7f chg: upgraded jetty to version 9.4.3.v20170317
cherry-picked from 390231e8dd
2020-03-21 14:36:36 +01:00
6571f4ff1b wip: removing ajp support 2020-03-21 14:36:36 +01:00
03e2718ff5 fix: null pointer exception
if argument is null in res.debug() / write() / writeln()
2020-03-21 14:36:36 +01:00
00762cf495 del: inline css styles from helma debug lines 2020-03-21 14:36:36 +01:00
6e5d2061fa chg: allow variable amount of arguments in response methods 2020-03-21 14:36:36 +01:00
c399fd27e4 fix: build instructions using gradlew 2020-03-21 14:36:36 +01:00
677cedd0eb add: .gradle dir to .gitignore 2020-03-21 14:36:36 +01:00
5821630d7d fix: removed / replaced orphaned helma links 2020-03-20 21:22:17 +01:00
1f1163704a add: group and description to custom tasks 2020-03-20 21:06:50 +01:00
cd05af552e chg: cast each array element to string 2020-03-20 20:53:13 +01:00
Jürg Lehni
74b927244e Fix sendForward() to define Content-Range header, as required by HTML5 audio and video tags. 2020-03-20 19:53:51 +01:00
Jürg Lehni
a9e1cf3f51 Escape backslash (\) in SQL Strings as they can break queries unescaped. 2020-03-20 19:53:17 +01:00
e246589cdf chg: bumped version of commons codec jar 2020-03-18 21:26:30 +01:00
2ca34c70b5 chg: bumped jetty version 2020-03-18 21:22:06 +01:00
a2d9dae06e add: jvm arg to prevent dock icon on macos 2020-03-18 21:17:26 +01:00
d540b38a98 fix: line endings in archive files (zip: crlf; tar: lf) 2020-03-18 21:05:03 +01:00
19a3961207 add: parameter for running commandline task 2020-03-18 10:38:45 +01:00
b90143adf7 chg: name of rhino shell task 2020-03-18 10:38:43 +01:00
e40b78230c fix: missing jsdoc files 2020-03-18 10:37:59 +01:00
a9163bd66f chg: moved launcher source files into subproject 2020-03-17 20:49:55 +01:00
94ce6dac49 del: code in comments 2020-03-17 19:58:45 +01:00
70a0b2d9a1 fix: readmes 2020-03-17 19:58:24 +01:00
a4635aefb6 chg: updated readme 2020-03-17 19:20:39 +01:00
e4a36582f7 del: self-made start scripts (generated by gradle now) 2020-03-17 19:20:26 +01:00
efd5617a89 fix: error when running start scripts 2020-03-17 18:30:14 +01:00
387066f34d chg: moved http and xmlrpc port settings into server.properties 2020-03-17 18:29:41 +01:00
7eebeee1d0 chg: replaced ant with gradle 2020-03-17 08:57:53 +01:00
ced560f0c7 chg: set source and target of java versions to 6 2020-03-15 12:38:50 +01:00
c0cbe38fc5 chg: upgrade dependencies 2020-03-15 12:23:18 +01:00
1bc6653499 chg: get rid of main task 2020-03-15 12:19:38 +01:00
Daniel Ruthardt
78ccdfced9 Don't assume a specific system class loader.
The issue was encountered using Oracle JDK9 on Debian stretch arm64.
2020-03-15 12:07:19 +01:00
fcb01e21cd fix: use file-based stream 2018-05-20 08:43:18 +02:00
ad04d90940 fix: exception when trying to close undefined stream in finally block 2018-05-06 12:35:34 +02:00
938456e014 chg: upgraded rhino to version 1.7.9 2018-04-29 21:33:01 +02:00
Simon Oberhammer
f1fa050ea5 bump version 1.7.4 2018-02-13 15:14:22 +01:00
Simon Oberhammer
e82aa34967 package modules too 2018-02-13 15:14:07 +01:00
Simon Oberhammer
65381e7638 use java8 as target; source could stay 1.5 but i'm bumping this too now 2018-02-13 14:44:56 +01:00
Simon Oberhammer
21739a54d8 update readme (first time after 9 years. yey\!) 2018-02-13 14:44:28 +01:00
Simon Oberhammer
d1fb7d312e neither jsdocs nor javadocs did build and the tools seem to be gone for a long time so drop those tasks from ant file; also removed welcome app from demo since this app no longer exists 2018-02-13 14:35:10 +01:00
1008524b35 chg: sorted lines 2017-04-17 16:36:46 +02:00
7dc2ffe46c chg: upgraded commons net lib 2017-04-17 16:35:37 +02:00
ffbf863046 Finish goodbye-ajp 2017-04-17 15:35:31 +02:00
e82dd613db fix: null pointer exception
if argument is null in res.debug() / write() / writeln()
2017-04-17 15:32:12 +02:00
468e8a9298 chg: upgraded jetty to version 9.4.3.v20170317
cherry-picked from 390231e8dd
2017-04-17 15:06:14 +02:00
6860ea589e Merge branch 'helma-🐜' into feature/goodbye-ajp 2017-04-17 15:01:47 +02:00
7185214a5d del: inline css styles from helma debug lines 2017-04-17 14:04:41 +02:00
1054413a10 chg: allow variable amount of arguments in response methods 2017-04-17 14:03:54 +02:00
Robert Gaggl
81f5e3cd8e res.setCookie() now accepts boolean httponly and secure flags
httponly defaults to true, secure to false
2017-03-27 15:50:01 +02:00
Robert Gaggl
75f0245817 removed activation.jar, this is part of j2se since version 6 2017-03-27 14:45:33 +02:00
Robert Gaggl
021a24a100 updated commons libs:
- codec to 1.10
- fileupload to 1.3.2
- io to 2.5
- logging to 1.2
- net to 3.6
2017-03-27 14:39:34 +02:00
Robert Gaggl
390231e8dd updated to jetty 9.4.3.v20170317 2017-03-27 14:17:46 +02:00
c085492c27 chg: refactored global encodeForm() method to JS 2017-03-19 17:50:18 +01:00
98a8cdbc53 fix: default value for encodeNewline 2017-03-19 17:47:59 +01:00
863c622631 chg: refactored global encodeXml() method to JS 2017-03-19 17:38:12 +01:00
12f9e1b1e3 chg: refactored global encode() method to JS 2017-03-19 17:13:20 +01:00
655f965084 chg: refactored global strippedTags() method to JS 2017-03-19 17:11:37 +01:00
51b568f099 fix: build instructions using gradlew 2017-03-19 13:18:21 +01:00
3927f86e58 add: .gradle dir to .gitignore 2017-03-19 13:17:51 +01:00
7d07ac4f2d chg: updated version string
this is a custom version of helma for antville 1.6
2016-12-17 18:18:31 +01:00
29743f0608 chg: updated rhino to version 1.7.7.1 2016-12-17 18:05:14 +01:00
049ee71b43 Merge branch 'feature/commonjs-support' into helma-🐜 2016-12-17 11:09:09 +01:00
5f68f40579 wip: removing ajp support 2016-12-17 10:54:39 +01:00
43cc3ca243 chg: removed spaces before commented-out code 2016-12-17 10:51:09 +01:00
c50fec4abb add: -i flag for helma installation dir
(just for the record)
2016-12-17 10:50:18 +01:00
8820821f41 fix: prevent dock icon being shown in macos
see https://developer.apple.com/library/content/releasenotes/Java/JavaLeopardUpdate1RN/ResolvedIssues/ResolvedIssues.html
2016-12-17 10:45:04 +01:00
5c0e36e48b add: experimental support for commonjs modules
activated rhino’s require() method and module.exports object; both work, but the default implementation cannot load packages which in turn require modules in relative subdirs.

a new property called commonjs.dir can be used to define an additional search directory. the app dir is added automatically.
2016-12-17 10:36:13 +01:00
c468e8e865 add: support for httponly and secure cookies 2016-12-09 23:49:23 +01:00
Robert Gaggl
b0ff574e95 updated rhino to 1.7.7.1 and jdk8 2016-12-05 13:47:42 +01:00
2a41085419 Merge branch 'feature/hello-gradle' into helma-🐜 2016-12-04 22:15:23 +01:00
5f0ff9f635 add: gradle files
still using ant targets via importBuild except for dependency management
2016-12-04 22:15:08 +01:00
4ebc1182f1 Merge branch 'feature/hello-gradle' into helma-🐜 2016-12-04 16:05:07 +01:00
e322fb80dd Merge branch 'feature/goodbye-jimi' into helma-🐜 2016-12-04 16:03:37 +01:00
6e196e857f del: support for Jimi image processing library 2016-12-04 15:59:29 +01:00
ecb0003a37 add: gradle files
still using ant targets via importBuild except for dependency management
2016-12-04 15:55:19 +01:00
dd822d4e24 fix: reference to Base64 is ambiguous, both class java.util.Base64 in java.util and class helma.util.Base64 in helma.util match (Java 8) 2015-12-22 19:36:40 +01:00
948dc9a76b fix: removed encoding of valid unicode characters to html entities 2015-12-13 12:36:37 +01:00
735de0bbf6 fix: re-enabled output of <br> elements in format() method with additional class attribute to signify where it comes from 2015-08-14 14:23:22 +02:00
80dfe53204 chg: removed transformation of linebreaks to <br> or <p> elements in format() method 2015-08-10 14:19:57 +02:00
ed8f6ce9b6 chg: removed transformation to HTML entities, basically only supporting Unicode output (it’s 2015, I think it’s alright) 2015-08-10 14:16:01 +02:00
fc51cb398b chg: bumped Java source and target version to 1.7 2015-08-10 14:10:29 +02:00
835c56afcf Ignore anything starting with db 2015-05-23 18:25:47 +02:00
2cfb7e4b15 Ignore anything starting with apps and the passwd file created by the manage app 2015-05-23 18:19:00 +02:00
f763a0896e Update and rename README.txt to README.md 2015-04-08 19:02:12 +02:00
60b31e6133 Update and rename README.txt to README.md 2015-04-08 19:00:36 +02:00
af2c37bda6 Update and rename readme.txt to README.md 2015-04-08 18:53:05 +02:00
6ca7261976 Delete summary.txt 2015-04-08 18:48:15 +02:00
7e6c6c6d5b Update README.md 2015-04-08 18:48:02 +02:00
32eb71677e Update README.md 2015-04-08 18:47:29 +02:00
b0eb4ecba3 Update and rename README to README.md 2015-04-08 18:45:09 +02:00
69adddafed Updated Jala module 2015-04-07 16:39:02 +02:00
0d31d25d7b Merge remote-tracking branch 'origin/master' 2015-04-07 16:11:57 +02:00
4c9114fac4 Updated Git URL for Jala submodule 2015-04-07 16:11:22 +02:00
22a23c45a2 Converted to MarkDown 2015-02-11 20:46:14 +01:00
8a6c58ad74 Fixed module URL 2015-01-28 20:57:55 +01:00
e9e8a4aa34 Moved some exclusion patterns from .git/info/exclude to .gitignore 2015-01-28 20:47:57 +01:00
48d77455f8 Ignore log directory 2015-01-28 20:36:17 +01:00
96a037d508 Added Jala as submodule 2015-01-28 20:36:07 +01:00
921b074e6b Refactored replace_filter to use JS regular expression 2015-01-28 20:14:08 +01:00
2acff557d0 Removed default size from form fields 2015-01-28 20:13:27 +01:00
e2fe90126b Removed submodules 2015-01-28 20:13:01 +01:00
a7dd487d3e Merge remote-tracking branch 'helma/master' 2015-01-28 19:23:10 +01:00
Simon Oberhammer
dd8f8b6caa bump version 2014-03-12 09:56:29 +01:00
Robert Gaggl
61bafb72d6 partly reverted 5f18e3ae2d:
switched back to using DbSources as Map keys, as using strings breaks switching databases
using DbSource.switchProperties (which is used in jala.Test)
2013-04-09 16:05:07 +02:00
Robert Gaggl
5f18e3ae2d Modified Transactor to store sqlConnections internally using the name of the DbSource
as Map key, not the DbSource instance. Using the instance as key is both inefficient and
error prone (see fd0b77bc11).

Additional changes:
- modified getConnection() to check if the DB is oracle. "SELECT 1" is invalid
for Oracle DBs and lead to Helma dropping in-use connections every minute.
- set DbSource name final
2013-04-09 12:52:06 +02:00
Robert Gaggl
8d9bc3afb1 Next attempt to fix the deadlock issue that lead to fd0b77bc11:
The source of the deadlock problem seems that during DbSource.getConnection() ResourceProperties instances are compared using their equals() method, which is synchronized in Hashtable and can/does lead to deadlocks (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6582568).

This commit overwrites equals with an unsynchronized version. Note that this implementation might return a wrong result if one of the two instances is modified during this method call, but at least doesn't throw a ConcurrentModificationException.
2013-04-08 17:30:31 +02:00
f6f6475908 Remoted symlink 2013-04-07 17:32:22 +02:00
b5adad0eaa Removed swarm submodule 2013-04-07 17:28:35 +02:00
59d127e089 Merged with helma/master 2013-04-07 17:27:18 +02:00
ff7bba76cf Merge remote-tracking branch 'helma/master'
Conflicts:
	.gitignore
	apps
	modules
2013-04-07 17:18:29 +02:00
a9a6b0d753 Added submodules for apps, modules and swarm 2012-04-22 18:39:08 +02:00
e28ad52e80 Merge branch 'master' of github.com:p3k/helma 2012-03-22 18:23:09 +01:00
964fcc1e54 Added .gitignore file and debian directory 2012-03-22 18:21:29 +01:00
9310ccd2f8 Merge remote-tracking branch 'oberhamsi/jetty7' 2012-03-22 17:28:50 +01:00
Simon Oberhammer
bb4e494ec6 removed extra code for 'org.mortbay' loggers
seems to me this just logs less; let's not do that in code - we can control
loglevel of org.eclipse with -D options just fine.
2012-03-22 17:21:18 +01:00
Simon Oberhammer
503005eac8 switch ContextHandler -> ServletContextHandler
I tried to do what RingoJs does...
2012-03-22 17:21:18 +01:00
Simon Oberhammer
892078eb4e to fix the illegal state exception
i switched the order of app-binding and jetty-server-starting; now it
gets a bit farther but throws another exception:

2012-03-20 10:25:35.550:WARN:oejuc.AbstractLifeCycle:FAILED org.eclipse.jetty.servlet.ServletHandler@177f409c: java.lang.ClassCastException: org.eclipse.jetty.server.handler.ContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler
java.lang.ClassCastException: org.eclipse.jetty.server.handler.ContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler
	at org.eclipse.jetty.servlet.ServletHandler.doStart(ServletHandler.java:147)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
	at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:97)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:722)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
	at helma.main.ApplicationManager$AppDescriptor.bind(ApplicationManager.java:550)
	at helma.main.ApplicationManager.startAll(ApplicationManager.java:168)
	at helma.main.Server.run(Server.java:602)
	at java.lang.Thread.run(Thread.java:662)
2012-03-22 17:21:18 +01:00
Simon Oberhammer
aff951c964 replace jar files and jar loading
helma compiles & starts now, but throws this exception:

    java.lang.IllegalStateException: STARTED
  	at org.eclipse.jetty.server.handler.HandlerWrapper.setHandler(HandlerWrapper.java:71)
  	at helma.main.ApplicationManager$AppDescriptor.bind(ApplicationManager.java:482)
	at helma.main.ApplicationManager.startAll(ApplicationManager.java:168)
	at helma.main.Server.run(Server.java:611)
	at java.lang.Thread.run(Thread.java:662)
2012-03-22 17:21:17 +01:00
Simon Oberhammer
56871c7072 autochanges by jetty6to7 tool 2012-03-22 17:21:17 +01:00
Simon Oberhammer
c7e9f4c6cb update rhino to 8ba9619bc53a3a61e9e026ef86b6ad698a850d38 2012-03-22 17:21:17 +01:00
Simon Oberhammer
1db31dc405 case-sensitivity-switch implemented by kmfdm 2012-03-22 17:21:17 +01:00
Simon Oberhammer
d8757f6aa3 removed extra code for 'org.mortbay' loggers
seems to me this just logs less; let's not do that in code - we can control
loglevel of org.eclipse with -D options just fine.
2012-03-20 14:05:33 +01:00
Simon Oberhammer
578c654541 switch ContextHandler -> ServletContextHandler
I tried to do what RingoJs does...
2012-03-20 14:00:30 +01:00
Simon Oberhammer
786a5e86bd to fix the illegal state exception
i switched the order of app-binding and jetty-server-starting; now it
gets a bit farther but throws another exception:

2012-03-20 10:25:35.550:WARN:oejuc.AbstractLifeCycle:FAILED org.eclipse.jetty.servlet.ServletHandler@177f409c: java.lang.ClassCastException: org.eclipse.jetty.server.handler.ContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler
java.lang.ClassCastException: org.eclipse.jetty.server.handler.ContextHandler cannot be cast to org.eclipse.jetty.servlet.ServletContextHandler
	at org.eclipse.jetty.servlet.ServletHandler.doStart(ServletHandler.java:147)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
	at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
	at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:97)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:722)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
	at helma.main.ApplicationManager$AppDescriptor.bind(ApplicationManager.java:550)
	at helma.main.ApplicationManager.startAll(ApplicationManager.java:168)
	at helma.main.Server.run(Server.java:602)
	at java.lang.Thread.run(Thread.java:662)
2012-03-20 10:26:19 +01:00
Simon Oberhammer
bb8aba7adc replace jar files and jar loading
helma compiles & starts now, but throws this exception:

    java.lang.IllegalStateException: STARTED
  	at org.eclipse.jetty.server.handler.HandlerWrapper.setHandler(HandlerWrapper.java:71)
  	at helma.main.ApplicationManager$AppDescriptor.bind(ApplicationManager.java:482)
	at helma.main.ApplicationManager.startAll(ApplicationManager.java:168)
	at helma.main.Server.run(Server.java:611)
	at java.lang.Thread.run(Thread.java:662)
2012-03-20 10:24:02 +01:00
Simon Oberhammer
d0c555e62a autochanges by jetty6to7 tool 2012-03-20 10:14:13 +01:00
Simon Oberhammer
d26bc06459 update rhino to 8ba9619bc53a3a61e9e026ef86b6ad698a850d38 2012-03-14 10:22:46 +01:00
a094f59a28 Fixed bug in decodeHttpAuth() causing colons in a password (and everything afterwards) to be swallowed. Note: RFC 2617 explicitely allows colons in passwords, just not in usernames. 2011-01-28 23:16:44 +01:00
671 changed files with 91118 additions and 4259 deletions

16
.editorconfig Normal file
View file

@ -0,0 +1,16 @@
# 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

15
.eslintrc Normal file
View file

@ -0,0 +1,15 @@
{
"extends": "eslint:recommended",
"env": {
"es6": true,
"commonjs": true
},
"globals": {
"app": "readonly",
"HopObject": "readonly",
"java": "readonly",
"Packages": "readonly",
"req": "readonly",
"res": "readonly"
}
}

42
.github/actions/ssh/action.yml vendored Normal file
View file

@ -0,0 +1,42 @@
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}"

22
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,22 @@
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

15
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,15 @@
name: Deploy (Production)
on: workflow_dispatch
jobs:
deploy:
runs-on: antville
environment:
name: antville.org
url: https://antville.org
steps:
- name: Copy files to production server
run: ssh staging-server deploy-helma

59
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,59 @@
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

44
.github/workflows/renovate.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Run Renovate
on:
schedule:
- cron: "13 * * * *"
workflow_dispatch:
jobs:
renovate:
runs-on: antville
steps:
- uses: actions/checkout@v4
- name: Run Renovate
# See <https://docs.renovatebot.com/troubleshooting/#log-debug-levels>
# 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 <mail+renovate@antville.org>
#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

32
.github/workflows/stage.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Deploy (Staging)
on: workflow_dispatch
jobs:
stage:
runs-on: antville
environment:
name: stage
url: ${{ vars.stage_url }}
steps:
- uses: actions/checkout@v4
- name: Build with Gradle
run: ./gradlew installDist
- name: Publish to staging server
run: |
rsync ./build/install/helma/ staging-server:./ \
--verbose --archive --delete --compress \
--filter '+ /bin' \
--filter '+ /extras' \
--filter '+ /launcher.jar' \
--filter '- /lib/ext' \
--filter '+ /lib' \
--filter '+ /modules' \
--filter '- /*'
- name: Restart Helma
run: ssh staging-server restart

25
.gitignore vendored
View file

@ -1,3 +1,22 @@
classes/*
launcher.jar
lib/helma*.jar
.gradle
.idea
.settings
build
/apps
/bin
/backups
/db
/docs
/extras
/lib
/licenses
/log
/static
/*.properties
/launcher.jar
/passwd
/start.*
!/gradle.properties

1
.java-version Normal file
View file

@ -0,0 +1 @@
11.0

6
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"recommendations": [
"vscjava.vscode-java-pack",
"vscjava.vscode-gradle"
]
}

6
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"files.watcherExclude": {
"apps/": true
},
"java.configuration.updateBuildConfiguration": "automatic"
}

31
CHANGES.md Normal file
View file

@ -0,0 +1,31 @@
# 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 Helmas 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 Rhinos 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()

37
LICENSE.md Normal file
View file

@ -0,0 +1,37 @@
# 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.

71
README.md Normal file
View file

@ -0,0 +1,71 @@
# How to Helma
## TL;DR
- Make sure you have Java 11 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 <http://localhost:8080>
## 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 <http://localhost:8080> 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)

View file

@ -1,113 +0,0 @@
This is the README file for version 1.7.0 of the Helma Javascript
Web Application Framework.
==============
STARTING HELMA
==============
With the default package installed, all you need to do to get
started is:
-> make sure that you have Java 1.4 or higher installed
-> call start.sh, resp. start.bat depending on your platform
-> direct your web browser to http://localhost:8080/
See below for more detailed information.
===========
ABOUT HELMA
===========
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.
===================
SYSTEM REQUIREMENTS
===================
You need a Java virtual machine 1.4 or higher to run Helma.
For Windows, Linux and Solaris you can get a Java runtime or development
kit from http://java.sun.com/j2se/downloads.html. If you are on Mac OS X,
you already have a Java runtime that will work well with Helma.
For other operating systems, please consult the documentation about the
availabilty of a Java 1.4 (or higher) runtime.
============================
INSTALLING AND RUNNING HELMA
============================
Simply unzip or untar the contents of the archive file into any place
on your hard disk. Start Helma by invoking start.bat or start.sh from
the command line, depending on whether you are on Windows or
Linux/Unix/MacOSX. If the java command is not found, try setting the
JAVA_HOME variable in the start script to the location of your Java
installation.
You may also want to have a look at the start script for other settings.
You can adjust server wide settings in the server.properties file. For
example, you should set the smtp property to the name of the SMTP server
that Helma should use to send Email. Applications can be started or
stopped by editing the apps.properties file through the web interface
using the Management application that is part of Helma.
If you manage to get it running you should be able to connect your
browser to http://localhost:8080/ or http://127.0.0.1:8080/
(port 8080 on the local machine, that is).
Helma comes with a version of Jetty, a lightweight yet industrial strenth
web server developed by Mortbay Consulting. See http://jetty.mortbay.com/
for more information. While Jetty works well for deploying real web sites,
you may want to run Helma behind an existing web server. This is most
easily done by running Helma with the AJPv13 listener which allows you to
plug Helma into any web server using the Apache mod_jk module. See
http://tomcat.apache.org/connectors-doc/index.html for more
information on mod_jk and AJPv13.
Finally, Helma can be plugged into Servlet containers using Servlet
classes that communicate with Helma either directly or via Java RMI.
(Be warned that these options may be harder to set up and maintain though,
since most of the recent development efforts have been geared towards the
mod_jk/AJPv13 setup.)
=====================================
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:
http://helma.org/docs/guide/
http://helma.org/docs/reference/
http://helma.org/docs/tutorial/
http://helma.org/docs/docbook/
========================
MAILING LIST AND SUPPORT
========================
Please join us on the Helma mailing lists where we will be happy to
answer any further questions you may have!
http://helma.org/development/mailinglists/

View file

@ -1,4 +0,0 @@
# List of apps to start.
test

View file

@ -1,17 +0,0 @@
To get the manage-application to work you must:
- add it to the apps.properties file with the following line:
manage
- use helma distribution 1.5 or later.
- add the following properties to server.properties:
allowAdmin = [comma-separated list of hosts or ip-addresses that
are allowed to access this application. wildcards
are only allowed in addresses, not in hostnames!]
adminAccess = <MD5-encoded credentials>
Creating the credentials can be done after you've got the application
up and running at this address: http://<your-server-name>/manage/makekey

298
build.gradle Normal file
View file

@ -0,0 +1,298 @@
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_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
}
version = new Date().format("yy.M.d")
tasks.build.dependsOn javadoc, 'jsdoc', 'generateLicenseReport'
tasks.compileJava.dependsOn 'processSource'
// Disable DocLint for now
// See <https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html>
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
sourceSets {
main {
java {
// Sources in `src` will be available here after processing
srcDirs = ["$buildDir/src/main/java"]
}
}
}
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 'commons-fileupload:commons-fileupload:1.5'
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 'javax.servlet:javax.servlet-api:4.0.1'
implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
implementation 'org.eclipse.jetty:jetty-servlet:9.4.57.v20241219'
implementation 'org.eclipse.jetty:jetty-xml:9.4.57.v20241219'
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
}
tasks.register('processSource', Sync) {
def gitOutput = new ByteArrayOutputStream()
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 "${project.buildDir}/src"
}
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')
}

484
build.xml
View file

@ -1,484 +0,0 @@
<?xml version="1.0"?>
<project name="Helma" default="usage" basedir=".">
<!-- =================================================================== -->
<!-- Initializes some variables -->
<!-- =================================================================== -->
<target name="init">
<property name="Name" value="helma"/>
<property name="year" value="1998-${year}"/>
<property name="version" value="1.7.0"/>
<property name="project" value="helma"/>
<property name="home.dir" value="."/>
<property name="build.dir" value="${home.dir}/build"/>
<property name="build.src" value="${home.dir}/src"/>
<property name="build.lib" value="${home.dir}/lib"/>
<property name="build.classes" value="${home.dir}/classes"/>
<property name="build.docs" value="${home.dir}/docs"/>
<property name="build.javadocs" value="${home.dir}/docs/api"/>
<property name="build.externals" value="${build.dir}/externals"/>
<property name="build.work" value="${home.dir}/work"/>
<property name="build.dist" value="${home.dir}/dist"/>
<property name="jar.name" value="${project}"/>
<property name="package.name" value="${project}-${version}"/>
<property name="core.name" value="${project}-core-${version}"/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="off"/>
<property name="build.jsdocs" value="${home.dir}/docs/framework"/>
<property name="jsdoc" value="${home.dir}/work/reference/templates/jsdoc.pl"/>
<path id="build.class.path">
<fileset dir="${home.dir}/lib">
<exclude name="**/helma*.jar" />
<include name="**/*.jar" />
</fileset>
</path>
<tstamp/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
</target>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="help" depends="usage" />
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="Helma build instructions"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" compile --> compiles the source code to ./classes"/>
<echo message=" jar --> generates the ./lib/helma-YYYYMMDD.jar file"/>
<echo message=" javadocs --> generates the API docs"/>
<echo message=" jsdocs --> generates the framework docs"/>
<!--<echo message=" docs -> tries to retrieve the HTML documentation "/> -->
<!--<echo message=" (may need proxy settings in startscript)"/> -->
<echo message=" package --> generates the distribution (zip and tar.gz)"/>
<echo message=" app [name] --> gets an application from svn and zips it"/>
<echo message=" module [name] --> gets a module from svn and zips it"/>
<echo message=" core --> generates core for production updates (zip and tar.gz)"/>
<echo message=" clean --> clean up temporary build directories and files"/>
<echo message=""/>
<echo message=" usage --> provides help on using the build tool (default)"/>
<echo message=""/>
<echo message=" See comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${build.classes}"/>
<!-- copy the imageio file -->
<copy file="${build.src}/META-INF/services/javax.imageio.spi.ImageWriterSpi"
todir="${build.classes}/META-INF/services"/>
<!-- copy helma db style sheet -->
<copy file="${build.src}/helma/objectmodel/dom/helma.xsl"
todir="${build.classes}/helma/objectmodel/dom" />
<!-- copy source files over to work directory -->
<delete dir="${build.work}/src" quiet="true"/>
<mkdir dir="${build.work}/src" />
<copy todir="${build.work}/src" overwrite="true">
<fileset dir="${build.src}" includes="**/*.java"/>
</copy>
<replace file="${build.work}/src/helma/main/Server.java"
token="__builddate__" value="${TODAY}"/>
<javac srcdir="${build.work}/src"
source="1.5"
target="1.5"
destdir="${build.classes}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
includeAntRuntime="no">
<classpath refid="build.class.path" />
</javac>
<delete dir="${build.work}/src"/>
</target>
<!-- =================================================================== -->
<!-- Creates a helma.jar file (snapshot) in the lib-directory -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<jar jarfile="${build.lib}/${jar.name}-${DSTAMP}.jar"
basedir="${build.classes}"
excludes="**/package.html,**/main/launcher/**"/>
<jar jarfile="${home.dir}/launcher.jar"
basedir="${build.classes}"
includes="**/main/launcher/**"
manifest="${build.src}/helma/main/launcher/manifest.txt"/>
<!-- Copy timestamped helma jar file to lib/helma.jar -->
<copy file="${build.lib}/${jar.name}-${DSTAMP}.jar"
tofile="${build.lib}/${jar.name}.jar"/>
</target>
<!-- =================================================================== -->
<!-- Creates the javadoc API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="init">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="helma.*"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="false"
private="false"
version="false"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &#169; ${year} Helma.org. All Rights Reserved."
classpathref="build.class.path"
/>
</target>
<!-- =================================================================== -->
<!-- Create the jsdoc Framework documentation -->
<!-- =================================================================== -->
<target name="jsdocs" depends="init, package-modules">
<!-- add a copy of the reference -->
<mkdir dir="${build.work}/reference"/>
<copy todir="${build.work}/reference">
<fileset dir="${build.externals}/reference"/>
</copy>
<!-- add a copy of the modules -->
<mkdir dir="${build.work}/reference/modules"/>
<copy todir="${build.work}/reference/modules">
<fileset dir="${build.externals}/modules/"/>
</copy>
<mkdir dir="${build.jsdocs}"/>
<java dir="${home.dir}" fork="true" jar="${build.lib}/rhino.jar">
<sysproperty key="jsdoc.dir" value="work/reference"/>
<arg value="work/reference/app/run.js"/>
<arg value="-t=work/reference/templates"/>
<arg value="-d=docs/framework"/>
<arg value="-r=3"/>
<arg value="work/reference/coreEnvironment"/>
<arg value="work/reference/coreExtensions"/>
<arg value="work/reference/modules"/>
</java>
<delete dir="${build.work}/reference" />
</target>
<!-- =================================================================== -->
<!-- Get the documentation (currently can fail due to request time-out -->
<!-- or missing support for proxies) -->
<!-- =================================================================== -->
<!-- <target name="docs" depends="init"> -->
<!-- <get src="http://www.helma.org/docs/reference/print" -->
<!-- dest="${build.docs}/reference.html" -->
<!-- ignoreerrors="true" -->
<!-- /> -->
<!-- </target> -->
<!-- =================================================================== -->
<!-- Builds and packages only the core for the deployment and updating -->
<!-- of production environments -->
<!-- =================================================================== -->
<target name="core" depends="init, jar">
<mkdir dir="${build.work}"/>
<!-- copy all libraries except helma-YYYYMMDD.jar -->
<copy todir="${build.work}/lib">
<fileset dir="${home.dir}/lib">
<exclude name="**/helma-*.jar" />
<include name="**/*.jar" />
</fileset>
</copy>
<!-- copy the launcher jar and start files-->
<copy file="${home.dir}/launcher.jar" todir="${build.work}/lib"/>
<!-- create lib/ext directory -->
<mkdir dir="${build.work}/lib/ext"/>
<!-- copy the license files -->
<copy todir="${build.work}/licenses">
<fileset dir="${home.dir}/licenses" excludes="**/.svn**"/>
</copy>
<copy file="${home.dir}/license.txt" todir="${build.work}/licenses"/>
<!-- zip up the whole thing -->
<antcall target="package-zip">
<param name="filename" value="${core.name}"/>
</antcall>
<antcall target="package-tgz">
<param name="filename" value="${core.name}"/>
</antcall>
<!-- clean up -->
<delete dir="${build.work}"/>
</target>
<!-- =================================================================== -->
<!-- Creates the full helma distribution -->
<!-- =================================================================== -->
<target name="package" depends="init">
<mkdir dir="${build.work}"/>
<!-- checkout the demo apps (and zip manage-app) -->
<antcall target="package-apps" />
<!-- generate the framework and modules documentation -->
<antcall target="jsdocs" />
<!-- create the main part of helma -->
<antcall target="package-raw">
<param name="distribution" value="main" />
</antcall>
<chmod perm="755">
<fileset dir="${build.work}">
<include name="start.sh"/>
</fileset>
</chmod>
<!-- zip up the whole thing -->
<antcall target="package-zip">
<param name="filename" value="${package.name}"/>
</antcall>
<antcall target="package-tgz">
<param name="filename" value="${package.name}"/>
</antcall>
<!-- make the src distributions -->
<antcall target="javadocs"/>
<antcall target="package-src-zip">
<param name="filename" value="${package.name}"/>
</antcall>
<antcall target="package-src-tgz">
<param name="filename" value="${package.name}"/>
</antcall>
<!-- clean up -->
<delete dir="${build.work}"/>
</target>
<!-- =================================================================== -->
<!-- Compile Helma and prepare the skeleton in a temporary directory. -->
<!-- Used by package . -->
<!-- =================================================================== -->
<target name="package-raw" depends="init, jar">
<!-- copy the framework (apps.props, server.props, hop/db, hop/static) -->
<copy todir="${build.work}">
<fileset dir="${build.dir}/${distribution}" excludes="**/.svn**"/>
</copy>
<!-- copy the launcher jar and start files -->
<copy file="${home.dir}/launcher.jar" todir="${build.work}/"/>
<copy file="${home.dir}/start.sh" todir="${build.work}"/>
<copy file="${home.dir}/start.bat" todir="${build.work}"/>
<!-- copy README.txt -->
<copy file="${home.dir}/README.txt" todir="${build.work}/"/>
<!-- copy the whole docs-directory -->
<copy todir="${build.work}/docs">
<fileset dir="${build.docs}"/>
</copy>
<!-- copy all libraries except helma-YYYYMMDD.jar -->
<copy todir="${build.work}/lib">
<fileset dir="${home.dir}/lib">
<exclude name="**/helma-*.jar" />
<include name="**/*.jar" />
</fileset>
</copy>
<!-- create lib/ext directory -->
<mkdir dir="${build.work}/lib/ext"/>
<!-- copy the license files -->
<copy todir="${build.work}/licenses">
<fileset dir="${home.dir}/licenses" excludes="**/.svn**"/>
</copy>
<copy file="${home.dir}/license.txt" todir="${build.work}/licenses"/>
<!-- copy the scripts directory -->
<copy todir="${build.work}/scripts">
<fileset dir="${home.dir}/scripts" excludes="**/.svn**"/>
</copy>
<!-- zip the sourcecode -->
<!-- mkdir dir="${build.work}/src"/>
<tar tarfile="${build.work}/src/helma-src.tar" basedir="${build.src}/">
<tarfileset dir="${build.src}">
<include name="${build.src}/**"/>
</tarfileset>
</tar>
<gzip zipfile="${build.work}/src/helma-src.tar.gz" src="${build.work}/src/helma-src.tar"/>
<delete file="${build.work}/src/helma-src.tar"/ -->
</target>
<!-- =================================================================== -->
<!-- Checkout demo apps, put them in work directory and zip manage app -->
<!-- =================================================================== -->
<target name="package-apps" depends="init">
<mkdir dir="${build.work}/apps" />
<!-- add a copy of the welcome app -->
<mkdir dir="${build.work}/apps/welcome"/>
<copy todir="${build.work}/apps/welcome">
<fileset dir="${build.externals}/welcome"/>
</copy>
<mkdir dir="${build.work}/apps/manage"/>
<zip zipfile="${build.work}/apps/manage/manage.zip" basedir="${build.externals}/manage/"
includes="**" excludes="**/properties,readme/**" />
<copy todir="${build.work}/apps/manage">
<fileset dir="${build.externals}/manage" includes="app.properties,class.properties,readme.txt"/>
</copy>
<!-- delete dir="${build.work}/manage" /-->
</target>
<!-- =================================================================== -->
<!-- Checkout modules including helmaTools -->
<!-- =================================================================== -->
<target name="package-modules" depends="init">
<!-- add a copy of the modules -->
<mkdir dir="${build.work}/modules"/>
<copy todir="${build.work}/modules">
<fileset dir="${build.externals}/modules"/>
</copy>
<mkdir dir="${build.work}/modules"/>
<zip zipfile="${build.work}/modules/helmaTools.zip" basedir="${build.externals}/helmaTools/"
includes="**" excludes="**/*.txt, **/*.html, **/*.bat, **/*.sh" />
<!--delete dir="${build.work}/helmaTools" /-->
</target>
<!-- =================================================================== -->
<!-- Packages the work directory with TAR-GZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-tgz" depends="init">
<mkdir dir="${build.dist}" />
<fixcrlf srcdir="${build.work}" eol="lf" eof="remove" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin" />
<tar tarfile="${build.dist}/${filename}.tar" basedir="${build.work}" excludes="**">
<tarfileset prefix="${filename}" dir="${build.work}" mode="755">
<include name="start.sh"/>
</tarfileset>
<tarfileset prefix="${filename}" dir="${build.work}">
<include name="**"/>
<exclude name="start.sh"/>
<exclude name="lib/jimi.jar"/>
<exclude name="lib/apache-dom.jar"/>
<exclude name="docs/api/**"/>
</tarfileset>
</tar>
<gzip zipfile="${build.dist}/${filename}.tar.gz" src="${build.dist}/${filename}.tar"/>
<delete file="${build.dist}/${filename}.tar"/>
</target>
<!-- =================================================================== -->
<!-- Packages the work directory with ZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-zip" depends="init">
<mkdir dir="${build.dist}" />
<fixcrlf srcdir="${build.work}" eol="crlf" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml" />
<zip zipfile="${build.dist}/${filename}.zip">
<zipfileset dir="${build.work}" prefix="${filename}">
<include name="**"/>
<exclude name="start.sh"/>
<exclude name="lib/jimi.jar"/>
<exclude name="lib/apache-dom.jar"/>
<exclude name="docs/api/**"/>
</zipfileset>
</zip>
</target>
<!-- =================================================================== -->
<!-- Packages Helma src and build directories with TAR-GZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-src-tgz" depends="init">
<mkdir dir="${build.dist}" />
<tar tarfile="${build.dist}/${filename}-src.tar">
<tarfileset prefix="${filename}" dir="${home.dir}">
<include name="src/**"/>
<include name="build/**"/>
<include name="build.xml"/>
<include name="docs/**"/>
<include name="licenses/**"/>
<include name="license.txt"/>
<include name="lib/jimi.jar"/>
<include name="lib/apache-dom.jar"/>
<exclude name="docs/modules/**"/>
</tarfileset>
</tar>
<gzip zipfile="${build.dist}/${filename}-src.tar.gz" src="${build.dist}/${filename}-src.tar"/>
<delete file="${build.dist}/${filename}-src.tar"/>
</target>
<!-- =================================================================== -->
<!-- Packages Helma src and build directories with ZIP -->
<!-- needs parameter ${filename} for final dist-file -->
<!-- =================================================================== -->
<target name="package-src-zip" depends="init">
<mkdir dir="${build.dist}" />
<zip zipfile="${build.dist}/${filename}-src.zip">
<zipfileset dir="${home.dir}" prefix="${filename}">
<include name="src/**"/>
<include name="build/**"/>
<include name="build.xml"/>
<include name="docs/**"/>
<include name="licenses/**"/>
<include name="license.txt"/>
<include name="lib/jimi.jar"/>
<include name="lib/apache-dom.jar"/>
<exclude name="docs/modules/**"/>
</zipfileset>
</zip>
</target>
<!-- =================================================================== -->
<!-- Cleans up temporary build directories -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${build.work}" />
<delete dir="${build.classes}" />
<delete dir="${build.docs}"/>
<delete dir="${build.dist}"/>
<delete file="${home.dir}/launcher.jar" quiet="true"/>
<delete>
<fileset dir="${build.lib}" includes="${jar.name}*.jar"/>
</delete>
</target>
</project>

View file

@ -1,52 +0,0 @@
This is the README file for the Helma build files as part of the Helma Object Publisher.
PREREQUISITES
=============
The Helma build script is uses Apache Ant.
For more information about Ant, see <http://ant.apache.org/>.
For checking out the source files from Helma's CVS you also need a CVS client.
More information about CVS at <http://www.cvshome.org/>.
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
ant target
The parameter "target" specifies one of the build targets listed below.
BUILD TARGETS
=============
compile
Compiles the source files contained in the work/checkout/hop/ directory into the work/classes/ directory (which will be created if necessary).
jar
Creates a helma.jar file (snapshot) in the lib-directory. The file is named helma-yyyymmdd.jar.
javadocs
Creates the javadoc API documentation.
package
Creates the full helma distribution packages and places them in the dist directory.
app [name]
Gets an application from the cvs, zips/targzs it and places the files in the dist directory.
module [name]
Gets a module from the cvs, zips it and places the file in the dist directory.
--

52
cliff.toml Normal file
View file

@ -0,0 +1,52 @@
# 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 %}
* [<tt>{{ commit.id | split(pat="") | slice(end=11) | join() }}</tt>]\
(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 = "<!-- 0 --> 🐛 Bug Fixes" },
{ field = "author.name", pattern = "[Rr]enovate|[Dd]ependabot", group = "<!-- 3 --> 📦 Dependency Updates" },
{ message = "^Merge pull request", group = "<!-- 1 --> 🔀 Merges" },
{ message = ".*", group = "<!-- 2 --> Uncategorized" },
]

3
gradle.properties Normal file
View file

@ -0,0 +1,3 @@
org.gradle.console = plain
function =

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

251
gradlew vendored Executable file
View file

@ -0,0 +1,251 @@
#!/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=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# 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, 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" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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" "$@"

94
gradlew.bat vendored Normal file
View file

@ -0,0 +1,94 @@
@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=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
: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

5
launcher/build.gradle Normal file
View file

@ -0,0 +1,5 @@
jar {
manifest {
from 'src/main/java/helma/main/launcher/manifest.txt'
}
}

View file

@ -19,6 +19,7 @@ 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;
@ -34,17 +35,6 @@ import java.util.ArrayList;
* be able to set up class and install paths.
*/
public class Main {
public static final String[] jars = {
"helma.jar", "rhino.jar", "jetty.jar",
"jetty-util.jar", "jetty-ajp.jar",
"commons-logging.jar", "crimson.jar",
"xmlrpc.jar", "servlet.jar",
"mail.jar", "activation.jar",
"commons-fileupload.jar", "commons-codec.jar",
"commons-io.jar", "commons-net.jar",
"tagsoup.jar"
};
private Class serverClass;
private Object server;
@ -121,9 +111,24 @@ public class Main {
}
}
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
* Create a server-wide ClassLoader from our install directory.
* This will be used as parent ClassLoader for all application
* ClassLoaders.
*
* @param installDir
@ -131,35 +136,20 @@ public class Main {
* @throws MalformedURLException
*/
public static ClassLoader createClassLoader(String installDir)
throws MalformedURLException {
throws MalformedURLException, UnsupportedEncodingException {
// decode installDir in case it is URL-encoded
installDir = URLDecoder.decode(installDir);
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();
for (int i = 0; i < jars.length; i++) {
File jar = new File(libdir, jars[i]);
jarlist.add(new URL("file:" + jar.getAbsolutePath()));
}
// add all jar files from the lib directory
addJars(jarlist, libdir);
// add all jar files from the lib/ext directory
File extdir = new File(libdir, "ext");
File[] files = extdir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
String n = name.toLowerCase();
return n.endsWith(".jar") || n.endsWith(".zip");
}
});
if (files != null) {
for (int i = 0; i < files.length; i++) {
jarlist.add(new URL("file:" + files[i].getAbsolutePath()));
System.err.println("Adding to classpath: " + files[i].getAbsolutePath());
}
}
addJars(jarlist, new File(libdir, "ext")); //$NON-NLS-1$
URL[] urls = new URL[jarlist.size()];
@ -206,12 +196,10 @@ public class Main {
}
}
URLClassLoader apploader = (URLClassLoader)
ClassLoader.getSystemClassLoader();
// try to get Helma installation directory
if (installDir == null) {
URL launcherUrl = apploader.findResource("helma/main/launcher/Main.class");
URL launcherUrl = ClassLoader.getSystemClassLoader()
.getResource("helma/main/launcher/Main.class"); //$NON-NLS-1$
// this is a JAR URL of the form
// jar:<url>!/{entry}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
lib/ext/.keep Normal file
View file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,118 +0,0 @@
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
1. Definitions.
1.1. Contributor means each individual or entity that creates or contributes to the creation of Modifications.
1.2. Contributor Version means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.
1.3. Covered Software means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.
1.4. Executable means the Covered Software in any form other than Source Code.
1.5. Initial Developer means the individual or entity that first makes Original Software available under this License.
1.6. Larger Work means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.
1.7. License means this document.
1.8. Licensable means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
1.9. Modifications means the Source Code and Executable form of any of the following:
A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;
B. Any new file that contains any part of the Original Software or previous Modification; or
C. Any new file that is contributed or otherwise made available under the terms of this License.
1.10. Original Software means the Source Code and Executable form of computer software code that is originally released under this License.
1.11. Patent Claims means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
1.12. Source Code means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.
1.13. You (or Your) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, You includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, control means (a)‡the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b)‡ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
2. License Grants.
2.1. The Initial Developer Grant.
Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).
(c) The licenses granted in Sections‡2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.
(d) Notwithstanding Section‡2.1(b) above, no patent license is granted: (1)‡for code that You delete from the Original Software, or (2)‡for infringements caused by: (i)‡the modification of the Original Software, or (ii)‡the combination of the Original Software with other software or devices.
2.2. Contributor Grant.
Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1)‡Modifications made by that Contributor (or portions thereof); and (2)‡the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
(c) The licenses granted in Sections‡2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.
(d) Notwithstanding Section‡2.2(b) above, no patent license is granted: (1)‡for any code that Contributor has deleted from the Contributor Version; (2)‡for infringements caused by: (i)‡third party modifications of Contributor Version, or (ii)‡the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3)‡under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.
3. Distribution Obligations.
3.1. Availability of Source Code.
Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.
3.2. Modifications.
The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.
3.3. Required Notices.
You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.
3.4. Application of Additional Terms.
You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
3.5. Distribution of Executable Versions.
You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipients rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
3.6. Larger Works.
You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.
4. Versions of the License.
4.1. New Versions.
Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.
4.2. Effect of New Versions.
You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.
4.3. Modified Versions.
When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a)‡rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b)‡otherwise make it clear that the license contains terms which differ from this License.
5. DISCLAIMER OF WARRANTY.
COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
6. TERMINATION.
6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as Participant) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections‡2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.
6.3. In the event of termination under Sections‡6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.
7. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
8. U.S. GOVERNMENT END USERS.
The Covered Software is a commercial item, as that term is defined in 48‡C.F.R.‡2.101 (Oct. 1995), consisting of commercial computer software (as that term is defined at 48 C.F.R. ‡252.227-7014(a)(1)) and commercial computer software documentation as such terms are used in 48‡C.F.R.‡12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.
9. MISCELLANEOUS.
This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdictions conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.
10. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
The GlassFish code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California.

View file

@ -1,27 +0,0 @@
Copyright (c) 2009, incava.org
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 incava.org 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.

View file

@ -1,159 +0,0 @@
<HTML>
<HEAD>
<TITLE>Jetty License</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FONT FACE=ARIAL,HELVETICA>
<CENTER><FONT SIZE=+3><B>Jetty License</B></FONT></CENTER>
<CENTER><FONT SIZE=-1><B>$Revision$</B></FONT></CENTER>
<B>Preamble:</B><p>
The intent of this document is to state the conditions under which the
Jetty Package may be copied, such that the Copyright Holder maintains some
semblance of control over the development of the package, while giving the
users of the package the right to use, distribute and make reasonable
modifications to the Package in accordance with the goals and ideals of
the Open Source concept as described at
<A HREF="http://www.opensource.org">http://www.opensource.org</A>.
<P>
It is the intent of this license to allow commercial usage of the Jetty
package, so long as the source code is distributed or suitable visible
credit given or other arrangements made with the copyright holders.
<P><B>Definitions:</B><P>
<UL>
<LI> "Jetty" refers to the collection of Java classes that are
distributed as a HTTP server with servlet capabilities and
associated utilities.<p>
<LI> "Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.<P>
<LI> "Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder.<P>
<LI> "Copyright Holder" is whoever is named in the copyright or
copyrights for the package. <BR>
Mort Bay Consulting Pty. Ltd. (Australia) is the "Copyright
Holder" for the Jetty package.<P>
<LI> "You" is you, if you're thinking about copying or distributing
this Package.<P>
<LI> "Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)<P>
<LI> "Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.<P>
</UL>
0. The Jetty Package is Copyright (c) Mort Bay Consulting Pty. Ltd.
(Australia) and others. Individual files in this package may contain
additional copyright notices. The javax.servlet packages are copyright
Sun Microsystems Inc. <P>
1. The Standard Version of the Jetty package is
available from <A HREF=http://jetty.mortbay.org>http://jetty.mortbay.org</A>.<P>
2. You may make and distribute verbatim copies of the source form
of the Standard Version of this Package without restriction, provided that
you include this license and all of the original copyright notices
and associated disclaimers.<P>
3. You may make and distribute verbatim copies of the compiled form of the
Standard Version of this Package without restriction, provided that you
include this license.<P>
4. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.<P>
5. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:<P>
<BLOCKQUOTE>
a) Place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as ftp.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.<P>
b) Use the modified Package only within your corporation or organization.<P>
c) Rename any non-standard classes so the names do not conflict
with standard classes, which must also be provided, and provide
a separate manual page for each non-standard class that clearly
documents how it differs from the Standard Version.<P>
d) Make other arrangements with the Copyright Holder.<P>
</BLOCKQUOTE>
6. You may distribute modifications or subsets of this Package in source
code or compiled form, provided that you do at least ONE of the following:<P>
<BLOCKQUOTE>
a) Distribute this license and all original copyright messages, together
with instructions (in the about dialog, manual page or equivalent) on where
to get the complete Standard Version.<P>
b) Accompany the distribution with the machine-readable source of
the Package with your modifications. The modified package must include
this license and all of the original copyright notices and associated
disclaimers, together with instructions on where to get the complete
Standard Version.<P>
c) Make other arrangements with the Copyright Holder.<P>
</BLOCKQUOTE>
7. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package.
You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you meet the other distribution requirements
of this license.<P>
8. Input to or the output produced from the programs of this Package
do not automatically fall under the copyright of this Package, but
belong to whomever generated them, and may be sold commercially, and
may be aggregated with this Package.<P>
9. Any program subroutines supplied by you and linked into this Package
shall not be considered part of this Package.<P>
10. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written
permission.<P>
11. This license may change with each release of a Standard Version of
the Package. You may choose to use the license associated with version
you are using or the license of the latest Standard Version.<P>
12. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<P>
13. If any superior law implies a warranty, the sole remedy under such shall
be , at the Copyright Holders option either a) return of any price paid or
b) use or reasonable endeavours to repair or replace the software.<P>
14. This license shall be read under the laws of Australia. <P>
<center>The End</center>
<center><FONT size=-1>This license was derived from the <I>Artistic</I> license published
on <a href=http://www.opensource.org>http://www.opensource.com</a></font></center>
</FONT>

View file

@ -1,478 +0,0 @@
For a list of modification contained in the version of Rhino distributed
with Helma and for the corresponding patches and/or bugzilla entries,
see http://dev.helma.org/wiki/Rhino+Bugs+%26+Patches/
---------------
MOZILLA PUBLIC LICENSE
Version 1.1
---------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
1.1. "Contributor" means each entity that creates or contributes to
the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. "Executable" means Covered Code in any form other than Source
Code.
1.6. "Initial Developer" means the individual or entity identified
as the Initial Developer in the Source Code notice required by Exhibit
A.
1.7. "Larger Work" means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. "Original Code" means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this
License is not already Covered Code governed by this License.
1.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
1.11. "Source Code" means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus
any associated interface definition files, scripts used to control
compilation and installation of an Executable, or source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. "You" (or "Your") means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this
License or a future version of this License issued under Section 6.1.
For legal entities, "You" includes any entity which controls, is
controlled by, or is under common control with You. For purposes of
this definition, "control" means (a) the power, direct or indirect,
to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such
entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, to use, reproduce, modify,
display, perform, sublicense and distribute the Modifications
created by such Contributor (or portions thereof) either on an
unmodified basis, with other Modifications, as Covered Code
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be
distributed only under the terms of this License or a future version
of this License released under Section 6.1, and You must include a
copy of this License with every copy of the Source Code You
distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this
License or the recipients' rights hereunder. However, You may include
an additional document offering the additional rights described in
Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which You contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that
the Modification is derived, directly or indirectly, from Original
Code provided by the Initial Developer and including the name of the
Initial Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor must include a text file with the Source Code
distribution titled "LEGAL" which describes the claim and the
party making the claim in sufficient detail that a recipient will
know whom to contact. If Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes available thereafter and shall take other steps
(such as notifying appropriate mailing lists or newsgroups)
reasonably calculated to inform those who received the Covered
Code that new knowledge has been obtained.
(b) Contributor APIs.
If Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. If it is not possible to put such notice in a particular Source
Code file due to its structure, then You must include such notice in a
location (such as a relevant directory) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Code. However, You
may do so only on Your own behalf, and not on behalf of the Initial
Developer or any Contributor. You must make it absolutely clear than
any such warranty, support, indemnity or liability obligation is
offered by You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty,
support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of
the Covered Code is available under the terms of this License,
including a description of how and where You have fulfilled the
obligations of Section 3.2. The notice must be conspicuously included
in any notice in an Executable version, related documentation or
collateral in which You describe recipients' rights relating to the
Covered Code. You may distribute the Executable version of Covered
Code or ownership rights under a license of Your choice, which may
contain terms different from this License, provided that You are in
compliance with the terms of this License and that the license for the
Executable version does not attempt to limit or alter the recipient's
rights in the Source Code version from the rights set forth in this
License. If You distribute the Executable version under a different
license You must make it absolutely clear that any terms which differ
from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such
terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description
must be included in the LEGAL file described in Section 3.4 and must
be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation ("Netscape") may publish revised
and/or new versions of the License from time to time. Each version
will be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If You create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), You must (a) rename Your license so that
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this License)
and (b) otherwise make it clear that Your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial
Developer, Original Code or Contributor in the notice described in
Exhibit A shall not of themselves be deemed to be modifications of
this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
8.1. This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
software" and "commercial computer software documentation," as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if
any, provides otherwise), excluding its conflict-of-law provisions.
With respect to disputes in which at least one party is a citizen of,
or an entity chartered or registered to do business in the United
States of America, any litigation relating to this License shall be
subject to the jurisdiction of the Federal Courts of the Northern
District of California, with venue lying in Santa Clara County,
California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys' fees and
expenses. The application of the United Nations Convention on
Contracts for the International Sale of Goods is expressly excluded.
Any law or regulation which provides that the language of a contract
shall be construed against the drafter shall not apply to this
License.
12. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the NPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
EXHIBIT A -Mozilla Public License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (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.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is ______________________________________.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. All Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the terms
of the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]

View file

@ -1,170 +0,0 @@
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

View file

@ -1,100 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>W3C IPR SOFTWARE NOTICE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h1>
W3C IPR SOFTWARE NOTICE
</h1>
<h3>
Copyright &copy; 2000 <loc href="http://www.w3.org/">World Wide Web
Consortium</loc>, (<loc href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</loc>, <loc href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</loc>, <loc
href="http://www.keio.ac.jp/">Keio University</loc>). All Rights
Reserved.
</h3>
<p>
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.
</p>
<p>
<b>Note:</b> The original version of the W3C Software Copyright Notice
and License could be found at <a
href='http://www.w3.org/Consortium/Legal/copyright-software-19980720'>http://www.w3.org/Consortium/Legal/copyright-software-19980720</a>
</p>
<h3>
Copyright &copy; 1994-2000 <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved. http://www.w3.org/Consortium/Legal/
</h3>
<p>
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:
</p>
<p>
Permission to use, copy, and modify this software and its documentation,
with or without modification,&nbsp; 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:
</p>
<ol>
<li>
The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.
</li>
<li>
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 &copy;
[$date-of-software] <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved. http://www.w3.org/Consortium/Legal/"
</li>
<li>
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.)
</li>
</ol>
<p>
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.
</p>
<p>
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
DOCUMENTATION.
</p>
<p>
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.
</p>
</body>
</html>

15
modules/README.md Normal file
View file

@ -0,0 +1,15 @@
# 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');

View file

@ -17,63 +17,43 @@
/**
* @fileoverview Adds useful methods to the JavaScript Array type.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/Array.js')
*
* @addon
*/
/**
* 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 = function(val) {
return this.indexOf(val) > -1;
};
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() {
var result = [];
var map = {};
for (var i=0; i<arguments.length; i+=1) {
for (var n in arguments[i]) {
var item = arguments[i][n];
if (!map[item]) {
result.push(item);
map[item] = true;
}
}
}
return result;
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() {
var all = Array.union.apply(this, arguments);
var result = [];
for (var n in all) {
var chksum = 0;
var item = all[n];
for (var i=0; i<arguments.length; i+=1) {
if (arguments[i].contains(item))
chksum += 1;
else
break;
}
if (chksum == arguments.length)
result.push(item);
}
return result;
return Array.from(arguments).reduce((result, array) => {
return result.filter(element => array.includes(element));
});
};
// prevent any newly added properties from being enumerated

View file

@ -17,7 +17,7 @@
/**
* @fileoverview Adds useful methods to the JavaScript Date type.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/Date.js')
*/
@ -33,9 +33,11 @@ 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
*
* 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)
@ -53,19 +55,23 @@ Date.prototype.format = function (format, locale, timezone) {
};
/**
/**
* 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());
};
@ -74,6 +80,8 @@ Date.prototype.toLocalTime = function() {
/**
* returns the difference between this and another
* date object in milliseconds
* @external
* @memberof {Date}
*/
Date.prototype.diff = function(dateObj) {
return this.getTime() - dateObj.getTime();
@ -82,6 +90,8 @@ Date.prototype.diff = function(dateObj) {
/**
* 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)
@ -134,6 +144,8 @@ Date.prototype.getTimespan = function(param) {
* 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);
@ -147,6 +159,8 @@ Date.prototype.getAge = function(param) {
* 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);
@ -158,13 +172,15 @@ Date.prototype.getExpiry = function(param) {
/**
* 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)
var extend = Date.ONEDAY;
extend = Date.ONEDAY;
switch (extend) {
case Date.ONESECOND:
if (this.getSeconds() != date.getSeconds())

View file

@ -17,7 +17,7 @@
/**
* @fileoverview Implements some useful macro filters.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/Filters.js')
*/
@ -65,7 +65,7 @@ function titleize_filter(input) {
/**
* Cuts a String at a certain position, and
* Cuts a String at a certain position, and
* optionally appends a suffix, if truncation
* has occurred.
*
@ -118,7 +118,7 @@ function escapeXml_filter(input) {
* @see http://www.google.com/codesearch?q=escapeHtml
*/
function escapeHtml_filter(input) {
var replace = Packages.org.mortbay.util.StringUtil.replace;
var replace = Packages.org.eclipse.jetty.util.StringUtil.replace;
var str = (input || "").toString();
return replace(replace(replace(replace(str, '&', '&amp;'), '"', '&quot;'), '>', '&gt;'), '<', '&lt;');
}
@ -127,7 +127,7 @@ var h_filter = escapeHtml_filter;
/**
* Escapes the characters in a String to be suitable
* Escapes the characters in a String to be suitable
* to use as an HTTP parameter value.
*
* @see http://www.google.com/codesearch?q=escapeUrl
@ -145,7 +145,7 @@ function escapeUrl_filter(input, param, charset) {
* definitions.
*/
function escapeJavaScript_filter(input) {
var replace = Packages.org.mortbay.util.StringUtil.replace;
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');
}
@ -155,7 +155,7 @@ function escapeJavaScript_filter(input) {
* Replaces linebreaks with HTML linebreaks.
*/
function linebreakToHtml_filter(input) {
var replace = Packages.org.mortbay.util.StringUtil.replace;
var replace = Packages.org.eclipse.jetty.util.StringUtil.replace;
var str = (input || "").toString();
return replace(str, '\n', '<br />');
}
@ -168,11 +168,10 @@ function linebreakToHtml_filter(input) {
* @param new
*/
function replace_filter(input, param, oldString, newString) {
var str = (input || "").toString();
var oldString = param["old"] != null ? param["old"] : oldString;
var newString = param["new"] != null ? param["new"] : newString;
var replace = Packages.org.mortbay.util.StringUtil.replace;
return replace(str, oldString, newString);
var str = String(input || '');
var oldString = param.old || oldString;
var newString = param['new'] || newString;
return str.replace(new RegExp(oldString, 'g'), newString);
}

View file

@ -17,7 +17,7 @@
/**
* @fileoverview Adds useful global macros.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/Global.js')
*/
@ -77,3 +77,180 @@ var skin_macro = function(param, name) {
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 <br/> 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('&lt;');
break;
case '>':
buffer.push('&gt;');
break;
case '&':
buffer.push('&amp;');
break;
case '"':
buffer.push('&quot;');
break;
case '\n':
if (encodeNewLine) {
buffer.push("<br/>");
}
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('&lt;');
break;
case '>':
buffer.push('&gt;');
break;
case '&':
buffer.push('&amp;');
break;
case '"':
buffer.push('&quot;');
break;
case '\'':
buffer.push('&#39;');
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;
};

View file

@ -17,7 +17,7 @@
/**
* @fileoverview Adds useful methods to Helma's built-in HopObject prototype.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/HopObject.js')
*/
@ -27,6 +27,8 @@ 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
@ -45,6 +47,8 @@ HopObject.prototype.forEach = function(callback) {
/**
* macro returns the id of a HopObject
* @external
* @memberof {HopObject}
*/
HopObject.prototype.id_macro = function() {
res.write(this._id);
@ -54,6 +58,8 @@ HopObject.prototype.id_macro = function() {
/**
* macro returns the url for any hopobject
* @external
* @memberof {HopObject}
*/
HopObject.prototype.href_macro = function(param, action) {
res.write(this.href(action || param.action || String.NULLSTR));
@ -64,6 +70,8 @@ HopObject.prototype.href_macro = function(param, action) {
/**
* macro rendering a skin or displaying
* its source (param.as == "source")
* @external
* @memberof {HopObject}
*/
HopObject.prototype.skin_macro = function(param, name) {
var skinName = name || param.name;
@ -85,6 +93,8 @@ HopObject.prototype.skin_macro = function(param, name) {
/**
* this macro renders a text depending on
* the value of a given property
* @external
* @memberof {HopObject}
*/
HopObject.prototype.switch_macro = function(param) {
if (param.name) {
@ -97,6 +107,8 @@ HopObject.prototype.switch_macro = function(param) {
/**
* generic macro that loops over the childobjects
* and renders a specified skin for each of them
* @external
* @memberof {HopObject}
* @param Object providing the following properties:
* skin: the skin to render for each item (required)
* collection: the collection containing the items
@ -160,7 +172,7 @@ HopObject.prototype.loop_macro = function(param, collection) {
/**
* Render the number of child nodes of the HopObject.
* Render the number of child nodes of the HopObject.
* Three cases are distinguished which can be customized
* by setting param.verbose to "true" and defining the
* corresponding field of the <code>param</code>
@ -170,6 +182,8 @@ HopObject.prototype.loop_macro = function(param, collection) {
* <li>param.one - exactly one child node</li>
* <li>param.many - more than one child node</li>
* </ol>
* @external
* @memberof {HopObject}
* @param {Object} param The default macro parameter
* @param {String} name The default name for a child node
*/

View file

@ -1,179 +1,2 @@
/*
* 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: JSON.js,v $
* $Author$
* $Revision$
* $Date$
*/
/**
* @fileoverview Adds JSON methods to the Object, Array and String prototypes.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/core/JSON.js')
*/
/*
json.js
2006-04-28 [http://www.json.org/json.js]
This file adds these methods to JavaScript:
object.toJSON()
This method produces a JSON text from an object. The
object must not contain any cyclical references.
array.toJSON()
This method produces a JSON text from an array. The
array must not contain any cyclical references.
string.parseJSON()
This method parses a JSON text to produce an object or
array. It will return false if there is an error.
*/
(function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
/**
* @ignore
*/
array: function (x) {
var a = ['['], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a[a.length] = v;
b = true;
}
}
}
a[a.length] = ']';
return a.join('');
},
'boolean': function (x) {
return String(x);
},
'null': function (x) {
return "null";
},
/**
* @ignore
*/
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
/**
* @ignore
*/
object: function (x) {
if (x) {
if (x instanceof Array) {
return s.array(x);
}
var a = ['{'], b, f, i, v;
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
return a.join('');
}
return 'null';
},
/**
* @ignore
*/
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
}
};
/**
* This method produces a JSON text from an object.
* The object must not contain any cyclical references.
*/
Object.prototype.toJSON = function () {
return s.object(this);
};
/**
* This method produces a JSON text from an array.
* The array must not contain any cyclical references.
*/
Array.prototype.toJSON = function () {
return s.array(this);
};
Object.prototype.dontEnum("toJSON");
Array.prototype.dontEnum("toJSON");
return;
})();
/**
* This method parses a JSON text to produce an object or
* array. It will return false if there is an error.
*/
String.prototype.parseJSON = function () {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + this + ')');
} catch (e) {
return false;
}
};
String.prototype.dontEnum("parseJSON");
// This file intentionally left blank to prevent legacy code from
// breaking when trying to include the obsolete JSON module.

View file

@ -17,12 +17,14 @@
/**
* @fileoverview Adds useful methods to the JavaScript Number type.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* 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
@ -39,9 +41,11 @@ Number.prototype.format = function(fmt, locale) {
};
/**
/**
* 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
@ -57,6 +61,8 @@ Number.prototype.toPercent = function(total, 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

View file

@ -17,12 +17,16 @@
/**
* @fileoverview Adds useful methods to the JavaScript Object type.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* 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
@ -30,59 +34,61 @@
*/
Object.prototype.clone = function(clone, recursive) {
var getValue = function(value, recursive) {
if ((value == null || typeof(value) !== "object") || recursive !== true) {
return value;
}
return value.clone(null, 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") {
switch (this.constructor) {
case Array:
return this.map(function(value) {
return getValue(value, 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 null: // e.g. macro parameter objects
if (clone == null) {
clone = {};
}
// continue below
case Object:
case HopObject:
if (clone == null) {
clone = new this.constructor();
}
for (var propName in this) {
clone[propName] = getValue(this[propName], recursive);
}
return clone;
case Array:
return this.map(function(value) {
return getValue(value, recursive);
});
default:
return new this.constructor(this.valueOf());
}
} else if (typeof(this) === "function" && this.constructor === RegExp) {
return new RegExp(this.valueOf());
}
return this;
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) {
if (this[i] instanceof HopObject == false)
result[i] = this[i];
} else if (recursive) {
else if (recursive)
result[i] = this.reduce(true);
}
}
return result;
};
@ -90,6 +96,8 @@ Object.prototype.reduce = function(recursive) {
/**
* 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)
*/

View file

@ -20,10 +20,6 @@ String.APATTERN = /[^a-zA-Z]/;
String.NUMPATTERN = /[^0-9]/;
String.FILEPATTERN = /[^a-zA-Z0-9-_\. ]/;
String.HEXPATTERN = /[^a-fA-F0-9]/;
// 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;
String.LEFT = -1
String.BALANCE = 0
String.RIGHT = 1
@ -32,15 +28,26 @@ 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.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* 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() {
@ -56,6 +63,8 @@ String.prototype.isDateFormat = function() {
/**
* 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
@ -81,6 +90,8 @@ String.prototype.toDate = function(format, timezone) {
* 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
*/
@ -92,6 +103,8 @@ String.prototype.isUrl = function() {
/**
* 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() {
@ -102,6 +115,8 @@ String.prototype.isFileName = function() {
/**
* 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() {
@ -112,7 +127,9 @@ String.prototype.toFileName = function() {
/**
* function checks a string for a valid color value in hexadecimal format.
* it may also contain # as first character
* @returns Boolean false, if string length (without #) > 6 or < 6 or
* @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() {
@ -129,6 +146,8 @@ String.prototype.isHexColor = function() {
* 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() {
@ -151,6 +170,8 @@ String.prototype.toHexColor = function() {
/**
* 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() {
@ -163,6 +184,8 @@ String.prototype.isAlphanumeric = function() {
/**
* function cleans a string by throwing away all
* non-alphanumeric characters
* @external
* @memberof {String}
* @return cleaned string
*/
String.prototype.toAlphanumeric = function() {
@ -173,6 +196,8 @@ String.prototype.toAlphanumeric = function() {
/**
* 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() {
@ -185,6 +210,8 @@ String.prototype.isAlpha = function() {
/**
* 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() {
@ -196,6 +223,8 @@ String.prototype.isNumeric = function() {
/**
* 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
*/
@ -211,6 +240,8 @@ String.prototype.capitalize = function(limit) {
/**
* 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() {
@ -227,6 +258,8 @@ String.prototype.titleize = function() {
/**
* translates all characters of a string into HTML entities
* @external
* @memberof {String}
* @return String translated result
*/
String.prototype.entitize = function() {
@ -243,10 +276,12 @@ String.prototype.entitize = function() {
/**
* breaks up a string into two parts called
* head and tail at the given position
* don't apply this to HTML, i.e. use stripTags() in advance
* don't apply this to HTML, i.e. use stripTags() in advance
* @external
* @memberof {String}
* @param Number number of charactrers or of segments separated by the delimiter
* @param String pre-/suffix to be pre-/appended to shortened string
* @param String delimiter
* @param String delimiter
* @return Object containing head and tail properties
*/
String.prototype.embody = function(limit, clipping, delimiter) {
@ -276,6 +311,8 @@ String.prototype.embody = function(limit, clipping, delimiter) {
/**
* get the head of a string
* @external
* @memberof {String}
* @see String.prototype.embody()
*/
String.prototype.head = function(limit, clipping, delimiter) {
@ -285,6 +322,8 @@ String.prototype.head = function(limit, clipping, delimiter) {
/**
* get the tail of a string
* @external
* @memberof {String}
* @see String.prototype.embody()
*/
String.prototype.tail = function(limit, clipping, delimiter) {
@ -292,9 +331,12 @@ String.prototype.tail = function(limit, clipping, delimiter) {
};
/*
* set clip method out of compatibility/convenience reason
/**
* FIXME: we eventually have to get rid of this one...
* set clip method out of compatibility/convenience reason
* @external
* @memberof {String}
* @deprecated
* @see String.prototype.head()
*/
String.prototype.clip = String.prototype.head;
@ -302,6 +344,8 @@ String.prototype.clip = String.prototype.head;
/**
* function inserts a string every number of characters
* @external
* @memberof {String}
* @param Int number of characters after which insertion should take place
* @param String string to be inserted
* @param Boolean definitely insert at each interval position
@ -316,7 +360,7 @@ String.prototype.group = function(interval, str, ignoreWhiteSpace) {
for (var i=0; i<this.length; i=i+interval) {
var strPart = this.substring(i, i+interval);
res.write(strPart);
if (ignoreWhiteSpace == true ||
if (ignoreWhiteSpace == true ||
(strPart.length == interval && !/\s/g.test(strPart))) {
res.write(str);
}
@ -327,6 +371,8 @@ String.prototype.group = function(interval, str, ignoreWhiteSpace) {
/**
* replace all linebreaks and optionally all w/br tags
* @external
* @memberof {String}
* @param Boolean flag indicating if html tags should be replaced
* @param String replacement for the linebreaks / html tags
* @return String the unwrapped string
@ -337,62 +383,25 @@ String.prototype.unwrap = function(removeTags, replacement) {
var str = this.replace(/[\n|\r]/g, replacement);
if (removeTags)
str = str.replace(/<[w]?br *\/?>/g, replacement);
return str;
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.helma.util.MD5Encoder.encode(this);
};
/**
* function repeats a string the specified amount of times
* @param Int amount of repetitions
* @return String resulting string
*/
String.prototype.repeat = function(multiplier) {
res.push();
for (var i=0; i<multiplier; i++)
res.write(this);
return res.pop();
};
/**
* function returns true if the string starts with
* the string passed as argument
* @param String string pattern to search for
* @return Boolean true in case it matches the beginning
* of the string, false otherwise
*/
String.prototype.startsWith = function(str, offset) {
var javaObj = new java.lang.String(this);
if (offset != null)
return javaObj.startsWith(str, offset);
return javaObj.startsWith(str);
};
/**
* function returns true if the string ends with
* the string passed as argument
* @param String string pattern to search for
* @return Boolean true in case it matches the end of
* the string, false otherwise
*/
String.prototype.endsWith = function(str) {
var javaObj = new java.lang.String(this);
return javaObj.endsWith(str);
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:
@ -401,51 +410,46 @@ String.prototype.endsWith = function(str) {
* String.BALANCE and String.RIGHT here as well.)
* @return String the resulting string
*/
String.prototype.pad = function(str, len, mode) {
if (str == null || len == null)
return this;
var diff = len - this.length;
if (diff == 0)
return this;
var left, right = 0;
if (mode == null || mode == String.RIGHT)
right = diff;
else if (mode == String.LEFT)
left = diff;
else if (mode == String.BALANCE) {
right = Math.round(diff / 2);
left = diff - right;
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);
}
res.push();
for (var i=0; i<left; i++)
res.write(str);
res.write(this);
for (var i=0; i<right; i++)
res.write(str);
return res.pop();
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) {
if (this.indexOf(str, fromIndex ? fromIndex : 0) > -1)
return true;
return false;
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.
* @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
@ -500,17 +504,10 @@ String.prototype.diff = function(mod, separator) {
};
/**
* remove leading and trailing whitespace
*/
String.prototype.trim = function () {
var s = new java.lang.String(this);
return String(s.trim());
};
/**
* returns true if the string looks like an e-mail
* @external
* @memberof {String}
*/
String.prototype.isEmail = function() {
return String.EMAILPATTERN.test(this);
@ -519,6 +516,8 @@ String.prototype.isEmail = function() {
/**
* returns the amount of occurences of one string in another
* @external
* @memberof {String}
*/
String.prototype.count = function(str) {
var count = 0;
@ -533,23 +532,27 @@ String.prototype.count = function(str) {
/**
* returns the string encoded using the base64 algorithm
* @external
* @memberof {String}
*/
String.prototype.enbase64 = function() {
var bytes = new java.lang.String(this) . getBytes();
return new Packages.sun.misc.BASE64Encoder().encode(bytes);
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 = new Packages.sun.misc.BASE64Decoder().decodeBuffer(this);
return String(new java.lang.String(bytes));
var bytes = Packages.org.apache.commons.codec.binary.Base64.decodeBase64(this);
return String(java.lang.String(bytes, 'utf-8'));
};
// wrapper methods for string-related
// wrapper methods for string-related
// global helma functions
String.prototype.encode = function() {
@ -574,6 +577,8 @@ String.prototype.stripTags = function() {
/**
* 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
@ -603,6 +608,8 @@ 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
*/
@ -616,6 +623,8 @@ String.compose = function() {
/**
* creates a random string (numbers and chars)
* @external
* @memberof {String}
* @param len length of key
* @param mode determines which letters to use. null or 0 = all letters;
* 1 = skip 0, 1, l and o which can easily be mixed with numbers;
@ -650,6 +659,8 @@ String.random = function(len, mode) {
/**
* append one string onto another and add some "glue"
* if none of the strings is empty or null.
* @external
* @memberof {String}
* @param String the first string
* @param String the string to be appended onto the first one
* @param String the "glue" to be inserted between both strings

View file

@ -14,7 +14,7 @@
* $Date$
*/
// convenience SingleFileRepository to load all the
// convenience SingleFileRepository to load all the
// Javascript library files in ./modules/core
app.addRepository('modules/core/Array.js');
@ -24,5 +24,4 @@ app.addRepository('modules/core/Object.js');
app.addRepository('modules/core/String.js');
app.addRepository('modules/core/HopObject.js');
app.addRepository('modules/core/Global.js');
app.addRepository('modules/core/JSON.js');
app.addRepository('modules/core/Filters.js');

View file

@ -18,12 +18,12 @@
/**
* @fileoverview Fields and methods of the helma.Chart prototype
* <br /><br />
* To use this optional module, its repository needs to be added to the
* 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.jar');
app.addRepository('modules/helma/jxl-2.5.7.jar');
/**
* Define the global namespace if not existing
@ -55,12 +55,12 @@ helma.Chart = function(fpath, prefix, sheetName) {
var workbook, file;
try {
file = new java.io.File(fpath);
file = new java.io.File(fpath);
workbook = JXLPKG.getWorkbook(file);
} catch (e) {
if (e instanceof TypeError == false)
throw(e);
throw("helma.Chart needs " + JXLPKGNAME +
throw("helma.Chart needs " + JXLPKGNAME +
" in lib/ext or application directory " +
"[" + JXLPKGURL + "]");
}
@ -98,9 +98,9 @@ helma.Chart = function(fpath, prefix, sheetName) {
* Renders the Excel spreadsheet as XHTML table.
*/
this.render = function() {
res.write('<table border="0" cellspacing="1" class="' +
res.write('<table border="0" cellspacing="1" class="' +
prefix + 'table">\n');
var rowBuf = [];
var rows = sheet.getRows();
var max = 0;
@ -110,7 +110,7 @@ helma.Chart = function(fpath, prefix, sheetName) {
max = row.length;
rowBuf.push(row);
}
for (var i in rowBuf) {
res.write('<tr class="' + prefix + 'row">\n');
for (var n=0; n<max; n+=1) {
@ -145,7 +145,7 @@ helma.Chart = function(fpath, prefix, sheetName) {
}
res.write('</tr>\n');
}
res.write('</table>\n');
workbook.close();
};

View file

@ -19,7 +19,7 @@
* @fileoverview Fields and methods of the helma.Html
* and helma.Html.Tablewriter classes.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/helma/Html.js')
*/
@ -58,7 +58,7 @@ helma.Html.renderMarkupPart = function(name, start, end, attr) {
res.write(name);
if (attr) {
for (var i in attr) {
if (i == "prefix" || i == "suffix" ||
if (i == "prefix" || i == "suffix" ||
i == "default" || attr[i] == null) {
continue;
}
@ -267,9 +267,7 @@ helma.Html.prototype.input = function(param) {
return;
}
var attr = Object.prototype.reduce.call(param);
attr.type = "text";
if (!attr.size)
attr.size = 20;
attr.type = param.type || "text";
attr.value = (attr.value != null) ? encodeForm(attr.value) : "";
this.tag("input", attr);
return;
@ -404,7 +402,7 @@ helma.Html.prototype.submit = function(param) {
attr.name = attr.type;
attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type;
this.tag("input", attr);
return;
return;
};
/**
@ -435,7 +433,7 @@ helma.Html.prototype.button = function(param) {
attr.name = attr.type;
attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type;
this.tag("input", attr);
return;
return;
};
/**
@ -454,8 +452,8 @@ helma.Html.prototype.buttonAsString = function(attr) {
/**
* 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 <code>{value: v, display: d}</code> objects, or a collection
* @param {Array} options Either an array of strings, an array with
* several <code>{value: v, display: d}</code> objects, or a collection
* of <code>["value", "display"]</code> arrays in an array
* @param {String} selectedValue The value to pre-select
* @param {String} firstOption An optional first option to display in the
@ -467,8 +465,6 @@ helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOpt
return;
}
var attr = Object.prototype.reduce.call(param);
if (!attr.size)
attr.size = 1;
this.openTag("select", attr);
res.write("\n ");
if (firstOption) {
@ -477,7 +473,13 @@ helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOpt
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) {
@ -503,6 +505,7 @@ helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOpt
this.closeTag("option");
res.write("\n ");
}
hasOpenGroup && html.closeTag("optgroup");
this.closeTag("select");
res.write("\n ");
return;
@ -511,8 +514,8 @@ helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOpt
/**
* 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 <code>{value: v, display: d}</code> objects, or a collection
* @param {Array} options Either an array of strings, an array with
* several <code>{value: v, display: d}</code> objects, or a collection
* of <code>["value", "display"]</code> arrays in an array
* @param {String} selectedValue The value to pre-select
* @param {String} firstOption An optional first option to display in the
@ -649,7 +652,7 @@ helma.Html.prototype.tableAsString = function(headers, data, attr) {
/**
* Renders an x/html opening link tag
* @param {Object} attr An object containing the tag attributes
* @param {Object} attr An object containing the tag attributes
*/
helma.Html.prototype.openLink = function(attr) {
this.openTag("a", attr);
@ -658,7 +661,7 @@ helma.Html.prototype.openLink = function(attr) {
/**
* Returns an x/html opening link tag
* @param {Object} attr An object containing the tag attributes
* @param {Object} attr An object containing the tag attributes
* @returns The rendered open link tag
* @type String
* @see #openTag
@ -751,8 +754,6 @@ helma.Html.prototype.password = function(attr) {
return;
}
attr.type = "password";
if (!attr.size)
attr.size = 20;
this.tag("input", attr);
return;
};

View file

@ -18,7 +18,7 @@
/**
* @fileoverview Fields and methods of the helma.Http class.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/helma/Http.js')
*/
@ -57,13 +57,22 @@ helma.Http = function() {
"socket": 0
};
var maxResponseSize = null;
var maxTries = 5;
var currentTries = 0;
var responseHandler = function(connection, result) {
var input;
var stream;
try {
input = new java.io.BufferedInputStream(connection.getInputStream());
stream = connection.getInputStream();
} catch (error) {
input = new java.io.BufferedInputStream(connection.getErrorStream());
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();
@ -80,10 +89,9 @@ helma.Http = function() {
try {
input.close();
} catch (error) {
// safe to ignore
// safe to ignore
}
if (binaryMode && (result.code >= 200 && result.code < 300)) {
// only honor binaryMode if the request succeeded
if (binaryMode) {
result.content = body.toByteArray();
} else {
result.content = result.charset ?
@ -157,8 +165,8 @@ helma.Http = function() {
* @param {String} password The password
*/
this.setCredentials = function(username, password) {
var str = new java.lang.String(username + ":" + password);
credentials = (new Packages.sun.misc.BASE64Encoder()).encode(str.getBytes());
var str = username + ":" + password;
credentials = str.enbase64();
return;
}
@ -168,7 +176,7 @@ helma.Http = function() {
* 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.
* If the name of an array property ends with "_array" then the _array part is removed.
*/
this.setContent = function(stringOrObject) {
if (stringOrObject != null) {
@ -178,21 +186,21 @@ helma.Http = function() {
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);
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 {
@ -203,7 +211,7 @@ helma.Http = function() {
}
return;
};
/**
* Sets the request method to use.
* @param {String} m The method to use (<code>GET</code>, <code>POST</code> ...)
@ -280,7 +288,7 @@ helma.Http = function() {
* 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.
* "name" (the name of the cookie) and "value" (the value of the cookie) set.
*/
this.setCookies = function(cookies) {
if (cookies != null) {
@ -482,7 +490,7 @@ helma.Http = function() {
} 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
@ -550,6 +558,14 @@ helma.Http = function() {
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");
@ -648,7 +664,7 @@ helma.Http.setProxy = function(proxyString) {
sys.put("http.prodyPort", "");
}
return;
};
@ -680,7 +696,7 @@ helma.Http.getProxy = function() {
* @type Boolean
*/
helma.Http.isAuthorized = function(name, pwd) {
if (!req.username || !req.password ||
if (!req.username || !req.password ||
req.username != name || req.password != pwd) {
res.reset();
res.status = 401;

View file

@ -26,13 +26,13 @@
/**
* @fileoverview Fields and methods of the helma.Search class
* <br /><br />
* To use this optional module, its repository needs to be added to the
* 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.jar');
app.addRepository('modules/helma/lucene-analyzers.jar');
app.addRepository('modules/helma/lucene-core-2.2.0.jar');
app.addRepository('modules/helma/lucene-analyzers-2.2.0.jar');
if (!global.helma) {
@ -47,7 +47,7 @@ if (!global.helma) {
* creating a fulltext search index based on Apache Lucene.
* @returns A newly created instance of this prototype.
* @constructor
* @author Robert Gaggl <robert@nomatic.org>
* @author Robert Gaggl <robert@nomatic.org>
*/
helma.Search = function() {
try {
@ -309,7 +309,7 @@ helma.Search.Index = function(directory, analyzer) {
this.getAnalyzer = function() {
return analyzer;
};
/**
* Returns a searcher for querying this index.
* @returns A searcher useable for querying the index.
@ -318,7 +318,7 @@ helma.Search.Index = function(directory, analyzer) {
this.getSearcher = function() {
return new helma.Search.Searcher(this);
};
/** @ignore */
this.toString = function() {
return ("[Lucene Index " + directory + "]");
@ -773,7 +773,7 @@ helma.Search.HitCollection = function(hits) {
this.length = function() {
return this.size();
};
/**
* Executes a provided function once per hit.
* @param {Function} fun Function to execute for each element
@ -793,7 +793,7 @@ helma.Search.HitCollection = function(hits) {
}
return;
};
return this;
};
@ -1308,7 +1308,7 @@ helma.Search.Document.Field = function(name, value, 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) {

View file

@ -18,20 +18,20 @@
/**
* @fileoverview Fields and methods of the helma.Ssh class.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* 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.jar');
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
@ -43,7 +43,7 @@ if (!global.helma) {
* file. This argument is optional.
* @constructor
* @returns A newly created instance of helma.Ssh
* @author Robert Gaggl <robert@nomatic.org>
* @author Robert Gaggl <robert@nomatic.org>
*/
helma.Ssh = function(server, hosts) {
var SSHPKG = Packages.ch.ethz.ssh2;
@ -61,11 +61,11 @@ helma.Ssh = function(server, hosts) {
} catch (e) {
if (e instanceof TypeError == false)
throw(e);
throw("helma.Ssh needs " + SSHPKGNAME +
throw("helma.Ssh needs " + SSHPKGNAME +
" in lib/ext or application directory " +
"[" + SSHPKGURL + "]");
}
/**
* A simple verifier for verifying host keys
* @private
@ -96,7 +96,7 @@ helma.Ssh = function(server, hosts) {
return;
}
};
/**
* Converts the argument into an instance of java.io.File
* @param {helma.File|java.io.File|String} file Either a file
@ -131,7 +131,7 @@ helma.Ssh = function(server, hosts) {
}
return false;
};
/**
* Private helper method for debugging output using app.logger
* @param {String} methodName The name of the method
@ -175,7 +175,7 @@ helma.Ssh = function(server, hosts) {
}
return false;
};
/**
* Connects to a remote host using plain username/password authentication.
* @param {String} username The username
@ -217,7 +217,7 @@ helma.Ssh = function(server, hosts) {
}
return false;
};
/**
* Disconnects this client from the remote server.
*/
@ -325,7 +325,7 @@ helma.Ssh = function(server, hosts) {
}
}
};
/**
* Toggles paranoid mode. If set to true this client tries to
* verify the host key against the its list of known hosts
@ -346,7 +346,7 @@ helma.Ssh = function(server, hosts) {
this.isParanoid = function() {
return paranoid;
};
/**
* main constructor body
*/

View file

@ -17,7 +17,7 @@
/**
* @fileoverview Fields and methods of the helma.Zip class.
* <br /><br />
* To use this optional module, its repository needs to be added to the
* To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/helma/Zip.js')
*/
@ -39,7 +39,7 @@ if (!global.helma) {
* path to the .zip file as string.
* @constructor
* @returns A newly created instance of helma.Zip.
* @author Robert Gaggl <robert@nomatic.org>
* @author Robert Gaggl <robert@nomatic.org>
*/
helma.Zip = function(file) {
@ -85,7 +85,7 @@ helma.Zip = function(file) {
var outStream = new java.io.BufferedOutputStream(new java.io.FileOutputStream(dest));
outStream.write(buf, 0, size);
} finally {
outStream.close();
if (outStream) outStream.close();
}
}
return null;
@ -150,7 +150,7 @@ helma.Zip = function(file) {
}
return result;
};
/**
* Returns an array containing the entries of the archive
* represented by this helma.Zip instance.
@ -225,7 +225,7 @@ helma.Zip = function(file) {
* 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
* <em>recursively</em> to the archive.
* @param {Number} level An optional compression level to use. The argument
* @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.
*/
@ -304,9 +304,26 @@ helma.Zip = function(file) {
* @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
@ -317,12 +334,13 @@ helma.Zip = function(file) {
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 {
var outStream = new java.io.FileOutputStream(destFile);
bOutStream.writeTo(outStream);
} finally {
outStream.close();
if (destFile.exists()) destFile['delete']();
java.nio.file.Files.move(tempFile.toPath(), destFile.toPath());
} catch (ex) {
app.log(ex);
}
return;
};
@ -339,8 +357,10 @@ helma.Zip = function(file) {
/**
* constructor body
*/
var bOutStream = new java.io.ByteArrayOutputStream();
var zOutStream = new java.util.zip.ZipOutputStream(bOutStream);
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);
}
@ -446,7 +466,7 @@ helma.Zip.Entry = function(entry) {
/**
* The data of the zip entry
* @type ByteArray
* @type ByteArray
*/
this.data = null;

View file

@ -14,9 +14,11 @@
* $Date$
*/
// convenience SingleFileRepository to load all the
// 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');

View file

@ -0,0 +1,18 @@
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 '.'
}

BIN
modules/helma/jxl-2.5.7.jar Normal file

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,86 @@
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.

View file

@ -0,0 +1,125 @@
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.

View file

@ -1,3 +1,4 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@ -199,4 +200,3 @@
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.

View file

@ -0,0 +1,202 @@
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.

35
modules/jala/README.md Normal file
View file

@ -0,0 +1,35 @@
# 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.

21
modules/jala/build.gradle Normal file
View file

@ -0,0 +1,21 @@
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'
}

View file

@ -0,0 +1,7 @@
## 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

View file

@ -0,0 +1 @@
Jala is a <a href="http://helma.org">Helma</a>-based library and utility project initially developed to ease the work at <a href="http://orf.at">ORF.at</a>'s software development department.

View file

@ -0,0 +1,175 @@
//
// 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 <em>deprecated</em>, 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;
}

View file

@ -0,0 +1,429 @@
//
// 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<length; i+=1) {
update();
string += current;
}
//res.debug("string = " + string);
if (string == "creation date")
void(null);
stack.pop();
return string;
}
return getResult();
};

View file

@ -0,0 +1,119 @@
//
// 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.Captcha class.
*/
// Define the global namespace for Jala modules
if (!global.jala) {
global.jala = {};
}
/**
* Construct a new captcha.
* @returns A new captcha.
* @class Wrapper class for the
* {@link http://jcaptcha.sourceforge.net/ 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.
* @constructor
*/
jala.Captcha = function() {
/**
* Jala dependencies
*/
app.addRepository(getProperty("jala.dir", "modules/jala") +
"/lib/jcaptcha-all-1.0-RC3.jar");
var gimpy;
try {
var ref = Packages.com.octo.captcha.engine.image.gimpy;
gimpy = ref.DefaultGimpyEngine();
} catch(e) {
throw("Cannot instantiate object due to missing java class: " +
arguments.callee.toString());
}
var captcha = gimpy.getNextCaptcha();
/**
* Get a new captcha object.
* @returns A new captcha object.
* @type com.octo.captcha.Captcha
*/
this.getCaptcha = function getCaptcha() {
return captcha;
};
/**
* Render a new captcha image.
*/
this.renderImage = function renderImage() {
var image = captcha.getImageChallenge();
var stream = new java.io.ByteArrayOutputStream();
var ref = Packages.com.sun.image.codec.jpeg.JPEGCodec;
var encoder = ref.createJPEGEncoder(stream);
encoder.encode(image);
res.contentType = "image/jpeg";
res.writeBinary(stream.toByteArray());
return;
};
/**
* Validate a user's input with the prompted captcha.
* @param {String} input The user's input.
* @returns True if the user's input matches the captcha.
* @type Boolean
*/
this.validate = function validate(input) {
return !input || captcha.validateResponse(input);
};
return this;
};
/**
* Get a string representation of the captcha class.
* @returns A string representation of the capthca class.
* @type String
* @ignore
*/
jala.Captcha.toString = function toString() {
return "[jala.Captcha http://jcaptcha.sourceforge.net]";
};
/**
* Get a string representation of the captcha object.
* @returns A string representation of the captcha object.
* @type String
*/
jala.Captcha.prototype.toString = function toString() {
return "[jala.Captcha Object]";
};

File diff suppressed because it is too large Load diff

545
modules/jala/code/Date.js Normal file
View file

@ -0,0 +1,545 @@
//
// 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 &lt;select&gt;
* 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:
* <ul>
* <li>pattern - The date format pattern that should be rendered. Valid
* patterns are: "dd", "MM", "yyyy", "HH", "ss".</li>
* <li>firstOption - The string to use as first option, eg.: "choose a day"</li>
* </ul>
*/
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<param.max;i++) {
opt = (param.offset + i).format("00");
options[i] = [opt, opt];
}
var html = new helma.Html();
html.dropDown({name: key}, options, param.selected, param.firstOption);
}
if (!fmt)
var fmt = [{pattern: "dd", firstOption: "day"},
{pattern: "MM", firstOption: "month"},
{pattern: "yyyy", firstOption: "year"},
{pattern: "HH", firstOption: "hour"},
{pattern: "mm", firstOption: "minute"}];
for (var i in fmt) {
render(fmt[i], date);
}
return;
};
/**
* Returns a timestamp as set of dropdown-boxes
* @see #renderEditor
* @type String
*/
jala.Date.prototype.renderEditorAsString = function(prefix, date, pattern) {
res.push();
this.renderEditor(prefix, date, pattern);
return res.pop();
};
/**
* Creates a new instance of jala.Data.Calendar
* @class 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.
* @param {HopObject} collection A grouped HopObject collection to work on
* @returns A newly created jala.Date.Calendar instance
* @constructor
*/
jala.Date.Calendar = function(collection) {
var renderer = null;
var locale = java.util.Locale.getDefault();
var timezone = java.util.TimeZone.getDefault();
var hrefFormat = "yyyyMMdd";
var accessNameFormat = "yyyyMMdd";
/**
* Returns the collection this calendar object works on
* @returns The HopObject collection of this calendar
* @type HopObject
*/
this.getCollection = function() {
return collection;
};
/**
* Sets the renderer to use.
* @param {Object} r The renderer to use
* @see #getRenderer
*/
this.setRenderer = function(r) {
renderer = r;
return;
};
/**
* Returns the renderer used by this calendar.
* @returns The calendar renderer
* @type Object
* @see #setRenderer
*/
this.getRenderer = function() {
if (!renderer) {
renderer = new jala.Date.Calendar.Renderer(this);
}
return renderer;
};
/**
* Sets the locale to use within this calendar object
* @param {java.util.Locale} loc The locale to use
* @see #getLocale
*/
this.setLocale = function(loc) {
locale = loc;
return;
};
/**
* 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
* @type java.util.Locale
* @see #setLocale
*/
this.getLocale = function() {
return locale;
};
/**
* Sets the locale to use within this calendar object
* @param {java.util.Locale} loc The locale to use
* @see #getTimeZone
*/
this.setTimeZone = function(tz) {
timezone = tz;
return;
};
/**
* 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
* @type java.util.Locale
* @see #setTimeZone
*/
this.getTimeZone = function() {
return timezone;
};
/**
* Sets the format of the hrefs to render by this calendar
* to the format pattern passed as argument.
* @param {String} fmt The date format pattern to use for
* rendering the href
* @see #getHrefFormat
*/
this.setHrefFormat = function(fmt) {
hrefFormat = fmt;
return;
};
/**
* Returns the date formatting pattern used to render hrefs. The default
* format is "yyyyMMdd".
* @returns The date formatting pattern
* @type String
* @see #setHrefFormat
*/
this.getHrefFormat = function() {
return hrefFormat;
};
/**
* Sets the format of the group name to use when trying to access
* child objects of the collection this calendar is operating on.
* @param {String} fmt The date format pattern to use for
* accessing child objects
* @see #getAccessNameFormat
*/
this.setAccessNameFormat = function(fmt) {
accessNameFormat = fmt;
return;
};
/**
* 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
* @type String
* @see #setAccessNameFormat
*/
this.getAccessNameFormat = function() {
return accessNameFormat;
};
return this;
};
/** @ignore */
jala.Date.Calendar.prototype.toString = function() {
return "[Jala Calendar]";
};
/**
* Renders the calendar using either a custom renderer defined
* using {@link #setRenderer} or the default one.
* @see #setRenderer
* @see jala.Date.Calendar.Renderer
*/
jala.Date.Calendar.prototype.render = function(today) {
var renderer = this.getRenderer();
var collection = this.getCollection();
var hrefFormat = this.getHrefFormat();
var accessNameFormat = this.getAccessNameFormat();
var locale = this.getLocale();
var timezone = this.getTimeZone();
var size = collection.size();
if (size == null)
return;
/**
* private method that creates a date object set
* to the last date of the previous month or the
* first date of the next month (if available)
*/
var prevNextMonth = function(which, dayIndex) {
var obj;
if (which == "prev") {
if (size <= dayIndex || !(obj = collection.get(dayIndex +1)))
return;
} else if (which == "next") {
if (dayIndex == 0 || !(obj = collection.get(dayIndex - 1)))
return;
} else {
return;
}
return new Date(obj.groupname.substring(0, 4),
obj.groupname.substring(4, 6) -1,
obj.groupname.substring(6));
};
// create the calendar object used for date calculations
var cal = java.util.Calendar.getInstance(timezone, locale);
var firstDayOfWeek = cal.getFirstDayOfWeek();
var symbols = new java.text.DateFormatSymbols(locale);
res.push();
// render the header-row
res.push();
var weekdays = symbols.getShortWeekdays();
for (var i=0;i<7;i++) {
renderer.renderDayHeader(weekdays[(i+firstDayOfWeek-1)%7+1]);
}
renderer.renderRow(res.pop());
cal.set(java.util.Calendar.DATE, 1);
// check whether there's a day in path
// if so, use it to determine the month to render
if (today) {
cal.set(java.util.Calendar.YEAR, today.getFullYear());
cal.set(java.util.Calendar.MONTH, today.getMonth());
}
// nr. of empty days in rendered calendar before the first day of month appears
var pre = (7-firstDayOfWeek+cal.get(java.util.Calendar.DAY_OF_WEEK)) % 7;
var days = cal.getActualMaximum(java.util.Calendar.DATE);
var weeks = Math.ceil((pre + days) / 7);
var daycnt = 1;
var date = new Date(cal.get(java.util.Calendar.YEAR), cal.get(java.util.Calendar.MONTH), 1);
// remember the index of the first and last days within this month.
// this is needed to optimize previous and next month links.
var lastDayIndex = Number.MAX_VALUE;
var firstDayIndex = -1;
var dayObj, idx, selected;
for (var i=0;i<weeks;i++) {
res.push();
for (var j=0;j<7;j++) {
if ((i == 0 && j < pre) || daycnt > 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 <em>last</em> 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();

View file

@ -0,0 +1,312 @@
//
// 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
* <a href="https://javadns.dev.java.net/">https://javadns.dev.java.net/</a>.
* 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<answers.length;i++) {
arr[i] = new jala.DnsClient.Record(answers[i]);
}
return arr;
};
/**
* Convenience method to query for the MX-records
* of the domain passed as argument.
* @param {String} dName The domain name to query for
* @returns The records retrieved from the nameserver
* @type org.wonderly.net.dns.RR
*/
jala.DnsClient.prototype.queryMailHost = function (dName) {
return this.query(dName, this.TYPE_MX);
};
/** @ignore */
jala.DnsClient.toString = function() {
return "[jala.DnsClient]";
};
/** @ignore */
jala.DnsClient.prototype.toString = function() {
return "[jala.DnsClient (" + this.nameServer + ")]";
};
/**
* Constructs a new instance of jala.DnsClient.Record.
* @class Instances of this class wrap record data as received
* from the nameserver.
* @param {org.wonderly.net.dns.RR} data The data as received from
* the nameserver
* @returns A newly constructed Record instance
* @constructor
*/
jala.DnsClient.Record = function(data) {
/**
* The type of the nameserver record represented by this Answer instance.
* @type Number
* @see #TYPE_A
* @see #TYPE_CNAME
* @see #TYPE_HINFO
* @see #TYPE_MX
* @see #TYPE_NS
* @see #TYPE_PTR
* @see #TYPE_SOA
* @see #TYPE_TXT
* @see #TYPE_WKS
*/
this.type = data.getType();
/**
* The name of the host. This will only be set for records
* of type A, AAAA and NS.
* @type String
* @see #TYPE_A
* @see #TYPE_AAAA
* @see #TYPE_NS
*/
this.host = null;
/**
* The IP address of the host. This will only be set for records
* of type A and AAAA
* @type String
* @see #TYPE_A
* @see #TYPE_AAAA
*/
this.ipAddress = null;
/**
* The CNAME of this record. This will only be set for records
* of type CNAME
* @type String
* @see #TYPE_CNAME
*/
this.cname = null;
/**
* The name of the mail exchanging server. This is only set for
* records of type MX
* @type String
* @see #TYPE_MX
*/
this.mx = null;
/**
* The email address responsible for a name server. This property
* will only be set for records of type SOA
* @type String
* @see #TYPE_SOA
*/
this.email = null;
/**
* Descriptive text as received from the nameserver. This is only
* set for records of type TXT
* @type String
* @see #TYPE_TXT
*/
this.text = null;
/**
* Returns the wrapped nameserver record data
* @returns The wrapped data
* @type org.wonderly.net.dns.RR
*/
this.getData = function() {
return data;
};
/**
* Main constructor body
*/
switch (data.getClass()) {
case jala.DnsClient.PKG.ARR:
case jala.DnsClient.PKG.AAAARR:
this.host = data.getHost();
this.ipAddress = data.getIPAddress();
break;
case jala.DnsClient.PKG.NSRR:
this.host = data.getHost();
break;
case jala.DnsClient.PKG.CNAMERR:
this.cname = data.getCName();
break;
case jala.DnsClient.PKG.MXRR:
this.mx = data.getExchanger();
break;
case jala.DnsClient.PKG.SOARR:
this.host = data.getNSHost();
this.email = data.getResponsibleEmail();
break;
case jala.DnsClient.PKG.TXTRR:
this.text = data.getText();
break;
default:
break;
}
return this;
};
/** @ignore */
jala.DnsClient.Record.prototype.toString = function() {
return "[jala.DnsClient.Record]";
};

2523
modules/jala/code/Form.js Normal file

File diff suppressed because it is too large Load diff

130
modules/jala/code/Global.js Normal file
View file

@ -0,0 +1,130 @@
//
// 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;
};

View file

@ -0,0 +1,253 @@
//
// 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 <em>history.length - 2</em>.
* @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 <em>alters the contents of the history stack</em>.
* @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<arr.length -1;i++) {
if (!(obj = obj.get(unescape(arr[i]))) || obj.__node__.getState() == 3)
return false;
}
return true;
};
var obj;
var cut = offset != null ? offset : 1;
var stack = getStack();
if (stack.items.length > 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
* <em>does not alter the stack contents</em>!
* @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;
}

View file

@ -0,0 +1,177 @@
//
// 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:
* <ul>
* <li>File</li>
* <li>helma.File</li>
* <li>java.io.File</li>
* <li>String</li>
* <li>java.lang.String</li>
* <li>Packages.helma.util.MimePart</li>
* </ul>
* @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 <em>transient</em>, 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 <em>virtual</em>, 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 <em>invalid</em>, 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 <em>clean</em>, 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 <em>new</em>, 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 <em>modified</em>, 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 <em>deleted</em>, false otherwise.
* @type Boolean
*/
HopObject.prototype.isDeleted = function() {
return this.__node__.getState() === Packages.helma.objectmodel.INodeState.DELETED;
};

View file

@ -0,0 +1,156 @@
//
// 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<list.size(); i+=1) {
var element = list.get(i);
var text = element.getText();
var href = element.attribute("href");
if (text && href) {
result.push({
text: text,
url: href.getText()
});
}
}
return result;
};
/**
* Retrieves all elements by name from the document.
* The returned object structure is compatible for usage
* in {@link jala.XmlWriter}.
* @param {String} elementName The name of the desired element
* @returns The list of available elements in the document
* @type Array
*/
this.getAll = function(elementName) {
var result = [], object;
var list = this.scrape("//html:" + elementName);
var i, n, element, text, attributes, attr, size;
for (i=0; i<list.size(); i+=1) {
element = list.get(i);
object = {
name: element.getName(),
value: element.getText() || null
};
attributes = element.attributes();
if ((size = attributes.size()) > 0) {
object.attributes = new Array;
for (n=0; n<size; n+=1) {
attr = attributes.get(n);
object.attributes.push({
name: attr.getName(),
value: attr.getData() || null
});
}
}
result.push(object);
}
return result;
};
/**
* Get a string representation of the HTML document.
* @returns A string representation of the HTML document.
* @type String
*/
this.toString = function() {
return "[jala.HtmlDocument " + source.length + " Bytes]";
};
return this;
};

403
modules/jala/code/I18n.js Normal file
View file

@ -0,0 +1,403 @@
//
// 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 Methods and macros for internationalization
* of Helma applications.
*/
// Define the global namespace for Jala modules
if (!global.jala) {
global.jala = {};
}
/**
* Constructs a new instance of jala.I18n
* @class This class provides various functions and macros for
* internationalization of Helma applications.
* @constructor
* @type jala.I18n
*/
jala.I18n = function() {
/**
* The default object containing the messages.
* @ignore
*/
var messages = global.messages;
/**
* The default method for retrieving the locale.
* @ignore
*/
var localeGetter = function() {
return java.util.Locale.getDefault();
};
/**
* Overwrite the default object containing
* the messages (ie. a vanilla EcmaScript object).
* @param {Object} msgObject The object containing the messages
*/
this.setMessages = function(msgObject) {
messages = msgObject;
};
/**
* Get the message object.
* @returns The object containing the messages
* @type Object
*/
this.getMessages = function() {
return messages;
};
/**
* Set the method for retrieving the locale.
* @param {Function} func The getter method
*/
this.setLocaleGetter = function(func) {
if (func && func.constructor == Function) {
localeGetter = func;
} else {
throw Error("Getter method to retrieve locale must be a function");
}
return;
};
/**
* Get the method for retrieving the locale.
* @returns The getter method
* @type Function
*/
this.getLocaleGetter = function() {
return localeGetter;
};
return this;
};
/**
* The default handler containing the messages.
* @ignore
*/
jala.I18n.HANDLER = global;
/** @ignore */
jala.I18n.prototype.toString = function() {
return "[Jala i18n]";
};
/**
* Set (overwrite) the default handler containing
* the messages (ie. a vanilla EcmaScript object).
* @param {Object} handler The handler containing the message object
* @deprecated Use {@link #setMessages} instead
*/
jala.I18n.prototype.setHandler = function(handler) {
this.setMessages(handler.messages);
return;
};
/**
* Returns the locale for the given id, which is expected to follow
* the form <code>language[_COUNTRY][_variant]</code>, where <code>language</code>
* is a valid ISO Language Code (eg. "de"), <code>COUNTRY</code> 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;i<values.length;i++) {
if ((arg = values[i]) != null) {
// MessageFormat can't deal with javascript date objects
// so we need to convert them into java.util.Date instances
if (arg instanceof Date) {
args[i] = new java.util.Date(arg.getTime());
} else {
args[i] = arg;
}
}
}
}
// use the getter method for retrieving the locale
var locale = this.getLocaleGetter()();
// format the message
try {
var msgFormat = new java.text.MessageFormat(message, locale);
return msgFormat.format(args);
} catch (e) {
app.logger.warn("jala.i18n.formatMessage(): Unable to format message '"
+ message + "', reason: " + e, e.javaException);
}
}
return null;
};
/**
* 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 <code>number</code> 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 <code>number</code> 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:
* <ul>
* <li>text: The message to translate (required)</li>
* <li>plural: The plural form of the message</li>
* <li>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.</li>
* </ul>
* @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<arr.length;i++) {
if ((propName = arr[i]) != null) {
var value = null;
if ((dotIdx = propName.indexOf(".")) > 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);
};

View file

@ -0,0 +1,362 @@
//
// 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
<ul>
<li>an instance of helma.image.ImageWrapper</li>
<li>the path to the image file as String</li>
<li>an instance of helma.File representing the image file</li>
<li>an instance of java.io.File representing the image file</li>
</ul>
* @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<size; y++) {
for (var x=0; x<size; x++) {
if ((y <= center) && (x <= center)) {
if (x >= 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<kernel.length; i++) {
kernel[i] = kernel[i] / sum;
}
return kernel;
};
/**
* Factory method for an unsharp mask kernel
* @param {Number} size The size of the kernel
* @param {Number} deviation The deviation to use
* @returns The unsharp mask kernel
* @type float[]
* @private
*/
jala.ImageFilter.getUnsharpMaskKernel = function(size, deviation) {
var elements = jala.ImageFilter.getGaussianBlurKernel(size, deviation);
var center = ((size * size) - 1) / 2;
elements[center] = 0;
var sum = 0;
for (var i=0; i<elements.length; i++) {
sum += elements[i];
elements[i] = -elements[i];
}
elements[center] = sum + 1;
return elements;
};
/**
* Factory method for a sharpening kernel
* @param {Number} amount The amount of sharpening to use
* @return The sharpening kernel
* @type float[]
* @private
*/
jala.ImageFilter.getSharpeningKernel = function(amount) {
var kernel = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 9);
var corner = 0;
var side = amount / -50;
var center = (side * -4.0) + (corner * -4.0) + 1.0;
kernel[0] = kernel[2] = kernel[6] = kernel[8] = corner;
kernel[1] = kernel[3] = kernel[5] = kernel[7] = side;
kernel[4] = center;
return kernel;
};

View file

@ -0,0 +1,765 @@
//
// 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.IndexManager class.
*/
// Define the global namespace for Jala modules
if (!global.jala) {
global.jala = {};
}
/**
* HelmaLib dependencies
*/
app.addRepository("modules/helma/Search.js");
app.addRepository("modules/helma/File.js");
/**
* Constructs a new IndexManager object.
* @class 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.
* @param {String} name The name of the index, which is the name of the directory
* the index already resides or will be created in.
* @param {helma.File} dir The base directory where this index's directory
* is already existing or will be created in. If not specified a RAM directory
* is used.
* @param {String} lang The language of the documents in this index. This leads
* to the proper Lucene analyzer being used for indexing documents.
* @constructor
* @see helma.Search.createIndex
*/
jala.IndexManager = function IndexManager(name, dir, lang) {
/**
* Private variable containing the worker thread
* @private
*/
var thread = null;
/**
* Private flag indicating that the worker thread should stop
* @type Boolean
* @private
*/
var interrupted = false;
/**
* Private variable containing the index managed by
* this IndexManager instance.
* @private
*/
var index = null;
/**
* Private variable containing a status indicator.
* @type Number
* @private
*/
var status = jala.IndexManager.NORMAL;
/**
* Synchronized linked list that functions as a queue for
* asynchronous processing of index manipulation jobs.
* @type java.util.LinkedList
* @private
* @see jala.IndexManager.Job
*/
var queue = java.util.Collections.synchronizedList(new java.util.LinkedList());
/**
* The name of the unique identifier field in the index. Defaults to "id".
* @type String
* @private
*/
var idFieldname = "id";
/**
* The index directory
* @type Packages.org.apache.lucene.store.Directory
* @private
*/
var indexDirectory = null;
/**
* The searcher utilized by {@link #search}
* @type jala.IndexManager.Searcher
* @private
*/
var searcher = null;
/**
* Returns the directory of the underlying index
* @returns The directory of the underlying index
* @type Packages.org.apache.lucene.store.Directory
*/
this.getDirectory = function() {
return indexDirectory;
};
/**
* Returns the underlying index.
* @returns The index this queue is working on.
* @type helma.Search.Index
*/
this.getIndex = function() {
return index;
};
/**
* Returns the status of this manager.
* @returns The status of this index manager.
* @type Number
* @see #NORMAL
* @see #REBUILDING
*/
this.getStatus = function() {
return status;
};
/**
* Modifies the status of this manager, which has implications
* on how index modifying jobs are handled. If the status
* is {@link #REBUILDING}, all jobs are queued until the status
* is set back to {@link #NORMAL}.
* @param {Number} s The new status of this manager.
* @see #NORMAL
* @see #REBUILDING
*/
this.setStatus = function(s) {
status = s;
return;
};
/**
* Returns the queue this index manager is using.
* @returns The queue.
* @type java.util.LinkedList
*/
this.getQueue = function() {
return queue;
};
/**
* Returns the name of the index manger, which
* is equal to the name of the underlying index
* @returns The name of the index manager
* @type String
*/
this.getName = function() {
return name;
};
/**
* Returns the name of the field containing the unique identifier
* of document objects in the index wrapped by this IndexManager.
* Defaults to "id".
* @returns The name of the id field in the index
* @type String
* @see #setIdFieldname
*/
this.getIdFieldname = function() {
return idFieldname;
};
/**
* Sets the name of the field containing the unique identifier
* of document objects in the index wrapped by this IndexManager.
* @see #getIdFieldname
*/
this.setIdFieldname = function(name) {
idFieldname = name;
return;
};
/**
* Returns true if the underlying index is currently optimized.
* @returns True in case the index is optimized, false otherwise.
* @type Boolean
*/
this.hasOptimizingJob = function() {
for (var i=0; i<queue.size(); i++) {
if (queue.get(i).type == jala.IndexManager.Job.OPTIMIZE) {
return true;
}
}
return false;
};
/**
* Returns true if the underlying index is currently rebuilding.
* @returns True in case the index is rebuilding, false otherwise.
* @type Boolean
*/
this.isRebuilding = function() {
return status == jala.IndexManager.REBUILDING;
};
/**
* Starts the IndexManager worker thread that processes the job queue
*/
this.start = function() {
if (!this.isRunning()) {
interrupted = false;
thread = app.invokeAsync(this, function() {
while (interrupted === false) {
if (this.getStatus() != jala.IndexManager.REBUILDING && !queue.isEmpty()) {
var job = queue.remove(0);
if (this.processJob(job) === false) {
// processing job failed, check if we should re-add
if (job.errors < jala.IndexManager.MAXTRIES) {
// increment error counter and put back into queue
job.errors += 1;
queue.add(job);
} else {
this.log("error", "error during queue flush: tried " +
jala.IndexManager.MAXTRIES + " times to handle " +
job.type + " job " + ", giving up.");
}
}
this.log("debug", "remaining jobs " + queue.size());
// if no more jobs are waiting, optimize the index and re-open
// the index searcher to make changes visible
if (queue.isEmpty()) {
var start = java.lang.System.currentTimeMillis();
try {
this.getIndex().optimize();
this.log("optimized index in " + jala.IndexManager.getRuntime(start) + " ms");
this.initSearcher();
} catch (e) {
this.log("error", "Unable to optimize index or re-open searcher, reason: " + e.toString());
}
}
} else {
// wait for 100ms before checking again
java.lang.Thread.sleep(100);
}
}
return true;
}, [], -1);
this.log("started successfully");
} else {
this.log("already running");
}
return;
};
/**
* Stops this IndexManager instance. This function waits for 10 seconds
* maximum for the worker thread to stop.
* @returns True if the worker thread stopped successfully, false otherwise
* @type Boolean
*/
this.stop = function() {
interrupted = true;
var result;
if ((result = this.isRunning()) === true) {
if ((result = thread.waitForResult(10000)) === true) {
thread = null;
this.log("stopped successfully");
} else {
result = false;
this.log("error", "unable to stop");
}
} else {
this.log("info", "already stopped");
}
return result;
};
/**
* Returns true if this IndexManager instance is running
* @returns True if this IndexManager instance is running, false otherwise.
* @type Boolean
*/
this.isRunning = function() {
if (thread != null) {
return thread.running;
}
return false;
};
/**
* Read only reference containing the running status of this IndexManager
* @type Boolean
*/
this.running; // for api documentation only, is overwritten by getter below
this.__defineGetter__("running", function() {
return this.isRunning()
});
/**
* Read only reference containing the number of pending jobs
* @type Number
*/
this.pending; // for api documentation only, is overwritten by getter below
this.__defineGetter__("pending", function() {
return queue.size()
});
/**
* Initializes the searcher
* @private
*/
this.initSearcher = function() {
searcher = new Packages.org.apache.lucene.search.IndexSearcher(indexDirectory);
return;
};
/**
* Returns the searcher of this index manager
* @returns The searcher of this index manager
* @type org.apache.lucene.search.IndexSearcher
* @private
*/
this.getSearcher = function() {
if (searcher === null) {
this.initSearcher();
}
return searcher;
};
/**
* Main constructor body. Initializes the underlying index.
*/
var search = new helma.Search();
var analyzer = helma.Search.getAnalyzer(lang);
if (dir != null) {
indexDirectory = search.getDirectory(new helma.File(dir, name));
this.log("created/mounted " + indexDirectory);
} else {
indexDirectory = search.getRAMDirectory();
this.log("created new RAM directory");
}
index = search.createIndex(indexDirectory, analyzer);
return this;
};
/**
* Constant defining the maximum number of tries to add/remove
* an object to/from the underlying index.
* @type Number
* @final
*/
jala.IndexManager.MAXTRIES = 10;
/**
* Constant defining normal mode of this index manager.
* @type Number
* @final
*/
jala.IndexManager.NORMAL = 1;
/**
* Constant defining rebuilding mode of this index manager.
* @type Number
* @final
*/
jala.IndexManager.REBUILDING = 2;
/**
* Returns the milliseconds elapsed between the current timestamp
* and the one passed as argument.
* @returns The elapsed time in millis.
* @type Number
* @private
*/
jala.IndexManager.getRuntime = function(millis) {
return java.lang.System.currentTimeMillis() - millis;
};
/** @ignore */
jala.IndexManager.prototype.toString = function() {
return "[" + this.constructor.name + " '" + this.getName() + "' (" +
this.pending + " objects queued)]";
};
/**
* Helper function that prefixes every log message with
* the name of the IndexManager.
* @param {String} level An optional logging level. Accepted values
* @param {String} msg The log message
* are "debug", "info", "warn" and "error".
*/
jala.IndexManager.prototype.log = function(/* msg, level */) {
var level = "info", message;
if (arguments.length == 2) {
level = arguments[0];
message = arguments[1];
} else {
message = arguments[0];
}
app.logger[level]("[" + this.constructor.name + " '" +
this.getName() + "'] " + message);
return;
};
/**
* Static helper method that returns the value of the "id"
* field of a document object.
* @param {helma.Search.Document} doc The document whose id
* should be returned.
* @private
*/
jala.IndexManager.prototype.getDocumentId = function(doc) {
try {
return doc.getField(this.getIdFieldname()).value;
} catch (e) {
// ignore
}
return null;
};
/**
* 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.
* @param {helma.Search.Document} 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.
* @type Boolean
* @see helma.Search.Document
*/
jala.IndexManager.prototype.add = function(doc) {
var id;
if (!doc) {
this.log("error", "missing document object to add");
return false;
} else if ((id = this.getDocumentId(doc)) == null) {
this.log("error", "document doesn't contain an Id field '" +
this.getIdFieldname() + "'");
return false;
}
// the job's callback function which actually adds the document to the index
var callback = function() {
var start = java.lang.System.currentTimeMillis();
this.getIndex().updateDocument(doc, this.getIdFieldname());
this.log("debug", "added document with Id " + id +
" to index in " + jala.IndexManager.getRuntime(start) + " ms");
return;
}
var job = new jala.IndexManager.Job(jala.IndexManager.Job.ADD, callback);
this.getQueue().add(job);
this.log("debug", "queued adding document " + id + " to index");
return true;
};
/**
* Queues the removal of all index documents whose identifier value ("id" by default)
* matches the number passed as argument.
* @param {Number} id The identifier value
* @returns True if the removal job was added successfully to the queue, false
* otherwise.
* @type Boolean
*/
jala.IndexManager.prototype.remove = function(id) {
if (id === null || isNaN(id)) {
this.log("error", "missing or invalid document id to remove");
return false;
}
// the job's callback function which actually removes all documents
// with the given id from the index
var callback = function() {
var start = java.lang.System.currentTimeMillis();
this.getIndex().removeDocument(this.getIdFieldname(), parseInt(id, 10));
this.log("debug", "removed document with Id " + id +
" from index in " + jala.IndexManager.getRuntime(start) + " ms");
};
var job = new jala.IndexManager.Job(jala.IndexManager.Job.REMOVE, callback);
this.getQueue().add(job);
this.log("debug", "queued removal of document with Id " + id);
return true;
};
/**
* Queues the optimization of the underlying index. Normally there is no need
* to call this method explicitly, as the index will be optimized after all
* queued jobs have been processed.
* @returns True if the optimizing job was added, false otherwise, which means
* that there is already an optimizing job waiting in the queue.
* @type Boolean
*/
jala.IndexManager.prototype.optimize = function() {
if (this.hasOptimizingJob()) {
return false;
}
var callback = function() {
var start = java.lang.System.currentTimeMillis();
this.getIndex().optimize();
this.log("optimized index in " + jala.IndexManager.getRuntime(start) + " ms");
// re-open index searcher, so that changes are seen
this.initSearcher();
return;
};
var job = new jala.IndexManager.Job(jala.IndexManager.Job.OPTIMIZE, callback);
this.getQueue().add(job);
this.log("debug", "queued index optimization");
return true;
};
/**
* Processes a single queued job
* @param {Object} job
* @private
*/
jala.IndexManager.prototype.processJob = function(job) {
this.log("debug", job.type + " job has been in queue for " +
jala.IndexManager.getRuntime(job.createtime.getTime()) +
" ms, processing now...");
try {
job.callback.call(this);
} catch (e) {
this.log("error", "Exception while processing job " + job.type + ": " + e);
return false;
}
return true;
};
/**
* Searches the underlying index using the searcher of this index manager
* @param {helma.Search.Query|org.apache.lucene.search.Query} query The query
* to execute. Can be either an instance of helma.Search.Query, or an instance
* of org.apache.lucene.search.Query
* @param {helma.Search.QueryFilter|org.apache.lucene.search.Filter} filter
* An optional query filter
* @param {Array} sortFields An optional array containing
* org.apache.lucene.search.SortField instances to use for sorting the result
* @returns A HitCollection containing the search results
* @type helma.Search.HitCollection
*/
jala.IndexManager.prototype.search = function(query, filter, sortFields) {
var pkg = Packages.org.apache.lucene;
if (query == null || (!(query instanceof helma.Search.Query) &&
!(query instanceof pkg.search.Query))) {
throw "jala.IndexManager search(): missing or invalid query";
} else if (query instanceof helma.Search.Query) {
// unwrap query
query = query.getQuery();
}
if (filter != null && filter instanceof helma.Search.QueryFilter) {
// unwrap filter
filter = filter.getFilter();
}
var searcher = this.getSearcher();
var analyzer = this.getIndex().getAnalyzer();
var hits;
if (sortFields != null && sortFields.length > 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";

Some files were not shown because too many files have changed in this diff Show more