Importing Data from the Package

You can develop a custom resource in such a way that it can place arbitrary data, in the form of one or more files, in a site package and have those files unpacked on a different computer. In order for this arbitrary set of files to be retrieved from a site package, a custom resource must include a Component Object Model (COM) object that implements the Import method of the IPuP interface. Commerce Server Site Packager calls this method, providing the name of a temporary file or folder where the Commerce Server Site Packager has placed the file(s) to be unpacked. The Import method must do something with this file or files before returning, such as moving them to another location or moving their contents into a database. Once the Import method returns, Commerce Server Site Packager will delete the file (or files) from the temporary location.

The ProgID of the object that implements the IPuP interface must be placed into the s_ProgidSnapIn column of the SystemProps table in the Administration database (the ProgID is also added to the s_ProgIDSnapIn column of the Resources table when the SiteConfig object is used to migrate configuration values). When Commerce Server Site Packager encounters this ProgID in the course of unpacking the site, it will instantiate the corresponding object and call the Import method of its IPuP interface.

For more information about the Import method, see IPuP::Import.

If the custom resource being unpacked is a site-level reference to a global resource, the Commerce Server Site Packager will call the CreateGroupResource method of the same IPuP interface before calling the Import method. This will provide the custom resource with the opportunity to create the global resource and return its name so that the site-level reference can refer to it. For more information about the CreateGroupResource method, see IPuP::CreateGroupResource.


All rights reserved.