How To Managed Serialized Data Over Multiple Application Versions

Lately I've been struggling with deciding how to deal with serialized data between application versions. Assume you have some software that has to be able to save data files. As the application evolves, the data format changes. The application needs to be able to load data saved from prior application versions.
When I first started out I just used a Serializable class. It was quick and easy. However, as newer versions used slightly different data formats, I had to come up with a means to upgrade the data to the latest version. Initially I created a process where the latest data class knows how to upgrade from prior data class versions. Then, when loading data in the application, if the class doesn't match the latest data class version, it checks to see if it matches one of the versions that can be upgraded.
This sort of works, but still has one glaring problem. The old data classes must be etched in stone; never altered. For ever and ever. You can get away with certain simple updates to older data classes by defining a serialVersionUID and keeping it's value the same. But this doesn't always work. What if my overall package structure changes? I have to ensure that the old data classes remain in the same older package structures. Not ideal.
So I've started considering other ways to serialize data...a process where the data can be broken down into core Java classes. There are serializers for serializing to XML, but I don't feel that XML is an appropriate storage format for the data. I'm also considering using a custom built serializer that uses introspection in some fashion.
Before I go any further, however, I'd like to solicit some suggestions. Do you know of any serialization packages that might help me? Do you have any suggestions on what might be a good custom solution? Will Externalizable make this easier? (I've never used Externalizable before...looks like maybe it could help, but even that appears to be vulnerable to refactors that change package structure).
Thanks for your thoughts.

