jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1456066 - in /jackrabbit/oak/trunk/oak-solr-embedded: ./ src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/
Date Wed, 13 Mar 2013 18:04:41 GMT
Author: tommaso
Date: Wed Mar 13 18:04:41 2013
New Revision: 1456066

URL: http://svn.apache.org/r1456066
Log:
OAK-700 - fixing export packages directive, using Lucene Codecs to inject SPIs in classloader

Modified:
    jackrabbit/oak/trunk/oak-solr-embedded/pom.xml
    jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java
    jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java

Modified: jackrabbit/oak/trunk/oak-solr-embedded/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/pom.xml?rev=1456066&r1=1456065&r2=1456066&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/pom.xml Wed Mar 13 18:04:41 2013
@@ -58,22 +58,8 @@
               !org.ietf.*,
               !org.eclipse.jetty.jmx.*,
               !org.apache.zookeeper.server.quorum.flexible.*,
-              !org.mortbay.jetty.*,
               !org.mortbay.util.*,
               !org.mortbay.log,
-              !com.sun.msv.*,
-              !org.relaxng.datatype,
-              !org.apache.tika.*,
-              !javax.servlet.jsp.*,
-              !org.apache.commons.digester.*,
-              !org.apache.commons.validator.*,
-              !org.apache.log.*,
-              !org.apache.struts.*,
-              !org.apache.tools.ant.*,
-              !org.dom4j.*,
-              !org.jdom.*,
-              !com.werken.*,
-              !org.apache.oro.*,
               *
             </Import-Package>
             <DynamicImport-Package>*</DynamicImport-Package>
@@ -159,6 +145,12 @@
       <artifactId>lucene-core</artifactId>
       <version>${solr.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-codecs</artifactId>
+      <version>${solr.version}</version>
+    </dependency>
+
 
     <dependency>
       <groupId>org.apache.felix</groupId>

Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java?rev=1456066&r1=1456065&r2=1456066&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrConfigurationProvider.java
Wed Mar 13 18:04:41 2013
@@ -24,7 +24,7 @@ import org.apache.jackrabbit.oak.plugins
 /**
  * An {@link OakSolrConfigurationProvider} for the embedded Solr server
  */
-@Component
+@Component(immediate = true)
 @Service(OakSolrConfigurationProvider.class)
 public class EmbeddedSolrConfigurationProvider implements OakSolrConfigurationProvider {
 

Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java?rev=1456066&r1=1456065&r2=1456066&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
Wed Mar 13 18:04:41 2013
@@ -27,7 +27,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.plugins.index.solr.OakSolrUtils;
 import org.apache.jackrabbit.oak.plugins.index.solr.SolrServerProvider;
-import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.codecs.Codec;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
@@ -99,14 +99,22 @@ public class EmbeddedSolrServerProvider 
 
     @Override
     public SolrServer getSolrServer() throws Exception {
+        // hack needed to let lucene SPIs work in an OSGi deploy
+//        Thread thread = Thread.currentThread();
+//        ClassLoader loader = thread.getContextClassLoader();
+//        thread.setContextClassLoader(Lucene40Codec.class.getClassLoader());
+//        thread.setContextClassLoader(loader);
+
+        Codec.reloadCodecs(Thread.currentThread().getContextClassLoader());
+
         if (solrServer == null) {
             try {
                 solrServer = initializeWithNewHttpServer();
-            } catch (Exception e2) {
+            } catch (Exception e) {
                 log.warn("unable to spawn a new Solr server and initialize the default Solr
HTTP client");
                 try {
                     solrServer = initializeWithEmbeddedSolrServer();
-                } catch (Exception e3) {
+                } catch (Exception e2) {
                     log.warn("unable to initialize embedded Solr client");
                     throw new IOException("unable to initialize an embedded Solr server",
e2);
                 }
@@ -121,12 +129,6 @@ public class EmbeddedSolrServerProvider 
     private SolrServer initializeWithNewHttpServer() throws Exception {
         // try spawning a new Solr server using Jetty and connect to it via HTTP
 
-        // hack needed to let lucene SPIs work in an OSGi deploy
-        Thread thread = Thread.currentThread();
-        ClassLoader loader = thread.getContextClassLoader();
-        thread.setContextClassLoader(Lucene40Codec.class.getClassLoader());
-        thread.setContextClassLoader(loader);
-
         enableSolrCloud(solrHome, DEFAULT_CORE_NAME);
         JettySolrRunner jettySolrRunner = new JettySolrRunner(solrHome, CONTEXT, solrHttpPort,
"solrconfig.xml", "schema.xml", true);
         jettySolrRunner.start(true);



Mime
View raw message