本文整理汇总了Java中org.apache.solr.core.SolrInfoMBean类的典型用法代码示例。如果您正苦于以下问题:Java SolrInfoMBean类的具体用法?Java SolrInfoMBean怎么用?Java SolrInfoMBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SolrInfoMBean类属于org.apache.solr.core包,在下文中一共展示了SolrInfoMBean类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addMBean
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
private void addMBean(SolrQueryRequest req, NamedList<NamedList<NamedList<Object>>> cats, Set<String> requestedKeys, String key, SolrInfoMBean m) {
if ( ! ( requestedKeys.isEmpty() || requestedKeys.contains(key) ) ) return;
NamedList<NamedList<Object>> catInfo = cats.get(m.getCategory().name());
if ( null == catInfo ) return;
NamedList<Object> mBeanInfo = new SimpleOrderedMap<>();
mBeanInfo.add("class", m.getName());
mBeanInfo.add("version", m.getVersion());
mBeanInfo.add("description", m.getDescription());
mBeanInfo.add("src", m.getSource());
// Use an external form
URL[] urls = m.getDocs();
if(urls!=null) {
List<String> docs = new ArrayList<>(urls.length);
for(URL url : urls) {
docs.add(url.toExternalForm());
}
mBeanInfo.add("docs", docs);
}
if (req.getParams().getFieldBool(key, "stats", false))
mBeanInfo.add("stats", m.getStatistics());
catInfo.add(key, mBeanInfo);
}
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:SolrInfoMBeanHandler.java
示例2: getRegisteredSearchers
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
private List<SolrIndexSearcher> getRegisteredSearchers()
{
List<SolrIndexSearcher> searchers = new ArrayList<SolrIndexSearcher>();
for (Entry<String, SolrInfoMBean> entry : core.getInfoRegistry().entrySet())
{
if (entry.getValue() != null)
{
if (entry.getValue().getName().equals(SolrIndexSearcher.class.getName()))
{
if (!entry.getKey().equals("searcher"))
{
searchers.add((SolrIndexSearcher) entry.getValue());
}
}
}
}
return searchers;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:SolrInformationServer.java
示例3: getRegisteredSearchers
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
protected List<SolrIndexSearcher> getRegisteredSearchers()
{
List<SolrIndexSearcher> searchers = new ArrayList<SolrIndexSearcher>();
for (String key : core.getInfoRegistry().keySet())
{
SolrInfoMBean mBean = core.getInfoRegistry().get(key);
if (mBean != null)
{
if (mBean.getName().equals(SolrIndexSearcher.class.getName()))
{
if (!key.equals("searcher"))
{
searchers.add((SolrIndexSearcher) mBean);
}
}
}
}
return searchers;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:LegacySolrInformationServer.java
示例4: getRegisteredSearcherCount
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
@Override
public int getRegisteredSearcherCount()
{
HashSet<String> keys = new HashSet<String>();
for (String key : core.getInfoRegistry().keySet())
{
SolrInfoMBean mBean = core.getInfoRegistry().get(key);
if (mBean != null)
{
if (mBean.getName().equals(SolrIndexSearcher.class.getName()))
{
if (!key.equals("searcher"))
{
keys.add(key);
}
}
}
}
log.info(".... registered Searchers for " + core.getName() + " = " + keys.size());
return keys.size();
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:LegacySolrInformationServer.java
示例5: getMBeanInfo
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
protected NamedList<NamedList<NamedList<Object>>> getMBeanInfo(SolrQueryRequest req) {
NamedList<NamedList<NamedList<Object>>> cats = new NamedList<>();
String[] requestedCats = req.getParams().getParams("cat");
if (null == requestedCats || 0 == requestedCats.length) {
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
cats.add(cat.name(), new SimpleOrderedMap<NamedList<Object>>());
}
} else {
for (String catName : requestedCats) {
cats.add(catName,new SimpleOrderedMap<NamedList<Object>>());
}
}
Set<String> requestedKeys = arrayToSet(req.getParams().getParams("key"));
Map<String, SolrInfoMBean> reg = req.getCore().getInfoRegistry();
for (Map.Entry<String, SolrInfoMBean> entry : reg.entrySet()) {
addMBean(req, cats, requestedKeys, entry.getKey(),entry.getValue());
}
for (SolrInfoMBean infoMBean : req.getCore().getCoreDescriptor().getCoreContainer().getResourceLoader().getInfoMBeans()) {
addMBean(req,cats,requestedKeys,infoMBean.getName(),infoMBean);
}
return cats;
}
开发者ID:europeana,项目名称:search,代码行数:28,代码来源:SolrInfoMBeanHandler.java
示例6: getSolrInfoBeans
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
private static SimpleOrderedMap<Object> getSolrInfoBeans( SolrCore core, boolean stats )
{
SimpleOrderedMap<Object> list = new SimpleOrderedMap<>();
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values())
{
SimpleOrderedMap<Object> category = new SimpleOrderedMap<>();
list.add( cat.name(), category );
Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
SolrInfoMBean m = entry.getValue();
if (m.getCategory() != cat) continue;
String na = "Not Declared";
SimpleOrderedMap<Object> info = new SimpleOrderedMap<>();
category.add( entry.getKey(), info );
info.add( "name", (m.getName() !=null ? m.getName() : na) );
info.add( "version", (m.getVersion() !=null ? m.getVersion() : na) );
info.add( "description", (m.getDescription()!=null ? m.getDescription() : na) );
info.add( "source", (m.getSource() !=null ? m.getSource() : na) );
URL[] urls = m.getDocs();
if ((urls != null) && (urls.length > 0)) {
ArrayList<String> docs = new ArrayList<>(urls.length);
for( URL u : urls ) {
docs.add( u.toExternalForm() );
}
info.add( "docs", docs );
}
if( stats ) {
info.add( "stats", m.getStatistics() );
}
}
}
return list;
}
开发者ID:europeana,项目名称:search,代码行数:38,代码来源:PluginInfoHandler.java
示例7: testCallMBeanInfo
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
/**
* Gets a list of everything we can find in the classpath and makes sure it has
* a name, description, etc...
*/
public void testCallMBeanInfo() throws Exception {
List<Class> classes = new ArrayList<>();
classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(SearchHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(SearchComponent.class.getPackage().getName()));
classes.addAll(getClassesForPackage(LukeRequestHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(DefaultSolrHighlighter.class.getPackage().getName()));
classes.addAll(getClassesForPackage(LRUCache.class.getPackage().getName()));
// System.out.println(classes);
int checked = 0;
for( Class clazz : classes ) {
if( SolrInfoMBean.class.isAssignableFrom( clazz ) ) {
try {
SolrInfoMBean info = (SolrInfoMBean)clazz.newInstance();
//System.out.println( info.getClass() );
assertNotNull( info.getName() );
assertNotNull( info.getDescription() );
assertNotNull( info.getCategory() );
if( info instanceof LRUCache ) {
continue;
}
assertNotNull( info.toString() );
// increase code coverage...
assertNotNull( info.getDocs() + "" );
assertNotNull( info.getStatistics()+"" );
checked++;
}
catch( InstantiationException ex ) {
// expected...
//System.out.println( "unable to initalize: "+clazz );
}
}
}
assertTrue( "there are at least 10 SolrInfoMBean that should be found in the classpath, found " + checked, checked > 10 );
}
开发者ID:europeana,项目名称:search,代码行数:44,代码来源:SolrInfoMBeanTest.java
示例8: execute
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
@Override
public void execute(AgentOrder agentOrder) {
SolrEventBuilder solrEventBuilder = SolrEventBuilder.createStatisticsBuilder(this.getEventBuilderData(),
this.getCoreName());
Map<String, SolrInfoMBean> infoRegistry = this.solrCore.getInfoRegistry();
this.addIndexStatistics(solrEventBuilder, infoRegistry);
this.addUpdateStatistics(solrEventBuilder, infoRegistry);
this.addReplicationStatistics(solrEventBuilder, infoRegistry);
this.addCacheStatistics(solrEventBuilder, infoRegistry);
this.sendEvent(solrEventBuilder.toEvent());
}
开发者ID:Indoqa,项目名称:logspace,代码行数:14,代码来源:SolrCoreStatisticsAgent.java
示例9: addReplicationStatistics
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
private void addReplicationStatistics(SolrEventBuilder solrEventBuilder, Map<String, SolrInfoMBean> infoRegistry) {
SolrInfoMBean mBean = infoRegistry.get("/replication");
if (mBean == null) {
return;
}
NamedList<?> statistics = mBean.getStatistics();
solrEventBuilder.setIndexSize(getIndexSize(statistics));
solrEventBuilder.setGeneration(getLong(statistics, "generation"));
solrEventBuilder.setIndexVersion(getLong(statistics, "indexVersion"));
solrEventBuilder.setIsMaster(getBoolean(statistics, "isMaster"));
solrEventBuilder.setIsSlave(getBoolean(statistics, "isSlave"));
}
开发者ID:Indoqa,项目名称:logspace,代码行数:15,代码来源:SolrCoreStatisticsAgent.java
示例10: addUpdateStatistics
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
private void addUpdateStatistics(SolrEventBuilder solrEventBuilder, Map<String, SolrInfoMBean> infoRegistry) {
SolrInfoMBean mBean = infoRegistry.get("updateHandler");
if (mBean == null) {
return;
}
NamedList<?> statistics = mBean.getStatistics();
solrEventBuilder.setUpdates(getLong(statistics, "cumulative_adds"));
solrEventBuilder.setDeletes(getLong(statistics, "cumulative_deletesByQuery") + getLong(statistics, "cumulative_deletesById"));
solrEventBuilder.setCommits(getLong(statistics, "commits"));
}
开发者ID:Indoqa,项目名称:logspace,代码行数:13,代码来源:SolrCoreStatisticsAgent.java
示例11: setUpBase
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
@Before
public void setUpBase() throws Exception
{
coreContainer = new CoreContainer();
coreDescriptor = new CoreDescriptor(coreContainer, "name", "instanceDir");
when(resourceLoader.getCoreProperties()).thenReturn(new Properties());
// SolrCore is final, we can't mock with mockito
core = new SolrCore("name", coreDescriptor);
FieldUtils.writeField(core, "updateHandler", updateHandler, true);
FieldUtils.writeField(core, "resourceLoader", resourceLoader, true);
infoRegistry = new HashMap<String, SolrInfoMBean>();
FieldUtils.writeField(core, "infoRegistry", infoRegistry, true);
reqHandlers = new RequestHandlers(core);
reqHandlers.register("/select", selectRequestHandler);
reqHandlers.register("/afts", aftsRequestHandler);
FieldUtils.writeField(core, "reqHandlers", reqHandlers, true);
Map<String, UpdateRequestProcessorChain> map = new HashMap<>();
UpdateRequestProcessorFactory[] factories = new UpdateRequestProcessorFactory[] { runUpdateProcessorFactory };
when(runUpdateProcessorFactory.getInstance(any(SolrQueryRequest.class), any(SolrQueryResponse.class),
any(UpdateRequestProcessor.class))).thenReturn(processor);
UpdateRequestProcessorChain def = new UpdateRequestProcessorChain(factories, core);
map.put(null, def);
map.put("", def);
FieldUtils.writeField(core, "updateProcessorChains", map, true);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:28,代码来源:SolrCoreTestBase.java
示例12: getSolrInfoBeans
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
private static SimpleOrderedMap<Object> getSolrInfoBeans( SolrCore core, boolean stats )
{
SimpleOrderedMap<Object> list = new SimpleOrderedMap<Object>();
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values())
{
SimpleOrderedMap<Object> category = new SimpleOrderedMap<Object>();
list.add( cat.name(), category );
Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
SolrInfoMBean m = entry.getValue();
if (m.getCategory() != cat) continue;
String na = "Not Declared";
SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
category.add( entry.getKey(), info );
info.add( "name", (m.getName() !=null ? m.getName() : na) );
info.add( "version", (m.getVersion() !=null ? m.getVersion() : na) );
info.add( "description", (m.getDescription()!=null ? m.getDescription() : na) );
info.add( "source", (m.getSource() !=null ? m.getSource() : na) );
URL[] urls = m.getDocs();
if ((urls != null) && (urls.length > 0)) {
ArrayList<String> docs = new ArrayList<String>(urls.length);
for( URL u : urls ) {
docs.add( u.toExternalForm() );
}
info.add( "docs", docs );
}
if( stats ) {
info.add( "stats", m.getStatistics() );
}
}
}
return list;
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:38,代码来源:PluginInfoHandler.java
示例13: getCategory
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
@Override
public final Category getCategory() {
return SolrInfoMBean.Category.OTHER;
}
开发者ID:TYPO3-Solr,项目名称:solr-typo3-plugin,代码行数:5,代码来源:AccessFilterQParserPlugin.java
示例14: testCacheImpacts
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
/**
* test that our assumptions about how caches are affected hold true
*/
public void testCacheImpacts() throws Exception {
// cursor queryies can't live in the queryResultCache, but independent filters
// should still be cached & reused
// don't add in order of any field to ensure we aren't inadvertantly
// counting on internal docid ordering
assertU(adoc("id", "9", "str", "c", "float", "-3.2", "int", "42"));
assertU(adoc("id", "7", "str", "c", "float", "-3.2", "int", "-1976"));
assertU(adoc("id", "2", "str", "c", "float", "-3.2", "int", "666"));
assertU(adoc("id", "0", "str", "b", "float", "64.5", "int", "-42"));
assertU(adoc("id", "5", "str", "b", "float", "64.5", "int", "2001"));
assertU(adoc("id", "8", "str", "b", "float", "64.5", "int", "4055"));
assertU(adoc("id", "6", "str", "a", "float", "64.5", "int", "7"));
assertU(adoc("id", "1", "str", "a", "float", "64.5", "int", "7"));
assertU(adoc("id", "4", "str", "a", "float", "11.1", "int", "6"));
assertU(adoc("id", "3", "str", "a", "float", "11.1", "int", "3"));
assertU(commit());
final Collection<String> allFieldNames = getAllSortFieldNames();
final SolrInfoMBean filterCacheStats
= h.getCore().getInfoRegistry().get("filterCache");
assertNotNull(filterCacheStats);
final SolrInfoMBean queryCacheStats
= h.getCore().getInfoRegistry().get("queryResultCache");
assertNotNull(queryCacheStats);
final long preQcIn = (Long) queryCacheStats.getStatistics().get("inserts");
final long preFcIn = (Long) filterCacheStats.getStatistics().get("inserts");
final long preFcHits = (Long) filterCacheStats.getStatistics().get("hits");
SentinelIntSet ids = assertFullWalkNoDups
(10, params("q", "*:*",
"rows",""+TestUtil.nextInt(random(),1,11),
"fq", "-id:[1 TO 2]",
"fq", "-id:[6 TO 7]",
"fl", "id",
"sort", buildRandomSort(allFieldNames)));
assertEquals(6, ids.size());
final long postQcIn = (Long) queryCacheStats.getStatistics().get("inserts");
final long postFcIn = (Long) filterCacheStats.getStatistics().get("inserts");
final long postFcHits = (Long) filterCacheStats.getStatistics().get("hits");
assertEquals("query cache inserts changed", preQcIn, postQcIn);
// NOTE: use of pure negative filters causees "*:* to be tracked in filterCache
assertEquals("filter cache did not grow correctly", 3, postFcIn-preFcIn);
assertTrue("filter cache did not have any new cache hits", 0 < postFcHits-preFcHits);
}
开发者ID:europeana,项目名称:search,代码行数:55,代码来源:CursorPagingTest.java
示例15: getMBeanInfo
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
protected NamedList<NamedList<NamedList<Object>>> getMBeanInfo(SolrQueryRequest req) {
NamedList<NamedList<NamedList<Object>>> cats = new NamedList<NamedList<NamedList<Object>>>();
String[] requestedCats = req.getParams().getParams("cat");
if (null == requestedCats || 0 == requestedCats.length) {
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
cats.add(cat.name(), new SimpleOrderedMap<NamedList<Object>>());
}
} else {
for (String catName : requestedCats) {
cats.add(catName,new SimpleOrderedMap<NamedList<Object>>());
}
}
Set<String> requestedKeys = arrayToSet(req.getParams().getParams("key"));
Map<String, SolrInfoMBean> reg = req.getCore().getInfoRegistry();
for (Map.Entry<String, SolrInfoMBean> entry : reg.entrySet()) {
String key = entry.getKey();
SolrInfoMBean m = entry.getValue();
if ( ! ( requestedKeys.isEmpty() || requestedKeys.contains(key) ) ) continue;
NamedList<NamedList<Object>> catInfo = cats.get(m.getCategory().name());
if ( null == catInfo ) continue;
NamedList<Object> mBeanInfo = new SimpleOrderedMap<Object>();
mBeanInfo.add("class", m.getName());
mBeanInfo.add("version", m.getVersion());
mBeanInfo.add("description", m.getDescription());
mBeanInfo.add("src", m.getSource());
// Use an external form
URL[] urls = m.getDocs();
if(urls!=null) {
List<String> docs = new ArrayList<String>(urls.length);
for(URL url : urls) {
docs.add(url.toExternalForm());
}
mBeanInfo.add("docs", docs);
}
if (req.getParams().getFieldBool(key, "stats", false))
mBeanInfo.add("stats", m.getStatistics());
catInfo.add(key, mBeanInfo);
}
return cats;
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:51,代码来源:SolrInfoMBeanHandler.java
示例16: testCallMBeanInfo
import org.apache.solr.core.SolrInfoMBean; //导入依赖的package包/类
/**
* Gets a list of everything we can find in the classpath and makes sure it has
* a name, description, etc...
*/
public void testCallMBeanInfo() throws Exception {
List<Class> classes = new ArrayList<Class>();
classes.addAll(getClassesForPackage(StandardRequestHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(SearchHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(SearchComponent.class.getPackage().getName()));
classes.addAll(getClassesForPackage(LukeRequestHandler.class.getPackage().getName()));
classes.addAll(getClassesForPackage(DefaultSolrHighlighter.class.getPackage().getName()));
classes.addAll(getClassesForPackage(LRUCache.class.getPackage().getName()));
// System.out.println(classes);
int checked = 0;
for( Class clazz : classes ) {
if( SolrInfoMBean.class.isAssignableFrom( clazz ) ) {
try {
SolrInfoMBean info = (SolrInfoMBean)clazz.newInstance();
//System.out.println( info.getClass() );
assertNotNull( info.getName() );
assertNotNull( info.getDescription() );
assertNotNull( info.getSource() );
assertNotNull( info.getCategory() );
// Make sure the URL has the classname in it
//assertTrue(info.getSource(), info.getSource().indexOf(info.getClass().getSimpleName()+".java")>0 );
if( info instanceof LRUCache ) {
continue;
}
assertNotNull( info.toString() );
// increase code coverage...
assertNotNull( info.getDocs() + "" );
assertNotNull( info.getStatistics()+"" );
checked++;
}
catch( InstantiationException ex ) {
// expected...
//System.out.println( "unable to initalize: "+clazz );
}
}
}
assertTrue( "there are at least 10 SolrInfoMBean that should be found in the classpath, found " + checked, checked > 10 );
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:48,代码来源:SolrInfoMBeanTest.java
注:本文中的org.apache.solr.core.SolrInfoMBean类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论