You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2011/07/08 17:20:32 UTC

svn commit: r1144355 [1/2] - in /incubator/stanbol/trunk: commons/ defaultdata/ enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/ entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/...

Author: rwesten
Date: Fri Jul  8 15:20:31 2011
New Revision: 1144355

URL: http://svn.apache.org/viewvc?rev=1144355&view=rev
Log:
STANBOL-257: This includes the necessary Changes to other components to used the new commons.solr bundle. It also adds this module to the commons reactor.

### SolrYard

In addition the implementation of the SolrYard was changed to support lazy initialization of the SolrYard. In the short time this solves a race condition with the initialization of the services provided by the commons.solr bundle. As soon as the commons.solr bundle supports the registration of SolrServer as OSGI services this functionality will be adapted to lookup the SolrServer via a ServiceTracker.

### other

* The ReferencedSite now checks if a cache is available (Cache.isAvailable()). Previously it reported that localMode is possible if the Cache was present but not available.
* Added a check to the EntityTaggingEngine that is does not process TextAnnotations that has an empty selected text.
* Updated the KRES launcher: In addition to the changes necessary to the change of the SolrYard bundle this includes the updated to defaultdata 0.0.3 and the removal of the dbPedia specific configurations (now loaded from the defaultdata bundle)
* parent POM: Added some missing <scope>provided</score> so that such dependencies are consistent with others (In general, I have no idea why the provided scope is added to all dependencies in the parent).
* corrected the path used to install configurations within the defaultdata bundle. Previously the default Solr index for dbpedia was processed by the sling-installer framework. Even through it was ignored this was not intended. The change has no influence on any functionality therefore it not necessary to upgrade (or increase the version number). Just committed this to make sure that with the next upgrade to the defaultdata this issue is resolved.

Added:
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java   (contents, props changed)
      - copied, changed from r1142896, incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java
    incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg
      - copied, changed from r1142896, incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.enhancer.engines.entitytagging.impl.NamedEntityTaggingEngine-local.config
    incubator/stanbol/trunk/launchers/stable/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg
      - copied, changed from r1142896, incubator/stanbol/trunk/launchers/stable/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg
Removed:
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManager.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProvider.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProviderManager.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/ClassPathSolrIndexConfigProvider.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/ConfigUtils.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrDirectoryManager.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrServerProvider.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/EmbeddedSolrPorovider.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/StreamQueryRequest.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/install/
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/solr/conf/cache/conf/
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/solr/conf/entityhub/conf/
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/solr/conf/solr.xml
    incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java
    incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.enhancer.engines.entitytagging.impl.ReferencedSiteEntityTaggingEnhancementEngine-dbPedia.config
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.entityhub.core.site.CacheImpl-dbPediaLocalCache.config
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.entityhub.site.referencedSite-dbPediaSite.config
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg
    incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.SolrYard-dbPediaLocalCacheYard.config
    incubator/stanbol/trunk/launchers/stable/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg
Modified:
    incubator/stanbol/trunk/commons/pom.xml
    incubator/stanbol/trunk/defaultdata/pom.xml
    incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/NamedEntityTaggingEngine.java
    incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/ReferencedSiteImpl.java
    incubator/stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml
    incubator/stanbol/trunk/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/SolrYardIndexingDestination.java
    incubator/stanbol/trunk/entityhub/yard/solr/pom.xml
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrFieldMapper.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYard.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYardConfig.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/AssignmentEncoder.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/DataTypeEncoder.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/FieldEncoder.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LangEncoder.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/WildcardEncoder.java
    incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/OSGI-INF/metatype/metatype.properties
    incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java
    incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml
    incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml
    incubator/stanbol/trunk/launchers/stable/src/main/bundles/list.xml
    incubator/stanbol/trunk/parent/pom.xml

Modified: incubator/stanbol/trunk/commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/pom.xml?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/pom.xml (original)
+++ incubator/stanbol/trunk/commons/pom.xml Fri Jul  8 15:20:31 2011
@@ -27,6 +27,7 @@
   <modules>
     <module>jsonld</module>
     <module>opennlp</module>
+    <module>solr</module>
     <module>web/base</module>
     <module>web/home</module>
     <module>web/sparql</module>

Modified: incubator/stanbol/trunk/defaultdata/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/defaultdata/pom.xml?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/defaultdata/pom.xml (original)
+++ incubator/stanbol/trunk/defaultdata/pom.xml Fri Jul  8 15:20:31 2011
@@ -71,7 +71,7 @@
               -100
             </Data-Files-Priority>
             <Install-Path>
-              org/apache/stanbol/defaultdata/site/dbpedia
+              org/apache/stanbol/defaultdata/site/dbpedia/config
             </Install-Path>
           </instructions>
         </configuration>

