Author: rwesten
Date: Tue Jun 3 07:05:21 2014
New Revision: 1599433
URL: http://svn.apache.org/r1599433
Log:
fix for STANBOL-1352 in 0.12.1
Modified:
stanbol/branches/release-0.12/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
stanbol/branches/release-0.12/commons/solr/managed/pom.xml
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
stanbol/branches/release-0.12/commons/solr/web/pom.xml
Modified:
stanbol/branches/release-0.12/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java?rev=1599433&r1=1599432&r2=1599433&view=diff
==============================================================================
---
stanbol/branches/release-0.12/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
(original)
+++
stanbol/branches/release-0.12/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
Tue Jun 3 07:05:21 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.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
@@ -72,7 +69,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
@@ -203,16 +199,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!");
}
@@ -321,11 +315,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());
ClassLoader classLoader = updateContextClassLoader();
@@ -397,11 +389,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());
@@ -412,7 +402,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 {
@@ -425,7 +415,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/branches/release-0.12/commons/solr/managed/pom.xml
URL:
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/commons/solr/managed/pom.xml?rev=1599433&r1=1599432&r2=1599433&view=diff
==============================================================================
--- stanbol/branches/release-0.12/commons/solr/managed/pom.xml (original)
+++ stanbol/branches/release-0.12/commons/solr/managed/pom.xml Tue Jun 3
07:05:21 2014
@@ -91,7 +91,7 @@
<dependency>
<groupId>org.apache.stanbol</groupId>
<artifactId>org.apache.stanbol.commons.solr.core</artifactId>
- <version>0.12.0</version>
+ <version>0.12.1-SNAPSHOT</version>
</dependency>
<!-- OSGI dependencies -->
Modified:
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java?rev=1599433&r1=1599432&r2=1599433&view=diff
==============================================================================
---
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
(original)
+++
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ManagedSolrServerImpl.java
Tue Jun 3 07:05:21 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/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java?rev=1599433&r1=1599432&r2=1599433&view=diff
==============================================================================
---
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
(original)
+++
stanbol/branches/release-0.12/commons/solr/managed/src/main/java/org/apache/stanbol/commons/solr/managed/impl/ReferencedSolrServer.java
Tue Jun 3 07:05:21 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!");
}
Modified: stanbol/branches/release-0.12/commons/solr/web/pom.xml
URL:
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/commons/solr/web/pom.xml?rev=1599433&r1=1599432&r2=1599433&view=diff
==============================================================================
--- stanbol/branches/release-0.12/commons/solr/web/pom.xml (original)
+++ stanbol/branches/release-0.12/commons/solr/web/pom.xml Tue Jun 3 07:05:21
2014
@@ -87,7 +87,7 @@
<dependency>
<groupId>org.apache.stanbol</groupId>
<artifactId>org.apache.stanbol.commons.web.base</artifactId>
- <version>0.12.0</version>
+ <version>0.12.1-SNAPSHOT</version>
</dependency>
<!-- OSGI framework dependencies -->