f1fec12bd1a545622e25a27ca1e118179c27e4e5 |
|
07-Jul-2015 |
Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com> |
Code cleanups
EnableReplicationUserData.java:
Extracted inner class EnableReplicationServerData.
Removed all fields named "*1" and "*2" and replaced them with new fields EnableReplicationServerData server1 and server2.
ReplicationCliMain.java:
Used EnableReplicationUserData.EnableReplicationServerData.
As a consequence, extracted methods setConnectionDetails(), setReplicationDetails(), checkReplicationServerAlreadyConfigured(), checkReplicationPort(), checkAdminAndReplicationPortsAreDifferent(), addToSets(), configureToReplicateBaseDN(), countReplicationServers(), checkCanMergeReplicationTopologies() to reduce code duplication.
Extracted methods findSameReplicationServer() and findReplicaInSuffix2() to increase readability.
Extracted configureServer() from configureServer1() and configureServer2() + removed these 2 methods.
Moved getValue(String v, String defaultValue) and getValue(int v, int defaultValue) to ReplicationCliArgumentParser.
Consequence of the changes to ReplicationCliArgumentParser.
ReplicationCliArgumentParser.java:
Reduced methods visibility + made a few methods static.
Renamed or inlined various methods.
Added getValueOrDefault(StringArgument) and getValueOrDefault(IntegerArgument).
Used ternary operator.
Extracted method getAdminUidArg()
PurgeHistoricalUserData.java:
Code cleanups.
Consequence of the changes to ReplicationCliArgumentParser.
Removed getValue(String v, String defaultValue) and getValue(int v, int defaultValue). |