Smalltalk WebStart

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Smalltalk WebStart

Andy Bower-3
Folks,

This post is in response to another recent thread in the group, "Using
Binary Packages Like Java Jars".

We've had binary packages in Dolphin for Heaven knows how long now but,
up until now, they have really only been used as part of the Web applet
kit (which unfortunately is being phased out due to changes that were
made in Internet Explorer 6). So, in conjunction with the recent query,
it seemed about time that we should bring them back into the spotlight.

Also, on the occasions when I've had to install a JavaTM virtual
machine (sigh), I've become heartily fed up with the fact that I get
some "Java Web Start" icon stuck automatically on my desktop without my
asking. Then, when I actually try it, it all seems far too
straightforward to put up with Sun crowing on about this new
"technology".

So, with the motto, "HOW HARD CAN IT BE?" (which, perhaps, ought to be
a general Smalltalk adage) I decided to see what I could knock up in
Dolphin in a day.  The result is Smalltalk WebStart:

http://www.object-arts.com/downloads/5.1/WebStart/SmalltalkWebStartSetup
.exe

This link will install a Dolphin Smalltalk WebStart VM and launcher
that is capable of hosting applications distributed in what is,
effectively, BinaryPackage format. In fact the distribution format is
ZIP files which can contain one or more binary packages and additional
resource files that may be needed by the application (I chose not to
call these files SARS for obvious reasons).

If you install the above download you will be presented with a shortcut
icon entitled "Smalltalk WebStart".  Double-click this to start the
application launcher. You'll see that, by default, there are two
applications already installed: Notepad and RegEdit (not surprisingly
these are just taken from the traditional Dolphin samples of the same
names). Before double-clicking either of these applications go to
\Program Files\Object Arts\Smalltalk WebStart\WebStart Apps and take a
look at the Notepad and RegEdit subdirectories. You should see that
each contains a single ZIP file holding the application contents.

