Wednesday, February 28, 2007

Stuck on ConfigParameters

The XMA comes with this really cool thing, configuration parameters. The ability to store (and encrpyt) configuration data on the MA is a great feature that am constantly on the verge of abusing. You can store anything in there, and easily dig it out when the MA runs to control the MA behaviour.

Often I've wished the MV had the same functionality, as well as every other MA type besides the XMA. Yes I know that I can write an XML file and put that in the Extensions folder, or I can use the registry or something else, but I want to be able to use the MA to store my configuration data.

As it turns out you can kinda do this with some trickery. The story goes something like this:
1. Add your config parameters to your XMA
2. On Import, write code to dig out the configParameters
3. Use the configParameters to create a fake object and inject it into your import file
4. Modify the MA schema to include your new fake object

At this point you should be able to run an Import on your MA and see the fancy new object in the CS.

5. On the Initialize function in the MA or MV extensions, use WMI to find your fake object
6. Get the attributes of your fake object (the config parameters) by looking at the hologram on the CS object.

Not for the faint of heart:
You can get really inventive and get access to real objects instead of attr:value pairs if you serialize an object into the value on Import, then deserialize it after you read it out of the hologram.

1 comment:

Jack deems said...

hello, everyone,
Im truelly a noob to this env. and I really really need some cool stept by step tutorial of how to use the smart card profile template, I wasnt able to find any (the one that is posted here is not available. please , anyone ,
thanks a lot. in advance !