Author: rwesten
Date: Tue Jun  3 07:36:57 2014
New Revision: 1599441

URL: http://svn.apache.org/r1599441
Log:
fix for STANBOL-1352 in trunk

Modified:
    stanbol/trunk/   (props changed)
    stanbol/trunk/commons/   (props changed)
    stanbol/trunk/commons/solr/   (props changed)
    stanbol/trunk/commons/solr/core/   (props changed)
    
stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
    
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
    
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java

Propchange: stanbol/trunk/
------------------------------------------------------------------------------
  Merged /stanbol/branches/release-0.12:r1599433

Propchange: stanbol/trunk/commons/
------------------------------------------------------------------------------
  Merged /stanbol/branches/release-0.12/commons:r1599433

Propchange: stanbol/trunk/commons/solr/
------------------------------------------------------------------------------
  Merged /stanbol/branches/release-0.12/commons/solr:r1599433

Propchange: stanbol/trunk/commons/solr/core/
------------------------------------------------------------------------------
  Merged /stanbol/branches/release-0.12/commons/solr/core:r1599433

Modified: 
stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java?rev=1599441&r1=1599440&r2=1599441&view=diff
==============================================================================
--- 
stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
 (original)
+++ 
stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
 Tue Jun  3 07:36:57 2014
@@ -36,7 +36,6 @@ import static org.apache.stanbol.commons
 import static org.osgi.framework.Constants.SERVICE_ID;
 
 import java.io.File;
-import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -51,8 +50,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.apache.commons.io.FilenameUtils;
 import org.apache.hadoop.hdfs.protocol.UnregisteredNodeException;
 import org.apache.solr.cloud.ZkController;
@@ -80,7 +77,6 @@ import org.osgi.framework.ServiceReferen
 import org.osgi.framework.ServiceRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
 
 /**
  * This Class 'wraps' a Solr {@link CoreContainer} with all its registered 
@@ -211,16 +207,14 @@ public class SolrServerAdapter {
      * {@link SolrCore}s as OSGI services by using the provided {@link 
BundleContext}.
      * @throws SAXException On any error while parsing the solr.xml file used 
to 
      * initialise the {@link CoreContainer}
-     * @throws IOException On any error while accessing the solr.xml used to 
-     * initialise the {@link CoreContainer} or the home directory for the 
-     * {@link CoreContainer}
-     * @throws ParserConfigurationException Configuration error of the XML 
parser
+     * @throws SolrException if the Solr {@link CoreContainer} could not be 
+     * created.
      * @throws IllegalArgumentException if any of the parsed parameters is
      * <code>null</code> or the {@link SolrServerProperties} do not contain a
      * valid value for the {@link SolrConstants#PROPERTY_SERVER_DIR} 
      * property.
      */
