当前位置: 首页>>代码示例>>Java>>正文


Java PluginInfo.isDefault方法代码示例

本文整理汇总了Java中org.apache.solr.core.PluginInfo.isDefault方法的典型用法代码示例。如果您正苦于以下问题:Java PluginInfo.isDefault方法的具体用法?Java PluginInfo.isDefault怎么用?Java PluginInfo.isDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.core.PluginInfo的用法示例。


在下文中一共展示了PluginInfo.isDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.solr.core.PluginInfo; //导入方法依赖的package包/类
/**
 * Initializes the chain using the factories specified by the <code>PluginInfo</code>.
 * if the chain includes the <code>RunUpdateProcessorFactory</code>, but 
 * does not include an implementation of the 
 * <code>DistributingUpdateProcessorFactory</code> interface, then an 
 * instance of <code>DistributedUpdateProcessorFactory</code> will be 
 * injected immediately prior to the <code>RunUpdateProcessorFactory</code>.
 *
 * @see DistributingUpdateProcessorFactory
 * @see RunUpdateProcessorFactory
 * @see DistributedUpdateProcessorFactory
 */
@Override
public void init(PluginInfo info) {
  final String infomsg = "updateRequestProcessorChain \"" + 
    (null != info.name ? info.name : "") + "\"" + 
    (info.isDefault() ? " (default)" : "");

  log.info("creating " + infomsg);

  // wrap in an ArrayList so we know we know we can do fast index lookups 
  // and that add(int,Object) is supported
  List<UpdateRequestProcessorFactory> list = new ArrayList
    (solrCore.initPlugins(info.getChildren("processor"),UpdateRequestProcessorFactory.class,null));

  if(list.isEmpty()){
    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
                            infomsg + " require at least one processor");
  }

  int numDistrib = 0;
  int runIndex = -1;
  // hi->lo incase multiple run instances, add before first one
  // (no idea why someone might use multiple run instances, but just in case)
  for (int i = list.size()-1; 0 <= i; i--) {
    UpdateRequestProcessorFactory factory = list.get(i);
    if (factory instanceof DistributingUpdateProcessorFactory) {
      numDistrib++;
    }
    if (factory instanceof RunUpdateProcessorFactory) {
      runIndex = i;
    }
  }
  if (1 < numDistrib) {
    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
                            infomsg + " may not contain more then one " +
                            "instance of DistributingUpdateProcessorFactory");
  }
  if (0 <= runIndex && 0 == numDistrib) {
    // by default, add distrib processor immediately before run
    DistributedUpdateProcessorFactory distrib 
      = new DistributedUpdateProcessorFactory();
    distrib.init(new NamedList());
    list.add(runIndex, distrib);

    log.info("inserting DistributedUpdateProcessorFactory into " + infomsg);
  }

  chain = list.toArray(new UpdateRequestProcessorFactory[list.size()]); 
}
 
开发者ID:europeana,项目名称:search,代码行数:61,代码来源:UpdateRequestProcessorChain.java

示例2: init

import org.apache.solr.core.PluginInfo; //导入方法依赖的package包/类
/**
 * Initializes the chain using the factories specified by the <code>PluginInfo</code>.
 * if the chain includes the <code>RunUpdateProcessorFactory</code>, but 
 * does not include an implementation of the 
 * <code>DistributingUpdateProcessorFactory</code> interface, then an 
 * instance of <code>DistributedUpdateProcessorFactory</code> will be 
 * injected immediately prior to the <code>RunUpdateProcessorFactory</code>.
 *
 * @see DistributingUpdateProcessorFactory
 * @see RunUpdateProcessorFactory
 * @see DistributedUpdateProcessorFactory
 */
@Override
public void init(PluginInfo info) {
  final String infomsg = "updateRequestProcessorChain \"" + 
    (null != info.name ? info.name : "") + "\"" + 
    (info.isDefault() ? " (default)" : "");

  // wrap in an ArrayList so we know we know we can do fast index lookups 
  // and that add(int,Object) is supported
  List<UpdateRequestProcessorFactory> list = new ArrayList
    (solrCore.initPlugins(info.getChildren("processor"),UpdateRequestProcessorFactory.class,null));

  if(list.isEmpty()){
    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
                            infomsg + " require at least one processor");
  }

  int numDistrib = 0;
  int runIndex = -1;
  // hi->lo incase multiple run instances, add before first one
  // (no idea why someone might use multiple run instances, but just in case)
  for (int i = list.size()-1; 0 <= i; i--) {
    UpdateRequestProcessorFactory factory = list.get(i);
    if (factory instanceof DistributingUpdateProcessorFactory) {
      numDistrib++;
    }
    if (factory instanceof RunUpdateProcessorFactory) {
      runIndex = i;
    }
  }
  if (1 < numDistrib) {
    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
                            infomsg + " may not contain more then one " +
                            "instance of DistributingUpdateProcessorFactory");
  }
  if (0 <= runIndex && 0 == numDistrib) {
    // by default, add distrib processor immediately before run
    DistributedUpdateProcessorFactory distrib 
      = new DistributedUpdateProcessorFactory();
    distrib.init(new NamedList());
    list.add(runIndex, distrib);

    log.info("inserting DistributedUpdateProcessorFactory into " + infomsg);
  }

  chain = list.toArray(new UpdateRequestProcessorFactory[list.size()]); 
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:59,代码来源:UpdateRequestProcessorChain.java


注:本文中的org.apache.solr.core.PluginInfo.isDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。