// Scheduled Agent Inventory // //******************************************************************************************************************* //* * //* File: RDBCreate.cpp * //* Suite: Domino Tools * //* Version: 1.1.2 * //* Author: Ian Tree/HMNL * //* * //* Copyright 2008 Hadleigh Marshall Netherlands b.v. * //******************************************************************************************************************* //* RDBCreate * //* * //* This utility will create a database based on a design that is available on the Internet in DXL form. * //* The utility uses the standard functionality of the the DX Tools Design manager component. * //* * //* USAGE: * //* * //* RDBCreate TargetServer TargetDbName ManifestURL [-V|T|D][-U] [=IniFilename] * //* * //* TargetServer - Name of the server on which to create the database | 'Local' * //* TargetDbName - Name of the database to create (relative to the Notes data directory) * //* ManifestURL - URL of the manifest that describes the design of the database * //* -[V|T|D] - Optional switch - Logging level Verbose, Trace or Debug increasing the log output * //* -U - Optional switch - Update the D/B design of an existing database * //* =IniFilename - Optional - Notes ini filename to use * //* * //* NOTES: * //* * //* 1. * //* * //******************************************************************************************************************* //* * //* History: * //* * //* 1.0.0 - 09/2008 - Rebased for DX framework * //* 1.1.0 - 09/2008 - QE version * //* 1.1.1 - 10/2008 - Fixed manifest binding * //* 1.1.2 - 10/2008 - Production Release Version * //* * //*******************************************************************************************************************/ #include "RDBCreate.h" int main(int argc, char* argv[]) { AppRunSettings *arsLocal; // Applictaion Run Settings Object ExecEnvironment *xeLocal; // Execution Run Time DesignManager *dmLocal; // Design Manager char szBuildID[MAX_BUILD]; // Build Info char szDbTitle[NSF_INFO_SIZE]; // Database Title char szMsg[MAX_MSG]; // Generic Message Buffer // Show application is starting std::cout << APP_TITLE << " (" << APP_NAME << ") Version: " << APP_VERSION << " is starting." << std::endl; // Validate and build the Run Settings for this execution arsLocal = new AppRunSettings(argc, argv); if (!arsLocal->AllowExecution) // Exit silently if just showing usage { return APPRC_NOERROR; } if (!arsLocal->IsValid) // Abort if validation failed { std::cout << MSG_CDB0030S << std::endl; return APPRC_FATAL; } // Set the identification in the Run Settings strcpy_s(arsLocal->APPName, MAXAPPNAME, APP_NAME); strcpy_s(arsLocal->APPTitle, MAXAPPTITLE, APP_TITLE); strcpy_s(arsLocal->APPVer, MAXAPPVERSION, APP_VERSION); // Initialise the runtime environment xeLocal = new ExecEnvironment(arsLocal, argc, argv); if (!xeLocal->IsInitialised) // Abort if runtime failed to initialise { std::cout << MSG_CDB0030S << std::endl; return APPRC_FATAL; } // Load the design manager dmLocal = new DesignManager(xeLocal); // Report the Engine Build Information if (arsLocal->LogLevel >= LOGLEVEL_VERBOSE) { xeLocal->GetBuildInfo_s(szBuildID, MAX_BUILD); sprintf_s(szMsg, MAX_MSG, MSG_CDB0036I, szBuildID); xeLocal->LogMessage(szMsg); dmLocal->GetBuildInfo_s(szBuildID, MAX_BUILD); sprintf_s(szMsg, MAX_MSG, MSG_CDB0037I, szBuildID); xeLocal->LogMessage(szMsg); } // Load the Design Manifest if (!dmLocal->LoadManifest(arsLocal->szManifestURL)) // Request the manifest to be loaded { xeLocal->LogMessage(MSG_CDB0032E); xeLocal->Close(); delete xeLocal; delete arsLocal; return APPRC_FATAL; } // Show update from the Internet is happening xeLocal->LogMessage(MSG_CDB0033I); // Apply all of the design sets to the repository if (!dmLocal->ApplyAllDesignSets()) { xeLocal->LogMessage(MSG_CDB0035E); } else { xeLocal->LogMessage(MSG_CDB0034I); // Set the (default) database title dmLocal->GetDefaultDbTitle_s(szDbTitle, NSF_INFO_SIZE); xeLocal->SetRepositoryTitle(szDbTitle); if (arsLocal->LogLevel >= LOGLEVEL_VERBOSE) { sprintf_s(szMsg, MAX_MSG, MSG_CDB0038I, szDbTitle); xeLocal->LogMessage(szMsg); } } // Destroy the Design Manager delete dmLocal; // Show database built sprintf_s(szMsg, MAX_MSG, MSG_CDB0039I, arsLocal->szRepDb, arsLocal->szRepServer); xeLocal->LogMessage(szMsg); // Processing is completed - shut down, clean up and exit. if (!xeLocal->Close()) { std::cout << MSG_CDB0031S << std::endl; return APPRC_FATAL; } // Cleanup the local objects delete xeLocal; delete arsLocal; // Terminate the application std::cout << APP_TITLE << " (" << APP_NAME << ") Version: " << APP_VERSION << " has completed normally." << std::endl; return APPRC_NOERROR; }