Tomek Rękawek created OAK-4849:
----------------------------------

             Summary: Refactor the MigrationCliArguments not to perform 
anything in the constructor
                 Key: OAK-4849
                 URL: https://issues.apache.org/jira/browse/OAK-4849
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: upgrade
            Reporter: Tomek Rękawek
             Fix For: 1.6


The MigrationCliArguments class creates a deep structure of helper classes in 
its constructor. As a result simply creating the MigrationCliArguments leads to 
repository creation (sic!), as one of the nested classes needs to do this in 
order to check if the repository uses embedded nodestore.

All of this automatic object creations should be replaced with explicit 
actions, like:

{code}
OptionSet parsed = OptionParserFactory.create().parse(args);
MigrationCliArguments cliArgs = new MigrationCliArguments(parsed);

MigrationOptions options = new MigrationOptions(cliArguments);
options.logOptions(); // optionally log the diagnostic info

StoreArguments stores = new StoreArguments(options, cliArgs.getArguments());
stores.logOptions(); // optionally log the diagnostic info

// following method creates a repository in order to find out whether
// an embedded store is being used
boolean isSrcEmbedded = stores.srcUsesEmbeddedDatastore();

DatastoreArguments datastores = new DatastoreArguments(options, stores, 
isSrcEmbedded);
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to