Re: How to retrieve all available Cores in a static way ?

2009-05-20 Thread Andrey Klochkov
AFAIK there's no way of getting it in static way. If you look into
SolrDispatchFilter.java, you'll see this lines:

// put the core container in request attribute
req.setAttribute(org.apache.solr.CoreContainer, cores);

So later in your servlet you can get this request attribute, I do it in this
way.

On Tue, May 19, 2009 at 7:21 PM, Giovanni De Stefano 
giovanni.destef...@gmail.com wrote:

 Hello all,

 I have a quick question but I cannot find a quick answer :-)

 I have a Java client running on the same JVM where Solr is running.

 The Solr I have is a multicore.

 How can I retrieve from the Java client the different cores available?

 I tried with:

 ...
 CoreContainer container = new CoreContainer();
 CollectionSolrCore cores = container.getCores();
 ...

 but I get nothing useful... :-(

 Is there any static method that lets me get this collection?

 Thanks a lot!

 Giovanni




-- 
Andrew Klochkov


Re: How to retrieve all available Cores in a static way ?

2009-05-20 Thread Ryan McKinley

I cringe to suggest this but you can use the deprecated call:
 SolrCore.getSolrCore().getCoreContainer()


On May 19, 2009, at 11:21 AM, Giovanni De Stefano wrote:


Hello all,

I have a quick question but I cannot find a quick answer :-)

I have a Java client running on the same JVM where Solr is running.

The Solr I have is a multicore.

How can I retrieve from the Java client the different cores available?

I tried with:

...
CoreContainer container = new CoreContainer();
CollectionSolrCore cores = container.getCores();
...

but I get nothing useful... :-(

Is there any static method that lets me get this collection?

Thanks a lot!

Giovanni




Re: How to retrieve all available Cores in a static way ?

2009-05-20 Thread Giovanni De Stefano
Thank you all for your replies.

I guess I will stick with another approach: all my request handlers inherit
from a custom base handler which is CoreAware.

Its inform(core) method notifies a static map hold by another object
avoiding duplicates.

Thanks again!

Giovanni

On Wed, May 20, 2009 at 3:17 PM, Ryan McKinley ryan...@gmail.com wrote:

 I cringe to suggest this but you can use the deprecated call:
  SolrCore.getSolrCore().getCoreContainer()



 On May 19, 2009, at 11:21 AM, Giovanni De Stefano wrote:

  Hello all,

 I have a quick question but I cannot find a quick answer :-)

 I have a Java client running on the same JVM where Solr is running.

 The Solr I have is a multicore.

 How can I retrieve from the Java client the different cores available?

 I tried with:

 ...
 CoreContainer container = new CoreContainer();
 CollectionSolrCore cores = container.getCores();
 ...

 but I get nothing useful... :-(

 Is there any static method that lets me get this collection?

 Thanks a lot!

 Giovanni





How to retrieve all available Cores in a static way ?

2009-05-19 Thread Giovanni De Stefano
Hello all,

I have a quick question but I cannot find a quick answer :-)

I have a Java client running on the same JVM where Solr is running.

The Solr I have is a multicore.

How can I retrieve from the Java client the different cores available?

I tried with:

...
CoreContainer container = new CoreContainer();
CollectionSolrCore cores = container.getCores();
...

but I get nothing useful... :-(

Is there any static method that lets me get this collection?

Thanks a lot!

Giovanni