Package net.sf.collabreview.core.configuration

Examples of net.sf.collabreview.core.configuration.ConfigurationData


    assert configuration != null;
    logger.debug("Configuring SubversionImportWorker"); // from: " + configuration.asXML());
    initSvnLib();
    repository = setupConnection(configuration);
    store = importer.getCollabReview().getRepository();
    ConfigurationData element = configuration.getSubElement("startrevision");
    if (element != null) {
      startRevision = Long.parseLong(element.getSelfValue());
    }
    element = configuration.getSubElement("endrevision");
    if (element != null) {
      endRevision = Long.parseLong(element.getSelfValue());
    }
    element = configuration.getSubElement("pollDelay");
    if (element != null) {
      pollDelay = Long.parseLong(element.getSelfValue()) * 1000;
    }
    element = configuration.getSubElement("fileencoding");
    if (element != null) {
      defaultEncoding = element.getSelfValue();
    }
    element = configuration.getSubElement("maxsourcesize");
    int sourceFileSizeLimit = element != null ? Integer.parseInt(element.getSelfValue()) : SOURCE_FILE_SIZE_LIMIT;
    logger.info("Assuming default encoding of sources in svn is: " + defaultEncoding);
    initBranchMappers(configuration);
    fileUpdateHandler = new FileUpdateHandler(this, progressInfo, store, Filter.readFilter(configuration.getSubElement("filter")), sourceFileSizeLimit);
    directoryUpdateHandler = new DirectoryUpdateHandler(this, progressInfo, store);
    progressInfo.setState(ImportProgressInfo.State.created);
View Full Code Here


  }

  private void initBranchMappers(ConfigurationData configuration) {
    List<BranchMapper> branchMappers = new ArrayList<BranchMapper>();
    for (Object elementObject : configuration.getSubElements("mapper")) {
      ConfigurationData element = (ConfigurationData) elementObject;
      assert element.getValue("class") != null;
      try {
        Class mapperClass = getClass().getClassLoader().loadClass(element.getValue("class"));
        BranchMapper mapper = (BranchMapper) mapperClass.newInstance();
        mapper.configure(element);
        branchMappers.add(mapper);
      } catch (Exception e) {
        logger.error("Failed to load BranchMapper for " + element.toString(), e);
      }
    }
    this.branchMapperList = branchMappers;
  }
