Package com.flaptor.util

Examples of com.flaptor.util.Config


        if (null != log4jConfigPath) {
            PropertyConfigurator.configureAndWatch(log4jConfigPath);
        } else {
            logger.warn("log4j.properties not found on classpath!");
        }
        Config config = Config.getConfig("crawler.properties");
        String mode = config.getString("crawler.mode").toLowerCase();

        Crawler crawler = new Crawler();
       
        int cycles = config.getInt("crawler.mode.cycles");
       
        if (mode.equals("runforever")) {
          crawler.crawl(-1);
        } else if (mode.equals("cycles")) {
            crawler.crawl(config.getInt("crawler.mode.cycles"));
        } else if (mode.equals("refresh")) {
            crawler.refresh();
        } else if (mode.equals("redistribute")) {
            crawler.redistribute();
        }
View Full Code Here


        return true;
    }
   
    public boolean initialize(ConfigBean config){
        inited= (super.initialize(config) && reloadProbabilities());
        Config cfg= Config.getConfig("classifier.properties");
        maxTuple= cfg.getInt("document.parser.tuples.size");
        cache = new FileCache<String> (config.getCacheDir() + "/text"); // TODO: softcode /text
        return inited;
    }
View Full Code Here

                indexDescriptor = IndexDescriptor.defaultDescriptor();
            }finally {
                com.flaptor.util.Execute.close(is, logger);
            }
        }
        Config config = Config.getConfig("common.properties");

        failOnLegacyParameters(config);
       
        ConcurrentMergeScheduler cms = new ConcurrentMergeScheduler();
        cms.setMaxThreadCount(12);
        cms.setMergeThreadPriority(Thread.MIN_PRIORITY);
        this.mergeScheduler = cms;
       
        LogByteSizeMergePolicy mp = new LogByteSizeMergePolicy();
        smallSegmentSize = config.getFloat("Index.smallSegmentSizeMB");
        mp.setMinMergeMB(smallSegmentSize);
        mp.setMergeFactor(config.getInt("Index.mergeFactor"));
        mergePolicy = mp;
      
        createAnalyzer();

        setUpDirectory(create);
View Full Code Here

            throw new RuntimeException(e);
        }
    }

    private void createAnalyzer() {
        Config config = Config.getConfig("common.properties");
        String[] stopwords = config.getString("stopwords").split(",");
        logger.info("Using the following stopwords: " + java.util.Arrays.toString(stopwords));
        analyzer = new LatinStandardAnalyzer(stopwords);
    }
View Full Code Here

        StringTemplate frameTemplate;
        StringTemplate notFoundTemplate;
       
        public CacheHandler() {
            Config config = Config.getConfig("multiCache.properties");
            frameTemplate = new StringTemplate(config.getString("HTTPCacheServer.frameTemplate"));
            notFoundTemplate = new StringTemplate(config.getString("HTTPCacheServer.notFound"));

          if (config.getBoolean("clustering.enable")) {
              int port = PortUtil.getPort("clustering.rpc.cacheServer");
            nodeListener = new NodeListener(port, config);
            MonitorModule.addModuleListener(nodeListener, new CacheServerMonitoredNode(this));
            ControllerModule.addModuleListener(nodeListener, new ControllableImplementation());
                DeployModule.addModuleListener(nodeListener, new DeployListenerImplementation());
            nodeListener.start();
            }

          List<Pair<String, Integer>> caches = new ArrayList<Pair<String, Integer>>();
          for (String host : config.getStringArray("multiCache.hosts")) {
              caches.add(PortUtil.parseHost(host, "crawler.pageCache.rmi"));
          }
          multiCache = new MultiCache<DocumentCacheItem>(caches, config.getLong("multiCache.timeout"), config.getInt("multiCache.workerThreads"));
        }
