[ 
https://issues.apache.org/jira/browse/OAK-4849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tomek Rękawek updated OAK-4849:
-------------------------------
    Description: 
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 initializes (and closes) 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}

  was:
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}


> Refactor the MigrationCliArguments from implicit to explicit
> ------------------------------------------------------------
>
>                 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 initializes (and closes) 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