View Full Code Here

   * then this function is stored here.
   */
  private OperationCostFunctions costFunctions = null;

  public void configure(ConfigurationData configuation) {
    ConfigurationData costsElement = configuation.getSubElement("costs");
    if (costsElement != null) {
      String className = costsElement.getSelfValue();
      logger.info("Setting new cost function for TokenbasedSimilarity objects to " + className);
      try {
        Class klasse = getClass().getClassLoader().loadClass(className);
        Object costFunctionObject = klasse.newInstance();
        costFunctions = (OperationCostFunctions) costFunctionObject;
View Full Code Here

   * @param configurationData the configuration data
   * @throws Exception if the configure() method of the metric throws an exception
   * @see net.sf.collabreview.reputation.ReputationMetric#configure(net.sf.collabreview.core.configuration.ConfigurationData)
   */
  protected final void startConfigure(ConfigurationData configurationData) throws Exception {
    ConfigurationData filter = configurationData.getSubElement("filter");
    if (filter != null) {
      Filter f = Filter.readFilter(configurationData);
      setFilter(f);
    }
    String name = configurationData.getValue("name");
View Full Code Here

   * @param parent the elements parent
   * @param name   the name of the element
   * @return the requested element or null if it is not there (an error message is logged)
   */
  private ConfigurationData getConfigElement(ConfigurationData parent, String name) {
    ConfigurationData result = parent.getSubElement(name);
    if (result == null) {
      logger.error("No <" + name + "/> element specified in configuration!");
    }
    return result;
  }
View Full Code Here

    logger.debug("Configuring " + filters.length + " filters");
    TrivialTokenFilter trivialTokenFilter = new OrTrivialTokenFilter();
    ((ConfigurableTrivialTokenFilter) trivialTokenFilter).configure(this, configuration);
    getTokenIndex().setExternalFilter(trivialTokenFilter);
    for (Object filterObject : filters) {
      ConfigurationData filterDef = (ConfigurationData) filterObject;
      String className = filterDef.getValue("class");
      try {
        Class klasse = getClass().getClassLoader().loadClass(className);
        ConfigurableTrivialTokenFilter newFilter = (ConfigurableTrivialTokenFilter) klasse.newInstance();
        newFilter.configure(this, filterDef);
        ((OrTrivialTokenFilter) trivialTokenFilter).addFilter(newFilter);
      } catch (ClassNotFoundException e) {
        logger.error("Class " + className + " not found for filter defined by: \n" + filterDef.toString(), e);
      } catch (IllegalAccessException e) {
        logger.error("May not access filter class for\n" + filterDef.toString(), e);
      } catch (InstantiationException e) {
        logger.error("Failed to create filter for\n" + filterDef.toString(), e);
      }
    }
  }
View Full Code Here

  public void configure(AgentManager agentManager, ConfigurationData config) throws Exception {
    assert this.agentManager == null;
    this.agentManager = agentManager;
    configureCheckstyle(config);
    ConfigurationData sleepConfig = config.getSubElement("sleep");
    if (sleepConfig != null) {
      sleepInterval = Long.parseLong(sleepConfig.getSelfValue()) * 1000;
    }
    logger.debug("Agent sleep interval is: " + sleepInterval / 1000 + " seconds");
    // ensure that the checkstyle author exists
    AuthorManager manager = agentManager.getCollabReview().getAuthorManager();
    Author author = manager.getAuthor(getProposedName());
    if (author == null) {
      logger.info("Registering a new author for the CheckstyleAgent: " + getProposedName());
      author = manager.createAuthor(getProposedName());
      if (manager.storeAuthor(author) == null) {
        logger.error("Failed to register the new author");
      } else {
        manager.commit();
      }
    }
    // input filter
    ConfigurationData filterConfig = config.getSubElement("filter");
    if (filterConfig != null) {
      filter = Filter.readFilter(filterConfig);
    }
    // initialize recheck all flag
    ConfigurationData recheckElement = config.getSubElement("recheck");
    if (recheckElement != null) {
      recheckAll = recheckElement.getSelfValue().toLowerCase().equals("true");
    }
    // initialize curesize
    ConfigurationData curesizeElement = config.getSubElement("curesize");
    if (curesizeElement != null) {
      errorCureSize = Integer.parseInt(curesizeElement.getSelfValue());
    }
    // register the hook first so we won't miss any artifact update...
    registerHooks();
    // do the initial scan
    initialScan();
View Full Code Here

    injectFilter(factory, configurationForProducedFactories);
    return factory;
  }

  private void injectFilter(factoryType factory, ConfigurationData configurationForProducedFactories) {
    ConfigurationData element = configurationForProducedFactories.getSubElement("filter");
    if (element == null) {
      return;
    }
    Filter filter = Filter.readFilter(element);
    inject(factory, "setFilter", Filter.class, filter);
View Full Code Here

  @Override
  public void init(ServletConfig servletConfig) throws ServletException {
    logger.debug("Configuring...");
    super.init(servletConfig);
    //Document document = Configuration.get().getDom4JSubTree("extensions");
    ConfigurationData extensionDispatcherConfig = CollabReviewSingleton.get().getExtensionDispatcherConfiguration();
    if (extensionDispatcherConfig == null) {
      logger.info("No extensions defined. Add an <extensions id=\"extensions\"/> element to your configuration");
    } else {
      for (ConfigurationData extensionConfig : extensionDispatcherConfig.getSubElements("extension")) {
        initExtension(extensionConfig);
      }
    }
  }
View Full Code Here

  public ParallelSearch(BasicRepository repository, ConfigurationData configuration) throws Exception {
    super(repository);
    List<AncestorSearch> embeddedSearchesList = new LinkedList<AncestorSearch>();
    ConfigurationData[] elementList = configuration.getSubElements("search");
    for (Object elementObject : elementList) {
      ConfigurationData element = (ConfigurationData) elementObject;
      AncestorSearch newSearch = createSearchFromConfig(element, repository);
      if (newSearch != null) {
        embeddedSearchesList.add(newSearch);
      }
    }
    embeddedSearches = embeddedSearchesList.toArray(new AncestorSearch[0]);
    // generate evaluation statistics?
    ConfigurationData evaluationFile = configuration.getSubElement("print");
    if (evaluationFile != null) {
      enableEvaluating(new File(evaluationFile.getValue("file")));
    } else {
      logger.debug("Search evaluation mode not enabled");
    }
  }
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.configuration.ConfigurationData

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.