src/main/java/org/jboss/loom/MigratorApp.java
static Configuration parseArguments(String[] args) {
    
        // Global config
        GlobalConfiguration globalConfig = new GlobalConfiguration();
        
        // Module-specific options.
        List<ModuleSpecificProperty> moduleConfigs = new LinkedList<>();
        
        
        // For each argument...
        for (String arg : args) {
            arg = StringUtils.removeStart( arg, "--" );
            
            if( arg.equals("help") ){
                Utils.writeHelp();
                return null;
            }
            if( arg.startsWith("as5.dir=") || arg.startsWith("eap5.dir=") || arg.startsWith("src.dir=") ) {
                globalConfig.getAS5Config().setDir(StringUtils.substringAfter(arg, "="));
                continue;
            }

            if( arg.startsWith("dest.dir=") || arg.startsWith("eap6.dir=") || arg.startsWith("dest.dir=") || arg.startsWith("wfly.dir=") ) {
                globalConfig.getAS7Config().setDir(StringUtils.substringAfter(arg, "="));
                continue;
            }

            if( arg.startsWith("as5.profile=") || arg.startsWith("eap5.profile=") || arg.startsWith("src.profile=") ) {
                globalConfig.getAS5Config().setProfileName(StringUtils.substringAfter(arg, "="));
                continue;
            }

            if( arg.startsWith("dest.confPath=") || arg.startsWith("eap6.confPath=") || arg.startsWith("dest.conf.file=") || arg.startsWith("wfly.confPath=") ) {
                globalConfig.getAS7Config().setConfigPath(StringUtils.substringAfter(arg, "="));
                continue;
            }

            if( arg.startsWith("dest.mgmt=") ||  arg.startsWith("eap6.mgmt=") ||  arg.startsWith("dest.mgmt=") ||  arg.startsWith("wfly.mgmt=") ) {
                parseMgmtConn( StringUtils.substringAfter(arg, "="), globalConfig.getAS7Config() );
                continue;
            }

            if( arg.startsWith("app.path=") ) {
                globalConfig.addDeploymentPath( StringUtils.substringAfter(arg, "="));
                continue;
            }

            if( arg.startsWith("valid.skip") ) {
                globalConfig.setSkipValidation(true);
                continue;
            }

            if( arg.equals("dry") || arg.equals("dryRun") || arg.equals("dry-run") ) {
                globalConfig.setDryRun(true);
                continue;
            }
            
            if( arg.equals("test") || arg.equals("testRun") || arg.equals("test-run") ) {
                globalConfig.setTestRun(true);
                continue;
            }
            
            if( arg.startsWith("report.dir=") ) {
                globalConfig.setReportDir( StringUtils.substringAfter(arg, "="));
                continue;
            }

            if( arg.startsWith("migrators.dir=") || arg.startsWith("migr.dir=") ) {
                globalConfig.setExternalMigratorsDir( StringUtils.substringAfter(arg, "="));
                continue;
            }

            

            // Module-specific configurations.
            // TODO: Process by calling IMigrator instances' callback.
            if (arg.startsWith("conf.")) {
                
                // --conf.<module>.<property.name>[=<value>]
                String conf = StringUtils.substringAfter(arg, ".");
                String module = StringUtils.substringBefore(conf, ".");
                String propName = StringUtils.substringAfter(conf, ".");
                int pos = propName.indexOf('=');
                String value = null;
                if( pos == -1 ){
                    value = propName.substring(pos+1);
                    propName = propName.substring(0, pos);
                }
                
                moduleConfigs.add( new ModuleSpecificProperty(module, propName, value));
            }

            
            // Unrecognized.
            
            if( ! arg.contains("=") ){
                // TODO: Could be AS5 or AS7 dir.
            }
            
            System.err.println("Warning: Unknown argument: " + arg + " !");
            Utils.writeHelp();
            continue;
        }

        Configuration configuration = new Configuration();
        configuration.setModuleConfigs(moduleConfigs);
        configuration.setGlobalConfig(globalConfig);
        
        return configuration;
        
    }