Now double-click on, say, Notepad and observe that, at first, the
launcher checks for a new version of the Notepad application on the web
(it probably won't find anything new just yet) and then proceeds to
bring up a DolphinSure warning dialog. You can trust the unsigned
content and the Dolphin Notepad application should appear.  Now go back
to looking at the Notepad subdirectory and you should see that the ZIP
file has been expanded into several files:

NotePad.pak - the BinaryPackage contain the code
NotePad.ico - an icon resource
NotePad.ini - a configuration file

The INI file is worthy of further investigation since it contains the
home URL of the application and also a line, "autoupdate=true" which
tells the launcher to look for an updated version of the app each time
it is started. Without the "autoupdate" line the application would have
to to be manually refreshed from the menu.

Notice, also, that when you start an application from the launcher, the
launcher window itself closes.  This is to ensure that only one
application can start within the WebStart VM at any one time.  Although
it is strictly not necessary to impose this limitation since the binary
package framework would allow for several applications to run within a
single VM, I've chosen to do this to avoid version compatibility and
namespace issues.  This way, an application can be defined completely
within its own ZIP file and can't be interfered with by another
application that may use similar but different version components.

You also notice that it is possible to launch a Smalltalk WebStart
application directly from a shortcut icon rather than going through the
launcher window. You'll see that the program group contains two such
shortcut icons to the Notepad and RegEdit apps.

INSTALLING NEW APPS

 From the launcher window choose, Application/Install New. In the
prompter that appears you should type in the URL for a WebStart
application ZIP file. At the moment there are two more (rather tedious
I'm afraid) such applications available on the Object Arts website.
Try:

http://www.object-arts.com/downloads/5.1/WebStart/Chat.zip

and

http://www.object-arts.com/downloads/5.1/WebStart/AvatarChat.zip

CREATING NEW APPS

By now, you should have got the idea that a WebStart application is
simply a Dolphin Shell application exported to one or more binary
package and then wrapped up into a ZIP file together with an INI and
any other required resources. Once you've created your applicationin
the standard Dolphin development environment, right click on the
package(s) in the Package Browser and choose Deploy Binary Package from
the context menu.  You will be prompted for a DolphinSure certificate
to use to digitally sign the application. If you don't have a
certificate simply press Ok and the application will be exported as an
unsigned .PAK file. You will need to be running Dolphin Pro to generate
binary packages.

NOTE: we are not currently issuing any new DolphinSure certificates, so
please don't ask for one just now. Dolphin 6 will introduce a new
certificate format and it doesn't seem worthwhile issuing a bunch of D5
certificates which will be superseded within a few months.

HOW IT WORKS

The source for WebStart is included in a couple of Dolphin source
package files in the \Program Files\Object Arts\Smalltalk WebStart
directory.  Try loading WebStart.pac into a Dolphin 5.1.4 Pro image
(which will also bring in ZLib.pac).  You'll also need to have Steve
Waring's HTTP Client package installed since this is used for the web
transport. If you haven't got it already, you can find this at Dolphin
Harbour:

http://www.dolphinharbor.org

IMPORTANT: You will also need to file in the "Patch 5.1.4.st" file
located in the same directory; we found a new bug in the binary package
mechanism which needs to be fixed for WebStart to work.

If you choose to deploy the WebStart package you will see that it
generates the launcher/VM executable.  Remember, this is just a sample
so you may want to take what is here and use it as a model to implement
your own automatic application deployment and updating system based on
binary packages.

Anyway, have fun. I'm away on vacation for a week so, if there are
problems, just post them up to the newsgroup and someone may be able to
come up with a solution before I return. As I said before, this is
intended to be just a sample to show how it might be done, so please
don't expect this to be industrial strength code at the moment.
However, if enough of you find this useful we may consider rolling this
into the mainstream part of Dolphin 6, so let us know what you think.


Best regards

Andy Bower
Dolphin Support
www.object-arts.com


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Ian Bartholomew-19
Andy,

I think there is something slightly wrong with the installation of
SmalltalkWebstart.  The two files

patch 5.1.4.st
SmalltalkWebstart.exe.manifest

both end up in the WebStart Apps/Reg Edit subfolder rather than, I assume,
in the root folder.  I also noticed that the Resources subfolder already
contains an icon for notepad and regedit - I would have thought they should
just be part of the appropriate zip file?

I haven't had a chance to use it yet but reading your notes I couldn't see
any mention of how to add "loose" files to the zip.  For example, I was
thinking about distributing my goodies as individual SmalltalkWebstart
applications (one for the ChunkBrowser one for the IDE Extensions &etc).
That would need a zip containing the "executable" pak file (to "install" the
goodie) and loose "normal" package files, chunkbrowser.pac and it's
prerequisite packages for example, that the installer would copy to the
correct place.  Is there any way of adding "loose" files to a zip and, if
not, might it be worth adding such a mechanism?.

Thanks for posting the SmalltalkWebstart package though - it does look
interesting.

Have a good holiday....

PS.  I like the "Powered by Smalltalk" logo.  Can _we_ use it?

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Ian Bartholomew-19
Ian,

> I couldn't see any mention of how to add "loose" files to the zip.

Duh, doesn't matter.  I shall go and slap myself with a wet fish.....

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Andy Bower-3
In reply to this post by Ian Bartholomew-19
Ian,

> I think there is something slightly wrong with the installation of
> SmalltalkWebstart.  The two files
>
> patch 5.1.4.st
> SmalltalkWebstart.exe.manifest
>
> both end up in the WebStart Apps/Reg Edit subfolder rather than, I
> assume, in the root folder.  

Thanks, I've moved them and updated the installer which is now at
version 5.1.4.2.

> I also noticed that the Resources
> subfolder already contains an icon for notepad and regedit - I would
> have thought they should just be part of the appropriate zip file?

The copy of the icons is just a frig to get around the fact that I
wanted to have the setup program install some shortcut icons for the
Notepad and RegEdit applications before they are actually really
installed (they are shipped just as the ZIP files). The icons in the
Resources subfolder are used only by the Setup program.

> I haven't had a chance to use it yet but reading your notes I
> couldn't see any mention of how to add "loose" files to the zip.  For
> example, I was thinking about distributing my goodies as individual
> SmalltalkWebstart applications (one for the ChunkBrowser one for the
> IDE Extensions &etc).  That would need a zip containing the
> "executable" pak file (to "install" the goodie) and loose "normal"
> package files, chunkbrowser.pac and it's prerequisite packages for
> example, that the installer would copy to the correct place.  Is
> there any way of adding "loose" files to a zip and, if not, might it
> be worth adding such a mechanism?.

As I think you've worked out, just add the loose files to the
appropriate subfolder in the ZIP file manually and they will
automagically get transported to the target machine and unzipped in the
correct place.

The one issue that needs addressing pretty soon is how to make
applications access resource files (like icons etc) when they are in a
normal development image (for testing) and when they are deployed as a
WebStart application. Some derivative of Chris's PackagedFileLocator
should be able to do it but I haven't had time to look at that yet (all
suggestions/code grateful received).

> PS.  I like the "Powered by Smalltalk" logo.  Can we use it?

I guess so; it's one of the ones that I found on the whysmalltalk site.

Best regards

Andy Bower
Dolphin Support
www.object-arts.com


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

keith
In reply to this post by Andy Bower-3
"Andy Bower" <[hidden email]> wrote in message news:<[hidden email]>...

> Folks,
>
> This post is in response to another recent thread in the group, "Using
> Binary Packages Like Java Jars".
>
> We've had binary packages in Dolphin for Heaven knows how long now but,
> up until now, they have really only been used as part of the Web applet
> kit (which unfortunately is being phased out due to changes that were
> made in Internet Explorer 6). So, in conjunction with the recent query,
> it seemed about time that we should bring them back into the spotlight.
>
Excellent! This is exactly the confirmation I was hoping for,
concerning binary packages. I downloaded the sample, and everything
worked like a charm! I must confess I haven't delved into the innards
of what you've done, but it certainly looks like something I can make
use of.

Looks like you might be on to the software engineering "hook" phrase
of the 21st century (instead of "what do you want to do today") - "how
hard can it be"?

Thanks for the effort -- I'd love to see this in D6!

KeithB


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Chris Uppal-3
In reply to this post by Andy Bower-3
Andy Bower wrote:

> The one issue that needs addressing pretty soon is how to make
> applications access resource files (like icons etc) when they are in a
> normal development image (for testing) and when they are deployed as a
> WebStart application. Some derivative of Chris's PackagedFileLocator
> should be able to do it but I haven't had time to look at that yet (all
> suggestions/code grateful received).