I've continued to work on my own custom serialization process as described in my previous post. Here is how it currently works:
In the example there is a class named ExampleSubClass identified by the String "xsub" of version "1.0". It is saved and then reloaded into a class named RevisedExampleSubClass identified by the String "xsub" of version "1.1". The String "xsub" identifies what the class represents, which allows the class and package to change as needed. Fields can be added, removed, or converted through the optional serialConvert method.
public class ExampleSubClass extends ExampleSuperClass {
     private static final String serialId = "xsub";
     private static final String serialVersion = "1.0";
     ExampleAggClass exNullAggClass = null;
     String exString;
     ExampleNonXCSerialClass nonXCSerialClass;
     String exNum;
     ExampleAggClass conAggClass;
public class RevisedExampleSubClass extends ExampleSuperClass {
     private static final String serialId = "xsub";
     private static final String serialVersion = "1.1";
     ExampleAggClass exNullAggClass = null;
     String newStringA;
     String newStringB;
     String exString;
     Integer exNum;
     ExampleNonXCSerialClass nonXCSerialClass;
     String conAggString;
     private void serialConvert(Converter converter, String fromVersion) {
          if (fromVersion.equals("1.0")) {
               converter.addField("newStringA", String.class, "new string!");
               // intentionally not adding newStringB to see if warning is thrown
               converter.convertField("exNum", new ConvertScript<String,Integer>(String.class, Integer.class) {
                    @Override
                    public Integer convert(String fromValue) {
                         return new Integer(fromValue);
               converter.convertField("conAggClass", "conAggString", new ConvertScript<ExampleAggClass, String>(ExampleAggClass.class, String.class) {
                    @Override
                    public String convert(ExampleAggClass fromValue) {
                         return fromValue.getAggString();
// and then in some other class...
     ExampleSubClass example = new ExampleSubClass();
     System.out.println("Serializing class...");
     XCObjectOutputStream xcoos = new XCObjectOutputStream(new FileOutputStream(file));
     xcoos.writeObject(example);
     xcoos.close();
     System.out.println("Deserializing class...");
     XCObjectInputStream xcois = new XCObjectInputStream(new FileInputStream(file), RevisedExampleSubClass.class);
     RevisedExampleSubClass resc = (RevisedExampleSubClass) xcois.readObject();There is still a little more work to do to fully support arrays and collections, and I need to develop a rigorous test suite for it. But so far it's looking good.
Edited by: Skotty on Jul 18, 2010 5:31 PM

Similar Messages

  • In ADF how can i insert data in multiple table if they have foreign key

    I have started working on ADF and can anybody inform me in ADF how can i insert data in multiple table if they have foreign key,please?
    Thnak you very much.

    Hello,
    Still no luck.I am surely doing silly mistakes.Anyway,Here are my workings-
    1> student_mst (id(pk),studentname) and student_guard_mst(id(fk),guardianname)
    2> created EO from both of the tables,made id in both EO as DBSequence and an association was also generated.
    3> i made that association composite by clicking the checkbox
    4> i created 2 VO from 2 EO.
    5> put those VO in Application Module.
    6> dragged and dropped 2 VO on my jspx page and dropped them as ADF Form.
    Now what to do please?

  • How to get the data from multiple nodes to one table

    Hi All,
    How to get the data from multiple nodes to one table.examples nodes are like  A B C D E relation also maintained
    Regards,
    Indra

    HI Indra,
    From Node A, get the values of the attributes as
    lo_NodeA->GET_STATIC_ATTRIBUTES(  IMPORTING STATIC_ATTRIBUTES = ls_attributesA  ).
    Similarily get all the node values from B, C, D and E.
    Finally append all your ls records to the table.
    Hope you are clear.
    BR,
    RAM.

  • How do I display data from Multiple Queries in a spreadsheet?

    I am running Oracle forms 10g as a kicker to export a report (rdf 10.1.2.0.2) to PDF or Excel Spreadsheet - User's choice.
    Doesn't matter if I have desformat = SPREADSHEET, DELIMITEDDATA, or DELIMITED; I still get only the first query displayed when I run in spreadsheet format.
    How do I display data from Multiple Queries in a spreadsheet? Is this possible?
    Thanks in advance!

    Hi adam,
    did you search the forum? You will find a lot of threads handling the problem of Excel file access.
    In short: you need to use ActiveX (the RGT also uses ActiveX under the hood)!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • HT4847 How i can download my backup data? And how to manage the data on i Cloud?

    How i can download my backup data? And how to manage the data on i Cloud?

    You can't download an iCloud backup, except to restore it to your device should you ever need to.
    iCloud data can be managed within the apps on your iPad.  Any changes to the data within the apps corresponding to the data you are syncing with iCloud will take place in iCloud.  You can also manage some of this data on icloud.com from your computer.
    This article explains ways to manage your iCloud storage space, should you need to reduce you iCloud storage: http://support.apple.com/kb/ht4847.

  • How to check the dependency of Timesten Application version 11.2.1 for OEL 6U4

    How to check the dependency of Timesten Application version 11.2.1 for OEL 6U4

    Hi Chris,
    THank for your reply.. My requirement is I am planning to upgrade my Server OS from OEL 5U8/5U3 servers to OEL 6U4. And we are using timesten application 11.2.1 version as of now. So wanted to check if the same version of TImesten can we install them on OEL 6U4 . if we can install it successfully what are the dependent RPM packages we need to consider for installing the timesten application and will there be any issues using the application? .
    Is timesten 11.2.2 is the officially supported and stable version on OEL6U4?
    And also can you suggest me if I want to check other applications dependency like rhino-2.3 and postgres 8.1.23 version how I need to check if this applications versions are certified to run on OEL 6U4.
    IT would be great help if you can suggest me on this.
    Naveen

  • How can I take data from multiple pages documents and put them into a numbers table?

    I produce invoices in pages, with dates, invoice numbers, references and amounts due. I want to take all this data from multiple documents and transfeer it to a single numbers table. Is this possible and if so, how do I do it. I know I can do it the other way round with mail merge but I can't figure out how to do it this way round?
    Thanks,
    Keith

    The data is spread throughout a pages document in specific areas here's a copy of an invoice for you to have a look at.

  • How do you receive data from multiple people on a single port?

    I am trying to make a server where it receives the data from multiple users and then send it back to them all- multicasting audio to be exact. I tried setting it up but when i open the RTP session i get "can't open local data port" if i have more than one used connected to me. Does anyone have a solution? I didnt find much on the samples page and the multicast example from http://java.sun.com/products/java-media/jmf/2.1.1/apidocs/javax/media/rtp/RTPManager.html
    didnt help either- i used the same ipaddress for the initialize and addtarget but i get "Local Data AddressDoes not belong to any of this hosts local interfaces". I am really in a pickle... If anyone can help me out that would be great!
    EX: If A,B,C want to multicast they will all send to Server S using port 3000. Server S will create listeners for each of them using port 3000 and when received data it will send back to all of them at 4000. This is what i am trying to do... should i make multiple threads? would that help? thanks and please help!

    To send to everyone, you can send to a multicast address (choose one from 224.0.0.0 to 239.255.255.255), on a given port (2000). I don't have any code example here but it should very similar to unicast. As you said, you just have to register the Session and add a target with this same address.
    I don't have any example myself, but you should find code example of both server and client around. It is a very common usage of jmf rtp.
    I don't know how to mix several audio streams together (never had to do this), so I'm afraid I can't answer your other questions, sorry... The only way to know if it will slow down the transmission is to try. :)

  • How to send joystick data over TCP connection

    Hi all,
    I am a long time Labview discussion forum user for learning, but this is my first time posting a question, I hope somebody can help me!
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    Again, the actual TCP communication I get, and can operate fine, just formatting all the data into a string (or whatever is required) so that I can unpack on the other side is the issue here.
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense...
    One final question.....I already have a solution to this but using labview for the entirety of this project would be nice. I use skype to stream 1080p video from a webcam to my computer so I can view live feed. Can labview do this? This would be awesome if so, I am just not sure if the communication protocols in use could support real time (or as close as possible to streaming) for 1080p video.
    Thanks all in advance for your help,
    Physicsnole
    Attachments:
    cameraserver.vi ‏24 KB
    cameraclient.vi ‏18 KB

    Physicsnole wrote:
    In the attached VI I am trying to send data from a joystick over a TCP connection. I can send data fine using the TCP examples (in fact the majority of my VI is just a copy of the example). However I am to the point where I do not know how to send all the data necessary (3 axis data, 12 buttons, and the POV data) over TCP. Strings, clusters, and arrays were never my strong suite and converting between them is a nightmare for me.
    Well, you cast the axis info cluster to a string, but then you cast it back to an array of DBL. Thatr's not compatible. You should probably cast it back to an "axis info" cluster of exactly the same type. Go the the other VI and right-click the cluster wire to create a constant. Now move that diagram cluster constant to the other VI and use it as type.
    Your default ports don't seem to match. You seem to have client and server roles confused. In the sever you create a listener, but then you start sending packets, even though no connection is established. The connection needs to be initiated by the client.
    Your client stops the loop the first time a timeout is encountered. Shouldn't that be more permanent? Also, please retain code clarity and avoid unecessary complexities. For example, replace the "not or" with a plain "or" and change the loop to "stop if true"
    Physicsnole wrote:
    Basically I am trying to send each axis data (X,Y, and Z), button data (12 buttons), and POV data (the POV data will be calculated to adjust the position of a camera, so the immediate data is not important, I will add functions to add the change in the button movements to write a standing position for two servos [pan and tilt], for which that I will need to send over the TCP connection) over the TCP connection to control various cameras and motors. I don't know if it is posible to send that much data over a TCP connection in one write VI through a string, and also how to separate the string on the other side in order to control the client VI.
    You can send as much as you want. The casting to/from string is the same as described above.
    Physicsnole wrote:
    Another question I have (not impotant to get the program running just might make it easier on me) is can a TCP server (which sends the data to the client) also recieve data back from the client on the same port ( for example sensor data and digital positions [on,off])? Or do I need to set up two TCP communication loops with the first client acting as the server on a different port than the first, which then sends the data to the original server, which also has a client TCP configuration in another loop? I hope this makes sense..
    The primary function of a "server" is to wait for a connection and then communicate with the client once a conenction is established. An established TCP/IP connection is fully two-way and both sides can send and receive.
    LabVIEW Champion . Do more with less code and in less time .

  • How to export the data to Multiple sheet in Excel

    Hi,
    How can I export the data to multiple sheets in excel using Crystal Report XI.
    Thanks,
    Baski.
    Edited by: J_Baskaar on Mar 31, 2010 8:14 AM

    One of the 3rd-party Crystal report schedulers listed at http://www.kenhamady.com/bookmarks.html allows you to burst a report so that each group at level 1 becomes a separate worksheet inside a single workbook.

  • How to get the data from multiple tabes into single table

    hi all,
    here i am having 10 data base tables,how to get the data into a single table.
    regards,
    subba reddy

    hi,
    non XI/PI related
    Regards,
    Michal Krawczyk

  • Regarding ssis - Divide data over multiple files

    Hi,
    I have input data like this
    filename       id
    a                   1
    a                  2
    b                 3
    c                3
    i want to send the data different excel sheets
    all 'a' should go one excel file
    b should go one excel file
    if other time z is there  z should go one file    these should happen dynamically
    please help me

    See similar logic explained here
    It even creates the excel sheets on the fly
    http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Strategy for managing data over multiple drives

    I have been looking at extending my hard drives and considering the very same options as The Hatter suggested in recent posts - ie Raptor vs Caviar SE16 2*750 vs Caviar RAID 2*750 .
    I received a deal on the initial HDD set with my MacPro , so i currently have 2* 250 HDD’s and i have just started to move my itunes and iphoto files plus other media files ( incl photoshop data, movies, documents, etc) onto the separate drive, to see what performance benefits i will get. This is hopefully as a prelude to going to a more ruthless split of files along the lines of a formal strategy - hence my question on what strategy i should have ?
    My dilemma is trying to find a clear explanation of where to start looking for the practical way to actually set up the OSX and apps on one boot disc/partition and the media/documents on another drive(s); and what to do with the other stuff that doesn't actually fit into either category - user/home/library/application support folders, presets and other application support files.
    I have read posts with people saying not to move user and application support data/library files from the boot drive - in which case there is a lot of file data still likely to reside in the boot drive even after removing documents, and all media files ?
    I am paranoid about not having a clear idea of the right strategy before starting the whole process
    its more a strategy question than hardware, but i have not been able to really get this answered from the posts that i have searched.
    cheers
    graham

    I personally wouldn't bother about going with Raptors. They are disproportionally expensive and do not perform any better than much larger drives in the 750GB/1TB sizes. With these large drives I cannot see any compelling reason to go with a Raptor. Compared to 500GB and smaller drives sure… but not with larger drives.
    So presuming you're going with 2 x Western Digital RE2 750GB drives then you need to decide if you're using RAID or not. If you are then you'll have a 1.5TB volume to use which require no further effort.

  • How to send class data over TCP/IP like a serialized cluster

    I have a device which communicates over a TCP/IP connection.  I need to construct complex messages for the communications.  If I use type-defs clusters it is a simple matter to convert the data to string and send it out.  Same with getting the data in.
    If I try this with classes (which I really want to use instead of type-def clusters) I don't get my data in the same format I want it to be in.  It gives me a bunch of stuff I don't want or need like the name of the class.
    I can do some crazy shenanigans like below but this will break if my data type ever changes.
    In addition to that problem some of my classes will contain other classes as data members.  For example all messages have a message header as their beginning so a separate message header class will be part of all other classes.
    Is there a built in / simple way to do this?
    Thanks for the help,
    James G. 
    Attachments:
    class to cluster.JPG ‏11 KB

    Got it. I thought the receiving device was running LabVIEW You could write a method for your class to return the data in whatever format you want.
    =====================
    LabVIEW 2012

  • How can I send data from multiple range with VBA API ?

    hello everyone,
    i have one worksheet , multiple range. With addin , we can specified the range to retrieve or submit.
    In smart view  for retreive, I have the API retrieverange so  I can do the same. But for submitting data, I only have the API "HypSubmitData" and it doesn't take any paramater like a rangebut only the sheet !
    So how do you manager to do it ? one worksheet per range ?
    thanks for answers

    11.1.2.5.400 added the capability to perform range submission, however I doubt that the vba is not updated with the function. So you might have to wait for a while, or you can create a code which copied the selected cells to a hidden worksheet and perform submit from that sheet. Keep in mind that when the use make the selection, you'll have to copy the pov too.
    Regards
    Celvin Kattookaran

Maybe you are looking for

  • IPod 5G freezes when connected to PC

    Hey all- I was just wondering if anyone can help with this problem I've been having with my iPod 5th Gen and iTunes. Recently I had to do a System Restore to a few days previous - my Internet would not work without me doing so. However, I noticed tha

  • Acrobat 9 Batch Processing - Get PDF filenames from folder?

    Hello, Can anyone provide me with an example with how to use Batch Processing (when set to a specific folder/files) to get a list of filenames in that folder? I haven't been able to find any examples online. There doesn't seem to be any built in batc

  • Will not show headers of word doc files

    I format Word doc files into pdf files to print paperback books. I set the files up with headers and footers. When I am finished I do a print preview and both the headers and footers show up fine but when I convert to pdf the headers aren't there. I

  • Too much ram used!

    Our applet has a size of 200kB aproximately, but when it is loaded in the client, it consumes something like 70MB of ram memory. Besides every time we reload it, the consumption increments by 10MB aprox. Is this behavior normal? Does exist maybe some

  • Event generation for ISU Dunning

    Hi all, Scenario: I have a requirement to start a workflow for Dunning procedure in IS Utilities module. Problem: Now my problem is after doing transactions FPVA and FPVB no event is generated or to be precise in transaction SWEL no events r recorded