Envy question, loading a Config Map programatically

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Envy question, loading a Config Map programatically

Postby Livardo » Tue Apr 13, 2010 6:27 am

Hi all,

I remember a co-worker having a fragment of code he would run in a workspace to load up a specific edition of a Config Map. For the life of me, I can't find that code and I would kind of like to do something similar. I know I can probably figure this out by getting to the Congig Map browser classes but I thought I'd save myself some time by asking here first.

For a particular config map, let's say "ConfigDev", I want to "load with required maps" the newest open edition. Any way to do this from the workspace?

thanks
Livardo
 
Posts: 27
Joined: Thu Nov 01, 2007 6:33 am

Re: Envy question, loading a Config Map programatically

Postby nmongeau » Tue Apr 13, 2010 7:01 am

This should get you started:

Code: Select all
| maps config |
maps := (EmConfigurationMap editionsFor: 'YourConfigName') select: [:e | e isEdition].
config := (maps size > 1)
   ifTrue:
      [EtTools
         prompt: ('Choose version of ', maps first name)
         chooseFrom: maps
         initialSelection:  (Array with: maps first)
         printBlock: [:cm |
            cm timeStamp printString, ' - ', (cm description select: [:char |
               char ~= Character cr and: [char ~= Character lf]])]
         statusIndicatorBlock: nil
         at: System cursorPosition]
   ifFalse:
      [maps first].



System showBusyCursorWhile:
   [EmLibrary cache cacheEditionsWhileExecuting:
      [Transcript
         execLongOperation:
            [:dialog |
            config loadWithRequiredMapsAndTracing: true reportProgressTo: dialog]
         message: 'Loading requested config map...             '
         allowCancel: true
         showProgress: true]].


Normand
nmongeau
[|]
 
Posts: 29
Joined: Fri Jan 12, 2007 9:37 am

Re: Envy question, loading a Config Map programatically

Postby koschate » Tue Apr 13, 2010 11:25 am

Going beyond just loading a config map programmatically, I'm trying to automate image building generally here, so I created a small application that I load into a virgin image and then save. Assuming I've saved the image as abtBuild.icx, I can do something like this:
Code: Select all
abt abtBuild.icx -e load.st

where load.st looks like this:
Code: Select all
| result map |
((map := EmConfigurationMap latestEditionFor: 'TK - P1 Development') loadWithRequiredMapsAndTracing: true)
   ifTrue: [
      Transcript targetTextWidget clear.
      Transcript show: ('Image loaded with "%1"' bindWith: map signature).
      EmUser resetImageOwner.
      EmInterface current removeApplications: (Array with: AbtStartupApp).
      System
         saveImage: 'abtBuild.icx';
         exit].


Ideally, the ability to invoke a Smalltalk script should be part of base VA (Are you listening, John?), but until then, this seems to do the job. There's a number of other additions to EmConfigurationmap that you might find relevant in the attached application. This code is from VA 7.5.2, but should work in most versions.
Attachments
AbtStartup.zip
Startup execution support for VA Smalltalk
(34.61 KiB) Downloaded 12 times
koschate
[|]
 
Posts: 102
Joined: Thu Feb 01, 2007 7:24 am

Re: Envy question, loading a Config Map programatically

Postby wembley » Tue Apr 13, 2010 12:10 pm

koschate wrote:Ideally, the ability to invoke a Smalltalk script should be part of base VA (Are you listening, John?)

Thomas -

Actually, the ability to invoke a Smalltalk script IS part of base VA. Do you remember abt.cnf? abt.cnf may not be as flexible as you would like (for example, it has one and only one filename). But it is quite capable -- we use it to automate our product image builds.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Envy question, loading a Config Map programatically

Postby koschate » Tue Apr 13, 2010 1:33 pm

I remember abt.cnf quite well. In fact, I tried to use it for this purpose. It was probably about a year ago that I attempted it. I believe the problem I ran into was that abt.cnf code was invoked far too early in the image startup and I couldn't find any clean way of getting around that. However, I'll revisit the issue.
koschate
[|]
 
Posts: 102
Joined: Thu Feb 01, 2007 7:24 am

Re: Envy question, loading a Config Map programatically

Postby Livardo » Wed Apr 14, 2010 6:57 am

nmongeau wrote:This should get you started:

<< snipped >>

Normand



Hey, thanks a lot for this! I ended up using another method in the EmConfigurationMap class:

Code: Select all
(EmConfigurationMap latestEditionFor: 'MyConfigMap') loadWithRequiredMaps.


cheers!
Livardo
 
Posts: 27
Joined: Thu Nov 01, 2007 6:33 am


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest