We [CodeFab] have a number of developers that are occasionally working
on the same app under Solaris using WebObjects 4.0.
Unfortunately, every time the application starts, it rewrites
/tmp/WebObjects.conf-- removing all other instances of the
applicatiion. If you have two developers that are doing development
that need to access the apps via the webserver, it means that only one
instance of the app is available at a time.
Under 3.5, the solution was simple-- create per user links under the
WebObjects directory off to the user's workarea.... the appnames would
effectively then become <username>/<appname>.
With 4.0's vastly improved application initialization sequence, this
feature was lost.
However, it is really easy to add back!
WOApplication has an instance variable called "name". It is apparently
initialized in -WOApp's -init. Simply override -init, change the name
variable to whatever you want to call the app and the app will be
registered in WebObjects.conf under the new name!
In keeping with the 4.0 design pattern, I did the following-- it allows
you to specify the name of the application through the defaults database
or on the command line using the -WOApplicationName default (just like
any of the other defaults).
Simply add this to your Application's -init *after* the line that
invokes [super init].
NSString *newName = [[NSUserDefaults standardUserDefaults]
stringForKey: @"WOApplicationName"];
if (newName != nil)
[self takeValue: newName forKey: @"name"];
That's it!
b.bum
(to achieve 3.5.1 like behaviour, the above code could derive the name
by taking the mainbundle's path, and using everything between the
WebObjects and the .woa-- but, under 4.0, the app doesn't have to live
under WebObjects... so this won't always work)