XML: A Managers Guide (2nd Edition) (Addison-Wesley Information Technology Series)
Business Challenge
Many software developers use configuration files, so users or administrators can specify application execution parameters. Such files are often referred to as "configuration files," "deployment descriptors," or "property sheets." For example, the file may describe the properties of a software component or the execution options for an application. A common problem in using configuration files is enabling third-party development tools to create them. For the development tool provider, a significant amount of work is often necessary to produce a properly formatted file. Software developers use logging files to track such information as usage, application statistics, and debugging data. A common problem in using logging files is enabling users or administrators to view them and third-party analysis tools to process them. A significant amount of work is often necessary to interpret the file format properly. For example, it is often hard for administrators to reconstruct what happened in a user's Web session. If the user 's shopping cart suddenly dies with thousands of dollars of merchandise selected, you might want to know why. But reconstructing the series of electronic events from the Web server log, the application server log, the DBMS log, the network logs, and the machine logs is almost impossible because they are all in vastly different formats. XML Benefit
Using XML as the format for application input and output files makes it easier for everyone. By using off-the-shelf XML processors, software developers avoid the low-level work of file manipulation. More important, XML schemas make it possible to define file formats quickly and unambiguously. With access to the schema, software development tool and analysis tool vendors can leverage off-the-shelf processors to reduce the amount of work necessary to produce and interpret different file formats. Also, by defining an XSL stylesheet for input and output files, software developers make it easy for users and administrators to view the information in the files with their Web browsers. Sun's J2EE standard uses an XML deployment descriptor to configure the transaction and security properties of server-side Java components . A small company called TeaLeaf Technologies has an XML logging format that enables customers to address the problem of reconstructing Web sessions. Architecture
As shown in Figure 8-4, deployment tools create XML configuration documents and store them on disk. The application then reads them from the disk and uses the information they contain to control application execution. As the application generates appropriate data, it saves XML logging files to disk. Analysis tools or Web browsers then access the recorded information. Note that the same process is possible over a network instead of through the filesystem. Administrators could centralize the control of applications by pointing them to a networked repository of configuration files. Distributed application nodes could send logging over the network to a central location to facilitate the analysis of information from all nodes. Figure 8-4. Configuration and Logging Files Architecture
Key Features
The distinguishing feature of XML configuration and logging files is that they are directly related to application execution. XML input files control application execution. XML output files contain the results of application execution. Development Process
For each type of file, you have to map the data types to an XML schema. For configuration files, your developers must write the code that takes the data extracted by the XML processor from input documents and puts it into the appropriate internal data structures. For logging files, your developers must write the code that takes the output data from its internal data structures and passes it to the XML processor so that it can construct output documents. Schema Source
In some cases, there may be standard schemas. Some software component standards include schemas that define the format for the configuration file. Certain types of output files such as transaction or security logs might also have standard schemas. But because of the wide variety of possible configuration and logging files, as well as the ease of using XML for this purpose, you may often design such schemas yourself. Document Life Cycle
Software development tools or even text editors create input documents and save them to disk. The application then consumes these input documents during application execution. Also, during execution, the application creates output documents and saves them to disk. Analysis tools consume these output documents. Both input and output documents remain on disk until explicitly destroyed . Configuration and archiving tools may also maintain repositories of these documents. |