Abstract:
A mechanism for maintaining configuration or other vital data outside of source code is disclosed. In accordance with the illustrative embodiment of the present invention, a data manager software component serves as an interface between an external configuration data store and one or more applications, processes, and threads. In contrast with techniques of the prior art, the illustrative embodiment does not suffer from the risk of undetected corruption of vital data, and therefore is especially advantageous in safety-critical systems.

Description:
FIELD OF THE INVENTION 
       [0001]    The present invention relates to computer software in general, and, more particularly, to safety-critical systems. 
       BACKGROUND OF THE INVENTION 
       [0002]    Software systems typically maintain configuration data outside of the source code, as opposed to hard-coded within source code, in order to provide maximum flexibility and extensibility. This approach, however, introduces the risk that configuration data might be corrupted or changed in some other unwanted fashion. Moreover, in a system that supports concurrency, there is the risk that two or more applications, processes, threads, etc. will not have a consistent view of the configuration data. 
         [0003]    In a safety-critical system, configuration data is considered vital, and the foregoing risks are unacceptable. What is needed, therefore, is a mechanism that offers the advantages of maintaining configuration data outside of source code, but that guarantees that (1) no corruption of configuration data occurs prior to initialization, and (2) any change to configuration data that occurs during execution is detected. 
       SUMMARY OF THE INVENTION 
       [0004]    The present invention provides a mechanism in which a safety-critical system can maintain configuration or other vital data outside of source code, without the potential risks associated with techniques of the prior art. In particular, a data manager software component is employed that serves as an interface between an external configuration data store and one or more applications, processes, and threads of the safety-critical system. In accordance with the illustrative embodiment, the data manager component is an object class that implements the Singleton design pattern, which restricts instantiation of the class to a single object. In accordance with the Singleton pattern, the data manager class has a public method getInstance( ) that provides access to the single object, and a constructor that is declared private, thereby preventing the creation of additional objects from outside the class. 
         [0005]    In accordance with the illustrative embodiment, the data manager class also comprises code for obtaining configuration data from an external eXtensible Markup Language (XML) document, where the code is inaccessible from outside of the class. In addition, the data manager class comprises one or more public methods for accessing values of the configuration data, but lacks any public methods for updating the configuration data. 
         [0006]    The illustrative embodiment comprises: a software component for maintaining one or more configuration data across one or more processes, threads, and applications, the software component comprising: code for obtaining one or more values for the configuration data from outside the software component; one or more public methods for accessing values of the configuration data; and a method that returns a singleton instance of the software component; wherein the code is inaccessible from outside of the software component; and wherein the code is the only means in the software component for obtaining a value for the configuration data; and wherein the software component has no public method for updating a value of the configuration data; and wherein the software component has no public constructor. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0007]      FIG. 1  depicts a schematic diagram of the salient elements of a safety-critical software system, in accordance with the illustrative embodiment of the present invention. 
           [0008]      FIG. 2  depicts illustrative contents of configuration data store  102 , as shown in  FIG. 1 , in accordance with the illustrative embodiment of the present invention. 
           [0009]      FIG. 3  depicts a conceptual representation of application  103 - i  during its execution, in accordance with the illustrative embodiment of the present invention. 
           [0010]      FIG. 4  depicts a conceptual representation of process  304 - j  during its execution, in accordance with the illustrative embodiment of the present invention. 
           [0011]      FIG. 5  depicts illustrative code for data manager  101 , as shown in  FIG. 1 , in accordance with the illustrative embodiment of the present invention. 
           [0012]      FIG. 6  depicts illustrative code for application  103 - i , as shown in  FIG. 1 , in accordance with the illustrative embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION 
       [0013]      FIG. 1  depicts a schematic diagram of the salient elements of safety-critical software system  100 , in accordance with the illustrative embodiment of the present invention. As shown in  FIG. 1 , software system  100  comprises data manager  101 , configuration data store  102 , and applications  103 - 1  through  103 -N, where N is a positive integer. 
         [0014]    Data manager  101  is a software component that is capable of obtaining configuration data values from configuration data store  102 , and of controlling access to these values, and is described in detail below and with respect to  FIG. 5 . 
         [0015]    Configuration data store  102  is one of a database, an unstructured file system, a data structure stored in main memory, etc. that is capable of storing configuration data values. In accordance with the illustrative embodiment, configuration data store  102  stores the configuration data values in an eXtensible Markup Language (XML) document, as is described below and with respect to  FIG. 2 . 
         [0016]    Each of applications  103 - 1  through  103 -N, where N is a positive integer, is a computer program that performs a well-defined set of functions in safety-critical system  100 , as is well-known in the art. 
         [0017]      FIG. 2  depicts illustrative contents of configuration data store  102 , in accordance with the illustrative embodiment of the present invention. In the illustrative embodiment, configuration data values are stored in an eXtensible Markup Language (XML) document, a type of document well-known in the art.  FIG. 2  depicts illustrative XML document  200 , in which the configuration data are represented as a set of properties and values. 
         [0018]    As will be appreciated by those skilled in the art, in some other embodiments of the present invention, configuration data values might be stored in an alternative fashion in XML document  200 , while in still other embodiments, configuration data values might be stored in a different kind of document or data structure, rather than an XML document. In any case, it will be clear to those skilled in the art, after reading this disclosure, how to make and use such alternative embodiments of the present invention. 
         [0019]      FIG. 3  depicts a conceptual representation of application  103 - i  during its execution, where i is an integer between 1 and N inclusive, in accordance with the illustrative embodiment of the present invention. As shown in  FIG. 3 , application  103 - i  comprises processes  304 - 1  through  304 -M, where M is a positive integer. 
         [0020]    Each process  304 - j , where j is an integer between 1 and M inclusive, is an instance of a computer program that is spawned during the execution of application  103 - i , as is well-known in the art. 
         [0021]      FIG. 4  depicts a conceptual representation of process  304 - j  during its execution, where j is an integer between 1 and M inclusive, in accordance with the illustrative embodiment of the present invention. As shown in  FIG. 4 , process  304 - j  comprises threads  405 - 1  through  405 -P, where P is a positive integer. 
         [0022]    Each thread  405 - k , where k is an integer between 1 and P inclusive, is a thread of execution within process  304 - j , as is well-known in the art. 
         [0023]      FIG. 5  depicts illustrative code for data manager  101 , in accordance with the illustrative embodiment of the present invention. In accordance with the illustrative embodiment, data manager  101  is a single object class called DataManager. As shown in  FIG. 5 , class DataManager implements the Singleton design pattern, which restricts instantiation of the class to a single object. In particular, class DataManager has a public method getInstance( ) that provides access to the single object, and restricts external access to the class constructor by declaring it private, thereby preventing the creation of additional objects from outside the class. 
         [0024]    The configuration data values are stored in a property list data structure called configData. Class DataManager has two public methods getConfigValue( ) for accessing the configuration data values: one accepts the datum name as its single input parameter, and the other accepts the datum name and a default value. In addition, class DataManager has a private method loadConfigValues( ) that reads the configuration data values from XML document  200 ; this method is invoked by a static initialization block that is automatically executed when the class is loaded. Because data structure configData is declared private, and because the code for reading the configuration data values is encapsulated in a private method, the configuration data values cannot be directly accessed or changed by any of applications  103 - 1  through  103 -N, processes  304 - 1  through  304 -M, or threads  405 - 1  through  405 -P. 
         [0025]    As will be appreciated by those skilled in the art, in some other embodiments of the present invention, data manager  101  might comprise code that is specified in some other object-oriented programming language (e.g., C#, Smalltalk, etc.), or might comprise a plurality of object classes rather than a single object class, or might in fact be specified in a programming language that is not object-oriented (e.g., C, Perl, etc.). In any case, it will be clear to those skilled in the art, after reading this disclosure, how to make and use such alternative embodiments of data manager  101 . 
         [0026]      FIG. 6  depicts illustrative code for application  103 - i , where i is an integer between 1 and N inclusive, in accordance with the illustrative embodiment of the present invention. As shown in  FIG. 6 , the singleton DataManager object is obtained by the public getInstance( ) method, and the configuration data values are obtained by the public getConfigValue( ) methods. As will be appreciated by those skilled in the art, in some embodiments of the present invention, the code depicted in  FIG. 6  might belong to one of processes  304 - 1  through  304 -M spawned by application  103 - i , while in some other embodiments, the code of application  103 - i  depicted in  FIG. 6  might not belong to any of these processes. Moreover, when the code depicted in  FIG. 6  does belong to one of processes  304 - 1  through  304 -M (say process  304 - j ), then in some embodiments of the present invention this code might belong to one of threads  405 - 1  through  405 -P, while in some other embodiments, the code of process  304 - j  depicted in  FIG. 6  might not belong to any of these threads. 
         [0027]    As will be appreciated by those skilled in the art, the specification of safety-critical system  100  as described above and with respect to  FIGS. 1 through 6  guarantees that the values of the configuration data will not be corrupted prior to initialization, and that during execution, any corruption or changes to configuration data values are automatically detected. Consequently, safety-critical software system  100  is said to maintain the vitality of the configuration data. As will be further appreciated by those skilled in the art, in some other embodiments of the present invention, the techniques of the illustrative embodiment might be employed for maintaining the vitality of other kinds of data (i.e., data that might not be related to system configuration). 
         [0028]    It is to be understood that the disclosure teaches just one example of the illustrative embodiment and that many variations of the invention can easily be devised by those skilled in the art after reading this disclosure and that the scope of the present invention is to be determined by the following claims.