@Override public void actionPerformed(ActionEvent event) { final AnalysisJobBuilder ajb = new AnalysisJobBuilder(_configuration); ajb.setDatastore(_datastore); ajb.addSourceColumns(getColumns()); final QuickAnalysisStrategy quickAnalysisStrategy = _userPreferences.getQuickAnalysisStrategy(); quickAnalysisStrategy.configureAnalysisJobBuilder(ajb); try { if (!ajb.isConfigured(true)) { throw new IllegalStateException("Unknown job configuration issue!"); } Injector injector = Guice.createInjector(new DCModule(_parentModule, ajb)); RunAnalysisActionListener actionListener = injector.getInstance(RunAnalysisActionListener.class); actionListener.actionPerformed(event); } catch (Exception e) { WidgetUtils.showErrorMessage( "Error", "Could not perform quick analysis on table " + _table.getName(), e); } }
/** * A main method that will display the results of a few example number analyzers. Useful for * tweaking the charts and UI. * * @param args */ public static void main(String[] args) throws Exception { LookAndFeelManager.getInstance().init(); Injector injector = Guice.createInjector(new DCModule(VFSUtils.getFileSystemManager().resolveFile("."), null)); // run a small job final AnalysisJobBuilder ajb = injector.getInstance(AnalysisJobBuilder.class); Datastore ds = injector.getInstance(DatastoreCatalog.class).getDatastore("orderdb"); DatastoreConnection con = ds.openConnection(); Table table = con.getSchemaNavigator().convertToTable("PUBLIC.CUSTOMERS"); ajb.setDatastore(ds); ajb.addSourceColumns(table.getNumberColumns()); ajb.addAnalyzer(NumberAnalyzer.class).addInputColumns(ajb.getSourceColumns()); ResultWindow resultWindow = injector.getInstance(ResultWindow.class); resultWindow.setVisible(true); resultWindow.startAnalysis(); }