Abstract:
A system and method for storing object information on a persistent medium. A DefaultEncoderDecoder is supplied that encodes object persistent attribute data into a string of attribute names, types and data values. The encoding and decoding is managed by one or more get and one or more set methods. The get methods control storing of the data while set methods control restoring of persistent data. Encoded strings of attribute data are upwardly compatible through replacement or overriding of the set methods.

Description:
This invention is related to commonly assigned patent applications Ser. No. 08/018,608, now abandoned, and Ser. No. 08/018,893 filed Feb. 17, 1993, respectively. 
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to data processing systems and more particularly to systems for creating application programs or operating system programs. Still more particularly, the present invention relates to object oriented systems having persistent object storage functions operable to store and restore persistent objects without operator modification. 
     2. Background and Related Art 
     The development of application and system software for data processing systems has traditionally been a time consuming task. The field of software engineering has attempted to overcome the limitations of traditional techniques by proposing new, more efficient software development models. Object oriented programming has emerged as a promising technology that will allow rapid development, implementation and customization. Each object has certain data attributes and processes or methods that operate on that data. Data is said to be &#34;encapsulated&#34; by an object and can only be modified by the object methods. Methods are invoked by sending a message to an object identifying the method and supplying any needed arguments. 
     Object oriented systems have two important properties in addition to encapsulation. &#34;Inheritance&#34; is the ability to derive a new object from an existing object and inherit all properties, including methods and data structure, from the existing object. The new object may have certain unique features which are supplied as overrides or modifications to the existing class. I.e. a new subclass needs to specify only the functions and data that distinguish that class from the existing more general class. 
     The ability to override an existing method description enables polymorphism, the ability to have a single message to an object be processed in different ways depending on the object itself. 
     Inheritance and polymorphism create a powerful structure for implementing new software systems. The software developer does not have to develop each piece of a system, he or she need only specify the unique features of the system. 
     The power of object oriented systems is realized through the development of system &#34;frameworks.&#34; A framework is a collection of base classes that can be used by a system implementor to create a final systems product. The framework is defined and developed to work together as a system. Conceptually, the framework is much like a set of standard hardware components used by computer hardware builders. Each of the components has certain defined functions and interfaces and the engineer assembles these components according to a particular design to create a unique hardware system. 
     Objects created by a data processing system are typically maintained in the volatile memory of those systems. This allows faster processing, but does not provide a means to store data. Object oriented systems solve this problem by implementing &#34;persistent objects.&#34; &#34;Persistence&#34; means that an object&#39;s state can be preserved beyond the termination of the process that created that object. The persistent framework include methods that allow persistent objects to be stored in and retrieved from a non-volatile medium such as a hard disk drive or writable optical disk. Objects can be stored individually or grouped with other objects. 
     The use of Persistent Streams to capture and retain database queries and results is discussed in U.S. Pat. No. 5,161,225 to Abraham et al., commonly assigned. 
     Existing persistent object systems are limited by their fixed implementation of object storage. A particular object oriented product typically provides one mechanism for storing persistent objects. This mechanism includes a definition of the non-volatile medium used, the structure of object groups stored on the medium and the structure of each particular object stored on the medium. 
     Fixed implementations of persistent objects limit the developer flexibility to change persistent object storage to meet particular system requirements. A fixed storage scheme requires that the method for restoring data remains constant thereby constraining the developers from improving or enhancing the application. A change to the number or types of parameters to which an object responds would prevent restoration of previously stored objects in a fixed storage system. 
     Fixed implementations have the advantage, however, of requiring no coding effort by the developer before being able to store persistent objects. The developer frequently does not have the time or training to be able to develop a customized persistent storage framework. These developers need an ability to store persistent data in a flexible framework without the concerns of later system incompatibility and without the need to devise their own storage mechanism. 
     The existing technical problem addressed by the present invention is to provide a persistent object framework that provides flexible and upwardly compatible persistent object storage without requiring developer coding of the storage methods. 
     SUMMARY OF THE INVENTION 
     It is therefore an object of the present invention to provide a persistent object system that enables persistent storage and retrieval of objects without requiring programming by the operator. 
     It is yet another object of the invention to provide an object framework that allows restoration of persistent objects without storing persistent object format information with the object. 
     It is still another object of the invention to provide persistent data storage that is upwardly compatible using object oriented techniques. 
     The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular description of a preferred embodiment of the invention, as illustrated in the accompanying drawing wherein like reference numbers represent like parts of the invention. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     FIG. 1 is a block diagram of system on which the present invention operates. 
     FIG. 2 is an illustration of an object according to the present invention. 
     FIG. 3 is a hierarchical representation of classes in the preferred embodiment. 
     FIG. 4a and 4b are representations of a persistent data storage group skeletal framework. 
     FIG. 5 is a flowchart depicting the DefaultEncoder process according to the present invention. 
     FIG. 6 is a flowchart depicting the DefaultDecode process according to the present invention. 
    
    
     DETAILED DESCRIPTION 
     The preferred embodiment will be described with reference to the above figures. 
     An object oriented programming system operates on a computer system such as that shown in FIG. 1. The computer system can be a &#34;Personal Computer&#34;, workstation, minicomputer or mainframe type of computer. FIG. 1 illustrates a personal computer such as the IBM PS/2 Model 95 computer (IBM and PS/2 are trademarks of the IBM Corporation.) The computer typically includes a system unit 100 which contains a processor or CPU 102 and memory 104. An object oriented program 106 operates on the processor and is resident in memory 104. The system will typically have a display device 108 such as a color or monochrome CRT, a keyboard 110, a pointing device 112 such as a mouse or trackball, a fixed disk drive 114, and optionally, a network connection 116 to a LAN or other network. 
     An object encapsulates data and the methods needed to operate on that data. Objects can be represented by a &#34;doughnut diagram&#34; such as shown in FIG. 2. Object data is shown in the center 202 surrounded by the applicable methods 204 to 214. Data 202 may be modified only by the methods of that object. Methods 204-214 are invoked by receiving messages from other objects. A typical object oriented system will have a message router 220 that routes messages between objects. Thus, object 230 causes Method C 208 to be invoked by sending a message 232 to the message router that in turn sends it 222 to Method C 208 of object 200. 
     Object frameworks are constructed to provide a set of objects for application and system developers to use to construct a delivered system. The IBM System Object Model (SOM) framework, for example, provides a language independent set of objects for use in systems development. The IBM OS/2 Version 2.0 Workplace Shell is an example of an application developed using such an environment. 
     Objects are grouped into classes of related objects. The class description contains information relevant to all objects in a class, including a description of instance variables maintained by each of the objects and the available object methods. An object instance is created (or &#34;instantiated&#34;) based on that information and has the properties defined in the object class. For example, the object class DOG can include the instance variables &#34;dog --  type&#34; and &#34;dog --  name&#34; and a &#34;bark&#34; method implementing the response to a bark message. An instance of dog, e.g. ROVER, will maintain the type and name instance variables for itself and will respond to the bark message. 
     Abstract classes are used to describe the interfaces and methods expected to be used by a class without providing detail on the implementation of those methods. Abstract classes are useful in frameworks where the implementation details are to be left to the implementor. Concrete classes are created as subclasses of abstract classes and implement those classes. 
     Classes in an object oriented system are often derived from some single base class. This base class is named &#34;SOMObject&#34; in the IBM System Object Model. FIG. 3 illustrates the preferred embodiment of the present invention by showing the class hierarchy for Persistent Objects using the System Object Model. 
     The class &#34;PersistentObject&#34; 304 is a subclass of SOMObject 302 and contains the methods and variables necessary to create persistent objects. Because it is a subclass of SOMObject it inherits all methods and variables known to SOMObject. Also derived from SOMObject 302 are PersistentStorageManager 306, IOGroupManager 308, and EncoderDecoder 310. These subclasses are abstract classes for implementing overall management of persistent objects (PersistentStorageManager), for controlling the structure and grouping of persistent objects on the persistent object storage medium (IOGroupManager), and for writing object information to the storage medium (EncoderDecoder.) 
     The IOGroupManager abstract class 308 controls the grouping and organization of groups of objects on the persistent storage medium. Persistent objects are stored in related groups of objects. The structure of object group storage is called the Group Skeletal Format and defines a skeleton within which the objects are stored. The most straightforward structure is storing the object description in plain ASCII text with objects stored sequentially within a group. FIG. 4 illustrates the group skeletal format for this object structure. 
     The group skeletal format 400 contains a Object Group Header 402 that contains group data, a number of object separators 404 406 . . . 412 and object storage blocks 414 416 . . . 420. Storage of objects within a storage block 414 is controlled by the EncoderDecoder class. 
     EncoderDecoder 310 functions to reformat object instance data from the internal object storage format to a format that can be written to a persistent storage medium (e.g. a disk.) The persistent format must contain sufficient information to restore the object to internal storage in the same state as when it was written. 
     An EncoderDecoderAbstract class is implemented in the preferred embodiment to define the interfaces to concrete EncoderDecoder subclasses derived by the application developer or developer. The EncoderDecoderAbstract class defines the interface to the following methods. EncoderDecoderWrite formats and writes the instance data of a particular object using a selected media interface. EncoderDecoderRead reads from the selected media interface and restores the object from the persistent format to internal object format. 
     The EncoderDecoder of the present invention sends messages to the selected IOGroupManger for all media specific functions, including preparing the device, opening and closing the device, and physically writing and reading the data from the device. 
     The preferred embodiment of the present invention provides a DefaultEncoderDecoder to implement flexible, generalized storage of object information. The DefaultEncoderDecoder relies on a repository of information about the class of an object including the data types of attributes of the class. It further relies on a means to identify attributes of a class as persistent attributes. The repository used to contain the above information about an object is known as an Interface Repository. Finally, the DefaultEncoderDecoder relies on a &#34;set&#34; and a &#34;get&#34; method for each persistent attribute, a consistent mapping of persistent attribute name to the name of the method used to get/set the attribute and a consistent get/set method signature for each supported data type. The &#34;get&#34; method or methods control storage of the persistent object, while the &#34;set&#34; method or methods control restoration of the object. 
     The preferred embodiment implements attributes as specified by the standards of the Object Management Group. Attributes are the public data associated with objects. Each attribute is required by the standards to have a get and set method. Persistent attributes are indicated by the keyword &#34;persistent&#34; next to the attribute names in the Interface Definition Language (IDL) entries for the object. 
     The DefaultEncoderDecoder is activated when storage of an object is required. The DefaultEncoderDecoder consults the Interface Repository to determine if the object has any data attributes and if so whether any of the data attributes have been identified as persistent. For each of the persistent object data attributes, the DefaultEncoderDecoder consults the Interface Repository to determine the data type of the attribute. Given the name of the persistent attribute and its data type, the DefaultEncoderDecoder constructs a &#34;get&#34; method request. The attribute &#34;get&#34; method is then invoked to retrieve the data to be stored. The DefaultEncoderDecoder generates a stream of data for each persistent data attribute. The stream of data includes the data type of the persistent attribute, the attribute name and the data returned from the attribute &#34;get&#34; method. All basic attribute data types are supported including integers, floating point numbers, character strings, arrays and sequences of these types and structures of any of these types. The resulting stream is concatenated with all streams generated from that object and written to persistent storage. 
     The persistent stream, according to the present invention, is written as an ASCII stream of attribute names and parameters. Although the preferred embodiment writes and ASCII stream, any other format could be used, including EBCDIC or binary. The stream is in a readily parsed format to allow reconstruction of the object. 
     The structure of the object can be understood by reference to the following example: 
     
         ______________________________________interface Person : SOMPPersistentObjectattribute string name;attribute short deptNum;// Attribute get/set methods:void .sub.-- set.sub.-- name(string name);string .sub.-- get.sub.-- name();void .sub.-- set.sub.-- deptNum(short num);short .sub.-- get.sub.-- deptNum();implementation{   // Attribute modifiers identify which   // attributes are persistent   name: persistent;   deptNum: persistent;};};______________________________________ 
    
     The DefaultEncoderDecoder stores the essential object information as an ASCII string having the following preferred format; 
     1. For each persistent attribute in the object: 
     a. number of characters in the persistent attribute name; 
     b. name of attribute; 
     c. data type of the attribute; 
     d. data returned by the attribute &#34;get&#34; method. 
     2. An &#34;End of Attributes&#34; marker to signal the end of the data stream upon restore of the object. 
     The stream of data stored for an instance of the above example object would result in a string such as: 
     
         ______________________________________(4)name(19)David(7)deptNum(20)(987)EOA|||||||.vertline.||||||||.vertline.End of attrib marker|||||||data for attrib &#34;deptNum&#34;||||||data type forattrib &#34;deptNum&#34;|||||name of attribute||||length of next name of attribute|||data for attribute &#34;name&#34;||data type for attribute &#34;name&#34;|name of attributelength of next name of attribute______________________________________ 
    
     The process of the preferred embodiment for encoding object data for persistent storage will be described with reference to FIG. 5. The Persistent Object Manager 306 is instructed by the program to store an object. The PersistentStorageManager in turn instructs an IOGroupManger 308 to instantiate an EncoderDecoder, the DafaultEncoderDecoder according to the present invention, and the DefaultEncoderDecoder invokes the necessary get methods. 
     The process starts at 502 and proceeds to reading the Interface Repository to determine the number and types of data attributes for the class of this object 504. A test for the existence of more attributes is made at 506. If no more attributes exist an &#34;end of attributes&#34; marker is stored 508 and the process terminated 520. If more attributes exist, a test is made to determine if the next attribute is persistent 510. If not, processing returns to test 506. If a persistent attribute is found, the length of the attribute name is stored 512 and the attribute name and type are stored 514. A &#34;get&#34; method request is constructed using the attribute name and data type and the method invoked 516. Finally, the data returned from the &#34;get&#34; method is stored 518 and processing returns to test 506. 
     Objects are restored from persistent storage through the invocation of set methods for the persistent attributes of the object. The request to restore an object is initiated by the program by invoking a method on the Persistent Storage Manager. The Persistent Storage Manager then instantiates an IOGroupManager which in turn instantiates an EncoderDecoder (in this case the DefaultEncoderDecoder.) 
     The restoration of an object is accomplished by the process steps illustrated in FIG. 6. The process starts at 602 and proceeds immediately to step 604 that reads an attribute name from the persistent storage stream. The result is tested to determine whether or not it is an &#34;end of attribute&#34; marker 606. If so, the restoration ends 616. Otherwise, the system reads the attribute type 608, allocates space to hold the restored data 610, and reads the data stream into the allocated space 612. A &#34;set&#34; method is constructed using the attribute name and data type and the method is then invoked 614. Upon return, control passes to step 604. 
     This storage format allows the implementation and even the interface to the object to be changed without loss of persistent data. Upward compatibility of data is controlled by overriding the &#34;set&#34; methods to support the current structure. 
     It will be understood from the foregoing description that various modifications and changes may be made in the preferred embodiment of the present invention without departing from its true spirit. It is intended that this description is for purposes of illustration only and should not be construed in a limiting sense. The scope of this invention should be limited only by the language of the following claims.