Package org.apache.solr.core

Examples of org.apache.solr.core.SolrInfoMBean


    {
      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( "sourceId",    (m.getSourceId()   !=null ? m.getSourceId()    : 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;
  }
View Full Code Here


    Set<String> requestedKeys = arrayToSet(req.getParams().getParams("key"));
   
    Map<String, SolrInfoMBean> reg = core.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 catInfo = (NamedList) cats.get(m.getCategory().name());
      if ( null == catInfo ) continue;

      NamedList mBeanInfo = new SimpleOrderedMap();
      mBeanInfo.add("class", m.getName());
      mBeanInfo.add("version", m.getVersion());
      mBeanInfo.add("description", m.getDescription());
      mBeanInfo.add("srcId", m.getSourceId());
      mBeanInfo.add("src", m.getSource());
      mBeanInfo.add("docs", m.getDocs());
     
      if (req.getParams().getFieldBool(key, "stats", false))
        mBeanInfo.add("stats", m.getStatistics());
     
      catInfo.add(key, mBeanInfo);
    }
    rsp.setHttpCaching(false); // never cache, no matter what init config looks like
  }
View Full Code Here

   
    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.getSourceId() );
          assertNotNull( info.getVersion() );
          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 );
View Full Code Here

    Set<String> requestedKeys = arrayToSet(req.getParams().getParams("key"));
   
    Map<String, SolrInfoMBean> reg = core.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 catInfo = (NamedList) cats.get(m.getCategory().name());
      if ( null == catInfo ) continue;

      NamedList mBeanInfo = new SimpleOrderedMap();
      mBeanInfo.add("class", m.getName());
      mBeanInfo.add("version", m.getVersion());
      mBeanInfo.add("description", m.getDescription());
      mBeanInfo.add("srcId", m.getSourceId());
      mBeanInfo.add("src", m.getSource());
      mBeanInfo.add("docs", m.getDocs());
     
      if (req.getParams().getFieldBool(key, "stats", false))
        mBeanInfo.add("stats", m.getStatistics());
     
      catInfo.add(key, mBeanInfo);
    }
    rsp.setHttpCaching(false); // never cache, no matter what init config looks like
  }
View Full Code Here

    {
      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( "sourceId",    (m.getSourceId()   !=null ? m.getSourceId()    : 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;
  }
View Full Code Here

   
    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.getSourceId() );
          assertNotNull( info.getVersion() );
          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 );
View Full Code Here

      SimpleOrderedMap<Object> category = new SimpleOrderedMap<Object>();
      list.add( cat.name(), category );
      Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
      synchronized(reg) {
        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( "sourceId",    (m.getSourceId()   !=null ? m.getSourceId()    : 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;
View Full Code Here

    {
      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( "sourceId",    (m.getSourceId()   !=null ? m.getSourceId()    : 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;
  }
View Full Code Here

        assertQ(req("text:something"), "//*[@numFound='1']");

        Map<String, SolrInfoMBean> infoRegistry = h.getCore().getInfoRegistry();

        // check the stats of the queryResultCache
        SolrInfoMBean solrInfoMBean = infoRegistry.get("queryResultCache");
        NamedList stats = solrInfoMBean.getStatistics();
        Long hits = (Long) stats.get("hits");
        assertEquals(Long.valueOf(0l), hits);
        Long lookups = (Long) stats.get("lookups");
        assertEquals(Long.valueOf(1l), lookups);
        Long inserts = (Long) stats.get("inserts");
View Full Code Here

        assertQ(req, "//*[@numFound='1']");

        Map<String, SolrInfoMBean> infoRegistry = h.getCore().getInfoRegistry();

        // check the stats of the documentCache
        SolrInfoMBean solrInfoMBean = infoRegistry.get("documentCache");
        NamedList stats = solrInfoMBean.getStatistics();
        Long lookups = (Long) stats.get("lookups");
        assertEquals(Long.valueOf(8l), lookups);
        Long inserts = (Long) stats.get("inserts");
        assertEquals(Long.valueOf(1l), inserts);
        Long hits = (Long) stats.get("hits");
View Full Code Here

TOP

Related Classes of org.apache.solr.core.SolrInfoMBean

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.