#pragma once // DesignManager for DX based applications // // Version: 1.0.0 // // Application Includes #include "ExecEnvironment.h" #include "DXGlobals.h" #include "DesignManifest.h" #include "DesignManifestLine.h" // Additional Platform includes #include // WinHTTP API // Trace Messages #define MSG_DXM0001T "DXM0001T: A new DesignManager instance has been created @%p." #define MSG_DXM0002T "DXM0002T: A DesignManager instance @%p has been destroyed." #define MSG_DXM0005T "DXM0005T: Parsing '%s' at state: %i." #define MSG_DXM0018T "DXM0018T: Element: %s of type: %i has been parsed." #define MSG_DXM0022T "DXM0022T: Attempting to update design element: %s in the repository." #define MSG_DXM0029T "DXM0029T: Configuring connection to host: %s." #define MSG_DXM0031T "DXM0031T: Configuring request for resource: %s." #define MSG_DXM0038T "DXM0038T: Returning %ld bytes to the XML processor from cache." #define MSG_DXM0041T "DXM0041T: Returning %ld bytes to the XML processor from a new cache." #define MSG_DXM0042T "DXM0042T: End of content stream has been processed normally." #define MSG_DXM0043T "DXM0043T: Returning %ld bytes to the XML processor from uncached response data." // Information Messages #define MSG_DXM0006I "DXM0006I: Design Manager is loading the manifest (%s)." #define MSG_DXM0007I "DXM0007I: Design Manifest (%s) has been successfully loaded." #define MSG_DXM0017I "DXM0017I: The Design Manifest has been loaded with %i sets and %i elements." #define MSG_DXM0019I "DXM0019I: Processing a request to apply Design Set: %s to the repository." #define MSG_DXM0021I "DXM0021I: Completed a request to apply Design Set: %s to the repository." #define MSG_DXM0044I "DXM0044I: Design Manager completed, %i Design Sets were applied, %i Design Elements were added and %i were skipped." #define MSG_DXM0045I "DXM0045I: Skipping Design Element '%s', already in the repository." #define MSG_DXM0056I "DXM0056I: Current Domino build number is %i." #define MSG_DXM0060I "DXM0060I: Manifest located, processing %d bytes." // Warning Messages #define MSG_DXM0046W "DXM0046W: Post processing failed for Design Element '%s'." #define MSG_DXM0055W "DXM0055W: Pre processing failed for Design Element '%s', skipping element." #define MSG_DXM0057W "DXM0057W: The current version of Domino does not import DXL reliably (use 7.0.3 and up)." // Error Messages #define MSG_DXM0003E "DXM0003E: Unable to locate the DesignManifest resource in this executable." #define MSG_DXM0004E "DXM0004E: Unable to parse the DesignManifest, Design manager is inactive." #define MSG_DXM0008E "DXM0008E: The Design Manifest line parser has returned a permanent error." #define MSG_DXM0009E "DXM0009E: The Design Manifest line parser could not recognise an XML line." #define MSG_DXM0010E "DXM0010E: The Manifest definition is missing from the design manifest." #define MSG_DXM0011E "DXM0011E: A DesignSet definition is missing from the design manifest." #define MSG_DXM0012E "DXM0012E: A DesignSet close definition is missing from the design manifest." #define MSG_DXM0013E "DXM0013E: An empty DesignSet (containing no elements) is invalid." #define MSG_DXM0014E "DXM0014E: A DesignElement is missing the URL definition." #define MSG_DXM0015E "DXM0015E: A DesignElement close is missing from the design manifest." #define MSG_DXM0016E "DXM0016E: A Design Manifest cannot be defined without any Design Sets." #define MSG_DXM0020E "DXM0020E: Design Set '%s' could not be located in the loaded design manifest." #define MSG_DXM0022E "DXM0022E: Unable to create a valid DXL Importer." #define MSG_DXM0023E "DXM0023E: DXLCreateImporter call failed." #define MSG_DXM0024E "DXM0024E: Unable to set a DXL Importer property." #define MSG_DXM0025E "DXM0025E: DXLImport failed." #define MSG_DXM0026E "DXM0026E: Unable to get the DXL Importer Log Handle." #define MSG_DXM0027E "DXM0027E: Unable to initialise the WinHTTP component." #define MSG_DXM0028E "DXM0028E: Unable to crack : %s." #define MSG_DXM0030E "DXM0030E: Unable to configure the http connection to host: %s." #define MSG_DXM0032E "DXM0032E: Unable to configure the http request for: %s." #define MSG_DXM0033E "DXM0033E: Unable to send the http request for: %s." #define MSG_DXM0034E "DXM0034E: Unable to get a response to the http request for: %s." #define MSG_DXM0035E "DXM0035E: Unable to get query the response code for the http request for: %s." #define MSG_DXM0036E "DXM0036E: A response code of %ld was received from the http request for: %s." #define MSG_DXM0037E "DXM0037E: Unable to determine if data is available in response to a http request." #define MSG_DXM0039E "DXM0039E: Failed to allocate cache memory of %ld bytes." #define MSG_DXM0040E "DXM0040E: Failed to read response data into a new cache buffer." #define MSG_DXM0047E "DXM0047E: Unable to locate the icon data carrier design note." #define MSG_DXM0048E "DXM0048E: Unable to open the icon data carrier design note." #define MSG_DXM0049E "DXM0049E: Unable to open the database icon note." #define MSG_DXM0050E "DXM0050E: Unable to remove the icon bitmap item from the icon note." #define MSG_DXM0051E "DXM0051E: Unable to get icon bitmap info from the carrier note." #define MSG_DXM0052E "DXM0052E: Unable to copy the icon bitmap item tto the icon note." #define MSG_DXM0053E "DXM0053E: Unable to delete the icon data carrier design note." #define MSG_DXM0054E "DXM0054E: Unable to delete the '%s' note." #define MSG_DXM0058E "DXM0058E: Unable to allocate memory for the Manifest Buffer." #define MSG_DXM0059E "DXM0059E: The Design Manifest '%s' could not be loaded, design update abandoned." // Local Definitions #define DM_BUILD 14 #define DM_IDENTITY "DXCommon Design Manager (build: %i)" #define MAX_LINE 256 // Max line size #define DUMMY_CARRIER_ELEMENT "DX-Dummy-Carrier" // Dummy carrier for ICONDATA #define MANIFEST_BFR_SIZE 20*1024 // 20k Buffer for Manifest // Parser States #define PSTATE_NOT_STARTED 1 // Parsing not started #define PSTATE_MANIFEST_DEFINED 2 // Root Manifest object is defined #define PSTATE_SET_OPEN 3 // DesignSet is open #define PSTATE_ELEMENT_INDEF 4 // Element is being defined #define PSTATE_ELEMENT_URLDEF 5 // Element has had the URL added class DesignManager { public: // Constructor DesignManager(ExecEnvironment * xeParent); // Destructor ~DesignManager(void); // Public members DesignManifest *dmRoot; // Design manifest root // Public functions bool LoadManifest(char * szManifestID); // Load the design manifest bool ApplyDesignSet(char * szSetName); // Apply a design set to the repository static DWORD LNCALLBACK WrapperXMLReader(unsigned char * ucBuffer, DWORD dwMaxToRead, void * pObject); DWORD XMLReader(unsigned char * ucBuffer, DWORD dwMaxToRead); // XML Reader routine bool ApplyAllDesignSets(void); // Apply all design sets to the repository void GetBuildInfo_s(char * szBuild, int iSize); // Get the build identity void GetDefaultDbTitle_s(char * szTitle, int iSize); // Get the default (constructed) Db Title private: // Private Members ExecEnvironment *xeBase; // Execution Environment HINTERNET hWHFacility; // Handle to the WinHTTP Component HINTERNET hWHConnection; // Handle to the WinHTTP Connection HINTERNET hWHRequest; // Handle to the WinHTTP Request DXLIMPORTHANDLE dihImporter; // DXL Importer Handle HANDLE hRespBuffer; // Handle to the response buffer DWORD dwRespBfrSize; // Size of data in the response buffer int iSetsApplied; // Count of design sets applied int iElementsAdded; // Count of design elements added int iElementsSkipped; // Count of design elements skipped char szCurrentReadURL[MAX_DM_URL]; // Current URL to Read // Private Functions bool ParseManifest(char * pManifest); // Parse the Design Manifest resource DesignSet * FindDesignSet(char * szSetName); // Find a named Design Set bool ApplyDesignElement(DesignElement * deCurrent); // Apply a Design Element to the repository bool CreateImporter(void); // Create a DXL Importer instance void DestroyManifest(void); // Destroy the manifest bool PostProcessElement(DesignElement * deCurrent); // Post processing for some design elements bool PreProcessElement(DesignElement * deCurrent); // Pre processing for some design elements bool LoadWebManifest(char * szManifestURL); // Load a manifest from the Internet };