If you mean my PackageRelativeFileLocator, then that's exactly what they are
intended for.  They've been working quite well for me for a while now.

If you'd like to add them (or a derivative) to the standard image, then please
be my guest.

For anyone who's interested, they're at:

<http://www.metagnostic.org/DolphinSmalltalk/Miscellanea.html>

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Ian Bartholomew-19
In reply to this post by Andy Bower-3
Anyone else noticed a problem with the sequence with which the web start app
itself is installed into Dolphin?

If I use the following sequence into a clean 5.1.4 ....

1) Install the extra 5.1.4 patch
2) Install "web start.pac"
3) When prompted install "SW HTTPClient.pac"

... the I get a recursive error walkback every time (below).

If I reverse the order of 2 qnd 3, installing Steve's package before
attempting to install "web start", then all works without error.

13:40:10, 11 April 2004: 'Recursion too deep; the stack overflowed. (16r3E9:
Recursion too deep; the stack overflowed.)'
ProcessorScheduler>>stackOverflow:
[] in ProcessorScheduler>>vmi:list:no:with:
BlockClosure>>ifCurtailed:
ProcessorScheduler>>vmi:list:no:with:
SmallInteger(Integer)>>asDword
[] in InputState>>wndProc:message:wParam:lParam:cookie:
BlockClosure>>ifCurtailed:
ProcessorScheduler>>callback:evaluate:
InputState>>wndProc:message:wParam:lParam:cookie:
MultipleSelectionListView(View)>>sendMessage:wParam:lpParam:
MultipleSelectionListView(ListView)>>lvmGetNextItem:flags:
[] in MultipleSelectionListView>>selectionsByIndex
Interval>>collect:
MultipleSelectionListView>>selectionsByIndex
MultipleSelectionListView>>selectionByIndex
MultipleSelectionListView>>selections:ifAbsent:
ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
PackageSelector(SelectableItemsPresenter)>>selections:
PackageSelector>>resetForItems:
[] in PackageSelector(SelectableItemsPresenter)>>selections:
MultipleSelectionListView>>selections:ifAbsent:
[] in ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
MultipleSelectionListView>>selections:ifAbsent:
ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
PackageSelector(SelectableItemsPresenter)>>selections:
PackageSelector>>resetForItems:
[] in PackageSelector(SelectableItemsPresenter)>>selections:
MultipleSelectionListView>>selections:ifAbsent:
[] in ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
MultipleSelectionListView>>selections:ifAbsent:
ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
PackageSelector(SelectableItemsPresenter)>>selections:
PackageSelector>>resetForItems:
[] in PackageSelector(SelectableItemsPresenter)>>selections:
MultipleSelectionListView>>selections:ifAbsent:
[] in ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
MultipleSelectionListView>>selections:ifAbsent:
ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
PackageSelector(SelectableItemsPresenter)>>selections:
PackageSelector>>resetForItems:
[] in PackageSelector(SelectableItemsPresenter)>>selections:
MultipleSelectionListView>>selections:ifAbsent:
[] in ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
MultipleSelectionListView>>selections:ifAbsent:
ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:
PackageSelector(SelectableItemsPresenter)>>selections:
PackageSelector>>resetForItems:
[] in PackageSelector(SelectableItemsPresenter)>>selections:
MultipleSelectionListView>>selections:ifAbsent:
[] in ListPresenter(SelectableItemsPresenter)>>selections:ifAbsent:

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Chris Uppal-3
Ian,

