Functions | Variables

fwInstallationXml.ctl File Reference

Functions

int fwInstallationXml_childNodesContent (unsigned doc, int node, dyn_string &node_names, dyn_anytype &attributes, dyn_string &nodevalues, dyn_string &exceptionInfo)
int fwInstallationXml_get (string docPath, dyn_string &tags, dyn_string &values, dyn_anytype &attribs)
int fwInstallationXml_getTag (string docPath, string tag, dyn_string &FilteredValues, dyn_anytype &FilteredAttribs)
int fwInstallationXml_create (string pathName, string componentName, string componentVersion, string componentDate, dyn_string requiredComponents, bool isSubComponent, dyn_string initScripts, dyn_string deleteScripts, dyn_string postInstallScripts, dyn_string postDeleteScripts, dyn_string configFiles, dyn_string asciiFiles, dyn_string panelFiles, dyn_string scriptFiles, dyn_string libraryFiles, dyn_string otherFiles, string dontRestartProject, dyn_string &xmlDesc)
int fwInstallationXml_load (string fileName, dyn_dyn_mixed &componentInfo)
int fwInstallationXml_decode (string strComponentFile, string &componentName, string &componentVersion, string &date, dyn_string &dynRequiredComponents, bool &isSubComponent, dyn_string &dynInitFiles, dyn_string &dynDeleteFiles, dyn_string &dynPostInstallFiles, dyn_string &dynPostDeleteFiles, dyn_string &dynConfigFiles_general, dyn_string &dynConfigFiles_windows, dyn_string &dynConfigFiles_linux, dyn_string &dynDplistFiles, dyn_string &dynPanelFiles, dyn_string &dynScriptFiles, dyn_string &dynLibFiles, dyn_string &dynComponentFiles, dyn_string &dynSubComponents, dyn_string &dynScriptsToBeAdded, dyn_string &dynFileNames, string &dontRestartProject)
int fwInstallationXml_parseFile (string sourceDir, string descFile, string subPath, string destinationDir, dyn_dyn_mixed &parsedComponentInfo)

Variables

const string csFwInstallationXmlLibVersion = "5.0.0"
const string fwInstallation_Xml_CHILDNODESTYPE = "fwXml_ChildNodesType"
const string fwInstallation_Xml_CHILDSUBTREEID = "fwXml_ChildSubTreeId"
fwInstallation.ctl: Definition of constants

The following constants define the indeces of the different elements in the component XML file when passed as a dyn_dyn_mixed matrix

const int FW_INSTALLATION_XML_COMPONENT_NAME = 1
const int FW_INSTALLATION_XML_COMPONENT_VERSION = 2
const int FW_INSTALLATION_XML_COMPONENT_IS_SUBCOMPONENT = 3
const int FW_INSTALLATION_XML_COMPONENT_DATE = 4
const int FW_INSTALLATION_XML_COMPONENT_HELP_FILE = 5
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_COMPONENTS = 6
const int FW_INSTALLATION_XML_COMPONENT_DPLIST_FILES = 7
const int FW_INSTALLATION_XML_COMPONENT_SUBCOMPONENTS = 8
const int FW_INSTALLATION_XML_COMPONENT_COMMENTS = 9
const int FW_INSTALLATION_XML_COMPONENT_INIT_SCRIPTS = 10
const int FW_INSTALLATION_XML_COMPONENT_DELETE_SCRIPTS = 11
const int FW_INSTALLATION_XML_COMPONENT_POST_INSTALL_SCRIPTS = 12
const int FW_INSTALLATION_XML_COMPONENT_POST_DELETE_SCRIPTS = 13
const int FW_INSTALLATION_XML_COMPONENT_CONFIG_FILES = 14
const int FW_INSTALLATION_XML_COMPONENT_PANEL_FILES = 15
const int FW_INSTALLATION_XML_COMPONENT_LIBRARY_FILES = 16
const int FW_INSTALLATION_XML_COMPONENT_SCRIPT_FILES = 17
const int FW_INSTALLATION_XML_COMPONENT_OTHER_FILES = 18
const int FW_INSTALLATION_XML_DESC_FILE = 19
const int FW_INSTALLATION_XML_COMPONENT_DONT_RESTART = 20
const int FW_INSTALLATION_XML_COMPONENT_CONFIG_FILES_WINDOWS = 21
const int FW_INSTALLATION_XML_COMPONENT_CONFIG_FILES_LINUX = 22
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_PVSS_VERSION = 23
const int FW_INSTALLATION_XML_COMPONENT_STRICT_PVSS_VERSION = 24
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_PVSS_PATCH = 25
const int FW_INSTALLATION_XML_COMPONENT_PREINIT_SCRIPTS = 26
const int FW_INSTALLATION_XML_COMPONENT_UPDATE_TYPES = 27
const int FW_INSTALLATION_XML_COMPONENT_FILES = 28
const int FW_INSTALLATION_XML_COMPONENT_POST_INSTALL_SCRIPTS_CURRENT = 29
const int FW_INSTALLATION_XML_COMPONENT_POST_DELETE_SCRIPTS_CURRENT = 30

Detailed Description

