GlassFish4

Only took a few teaks to get GlassFish 4 to work.
* Need to add `--savepassword=true` when creating the domain
* Need to copy the master-password file back one directory after the domain is created.

The other changes were just around removing references to version 3.
I can't remember why I added the bit that creates the templates directory.