Skip to content

Commit

Permalink
Update license and readme for NPM module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Brail committed Oct 1, 2014
1 parent f4551d6 commit 004b7e5
Show file tree
Hide file tree
Showing 12 changed files with 806 additions and 81 deletions.
179 changes: 113 additions & 66 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
====

Copyright 2013 Apigee Corporation

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.
Copyright 2013 Apigee Corporation

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.

====

Expand All @@ -30,61 +30,108 @@ the following:
* All of the files in nodetests/src/test/resources/test
* All the files in src/main/javascript/com/apigee/noderunner/fromnode except those specifically mentioned below:

"""
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
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.
"""
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
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.

- src/main/javascript/com/apigee/noderunner/fromnode/assert.js:

"""
http://wiki.commonjs.org/wiki/Unit_Testing/1.0
http://wiki.commonjs.org/wiki/Unit_Testing/1.0

THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!

Originally from narwhal.js (http://narwhaljs.org)
Copyright (c) 2009 Thomas Robinson <280north.com>
Originally from narwhal.js (http://narwhaljs.org)
Copyright (c) 2009 Thomas Robinson <280north.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
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 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 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.
"""
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 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.

- src/main/javascript/com/apigee/noderunner/fromnode/punycode.js:

copyright 2011 Mathias Bynens <http://mathiasbynens.be/>
and released under the MIT license.
"""
* Punycode.js <http://mths.be/punycode>
* Copyright 2011 Mathias Bynens <http://mathiasbynens.be/>
* Available under MIT license <http://mths.be/mit>
"""
copyright 2011 Mathias Bynens <http://mathiasbynens.be/>
and released under the MIT license.
* Punycode.js <http://mths.be/punycode>
* Copyright 2011 Mathias Bynens <http://mathiasbynens.be/>
* Available under MIT license <http://mths.be/mit>

- Crypto support:

Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. (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.

- slf4j logging API:

Copyright (c) 2004-2013 QOS.ch
All rights reserved.

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.

- logback framework (used for logging in pre-packaged distributions):

This framework is distributed under the Eclipse Public License 1.0. See the license:

[./etc/epl-1-0.html](./etc/epl-1-0.html)

- Rhino (used to run JavaScript):

This framework is distributed under the Mozilla Public License 2.0. See the license:

[./etc/mpl-2-0.txt](./etc/mpl-2-0.txt)
62 changes: 48 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,42 @@ For a more detailed introduction, see our intro presentation:

* [Introduction to Trireme](./docs/trireme-intro.pdf)

## So, again, why would I use Trireme?

* To embed Node.js apps inside an existing Java application
* To run Node.js apps that take advantage of Java libraries you can't live without, like JDBC drivers and XML parsers

If neither of those reasons apply to you, then stick with "regular node!"

## How do I get it?

See [the releases page](https://github.com/apigee/trireme/releases) to download the latest release files.
### From NPM

"trireme-x.y.z.jar" is always a stand-alone jar that you can run just like "node":
sudo npm install -g trireme
trireme -h
trireme <your script name here>

java -jar trireme-x.y.z.jar script.js
The NPM package for Trireme lets you run it on the command line just like "node".

Unfortunately, Trireme does not support the "repl" yet (and it's hard since Java gives us limited control over
the TTY) so just running "trireme" with no arguments produces an error right now.

To embed Trireme, you'll need the other jars in your classpath, as described in the "Package Map" below.
### From Maven Central

Trireme is also available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cio.apigee.trireme).
The best reason to use Trireme is because it's important to embed Node.js code inside an existing Java application.
In that case you will use the modules under "io.apigee.trireme" on Maven Central:

Finally, there is a [CI server](http://ci.apigee.io/job/Trireme/).
[io.apigee.trireme](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.apigee.trireme%22)

The "module map" later in this document shows which modules to use in which cases.

### From GitHub

See [the releases page](https://github.com/apigee/trireme/releases) to download the latest release files.

"trireme-x.y.z.jar" is always a stand-alone jar that you can run just like "node":

java -jar trireme-x.y.z.jar script.js

## What version of Node.js does Trireme Support?

Expand Down Expand Up @@ -134,9 +157,6 @@ Trireme handles this disparity by using the "Bouncy Castle" crypto framework to
keys and certificates that SSLEngine can understand. In addition, you can also use regular Java keystore files,
as described below.

5) "securepair" isn't implemented yet -- the vast majority of TLS code we have seen just uses the regular
"cleartext stream." If you really want to see "securepair," it's probably not too difficult.

In order to support TLS and HTTPS using PEM files, the "trireme-crypto" module and its dependencies
(Bouncy Castle) must be in the class path. If they are not present, then TLS is still available, but it will
only work with Java keystore files (see below) or without using any keys at all. Trireme checks for this
Expand Down Expand Up @@ -184,9 +204,6 @@ dependencies are in the class path. If they are not present then these methods w
This is primarily because the trireme-crypto module uses Bouncy Castle to implement PEM file reading
and decryption.

Also, the "Context" feature of the Crypto module is not implemented. This module is really used inside Node.js
to implement TLS, and Trireme does TLS a different way, as explained above.

### Child Process

Child processes are supported. Arbitrary commands may be executed, just like in standard Node.js. The Sandbox
Expand Down Expand Up @@ -238,7 +255,11 @@ In general, we have seen simple HTTP benchmarks run at about one-half the speed
standard Node.js. Some things are slower than that, and others are faster -- it all depends, as it does with
all benchmarks.

We would love to be able to use a faster JavaScript implementation, which would speed up all of Trireme.
Furthermore, Java is notoriously slow to start up, and this especially hurts Trireme when it's used to run
command-line tools. So please try it as a long-running server (which is Java's strong suit) before dismissing the
whole thing because "trireme /tmp/hello-world.js" runs 40 times slower than node. Thanks!

Finally, we would love to be able to use a faster JavaScript implementation, which would speed up all of Trireme.
However, for many programs, Trireme on Rhino will be just fine, and the ability to embed Trireme inside
another container is especially helpful.

Expand Down Expand Up @@ -313,6 +334,20 @@ totally isolated environment in a multi-tenant server.

## Running Trireme

### Using NPM

If you installed Trireme using NPM, just run:

trireme <script name>

Trireme will execute your script just like Node.

In addition, the environment variable TRIREME_CLASSPATH may be used to add extra JARs or directories to the
classpath used to run Trireme. Anything on this path will be appended to the classpath used to
launch Trireme. This allows you to add JDBC drivers, etc.

### Using Java

The "jar" module builds a self-contained JAR that may be used to launch Trireme on the command
line just like regular Node.js:

Expand Down Expand Up @@ -382,4 +417,3 @@ Used in the build process or "node10src" and others.</td></tr>
</table>

Additional modules in this directory are used only for testing.

Loading

0 comments on commit 004b7e5

Please sign in to comment.