private FitNesseContext loadContext(Arguments arguments) throws Exception { Properties properties = loadConfigFile(arguments.getConfigFile()); // Enrich properties with command line values: properties.setProperty( ComponentFactory.VERSIONS_CONTROLLER_DAYS, Integer.toString(arguments.getDaysTillVersionsExpire())); Builder builder = new Builder(); ComponentFactory componentFactory = new ComponentFactory(properties); WikiPageFactory wikiPageFactory = (WikiPageFactory) componentFactory.createComponent( ComponentFactory.WIKI_PAGE_FACTORY_CLASS, FileSystemPageFactory.class); builder.properties = properties; builder.port = arguments.getPort(); builder.rootPath = arguments.getRootPath(); builder.rootDirectoryName = arguments.getRootDirectory(); builder.versionsController = (VersionsController) componentFactory.createComponent( ComponentFactory.VERSIONS_CONTROLLER_CLASS, ZipFileVersionsController.class); builder.versionsController.setHistoryDepth( Integer.parseInt(properties.getProperty(ComponentFactory.VERSIONS_CONTROLLER_DAYS, "14"))); builder.recentChanges = (RecentChanges) componentFactory.createComponent( ComponentFactory.RECENT_CHANGES_CLASS, RecentChangesWikiPage.class); builder.root = wikiPageFactory.makeRootPage(builder.rootPath, builder.rootDirectoryName); PluginsLoader pluginsLoader = new PluginsLoader(componentFactory); builder.logger = pluginsLoader.makeLogger(arguments.getLogDirectory()); builder.authenticator = pluginsLoader.makeAuthenticator(arguments.getUserpass()); FitNesseContext context = builder.createFitNesseContext(); SymbolProvider symbolProvider = SymbolProvider.wikiParsingProvider; pluginsLoader.loadPlugins(context.responderFactory, symbolProvider); pluginsLoader.loadResponders(context.responderFactory); pluginsLoader.loadSymbolTypes(symbolProvider); pluginsLoader.loadContentFilter(); pluginsLoader.loadSlimTables(); pluginsLoader.loadCustomComparators(); WikiImportTestEventListener.register(); LOG.info("root page: " + context.root); LOG.info("logger: " + (context.logger == null ? "none" : context.logger.toString())); LOG.info("authenticator: " + context.authenticator); LOG.info("page factory: " + context.pageFactory); LOG.info("page theme: " + context.pageFactory.getTheme()); LOG.info("Starting FitNesse on port: " + context.port); return context; }
public static Authenticator makeAuthenticator( String authenticationParameter, ComponentFactory componentFactory) throws Exception { Authenticator authenticator = new PromiscuousAuthenticator(); if (authenticationParameter != null) { if (new File(authenticationParameter).exists()) authenticator = new MultiUserAuthenticator(authenticationParameter); else { String[] values = authenticationParameter.split(":"); authenticator = new OneUserAuthenticator(values[0], values[1]); } } return componentFactory.getAuthenticator(authenticator); }
private static FitNesseContext loadContext(Arguments arguments) throws Exception { FitNesseContext context = new FitNesseContext(); ComponentFactory componentFactory = new ComponentFactory(context.rootPath); context.port = arguments.getPort(); context.rootPath = arguments.getRootPath(); context.rootPageName = arguments.getRootDirectory(); context.rootPagePath = context.rootPath + "/" + context.rootPageName; context.root = componentFactory.getRootPage( FileSystemPage.makeRoot(context.rootPath, context.rootPageName)); context.responderFactory = new ResponderFactory(context.rootPagePath); context.logger = makeLogger(arguments); context.authenticator = makeAuthenticator(arguments.getUserpass(), componentFactory); context.htmlPageFactory = componentFactory.getHtmlPageFactory(new HtmlPageFactory()); extraOutput = componentFactory.loadResponderPlugins(context.responderFactory); extraOutput += componentFactory.loadWikiWidgetPlugins(); extraOutput += componentFactory.loadWikiWidgetInterceptors(); extraOutput += componentFactory.loadContentFilter(); WikiImportTestEventListener.register(); return context; }