Modified: 
stanbol/branches/release-0.12/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/MockComponentContext.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/MockComponentContext.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/MockComponentContext.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/MockComponentContext.java
 Wed May 20 12:41:56 2015
@@ -18,6 +18,7 @@ package org.apache.stanbol.enhancer.engi
 
 import java.io.File;
 import java.io.InputStream;
+import java.util.Collection;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -157,47 +158,71 @@ public class MockComponentContext implem
         }
 
         @Override
-        public ServiceRegistration registerService(String[] clazzes, Object 
service, Dictionary properties) {
+        public ServiceReference[] getServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceRegistration registerService(String clazz, Object 
service, Dictionary properties) {
+        public ServiceReference[] getAllServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceReference[] getServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
+        public ServiceReference getServiceReference(String clazz) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceReference[] getAllServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
+        public File getDataFile(String filename) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceReference getServiceReference(String clazz) {
+        public Filter createFilter(String filter) throws 
InvalidSyntaxException {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public Object getService(ServiceReference reference) {
+        public ServiceRegistration<?> registerService(String[] clazzes, Object 
service,
+                Dictionary<String,?> properties) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public boolean ungetService(ServiceReference reference) {
+        public ServiceRegistration<?> registerService(String clazz, Object 
service,
+                Dictionary<String,?> properties) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public File getDataFile(String filename) {
+        public <S> ServiceRegistration<S> registerService(Class<S> clazz, S 
service,
+                Dictionary<String,?> properties) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public Filter createFilter(String filter) throws 
InvalidSyntaxException {
+        public <S> ServiceReference<S> getServiceReference(Class<S> clazz) {
+            throw new UnsupportedOperationException("Mock implementation");
+        }
+
+        @Override
+        public <S> Collection<ServiceReference<S>> 
getServiceReferences(Class<S> clazz, String filter)
+                throws InvalidSyntaxException {
+            throw new UnsupportedOperationException("Mock implementation");
+        }
+
+        @Override
+        public <S> S getService(ServiceReference<S> reference) {
+            throw new UnsupportedOperationException("Mock implementation");
+        }
+
+        @Override
+        public boolean ungetService(ServiceReference<?> reference) {
+            throw new UnsupportedOperationException("Mock implementation");
+        }
+
+        @Override
+        public Bundle getBundle(String location) {
             throw new UnsupportedOperationException("Mock implementation");
         }
         

Modified: stanbol/branches/release-0.12/enhancement-engines/refactor/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/refactor/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- stanbol/branches/release-0.12/enhancement-engines/refactor/pom.xml 
(original)
+++ stanbol/branches/release-0.12/enhancement-engines/refactor/pom.xml Wed May 
20 12:41:56 2015
@@ -128,12 +128,12 @@
           <artifactId>slf4j-api</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>com.hp.hpl.jena</groupId>
-          <artifactId>arq</artifactId>
+          <groupId>org.apache.jena</groupId>
+          <artifactId>jena-arq</artifactId>
         </exclusion>
         <exclusion>
-          <groupId>com.hp.hpl.jena</groupId>
-          <artifactId>jena</artifactId>
+          <groupId>org.apache.jena</groupId>
+          <artifactId>jena-core</artifactId>
         </exclusion>
       </exclusions>
     </dependency>
@@ -195,37 +195,13 @@
 
 
     <dependency>
-      <groupId>com.hp.hpl.jena</groupId>
-      <artifactId>jena</artifactId>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-core</artifactId>
       <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.slf4j</groupId>
-          <artifactId>slf4j-log4j12</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
     <dependency>
-      <groupId>com.hp.hpl.jena</groupId>
-      <artifactId>arq</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>org.slf4j</groupId>
-          <artifactId>slf4j-log4j12</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jmx</groupId>
-          <artifactId>jmxri</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.jms</groupId>
-          <artifactId>jms</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jdmk</groupId>
-          <artifactId>jmxtools</artifactId>
-        </exclusion>
-      </exclusions>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-arq</artifactId>
     </dependency>
   </dependencies>
 

Modified: 
stanbol/branches/release-0.12/enhancement-engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/DereferencerImpl.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/DereferencerImpl.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/DereferencerImpl.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/DereferencerImpl.java
 Wed May 20 12:41:56 2015
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
  * @author andrea.nuzzolese
  * 
  */
-@Component(immediate = true, metatype = true)
+@Component(immediate = true)
 @Service(Dereferencer.class)
 public class DereferencerImpl implements Dereferencer {
 

Modified: 
stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/pom.xml
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/pom.xml
 Wed May 20 12:41:56 2015
@@ -76,6 +76,11 @@
                        
<artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
                        <version>0.12.0</version>
                </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        
                <!-- for tests -->
                <dependency>
                        <groupId>org.apache.stanbol</groupId>

Modified: 
stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/src/test/java/org/apache/stanbol/enhancer/engines/textannotationnewmodel/impl/MockComponentContext.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/src/test/java/org/apache/stanbol/enhancer/engines/textannotationnewmodel/impl/MockComponentContext.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/src/test/java/org/apache/stanbol/enhancer/engines/textannotationnewmodel/impl/MockComponentContext.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/textannotationnewmodel/src/test/java/org/apache/stanbol/enhancer/engines/textannotationnewmodel/impl/MockComponentContext.java
 Wed May 20 12:41:56 2015
@@ -18,6 +18,7 @@ package org.apache.stanbol.enhancer.engi
 
 import java.io.File;
 import java.io.InputStream;
+import java.util.Collection;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -157,49 +158,73 @@ public class MockComponentContext implem
         }
 
         @Override
-        public ServiceRegistration registerService(String[] clazzes, Object 
service, Dictionary properties) {
+        public ServiceReference[] getServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceRegistration registerService(String clazz, Object 
service, Dictionary properties) {
+        public ServiceReference[] getAllServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceReference[] getServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
+        public ServiceReference getServiceReference(String clazz) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceReference[] getAllServiceReferences(String clazz, String 
filter) throws InvalidSyntaxException {
+        public File getDataFile(String filename) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public ServiceReference getServiceReference(String clazz) {
+        public Filter createFilter(String filter) throws 
InvalidSyntaxException {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public Object getService(ServiceReference reference) {
+        public ServiceRegistration<?> registerService(String[] clazzes, Object 
service,
+                Dictionary<String,?> properties) {
             throw new UnsupportedOperationException("Mock implementation");
         }
 
         @Override
-        public boolean ungetService(ServiceReference reference) {
+        public ServiceRegistration<?> registerService(String clazz, Object 
service,
+                Dictionary<String,?> properties) {
             throw new UnsupportedOperationException("Mock implementation");
-        }
+     }
 
         @Override
-        public File getDataFile(String filename) {
+        public <S> ServiceRegistration<S> registerService(Class<S> clazz, S 
service,
+                Dictionary<String,?> properties) {
             throw new UnsupportedOperationException("Mock implementation");
-        }
+     }
 
         @Override
-        public Filter createFilter(String filter) throws 
InvalidSyntaxException {
+        public <S> ServiceReference<S> getServiceReference(Class<S> clazz) {
             throw new UnsupportedOperationException("Mock implementation");
-        }
+     }
+
+        @Override
+        public <S> Collection<ServiceReference<S>> 
getServiceReferences(Class<S> clazz, String filter)
+                throws InvalidSyntaxException {
+            throw new UnsupportedOperationException("Mock implementation");
+      }
+
+        @Override
+        public <S> S getService(ServiceReference<S> reference) {
+            throw new UnsupportedOperationException("Mock implementation");
+    }
+
+        @Override
+        public boolean ungetService(ServiceReference<?> reference) {
+            throw new UnsupportedOperationException("Mock implementation");
+      }
+
+        @Override
+        public Bundle getBundle(String location) {
+            throw new UnsupportedOperationException("Mock implementation");
+    }
         
     }
 }

Modified: 
stanbol/branches/release-0.12/enhancement-engines/tika/src/test/java/org/apache/stanbol/enhancer/engines/tika/MockComponentContext.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/tika/src/test/java/org/apache/stanbol/enhancer/engines/tika/MockComponentContext.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/tika/src/test/java/org/apache/stanbol/enhancer/engines/tika/MockComponentContext.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/tika/src/test/java/org/apache/stanbol/enhancer/engines/tika/MockComponentContext.java
 Wed May 20 12:41:56 2015
@@ -18,6 +18,7 @@ package org.apache.stanbol.enhancer.engi
 
 import java.io.File;
 import java.io.InputStream;
+import java.util.Collection;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -56,11 +57,6 @@ public class MockComponentContext implem
         return new BundleContext() {
 
             @Override
-            public boolean ungetService(ServiceReference reference) {
-                return false;
-            }
-
-            @Override
             public void removeServiceListener(ServiceListener listener) {
             }
 
@@ -73,18 +69,6 @@ public class MockComponentContext implem
             }
 
             @Override
-            public ServiceRegistration registerService(String clazz,
-                    Object service, Dictionary properties) {
-                return null;
-            }
-
-            @Override
-            public ServiceRegistration registerService(String[] clazzes,
-                    Object service, Dictionary properties) {
-                return null;
-            }
-
-            @Override
             public Bundle installBundle(String location, InputStream input)
                     throws BundleException {
                 return null;
@@ -107,11 +91,6 @@ public class MockComponentContext implem
             }
 
             @Override
-            public Object getService(ServiceReference reference) {
-                return null;
-            }
-
-            @Override
             public String getProperty(String key) {
                 return null;
             }
@@ -165,6 +144,50 @@ public class MockComponentContext implem
             @Override
             public void addBundleListener(BundleListener listener) {
             }
+
+            @Override
+            public ServiceRegistration<?> registerService(String[] clazzes, 
Object service,
+                    Dictionary<String,?> properties) {
+                return null;
+            }
+
+            @Override
+            public ServiceRegistration<?> registerService(String clazz, Object 
service,
+                    Dictionary<String,?> properties) {
+                return null;
+            }
+
+            @Override
+            public <S> ServiceRegistration<S> registerService(Class<S> clazz, 
S service,
+                    Dictionary<String,?> properties) {
+                return null;
+            }
+
+            @Override
+            public <S> ServiceReference<S> getServiceReference(Class<S> clazz) 
{
+                return null;
+            }
+
+            @Override
+            public <S> Collection<ServiceReference<S>> 
getServiceReferences(Class<S> clazz, String filter)
+                    throws InvalidSyntaxException {
+                return null;
+            }
+
+            @Override
+            public <S> S getService(ServiceReference<S> reference) {
+                return null;
+            }
+
+            @Override
+            public boolean ungetService(ServiceReference<?> reference) {
+                return false;
+            }
+
+            @Override
+            public Bundle getBundle(String location) {
+                return null;
+            }
         };
     }
 

Modified: 
stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
 Wed May 20 12:41:56 2015
@@ -501,7 +501,7 @@ public class TopicClassificationEngine e
                 "Unable to extract " + " textual content from ContentPart %s 
of ContentItem %s!",
                 contentPart.getKey(), ci.getUri()), e);
         }
-        if (text.trim().isEmpty()) {
+        if (StringUtils.isBlank(text)) {
             log.warn(
                 "ContentPart {} of ContentItem {} does not contain any " + 
"text to extract topics from",
                 contentPart.getKey(), ci.getUri());
@@ -709,7 +709,7 @@ public class TopicClassificationEngine e
         query.addFilterQuery(entryTypeField + ":" + METADATA_ENTRY);
         query.addFilterQuery(broaderField + ":" + 
ClientUtils.escapeQueryChars(broadTopicId));
         query.addField(conceptUriField);
-        query.addSortField(conceptUriField, SolrQuery.ORDER.asc);
+        query.addSort(conceptUriField, SolrQuery.ORDER.asc);
         try {
             for (SolrDocument result : solrServer.query(query).getResults()) {
                 
narrowerConcepts.add(result.getFirstValue(conceptUriField).toString());
@@ -759,7 +759,7 @@ public class TopicClassificationEngine e
         // TODO: this can be very big on flat thesauri: should we enable a 
paging API instead?
         query.setRows(MAX_ROOTS);
         query.setFields(conceptUriField);
-        query.setSortField(conceptUriField, SolrQuery.ORDER.asc);
+        query.setSort(conceptUriField, SolrQuery.ORDER.asc);
         query.addFilterQuery(entryTypeField + ":" + METADATA_ENTRY);
         if (broaderField != null) {
             // find any topic with an empty broaderField
@@ -927,7 +927,7 @@ public class TopicClassificationEngine e
         String offset = null;
         boolean done = false;
         int batchSize = 1000;
-        query.addSortField(conceptUriField, SolrQuery.ORDER.asc);
+        query.addSort(conceptUriField, SolrQuery.ORDER.asc);
         query.setRows(batchSize + 1);
         try {
             while (!done) {

Modified: 
stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/topic/engine/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
 Wed May 20 12:41:56 2015
@@ -266,7 +266,7 @@ public class SolrTrainingSet extends Con
             q += " AND " + exampleIdField + ":[" + offset.toString() + " TO 
*]";
         }
         query.setQuery(q);
-        query.addSortField(exampleIdField, SolrQuery.ORDER.asc);
+        query.addSort(exampleIdField, SolrQuery.ORDER.asc);
         query.set("rows", batchSize + 1);
         String nextExampleId = null;
         try {

Modified: 
stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
 Wed May 20 12:41:56 2015
@@ -36,7 +36,7 @@ import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
 
 
-@Component(immediate = true, metatype = true)
+@Component(immediate = true)
 @Service
 public class TopicClassifierFragment implements WebFragment {
 

Modified: 
stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancement-engines/topic/web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
 Wed May 20 12:41:56 2015
@@ -26,6 +26,7 @@ import org.apache.stanbol.enhancer.servi
 import org.apache.stanbol.enhancer.servicesapi.rdf.Properties;
 import org.apache.stanbol.enhancer.topic.api.ClassifierException;
 import org.apache.stanbol.enhancer.topic.api.TopicClassifier;
+import org.apache.stanbol.enhancer.topic.api.TopicSuggestion;
 import org.apache.stanbol.enhancer.topic.api.training.TrainingSet;
 import org.apache.stanbol.enhancer.topic.api.training.TrainingSetException;
 import org.osgi.framework.BundleContext;
@@ -36,6 +37,8 @@ import javax.servlet.ServletContext;
 import javax.ws.rs.*;
 import javax.ws.rs.core.*;
 import javax.ws.rs.core.Response.ResponseBuilder;
+
+import java.util.ArrayList;
 import java.util.List;
 
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
@@ -202,6 +205,38 @@ public final class TopicModelResource ex
         addCORSOrigin(servletContext, rb, headers);
         return rb.build();
     }
+    /**
+     * Suggests a list of concepts for the parsed content. Intended for simple
+     * testing of the classifier (e.g. by bash scripts)
+     * @param max the maximum number of suggested categories (default all)
+     * @param score if the scores should be included
+     */
+    @POST
+    @Path("suggest")
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN) // comma separated list of concept URIs
+    public String suggest(@QueryParam(value = "max") int max,
+            @QueryParam(value = "score") Boolean score, 
+            String textContent, @Context HttpHeaders headers) 
+            throws TrainingSetException, ClassifierException {
+        if(max < 1){
+            max = Integer.MAX_VALUE;
+        }
+        StringBuilder concepts = new StringBuilder();
+        List<TopicSuggestion> sugs = classifier.suggestTopics(textContent);
+        for(int i=0;i < max && i <sugs.size(); i++){
+            TopicSuggestion sug = sugs.get(i);
+            if(i > 0){
+                concepts.append('\n');
+            }
+            concepts.append(sug.conceptUri);
+            if(score == null || Boolean.TRUE.equals(score)){
+                concepts.append('\t');
+                concepts.append(sug.score);
+            }
+        }
+        return concepts.toString();
+    }
 
     // TODO make the following a DELETE method on the example sub-resources 
them-selves once we have a GET for
     // them

Modified: stanbol/branches/release-0.12/enhancer/generic/nlp-json/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/generic/nlp-json/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- stanbol/branches/release-0.12/enhancer/generic/nlp-json/pom.xml (original)
+++ stanbol/branches/release-0.12/enhancer/generic/nlp-json/pom.xml Wed May 20 
12:41:56 2015
@@ -93,6 +93,10 @@
       <artifactId>org.apache.stanbol.enhancer.nlp</artifactId>
       <version>0.12.0</version>
     </dependency>
+        <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
     <dependency>
       <groupId>javax.ws.rs</groupId>
       <artifactId>jsr311-api</artifactId>

Modified: stanbol/branches/release-0.12/enhancer/generic/nlp/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/generic/nlp/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- stanbol/branches/release-0.12/enhancer/generic/nlp/pom.xml (original)
+++ stanbol/branches/release-0.12/enhancer/generic/nlp/pom.xml Wed May 20 
12:41:56 2015
@@ -129,6 +129,10 @@
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>
+    <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
     <!-- Logging -->
     <dependency>
       <groupId>org.slf4j</groupId>

Modified: stanbol/branches/release-0.12/enhancer/generic/servicesapi/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/generic/servicesapi/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- stanbol/branches/release-0.12/enhancer/generic/servicesapi/pom.xml 
(original)
+++ stanbol/branches/release-0.12/enhancer/generic/servicesapi/pom.xml Wed May 
20 12:41:56 2015
@@ -105,6 +105,10 @@
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
+    <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
 
     <!-- for tests -->
     <dependency>

Modified: stanbol/branches/release-0.12/enhancer/jersey/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jersey/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- stanbol/branches/release-0.12/enhancer/jersey/pom.xml (original)
+++ stanbol/branches/release-0.12/enhancer/jersey/pom.xml Wed May 20 12:41:56 
2015
@@ -222,6 +222,11 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>  <!-- used for debug level logging during tests -->
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/fragment/EnhancerWebFragment.java
 Wed May 20 12:41:56 2015
@@ -47,7 +47,7 @@ import org.apache.stanbol.enhancer.servi
  * Statically define the list of available resources and providers to be 
contributed to the the Stanbol JAX-RS
  * Endpoint.
  */
-@Component(immediate = true, metatype = true)
+@Component(immediate = true)
 @Service
 public class EnhancerWebFragment implements WebFragment {
 

Modified: 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/reader/ContentItemReader.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/reader/ContentItemReader.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/reader/ContentItemReader.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/reader/ContentItemReader.java
 Wed May 20 12:41:56 2015
@@ -83,8 +83,6 @@ import org.apache.stanbol.enhancer.servi
 import org.apache.stanbol.enhancer.servicesapi.helper.ContentItemHelper;
 import org.apache.stanbol.enhancer.servicesapi.helper.EnhancementEngineHelper;
 import org.apache.stanbol.enhancer.servicesapi.impl.StreamSource;
-import org.apache.stanbol.enhancer.servicesapi.rdf.Properties;
-import org.apache.stanbol.enhancer.servicesapi.rdf.TechnicalClasses;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;

Modified: 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/writers/ContentItemWriter.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/writers/ContentItemWriter.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/writers/ContentItemWriter.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/writers/ContentItemWriter.java
 Wed May 20 12:41:56 2015
@@ -44,9 +44,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Random;
 import java.util.Set;
 
 import javax.servlet.ServletContext;
@@ -64,13 +66,17 @@ import org.apache.clerezza.rdf.core.UriR
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
 import 
org.apache.clerezza.rdf.core.serializedform.UnsupportedSerializationFormatException;
 import org.apache.commons.io.IOUtils;
-import org.apache.http.entity.mime.FormBodyPart;
-import org.apache.http.entity.mime.HttpMultipart;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.mime.MIME;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.AbstractContentBody;
 import org.apache.http.entity.mime.content.ContentBody;
 import org.apache.http.entity.mime.content.ContentDescriptor;
-import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.entity.mime.content.InputStreamBody;
+import org.apache.http.message.BasicNameValuePair;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.enhancer.servicesapi.Blob;
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
@@ -78,15 +84,38 @@ import org.apache.stanbol.enhancer.servi
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Provider
 public class ContentItemWriter implements MessageBodyWriter<ContentItem> {
 
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    public static final String CONTENT_ITEM_BOUNDARY;
+    public static final String CONTENT_PARTS_BOUNDERY;;
+    /**
+     * The pool of ASCII chars to be used for generating a multipart boundary.
+     */
+    private final static char[] MULTIPART_CHARS =
+            "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                    .toCharArray();
+    static {
+        final Random rand = new Random();
+        final int count = rand.nextInt(11) + 10; // a random size from 10 to 20
+        StringBuilder randomString = new StringBuilder(count);
+        for (int i = 0; i < count; i++) {
+            
randomString.append(MULTIPART_CHARS[rand.nextInt(MULTIPART_CHARS.length)]);
+        }
+        CONTENT_ITEM_BOUNDARY = "contentItem-"+randomString;
+        CONTENT_PARTS_BOUNDERY = "contentParts-"+randomString;
+    }
+    private static final ContentType MULTIPART_ALTERNATE = 
ContentType.create("multipart/alternate");
+    
     /**
      * The "multipart/*" wilrcard
      */
     private static final MediaType MULTIPART = 
MediaType.valueOf(MULTIPART_FORM_DATA_TYPE.getType()+"/*");
-    private static final String CONTENT_ITEM_BOUNDARY = "contentItem";
     private static final Charset UTF8 = Charset.forName("UTF-8");
     /**
      * The media type for JSON-LD (<code>application/ld+json</code>)
@@ -243,25 +272,32 @@ public class ContentItemWriter implement
             String contentType = String.format("%s/%s; charset=%s; 
boundary=%s",
                 
mediaType.getType(),mediaType.getSubtype(),charset.toString(),CONTENT_ITEM_BOUNDARY);
             httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE,contentType);
-            HttpMultipart entity = new HttpMultipart("from-data", charset 
,CONTENT_ITEM_BOUNDARY);
+            MultipartEntityBuilder entityBuilder = 
MultipartEntityBuilder.create();
+            entityBuilder.setBoundary(CONTENT_ITEM_BOUNDARY);
             //(2) serialising the metadata
             if(!isOmitMetadata(reqProp)){
-                entity.addBodyPart(new FormBodyPart("metadata", new 
ClerezzaContentBody(
-                    ci.getUri().getUnicodeString(), ci.getMetadata(),
-                    rdfFormat)));
+                entityBuilder.addPart("metadata", new ClerezzaContentBody(
+                    ci.getUri().getUnicodeString(), ci.getMetadata(), 
rdfFormat));
             }
             //(3) serialising the Content (Bloby)
             //(3.a) Filter based on parameter
             List<Entry<UriRef,Blob>> includedBlobs = filterBlobs(ci, reqProp);
             //(3.b) Serialise the filtered
             if(!includedBlobs.isEmpty()) {
-                HttpMultipart content = new HttpMultipart("alternate", UTF8 
,"contentParts");
+                Map<String,ContentBody> contentParts = new 
LinkedHashMap<String,ContentBody>();
                 for(Entry<UriRef,Blob> entry : includedBlobs){
-                    content.addBodyPart(new 
FormBodyPart(entry.getKey().getUnicodeString(), 
-                        new BlobContentBody(entry.getValue()))); //no file name
+                    Blob blob = entry.getValue();
+                    ContentType ct = ContentType.create(blob.getMimeType());
+                    String cs = blob.getParameter().get("charset");
+                    if(StringUtils.isNotBlank(cs)){
+                        ct = ct.withCharset(cs);
+                    }
+                    contentParts.put(entry.getKey().getUnicodeString(), 
+                        new InputStreamBody(blob.getStream(),ct));
                 }
                 //add all the blobs
-                entity.addBodyPart(new FormBodyPart("content",new 
MultipartContentBody(content, null)));
+                entityBuilder.addPart("content", new 
MultipartContentBody(contentParts,
+                    CONTENT_PARTS_BOUNDERY, MULTIPART_ALTERNATE));
             } //else no content to include
             Set<String> includeContentParts = 
getIncludedContentPartURIs(reqProp);
             if(includeContentParts != null){
@@ -272,26 +308,27 @@ public class ContentItemWriter implement
                     try {
                         object = toJson(reqProp);
                     } catch (JSONException e) {
-                        throw new WebApplicationException(e,
-                            
Response.status(Response.Status.INTERNAL_SERVER_ERROR)
-                            .entity("Unable to convert Request Properties to " 
+
-                                       "JSON (values : 
"+reqProp+")!").build());
+                        String message = "Unable to convert Request Properties 
" 
+                                + "to JSON (values : "+reqProp+")!";
+                        log.error(message,e);
+                        throw new WebApplicationException(new 
IllegalStateException(message), 
+                            Response.Status.INTERNAL_SERVER_ERROR);
                     }
-                    entity.addBodyPart(new FormBodyPart(
-                        REQUEST_PROPERTIES_URI.getUnicodeString(), 
-                        new 
StringBody(object.toString(),MediaType.APPLICATION_JSON,UTF8)));
+                    entityBuilder.addTextBody(
+                        REQUEST_PROPERTIES_URI.getUnicodeString(), 
object.toString(),
+                         ContentType.APPLICATION_JSON.withCharset(UTF8));
                 }
                 //(5) additional RDF metadata stored in contentParts
                 for(Entry<UriRef,TripleCollection> entry : getContentParts(ci, 
TripleCollection.class).entrySet()){
                     if(includeContentParts.isEmpty() || 
includeContentParts.contains(
                         entry.getKey())){
-                        entity.addBodyPart(new 
FormBodyPart(entry.getKey().getUnicodeString(), 
+                        
entityBuilder.addPart(entry.getKey().getUnicodeString(), 
                             new ClerezzaContentBody(null, //no file name
-                                entry.getValue(),rdfFormat)));
+                                entry.getValue(),rdfFormat));
                     } // else ignore this content part
                 }
             }
-            entity.writeTo(entityStream);
+            entityBuilder.build().writeTo(entityStream);
         }   
             
     }
@@ -430,20 +467,26 @@ public class ContentItemWriter implement
      */
     private class MultipartContentBody extends AbstractContentBody implements 
ContentBody,ContentDescriptor {
 
-        private HttpMultipart multipart;
-        private String name;
-
-        public MultipartContentBody(HttpMultipart multipart,String name){
-            super(String.format("multipart/%s; boundary=%s",
-                multipart.getSubType(), multipart.getBoundary()));
-            this.name = name;
-            this.multipart = multipart;
-        }
-        @Override
-        public String getCharset() {
-            return multipart.getCharset().toString();
-        }
+        private Map<String,ContentBody> parts;
+        private String boundary;
 
+        public MultipartContentBody(Map<String,ContentBody> parts, String 
boundary, ContentType contentType){
+            super(ContentType.create(contentType.getMimeType(), new 
BasicNameValuePair("boundary",boundary)));
+            this.parts = parts;
+            this.boundary = boundary;
+        }
+//        @Override
+//        public String getCharset() {
+//            return null; //no charset for multipart parts
+//        }
+//        @Override
+//        public String getMimeType() {
+//            String mime = new StringBuilder(super.getMimeType()).append("; 
boundary=")
+//                    .append(boundary).toString();
+//            log.info("!!! {}",mime);
+//            return mime;
+//            
+//        }
         @Override
         public String getTransferEncoding() {
             return MIME.ENC_8BIT;
@@ -451,17 +494,25 @@ public class ContentItemWriter implement
 
         @Override
         public long getContentLength() {
-            return multipart.getTotalLength();
+            //not known as we would need to count the content length AND
+            //the length of the different mime headers.
+            return -1;
         }
 
         @Override
         public String getFilename() {
-            return name;
+            return null;
         }
 
         @Override
         public void writeTo(OutputStream out) throws IOException {
-            multipart.writeTo(out);
+            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+            builder.setBoundary(boundary);
+            for(Entry<String,ContentBody> part : parts.entrySet()){
+                builder.addPart(part.getKey(), part.getValue());
+            }
+            HttpEntity entity = builder.build();
+            entity.writeTo(out);
         }
         
     }
@@ -477,7 +528,8 @@ public class ContentItemWriter implement
         private String name;
 
         protected ClerezzaContentBody(String name, TripleCollection graph, 
MediaType mimeType){
-            super(mimeType.getType()+'/'+mimeType.getSubtype());
+            super(ContentType.create(new StringBuilder(mimeType.getType())
+            .append('/').append(mimeType.getSubtype()).toString(), UTF8));
             charset = mimeType.getParameters().get("charset");
             if(charset == null || charset.isEmpty()){
                 charset = UTF8.toString();
@@ -511,43 +563,5 @@ public class ContentItemWriter implement
             getSerializer().serialize(out, graph, 
getMediaType()+'/'+getSubType());
         }
     }
-    private class BlobContentBody extends AbstractContentBody {
-        
-        private Blob blob;
-
-        public BlobContentBody(Blob blob) {
-            super(blob.getMimeType());
-            this.blob = blob;
-        }
-
-        @Override
-        public String getFilename() {
-            return null;
-        }
-
-        @Override
-        public void writeTo(OutputStream out) throws IOException {
-            InputStream in = blob.getStream();
-            IOUtils.copy(in, out);
-            IOUtils.closeQuietly(in);
-        }
-
-        @Override
-        public String getCharset() {
-            return blob.getParameter().get("charset");
-        }
-
-        @Override
-        public String getTransferEncoding() {
-            return blob.getParameter().get("charset") == null ?
-                    MIME.ENC_BINARY : MIME.ENC_8BIT;
-        }
-
-        @Override
-        public long getContentLength() {
-            return -1;
-        }
-        
-    }
     
 }

Modified: 
stanbol/branches/release-0.12/enhancer/jersey/src/test/java/org/apache/stanbol/enhancer/jersey/ContentItemReaderWriterTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jersey/src/test/java/org/apache/stanbol/enhancer/jersey/ContentItemReaderWriterTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/enhancer/jersey/src/test/java/org/apache/stanbol/enhancer/jersey/ContentItemReaderWriterTest.java
 (original)
+++ 
stanbol/branches/release-0.12/enhancer/jersey/src/test/java/org/apache/stanbol/enhancer/jersey/ContentItemReaderWriterTest.java
 Wed May 20 12:41:56 2015
@@ -56,8 +56,6 @@ import org.apache.clerezza.rdf.core.impl
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
-import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
 import org.apache.clerezza.rdf.ontologies.RDF;
 import org.apache.commons.io.IOUtils;
 import org.apache.stanbol.commons.web.base.writers.JsonLdSerializerProvider;
@@ -116,17 +114,14 @@ public class ContentItemReaderWriterTest
         NonLiteral ep = createExecutionPlan(em, "testChain",null);
         writeExecutionNode(em, ep, "testEngine", true, null,null);
         initExecutionMetadata(em, em, contentItem.getUri(), "testChain", 
false);
-        final Serializer serializer = new Serializer();
-        serializer.bindSerializingProvider(new JenaSerializerProvider());
-        serializer.bindSerializingProvider(new JsonLdSerializerProvider());
+        final Serializer serializer = Serializer.getInstance();
         ciWriter = new ContentItemWriter(null) {
             protected org.apache.clerezza.rdf.core.serializedform.Serializer 
getSerializer() {
                 return serializer;
             };
         };
 
-        final Parser parser = new Parser();
-        parser.bindParsingProvider(new JenaParserProvider());
+        final Parser parser = Parser.getInstance();
         ciReader = new ContentItemReader(null){
             @Override
             protected Parser getParser() {
@@ -160,41 +155,43 @@ public class ContentItemReaderWriterTest
         MediaType contentType = serializeContentItem(out);
         
assertTrue(MediaType.MULTIPART_FORM_DATA_TYPE.isCompatible(contentType));
         assertNotNull(contentType.getParameters().get("boundary"));
-        
assertEquals(contentType.getParameters().get("boundary"),"contentItem");
+        
assertEquals(contentType.getParameters().get("boundary"),ContentItemWriter.CONTENT_ITEM_BOUNDARY);
         assertNotNull(contentType.getParameters().get("charset"));
         assertEquals(contentType.getParameters().get("charset"),"UTF-8");
         //check the serialised multipart MIME
         String multipartMime = new 
String(out.toByteArray(),Charset.forName(contentType.getParameters().get("charset")));
         log.info("Multipart MIME content:\n{}\n",multipartMime);
         String[] tests = new String[]{
-            "--"+contentType.getParameters().get("boundary"),
+            "--"+ContentItemWriter.CONTENT_ITEM_BOUNDARY,
             "Content-Disposition: form-data; name=\"metadata\"; 
filename=\"urn:test\"",
             "Content-Type: application/rdf+xml; charset=UTF-8",
             "<rdf:type rdf:resource=\"urn:types:Document\"/>",
-            "--"+contentType.getParameters().get("boundary"),
+            "--"+ContentItemWriter.CONTENT_ITEM_BOUNDARY,
             "Content-Disposition: form-data; name=\"content\"",
-            "Content-Type: multipart/alternate; boundary=contentParts; 
charset=UTF-8",
-            "--contentParts",
+            "Content-Type: multipart/alternate; 
boundary="+ContentItemWriter.CONTENT_PARTS_BOUNDERY,
+            "--"+ContentItemWriter.CONTENT_PARTS_BOUNDERY,
             "Content-Disposition: form-data; name=\"urn:test_main\"",
             "Content-Type: text/html; charset=UTF-8",
             "This is a <b>ContentItem</b> to <i>Mime Multipart</i> test!",
-            "--contentParts",
+            "--"+ContentItemWriter.CONTENT_PARTS_BOUNDERY,
             "Content-Disposition: form-data; name=\"run:text:text\"",
             "Content-Type: text/plain; charset=UTF-8",
             "This is a ContentItem to Mime Multipart test!",
-            "--contentParts--",
-            "--"+contentType.getParameters().get("boundary"),
+            "--"+ContentItemWriter.CONTENT_PARTS_BOUNDERY+"--",
+            "--"+ContentItemWriter.CONTENT_ITEM_BOUNDARY,
             "Content-Disposition: form-data; 
name=\""+REQUEST_PROPERTIES_URI.getUnicodeString()+"\"",
             "Content-Type: application/json; charset=UTF-8",
-            "--"+contentType.getParameters().get("boundary"),
+            "--"+ContentItemWriter.CONTENT_ITEM_BOUNDARY,
             "Content-Disposition: form-data; 
name=\""+CHAIN_EXECUTION.getUnicodeString()+"\"",
             "Content-Type: application/rdf+xml; charset=UTF-8",
             "<rdf:type 
rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionNode\"/>",
-            "--"+contentType.getParameters().get("boundary")+"--"
+            "--"+ContentItemWriter.CONTENT_ITEM_BOUNDARY+"--"
         };
+        log.debug("> Validate Multipart Mime:");
         for(String test : tests){
             int index = multipartMime.indexOf(test);
-            assertTrue(index >=0);
+            assertTrue("Unable to find: '"+test+"' in multipart mime!",index 
>=0);
+            log.debug(" - found '{}'",test);
             multipartMime = multipartMime.substring(index);
         }
     }

Added: 
stanbol/branches/release-0.12/enhancer/jersey/src/test/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jersey/src/test/resources/log4j.properties?rev=1680546&view=auto
==============================================================================
--- 
stanbol/branches/release-0.12/enhancer/jersey/src/test/resources/log4j.properties
 (added)
+++ 
stanbol/branches/release-0.12/enhancer/jersey/src/test/resources/log4j.properties
 Wed May 20 12:41:56 2015
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Root logger option
+log4j.rootLogger=INFO, stdout
+ 
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+log4j.logger.org.apache.stanbol.enhancer.jersey=DEBUG
\ No newline at end of file

Modified: stanbol/branches/release-0.12/enhancer/jobmanager/event/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/enhancer/jobmanager/event/pom.xml?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- stanbol/branches/release-0.12/enhancer/jobmanager/event/pom.xml (original)
+++ stanbol/branches/release-0.12/enhancer/jobmanager/event/pom.xml Wed May 20 
12:41:56 2015
@@ -93,6 +93,11 @@
       <artifactId>commons-collections</artifactId>
     </dependency>
 
+    <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
+
     <!-- for tests -->
     <dependency>
       <groupId>junit</groupId>

Modified: 
stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java
 (original)
+++ 
stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java
 Wed May 20 12:41:56 2015
@@ -45,7 +45,7 @@ import org.apache.stanbol.entityhub.jers
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
 
-@Component(immediate = true, metatype = true)
+@Component(immediate = true)
 @Service
 public class EntityhubWebFragment implements WebFragment {
     

Modified: 
stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java
 (original)
+++ 
stanbol/branches/release-0.12/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java
 Wed May 20 12:41:56 2015
@@ -257,12 +257,14 @@ public class RepresentationReader implem
                     Response.status(Status.INTERNAL_SERVER_ERROR).
                     entity(message).
                     header(HttpHeaders.ACCEPT, acceptedMediaType).build());
-            } catch (Exception e){
-                String message = "Unable to create the Parser for the 
supported format "
-                    +content.getMediaType()+" ("+e+")";
+            } catch (RuntimeException e){
+                //NOTE: Clerezza seams not to provide specific exceptions on
+                //      parsing errors. Hence the catch for all 
RuntimeException
+                String message = "Unable to parse the provided RDF data 
(format: "
+                    +content.getMediaType()+", message: "+e.getMessage()+")";
                 log.error(message,e);
                 throw new WebApplicationException(
-                    Response.status(Status.INTERNAL_SERVER_ERROR).
+                    Response.status(Status.BAD_REQUEST).
                     entity(message).
                     header(HttpHeaders.ACCEPT, acceptedMediaType).build());
                 

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancementPropertiesTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancementPropertiesTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancementPropertiesTest.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancementPropertiesTest.java
 Wed May 20 12:41:56 2015
@@ -69,11 +69,11 @@ public class EnhancementPropertiesTest e
                 
"http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Paris";,
                 
"http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Bob_Marley";,
                 //the Arabic and Russian label of paris
-                
"http://www.w3.org/2000/01/rdf-schema#label.*\"\\\\u0628\\\\u0627\\\\u0631\\\\u064A\\\\u0633\"@ar";,
-                
"http://www.w3.org/2000/01/rdf-schema#label.*\"\\\\u041F\\\\u0430\\\\u0440\\\\u0438\\\\u0436\"@ru";,
+                
"http://www.w3.org/2000/01/rdf-schema#label.*\"باريس\"@ar";,
+                
"http://www.w3.org/2000/01/rdf-schema#label.*\"Париж\"@ru";,
                 //the Arabic and Russian label of Bob Marley
-                
"http://www.w3.org/2000/01/rdf-schema#label.*\"\\\\u0628\\\\u0648\\\\u0628 
\\\\u0645\\\\u0627\\\\u0631\\\\u0644\\\\u064A\"@ar",
-                
"http://www.w3.org/2000/01/rdf-schema#label.*\"\\\\u041C\\\\u0430\\\\u0440\\\\u043B\\\\u0438,
 \\\\u0411\\\\u043E\\\\u0431\"@ru",
+                "http://www.w3.org/2000/01/rdf-schema#label.*\"بوب م
ارلي\"@ar",
+                "http://www.w3.org/2000/01/rdf-schema#label.*\"Марли, 
Боб\"@ru",
                  //foaf:depiction triples for Paris and Bob_Marley
                 
"http://dbpedia.org/resource/Paris.*http://xmlns.com/foaf/0.1/depiction.*http://upload.wikimedia.org/wikipedia/.*";,
                 
"http://dbpedia.org/resource/Bob_Marley.*http://xmlns.com/foaf/0.1/depiction.*http://upload.wikimedia.org/wikipedia/.*";

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java
 Wed May 20 12:41:56 2015
@@ -51,19 +51,16 @@ import org.apache.clerezza.rdf.core.seri
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 import org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;
 import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
-import org.apache.clerezza.rdf.rdfjson.parser.RdfJsonParsingProvider;
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
 import 
org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.PoolingClientConnectionManager;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.CoreConnectionPNames;
-import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.config.SocketConfig;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
 import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
 import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
@@ -135,9 +132,8 @@ public abstract class MultiThreadedTestB
     public static final String DEFAULT_TEST_DATA_PROPERTY = 
"http://dbpedia.org/ontology/abstract";;
     private static final String[] ENABLE_EXECUTION_METADATA = new 
String[]{"executionmetadata","true"};
     protected static Parser rdfParser;
-    protected DefaultHttpClient pooledHttpClient;
-    private BasicHttpParams httpParams;
-    private PoolingClientConnectionManager connectionManager;
+    protected CloseableHttpClient pooledHttpClient;
+    private PoolingHttpClientConnectionManager connectionManager;
     
     private NamespacePrefixService nsPrefixService;
     
@@ -160,9 +156,7 @@ public abstract class MultiThreadedTestB
     @BeforeClass
     public static void init() throws IOException {
         //init the RDF parser
-        rdfParser = new Parser();
-        rdfParser.bindParsingProvider(new JenaParserProvider());
-        rdfParser.bindParsingProvider(new RdfJsonParsingProvider());
+        rdfParser = Parser.getInstance();
         //init theTestData
     }
 
@@ -346,17 +340,22 @@ public abstract class MultiThreadedTestB
     @Before
     public void initialiseHttpClient() {
         if(this.pooledHttpClient == null){ //init for the first test
-            httpParams = new BasicHttpParams();
-            httpParams.setParameter(CoreProtocolPNames.USER_AGENT, "Stanbol 
Integration Test");
-            httpParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS,true);
-            httpParams.setIntParameter(ClientPNames.MAX_REDIRECTS,3);
-            
httpParams.setBooleanParameter(CoreConnectionPNames.SO_KEEPALIVE,true);
-    
-            connectionManager = new PoolingClientConnectionManager();
+            RequestConfig requestConfig = RequestConfig.custom()
+                    .setRedirectsEnabled(true)
+                    .setMaxRedirects(3).build();
+            SocketConfig socketConfig = SocketConfig.custom()
+                    .setSoKeepAlive(true).build();
+            
+            connectionManager = new PoolingHttpClientConnectionManager();
+            connectionManager.setDefaultSocketConfig(socketConfig);
             connectionManager.setMaxTotal(20);
             connectionManager.setDefaultMaxPerRoute(20);
     
-            pooledHttpClient = new 
DefaultHttpClient(connectionManager,httpParams);
+            pooledHttpClient = HttpClientBuilder.create()
+                    .setUserAgent("Stanbol Integration Test")
+                    .setConnectionManager(connectionManager)
+                    .setDefaultRequestConfig(requestConfig)
+                    .build();
         }
     }
 
@@ -414,10 +413,15 @@ public abstract class MultiThreadedTestB
     @After
     public final void close() {
         setEndpoint(null,ENABLE_EXECUTION_METADATA); //reset the endpoint to 
the default
-        httpParams = null;
+        try {
+            pooledHttpClient.close();
+        } catch (IOException e) {
+            log.info("Unable to close HttpClient",e);
+        }
         pooledHttpClient = null;
         connectionManager.shutdown();
         connectionManager = null;
+        
     }
 
     public static class TestSettings {

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java
 Wed May 20 12:41:56 2015
@@ -26,6 +26,9 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.charset.Charset;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.clerezza.rdf.core.BNode;
 import org.apache.clerezza.rdf.core.MGraph;
@@ -36,16 +39,16 @@ import org.apache.clerezza.rdf.core.impl
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
 import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.http.entity.mime.FormBodyPart;
-import org.apache.http.entity.mime.HttpMultipart;
+import org.apache.http.HttpEntity;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.mime.MIME;
-import org.apache.http.entity.mime.MultipartEntity;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.AbstractContentBody;
 import org.apache.http.entity.mime.content.ContentBody;
 import org.apache.http.entity.mime.content.ContentDescriptor;
 import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.message.BasicNameValuePair;
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
 import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
 import org.apache.stanbol.enhancer.servicesapi.helper.EnhancementEngineHelper;
@@ -63,11 +66,7 @@ import org.slf4j.LoggerFactory;
  */
 public class MultipartRequestTest extends EnhancerTestBase {
     private static final Charset UTF8 = Charset.forName("UTF-8");
-    private static Serializer serializer = new Serializer();
-    static {
-        serializer.bindSerializingProvider(new JenaSerializerProvider());
-    }
-
+    private static Serializer serializer = Serializer.getInstance();
     
     private static final Logger log = 
LoggerFactory.getLogger(MultipartRequestTest.class);
 
@@ -167,19 +166,19 @@ public class MultipartRequestTest extend
         .assertStatus(200)
         .assertContentContains(
             "--contentItem",
-            "--contentItem--",
             "Content-Disposition: form-data; name=\"content\"",
-            "Content-Type: multipart/alternate; boundary=contentParts; 
charset=UTF-8",
+            "Content-Type: multipart/alternate; boundary=contentParts-",
             "Content-Type: text/plain; charset=UTF-8",
             "Content-Type: text/html",
-            "--contentParts",
-            "--contentParts--")
+            "--contentParts")
         .assertContentContains(TEXT_CONTENT_LINES)
         .assertContentContains(HTML_CONTENT_LINES) //line by line the HTML 
content
         .assertContentRegexp(
             "Content-Disposition: form-data; name=\"metadata\"; filename=.*",
             "Content-Disposition: form-data; name=\"urn:tika:text:.*",
             "Content-Disposition: form-data; name=\"urn:content-item-sha1-.*",
+            "--contentItem-.*--",
+            "--contentParts-.*--",
             //and the expected enhancements in the metadata
             
"http://purl.org/dc/terms/creator.*LanguageDetectionEnhancementEngine";,
             "http://purl.org/dc/terms/language.*en";,
@@ -205,16 +204,16 @@ public class MultipartRequestTest extend
         .assertStatus(200)
         .assertContentContains(
             "--contentItem",
-            "--contentItem--",
             "Content-Disposition: form-data; name=\"content\"",
-            "Content-Type: multipart/alternate; boundary=contentParts; 
charset=UTF-8",
+            "Content-Type: multipart/alternate; boundary=contentParts-",
             "Content-Type: text/plain; charset=UTF-8",
             "Content-Type: text/html",
-            "--contentParts",
-            "--contentParts--")
+            "--contentParts")
         .assertContentContains(TEXT_CONTENT_LINES)
         .assertContentContains(HTML_CONTENT_LINES) //line by line the HTML 
content
         .assertContentRegexp( //MUST contain
+            "--contentItem-.*--",
+            "--contentParts-.*--",
             "Content-Disposition: form-data; name=\"urn:tika:text:.*",
             "Content-Disposition: form-data; name=\"urn:content-item-sha1-.*")
         .assertContentRegexp(false, //MUST NOT contain
@@ -244,14 +243,14 @@ public class MultipartRequestTest extend
         .assertStatus(200)
         .assertContentContains(
             "--contentItem",
-            "--contentItem--",
             "Content-Disposition: form-data; name=\"content\"",
-            "Content-Type: multipart/alternate; boundary=contentParts; 
charset=UTF-8",
+            "Content-Type: multipart/alternate; boundary=contentParts-",
             "Content-Type: text/plain; charset=UTF-8",
-            "--contentParts",
-            "--contentParts--")
+            "--contentParts")
         .assertContentContains(TEXT_CONTENT_LINES)
         .assertContentRegexp(
+            "--contentItem-.*--",
+            "--contentParts-.*--",
             "Content-Disposition: form-data; name=\"metadata\"; filename=.*",
             "Content-Disposition: form-data; name=\"urn:tika:text:.*",
             //and the expected enhancements in the metadata
@@ -280,14 +279,14 @@ public class MultipartRequestTest extend
         .assertStatus(200)
         .assertContentContains(
              "--contentItem",
-             "--contentItem--",
              "Content-Disposition: form-data; name=\"content\"",
-             "Content-Type: multipart/alternate; boundary=contentParts; 
charset=UTF-8",
+             "Content-Type: multipart/alternate; boundary=contentParts-",
              "Content-Type: text/plain; charset=UTF-8",
-             "--contentParts",
-             "--contentParts--")
+             "--contentParts")
          .assertContentContains(TEXT_CONTENT_LINES)
          .assertContentRegexp(
+             "--contentItem-.*--",
+             "--contentParts-.*--",
              "Content-Disposition: form-data; name=\"metadata\"; filename=.*",
              "Content-Disposition: form-data; name=\"urn:tika:text:.*",
              //and the expected enhancements in the metadata
@@ -314,14 +313,14 @@ public class MultipartRequestTest extend
         .assertStatus(200)
         .assertContentContains(
              "--contentItem",
-             "--contentItem--",
              "Content-Disposition: form-data; 
name=\"http://stanbol.apache.org/ontology/enhancer/executionmetadata#ChainExecution\"";,
              "Content-Type: application/rdf+xml; charset=UTF-8",
              "<rdf:type 
rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionPlan\"/>",
              "<rdf:type 
rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionNode\"/>",
              "<rdf:type 
rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionmetadata#EngineExecution\"/>",
              "<rdf:type 
rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionmetadata#ChainExecution\"/>")
-         .getContent();
+        .assertContentRegexp("--contentItem-.*--")
+        .getContent();
         log.debug("Content:\n{}\n",content);
     }
     /**
@@ -341,29 +340,24 @@ public class MultipartRequestTest extend
         //It is a secret, that Berlin is the capital of Germany
         String extraTextConent = TEXT_CONTENT + 
                 "\nIt is a secret, that the city of Berlin is the capital of 
Germany since 1990.";
-        
-        //The multipart entity for the contentItem
-        MultipartEntity contentItem = new MultipartEntity(null, null ,UTF8);
-        //The multipart/alternate mime part for the parsed content versions
-        HttpMultipart content = new HttpMultipart("alternate", UTF8 
,"contentParts");
-        //add the content part to the contentItem
-        contentItem.addPart(
-            "content", //the name MUST BE "content"
-            new MultipartContentBody(content));
-        //now add the content (ordering is important, because the first
-        //part will be assumed the original document and all following are
-        //assumed alternate - transformed - versions
-        content.addBodyPart(new FormBodyPart(
-            "http://www.example.com/test.html";, //the id of the content
-            new StringBody(HTML_CONTENT, "text/html", UTF8)));
-        content.addBodyPart(new FormBodyPart(
-            "http://www.example.com/test.txt";,
-            new StringBody(extraTextConent, "text/plain", UTF8)));
+        //The multipartBuilder used to construct the contentItem for the 
contentItem
+        MultipartEntityBuilder ciBuilder = MultipartEntityBuilder.create();
+        String boundary = "contentItem-47jjksnbue73fnis";
+        ciBuilder.setBoundary(boundary);
+        //use a small extension to deal with multipart/alternate
+        Map<String, ContentBody> alternates = new 
LinkedHashMap<String,ContentBody>();
+        alternates.put("http://www.example.com/test.html";, 
+            new StringBody(HTML_CONTENT, 
ContentType.TEXT_HTML.withCharset(UTF8)));
+        alternates.put("http://www.example.com/test.txt";, 
+            new StringBody(extraTextConent, 
ContentType.TEXT_PLAIN.withCharset(UTF8)));
+        ciBuilder.addPart("content", 
+            new MultipartContentBody(alternates, "contentParts", 
+                ContentType.create("multipart/alternate")));
         
         String receivedContent = executor.execute(
             builder.buildPostRequest(getEndpoint())
             .withHeader("Accept","text/rdf+nt")
-            .withEntity(contentItem)
+            .withEntity(ciBuilder.build())
         )
         .assertStatus(200)
         .assertContentRegexp(
@@ -387,20 +381,13 @@ public class MultipartRequestTest extend
         final UriRef contentItemId = new 
UriRef("http://www.example.com/test.html";);
         String rdfContentType = SupportedFormat.RDF_XML;
         String rdfContent = getDummyRdfMetadata(contentItemId, rdfContentType);
-        MultipartEntity contentItem = new MultipartEntity(null, null ,UTF8);
-        //first the content -> illegal
-        contentItem.addPart(
-            "content", //the name MUST BE "content"
-            new StringBody(HTML_CONTENT,"text/html",UTF8));
-        //after that the metadata
-        contentItem.addPart(
-            "metadata", //the name MUST BE "metadata" 
-            new StringBody(rdfContent,rdfContentType,UTF8));
-
+        MultipartEntityBuilder ciBuilder = MultipartEntityBuilder.create();
+        
ciBuilder.addTextBody("content",HTML_CONTENT,ContentType.TEXT_HTML.withCharset(UTF8));
+        ciBuilder.addTextBody("metadata", rdfContent, 
ContentType.create(rdfContentType,UTF8));
         String receivedContent = executor.execute(
             builder.buildPostRequest(getEndpoint())
             .withHeader("Accept","text/rdf+nt")
-            .withEntity(contentItem)
+            .withEntity(ciBuilder.build())
         )
         .assertStatus(400) //BAD request
         .getContent();
@@ -414,16 +401,13 @@ public class MultipartRequestTest extend
         final UriRef contentItemId = new 
UriRef("http://www.example.com/test.html";);
         String rdfContentType = SupportedFormat.RDF_XML;
         String rdfContent = getDummyRdfMetadata(contentItemId, rdfContentType);
-        MultipartEntity contentItem = new MultipartEntity(null, null ,UTF8);
-        //after that the metadata
-        contentItem.addPart(
-            "metadata", //the name MUST BE "metadata" 
-            new StringBody(rdfContent,rdfContentType,UTF8));
+        MultipartEntityBuilder ciBuilder = MultipartEntityBuilder.create();
+        ciBuilder.addTextBody("metadata", rdfContent, 
ContentType.create(rdfContentType,UTF8));
 
         String receivedContent = executor.execute(
             builder.buildPostRequest(getEndpoint())
             .withHeader("Accept","text/rdf+nt")
-            .withEntity(contentItem)
+            .withEntity(ciBuilder.build())
         )
         .assertStatus(400) //BAD request
         .getContent();
@@ -467,13 +451,14 @@ public class MultipartRequestTest extend
         addTagAsTextAnnotation(metadata, contentItemId, 
             "Silvio Berlusconi",DBPEDIA_PERSON, user);
         
+        String rdfContentType = SupportedFormat.RDF_XML;
+        
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        serializer.serialize(out, metadata, SupportedFormat.RDF_XML);
+        serializer.serialize(out, metadata, rdfContentType);
         String rdfContent = new String(out.toByteArray(),UTF8);
         
-        //The multipart entity for the contentItem
-        MultipartEntity contentItem = new MultipartEntity(null, null ,UTF8);
-        //the "metadata" MUST BE the first element
+        MultipartEntityBuilder ciBuilder = MultipartEntityBuilder.create();
+        //add the metadata
         /*
          * NOTE: We need here to override the getFilename, because this MUST
          *       BE the URI of the ContentItem. This is important, because the
@@ -482,29 +467,20 @@ public class MultipartRequestTest extend
          *       the Stanbol Enhancer is the same of as the URI used in the
          *       Metadata!
          */
-        contentItem.addPart(
-            "metadata", //the name MUST BE "metadata" 
-            new StringBody(rdfContent,SupportedFormat.RDF_XML,UTF8){
-                @Override
-                public String getFilename() { //The filename MUST BE the
-                    return contentItemId.getUnicodeString(); //uri of the 
ContentItem
-                }
-            });
-        //Add the Content
-        /*
-         * NOTE: If we only parse a single content than we can also directly
-         *       add it with the name "content". This means that the useage of
-         *       a "multipart/alternate" container is in such cases optional.
-         */
-        contentItem.addPart(
-            "content", //the name MUST BE "content"
-            new StringBody(HTML_CONTENT,"text/html",UTF8));
-        
+        ciBuilder.addPart("metadata", 
+            new StringBody(rdfContent, 
ContentType.create(rdfContentType).withCharset(UTF8)){
+            @Override
+            public String getFilename() { //The filename MUST BE the
+                return contentItemId.getUnicodeString(); //uri of the 
ContentItem
+            }
+        });
+        //add the content
+        ciBuilder.addTextBody("content", HTML_CONTENT, 
ContentType.TEXT_HTML.withCharset(UTF8));        
         //send the request
         String receivedContent = executor.execute(
             builder.buildPostRequest(getEndpoint())
             .withHeader("Accept","text/rdf+nt")
-            .withEntity(contentItem)
+            .withEntity(ciBuilder.build())
         )
         .assertStatus(200)
         .assertContentRegexp(
@@ -555,25 +531,28 @@ public class MultipartRequestTest extend
     }    
     /**
      * Supports sending multipart mime as {@link ContentBody}.
-     * TODO: maybe move such utilities to an own Multipart ContentItem
-     * utility module
      * @author Rupert Westenthaler
      *
      */
-    private static class MultipartContentBody extends AbstractContentBody 
implements ContentBody,ContentDescriptor {
+    private class MultipartContentBody extends AbstractContentBody implements 
ContentBody,ContentDescriptor {
 
-        private HttpMultipart multipart;
+        private Map<String,ContentBody> parts;
+        private String boundary;
 
-        public MultipartContentBody(HttpMultipart multipart){
-            super(String.format("multipart/%s; boundary=%s",
-                multipart.getSubType(), multipart.getBoundary()));
-            this.multipart = multipart;
+        public MultipartContentBody(Map<String,ContentBody> parts, String 
boundary, ContentType contentType){
+            super(ContentType.create(contentType.getMimeType(), new 
BasicNameValuePair("boundary",boundary)));
+            this.parts = parts;
+            this.boundary = boundary;
         }
-        @Override
-        public String getCharset() {
-            return multipart.getCharset().toString();
-        }
-
+//        @Override
+//        public String getCharset() {
+//            return UTF8.toString(); //no charset for multipart parts
+//        }
+//        @Override
+//        public String getMimeType() {
+//            return new StringBuilder(super.getMimeType()).append("; 
boundary=")
+//                    .append(boundary).toString();
+//        }
         @Override
         public String getTransferEncoding() {
             return MIME.ENC_8BIT;
@@ -581,7 +560,9 @@ public class MultipartRequestTest extend
 
         @Override
         public long getContentLength() {
-            return multipart.getTotalLength();
+            //not known as we would need to count the content length AND
+            //the length of the different mime headers.
+            return -1; 
         }
 
         @Override
@@ -591,7 +572,13 @@ public class MultipartRequestTest extend
 
         @Override
         public void writeTo(OutputStream out) throws IOException {
-            multipart.writeTo(out);
+            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
+            builder.setBoundary(boundary);
+            for(Entry<String,ContentBody> part : parts.entrySet()){
+                builder.addPart(part.getKey(), part.getValue());
+            }
+            HttpEntity entity = builder.build();
+            entity.writeTo(out);
         }
         
     }

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
 Wed May 20 12:41:56 2015
@@ -248,16 +248,23 @@ public final class EntityhubTest extends
         }
         Assert.assertNotNull(f.isFile());
         ZipFile archive = new ZipFile(f);
-        for(Enumeration<? extends ZipEntry> e = 
archive.entries();e.hasMoreElements();){
-            ZipEntry entry = e.nextElement();
-            RequestExecutor re = executor.execute(
-                buildImportRdfData(archive.getInputStream(entry) ,RDF_XML, 
false, null));
-            //assert that the entity was created (or already existed)
-            //some projects seams to have more than a single doap file
-            int status = re.getResponse().getStatusLine().getStatusCode();
-            Assert.assertTrue(status == 200 || status == 304);
+        try {
+            for(Enumeration<? extends ZipEntry> e = 
archive.entries();e.hasMoreElements();){
+                ZipEntry entry = e.nextElement();
+                if(!entry.isDirectory()) {
+                    log.debug(" - uploading {} to entityhub",entry);
+                    RequestExecutor re = executor.execute(
+                        buildImportRdfData(archive.getInputStream(entry) 
,RDF_XML, false, null));
+                    //assert that the entity was created (or already existed)
+                    //some projects seams to have more than a single doap file
+                    int status = 
re.getResponse().getStatusLine().getStatusCode();
+                    Assert.assertTrue("Unable to add '"+entry.getName()+"'! 
Status:" 
+                            + re.getResponse().getStatusLine(), status == 200 
|| status == 304);
+                }
+            }
+        } finally {
+            archive.close();
         }
-        
         testFindNameQuery();
         testFindWildcards();
         testFindLimitAndOffsetQuery();

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java
 Wed May 20 12:41:56 2015
@@ -215,8 +215,9 @@ public class DbpediaLDPathTest extends E
          .assertContentType("text/turtle")
          .assertContentContains(
              "<http://stanbol.apache.org/ontology/entityhub/query#score>",
-             "<http://dbpedia.org/resource/Vienna>",
-             "<name_de> \"Wien\"@de .");
+             "<http://dbpedia.org/resource/Vienna>")
+         .assertContentRegexp(
+             "<name_de>\\s+\"Wien\"@de .");
     }
     @Test
     public void testFindLDPathOnMultipleResults() throws IOException {
@@ -261,7 +262,7 @@ public class DbpediaLDPathTest extends E
          .assertContentType("text/turtle")
          .assertContentRegexp(
              "<http://stanbol.apache.org/ontology/entityhub/query#score>",
-             "<name>  \"Spider\"@en ;",
+             "<name>\\s+\"Spider\"@en ;",
              "<category>.*<http://dbpedia.org/resource/Category:Arachnids>",
              "<category>.*<http://dbpedia.org/resource/Category:Spiders>",
              "<others>.*<http://dbpedia.org/resource/Opiliones>",
@@ -366,13 +367,13 @@ public class DbpediaLDPathTest extends E
             "<http://dbpedia.org/resource/Koblenz>",
             "<http://dbpedia.org/resource/Cologne>",
             //now some values based on the LDPath
-            "<name>  \"Koblenz\"@en",
-            "<lat>   \"50.359722\"",
-            "<long>  \"7.597778\"",
+            "<name>\\s+\"Koblenz\"@en",
+            "<lat>\\s+\"50.359722\"",
+            "<long>\\s+\"7.597778\"",
             "<type>.*<http://www.w3.org/2002/07/owl#Thing>",
             "<type>.*<http://www.opengis.net/gml/_Feature>",
             "<type>.*<http://dbpedia.org/ontology/Town>",
-            "<population> 314926");
+            "<population>\\s+314926");
     }
     
     

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/DefaultConfigTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/DefaultConfigTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/DefaultConfigTest.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/DefaultConfigTest.java
 Wed May 20 12:41:56 2015
@@ -22,6 +22,11 @@ import org.junit.Test;
 /** Verify that the example config of STANBOL-110 is present */ 
 public class DefaultConfigTest extends StanbolTestBase {
     
+    @Override
+    protected String getCredentials() {
+        return "admin:admin";
+    }
+
     @Test
     public void testDefaultConfig() throws Exception {
         // AFAIK there's no way to get the config in machine
@@ -30,7 +35,6 @@ public class DefaultConfigTest extends S
         final String path = 
"/system/console/config/configuration-status-20110304-1743+0100.txt";
         executor.execute(
                 builder.buildGetRequest(path)
-                .withCredentials("admin", "admin")
         )
         .assertStatus(200)
         .assertContentRegexp(

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
 (original)
+++ 
stanbol/branches/release-0.12/integration-tests/src/test/java/org/apache/stanbol/it/OsgiConsoleTest.java
 Wed May 20 12:41:56 2015
@@ -22,6 +22,12 @@ import org.junit.Test;
 /** Test access to the OSGi console */
 public class OsgiConsoleTest extends StanbolTestBase {
     
+    
+    @Override
+    protected String getCredentials() {
+        return "admin:admin";
+    }
+    
     @Test
     public void testDefaultConsolePaths() throws Exception {
         final String [] subpaths = {
@@ -45,7 +51,6 @@ public class OsgiConsoleTest extends Sta
             final String path = "/system/console/" + subpath;
             executor.execute(
                     builder.buildGetRequest(path)
-                    .withCredentials("admin", "admin")
             ).assertStatus(200);
         }
     }

Modified: 
stanbol/branches/release-0.12/integration-tests/src/test/resources/apache-project-doap-files.zip
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/integration-tests/src/test/resources/apache-project-doap-files.zip?rev=1680546&r1=1680545&r2=1680546&view=diff
==============================================================================
Binary files - no diff available.


Reply via email to