Package com.gentics.cr.configuration

Examples of com.gentics.cr.configuration.GenericConfiguration


    }
  }

  protected static String getFirstIndexLocation(CRConfig config) {
    String path = "";
    GenericConfiguration locs = (GenericConfiguration) config.get(INDEX_LOCATIONS_KEY);
    if (locs != null) {
      Map<String, GenericConfiguration> locationmap = locs.getSortedSubconfigs();
      if (locationmap != null) {
        for (GenericConfiguration locconf : locationmap.values()) {
          String p = locconf.getString(INDEX_PATH_KEY);
          if (p != null && !"".equals(p)) {
            path = p;
View Full Code Here


    String collectorClassName = (String) config.get(COLLECTOR_CLASS_KEY);
    if (collectorClassName != null) {
      Class<?> genericCollectorClass;
      try {
        genericCollectorClass = Class.forName(collectorClassName);
        GenericConfiguration collectorConfiguration = config.getSubConfigs().get(COLLECTOR_CONFIG_KEY.toUpperCase());
        Object[][] prioritizedParameters = new Object[3][];
        prioritizedParameters[0] = new Object[] { searcher, hits, collectorConfiguration, userPermissions };
        prioritizedParameters[1] = new Object[] { searcher, hits, collectorConfiguration };
        prioritizedParameters[2] = new Object[] { hits, collectorConfiguration };
        Object collectorObject = Instanciator.getInstance(genericCollectorClass, prioritizedParameters);
View Full Code Here

   * It is not able to write to the index.
   * @param config
   */
  public LuceneMultiIndexLocation(final CRConfig config) {
    super(config);
    GenericConfiguration locs = (GenericConfiguration) config.get(INDEX_LOCATIONS_KEY);
    if (locs != null) {
      Map<String, GenericConfiguration> locationmap = locs.getSortedSubconfigs();
      if (locationmap != null) {
        for (GenericConfiguration locconf : locationmap.values()) {
          String path = locconf.getString(INDEX_PATH_KEY);
          if (path != null && !"".equals(path)) {
            dirs.put(path, loadDirectory(path, config));
View Full Code Here

   * Create table of ContentTransformers configured in config.
   * @param config configuration.
   * @return transformer table
   */
  public static ConcurrentHashMap<String, ContentHighlighter> getTransformerTable(final GenericConfiguration config) {
    GenericConfiguration tconf = (GenericConfiguration) config.get(HIGHLIGHTER_KEY);
    if (tconf != null) {
      ConcurrentHashMap<String, GenericConfiguration> confs = tconf.getSubConfigs();
      if (confs != null && confs.size() > 0) {
        ConcurrentHashMap<String, ContentHighlighter> ret = new ConcurrentHashMap<String, ContentHighlighter>(confs.size());
        for (Map.Entry<String, GenericConfiguration> e : confs.entrySet()) {
          try {
            GenericConfiguration c = e.getValue();
            String attribute = (String) c.get(HIGHLIGHTER_ATTRIBUTE_KEY);
            String highlighterClass = (String) c.get(HIGHLIGHTER_CLASS_KEY);
            ContentHighlighter t = null;
            t = (ContentHighlighter) Class.forName(highlighterClass)
                .getConstructor(new Class[] { GenericConfiguration.class }).newInstance(c);
            if (t != null && attribute != null) {
              ret.put(attribute, t);
View Full Code Here

   */
  public static Collection<TaxonomyMapping> mapTaxonomies(
      final CRConfig config) {
    Vector<TaxonomyMapping> mappings = new Vector<TaxonomyMapping>();

    GenericConfiguration mappingsConf = (GenericConfiguration) config
        .get(FACET_CONFIG_KEY.concat(".").concat(
            FACET_CONFIG_MAPPINGS_KEY));

    if (mappingsConf != null) {
      Map<String, GenericConfiguration> mappingsMap = mappingsConf
          .getSortedSubconfigs();
      if (mappingsMap != null) {
        for (GenericConfiguration mapConf : mappingsMap.values()) {
          String category = mapConf.getString(
              FACET_CONFIG_MAPPINGS_CATEGORY_KEY, "");
View Full Code Here

   * TODO javadoc.
   * @param config TODO javadoc
   * @return TODO javadoc
   */
  public static List<String> getReverseAttributes(final GenericConfiguration config) {
    GenericConfiguration analyzerConfig = loadAnalyzerConfig(config);
    if (analyzerConfig != null) {
      String reverseAttributeString = (String) analyzerConfig.get(REVERSE_ATTRIBUTES_KEY);
      return IndexerUtil.getListFromString(reverseAttributeString, ",");
    }
    return null;
  }
View Full Code Here

    PerFieldAnalyzerWrapper analyzerWrapper = new PerFieldAnalyzerWrapper(createDefaultAnalyzer(config));
    configuredAnalyzerMap.clear();

    //Load analyzer config
    GenericConfiguration analyzerConfig = loadAnalyzerConfig(config);
    if (analyzerConfig != null) {
      ArrayList<String> addedReverseAttributes = new ArrayList<String>();
      List<String> reverseAttributes = getReverseAttributes(config);
      Map<String, GenericConfiguration> subconfigs = analyzerConfig.getSortedSubconfigs();
      if (subconfigs != null) {
        for (Map.Entry<String, GenericConfiguration> entry : subconfigs.entrySet()) {
          GenericConfiguration analyzerconfig = entry.getValue();
          String fieldname = analyzerconfig.getString(FIELD_NAME_KEY);
          String analyzerclass = analyzerconfig.getString(ANALYZER_CLASS_KEY);

          Analyzer analyzerInstance = createAnalyzer(analyzerclass, analyzerconfig);
          analyzerWrapper.addAnalyzer(fieldname, analyzerInstance);
          configuredAnalyzerMap.put(fieldname, analyzerInstance.getClass().getCanonicalName());
View Full Code Here

   */
  private static GenericConfiguration loadAnalyzerConfig(final GenericConfiguration config) {
    if (config.hasSubConfig(ANALYZER_CONFIG_KEY)) {
      return config.getSubConfig(ANALYZER_CONFIG_KEY);
    } else {
      GenericConfiguration analyzerConfig = null;
      String confpath = config.getString(ANALYZER_CONFIG_KEY);
      if (confpath != null) {
        analyzerConfig = new GenericConfiguration();
        try {
          CRConfigFileLoader.loadConfiguration(analyzerConfig, confpath, null);
        } catch (IOException e) {
          LOGGER.error("Could not load analyzer configuration from " + confpath, e);
        }
View Full Code Here

  public SynonymIndexExtension(final CRConfig config, IndexLocation callingLocation) {
    super(config, callingLocation);
    this.config = config;
    this.callingIndexLocation = callingLocation;

    GenericConfiguration synonymConf = (GenericConfiguration) config.get(SYNONYM_INDEX_KEY);
    synonymLocation = LuceneIndexLocation.getIndexLocation(new CRConfigUtil(synonymConf, SYNONYM_INDEX_KEY));
    synonymLocation.registerDirectoriesSpecial();

    reindexStrategy = initReindexStrategy(config);
View Full Code Here

  private static QueryParser getParser(final String[] searchedAttributes, final Analyzer analyzer,
      final CRRequest request, final CRConfig config, final Object subconfig) {
    QueryParser parser = null;
   
    if (subconfig != null && subconfig instanceof GenericConfiguration) {
      GenericConfiguration pconfig = (GenericConfiguration) subconfig;

      String parserClass = pconfig.getString(QUERY_PARSER_CLASS);
      if (parserClass != null) {
        parser = (QueryParser) Instanciator.getInstance(parserClass, new Object[][] {
            new Object[] {
            pconfig, LuceneVersion.getVersion(), searchedAttributes, analyzer, request },
            new Object[] {
View Full Code Here

TOP

Related Classes of com.gentics.cr.configuration.GenericConfiguration

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.