This package contains functions to manipulate the component XML description files

Author:
Fernando Varela (EN-ICE)
Date:
August 2010

Function Documentation

int fwInstallationXml_childNodesContent ( unsigned  doc,
int  node,
dyn_string &  node_names,
dyn_anytype &  attributes,
dyn_string &  nodevalues,
dyn_string &  exceptionInfo 
)

'fwInstallation_xmlChildNodesContent()' this function is a copy of 'fwXml_childNodesContent' and it should be eventually replace once the fwXml.ctl is widely distributed. It returns tags, attributes and contained data of all children

Constraints
None
Usage
Public
PVSS managers
UI, CTRL
Parameters:
doc input, the document identifier
node input, the node identifier of the parent element-node container
node_names output, the node-names or tag-names for element-nodes
attributes output, the attributes of element-nodes and added infomation
nodevalues output, the node-values or values of the unique child's text-node
exceptionInfo inout, returns details of any exceptions
Returns:
output, the combined types of the type of children which data is returned
When used for simple Xml-file structures
If the function returns '0' (zero), then the child-nodes are all element-nodes which contain at most one text-node as their child. The following is returned via the three output-parameters: 'node_names' returns the tag-names of the element-nodes, 'attributes' returns all the attributes of the element-nodes, 'nodevalues' returns the value (character-data) of the contained text-node if present, otherwise it returns the empty string.
A typical example is included in the example-panel "xmlChildNodesContentExample.pnl" (first push-button). The Xml-file "xmlExampleFlatListing.xml" can be completely read by issuing one single call to this function - specify for the 'node' variable the node-identifier of the element-node called "<room>".
Note that this function was created especially for users who want to parse Xml-files of a structure which corresponds to the above description. Only read further if you want to use this function to parse more complex Xml-file structures.
When used for complex Xml-file structures
If any of the child-nodes is different from an element-node which contains at most one text-node as its child, then the return-code will be different from '0' and will be more specific the bitwise OR-ed values which are obtained by shifting the value '1' to the left by a number of places which corresponds to the internal enumerated value of the node-type.
An example will illustrate this much easier. Refer again to the example-panel "xmlChildNodesContentExample.pnl" (second push-button). The Xml-file corresponds this time to "xmlExampleGreatText.xml". In this example there is in addition to the above at least one text-node as a direct child (not as a child of an element-node). In that case, the return-code is '8' - this is obtained by shifting '1' to the left by XML_TEXT_NODE places (1<<XML_TEXT_NODE) [1<<3].
For nodes which are not element-nodes, the returned values are: 'node_names' returns the node-name of the node as queried by 'xmlNodeName', 'attributes' returns a single mapping "[fwInstallation_Xml_CHILDNODESTYPE;(int)<node-type>]" which indicates the node-type of the node, 'nodevalues' returns the node-value of the node as queried by 'xmlNodeValue'.
If there is additionally at least one child-node with more than one child or with a child which is not a text-node then the return-code will have the bit-value '2' also set. The same example-panel "xmlChildNodesContentExample.pnl" illustrates this. Third button parses the "xmlExampleHierarchical.xml" Xml-file - return-code corresponds to '2' (1<<XML_ELEMENT_NODE) [1<<1]. Fourth button parses the Xml-file "xmlExampleMoreComplex.xml" - return-code corresponds to '10' - obtained by bitwise OR-ing of (1<<XML_ELEMENT_NODE) and (1<<XML_TEXT_NODE) which is [(1<<1)|(1<<3)].
For element-nodes with more than one child or with a child which is not a text-node, the returned values are: 'node_names' returns the tag-name of the node, 'attributes' returns all the attributes of the element-nodes with additionally the two following added mappings "[fwInstallation_Xml_CHILDNODESTYPE;(int)XML_ELEMENT_NODE]" which is the node-type and "[fwInstallation_Xml_CHILDSUBTREEID;(int)<element-node-identifier>]", 'nodevalues' returns the empty string.
int fwInstallationXml_create ( string  pathName,
string  componentName,
string  componentVersion,
string  componentDate,
dyn_string  requiredComponents,
bool  isSubComponent,
dyn_string  initScripts,
dyn_string  deleteScripts,
dyn_string  postInstallScripts,
dyn_string  postDeleteScripts,
dyn_string  configFiles,
dyn_string  asciiFiles,
dyn_string  panelFiles,
dyn_string  scriptFiles,
dyn_string  libraryFiles,
dyn_string  otherFiles,
string  dontRestartProject,
dyn_string &  xmlDesc 
)

This function creates a component description file (xml).

