public void run()

in src/main/java/com/datacompare/Application.java [44:98]


    public void run(ApplicationArguments args) throws Exception {
    	
    	logger.debug("Command-line arguments: {}", Arrays.toString(args.getSourceArgs()));
        logger.debug("Non Option Args: {}", args.getNonOptionArgs());
        logger.info("Option Names: {}", args.getOptionNames());
        
        if(!args.getOptionNames().isEmpty()) {
        	
        	try {

				int subStringlength=4;
				if(args.getSourceArgs() !=null && args.getSourceArgs().length>0)
					subStringlength=Arrays.toString(args.getSourceArgs()).length();
                String sourceArgs = StringUtils.substring(Arrays.toString(args.getSourceArgs()), 3, (subStringlength-1));
                String[] sargs = sourceArgs.split(", --");
                Map<String, String> arguments = new HashMap<String, String>();
                for (int i = 0; i < sargs.length; i++) {
        			String[] keyVal = sargs[i].split("=", 2);
        			arguments.put(keyVal[0], keyVal[1]);
        		}
                AppProperties appProperties = new AppProperties();
        		String connectionType = arguments.get("connectionType");
        		connectionType = (connectionType != null && !connectionType.isEmpty()) ? connectionType : "All";
        		appProperties.setConnectionType(connectionType);
        		String reportType = arguments.get("reportType");
        		reportType = (reportType != null && !reportType.isEmpty()) ? reportType : "Detail";
        		appProperties.setReportType(reportType);
        		appProperties.setSourceDBType(arguments.get("sourceDBType").toUpperCase());
        		if("All".equals(appProperties.getConnectionType())) {
        			setDatabaseProperties(arguments, appProperties);
        		} else if("JDBC".equals(appProperties.getConnectionType())) {
        			setJdbcDbProperties(arguments, appProperties);
        		}
        		setSchemaTableProperties(arguments, appProperties);
        		setOtherProperties(arguments, appProperties); 
        		
        		//Filter
        		String filterType = arguments.get("filterType");
        		filterType = (filterType != null && !filterType.isEmpty()) ? filterType : "Sql";
        		appProperties.setFilterType(filterType);
        		appProperties.setFilter(arguments.get("filter")); 
        		
        		logger.info("Properties: "+ appProperties);
        		
        		CompareService compareService = new CompareService();
        		compareService.startService(appProperties); 
 				
			} catch (Exception e) {
				logger.error("Error", e);  
			}
        	
        	//Exit the process normally.
        	System.exit(0); 
        }
    }