Configuration Management in Java EE Applications Using Subversion

Configuration Management in Java EE Applications Using Subversion

Retrieving Differences Between Versions

To determine the differences that exist between two revisions, the SVNManager.showDifferences method is used. The JavaSVN class SVNDiffManager has the required implementation for getting the differences between two versions. A handle to this class can be obtained using the SVNClientManager class. The SVNDiffManager's doDiff method has a default implementation for returning the differences in a fixed format into the OutputStream passed in as a parameter. We can have custom implementations for getting the differences between two versions through the ISVNEditor class, but we will go with the default implementation for this example.



public String showDifferences(

                BaseTrackingObject obj,long revision1,

                long revision2) {

        ....

        //Create an instance of SVNClientManager

        //providing authentication

        SVNClientManager ourClientManager =

                        SVNClientManager.newInstance(

                        options, "name", "password");

        //Obtain the handle to DiffClient

        //from the client manager

        SVNDiffClient theDiff = ourClientManager

                        .getDiffClient();

        ....

        theDiff.doDiff(svnUrl, SVNRevision.

                create(revision1), svnUrl,

                SVNRevision.create(revision2),

                false, false, diffStream);

        ....

}

Conclusions

Enterprise applications deal with requirements to not just store and retrieve critical data assets, but also track the historical changes to such data. The traditional approaches to solve these requirements using relational databases do not present an elegant solution. Subversion, a version tracking system offers the required amount of support for tracking our sample LoanData object over time. The JavaSVN APIs were used for tasks such as storing the loan object, retrieving the object, retrieving the log of changes that are made to the object, and also showing the differences between two versions of the object.

We have examined only a basic set of features but there is plenty of support from Subversion for far more sophisticated requirements that are not uncommon for an enterprise-level application. Happy exploring!

Resources

  • Sample code for this article and related installation instructions
  • The Subversion website has the required information
  • Version Control with Subversion is also available online
  • Code samples and API specs for JavaSVN

Swaminathan Radhakrishnan works as a senior technical architect for Infosys Technologies, Ltd.


Return to ONJava.com.

Prev  [1] [2] [3] 

Close    To Top
  • Prev Article-Java:
  • Next Article-Java:
  • Now: Tutorial for Web and Software Design > Java > Java EE > Java Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction