public class DirectoryDiff
extends java.lang.Object
To be able to compare directories, this class needs access to any directory schema extension files and the directories to compare. The extensions (if they exist) are loaded from application-specific JAR files in the classpath.
The directories to compare are specified with the command line and can be anywhere.
The class starts with the root node and compares every node in both directories. Nodes are treated as different, if they have different object class or different number or order of attribute values.
Every found difference is reported to the standard output. The first directory in the command line is marked as L (meaning Left) and the second one is marked as R (meaning Right).
This is the first cut of this utility class. It can be enhanced in multiple directions:
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
pathL
starting left directory path
|
private java.lang.String |
pathR
starting right directory path
|
private Remapper |
r1
backend for the first file
|
private Remapper |
r2
backend for the first file
|
Constructor and Description |
---|
DirectoryDiff(java.lang.String[] args)
Construct an instance of DirectoryDiff for the given command line
parameters.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
diffNodes(java.lang.String nid1,
java.lang.String nid2)
Compares two nodes.
|
static void |
main(java.lang.String[] args)
Application entry point.
|
private void |
run()
Main application worker routine.
|
(package private) static void |
say(java.lang.String msg)
Shortcut for the System.out.prinln()
|
private Remapper r1
private Remapper r2
private java.lang.String pathL
private java.lang.String pathR
public DirectoryDiff(java.lang.String[] args) throws ConfigurationException
args
- Command line parameters. Expected are two file names for the
first (left) and the second (right) directories.ConfigurationException
- In case of configuration error.static void say(java.lang.String msg)
msg
- Message to print to standard output.private void run()
private boolean diffNodes(java.lang.String nid1, java.lang.String nid2)
nid1
- node ID for the first tree nodenid2
- node ID for the second tree nodepublic static void main(java.lang.String[] args)
args
- Command line parameters.