| Sign In/My Account | View Cart |
Configuration Management in Java EE Applications Using Subversion
Pages: 1, 2, 3
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);
....
}
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!
Swaminathan Radhakrishnan works as a senior technical architect for Infosys Technologies, Ltd.
Return to ONJava.com.
Showing messages 1 through 7 of 7.
Good idea but ...
However I notice that when updating a tracked domain object like your Loan class, two physical updates take place:
In order to maintain the integrity of these two data sources, you need to ensure that both of the above changes either commit or roll back as a single transaction. The traditional way to do this in a J2EE environment is using a two-phase commit (2PC), also known as an XA transaction.
Many JDBC drivers support this type of transaction, some claim to but do not, and some do not even claim to. But let's assume we're using a JDBC driver that does. The other piece of the puzzle is SVN; do you think your SVN-based solution could be modified to implement a 2PC?