Modified: incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/NamedEntityTaggingEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/NamedEntityTaggingEngine.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/NamedEntityTaggingEngine.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/NamedEntityTaggingEngine.java Fri Jul  8 15:20:31 2011
@@ -348,10 +348,15 @@ public class NamedEntityTaggingEngine im
         // ... and check the values
         String name = EnhancementEngineHelper.getString(graph, textAnnotation, ENHANCER_SELECTED_TEXT);
         if (name == null) {
-            log.warn("Unable to process TextAnnotation " + textAnnotation + " because property"
+            log.info("Unable to process TextAnnotation " + textAnnotation + " because property"
                      + ENHANCER_SELECTED_TEXT + " is not present");
             return Collections.emptyList();
         }
+        if(name.isEmpty()){
+            log.info("Unable to process TextAnnotation " + textAnnotation + 
+                " because an empty Stirng is selected by " + ENHANCER_SELECTED_TEXT + "");
+            return Collections.emptyList();
+        }
 
         UriRef type = EnhancementEngineHelper.getReference(graph, textAnnotation, DC_TYPE);
         if (type == null) {

Modified: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/ReferencedSiteImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/ReferencedSiteImpl.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/ReferencedSiteImpl.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/ReferencedSiteImpl.java Fri Jul  8 15:20:31 2011
@@ -585,7 +585,16 @@ public class ReferencedSiteImpl implemen
      * the configured cache instance is not available.
      */
     protected Cache getCache(){
-        return siteConfiguration.getCacheStrategy() == CacheStrategy.none?null:(Cache)cacheTracker.getService();
+        if(siteConfiguration.getCacheStrategy() == CacheStrategy.none){
+            return null;
+        } else {
+            Cache cache = (Cache)cacheTracker.getService();
+            if(cache != null && cache.isAvailable()){
+                return cache;
+            } else {
+                return null;
+            }
+        }
     }
 
     /*--------------------------------------------------------------------------

Modified: incubator/stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml (original)
+++ incubator/stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml Fri Jul  8 15:20:31 2011
@@ -62,6 +62,14 @@
 		</plugins>
 	</build>
 	<dependencies>
+        <dependency>
+            <groupId>org.apache.stanbol</groupId>
+            <artifactId>org.apache.stanbol.commons.solr</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stanbol</groupId>
+            <artifactId>org.apache.stanbol.commons.stanboltools.datafileprovider</artifactId>
+        </dependency>
 		<dependency>
 			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.entityhub.servicesapi</artifactId>

Modified: incubator/stanbol/trunk/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/SolrYardIndexingDestination.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/SolrYardIndexingDestination.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/SolrYardIndexingDestination.java (original)
+++ incubator/stanbol/trunk/entityhub/indexing/destination/solryard/src/main/java/org/apache/stanbol/entityhub/indexing/destination/solryard/SolrYardIndexingDestination.java Fri Jul  8 15:20:31 2011
@@ -25,7 +25,7 @@ import org.apache.stanbol.entityhub.serv
 import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
 import org.apache.stanbol.entityhub.servicesapi.yard.Yard;
 import org.apache.stanbol.entityhub.servicesapi.yard.YardException;
-import org.apache.stanbol.entityhub.yard.solr.SolrDirectoryManager;
+import org.apache.stanbol.commons.solr.SolrDirectoryManager;
 import org.apache.stanbol.entityhub.yard.solr.impl.SolrYard;
 import org.apache.stanbol.entityhub.yard.solr.impl.SolrYardConfig;
 import org.slf4j.Logger;

Modified: incubator/stanbol/trunk/entityhub/yard/solr/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/pom.xml?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/pom.xml (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/pom.xml Fri Jul  8 15:20:31 2011
@@ -67,22 +67,6 @@
                  java objects are used as serialisation to and from the SolrServer
                  and therefore no XML API is needed -->
             <Import-Package>
-              !org.mortbay.jetty.*,
-              !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.*, 
-              !antlr.*, 
-              !com.werken.*,
-              !org.apache.oro.*,
               *
             </Import-Package>
             <Private-Package>
@@ -91,15 +75,6 @@
               org.apache.stanbol.entityhub.yard.solr.impl.install;version=${pom.version}
             </Private-Package>
             <Embed-Dependency>
-              solr-solrj, solr-core, solr-noggit, solr-dataimporthandler,
-              lucene-core, lucene-analyzers, lucene-highlighter, lucene-memory,
-              lucene-spatial, lucene-spellchecker, lucene-misc, lucene-queries,
-              xalan, lucene-xercesImpl, serializer, xml-apis, 
-              commons-codec, commons-httpclient, commons-beanutils, 
-              solr-commons-csv, commons-collections, commons-fileupload, 
-              commons-io, commons-lang, 
-              stax-api,wstx-asl, jakarta-regexp, xml-resolver, portlet-api,
-              velocity, velocity-tools
             </Embed-Dependency>
           </instructions>
         </configuration>
@@ -117,6 +92,10 @@
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.commons.stanboltools.datafileprovider</artifactId>
     </dependency>
+    <dependency> <!-- provides Solr and OSGI utilities for Solr -->
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.solr</artifactId>
+    </dependency>
 
     <!-- Stanbol Entityhub internal dependencies -->
     <dependency>
@@ -127,223 +106,225 @@
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.entityhub.core</artifactId>
     </dependency>
-    <!-- SolrJ dependencies (needed for using remote Solr servers) -->
+
+   <!--  other (not Solr related) dependencies) -->
+    <dependency>
+      <groupId>joda-time</groupId>
+      <artifactId>joda-time</artifactId>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-compress</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency> 
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
+    <!-- Logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <!-- for tests -->
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.entityhub.test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <!-- We need also all the Solr/Lucene dependencies for testing -->
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-solrj</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-httpclient</groupId>
       <artifactId>commons-httpclient</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-xercesImpl</artifactId>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-xercesImpl</artifactId>
+      <scope>test</scope>
     </dependency>
-
-    <!-- Solr/Lucene dependencies (needed for using embedded Solr servers) -->
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-core</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-dataimporthandler</artifactId>
+      <groupId>org.apache.solr</groupId>
+      <artifactId>solr-dataimporthandler</artifactId>
+      <scope>test</scope>
     </dependency>
-    <!-- <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-dataimporthandler-extras</artifactId>
-    </dependency>  -->
     <dependency>
-        <groupId>org.apache.solr</groupId>
-        <artifactId>solr-noggit</artifactId>
+      <groupId>org.apache.solr</groupId>
+      <artifactId>solr-noggit</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.solr</groupId>
       <artifactId>solr-commons-csv</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-core</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-analyzers</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-highlighter</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-memory</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-misc</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-queries</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lucene</groupId>
       <artifactId>lucene-spellchecker</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-spatial</artifactId>
-    </dependency>
-<!-- ICU is currently deactivated     
-    <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-icu</artifactId>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-spatial</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>org.apache.lucene</groupId>
-        <artifactId>lucene-icu4j</artifactId>
-    </dependency>  -->
-
-    <!-- additional Solr Dependencies -->
-    <dependency>
-        <groupId>jakarta-regexp</groupId>
-        <artifactId>jakarta-regexp</artifactId>
+      <groupId>jakarta-regexp</groupId>
+      <artifactId>jakarta-regexp</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>javax.portlet</groupId>
-        <artifactId>portlet-api</artifactId>
+      <groupId>javax.portlet</groupId>
+      <artifactId>portlet-api</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-fileupload</groupId>
       <artifactId>commons-fileupload</artifactId>
+      <scope>test</scope>
     </dependency>
-    <dependency>
+<!-- already a dependency of this bundle
+     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
-    </dependency>
+      <scope>test</scope>
+    </dependency>  -->
     <dependency>
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-beanutils</groupId>
       <artifactId>commons-beanutils</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>xml-resolver</groupId>
       <artifactId>xml-resolver</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>stax</groupId>
       <artifactId>stax-api</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.codehaus.woodstox</groupId>
       <artifactId>wstx-asl</artifactId>
+      <scope>test</scope>
     </dependency>
-<!-- Lucene comes with an own Xerces version and Solr uses xPath. This results
-     in the usage of the Xalan version of Java with the Xerxes version of lucene.
-     If this is a problem we need also to provide xalan and a compatible version
-     of the xml-apis -->
      <dependency>
-        <groupId>xalan</groupId>
-        <artifactId>xalan</artifactId>
-        <version>2.7.1</version>
+      <groupId>xalan</groupId>
+      <artifactId>xalan</artifactId>
+      <version>2.7.1</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>xalan</groupId>
-        <artifactId>serializer</artifactId>
-        <version>2.7.1</version>
+      <groupId>xalan</groupId>
+      <artifactId>serializer</artifactId>
+      <version>2.7.1</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
-        <groupId>xml-apis</groupId>
-        <artifactId>xml-apis</artifactId>
-        <version>1.3.04</version>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>1.3.04</version>
+      <scope>test</scope>
     </dependency>
-    <!-- The Solr-Core depends on the Servlet API and in case of running an
-         EmbeddedSolrServer the servlet-api is not available -->
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
+      <scope>test</scope>
     </dependency>
-
-    <!-- Solr has support of velocity templating (respone writer). This is not
-         used by the Entityhub, but the related classes are direct part of the
-         solr distribution. SolrCores can not be initialised without velocity!
-         Because of this the velocity and velocity-tools jars need to be
-         included however all additional dependencies are excluded. This allows
-         to init Solr, but this will not allow to use the velocity related
-         Response writer.
-         To enable velocity one would need to add another 10+ dependencies. -->
     <dependency>
         <groupId>org.apache.velocity</groupId>
         <artifactId>velocity</artifactId>
         <version>1.6.2</version>
+        <scope>test</scope>
     </dependency>
     <dependency>
         <groupId>org.apache.velocity</groupId>
         <artifactId>velocity-tools</artifactId>
         <version>2.0</version>
-    </dependency>
-
-   <!--  other (not Solr related) dependencies) -->
-    <dependency>
-      <groupId>joda-time</groupId>
-      <artifactId>joda-time</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.scr.annotations</artifactId>
-    </dependency>
-    <!-- for the Solr Index Installer -->
-    <dependency>
-      <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.installer.core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-compress</artifactId>
-    </dependency>
-    <!-- Logging -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <!-- for tests -->
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.entityhub.test</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
-      <scope>test</scope>
-    </dependency>
+       <scope>test</scope>
+    </dependency>    
+   
   </dependencies>
 
 </project>

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrFieldMapper.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrFieldMapper.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrFieldMapper.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrFieldMapper.java Fri Jul  8 15:20:31 2011
@@ -44,6 +44,7 @@ import org.apache.solr.client.solrj.resp
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
+import org.apache.stanbol.commons.solr.utils.SolrUtil;
 import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
 import org.apache.stanbol.entityhub.servicesapi.util.ModelUtils;
@@ -53,7 +54,7 @@ import org.apache.stanbol.entityhub.yard
 import org.apache.stanbol.entityhub.yard.solr.model.IndexDataType;
 import org.apache.stanbol.entityhub.yard.solr.model.IndexField;
 import org.apache.stanbol.entityhub.yard.solr.model.IndexValue;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
+import org.apache.stanbol.entityhub.yard.solr.query.QueryUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYard.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYard.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYard.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYard.java Fri Jul  8 15:20:31 2011
@@ -38,12 +38,12 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.PropertyOption;
 import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest.METHOD;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
 import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 import org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer;
 import org.apache.solr.client.solrj.request.UpdateRequest;
@@ -51,6 +51,12 @@ import org.apache.solr.client.solrj.resp
 import org.apache.solr.client.solrj.response.SolrPingResponse;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrInputDocument;
+import org.apache.stanbol.commons.solr.SolrDirectoryManager;
+import org.apache.stanbol.commons.solr.SolrServerProvider;
+import org.apache.stanbol.commons.solr.SolrServerProviderManager;
+import org.apache.stanbol.commons.solr.utils.ConfigUtils;
+import org.apache.stanbol.commons.solr.utils.SolrUtil;
+import org.apache.stanbol.commons.solr.utils.StreamQueryRequest;
 import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
 import org.apache.stanbol.entityhub.core.query.DefaultQueryFactory;
 import org.apache.stanbol.entityhub.core.query.QueryResultListImpl;
@@ -63,9 +69,6 @@ import org.apache.stanbol.entityhub.serv
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
 import org.apache.stanbol.entityhub.servicesapi.yard.Yard;
 import org.apache.stanbol.entityhub.servicesapi.yard.YardException;
-import org.apache.stanbol.entityhub.yard.solr.SolrDirectoryManager;
-import org.apache.stanbol.entityhub.yard.solr.SolrServerProvider.Type;
-import org.apache.stanbol.entityhub.yard.solr.SolrServerProviderManager;
 import org.apache.stanbol.entityhub.yard.solr.defaults.IndexDataTypeEnum;
 import org.apache.stanbol.entityhub.yard.solr.impl.SolrQueryFactory.SELECT;
 import org.apache.stanbol.entityhub.yard.solr.model.FieldMapper;
@@ -73,7 +76,6 @@ import org.apache.stanbol.entityhub.yard
 import org.apache.stanbol.entityhub.yard.solr.model.IndexValue;
 import org.apache.stanbol.entityhub.yard.solr.model.IndexValueFactory;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEnum;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
@@ -123,7 +125,7 @@ import org.slf4j.LoggerFactory;
 @Service
 @Properties(
     value = {
-         // TODO: Added propertied from AbstractYard to fix ordering!
+         // NOTE: Added propertied from AbstractYard to fix ordering!
          @Property(name = Yard.ID),
          @Property(name = Yard.NAME),
          @Property(name = Yard.DESCRIPTION),
@@ -135,7 +137,7 @@ import org.slf4j.LoggerFactory;
              options = {
                    @PropertyOption(name = "true", value = "true"),
                    @PropertyOption(name = "false", value = "false")}, 
-                   value = "false"),
+                   boolValue = false),
          @Property(name = SolrYard.MAX_BOOLEAN_CLAUSES, intValue = SolrYard.defaultMaxBooleanClauses)})
 public class SolrYard extends AbstractYard implements Yard {
     /**
@@ -183,7 +185,7 @@ public class SolrYard extends AbstractYa
      * <li> If this property is enabled the value of the 
      * {@link #SOLR_INDEX_CONFIGURATION_NAME} will be ignored.
      * </ul>
-     * Only applies in case a {@link EmbeddedSolrServer} is used.
+     * Only applies in case a EmbeddedSolrServer is used.
      * @see SolrYardConfig#isDefaultInitialisation()
      * @see SolrYardConfig#setDefaultInitialisation(Boolean)
      */
@@ -198,7 +200,7 @@ public class SolrYard extends AbstractYa
     public static final String DEFAULT_SOLR_INDEX_CONFIGURATION_NAME = "default";
     /**
      * Allows to configure the name of the index used for the configuration of the Solr Core.
-     * Only applies in case of using an {@link EmbeddedSolrServer} and
+     * Only applies in case of using an EmbeddedSolrServer and
      * {@link #SOLR_INDEX_DEFAULT_CONFIG} is disabled.
      * As default the value of the {@link #SOLR_SERVER_LOCATION} is used.
      * @see SolrYardConfig#getIndexConfigurationName()
@@ -237,12 +239,12 @@ public class SolrYard extends AbstractYa
      * The SolrServer used for this Yard. Initialisation is done based on the configured parameters in
      * {@link #activate(ComponentContext)}.
      */
-    private SolrServer server;
+    private SolrServer _server;
     /**
      * The {@link FieldMapper} is responsible for converting fields of {@link Representation} to fields in the
      * {@link SolrInputDocument} and vice versa
      */
-    private FieldMapper fieldMapper;
+    private FieldMapper _fieldMapper;
     /**
      * The {@link IndexValueFactory} is responsible for converting values of fields in the
      * {@link Representation} to the according {@link IndexValue}. One should note, that some properties of
@@ -261,7 +263,7 @@ public class SolrYard extends AbstractYa
      * needs to undergo some refactoring!
      * 
      */
-    private SolrQueryFactory solrQueryFactoy;
+    private SolrQueryFactory _solrQueryFactoy;
     /**
      * Used to store the name of the field used to get the {@link SolrInputDocument#setDocumentBoost(float)}
      * for a Representation. This name is available via {@link SolrYardConfig#getDocumentBoostFieldName()}
@@ -285,7 +287,9 @@ public class SolrYard extends AbstractYa
      * commons http one for all other requests. This would provide performance advantages when updating
      * {@link Representation}s stored in a SolrYard using an remote SolrServer.
      */
-    @Reference
+    @Reference(policy=ReferencePolicy.DYNAMIC,
+        bind="bindSolrServerProviderManager",
+        unbind="unbindSolrServerProviderManager")
     private SolrServerProviderManager solrServerProviderManager;
     /**
      * Used to retrieve (and init if not already present) the Solr Index directory for relative paths parsed
@@ -293,7 +297,9 @@ public class SolrYard extends AbstractYa
      * provides the path to the files. The {@link SolrServer} instance is created by the
      * {@link SolrServerProviderManager}!
      */
-    @Reference
+    @Reference(policy=ReferencePolicy.DYNAMIC,
+        bind="bindSolrDirectoryManager",
+        unbind="unbindSolrDirectoryManager")
     private SolrDirectoryManager solrDirectoryManager;
     /**
      * If update(..) and store(..) calls should be immediately committed.
@@ -327,6 +333,17 @@ public class SolrYard extends AbstractYa
      *             on any Error while initialising the Solr Server for this Yard
      */
     public SolrYard(SolrYardConfig config) throws IllegalArgumentException, YardException {
+        solrServerProviderManager = SolrServerProviderManager.getInstance();
+        // init via java.util.ServiceLoader
+        Iterator<SolrDirectoryManager> providerIt = ServiceLoader.load(SolrDirectoryManager.class,
+            SolrDirectoryManager.class.getClassLoader()).iterator();
+        if (providerIt.hasNext()) {
+            solrDirectoryManager = providerIt.next();
+        } else {
+            throw new IllegalStateException("Unable to instantiate "
+                                            + SolrDirectoryManager.class.getSimpleName()
+                                            + " service by using " + ServiceLoader.class.getName() + "!");
+        }
         // we need to change the exceptions, because this will be called outside
         // of an OSGI environment!
         try {
@@ -340,6 +357,19 @@ public class SolrYard extends AbstractYa
         }
     }
 
+    protected void bindSolrServerProviderManager(SolrServerProviderManager manager){
+        this.solrServerProviderManager = manager;
+    }
+    protected void unbindSolrServerProviderManager(SolrServerProviderManager manager){
+        this.solrDirectoryManager = null;
+    }
+    protected void bindSolrDirectoryManager(SolrDirectoryManager manager){
+        this.solrDirectoryManager = manager;
+    }
+    
+    protected void unbindSolrDirectoryManager(SolrDirectoryManager manager){
+        this.solrDirectoryManager = null;
+    }
     /**
      * Builds an {@link SolrYardConfig} instance based on the parsed {@link ComponentContext} and forwards to
      * {@link #activate(SolrYardConfig)}.
@@ -363,7 +393,7 @@ public class SolrYard extends AbstractYa
         if (context == null) {
             throw new IllegalStateException("No valid" + ComponentContext.class + " parsed in activate!");
         }
-        log.info("in " + SolrYard.class + " activate with config " + context.getProperties());
+        log.info("in {}.activate(..) with config {}",SolrYard.class.getSimpleName(), context.getProperties());
         activate(new SolrYardConfig((Dictionary<String,Object>) context.getProperties()));
     }
 
@@ -387,81 +417,131 @@ public class SolrYard extends AbstractYa
         super.activate(InMemoryValueFactory.getInstance(), DefaultQueryFactory.getInstance(), config);
         // mayby the super activate has updated the configuration
         config = (SolrYardConfig) this.getConfig();
-        if (solrServerProviderManager == null) { // not within an OSGI environment
-            solrServerProviderManager = SolrServerProviderManager.getInstance();
+        // check if immediateCommit is enable or disabled
+        if (config.isImmediateCommit() != null) {
+            immediateCommit = config.isImmediateCommit().booleanValue();
+        } else {
+            immediateCommit = DEFAULT_IMMEDIATE_COMMIT_STATE;
         }
-        if (solrDirectoryManager == null) { // not within an OSGI environment
-            // init via java.util.ServiceLoader
-            Iterator<SolrDirectoryManager> providerIt = ServiceLoader.load(SolrDirectoryManager.class,
-                SolrDirectoryManager.class.getClassLoader()).iterator();
-            if (providerIt.hasNext()) {
-                solrDirectoryManager = providerIt.next();
-            } else {
-                throw new IllegalStateException("Unable to instantiate "
-                                                + SolrDirectoryManager.class.getSimpleName()
-                                                + " service by using " + ServiceLoader.class.getName() + "!");
+        // check the maximum duration until changes are commited
+        if (config.getCommitWithinDuration() != null) {
+            commitWithin = config.getCommitWithinDuration().intValue();
+        } else {
+            commitWithin = DEFAULT_COMMIT_WITHIN_DURATION;
+        }
+        this.indexValueFactory = IndexValueFactory.getInstance();
+        this.documentBoostFieldName = config.getDocumentBoostFieldName();
+        this.fieldBoostMap = config.getFieldBoosts();
+    }
+
+    /**
+     * @param config
+     */
+    private SolrQueryFactory getSolrQueryFactory() throws YardException {
+        SolrYardConfig config = (SolrYardConfig)getConfig();
+        if(_solrQueryFactoy == null){
+            _solrQueryFactoy = new SolrQueryFactory(getValueFactory(), indexValueFactory, getFieldMapper());
+            if (config.isMultiYardIndexLayout()) { // set the yardID as domain if multiYardLayout is activated
+                _solrQueryFactoy.setDomain(config.getId());
             }
+            _solrQueryFactoy.setDefaultQueryResults(config.getDefaultQueryResultNumber());
+            _solrQueryFactoy.setMaxQueryResults(config.getMaxQueryResultNumber());
         }
+        return _solrQueryFactoy;
+    }
+
+    /**
+     * @param config
+     * @throws ConfigurationException
+     * @throws YardException 
+     */
+    private SolrServer getServer() throws YardException {
+        if(_server == null){
+            initSolrServer();
+        }
+        return _server;
+    }
+
+    /**
+     * @throws YardException
+     */
+    private void initSolrServer() throws YardException {
+        SolrYardConfig config = (SolrYardConfig) this.getConfig();
         String solrIndexLocation;
-        if (config.getSolrServerType() == Type.EMBEDDED) {
+        if (config.getSolrServerType() == SolrServerProvider.Type.EMBEDDED) {
             File indexDirectory = ConfigUtils.toFile(config.getSolrServerLocation());
             if (!indexDirectory.isAbsolute()) { // relative paths
-                // need to be resolved based on the internally managed Solr directory
-                String indexName = indexDirectory.toString();
-                indexDirectory = solrDirectoryManager.getSolrIndexDirectory(indexName);
-                if (indexDirectory == null) {
-                    String configName;
-                    if(config.isDefaultInitialisation()){
-                        configName = SolrYard.DEFAULT_SOLR_INDEX_CONFIGURATION_NAME;
+                SolrDirectoryManager solrDirectoryManager = this.solrDirectoryManager;
+                if(solrDirectoryManager != null){
+                    // need to be resolved based on the internally managed Solr directory
+                    String indexName = indexDirectory.toString();
+                    indexDirectory = solrDirectoryManager.getSolrIndexDirectory(indexName);
+                    if (indexDirectory == null) {
+                        String configName;
+                        if(config.isDefaultInitialisation()){
+                            configName = SolrYard.DEFAULT_SOLR_INDEX_CONFIGURATION_NAME;
+                        } else {
+                            configName = config.getIndexConfigurationName();
+                        }
+                        log.info(" ... initialise new SolrDirectory Index with name {} by using Index Configuration {}",
+                            indexName,configName);
+                        try {
+                            indexDirectory = solrDirectoryManager.createSolrDirectory(
+                                indexName,configName,null);
+                        } catch (IOException e) {
+                            throw new YardException("SolrIndex "+ config.getSolrServerLocation() + 
+                                    " could not be initialised!",e);
+                        }
+                        if (indexDirectory == null) {
+                            throw new YardException("SolrIndex "+ config.getSolrServerLocation() + 
+                                    " is not available" + (config.isDefaultInitialisation() ? 
+                                            " and could not be initialised!" : 
+                                                ". The necessary Index is not yet installed."));
+                        } else {
+                            log.info(" ... created IndexDirectory {} for SolrIndex {} by using config {}",
+                                new Object[]{indexDirectory,indexName,configName});
+                        }
                     } else {
-                        configName = config.getIndexConfigurationName();
+                        log.info(" ... use Directory {} for Solr Index with name {} ",indexDirectory,indexName);
                     }
-                    indexDirectory = solrDirectoryManager.createSolrDirectory(
-                        indexName,configName,null);
-                }
-                if (indexDirectory == null) {
-                    throw new ConfigurationException(SolrYard.SOLR_SERVER_LOCATION,
-                            "SolrIndex "
-                                    + config.getSolrServerLocation()
-                                    + " is not available"
-                                    + (config.isDefaultInitialisation() ? " and could not be initialised!"
-                                            : ". The necessary Index is not yet installed."));
+                } else {
+                    throw new YardException(String.format(
+                        "Unable to init SolrServer because %s service is not present",
+                        SolrDirectoryManager.class.getSimpleName()));
                 }
             }
             solrIndexLocation = indexDirectory.toString();
         } else {
             solrIndexLocation = config.getSolrServerLocation();
         }
-        server = solrServerProviderManager.getSolrServer(config.getSolrServerType(), solrIndexLocation);
-        // test the server
-        SolrPingResponse pingResponse = server.ping();
-        log.info(String.format("Successful ping for SolrServer %s ( %d ms) Details: %s",
-            config.getSolrServerLocation(), pingResponse.getElapsedTime(), pingResponse));
-        // check if immediateCommit is enable or disabled
-        if (config.isImmediateCommit() != null) {
-            immediateCommit = config.isImmediateCommit().booleanValue();
-        } else {
-            immediateCommit = DEFAULT_IMMEDIATE_COMMIT_STATE;
+        if(solrServerProviderManager == null){
+            throw new YardException(String.format(
+                "Unable to init SolrServer because %s service is not present",
+                SolrServerProviderManager.class.getSimpleName()));
         }
-        // check the maximum duration until changes are commited
-        if (config.getCommitWithinDuration() != null) {
-            commitWithin = config.getCommitWithinDuration().intValue();
-        } else {
-            commitWithin = DEFAULT_COMMIT_WITHIN_DURATION;
+        try {
+            _server = solrServerProviderManager.getSolrServer(config.getSolrServerType(), solrIndexLocation);
+            // test the server
+            SolrPingResponse pingResponse = _server.ping();
+            log.info(String.format("Successful ping for SolrServer %s ( %d ms) Details: %s",
+                config.getSolrServerLocation(), pingResponse.getElapsedTime(), pingResponse));
+        } catch (IOException e) {
+            throw new YardException("Unable to ping created SolrServer "+solrIndexLocation,e);
+        } catch (SolrServerException e) {
+            throw new YardException("Unable to ping created SolrServer "+solrIndexLocation,e);
+        } catch (RuntimeException e) {
+            throw new YardException("Unable to init SolrServer "+solrIndexLocation +
+                "because of "+e.getMessage(),e);
         }
-        // the fieldMapper need the Server to store it's namespace prefix configuration
-        this.fieldMapper = new SolrFieldMapper(server);
-        this.indexValueFactory = IndexValueFactory.getInstance();
-        this.solrQueryFactoy = new SolrQueryFactory(getValueFactory(), indexValueFactory, fieldMapper);
-        if (config.isMultiYardIndexLayout()) { // set the yardID as domain if multiYardLayout is activated
-            solrQueryFactoy.setDomain(config.getId());
+    }
+    FieldMapper getFieldMapper() throws YardException {
+        if(_fieldMapper == null){
+            // the fieldMapper need the Server to store it's namespace prefix configuration
+            _fieldMapper = new SolrFieldMapper(getServer());
         }
-        solrQueryFactoy.setDefaultQueryResults(config.getDefaultQueryResultNumber());
-        solrQueryFactoy.setMaxQueryResults(config.getMaxQueryResultNumber());
-        this.documentBoostFieldName = config.getDocumentBoostFieldName();
-        this.fieldBoostMap = config.getFieldBoosts();
+        return _fieldMapper;
     }
-
+    
     /**
      * Deactivates this SolrYard instance after committing remaining changes
      * 
@@ -472,8 +552,11 @@ public class SolrYard extends AbstractYa
         SolrYardConfig config = (SolrYardConfig) getConfig();
         log.info("... deactivating SolrYard " + config.getName() + " (id=" + config.getId() + ")");
         try {
-            this.server.commit();
-            this.server.optimize();
+            SolrServer server;
+            server = getServer();
+            server.commit();
+        } catch (YardException e) {
+            log.debug("Deactivate SolrYard with SolrServer that was never initialised");
         } catch (SolrServerException e) {
             log.error(
                 String.format("Unable to commit unsaved changes to SolrServer %s during deactivate!",
@@ -483,10 +566,10 @@ public class SolrYard extends AbstractYa
                 String.format("Unable to commit unsaved changes to SolrServer %s during deactivate!",
                     config.getSolrServerLocation()), e);
         }
-        this.server = null;
-        this.fieldMapper = null;
+        this._server = null;
+        this._fieldMapper = null; //in this case we can directly access the lazy field
         this.indexValueFactory = null;
-        this.solrQueryFactoy = null;
+        this._solrQueryFactoy = null;  //in this case we can directly access the lazy field
         this.documentBoostFieldName = null;
         this.fieldBoostMap = null;
         // reset the commitWithin and immediateCommit to the defaults
@@ -514,10 +597,10 @@ public class SolrYard extends AbstractYa
 
     @Override
     public final QueryResultList<Representation> find(final FieldQuery parsedQuery) throws YardException {
-        return find(parsedQuery, SELECT.QUERY);
+        return find(getFieldMapper(),parsedQuery, SELECT.QUERY);
     }
 
-    private QueryResultList<Representation> find(final FieldQuery parsedQuery, SELECT select) throws YardException {
+    private QueryResultList<Representation> find(final FieldMapper fieldMapper,final FieldQuery parsedQuery, SELECT select) throws YardException {
         log.debug("find " + parsedQuery);
         long start = System.currentTimeMillis();
         final Set<String> selected;
@@ -531,13 +614,13 @@ public class SolrYard extends AbstractYa
             selected = null;
         }
 
-        SolrQuery query = solrQueryFactoy.parseFieldQuery(parsedQuery, select);
+        SolrQuery query = getSolrQueryFactory().parseFieldQuery(parsedQuery, select);
         long queryGeneration = System.currentTimeMillis();
 
         QueryResponse response;
         try {
             StreamQueryRequest request = new StreamQueryRequest(query);
-            response = request.process(server);
+            response = request.process(getServer());
         } catch (SolrServerException e) {
             if ("unknown handler: /mlt".equals(e.getCause().getMessage())) {
                 throw new YardException("Solr is missing '<requestHandler name=\"/mlt\""
@@ -556,7 +639,7 @@ public class SolrYard extends AbstractYa
                             @Override
                             public Representation adapt(SolrDocument doc, Class<Representation> type) {
                                 // use this method for the conversion!
-                                return createRepresentation(doc, selected);
+                                return createRepresentation(fieldMapper, doc, selected);
                             }
                         }, Representation.class), Representation.class);
         long resultProcessing = System.currentTimeMillis();
@@ -569,13 +652,14 @@ public class SolrYard extends AbstractYa
 
     @Override
     public final QueryResultList<String> findReferences(FieldQuery parsedQuery) throws YardException {
-        SolrQuery query = solrQueryFactoy.parseFieldQuery(parsedQuery, SELECT.ID);
+        SolrQuery query = getSolrQueryFactory().parseFieldQuery(parsedQuery, SELECT.ID);
         QueryResponse respone;
         try {
-            respone = server.query(query, METHOD.POST);
+            respone = getServer().query(query, METHOD.POST);
         } catch (SolrServerException e) {
             throw new YardException("Error while performing query on the SolrServer", e);
         }
+        final FieldMapper fieldMapper = getFieldMapper();
         // return a queryResultList
         return new QueryResultListImpl<String>(parsedQuery,
         // by adapting SolrDocuments to Representations
@@ -592,7 +676,7 @@ public class SolrYard extends AbstractYa
 
     @Override
     public final QueryResultList<Representation> findRepresentation(FieldQuery parsedQuery) throws YardException {
-        return find(parsedQuery, SELECT.ALL);
+        return find(getFieldMapper(),parsedQuery, SELECT.ALL);
     }
 
     @Override
@@ -603,10 +687,12 @@ public class SolrYard extends AbstractYa
         if (id.isEmpty()) {
             throw new IllegalArgumentException("The parsed Representation id MUST NOT be empty!");
         }
+        SolrServer server = getServer();
+        FieldMapper fieldMapper = getFieldMapper();
         SolrDocument doc;
         long start = System.currentTimeMillis();
         try {
-            doc = getSolrDocument(id);
+            doc = getSolrDocument(server,fieldMapper,id);
         } catch (SolrServerException e) {
             throw new YardException("Error while getting SolrDocument for id" + id, e);
         } catch (IOException e) {
@@ -618,7 +704,7 @@ public class SolrYard extends AbstractYa
             // create an Representation for the Doc! retrieve
             log.debug(String.format("Create Representation %s from SolrDocument",
                 doc.getFirstValue(fieldMapper.getDocumentIdField())));
-            rep = createRepresentation(doc, null);
+            rep = createRepresentation(fieldMapper,doc, null);
         } else {
             rep = null;
         }
@@ -637,7 +723,7 @@ public class SolrYard extends AbstractYa
      *            if NOT NULL only this fields are added to the Representation
      * @return the Representation
      */
-    protected final Representation createRepresentation(SolrDocument doc, Set<String> fields) {
+    protected final Representation createRepresentation(FieldMapper fieldMapper, SolrDocument doc, Set<String> fields) {
         Object id = doc.getFirstValue(fieldMapper.getDocumentIdField());
         if (id == null) {
             throw new IllegalStateException(String.format(
@@ -689,8 +775,10 @@ public class SolrYard extends AbstractYa
         if (id.isEmpty()) {
             throw new IllegalArgumentException("The parsed Representation id MUST NOT be empty!");
         }
+        final SolrServer server = getServer();
+        final FieldMapper fieldMapper = getFieldMapper();
         try {
-            return getSolrDocument(id, Arrays.asList(fieldMapper.getDocumentIdField())) != null;
+            return getSolrDocument(server,fieldMapper,id, Arrays.asList(fieldMapper.getDocumentIdField())) != null;
         } catch (SolrServerException e) {
             throw new YardException("Error while performing getDocumentByID request for id " + id, e);
         } catch (IOException e) {
@@ -709,10 +797,13 @@ public class SolrYard extends AbstractYa
      * @throws IOException
      *             an any IO exception while accessing the SolrServer
      */
-    protected final Set<String> checkRepresentations(Set<String> ids) throws SolrServerException, IOException {
+    protected final Set<String> checkRepresentations(SolrServer server, 
+                                                     FieldMapper fieldMapper,
+                                                     Set<String> ids) 
+                                                     throws SolrServerException, IOException {
         Set<String> found = new HashSet<String>();
         String field = fieldMapper.getDocumentIdField();
-        for (SolrDocument foundDoc : getSolrDocuments(ids, Arrays.asList(field))) {
+        for (SolrDocument foundDoc : getSolrDocuments(server,fieldMapper,ids, Arrays.asList(field))) {
             Object value = foundDoc.getFirstValue(field);
             if (value != null) {
                 found.add(value.toString());
@@ -729,6 +820,7 @@ public class SolrYard extends AbstractYa
         if (id.isEmpty()) {
             throw new IllegalArgumentException("The parsed Representation id MUST NOT be empty!");
         }
+        SolrServer server = getServer();
         try {
             server.deleteById(id);
             server.commit();
@@ -754,6 +846,7 @@ public class SolrYard extends AbstractYa
                 toRemove.add(id);
             }
         }
+        SolrServer server = getServer();
         try {
             server.deleteById(toRemove);
             server.commit();
@@ -775,8 +868,10 @@ public class SolrYard extends AbstractYa
         if (representation == null) {
             throw new IllegalArgumentException("The parsed Representation MUST NOT be NULL!");
         }
+        SolrServer server = getServer();
+        FieldMapper fieldMapper = getFieldMapper();
         long start = System.currentTimeMillis();
-        SolrInputDocument inputDocument = createSolrInputDocument(representation);
+        SolrInputDocument inputDocument = createSolrInputDocument(fieldMapper,representation);
         long create = System.currentTimeMillis();
         try {
             UpdateRequest update = new UpdateRequest();
@@ -810,9 +905,11 @@ public class SolrYard extends AbstractYa
         Collection<Representation> added = new HashSet<Representation>();
         long start = System.currentTimeMillis();
         Collection<SolrInputDocument> inputDocs = new HashSet<SolrInputDocument>();
+        SolrServer server = getServer();
+        FieldMapper fieldMapper = getFieldMapper();
         for (Representation representation : representations) {
             if (representation != null) {
-                inputDocs.add(createSolrInputDocument(representation));
+                inputDocs.add(createSolrInputDocument(fieldMapper,representation));
                 added.add(representation);
             }
         }
@@ -852,7 +949,7 @@ public class SolrYard extends AbstractYa
      *            the representation
      * @return the Solr document for indexing
      */
-    protected final SolrInputDocument createSolrInputDocument(Representation representation) {
+    protected final SolrInputDocument createSolrInputDocument(FieldMapper fieldMapper,Representation representation) {
         SolrYardConfig config = (SolrYardConfig) getConfig();
         SolrInputDocument inputDocument = new SolrInputDocument();
         // If multiYardLayout is active, than we need to add the YardId as
@@ -972,9 +1069,11 @@ public class SolrYard extends AbstractYa
                 ids.add(representation.getId());
             }
         }
+        SolrServer server = getServer();
+        FieldMapper fieldMapper = getFieldMapper();
         int numDocs = ids.size(); // for debuging
         try {
-            ids = checkRepresentations(ids); // returns the ids found in the solrIndex
+            ids = checkRepresentations(server, fieldMapper,ids); // returns the ids found in the solrIndex
         } catch (SolrServerException e) {
             throw new YardException(
                     "Error while searching for alredy present documents before executing the actual update for the parsed Representations",
@@ -988,7 +1087,7 @@ public class SolrYard extends AbstractYa
         for (Representation representation : representations) {
             if (representation != null && ids.contains(representation.getId())) { // null parsed or not
                                                                                   // already present
-                inputDocs.add(createSolrInputDocument(representation));
+                inputDocs.add(createSolrInputDocument(fieldMapper,representation));
                 updated.add(representation);
             }
         }
@@ -1026,8 +1125,8 @@ public class SolrYard extends AbstractYa
      * @param inputDoc
      *            the document to store
      */
-    protected final void storeSolrDocument(SolrInputDocument inputDoc) throws SolrServerException,
-                                                                      IOException {
+    protected final void storeSolrDocument(SolrServer server, SolrInputDocument inputDoc) 
+                                           throws SolrServerException,IOException {
         server.add(inputDoc);
     }
 
@@ -1038,13 +1137,15 @@ public class SolrYard extends AbstractYa
      * @param inputDoc
      *            the document to store
      */
-    public final SolrDocument getSolrDocument(String uri) throws SolrServerException, IOException {
-        return getSolrDocument(uri, null);
+    protected final SolrDocument getSolrDocument(SolrServer server, FieldMapper fieldMapper,String uri) throws SolrServerException, IOException {
+        return getSolrDocument(server, fieldMapper, uri, null);
     }
 
-    protected final Collection<SolrDocument> getSolrDocuments(Collection<String> uris,
-                                                              Collection<String> fields) throws SolrServerException,
-                                                                                        IOException {
+    protected final Collection<SolrDocument> getSolrDocuments(SolrServer server,
+                                                              FieldMapper fieldMapper,
+                                                              Collection<String> uris, 
+                                                              Collection<String> fields) 
+                                                              throws SolrServerException, IOException {
         SolrYardConfig config = (SolrYardConfig) getConfig();
         SolrQuery solrQuery = new SolrQuery();
         if (fields == null || fields.isEmpty()) {
@@ -1108,8 +1209,11 @@ public class SolrYard extends AbstractYa
         return resultDocs;
     }
 
-    protected final SolrDocument getSolrDocument(String uri, Collection<String> fields) throws SolrServerException,
-                                                                                       IOException {
+    protected final SolrDocument getSolrDocument(SolrServer server,
+                                                 FieldMapper fieldMapper,
+                                                 String uri, 
+                                                 Collection<String> fields) 
+                                                 throws SolrServerException, IOException {
         SolrQuery solrQuery = new SolrQuery();
         if (fields == null || fields.isEmpty()) {
             solrQuery.addField("*"); // select all fields

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYardConfig.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYardConfig.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYardConfig.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYardConfig.java Fri Jul  8 15:20:31 2011
@@ -20,9 +20,10 @@ import java.util.Dictionary;
 import java.util.Map;
 
 import org.apache.solr.client.solrj.SolrServer;
+import org.apache.stanbol.commons.solr.SolrServerProvider;
 import org.apache.stanbol.entityhub.core.yard.AbstractYard.YardConfig;
-import org.apache.stanbol.entityhub.yard.solr.SolrDirectoryManager;
-import org.apache.stanbol.entityhub.yard.solr.SolrServerProvider.Type;
+import org.apache.stanbol.commons.solr.SolrDirectoryManager;
+import org.apache.stanbol.commons.solr.SolrServerProvider.Type;
 import org.osgi.service.cm.ConfigurationException;
 
 /**
@@ -81,7 +82,7 @@ public final class SolrYardConfig extend
      * @param type
      *            The type to use
      */
-    public void setSolrServerType(Type type) {
+    public void setSolrServerType(SolrServerProvider.Type type) {
         if (type == null) {
             config.remove(SolrYard.SOLR_SERVER_TYPE);
         } else {
@@ -89,14 +90,14 @@ public final class SolrYardConfig extend
         }
     }
 
-    public Type getSolrServerType() {
+    public SolrServerProvider.Type getSolrServerType() {
         Object serverType = config.get(SolrYard.SOLR_SERVER_TYPE);
         if (serverType != null) {
-            if (serverType instanceof Type) {
-                return (Type) serverType;
+            if (serverType instanceof SolrServerProvider.Type) {
+                return (SolrServerProvider.Type) serverType;
             } else {
                 try {
-                    return Type.valueOf(serverType.toString());
+                    return SolrServerProvider.Type.valueOf(serverType.toString());
                 } catch (IllegalArgumentException e) {
                     // invalid value set!
                     config.remove(SolrYard.SOLR_SERVER_TYPE);
@@ -107,9 +108,9 @@ public final class SolrYardConfig extend
         String serverLocation = getSolrServerLocation();
         // TODO: maybe we need to improve this detection code.
         if (serverLocation.startsWith("http")) {
-            return Type.HTTP;
+            return SolrServerProvider.Type.HTTP;
         } else {
-            return Type.EMBEDDED;
+            return SolrServerProvider.Type.EMBEDDED;
         }
     }
 

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/AssignmentEncoder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/AssignmentEncoder.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/AssignmentEncoder.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/AssignmentEncoder.java Fri Jul  8 15:20:31 2011
@@ -26,7 +26,7 @@ import org.apache.stanbol.entityhub.yard
 import org.apache.stanbol.entityhub.yard.solr.query.EncodedConstraintParts;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEncoder;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEnum;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
+import org.apache.stanbol.entityhub.yard.solr.query.QueryUtils;
 
 /**
  * Encodes the Assignment of the field to an value. If a value is parsed, than it encodes that the field must
@@ -58,7 +58,7 @@ public class AssignmentEncoder implement
             indexValue = indexValueFactory.createIndexValue(value);
         }
         // encode the value based on the type
-        String[] queryConstraints = SolrUtil.encodeQueryValue(indexValue, true);
+        String[] queryConstraints = QueryUtils.encodeQueryValue(indexValue, true);
         String[] eqConstraints;
         if (queryConstraints != null) {
             eqConstraints = new String[queryConstraints.length];

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/DataTypeEncoder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/DataTypeEncoder.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/DataTypeEncoder.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/DataTypeEncoder.java Fri Jul  8 15:20:31 2011
@@ -19,6 +19,7 @@ package org.apache.stanbol.entityhub.yar
 import java.util.Arrays;
 import java.util.Collection;
 
+import org.apache.stanbol.commons.solr.utils.SolrUtil;
 import org.apache.stanbol.entityhub.yard.solr.model.FieldMapper;
 import org.apache.stanbol.entityhub.yard.solr.model.IndexDataType;
 import org.apache.stanbol.entityhub.yard.solr.model.IndexField;
@@ -28,8 +29,8 @@ import org.apache.stanbol.entityhub.yard
 import org.apache.stanbol.entityhub.yard.solr.query.EncodedConstraintParts;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEncoder;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEnum;
+import org.apache.stanbol.entityhub.yard.solr.query.QueryUtils;
 import org.apache.stanbol.entityhub.yard.solr.query.ConstraintTypePosition.PositionType;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
 
 /**
  * Encodes the DataType to the field name.

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/FieldEncoder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/FieldEncoder.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/FieldEncoder.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/FieldEncoder.java Fri Jul  8 15:20:31 2011
@@ -20,13 +20,14 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.stanbol.commons.solr.utils.SolrUtil;
 import org.apache.stanbol.entityhub.yard.solr.model.FieldMapper;
 import org.apache.stanbol.entityhub.yard.solr.query.ConstraintTypePosition;
 import org.apache.stanbol.entityhub.yard.solr.query.EncodedConstraintParts;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEncoder;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEnum;
+import org.apache.stanbol.entityhub.yard.solr.query.QueryUtils;
 import org.apache.stanbol.entityhub.yard.solr.query.ConstraintTypePosition.PositionType;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
 
 public class FieldEncoder implements IndexConstraintTypeEncoder<List<String>> {
 

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LangEncoder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LangEncoder.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LangEncoder.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LangEncoder.java Fri Jul  8 15:20:31 2011
@@ -21,13 +21,14 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 
+import org.apache.stanbol.commons.solr.utils.SolrUtil;
 import org.apache.stanbol.entityhub.yard.solr.model.FieldMapper;
 import org.apache.stanbol.entityhub.yard.solr.query.ConstraintTypePosition;
 import org.apache.stanbol.entityhub.yard.solr.query.EncodedConstraintParts;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEncoder;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEnum;
+import org.apache.stanbol.entityhub.yard.solr.query.QueryUtils;
 import org.apache.stanbol.entityhub.yard.solr.query.ConstraintTypePosition.PositionType;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
 
 public class LangEncoder implements IndexConstraintTypeEncoder<Collection<String>> {
 

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/WildcardEncoder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/WildcardEncoder.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/WildcardEncoder.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/WildcardEncoder.java Fri Jul  8 15:20:31 2011
@@ -30,7 +30,7 @@ import org.apache.stanbol.entityhub.yard
 import org.apache.stanbol.entityhub.yard.solr.query.EncodedConstraintParts;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEncoder;
 import org.apache.stanbol.entityhub.yard.solr.query.IndexConstraintTypeEnum;
-import org.apache.stanbol.entityhub.yard.solr.utils.SolrUtil;
+import org.apache.stanbol.entityhub.yard.solr.query.QueryUtils;
 
 public class WildcardEncoder implements IndexConstraintTypeEncoder<IndexValue> {
 
@@ -53,7 +53,7 @@ public class WildcardEncoder implements 
                 "This encoder does not support the IndexDataType %s (supported: %s)", value.getType(),
                 SUPPORTED_TYPES));
         } else {
-            constraint.addEncoded(POS, SolrUtil.encodeQueryValue(value, false));
+            constraint.addEncoded(POS, QueryUtils.encodeQueryValue(value, false));
         }
     }
 

Copied: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java (from r1142896, incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java?p2=incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java&p1=incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java&r1=1142896&r2=1144355&rev=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java Fri Jul  8 15:20:31 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.stanbol.entityhub.yard.solr.utils;
+package org.apache.stanbol.entityhub.yard.solr.query;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -23,26 +23,12 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.regex.Pattern;
 
+import org.apache.stanbol.commons.solr.utils.SolrUtil;
 import org.apache.stanbol.entityhub.yard.solr.defaults.IndexDataTypeEnum;
 import org.apache.stanbol.entityhub.yard.solr.model.IndexValue;
 
-public final class SolrUtil {
-    private SolrUtil() {}
-
-    private static final String LUCENE_ESCAPE_CHARS = "[\\\\+\\-\\!\\(\\)\\:\\^\\[\\]\\{\\}\\~\\*\\?]";
-    private static final Pattern LUCENE_PATTERN = Pattern.compile(LUCENE_ESCAPE_CHARS);
-    private static final String REPLACEMENT_STRING = "\\\\$0";
-
-    /**
-     * Escapes all special chars in an string (field name or constraint) to be used in an SolrQuery.
-     * 
-     * @param string
-     *            the string to be escaped
-     * @return the escaped string
-     */
-    public static String escapeSolrSpecialChars(String string) {
-        return string != null ? LUCENE_PATTERN.matcher(string).replaceAll(REPLACEMENT_STRING) : null;
-    }
+public final class QueryUtils {
+    private QueryUtils() {}
 
     /**
      * This method encodes a parsed index value as needed for queries.

Propchange: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/QueryUtils.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/OSGI-INF/metatype/metatype.properties Fri Jul  8 15:20:31 2011
@@ -33,11 +33,3 @@ org.apache.stanbol.entityhub.yard.defaul
 #org.apache.stanbol.entityhub.yard.solr.maxBooleanClauses
 org.apache.stanbol.entityhub.yard.solr.maxBooleanClauses.name=Max Boolean Clauses
 org.apache.stanbol.entityhub.yard.solr.maxBooleanClauses.description=This is the maximum number of boolean clauses allowed for Solr queries. This value is configured in the solrconf.xml by the maxBooleanClauses element.
-
-
-#Properties defined by the org.apache.stanbol.entityhub.yard.solr.embedded.EmbeddedSolrPorovider
-org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.name=Apache Stanbol Entityhub Yard: Solr Directory Manager
-org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.description=Manages the Solr Indices used by the SolrYard in cases where no absolute path or an http URL is configured as SolrServer location.  
-
-org.apache.stanbol.entityhub.yard.solr.embedded.solrDataDir.name=Managed Index Location
-org.apache.stanbol.entityhub.yard.solr.embedded.solrDataDir.description=The path to the directory used to store the managed Solr Indices. The user directory is used to resolve relative paths. Property substitution is supported. (e.g. ${user.home}/.stanbol/indices will create the managed indices within the "/.stanbol/indices" relative to the home directory of the user). 
\ No newline at end of file

Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java Fri Jul  8 15:20:31 2011
@@ -23,6 +23,7 @@ import java.io.File;
 import java.util.Arrays;
 import java.util.Iterator;
 
+import org.apache.stanbol.commons.solr.SolrDirectoryManager;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
 import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;

Modified: incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml Fri Jul  8 15:20:31 2011
@@ -333,6 +333,11 @@
       <artifactId>org.apache.stanbol.commons.opennlp</artifactId>
       <version>0.9-SNAPSHOT</version>
     </bundle>
+    <bundle>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.solr</artifactId>
+      <version>0.9-SNAPSHOT</version>
+    </bundle>
     <!-- support for JSON-LD -->
     <bundle>
       <groupId>org.apache.stanbol</groupId>

Copied: incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg (from r1142896, incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg?p2=incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg&p1=incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg&r1=1142896&r2=1144355&rev=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrDirectoryManager.cfg (original)
+++ incubator/stanbol/trunk/launchers/full/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg Fri Jul  8 15:20:31 2011
@@ -1 +1 @@
-org.apache.stanbol.entityhub.yard.solr.managedSolrDir=${user.dir}/sling/entityhub/solrYard/indexes
+org.apache.stanbol.commons.solr.managedSolrDir=${user.dir}/sling/entityhub/solrYard/indexes

Modified: incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml?rev=1144355&r1=1144354&r2=1144355&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml Fri Jul  8 15:20:31 2011
@@ -213,7 +213,7 @@
   </startLevel>
     
 	<!-- Stanbol Enhancer infrastructure and required libraries-->
-	<startLevel level="15">
+	<startLevel level="12">
 		<bundle>
 			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
@@ -244,6 +244,16 @@
 		    <artifactId>org.apache.stanbol.commons.stanboltools.datafileprovider.bundle</artifactId>
 		    <version>0.9-SNAPSHOT</version>
 	    </bundle>
+        <bundle>
+            <groupId>org.apache.stanbol</groupId>
+            <artifactId>org.apache.stanbol.commons.opennlp</artifactId>
+            <version>0.9-SNAPSHOT</version>
+        </bundle>
+	    <bundle>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.commons.solr</artifactId>
+			<version>0.9-SNAPSHOT</version>
+	    </bundle>
 	</startLevel>
 
 	<!-- Clerezza storage and sparql infrastructure -->
@@ -422,18 +432,13 @@
 		<bundle>
 			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.defaultdata</artifactId>
-			<version>0.0.2</version>
+			<version>0.0.3</version>
 		</bundle>
 		<bundle>
 			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.enhancer.engines.opennlp.ner</artifactId>
 			<version>0.9-SNAPSHOT</version>
 		</bundle>
-	    <bundle>
-	        <groupId>org.apache.stanbol</groupId>
-	        <artifactId>org.apache.stanbol.commons.opennlp</artifactId>
-	        <version>0.9-SNAPSHOT</version>
-	    </bundle>
 		<!--
 			The geonames.org LocationEnhancement Engines needs two additional
 			bundles 1) jettyjson 2) commons-io. Both of them are already
@@ -444,7 +449,7 @@
 			<artifactId>org.apache.stanbol.enhancer.engines.geonames</artifactId>
 			<version>0.9-SNAPSHOT</version>
 		</bundle>
-        <!-- Entity Tagging Engine based on RICK -->
+        <!-- Entity Tagging Engine based on Entityhub -->
 		<bundle>
 			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.enhancer.engine.entitytagging</artifactId>
@@ -452,8 +457,8 @@
 		</bundle>
 	</startLevel>
     
-  <!-- RICK infrastructure and required libraries-->
-  <startLevel level="15">
+  <!-- Entityhub infrastructure and required libraries-->
+  <startLevel level="16">
     <bundle>
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.entityhub.servicesapi</artifactId>
@@ -484,8 +489,6 @@
       <artifactId>org.apache.stanbol.entityhub.yard.solr</artifactId>
       <version>0.9-SNAPSHOT</version>
     </bundle>
-  </startLevel>
-  <startLevel level="16">
     <bundle>
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.entityhub.core</artifactId>

Added: incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg?rev=1144355&view=auto
==============================================================================
--- incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg (added)
+++ incubator/stanbol/trunk/launchers/kres/src/main/resources/resources/config/org.apache.stanbol.commons.solr.impl.DefaultSolrDirectoryManager.cfg Fri Jul  8 15:20:31 2011
@@ -0,0 +1 @@
+org.apache.stanbol.commons.solr.managedSolrDir=${user.dir}/sling/entityhub/solrYard/indexes