Myna 1.0 Beta 6 Released

0 views
Skip to first unread message

Mark Porter

unread,
Jul 25, 2010, 4:53:29 PM7/25/10
to MynaJS-General
These notes are also available on the website:
http://www.mynajs.org/site/changeLog/Myna1.0beta6.ejs

This release contains a major change to $application, introduces
application import/export, enhanced cluster support, performance
enhancements, minor bug fixes and documentation updates

Highlights
------------
* **Reworked application definitions**

To support exporting and importing Myna applications, several
changes were made to $application to include application metadata
and to improve workflow. Specifically:

* *Format*

Instead of raw JavaScript code, application.sjs files should now
be an anonymous application config object. The properties of
this
object will be copied to $application. A template for this
object
with comments is available in the API docs under "Application
Template"

* *init() function*

This new application config property defines a function that is
executed after applying the config to $application, but before
nested configs are applied. This is analogous to the way classic
application.sjs files worked.

* *Application Request Workflow*

Setting workflow functions on the application config object
(onRequestStart,onError,etc) will now create a function chain
with any previously defined application configs automatically.
See $application in the API docs for more detail on the order
of nested application workflow function execution.

* *Application Metadata*

The application config now includes metadata such as
displayName,
author, minMynaVersion, etc. All app properties can be accessed
via Myna.loadAppProperties(path) and are used by Myna's new
import/export feature

* *Backwards compatibility*

Although the old style of application.sjs files is now
deprecated, Myna will automatically detect this style of config
an processes it in the old manner. This means that this change
should have no effect on current applications.

* **Application import/export/install**

A new section has been added to the Myna Administrator: "Manage
Applications". This section provides the following app related
functions:

* *Import*

Importing an application makes the Myna Administrator aware
that a particular directory represents an application. All
application properties are set in that directory's
application.sjs file

* *Export*

Exporting an application creates a Myna Egg from the
application definition. Myna Eggs are ZIP archives of an
application directory. After exporting the .egg file, a
checksum is created that can be used to verify that the Egg
has
not been modified. Ideally the checksum would be obtained from
a known reliable source, such as the app author's website, and
then the Egg could be mirrored anywhere. Eventually I would
like to provide an app registry on mynajs.org for listing
applications and checksums.

* *Install Egg*

Installing an Egg involves unpacking the Egg file and
registering the application with Myna. You can optionally
verify the Egg with a checksum

* **Improved CommonJS support**

Using Rhino's native "require" support and the Narwhal CommonJS
library, Myna now has native support for CommonJS. This means that
you can place CommonJS libraries in any of the locations defined
in
Myna's General Settings and include them via require(). This also
provides a mechanism for loading libraries distributed in other
applications, like so:

var lib=require("path/to/app/libname")



* **Improved REST support**

Myna now handles all requests, not just .ejs.sjs and .ws files.
Myna now also automatically loads an index.ejs or index.sjs if
available, or displays a directory listing (turn this off in
General Settings). Where REST applies is that you can now
processes
arbitrary URL's that do not have to match the actual filesystem
without using URL-MAP. Simply process the $server.requestDir and
$server.requestScriptName in your application's onRequestStart
function. This is also useful for creating dynamic objects that
look to the browser like static objects. For example
/myapp/charts/1123445.png could be processed like so:

//in myapp/application.sjs
{
onRequestStart:function(){
if ($server.requestDir.listLast("/") == "charts"){
var chart_id =
$server.requestScriptName.listFirst(".");
// Generate chart from database with something
// like JCharts.
$res.serveFile("/tmp/uniquename.png")
// Let Myna know that this request has been handled
// so a 404 error is not triggered
$req.handled=true;
}
}
}


* **New Cluster features: Map and Queue**

* *Myna.Cluster.Map*

A cluster-wide Java Map object that can be narrowed by instance
or purpose. This allows multiple myna instances to have a
shared,
thread-safe key-value store.

* *Myna.Cluster.Queue*

Provides a way to create cluster-wide work queue where no item
can be handled twice. This is useful for distributing tasks
across all machines in the cluster. Future enhancements may
include a ClusterThread class, similar to Myna.Thread that is
automatically distributed across the Myna cluster


* **New start page and document home**
This version includes a new start page that points to a new
document home. This page contains links to the administrator and
and API docs, and includes a "Getting Started" tutorial for
working with Myna
Other Features
---------------
* Added Function.prototype.bind
* Added ID property to fired Events
* Added String.before and String.after functions
* updated to Rhino 1.7R3pre from CVS
* updated narwhal
* Added json-sans-eval (json-minified.js) to /shared/js.
* Added functions byteArrayToBase64 and base64ToByteArray functions
to
JavaUtils
* Added functions byteArrayToHex and HexToByteArray functions to
JavaUtils
* Added functions getChecksum and isValidChecksum to Myna.File
* Added function Myna.loadAppProperties() to get application
properties by path
* Added Myna.printConsole() function
* Added function toJava to String
* Added "urlSafe" parameter to JavaUtils.byteArrayToBase64
* Added "urlSafe" parameter to String.toHash
* Added Function.createChainFunction()
* Added Function.before()
* Added Function.after()
* Added String.prototype.getLineIterator();
* Modified Myna.Thread to add deleteOnJoin property
* Added BalusC's FileServlet
* Added MynaThread.requestHandled property. This is similar to
$req.threadHandled, but it disables post-processing by JSServlet.
This
is set automatically by $res.serveFile
* Added $res.serveFile
* Added default hazelcast.xml file
* Added automatic unicast configuration for hazelcast
* Made Event function thread-safe
* Added Event.getListeners and Event.removeListeners
* Added $server.ipAddresses property
* Added "cluster_members" table to upgrade_tables.sjs
* Added Myna.sync as a convenience function for
Myna.JavaUtils.createSyncFunction
* Added Myna.Cluster
* Modified cluster startup to skip first stage
* Added String.trimIndent()
* Updated MynaEjsParser to call trimIndent().trim() on EJS blocks
* Added $server.properties: a shortcut to Myna.getGeneralProperties()
* Added Array.prototype.compact() - removes "undefined" elements
* Modified $req.getHeaders() to parse headers as dates, if possible,
and to accept lowercase key names
* Modified Myna.Query to immediately close the resultset after
handling all rows
* Myna.Thread: now waiting for thread to exit on joins instead of
when
the script finishes
* Myna.Thread: now compacting the thread arrays after deletes to save
a bit of memory and make them easier to work with
* Modified EJSParser to use a string array buffer for generated
content instead of the thread buffer. This provides better thread
safety
* Cosmetic changes to Myna Admin
* Added String.toFixedWidth
* Added Profiler.getSummaryText
* Added profiling to DataManager in getById and Find
* Added more profiling for queries

Bug fixes
----------------
* Modified DataManager.find/findBeans to better handle non-string
criteria
* Modified Object(lib).before/after to be consistent with
Function.before/after
* Modified Myna.ThreadGroup to have join() only join the the threads
in the group instead of all threads
* Bug: added range checks for String.before and String.after
* WebService: Not defining any functions no longer causes an error

Tony Zakula

unread,
Jul 27, 2010, 2:10:18 PM7/27/10
to mynajs-...@googlegroups.com
Great work Mark!  I cannot wait to try some of this out.
Reply all
Reply to author
Forward
0 new messages