/**
     *  Parses app's arguments.
     *  @returns  Configuration initialized according to args.
     */
Parses app's arguments.
@returns  Configuration initialized according to args.
Parses app ' s arguments . @returns Configuration initialized according to args .
static Configuration parseArguments(String[] args) {
        GlobalConfiguration globalConfig = new GlobalConfiguration();
        List<ModuleSpecificProperty> moduleConfigs = new LinkedList<>();
        for (String arg : args) {
            arg = StringUtils.removeStart( arg, "--" );
            if( arg.equals("help") ){
                Utils.writeHelp();
                return null;
            }
            if( arg.startsWith("as5.dir=") || arg.startsWith("eap5.dir=") || arg.startsWith("src.dir=") ) {
                globalConfig.getAS5Config().setDir(StringUtils.substringAfter(arg, "="));
                continue;
            }
            if( arg.startsWith("dest.dir=") || arg.startsWith("eap6.dir=") || arg.startsWith("dest.dir=") || arg.startsWith("wfly.dir=") ) {
                globalConfig.getAS7Config().setDir(StringUtils.substringAfter(arg, "="));
                continue;
            }
            if( arg.startsWith("as5.profile=") || arg.startsWith("eap5.profile=") || arg.startsWith("src.profile=") ) {
                globalConfig.getAS5Config().setProfileName(StringUtils.substringAfter(arg, "="));
                continue;
            }
            if( arg.startsWith("dest.confPath=") || arg.startsWith("eap6.confPath=") || arg.startsWith("dest.conf.file=") || arg.startsWith("wfly.confPath=") ) {
                globalConfig.getAS7Config().setConfigPath(StringUtils.substringAfter(arg, "="));
                continue;
            }
            if( arg.startsWith("dest.mgmt=") ||  arg.startsWith("eap6.mgmt=") ||  arg.startsWith("dest.mgmt=") ||  arg.startsWith("wfly.mgmt=") ) {
                parseMgmtConn( StringUtils.substringAfter(arg, "="), globalConfig.getAS7Config() );
                continue;
            }
            if( arg.startsWith("app.path=") ) {
                globalConfig.addDeploymentPath( StringUtils.substringAfter(arg, "="));
                continue;
            }
            if( arg.startsWith("valid.skip") ) {
                globalConfig.setSkipValidation(true);
                continue;
            }
            if( arg.equals("dry") || arg.equals("dryRun") || arg.equals("dry-run") ) {
                globalConfig.setDryRun(true);
                continue;
            }
            if( arg.equals("test") || arg.equals("testRun") || arg.equals("test-run") ) {
                globalConfig.setTestRun(true);
                continue;
            }
            if( arg.startsWith("report.dir=") ) {
                globalConfig.setReportDir( StringUtils.substringAfter(arg, "="));
                continue;
            }
            if( arg.startsWith("migrators.dir=") || arg.startsWith("migr.dir=") ) {
                globalConfig.setExternalMigratorsDir( StringUtils.substringAfter(arg, "="));
                continue;
            }
            if (arg.startsWith("conf.")) {
                String conf = StringUtils.substringAfter(arg, ".");
                String module = StringUtils.substringBefore(conf, ".");
                String propName = StringUtils.substringAfter(conf, ".");
                int pos = propName.indexOf('=');
                String value = null;
                if( pos == -1 ){
                    value = propName.substring(pos+1);
                    propName = propName.substring(0, pos);
                }
                moduleConfigs.add( new ModuleSpecificProperty(module, propName, value));
            }
            if( ! arg.contains("=") ){
            }
            System.err.println("Warning: Unknown argument: " + arg + " !");
            Utils.writeHelp();
            continue;
        }
        Configuration configuration = new Configuration();
        configuration.setModuleConfigs(moduleConfigs);
        configuration.setGlobalConfig(globalConfig);
        return configuration;
    }