Parameters:
pathName (in) path for the output file {if empty, only create xmlDesc}
componentName (in) name of the component {required}
componentVersion (in) version number of the component {required}
componentDate (in) date of the component {will set current date if empty}
requiredComponents (in) list of required components (componentName=minimalVersionNumber)
isSubComponent (in) TRUE if subcomponent
initScripts (in) scripts to be run during installation
deleteScripts (in) scripts to be run during deletion
postInstallScripts (in) scripts to be run after installation and subsequent restart {
postDeleteScripts (in) scripts to be run after deletion and subsequent restart
configFiles (in) config files for the project {need to be in ./config/, do not specify path}
asciiFiles (in) dplist files for the project {need to be in ./dplist/, do not specify path}
panelFiles (in) panel files for the project {need to be in ./panels/, do only specify sub-path}
scriptFiles (in) script files for the project {need to be in ./scripts/, do only specify sub-path}
libraryFiles (in) library files for the project {need to be in ./scripts/libs/, do only specify sub-path}
otherFiles (in) miscellaneous files for the project {do only specify sub-path from PROJ_PATH}
dontRestartProject (in) flag indicating if the restart of the project can be omitted after the installation of the component
xmlDesc (out) complete xml description
Returns:
0 - xml file created, -1 - file creation failed, -2 - parameters missing
Author:
Sascha Schmeling and Fernando Varela.
int fwInstallationXml_decode ( string  strComponentFile,
string &  componentName,
string &  componentVersion,
string &  date,
dyn_string &  dynRequiredComponents,
bool &  isSubComponent,
dyn_string &  dynInitFiles,
dyn_string &  dynDeleteFiles,
dyn_string &  dynPostInstallFiles,
dyn_string &  dynPostDeleteFiles,
dyn_string &  dynConfigFiles_general,
dyn_string &  dynConfigFiles_windows,
dyn_string &  dynConfigFiles_linux,
dyn_string &  dynDplistFiles,
dyn_string &  dynPanelFiles,
dyn_string &  dynScriptFiles,
dyn_string &  dynLibFiles,
dyn_string &  dynComponentFiles,
dyn_string &  dynSubComponents,
dyn_string &  dynScriptsToBeAdded,
dyn_string &  dynFileNames,
string &  dontRestartProject 
)

This function decodes an XML file (obsolete, legacy)

Parameters:
strComponentFile (in) XML file loaded into a string
componentName (out) name of the component
componentVersion (out) version of the component
date (out) date when the component was packaged
dynRequiredComponents (out) list of required components
isSubComponent (out) flag indicating if the component is a subcomponent
dynInitFiles (out) list of init scripts
dynDeleteFiles (out) list of delete scripts
dynPostInstallFiles (out) list of post-install scripts
dynPostDeleteFiles (out) list of post-delete scripts
dynConfigFiles_general (out) list of config files for both Windows and Linux
dynConfigFiles_windows (out) list of config files specific for Windows
dynConfigFiles_linux (out) list of config files specific for Linux
dynDplistFiles (out) list of dpl files
dynPanelFiles (out) list of panels
dynScriptFiles (out) list of scripts
dynLibFiles (out) list of libraries
dynComponentFiles (out) full list of component files
dynSubComponents (out) list of subcomponents
dynScriptsToBeAdded (out) list of scripts (legacy, obsolete)
dynFileNames full (out) list of files (legacy, obsolete)
dontRestartProject (out) flag indicating if the restart of the project can be omitted after the installation of the component
Returns:
0 if OK, -1 if error
int fwInstallationXml_get ( string  docPath,
dyn_string &  tags,
dyn_string &  values,
dyn_anytype &  attribs 
)

This function retrieves the contents of an XML file

Parameters:
docPath (in) XML file to be parsed
tags (out) XML tags in the file as an dyn_string array
values (out) values of the XML tags
attribs (out) tag attributes
Returns:
0 if OK, -1 if error
int fwInstallationXml_getTag ( string  docPath,
string  tag,
dyn_string &  FilteredValues,
dyn_anytype &  FilteredAttribs 
)

This function the value and attributes of all entries in a XML file for a particular tag

Parameters:
docPath (in) XML file to be parsed
tag (in) XML tag to look for
FilteredValues (out) values of the XML tags
FilteredAttribs (out) tag attributes
Returns:
0 if OK, -1 if error
int fwInstallationXml_load ( string  fileName,
dyn_dyn_mixed &  componentInfo 
)

This function loads the contents of a component XML file into a dyn_dyn_mixed matrix

Parameters:
fileName (in) fileName name of the component xml file
componentInfo (out) XML file contents as a dyn_dyn_mixed matrix
Returns:
0 if OK, -1 if error
int fwInstallationXml_parseFile ( string  sourceDir,
string  descFile,
string  subPath,
string  destinationDir,
dyn_dyn_mixed &  parsedComponentInfo 
)

This funcion parses a XML file. Contrarily to fwInstallationXML_load, this function prepends the relative destination path to the files

Parameters:
sourceDir (in) source directory
descFile (in) XML description file
subPath (in) path to the appended to the source directory
destinationDir (in) destination directory where the component will be installed
parsedComponentInfo (out) resulting component info
Returns:
0 if OK, -1 if error

Variable Documentation

const string csFwInstallationXmlLibVersion = "5.0.0"

Version of this library. Used to determine the coherency of all libraries of the installtion tool

const string fwInstallation_Xml_CHILDNODESTYPE = "fwXml_ChildNodesType"

Constant used in the mapping that identifies the node-type of the node in question

const string fwInstallation_Xml_CHILDSUBTREEID = "fwXml_ChildSubTreeId"

Constant used in the mapping that identifies the node-identifier of the node in question

 All Files Functions Variables