View Full Code Here

    /**
     * Constructor.
     */
    public Indexer() {

        Config config = Config.getConfig("indexer.properties");
        if (config.getBoolean("clustering.enable")) {
          int port = PortUtil.getPort("clustering.rpc.indexer");
        nodeListener = new NodeListener(port, config);
            ControllerModule.addModuleListener(nodeListener, new ControllableImplementation());
        indexerMonitoredNode = IndexerMonitoredNode.getInstance();
        MonitorModule.addModuleListener(nodeListener, IndexerMonitoredNode.getInstance());
        ActionModule.addModuleListener(nodeListener, new IndexerActionReceiver(this));
        DeployModule.addModuleListener(nodeListener, new DeployListenerImplementation());
        nodeListener.start();
        }


    indexManager = new IndexManager(this);
        maxQueueSize = config.getInt("Indexer.maxQueueSize");
        logger.info("Maximum queue size set to " + maxQueueSize);
        // create all the modules requested in the configuration file AND
        // the special Writer
        // module at the end of the pipeline
        pipe = new ModulePipe();
        String modulesStr = config.getString("Indexer.modules");
        if (!modulesStr.equals("")) {
            String[] moduleStr = modulesStr.split(",");
            for (int i = 0; i < moduleStr.length; i++) {
                logger.info("creating " + moduleStr[i]);
                try {
View Full Code Here

                    // FIXME: The code below incorrectly assumes that a module can have no more than one pattern file.
                    // This forces to use many instances of a module, each with one pattern file, otherwise the admin
                    // webapp wouldn't show all the pattern files.

                    // Get module config. this has to be in sync with what modulesmanager does to load.
                    Config moduleConfig = Config.getConfig(moduleName + "Module.properties",loader);
                    String filename = moduleConfig.getString(configProperty);
                    if (null != filename && filename.trim().length() > 0) {
                        bean = getPatternFileBean(filename);
                        patternFiles.put(moduleName,bean);
                    }
                }
View Full Code Here

    public XmlSearchHandler(ISearcher searcher) {
        if (null == searcher) {
            throw new RuntimeException("OpenSearchHandler constructor: base searcher cannot be null.");
        }
        this.searcher = searcher;
        Config config = Config.getConfig("searcher.properties");
        transformMap = new HashMap<String, Pair<Transformer, String>>();
        String[] mappings = config.getStringArray("xmlsearch.transformMap");
        System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
        TransformerFactory tFactory = TransformerFactory.newInstance();
        for ( String mapping : mappings) {
            String[] parameters = mapping.split(";");
            if (parameters.length != 3) {
View Full Code Here

    public IndexerModule (String moduleName, Config globalConfig) {
        super(moduleName, globalConfig);
        textLengthLimit = globalConfig.getInt("page.text.max.length");
        titleLengthLimit = globalConfig.getInt("page.title.max.length");
        Config mdlConfig = getModuleConfig();
        indexerBusyRetryTime = mdlConfig.getInt("indexer.busy.retry.time");
        crawlName = globalConfig.getString("crawler.name");

        categoryBoostDamp = weightToDamp(mdlConfig.getFloat("category.boost.weight"));
        pagerankBoostDamp = weightToDamp(mdlConfig.getFloat("pagerank.boost.weight"));
        spamrankBoostDamp = weightToDamp(mdlConfig.getFloat("spamrank.boost.weight"));
        logBoostDamp = weightToDamp(mdlConfig.getFloat("log.boost.weight"));
        freshnessBoostDamp = weightToDamp(mdlConfig.getFloat("freshness.boost.weight"));
        int[] freshnessParams = mdlConfig.getIntArray("freshness.params");
        freshnessWeight = freshnessParams[0];
        freshnessDamp = freshnessParams[1];
        hostStopWords = new HashSet<String>(Arrays.asList(mdlConfig.getStringArray("host.stopwords")));
        sendContent = mdlConfig.getBoolean("send.content.to.indexer");

        // instantiate the indexer.
        if (mdlConfig.getBoolean("use.mock.indexer")) {
            logger.warn("Using a mock indexer. This should be used only for testing.");
            this.indexers = new IRemoteIndexer[1];
            this.indexers[0] = new MockIndexer();
            pageMapper = new UrlHashMapper(mdlConfig, 1);
        } else {
          String[] specs = null;
          try {
            specs = mdlConfig.getStringArray("indexer.node.list");
          } catch (Exception e) {
            // for backward compatibility:
              specs = mdlConfig.getStringArray("remoteRmiIndexer.host");
          }
          this.indexers = new IRemoteIndexer[specs.length];
          for (int i=0; i<specs.length; i++) {
            Pair<String, Integer> host = PortUtil.parseHost(specs[i], "indexer.rmi");
            this.indexers[i] = new RmiIndexerStub(host.last(), host.first());
View Full Code Here

        String[] parts = config.getStringArray("indexer.node.mapper");
        if (null == parts || 0 == parts.length) {
            throw new RuntimeException("No mapper defined for the distributed indexer");
        }
        String mapperClass = parts[0].trim();
        Config mapperConfig = config;
        if (parts.length > 1) {
            String mapperName = parts[1].trim();
            mapperConfig = Config.getConfig(mapperName + "Mapper.properties");
        }
        APageMapper mapper;
View Full Code Here

TOP

Related Classes of com.flaptor.util.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.