The present invention is related to the following applications entitled: “Method And Apparatus In A Data Processing System For Refreshing Multiple Data Models In An Application”, U.S. application Ser. No. 09/429,212, now U.S. Pat. No. 6,779,177 filed on Oct. 28, 1999; “Method and Apparatus in a Data Processing System for Systematically Separating Application Graphical User Interface Component Placement From Component Sequencing And Component Creation”, U.S. application Ser. No. 09/429,522, now U.S. Pat. No. 6,901,554, filed on Oct. 28, 1999; “Method and Apparatus in a Data Processing System For Systematically Separating Application Components From Legacy System Services”, U.S. application Ser. No. 09/430,355, now U.S. Pat. No. 6,829,771, filed on Oct. 28, 1999; “Method and Apparatus in a Data Processing System For The Issuance And Delivery Of Lightweight Requests To Concurrent And Multiple Service Providers”, U.S. application Ser. No. 09/430,814, now U.S. Pat. No. 6,886,170, filed on Oct. 29, 1999; “Method and Apparatus in a Data Processing System For The Controlling And Sequencing Of Graphical User Interface Components And Mediating Access To System Services For Those Components”, U.S. application Ser. No. 09/430,324, now U.S. Pat. No. 6,779,155, filed on Oct. 29, 1999; “Method and Apparatus In A Data Processing System For Defining And Composing Type-Based (Multi-Level) Field Validation and Formatting Rules”, U.S. application Ser. No. 09/430,824, now U.S. Pat. No. 6,654,932, filed on Oct. 29, 1999; “Method and Apparatus in a Data Processing System For The Separation Of Role-Based Permissions Specification From Its Corresponding Implementation Of Its Semantic Behavior”, U.S. application Ser. No. 09/430,861, now U.S. Pat. No. 6,862,686, filed on Oct. 29, 1999; “Method and Apparatus in a Data Processing System For Generating Alternate Views of Client Applications”, U.S. application Ser. No. 09/430,823, now U.S. Pat. No. 6,675,228, filed on Oct. 29, 1999; “Method and Apparatus in a Data Processing System Of Creating Highly Reusable Application Function Sequencers Using Graph-Based Partitioning”, U.S. application Ser. No. 09/429,528, now U.S. Pat. No. 6,782,508, filed on Oct. 28, 1999; “Method and Apparatus in a Data Processing System For Specifying The Sequencing And Mediation Of Application Components”, U.S. application Ser. No. 09/431,429, filed on Oct. 29, 1999; “Method and Apparatus in a Data Processing System For Systematically Serializing Complex Data Structures”, U.S. application Ser. No. 09/429,593, now U.S. Pat. No. 6,862,711, filed on Oct. 28, 1999; “Method and Apparatus in a Data Processing System For Processing Events In An Object Oriented Environment”, U.S. application Ser. No. 09/429,592, now U.S. Pat. No. 6,748,570, filed on Oct. 28, 1999; all of which are assigned to the same assignee.
1. Technical Field
The present invention relates generally to an improved distributed data processing system, and, in particular to an improved system, method, and computer program product within an object oriented environment. Still more particularly, the present invention relates to a system, method, and computer program product for storage of attribute data in an object oriented environment in such a manner as to reduce the logic to store attributes and the amount of storage space for those attributes.
2. Description of Related Art
Object-oriented languages have been employed in creating applications. One of the big advantages of object-oriented languages is the ability to reuse portions of the software code. Reuse of the code is achieved through inheritance. In many cases, inheritance can make development of new classes very simple because the logic of a parent class need not be reinvented for each child of that parent class.
This advantage does not normally apply, however, to functions that act on the attributes of a class. These functions must be rewritten for each subclass so that the attributes of each subclass are acted upon. One such example is when the attributes of an object must be converted to another representation, such as XML data, or a byte stream.
An object identifier (ID) attribute is defined within ID class 12. A first name attribute and a last name attribute are defined within person class 14. A customer number attribute and a last visit date attribute are defined within customer class 16. The object identifier data will be stored in ID class 12. The first name data and last name data will both be stored in the person class 14. The customer number data and last visit date data will both be stored in the customer class 16. Thus, the attribute data is stored within the class in which the associated attribute is defined.
Methods, or logic, that need to act upon all attribute data of object 10 must be written for each class for which one or more attributes are defined. As depicted by
The read and write object methods defined within ID class 22 will read and write only the object ID data, “12345”. The read and write object methods defined within person class 24 will read and write only the first name and last name data, “John” and “Doe”. The read and write object methods defined within customer class 26 will read and write only the customer number and last visit date data, “3413523” and “Mar. 12, 2001”.
Thus, as depicted by
Therefore, it would be advantageous to have an improved method, system, and product for storage of attribute data in an object oriented environment in such a manner as to reduce attribute logic contained in the “readObject” and “writeObject” methods.
A method, system, and computer program product are described for storing attribute data in an object oriented environment. A base class and a subclass are defined within an object. The object is defined within the object oriented environment. An attribute is defined within the subclass. The attribute data defined for the subclass is stored only within the base class, and is not stored within the subclass.
The above as well as additional objectives, features, and advantages of the present invention will become apparent in the following detailed written description.
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
The present invention provides for storage of all attribute data of an object within a specialized base class. The base class is the superclass of the object.
One or more attributes are defined within subclasses of the object. A separate index is defined for and associated with each attribute. The attribute data for an attribute, along with the index defined for that attribute, are both stored in a storage attribute within the base class.
In this manner, no attribute data is stored in the subclasses of the object. All of the attribute data is stored in a storage attribute defined within the base class. By storing all of the attribute data in a base, superclass, the base class has knowledge of and access to all attribute data.
With reference now to the figures,
In the depicted example, a server 304 is connected to network 302 along with storage unit 306. In addition, clients 308, 310, and 312 also are connected to a network 302. These clients 308, 310, and 312 may be, for example, personal computers or network computers. For purposes of this application, a network computer is any computer, coupled to a network, which receives a program or other application from another computer coupled to the network. In the depicted example, server 304 provides data, such as boot files, operating system images, and applications to clients 308–312. Clients 308, 310, and 312 are clients to server 304. Distributed data processing system 300 may include additional servers, clients, and other devices not shown.
In the depicted example, distributed data processing system 300 is the Internet with network 302 representing a worldwide collection of networks and gateways that use the TCP/IP suite of protocols to communicate with one another. At the heart of the Internet is a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational and other computer systems that route data and messages. Of course, distributed data processing system 300 also may be implemented as a number of different types of networks, such as for example, an intranet, a local area network (LAN), or a wide area network (WAN).
Referring to
Peripheral component interconnect (PCI) bus bridge 414 connected to I/O bus 412 provides an interface to PCI local bus 416. A number of modems may be connected to PCI bus 416. Typical PCI bus implementations will support four PCI expansion slots or add-in connectors. Communications links to network computers 308–312 in
Additional PCI bus bridges 422 and 424 provide interfaces for additional PCI buses 426 and 428, from which additional modems or network adapters may be supported. In this manner, server 400 allows connections to multiple network computers. A memory-mapped graphics adapter 430 and hard disk 432 may also be connected to I/O bus 412 as depicted, either directly or indirectly.
Those of ordinary skill in the art will appreciate that the hardware depicted in
The data processing system depicted in
With reference now to
An operating system runs on processor 502 and is used to coordinate and provide control of various components within data processing system 500 in
Those of ordinary skill in the art will appreciate that the hardware in
For example, data processing system 500, if optionally configured as a network computer, may not include SCSI host bus adapter 512, hard disk drive 526, tape drive 528, and CD-ROM 530, as noted by dotted line 532 in
The depicted example in
Base class 602 includes a storage attribute, “Object[ ] data” which is the Java definition for an array of objects of type “Object”. All attribute data of object 600 will be stored in this storage attribute. Programmers with ordinary skill in the art will realize that other data storage structures such as a vector could be used instead.
The number of attributes defined by all of the subclasses of object 600 must be provided to base class 602 when object 600 is created. Base class 602 then sets aside the required array size to accommodate the total number of attributes. When object 600 is created these indexes are predefined and associated with particular attributes. Subclasses may access their attribute data by referencing the appropriate array index.
An object identifier (ID) attribute is defined within ID class 604. An index of “0” is defined and associated with the object identifier attribute. The object identifier data is not stored in the ID class 604. The object identifier data is stored in the “Object[ ] data” attribute at the “0” index.
A first name attribute and a last name attribute are defined within person class 606. An index of “1” is defined and associated with the first name attribute, and an index of “2” is defined and associated with the last name attribute. The first name data is stored in the “Object[ ] data” attribute at the “1” index. The last name data is stored in the “Object[ ] data” attribute at the “2” index.
A customer number attribute and a last visit date attribute are defined within customer class 608. An index of “3” is defined and associated with the customer number attribute, and an index of “4” is defined and associated with the last visit date attribute. The customer number data is stored in the “Object[ ] data” attribute at the “3” index. The last visit date data is stored in the “Object[ ] data” attribute at the “4” index.
Thus, all of the attribute data for object 600 is stored in the base class within the storage attribute, “Object[ ] data”. None of this attribute data is stored within ID class 604, person class 606, or customer class 608.
In order to prevent errors and allow for the classes to be more easily maintained, a constant should be defined in each class to indicate the last index used by that class. Each subclass should define their indexes relative to the last index used by the super class, indicated by the constant. When an attribute is added to a class, the last index will be updated and all of the subclasses, through the use of the constant, will be automatically updated.
Because all of the attribute data is stored within the base class, methods that need to act upon all attribute data need to be written only for the base class. As depicted by
One particular example of a case where all attribute data defined for an object needs to be acted upon is when the object is serialized or deserialized. When an object is serialized, all of the attribute data of the object is written to a data stream. When an object is deserialized, all of the attribute data of the object is read from a data stream. Using the present invention, this process of writing and reading all of the attribute data of an object may be accomplished by providing read and write methods only for the base object.
Within the write method, all of the attribute data must be written to a data stream. To accomplish this using the present invention, the size of the data array containing all of the attribute data should be written to the data stream first. After the size of the array is written, each of the elements in the array should also be written to the data stream.
When reading the data from the stream, the information must be read in the same order as it was written. In this case, the size of the data array will be read first. This value is used to create a new data array which will be used to store the attributes. Each of the attributes that were written to the data stream will then be read and put in the data array at the appropriate index.
The value of the present invention is that all of this logic is contained within a single class. To use a different algorithm for reading and writing the attribute values, the change can be made easily in a single place.
The present invention may be utilized in a serialization and deserialization process such as depicted by
The present invention is related to the subject matter of U.S. Pat. No. 6,292,933 issued to Peter C. Bahrs et al. on Sep. 18, 2001, which is hereby incorporated by reference.
It is important to note that while the present invention has been described in the context of a fully functioning data processing system, those of ordinary skill in the art will appreciate that the processes of the present invention are capable of being distributed in the form of a computer readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution. Examples of computer readable media include recordable-type media such a floppy disc, a hard disk drive, a RAM, and CD-ROMs and transmission-type media such as digital and analog communications links.
The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. For example, although the depicted architectural pattern is illustrated in a Java programming environment, the architectural pattern of the present invention may be applied to other types of programming environments. For example, VisualBasic, C++ and Smalltalk are other programming environments in which the processes of the present invention may be applied. In addition, the description of the classes along with the variables, constructors, and methods are provided for purposes of illustration only. Classes, variables, constructors, and methods may vary depending on the particular implementation. Illustration of these classes, variables, constructors are for illustrative purposes and not intended to limit the architectural pattern of the present invention. The embodiment was chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.
Number | Name | Date | Kind |
---|---|---|---|
4649473 | Hammer et al. | Mar 1987 | A |
4816653 | Anderl et al. | Mar 1989 | A |
5233686 | Rickenbach et al. | Aug 1993 | A |
5317741 | Schwanke | May 1994 | A |
5317746 | Watanabe | May 1994 | A |
5369778 | San Soucie et al. | Nov 1994 | A |
5396630 | Banda et al. | Mar 1995 | A |
5408650 | Arsenault | Apr 1995 | A |
5408659 | Cavendish et al. | Apr 1995 | A |
5418961 | Segal et al. | May 1995 | A |
5438676 | Schwanke | Aug 1995 | A |
5560014 | Imamura | Sep 1996 | A |
5566330 | Sheffield | Oct 1996 | A |
5634124 | Khoyi et al. | May 1997 | A |
5675755 | Trueblood | Oct 1997 | A |
5704029 | Wright, Jr. | Dec 1997 | A |
5710920 | Maruyama et al. | Jan 1998 | A |
5713045 | Berdahl | Jan 1998 | A |
5724589 | Wold | Mar 1998 | A |
5752018 | Sheffield | May 1998 | A |
5758152 | LeTourneau | May 1998 | A |
5761509 | Danforth et al. | Jun 1998 | A |
5764230 | Baradel et al. | Jun 1998 | A |
5787431 | Shaughnessy | Jul 1998 | A |
5801701 | Koppolu et al. | Sep 1998 | A |
5805892 | Nakajima | Sep 1998 | A |
5812849 | Nykiel et al. | Sep 1998 | A |
5819055 | MacLean et al. | Oct 1998 | A |
5822580 | Leung | Oct 1998 | A |
5835914 | Brim | Nov 1998 | A |
5838969 | Jacklin et al. | Nov 1998 | A |
5892510 | Lau et al. | Apr 1999 | A |
5893118 | Sonderegger | Apr 1999 | A |
5926177 | Hatanaka et al. | Jul 1999 | A |
5973702 | Orton et al. | Oct 1999 | A |
5974428 | Gerard et al. | Oct 1999 | A |
5983384 | Ross | Nov 1999 | A |
6002874 | Bahrs et al. | Dec 1999 | A |
6003037 | Kassabgi et al. | Dec 1999 | A |
6003042 | Melahn | Dec 1999 | A |
6023271 | Quaeler-Bock et al. | Feb 2000 | A |
6026413 | Challenger et al. | Feb 2000 | A |
6029182 | Nehab et al. | Feb 2000 | A |
6035303 | Baer et al. | Mar 2000 | A |
6052528 | Dechamboux | Apr 2000 | A |
6054985 | Morgan et al. | Apr 2000 | A |
6054996 | Bardon et al. | Apr 2000 | A |
6064382 | Diedrich et al. | May 2000 | A |
6085120 | Schwerdtfeger et al. | Jul 2000 | A |
6091411 | Straub et al. | Jul 2000 | A |
6108583 | Schneck et al. | Aug 2000 | A |
6112024 | Almond et al. | Aug 2000 | A |
6115646 | Fiszman et al. | Sep 2000 | A |
6134676 | VanHuben et al. | Oct 2000 | A |
6138269 | Ball et al. | Oct 2000 | A |
6148306 | Seidl et al. | Nov 2000 | A |
6167523 | Strong | Dec 2000 | A |
6169546 | Bogdan | Jan 2001 | B1 |
6175364 | Wong et al. | Jan 2001 | B1 |
6177936 | Cragun | Jan 2001 | B1 |
6182154 | Campagnoni et al. | Jan 2001 | B1 |
6185583 | Blando | Feb 2001 | B1 |
6185590 | Klein | Feb 2001 | B1 |
6185684 | Pravetz et al. | Feb 2001 | B1 |
6202207 | Donohue | Mar 2001 | B1 |
6208339 | Atlas et al. | Mar 2001 | B1 |
6208994 | Abdelnur | Mar 2001 | B1 |
6211872 | Matsutsuka et al. | Apr 2001 | B1 |
6230159 | Golde | May 2001 | B1 |
6237011 | Ferguson et al. | May 2001 | B1 |
6249284 | Bogdan | Jun 2001 | B1 |
6272641 | Ji | Aug 2001 | B1 |
6275228 | Cataudella | Aug 2001 | B1 |
6275232 | Cataudella et al. | Aug 2001 | B1 |
6292803 | Richardson et al. | Sep 2001 | B1 |
6292933 | Bahrs et al. | Sep 2001 | B1 |
6295553 | Gilbertson et al. | Sep 2001 | B1 |
6307571 | Mozdzer et al. | Oct 2001 | B2 |
6330659 | Poff et al. | Dec 2001 | B1 |
6335741 | Nock | Jan 2002 | B1 |
6355741 | Marechal | Mar 2002 | B1 |
6362839 | Hamilton et al. | Mar 2002 | B1 |
6425126 | Branson et al. | Jul 2002 | B1 |
6438617 | Savitzky et al. | Aug 2002 | B1 |
6442620 | Thatte et al. | Aug 2002 | B1 |
6442754 | Curtis | Aug 2002 | B1 |
6457142 | Klemm et al. | Sep 2002 | B1 |
6469714 | Buxton et al. | Oct 2002 | B2 |
6493871 | Welch et al. | Dec 2002 | B1 |
6532498 | Hager et al. | Mar 2003 | B1 |
6539388 | Hattori et al. | Mar 2003 | B1 |
6556218 | Alcorn | Apr 2003 | B1 |
6557046 | McCauley, III et al. | Apr 2003 | B1 |
6560770 | Saxena et al. | May 2003 | B1 |
6590594 | Bates et al. | Jul 2003 | B2 |
6611498 | Baker et al. | Aug 2003 | B1 |
6615258 | Barry et al. | Sep 2003 | B1 |
6654932 | Bahrs et al. | Nov 2003 | B1 |
6675228 | Bahrs et al. | Jan 2004 | B1 |
6748570 | Bahrs et al. | Jun 2004 | B1 |
6772172 | Leong et al. | Aug 2004 | B2 |
6779155 | Bahrs et al. | Aug 2004 | B1 |
6779177 | Bahrs et al. | Aug 2004 | B1 |
6782508 | Bahrs et al. | Aug 2004 | B1 |
6829771 | Bahrs et al. | Dec 2004 | B1 |
6862686 | Bahrs et al. | Mar 2005 | B1 |
6862711 | Bahrs et al. | Mar 2005 | B1 |
6886170 | Bahrs et al. | Apr 2005 | B1 |
6901554 | Bahrs et al. | May 2005 | B1 |
20020109734 | Umezu et al. | Aug 2002 | A1 |
20020152294 | Evans et al. | Oct 2002 | A1 |
20020188592 | Leonhardt et al. | Dec 2002 | A1 |
Number | Date | Country | |
---|---|---|---|
20030131341 A1 | Jul 2003 | US |