eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'StandaloneStartup':

Home

everywhere
www.exept.de
for:
[back]

Class: StandaloneStartup


Inheritance:

   Object
   |
   +--StandaloneStartup
      |
      +--WebServerStartup

Package:
stx:libbasic
Category:
System-Support
Version:
rev: 1.41 date: 2009/12/18 10:15:16
user: cg
file: StandaloneStartup.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


a subclassable template class for a standalone GUI-application's startup;
For your own stand alone programs, define a subclass of this, 
and redefine the #main: method there.
(of course, the other methods can also be redefined.)


Related information:

    Smalltalk
    GetOpt
    ReadEvalPrintLoop

Class protocol:

defaults
o  allowDebugOption
enable/disable the --debug startup option.
The default is now false, so standAlone apps are closed by default.
Can be redefined in subclasses to enable it

o  allowScriptingOption
enable/disable the --scripting startup option.
The default is now false, so standAlone apps are closed by default.
Can be redefined in subclasses to enable it

o  suppressRCFileReading
enable/disable the rc-file reading (and also the --rcFileName option).
If suppressed, there is no chance to interfere with the startup.
Can be redefined in subclasses to disable it

helpers
o  printInfo: msg

o  redirectStandardStreams

o  verboseInfo: msg

initialization
o  initialize
Verbose := true.

multiple applications support
o  applicationRegistryPath
the key under which this application stores its process ID in the registry
as a collection of path-components.
i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored
in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID.
(would also be used as a relative path for a temporary lock file under unix).
Used to detect if another instance of this application is already running.

** This method raises an error - it must be redefined in concrete classes **

o  applicationUUID
answer an application-specific unique uuid.
This is used as the name of some exclusive OS-resource, which is used to find out,
if another instance of this application is already running.
Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used.

** This method raises an error - it must be redefined in concrete classes **

o  checkForAndExitIfAnotherApplicationInstanceIsRunning
if another instance of this application is running,
send it an openFile command for my file-argument, and exit.
(i.e. to let the already running application open up another window).

multiple applications support-helpers
o  applicationRegistryEntry
retrieve the registry entry in which (if present), any currently running application
has left its process ID

o  confirmOpenNewApplicationInstance

o  currentIDKeyInRegistry

o  getCurrentIDFromRegistry

o  getIDOfRunningApplicationFromRegistryEntry

o  isAnotherApplicationInstanceRunning
answer true, if another instance of mzself is currently running.
For now, it only works under win32, because it uses the underlying mutex mechanism.

o  processStartupOfASecondInstance
This is executed when I have been started as a second instance of an already running application.
If I can get the currentID (i.e. windowID) of the first one and there is a command line argument with a file,
send a message to the main window of the already running application, o ask it for another window.
If the currentID is unknown, ask if the user wants to open a new instance of the application anyway.
Return true if the first instance has been notified, and this second instance should exit.

o  releaseApplicationMutex

o  sendCommand: message toWindowId: aWindowId
use the event send mechanism to forward a command to the already running application

o  sendOpenPathCommand: pathName toWindowId: aWindowId
use the event send mechanism to forward an open-Path command to the already running application

o  writeCurrentIDIntoRegistry: currentID

queries
o  applicationName
used in verbose messages - can/should be redefined in subclasses

o  iconInBrowserSymbol

o  isBrowserStartable
do not allow clicking on me in the browser

o  keepSplashWindowOpen
if true is returned here, the splashWindow is not closed and will be still open
when the main: method is invoked. This allows for plugin-loads etc. to be shown in the
splash screen. However, my subclass's main: has to make sure that the splashScreen is closed.
(calling hideSplashWindow)
The default is false here which means that the splashWindow will be already closed when the
subclasses main: is invoked.

o  startupFilename
used in verbose messages - can/should be redefined in subclasses

startup
o  loadPatch: fileName

o  loadPatches

o  setupSmalltalkFromArguments: argv
handle common command line arguments:
--help ............... print usage and exit
--verbose (-V) ....... be verbose during startup
--debug .............. enable debugger & inspector
--rcFileName ......... define a startup rc-file
--scripting portNr ... start a scripting server
--allowHost host ..... add host to the allowed scripting hosts

o  setupToolsForDebug

o  setupToolsForNoDebug

o  start

o  startStartBlockProcess

o  usage

startup-to be redefined
o  isHeadless
this is invoked early by Smalltalk>>mainStartup, to ask if I like to
have a Display or if I am a non-GUI headless application.

Redefine in subclass, if your application is a non-GUI application

o  main

o  main: argv

** This method raises an error - it must be redefined in concrete classes **


Demonstration:


    <yourNamehere>Startup start



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 22:19:15 GMT