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


Java PluginInfo类代码示例

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


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

示例1: clearLog

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
/**
 * Clears the logs on the file system. Only call before init.
 * 
 * @param core the SolrCore
 * @param ulogPluginInfo the init info for the UpdateHandler
 */
@Override
public void clearLog(SolrCore core, PluginInfo ulogPluginInfo) {
  if (ulogPluginInfo == null) return;
  Path tlogDir = new Path(getTlogDir(core, ulogPluginInfo));
  try {
    if (fs != null && fs.exists(tlogDir)) {
      String[] files = getLogList(tlogDir);
      for (String file : files) {
        Path f = new Path(tlogDir, file);
        boolean s = fs.delete(f, false);
        if (!s) {
          log.error("Could not remove tlog file:" + f);
        }
      }
    }
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:HdfsUpdateLog.java

示例2: newInstance

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
/**
 * Create a new ShardHandlerFactory instance
 * @param info    a PluginInfo object defining which type to create.  If null,
 *                the default {@link HttpShardHandlerFactory} will be used
 * @param loader  a SolrResourceLoader used to find the ShardHandlerFactory classes
 * @return a new, initialized ShardHandlerFactory instance
 */
public static ShardHandlerFactory newInstance(PluginInfo info, SolrResourceLoader loader) {
  if (info == null)
    info = DEFAULT_SHARDHANDLER_INFO;

  try {
    ShardHandlerFactory shf = loader.findClass(info.className, ShardHandlerFactory.class).newInstance();
    if (PluginInfoInitialized.class.isAssignableFrom(shf.getClass()))
      PluginInfoInitialized.class.cast(shf).init(info);
    return shf;
  }
  catch (Exception e) {
    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
        String.format(Locale.ROOT, "Error instantiating shardHandlerFactory class [%s]: %s",
            info.className, e.getMessage()));
  }

}
 
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:ShardHandlerFactory.java

示例3: inform

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
@Override
public void inform(SolrCore core) {
  List<PluginInfo> children = info.getChildren("highlighting");
  if(children.isEmpty()) {
    PluginInfo pluginInfo = core.getSolrConfig().getPluginInfo(SolrHighlighter.class.getName()); //TODO deprecated configuration remove later
    if (pluginInfo != null) {
      highlighter = core.createInitInstance(pluginInfo, SolrHighlighter.class, null, DefaultSolrHighlighter.class.getName());
      highlighter.initalize(core.getSolrConfig());
    } else {
      DefaultSolrHighlighter defHighlighter = new DefaultSolrHighlighter(core);
      defHighlighter.init(PluginInfo.EMPTY_INFO);
      highlighter = defHighlighter;
    }
  } else {
    highlighter = core.createInitInstance(children.get(0),SolrHighlighter.class,null, DefaultSolrHighlighter.class.getName());
  }

}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:HighlightComponent.java

示例4: getResourceNameToBeUsed

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
/** 
 * Returns the resource name that will be used: if the schema is managed, the resource
 * name will be drawn from the schema factory configuration in the given SolrConfig.
 * Otherwise, the given resourceName will be returned.
 * 
 * @param resourceName The name to use if the schema is not managed
 * @param config The SolrConfig from which to get the schema factory config
 * @return If the schema is managed, the resource name from the given SolrConfig,
 *         otherwise the given resourceName. 
 */
public static String getResourceNameToBeUsed(String resourceName, SolrConfig config) {
  PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
  final String nonManagedResourceName = null == resourceName ? IndexSchema.DEFAULT_SCHEMA_FILE : resourceName;
  if (null == info) {
    return nonManagedResourceName;
  }
  String managedSchemaResourceName
      = (String)info.initArgs.get(ManagedIndexSchemaFactory.MANAGED_SCHEMA_RESOURCE_NAME);
  if (null == managedSchemaResourceName) {
    managedSchemaResourceName = ManagedIndexSchemaFactory.DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME;
  }
  if ((new File(config.getResourceLoader().getConfigDir(), managedSchemaResourceName)).exists()) {
    return managedSchemaResourceName;
  }
  return nonManagedResourceName;
}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:IndexSchemaFactory.java

示例5: clearLog

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
private void clearLog(PluginInfo ulogPluginInfo) {
  if (ulogPluginInfo == null) return;
  File tlogDir = UpdateLog.getTlogDir(core, ulogPluginInfo);
  log.info("Clearing tlog files, tlogDir=" + tlogDir);
  if (tlogDir.exists()) {
    String[] files = UpdateLog.getLogList(tlogDir);
    for (String file : files) {
      File f = new File(tlogDir, file);
      boolean s = f.delete();
      if (!s) {
        log.error("Could not remove tlog file:" + f.getAbsolutePath());
        //throw new SolrException(ErrorCode.SERVER_ERROR, "Could not remove tlog file:" + f.getAbsolutePath());
      }
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:UpdateHandler.java

示例6: UpdateHandler

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
public UpdateHandler(SolrCore core, UpdateLog updateLog)  {
  this.core=core;
  schema = core.getSchema();
  idField = schema.getUniqueKeyField();
  idFieldType = idField!=null ? idField.getType() : null;
  parseEventListeners();
  PluginInfo ulogPluginInfo = core.getSolrConfig().getPluginInfo(UpdateLog.class.getName());
  if (!core.isReloaded() && !core.getDirectoryFactory().isPersistent()) {
    clearLog(ulogPluginInfo);
  }
  if (updateLog == null) {
    initLog(ulogPluginInfo);
  } else {
    this.ulog = updateLog;
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:UpdateHandler.java

示例7: clearLog

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
private void clearLog(PluginInfo ulogPluginInfo) {
	if(ulogPluginInfo == null)
		return;
	File tlogDir = UpdateLog.getTlogDir(core, ulogPluginInfo);
	log.info("Clearing tlog files, tlogDir=" + tlogDir);
	if(tlogDir.exists()) {
		String[] files = UpdateLog.getLogList(tlogDir);
		for(String file : files) {
			File f = new File(tlogDir, file);
			boolean s = f.delete();
			if(!s) {
				log.error("Could not remove tlog file:" + f.getAbsolutePath());
				//throw new SolrException(ErrorCode.SERVER_ERROR, "Could not remove tlog file:" + f.getAbsolutePath());
			}
		}
	}
}
 
开发者ID:netboynb,项目名称:search-core,代码行数:18,代码来源:UpdateHandler.java

示例8: UpdateHandler

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
public UpdateHandler(SolrCore core, UpdateLog updateLog) {
	this.core = core;
	schema = core.getSchema();
	idField = schema.getUniqueKeyField();
	idFieldType = idField != null ? idField.getType() : null;
	parseEventListeners();
	PluginInfo ulogPluginInfo = core.getSolrConfig().getPluginInfo(UpdateLog.class.getName());
	if(!core.isReloaded() && !core.getDirectoryFactory().isPersistent()) {
		clearLog(ulogPluginInfo);
	}
	if(updateLog == null) {
		initLog(ulogPluginInfo);
	} else {
		this.ulog = updateLog;
	}
}
 
开发者ID:netboynb,项目名称:search-core,代码行数:17,代码来源:UpdateHandler.java

示例9: clearLog

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
/**
 * Clears the logs on the file system. Only call before init.
 * 
 * @param core the SolrCore
 * @param ulogPluginInfo the init info for the UpdateHandler
 */
@Override
public void clearLog(SolrCore core, PluginInfo ulogPluginInfo) {
  if (ulogPluginInfo == null) return;
  Path tlogDir = new Path(getTlogDir(core, ulogPluginInfo));
  try {
    if (fs.exists(tlogDir)) {
      String[] files = getLogList(tlogDir);
      for (String file : files) {
        Path f = new Path(tlogDir, file);
        boolean s = fs.delete(f, false);
        if (!s) {
          log.error("Could not remove tlog file:" + f);
        }
      }
    }
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:26,代码来源:HdfsUpdateLog.java

示例10: init

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
@Override
public void init(PluginInfo info) {
  for (PluginInfo child : info.children) {
    if ("shardHandlerFactory".equals(child.type)) {
      this.shfInfo = child;
      break;
    }
  }
  init(info.initArgs);
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:11,代码来源:AbstractReSearcherComponent.java

示例11: getTlogDir

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
protected String getTlogDir(SolrCore core, PluginInfo info) {
  String dataDir = (String) info.initArgs.get("dir");
  
  String ulogDir = core.getCoreDescriptor().getUlogDir();
  if (ulogDir != null) {
    dataDir = ulogDir;
  }
  
  if (dataDir == null || dataDir.length() == 0) {
    dataDir = core.getDataDir();
  }

  return dataDir + "/" + TLOG_NAME;
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:UpdateLog.java

示例12: clearLog

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
/**
 * Clears the logs on the file system. Only call before init.
 * 
 * @param core the SolrCore
 * @param ulogPluginInfo the init info for the UpdateHandler
 */
public void clearLog(SolrCore core, PluginInfo ulogPluginInfo) {
  if (ulogPluginInfo == null) return;
  File tlogDir = new File(getTlogDir(core, ulogPluginInfo));
  if (tlogDir.exists()) {
    String[] files = getLogList(tlogDir);
    for (String file : files) {
      File f = new File(tlogDir, file);
      boolean s = f.delete();
      if (!s) {
        log.error("Could not remove tlog file:" + f);
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:UpdateLog.java

示例13: init

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
@Override
public void init(PluginInfo info) {
  dataDir = (String) info.initArgs.get("dir");
  
  defaultSyncLevel = SyncLevel.getSyncLevel((String) info.initArgs
      .get("syncLevel"));
  
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:HdfsUpdateLog.java

示例14: init

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
@Override
public void init(PluginInfo info) {
  init(info.initArgs);
  for (PluginInfo child : info.children) {
    if("shardHandlerFactory".equals(child.type)){
      this.shfInfo = child;
      break;
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:SearchHandler.java

示例15: buildIndexSchema

import org.apache.solr.core.PluginInfo; //导入依赖的package包/类
/** Instantiates the configured schema factory, then calls create on it. */
public static IndexSchema buildIndexSchema(String resourceName, SolrConfig config) {
  PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
  IndexSchemaFactory factory;
  if (null != info) {
    factory = config.getResourceLoader().newInstance(info.className, IndexSchemaFactory.class);
    factory.init(info.initArgs);
  } else {
    factory = new ClassicIndexSchemaFactory();
  }
  IndexSchema schema = factory.create(resourceName, config);
  return schema;
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:IndexSchemaFactory.java


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