static Configuration parseArguments ( String [ ] args ) { GlobalConfiguration globalConfig = new GlobalConfiguration ( ) ; List < ModuleSpecificProperty > moduleConfigs = new LinkedList < > ( ) ; for ( String arg : args ) { arg = StringUtils . removeStart ( arg , "--" ) ; if ( arg . equals ( "help" ) ) { Utils . writeHelp ( ) ; return null ; } if ( arg . startsWith ( "as5.dir=" ) || arg . startsWith ( "eap5.dir=" ) || arg . startsWith ( "src.dir=" ) ) { globalConfig . getAS5Config ( ) . setDir ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "dest.dir=" ) || arg . startsWith ( "eap6.dir=" ) || arg . startsWith ( "dest.dir=" ) || arg . startsWith ( "wfly.dir=" ) ) { globalConfig . getAS7Config ( ) . setDir ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "as5.profile=" ) || arg . startsWith ( "eap5.profile=" ) || arg . startsWith ( "src.profile=" ) ) { globalConfig . getAS5Config ( ) . setProfileName ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "dest.confPath=" ) || arg . startsWith ( "eap6.confPath=" ) || arg . startsWith ( "dest.conf.file=" ) || arg . startsWith ( "wfly.confPath=" ) ) { globalConfig . getAS7Config ( ) . setConfigPath ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "dest.mgmt=" ) || arg . startsWith ( "eap6.mgmt=" ) || arg . startsWith ( "dest.mgmt=" ) || arg . startsWith ( "wfly.mgmt=" ) ) { parseMgmtConn ( StringUtils . substringAfter ( arg , "=" ) , globalConfig . getAS7Config ( ) ) ; continue ; } if ( arg . startsWith ( "app.path=" ) ) { globalConfig . addDeploymentPath ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "valid.skip" ) ) { globalConfig . setSkipValidation ( true ) ; continue ; } if ( arg . equals ( "dry" ) || arg . equals ( "dryRun" ) || arg . equals ( "dry-run" ) ) { globalConfig . setDryRun ( true ) ; continue ; } if ( arg . equals ( "test" ) || arg . equals ( "testRun" ) || arg . equals ( "test-run" ) ) { globalConfig . setTestRun ( true ) ; continue ; } if ( arg . startsWith ( "report.dir=" ) ) { globalConfig . setReportDir ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "migrators.dir=" ) || arg . startsWith ( "migr.dir=" ) ) { globalConfig . setExternalMigratorsDir ( StringUtils . substringAfter ( arg , "=" ) ) ; continue ; } if ( arg . startsWith ( "conf." ) ) { String conf = StringUtils . substringAfter ( arg , "." ) ; String module = StringUtils . substringBefore ( conf , "." ) ; String propName = StringUtils . substringAfter ( conf , "." ) ; int pos = propName . indexOf ( '=' ) ; String value = null ; if ( pos == - 1 ) { value = propName . substring ( pos + 1 ) ; propName = propName . substring ( 0 , pos ) ; } moduleConfigs . add ( new ModuleSpecificProperty ( module , propName , value ) ) ; } if ( ! arg . contains ( "=" ) ) { } System . err . println ( "Warning: Unknown argument: " + arg + " !" ) ; Utils . writeHelp ( ) ; continue ; } Configuration configuration = new Configuration ( ) ; configuration . setModuleConfigs ( moduleConfigs ) ; configuration . setGlobalConfig ( globalConfig ) ; return configuration ; }
Parses app's arguments.
Parses app ' s arguments .
// Global config // Module-specific options. // For each argument... // Module-specific configurations. // TODO: Process by calling IMigrator instances' callback. // --conf.<module>.<property.name>[=<value>] // Unrecognized. // TODO: Could be AS5 or AS7 dir.