> 1) Install the extra 5.1.4 patch
> 2) Install "web start.pac"
> 3) When prompted install "SW HTTPClient.pac"
>
> ... the I get a recursive error walkback every time (below).

I think this is a known bug.

I've never worked out exactly what to change to fix it, but it seems to
be caused by installing a package that is dependent on another uninstalled
package with which it doesn't share a common "root" folder.  At least, that's
the case that bugs me (and which I reported).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Smalltalk WebStart

Louis Sumberg-2
In reply to this post by Andy Bower-3
This is very impressive for a day's work :)

I've run into a few problems:

1)  The installation worked fine and both Notepad and Regedit worked fine
the first time.  However, when I double-click on an icon a second time (or
try to run a newly installed app the first time, e.g., Chat), it tries to
update from the server but fails with a message "Invalid format for Date".
I traced this to WebStartApp>>timeStampFromLastModifiedString: which has the
line "date readFrom: stream", which in turn calls Data class>>readFrom:
which eventually uses a format that's the local pc's default format (self
defaultShortFormat).  In my case, this is 'M/d/yyyy'.  I changed the line in
#timeStampFromLasModifiedString: to read "date readFrom: stream format:
'd/M/yyyy' and now it starts up fine, but I don't know if hardcoding this
will work for the long-term.

2)  Ini files - The format of the ini file used in WebStart is, I believe,
different from what is commonly used, so for applications that actually use
an ini file to read and write other settings, this could be a problem.
Specifically, I think the ini file in WebStart needs a "section name", e.g.,
'[WebStart]'.  In addition, the location of that section in the ini file
should be arbitrary, i.e., not guaranteed to be at the top.  This of course
means WebStart would need some other means to read the values, but I know
there are at least two implementations of Dolphin wrappers around the
Windows functions that read ini files.  For example, using my Ini class, the
code to read values might be something like:

    | ini |
    ini := (Ini new filename: self iniPath) section: 'WebStart'.
    url := ini readString: 'url'.
    isAutoUpdate := ini readBoolean: 'autoupdate'

If this approach is undesirable (i.e., who wants another package
dependency), then I suppose it's easy enough to change the inifile reader in
WebStart to scan the ini file for lines starting with 'url=' and
'autoupdate='.

-- Louis