-    public SolrServerAdapter(final BundleContext context,SolrServerProperties 
parsedServerProperties) throws ParserConfigurationException, IOException, 
SAXException{
+    public SolrServerAdapter(final BundleContext context,SolrServerProperties 
parsedServerProperties) {
         if(parsedServerProperties == null){
             throw new IllegalArgumentException("The prsed Server Properties 
MUST NOT be NULL!");
         }
@@ -329,11 +323,9 @@ public class SolrServerAdapter {
      * Reloads a SolrCore e.g. to apply a change in its configuration
      * @param name the name of the Core to reload
      * @return The ServiceReference to the SolrCore.
-     * @throws ParserConfigurationException if the XML parser could not be 
configured
-     * @throws IOException indicated an error related to accessing the 
configured resource
-     * @throws SAXException indicated an formatting error in the xml 
configuration files.
+     * @throws SolrException if the Core could not be reloaded
      */
-    public void reloadCore(String name) throws ParserConfigurationException, 
IOException, SAXException {
+    public void reloadCore(String name) {
         //try to reload
         log.info("Reload Core {} on CoreContainer 
{}",name,serverProperties.getServerName());
         
@@ -407,11 +399,9 @@ public class SolrServerAdapter {
      * it will be replace by this one.
      * @param parsedCoreConfig The configuration.
      * @return The ServiceReference to the SolrCore.
-     * @throws ParserConfigurationException if the XML parser could not be 
configured
-     * @throws IOException indicated an error related to accessing the 
configured resource
-     * @throws SAXException indicated an formatting error in the xml 
configuration files.
+     * @throws SolrException If the core could not be registered
      */
-    public ServiceReference registerCore(SolrCoreProperties parsedCoreConfig) 
throws ParserConfigurationException, IOException, SAXException{
+    public ServiceReference registerCore(SolrCoreProperties parsedCoreConfig) {
         SolrCoreProperties coreConfig = parsedCoreConfig.clone();
         String coreName = coreConfig.getCoreName();
         log.info("Register Core {} to SolrServerAdapter (coreContainer: 
{})",coreName,serverProperties.getServerName());
@@ -422,7 +412,7 @@ public class SolrServerAdapter {
         if(coreDir == null){
             coreDir = new File(serverProperties.getServerDir(),coreName);
         }
-        SolrCore old = null;
+        //SolrCore old = null;
         ClassLoader classLoader = updateContextClassLoader();
         SolrCore core;
         try {
@@ -435,7 +425,8 @@ public class SolrServerAdapter {
             //of the wrapped CoreContainer!
             //core.addCloseHook(closeHook);
             // parse ture as third argument to avoid closing the current core 
for now
-            old = server.register(coreName, core, true);
+            //old = 
+            server.register(coreName, core, true);
         } finally {
             Thread.currentThread().setContextClassLoader(classLoader);
         }

Modified: 
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java?rev=1599441&r1=1599440&r2=1599441&view=diff
==============================================================================
--- 
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
 (original)
+++ 
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
 Tue Jun  3 07:36:57 2014
@@ -57,6 +57,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.solr.common.SolrException;
 import org.apache.stanbol.commons.solr.IndexReference;
 import org.apache.stanbol.commons.solr.SolrConstants;
 import org.apache.stanbol.commons.solr.SolrServerAdapter;
@@ -275,19 +276,10 @@ public class ManagedSolrServerImpl imple
         }
         try {
             server = new SolrServerAdapter(context.getBundleContext(), 
serverProperties);
-        } catch (ParserConfigurationException e) {
-            throw new IllegalStateException("Unable to initialise the XML 
parser " +
-                    "for parsing the SolrServer Configuration for Server '"+
-                    serverProperties.getServerName()+"' (dir="+
-                    serverProperties.getServerDir()+")!",e);
-        } catch (IOException e) {
+        } catch (SolrException e) {
             throw new ConfigurationException(PROPERTY_SERVER_DIR, "Unable to 
initialise " +
                     "a SolrServer based on the Directory 
'"+serverProperties.getServerDir() +
                     "'!",e);
-        } catch (SAXException e) {
-            throw new ConfigurationException(PROPERTY_SERVER_DIR, "Unable to 
initialise " +
-                "a SolrServer based on the Directory 
'"+serverProperties.getServerDir() +
-                "'!",e);
         }
 //        dfpServiceRegistration = context.getBundleContext().registerService(
 //            DataFileProvider.class.getName(), 
@@ -843,18 +835,11 @@ public class ManagedSolrServerImpl imple
         }
         try {
             server.registerCore(coreConfig);
-        } catch (ParserConfigurationException e) {
-            throw new IllegalStateException("Unable to configure XML 
parser",e);
-        } catch (IOException e) {
+        } catch (SolrException e) {
             throw new IOException(String.format(
-                "Unable to access the SolrCore configuration for index " +
+                "Unable to activate the SolrCore configuration for index " +
                 "'%s' of managed SolrServer '%s'",
                 metadata.getIndexName(), serverName), e);
-        } catch (SAXException e) {
-            throw  new SAXException(String.format(
-                "Unable to parse SolrCore configuration for  index '%s' of " +
-                "managed SolrServer '%s'",
-                metadata.getIndexName(), serverName), e);
         } finally {
             synchronized (serverInUser) {
                 serverInUser.remove(token);

Modified: 
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java?rev=1599441&r1=1599440&r2=1599441&view=diff
==============================================================================
--- 
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
 (original)
+++ 
stanbol/trunk/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
 Tue Jun  3 07:36:57 2014
@@ -33,6 +33,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.stanbol.commons.solr.SolrServerAdapter;
@@ -126,19 +127,10 @@ public class ReferencedSolrServer {
         log.info(" > publisRest = {}",properties.isPublishREST());
         try {
             server = new SolrServerAdapter(context.getBundleContext(), 
properties);
-        } catch (ParserConfigurationException e) {
-            throw new IllegalStateException("Unable to initialise the XML 
parser " +
-                       "for parsing the SolrServer Configuration for Server '"+
-                       properties.getServerName()+"' (dir="+
-                       properties.getServerDir()+")!",e);
-        } catch (IOException e) {
+        } catch (SolrException e) {
             throw new ConfigurationException(PROPERTY_SERVER_DIR, "Unable to 
initialise " +
                        "a SolrServer based on the Directory 
'"+properties.getServerDir() +
                        "'!",e);
-        } catch (SAXException e) {
-            throw new ConfigurationException(PROPERTY_SERVER_DIR, "Unable to 
initialise " +
-                "a SolrServer based on the Directory 
'"+properties.getServerDir() +
-                "'!",e);
         }
         log.info(" ... SolrServer successfully initialised!");
     }


Reply via email to