Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightdisambiguate/core/DBPSpotlightDisambiguateEnhancementTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightdisambiguate/core/DBPSpotlightDisambiguateEnhancementTest.java?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightdisambiguate/core/DBPSpotlightDisambiguateEnhancementTest.java
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightdisambiguate/core/DBPSpotlightDisambiguateEnhancementTest.java
 Mon Aug 20 13:48:31 2012
@@ -29,41 +29,47 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * This class provides a JUnit test for DBpedia Spotlight Annotate 
EnhancementEngine.
+ * This class provides a JUnit test for DBpedia Spotlight Annotate
+ * EnhancementEngine.
+ * 
  * @author Iavor Jelev, babelmonkeys / GzEvD
  */
 public class DBPSpotlightDisambiguateEnhancementTest {
 
-         /**
-          * This contains the logger.
-          */
-         private static final Logger LOG  = 
LoggerFactory.getLogger(DBPSpotlightDisambiguateEnhancementTest.class);
-         private static String SPL_URL    = 
System.getProperty(DBPSpotlightDisambiguateEnhancementEngine.SL_URL_KEY) == 
null ? 
-                                                                               
                                "http://spotlight.dbpedia.org/rest/annotate"; : 
(String) 
System.getProperty(DBPSpotlightDisambiguateEnhancementEngine.SL_URL_KEY);
-         private static String TEST_TEXT  = "President Obama is meeting Angela 
Merkel in Berlin on Monday.";
-         private static DBPSpotlightDisambiguateEnhancementEngine dbpslight;
-         private static String testFile   = "spots.xml";
-         private static String spotsXml;
-         
-         @BeforeClass
-         public static void oneTimeSetup() throws ConfigurationException {
-        dbpslight       = new DBPSpotlightDisambiguateEnhancementEngine();
-       dbpslight.setEndpointUrl( SPL_URL );
-         }
+       /**
+        * This contains the logger.
+        */
+       private static final Logger LOG = LoggerFactory
+                       
.getLogger(DBPSpotlightDisambiguateEnhancementTest.class);
+       private static String SPL_URL = System
+                       
.getProperty(DBPSpotlightDisambiguateEnhancementEngine.SL_URL_KEY) == null ? 
"http://spotlight.dbpedia.org/rest/annotate";
+                       : (String) System
+                                       
.getProperty(DBPSpotlightDisambiguateEnhancementEngine.SL_URL_KEY);
+       private static String TEST_TEXT = "President Obama is meeting Angela 
Merkel in Berlin on Monday.";
+       private static DBPSpotlightDisambiguateEnhancementEngine dbpslight;
+       private static String testFile = "spots.xml";
+       private static String spotsXml;
 
-         
-         @Test
-         public void testEntityExtraction() {
-           Collection<DBPSLAnnotation> entities;
+       @BeforeClass
+       public static void oneTimeSetup() throws ConfigurationException {
+               dbpslight = new DBPSpotlightDisambiguateEnhancementEngine();
+               dbpslight.setEndpointUrl(SPL_URL);
+       }
+
+       @Test
+       public void testEntityExtraction() {
+               Collection<DBPSLAnnotation> entities;
                try {
-            spotsXml = IOUtils.toString( 
this.getClass().getClassLoader().getResourceAsStream( testFile ) );
-            System.out.println( SPL_URL );
-                       entities = dbpslight.doPostRequest( TEST_TEXT, spotsXml 
);
-                   LOG.info("Found entities: {}",entities.size());
-                   LOG.debug("Entities:\n{}",entities);
-                   Assert.assertFalse("No entities were found!", 
entities.isEmpty());
+                       spotsXml = 
IOUtils.toString(this.getClass().getClassLoader()
+                                       .getResourceAsStream(testFile));
+                       System.out.println(SPL_URL);
+                       entities = dbpslight.doPostRequest(TEST_TEXT, spotsXml);
+                       LOG.info("Found entities: {}", entities.size());
+                       LOG.debug("Entities:\n{}", entities);
+                       Assert.assertFalse("No entities were found!", 
entities.isEmpty());
                } catch (Exception e) {
-                   Assert.assertFalse("An EngineException occurred! The 
message was: " + e.getMessage(), true);
+                       Assert.assertFalse("An EngineException occurred! The 
message was: "
+                                       + e.getMessage(), true);
                }
-         }
+       }
 }

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/resources/spots.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/resources/spots.xml?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/resources/spots.xml
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightdisambiguate/src/test/resources/spots.xml
 Mon Aug 20 13:48:31 2012
@@ -1,7 +1,8 @@
-<annotation text="President Obama is meeting Angela Merkel in Berlin on 
Monday.">
-  <surfaceForm name="President Obama" offset="0"/>
-  <surfaceForm name="meeting" offset="19"/>
-  <surfaceForm name="Angela Merkel" offset="27"/>
-  <surfaceForm name="Berlin" offset="44"/>
-  <surfaceForm name="Monday" offset="54"/>
+<annotation
+       text="President Obama is meeting Angela Merkel in Berlin on Monday.">
+       <surfaceForm name="President Obama" offset="0" />
+       <surfaceForm name="meeting" offset="19" />
+       <surfaceForm name="Angela Merkel" offset="27" />
+       <surfaceForm name="Berlin" offset="44" />
+       <surfaceForm name="Monday" offset="54" />
 </annotation>
\ No newline at end of file

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/pom.xml?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/pom.xml
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/pom.xml
 Mon Aug 20 13:48:31 2012
@@ -1,121 +1,109 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-   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.
--->
+<!-- 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. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
 
-  <modelVersion>4.0.0</modelVersion>
+       <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <artifactId>org.apache.stanbol.enhancer.parent</artifactId>
-    <groupId>org.apache.stanbol</groupId>
-    <version>0.9.0-incubating</version>
-    <relativePath>../../parent</relativePath>
-  </parent>
-
-  <groupId>org.apache.stanbol</groupId>
-  <artifactId>org.apache.stanbol.enhancer.engines.dbpspotlightspot</artifactId>
-  <packaging>bundle</packaging>
-
-  <name>Apache Stanbol Enhancer Enhancement Engine : DBPedia Spotlight 
Spot</name>
-  <description>an enhancement engine for spotting</description>
-
-  <inceptionYear>2010</inceptionYear>
-
-  <!--scm>
-    <connection>
-      
scm:svn:http://svn.apache.org/repos/asf/incubator/stanbol/tags/0.9.0-incubating/enhancer/engines/langid/
-    </connection>
-    <developerConnection>
-      
scm:svn:https://svn.apache.org/repos/asf/incubator/stanbol/tags/0.9.0-incubating/enhancer/engines/langid/
-    </developerConnection>
-    <url>http://incubator.apache.org/stanbol/</url>
-  </scm-->
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Export-Package>
-              
org.apache.stanbol.enhancer.engines.dbpspotlightspot;version=${project.version}
-            </Export-Package>
-            <Embed-Dependency>
-            </Embed-Dependency>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-scr-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <!-- AL20 licensed files: See src/test/resources/README -->
-            <exclude>src/test/resources/en.txt</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.tika</groupId>
-      <artifactId>tika-core</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.scr.annotations</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.clerezza</groupId>
-      <artifactId>rdf.core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+       <parent>
+               <artifactId>org.apache.stanbol.enhancer.parent</artifactId>
+               <groupId>org.apache.stanbol</groupId>
+               <version>0.9.0-incubating</version>
+               <relativePath>../../parent</relativePath>
+       </parent>
+
+       <groupId>org.apache.stanbol</groupId>
+       
<artifactId>org.apache.stanbol.enhancer.engines.dbpspotlightspot</artifactId>
+       <packaging>bundle</packaging>
+
+       <name>Apache Stanbol Enhancer Enhancement Engine : DBPedia Spotlight 
Spot</name>
+       <description>an enhancement engine for spotting</description>
+
+       <inceptionYear>2010</inceptionYear>
+
+       <!--scm> <connection> 
scm:svn:http://svn.apache.org/repos/asf/incubator/stanbol/tags/0.9.0-incubating/enhancer/engines/langid/
 
+               </connection> <developerConnection> 
scm:svn:https://svn.apache.org/repos/asf/incubator/stanbol/tags/0.9.0-incubating/enhancer/engines/langid/
 
+               </developerConnection> 
<url>http://incubator.apache.org/stanbol/</url> </scm -->
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               <Export-Package>
+                                                       
org.apache.stanbol.enhancer.engines.dbpspotlightspot;version=${project.version}
+                                               </Export-Package>
+                                               <Embed-Dependency>
+                                               </Embed-Dependency>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-scr-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.rat</groupId>
+                               <artifactId>apache-rat-plugin</artifactId>
+                               <configuration>
+                                       <excludes>
+                                               <!-- AL20 licensed files: See 
src/test/resources/README -->
+                                               
<exclude>src/test/resources/en.txt</exclude>
+                                       </excludes>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+       <properties>
+               
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+       </properties>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.apache.tika</groupId>
+                       <artifactId>tika-core</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.apache.felix</groupId>
+                       
<artifactId>org.apache.felix.scr.annotations</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>rdf.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>commons-io</groupId>
+                       <artifactId>commons-io</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-api</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
 
 </project>

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSLSurfaceForm.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSLSurfaceForm.java?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSLSurfaceForm.java
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSLSurfaceForm.java
 Mon Aug 20 13:48:31 2012
@@ -20,7 +20,7 @@ package org.apache.stanbol.enhancer.engi
 
 /**
  * Stores the surface forms given by DBPedia Spotlight Spot.
- *
+ * 
  * @author <a href="mailto:[email protected]";>Iavor Jelev</a>
  */
 public class DBPSLSurfaceForm {
@@ -30,6 +30,7 @@ public class DBPSLSurfaceForm {
        public Integer offset;
 
        public String toString() {
-               return String.format( "[name=%s, offset=%i, type=%s]", name, 
offset, type ) ;
+               return String.format("[name=%s, offset=%i, type=%s]", name, 
offset,
+                               type);
        }
 }

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSpotlightSpotEnhancementEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSpotlightSpotEnhancementEngine.java?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSpotlightSpotEnhancementEngine.java
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/DBPSpotlightSpotEnhancementEngine.java
 Mon Aug 20 13:48:31 2012
@@ -77,317 +77,353 @@ import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 /**
- * {@link DBPSpotlightSpotEnhancementEngine} provides functionality to enhance 
document
- * with their language.
- *
+ * {@link DBPSpotlightSpotEnhancementEngine} provides functionality to enhance
+ * document with their language.
+ * 
  * @author Iavor Jelev, Babelmonkeys (GzEvD)
  */
-@Component(
-    metatype = true, 
-    immediate = true,
-    label = "%stanbol.DBPSpotlightSpotEnhancementEngine.name", 
-    description = "%stanbol.DBPSpotlightSpotEnhancementEngine.description")
+@Component(metatype = true, immediate = true, label = 
"%stanbol.DBPSpotlightSpotEnhancementEngine.name", description = 
"%stanbol.DBPSpotlightSpotEnhancementEngine.description")
 @Service
-@Properties(value={
-    @Property(name=EnhancementEngine.PROPERTY_NAME,value="dbpspotlightspot")
-})
-public class DBPSpotlightSpotEnhancementEngine 
-        extends AbstractEnhancementEngine<IOException,RuntimeException>
-        implements EnhancementEngine, ServiceProperties {
-
-    /**
-     * a configurable value of the text segment length to check
-     */
-    @Property(value = "http://spotlight.dbpedia.org/rest/spot";)
-    public static final String SL_URL_KEY = 
"stanbol.DBPSpotlightSpotEnhancementEngine.url";
-    
-    @Property(value = "LingPipeSpotter")
-    public static final String SL_SPOTTER = 
"stanbol.DBPSpotlightSpotEnhancementEngine.spotter";
-
-
-    /** 
-     * The default value for the Execution of this Engine. Currently set to
-     * {@link ServiceProperties#ORDERING_PRE_PROCESSING} 
-     */
-    public static final Integer defaultOrder = ORDERING_CONTENT_EXTRACTION - 
29;
-
-    /**
-     * This contains the only MIME type directly supported by this enhancement 
engine.
-     */
-    private static final String TEXT_PLAIN_MIMETYPE = "text/plain";
-    /**
-     * Set containing the only supported mime type {@link #TEXT_PLAIN_MIMETYPE}
-     */
-    private static final Set<String> SUPPORTED_MIMTYPES = 
Collections.singleton(TEXT_PLAIN_MIMETYPE);
-
-    /**
-     * This contains a list of languages supported by DBpedia Spotlight.
-     * If the metadata doesn't contain a value for the language as the value 
of the {@link Property.DC_LANG property}
-     * the content can't be processed.
-     */
-    protected static final Set<String> SUPPORTED_LANGUAGES = 
-            Collections.unmodifiableSet(new HashSet<String>(
-                    Arrays.asList("en")));
-
-    /** holds the logger. */
-    private static final Logger log = 
LoggerFactory.getLogger(DBPSpotlightSpotEnhancementEngine.class);
-
-    /** holds the url of the Spotlight REST endpoint */
-    private String spotlightUrl;
-    /** holds the chosen of spotter to be used */
-    private String spotlightSpotter;
-
-
-
-    /**
-     * Initialize all parameters from the configuration panel, or with their 
default values
-     * @param ce  the {@link ComponentContext}
-     */
-    @SuppressWarnings("unchecked")
-       protected void activate(ComponentContext ce) throws 
ConfigurationException, IOException {
-        
-        super.activate(ce);
-        
-        Dictionary<String, Object> properties = ce.getProperties();
-        spotlightUrl                          = properties.get( SL_URL_KEY ) 
== null ? "http://spotlight.dbpedia.org/rest/spot"; : (String) properties.get( 
SL_URL_KEY );
-        spotlightSpotter                      = properties.get( SL_SPOTTER ) 
== null ? null : (String) properties.get( SL_SPOTTER );
-    }   
-    
-
-    /**
-     * Check if the content can be enhanced
-     * @param ci  the {@link ContentItem}
-     */
-    public int canEnhance(ContentItem ci) throws EngineException {
-        if(ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES) != null){
-            String language = getMetadataLanguage(ci.getMetadata(), null);
-            if (language != null && !SUPPORTED_LANGUAGES.contains(language)) {
-                log.info("DBpedia Spotlight can not process ContentItem {} 
because "
-                    + "language {} is not supported (supported: {})",
-                    new Object[]{ci.getUri(),language,SUPPORTED_LANGUAGES});
-                return CANNOT_ENHANCE;
-            }
-            return ENHANCE_SYNCHRONOUS;
-        } 
-        return CANNOT_ENHANCE;
-    }
-
-
-    /**
-     * Calculate the enhancements by doing a POST request to the DBpedia 
Spotlight endpoint and processing the results 
-     * @param ci  the {@link ContentItem}
-     */
-    public void computeEnhancements( ContentItem ci ) throws EngineException {
-        Entry<UriRef,Blob> contentPart = ContentItemHelper.getBlob(ci, 
SUPPORTED_MIMTYPES);
-        if(contentPart == null){
-            throw new IllegalStateException("No ContentPart with Mimetype '"
-                    + TEXT_PLAIN_MIMETYPE+"' found for ContentItem 
"+ci.getUri()
-                    + ": This is also checked in the canEnhance method! -> 
This "
-                    + "indicated an Bug in the implementation of the "
-                    + "EnhancementJobManager!");
-        }
-        String text = "";
-        try {
-            text = ContentItemHelper.getText(contentPart.getValue());
-        } catch (IOException e) {
-            throw new InvalidContentException(this, ci, e);
-        }
-
-        Collection<DBPSLSurfaceForm> dbpslGraph = doPostRequest( text );
-        if ( dbpslGraph != null ) {
-            //Acquire a write lock on the ContentItem when adding the 
enhancements
-            ci.getLock().writeLock().lock();
-            try {
-                createEnhancements( dbpslGraph, ci);
-                if (log.isDebugEnabled()) {
-                    Serializer serializer = Serializer.getInstance();
-                    ByteArrayOutputStream debugStream = new 
ByteArrayOutputStream();
-                    serializer.serialize(debugStream, ci.getMetadata(), 
"application/rdf+xml");
-                    try {
-                        log.debug("DBpedia Spotlight Spot 
Enhancements:\n{}",debugStream.toString("UTF-8"));
-                    } catch (UnsupportedEncodingException e) {
-                        e.printStackTrace();
-                    }
-                }
-            } finally {
-                ci.getLock().writeLock().unlock();
-            }
-        }
-    }
-
-
-    /**
-     * The method adds the returned DBpedia Spotlight surface forms to the 
content item's metadata.
-     * For each one an TextAnnotation is created.
-     *
-     * @param occs a Collection of entity information
-     * @param ci the content item
-     */
-    public void createEnhancements( Collection<DBPSLSurfaceForm> occs, 
ContentItem ci ) {
-        LiteralFactory literalFactory = LiteralFactory.getInstance();
-        final Language language;       // used for plain literals representing 
parts fo the content
-        String langString             = getMetadataLanguage(ci.getMetadata(), 
null);
-        
-        if(langString != null && !langString.isEmpty()){
-            language = new Language(langString);
-        } else {
-            language = null;
-        }
-        
-        HashMap<String, UriRef> entityAnnotationMap = new HashMap<String, 
UriRef>();
-
-        for (DBPSLSurfaceForm occ : occs) {
-            UriRef textAnnotation = 
EnhancementEngineHelper.createTextEnhancement( ci, this );
-            MGraph model          = ci.getMetadata();
-
-            model.add(new TripleImpl(textAnnotation, 
ENHANCER_SELECTED_TEXT,new PlainLiteralImpl(occ.name,language)));
-            model.add(new TripleImpl(textAnnotation, ENHANCER_START, 
literalFactory.createTypedLiteral(occ.offset)));
-            model.add(new TripleImpl(textAnnotation, ENHANCER_END, 
literalFactory.createTypedLiteral(occ.offset + occ.name.length())));
-            model.add(new TripleImpl(textAnnotation, DC_TYPE, new UriRef( 
occ.type )));
-            // TODO ################## model.add(new 
TripleImpl(textAnnotation, ENHANCER_SELECTION_CONTEXT, new 
PlainLiteralImpl(occ.context,language)));
-
-            if (entityAnnotationMap.containsKey(occ.name)) {
-                model.add(new TripleImpl(entityAnnotationMap.get(occ.name), 
DC_RELATION, textAnnotation));
-            } 
-            else {
-                entityAnnotationMap.put(occ.name,textAnnotation);
-            }
-        }
-    }
-
-
-
-
-    /**
-     * Sends a POST request to the DBpediaSpotlight url.
-     * @param text a <code>String</code> with the text to be analyzed
-     * @return a <code>String</code> with the server response
-     * @throws EngineException if the request cannot be sent
-     */
-    public Collection<DBPSLSurfaceForm> doPostRequest( String text ) throws 
EngineException {
+@Properties(value = { @Property(name = EnhancementEngine.PROPERTY_NAME, value 
= "dbpspotlightspot") })
+public class DBPSpotlightSpotEnhancementEngine extends
+               AbstractEnhancementEngine<IOException, RuntimeException> 
implements
+               EnhancementEngine, ServiceProperties {
+
+       /**
+        * a configurable value of the text segment length to check
+        */
+       @Property(value = "http://spotlight.dbpedia.org/rest/spot";)
+       public static final String SL_URL_KEY = 
"stanbol.DBPSpotlightSpotEnhancementEngine.url";
+
+       @Property(value = "LingPipeSpotter")
+       public static final String SL_SPOTTER = 
"stanbol.DBPSpotlightSpotEnhancementEngine.spotter";
+
+       /**
+        * The default value for the Execution of this Engine. Currently set to
+        * {@link ServiceProperties#ORDERING_PRE_PROCESSING}
+        */
+       public static final Integer defaultOrder = ORDERING_CONTENT_EXTRACTION 
- 29;
+
+       /**
+        * This contains the only MIME type directly supported by this 
enhancement
+        * engine.
+        */
+       private static final String TEXT_PLAIN_MIMETYPE = "text/plain";
+       /**
+        * Set containing the only supported mime type {@link 
#TEXT_PLAIN_MIMETYPE}
+        */
+       private static final Set<String> SUPPORTED_MIMTYPES = Collections
+                       .singleton(TEXT_PLAIN_MIMETYPE);
+
+       /**
+        * This contains a list of languages supported by DBpedia Spotlight. If 
the
+        * metadata doesn't contain a value for the language as the value of the
+        * {@link Property.DC_LANG property} the content can't be processed.
+        */
+       protected static final Set<String> SUPPORTED_LANGUAGES = Collections
+                       .unmodifiableSet(new 
HashSet<String>(Arrays.asList("en")));
+
+       /** holds the logger. */
+       private static final Logger log = LoggerFactory
+                       .getLogger(DBPSpotlightSpotEnhancementEngine.class);
+
+       /** holds the url of the Spotlight REST endpoint */
+       private String spotlightUrl;
+       /** holds the chosen of spotter to be used */
+       private String spotlightSpotter;
+
+       /**
+        * Initialize all parameters from the configuration panel, or with their
+        * default values
+        * 
+        * @param ce
+        *            the {@link ComponentContext}
+        */
+       @SuppressWarnings("unchecked")
+       protected void activate(ComponentContext ce) throws 
ConfigurationException,
+                       IOException {
+
+               super.activate(ce);
+
+               Dictionary<String, Object> properties = ce.getProperties();
+               spotlightUrl = properties.get(SL_URL_KEY) == null ? 
"http://spotlight.dbpedia.org/rest/spot";
+                               : (String) properties.get(SL_URL_KEY);
+               spotlightSpotter = properties.get(SL_SPOTTER) == null ? null
+                               : (String) properties.get(SL_SPOTTER);
+       }
+
+       /**
+        * Check if the content can be enhanced
+        * 
+        * @param ci
+        *            the {@link ContentItem}
+        */
+       public int canEnhance(ContentItem ci) throws EngineException {
+               if (ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES) != null) {
+                       String language = getMetadataLanguage(ci.getMetadata(), 
null);
+                       if (language != null && 
!SUPPORTED_LANGUAGES.contains(language)) {
+                               log.info(
+                                               "DBpedia Spotlight can not 
process ContentItem {} because "
+                                                               + "language {} 
is not supported (supported: {})",
+                                               new Object[] { ci.getUri(), 
language,
+                                                               
SUPPORTED_LANGUAGES });
+                               return CANNOT_ENHANCE;
+                       }
+                       return ENHANCE_SYNCHRONOUS;
+               }
+               return CANNOT_ENHANCE;
+       }
+
+       /**
+        * Calculate the enhancements by doing a POST request to the DBpedia
+        * Spotlight endpoint and processing the results
+        * 
+        * @param ci
+        *            the {@link ContentItem}
+        */
+       public void computeEnhancements(ContentItem ci) throws EngineException {
+               Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci,
+                               SUPPORTED_MIMTYPES);
+               if (contentPart == null) {
+                       throw new IllegalStateException(
+                                       "No ContentPart with Mimetype '"
+                                                       + TEXT_PLAIN_MIMETYPE
+                                                       + "' found for 
ContentItem "
+                                                       + ci.getUri()
+                                                       + ": This is also 
checked in the canEnhance method! -> This "
+                                                       + "indicated an Bug in 
the implementation of the "
+                                                       + 
"EnhancementJobManager!");
+               }
+               String text = "";
+               try {
+                       text = 
ContentItemHelper.getText(contentPart.getValue());
+               } catch (IOException e) {
+                       throw new InvalidContentException(this, ci, e);
+               }
+
+               Collection<DBPSLSurfaceForm> dbpslGraph = doPostRequest(text);
+               if (dbpslGraph != null) {
+                       // Acquire a write lock on the ContentItem when adding 
the
+                       // enhancements
+                       ci.getLock().writeLock().lock();
+                       try {
+                               createEnhancements(dbpslGraph, ci);
+                               if (log.isDebugEnabled()) {
+                                       Serializer serializer = 
Serializer.getInstance();
+                                       ByteArrayOutputStream debugStream = new 
ByteArrayOutputStream();
+                                       serializer.serialize(debugStream, 
ci.getMetadata(),
+                                                       "application/rdf+xml");
+                                       try {
+                                               log.debug("DBpedia Spotlight 
Spot Enhancements:\n{}",
+                                                               
debugStream.toString("UTF-8"));
+                                       } catch (UnsupportedEncodingException 
e) {
+                                               e.printStackTrace();
+                                       }
+                               }
+                       } finally {
+                               ci.getLock().writeLock().unlock();
+                       }
+               }
+       }
+
+       /**
+        * The method adds the returned DBpedia Spotlight surface forms to the
+        * content item's metadata. For each one an TextAnnotation is created.
+        * 
+        * @param occs
+        *            a Collection of entity information
+        * @param ci
+        *            the content item
+        */
+       public void createEnhancements(Collection<DBPSLSurfaceForm> occs,
+                       ContentItem ci) {
+               LiteralFactory literalFactory = LiteralFactory.getInstance();
+               final Language language; // used for plain literals 
representing parts
+                                                                       // fo 
the content
+               String langString = getMetadataLanguage(ci.getMetadata(), null);
+
+               if (langString != null && !langString.isEmpty()) {
+                       language = new Language(langString);
+               } else {
+                       language = null;
+               }
+
+               HashMap<String, UriRef> entityAnnotationMap = new 
HashMap<String, UriRef>();
+
+               for (DBPSLSurfaceForm occ : occs) {
+                       UriRef textAnnotation = EnhancementEngineHelper
+                                       .createTextEnhancement(ci, this);
+                       MGraph model = ci.getMetadata();
+
+                       model.add(new TripleImpl(textAnnotation, 
ENHANCER_SELECTED_TEXT,
+                                       new PlainLiteralImpl(occ.name, 
language)));
+                       model.add(new TripleImpl(textAnnotation, ENHANCER_START,
+                                       
literalFactory.createTypedLiteral(occ.offset)));
+                       model.add(new TripleImpl(textAnnotation, ENHANCER_END,
+                                       
literalFactory.createTypedLiteral(occ.offset
+                                                       + occ.name.length())));
+                       model.add(new TripleImpl(textAnnotation, DC_TYPE, new 
UriRef(
+                                       occ.type)));
+                       // TODO ################## model.add(new 
TripleImpl(textAnnotation,
+                       // ENHANCER_SELECTION_CONTEXT, new
+                       // PlainLiteralImpl(occ.context,language)));
+
+                       if (entityAnnotationMap.containsKey(occ.name)) {
+                               model.add(new 
TripleImpl(entityAnnotationMap.get(occ.name),
+                                               DC_RELATION, textAnnotation));
+                       } else {
+                               entityAnnotationMap.put(occ.name, 
textAnnotation);
+                       }
+               }
+       }
+
+       /**
+        * Sends a POST request to the DBpediaSpotlight url.
+        * 
+        * @param text
+        *            a <code>String</code> with the text to be analyzed
+        * @return a <code>String</code> with the server response
+        * @throws EngineException
+        *             if the request cannot be sent
+        */
+       public Collection<DBPSLSurfaceForm> doPostRequest(String text)
+                       throws EngineException {
                StringBuilder data = new StringBuilder();
                try {
-                       if ( spotlightSpotter != null && 
!spotlightSpotter.isEmpty() )
-                       data.append( URLEncoder.encode( "spotter", "UTF-8" ) + 
"=" + URLEncoder.encode( spotlightSpotter, "UTF-8" ) + "&" );
-                       data.append( URLEncoder.encode( "text", "UTF-8" ) + "=" 
+ URLEncoder.encode( text, "UTF-8" ) );
+                       if (spotlightSpotter != null && 
!spotlightSpotter.isEmpty())
+                               data.append(URLEncoder.encode("spotter", 
"UTF-8") + "="
+                                               + 
URLEncoder.encode(spotlightSpotter, "UTF-8") + "&");
+                       data.append(URLEncoder.encode("text", "UTF-8") + "="
+                                       + URLEncoder.encode(text, "UTF-8"));
                } catch (UnsupportedEncodingException e) {
-                       throw new EngineException( "Data for the httprequest 
could not be converted. Error: " + e.getMessage() );
+                       throw new EngineException(
+                                       "Data for the httprequest could not be 
converted. Error: "
+                                                       + e.getMessage());
                }
 
-               HttpURLConnection connection = null;  
-               StringBuffer response        = new StringBuffer(); 
-               
-        try {
-                       //Create connection
-                       URL url = new URL( spotlightUrl );
-                       connection = ( HttpURLConnection )url.openConnection();
-                       connection.setRequestMethod( "POST" );
-                       connection.setRequestProperty( "Content-Type", 
"application/x-www-form-urlencoded" );
-                       connection.setRequestProperty( "Accept", "text/xml" );
-
-                       connection.setUseCaches( false );
-                       connection.setDoInput( true );
-                       connection.setDoOutput( true );
-
-                       //Send request
-                       DataOutputStream wr = new DataOutputStream (
-                                       connection.getOutputStream ());
-                       wr.writeBytes( data.toString() );
-                       wr.flush ();
-                       wr.close ();
+               HttpURLConnection connection = null;
+               StringBuffer response = new StringBuffer();
+
+               try {
+                       // Create connection
+                       URL url = new URL(spotlightUrl);
+                       connection = (HttpURLConnection) url.openConnection();
+                       connection.setRequestMethod("POST");
+                       connection.setRequestProperty("Content-Type",
+                                       "application/x-www-form-urlencoded");
+                       connection.setRequestProperty("Accept", "text/xml");
+
+                       connection.setUseCaches(false);
+                       connection.setDoInput(true);
+                       connection.setDoOutput(true);
+
+                       // Send request
+                       DataOutputStream wr = new DataOutputStream(
+                                       connection.getOutputStream());
+                       wr.writeBytes(data.toString());
+                       wr.flush();
+                       wr.close();
 
-                       //Get Response  
+                       // Get Response
                        InputStream is = connection.getInputStream();
-                       BufferedReader rd = new BufferedReader( new 
InputStreamReader( is ) );
+                       BufferedReader rd = new BufferedReader(new 
InputStreamReader(is));
                        String line;
-                       while((line = rd.readLine()) != null) {
-                               response.append( line );
-                               response.append( '\r' );
+                       while ((line = rd.readLine()) != null) {
+                               response.append(line);
+                               response.append('\r');
                        }
                        rd.close();
 
                } catch (Exception e) {
 
-                   log.error( "[request] Request could not be made. Error: " + 
e.getMessage() );
+                       log.error("[request] Request could not be made. Error: "
+                                       + e.getMessage());
                        e.printStackTrace();
                        return null;
 
                } finally {
 
-                       if(connection != null) {
-                               connection.disconnect(); 
+                       if (connection != null) {
+                               connection.disconnect();
                        }
                }
-               
 
-           XMLParser xmlParser = new XMLParser();
+               XMLParser xmlParser = new XMLParser();
                try {
-                   Document xmlDoc                   = 
xmlParser.loadXMLFromString( response.toString() );
-                       NodeList nlist                    = 
xmlParser.getElementsByTagName( xmlDoc, "surfaceForm" );
-                       Collection<DBPSLSurfaceForm> annos = 
this.getAnnotations( nlist );
-        
-            return annos;
-               } catch ( Exception e) {
-                   log.error( "[response] Response XML could not be parsed. 
Error: " + e.getMessage() );
-                       throw new EngineException( "Response XML could not be 
parsed. Error: " + e.getMessage() );
-               }
-    }
-    
-    
-    /**
-     * This method creates the Collection of surface forms, which the method 
<code>createEnhancement</code>
-     * adds to the meta data of the content item as TextAnnotations.
-     * @param nList NodeList of all Resources contained in the XML response 
from DBpedia Spotlight
-     * @return a Collection<DBPSLSurfaceForm> with all annotations
-     */
-       private Collection<DBPSLSurfaceForm> getAnnotations( NodeList nList ) {
+                       Document xmlDoc = 
xmlParser.loadXMLFromString(response.toString());
+                       NodeList nlist = xmlParser.getElementsByTagName(xmlDoc,
+                                       "surfaceForm");
+                       Collection<DBPSLSurfaceForm> annos = 
this.getAnnotations(nlist);
+
+                       return annos;
+               } catch (Exception e) {
+                       log.error("[response] Response XML could not be parsed. 
Error: "
+                                       + e.getMessage());
+                       throw new EngineException(
+                                       "Response XML could not be parsed. 
Error: "
+                                                       + e.getMessage());
+               }
+       }
+
+       /**
+        * This method creates the Collection of surface forms, which the method
+        * <code>createEnhancement</code> adds to the meta data of the content 
item
+        * as TextAnnotations.
+        * 
+        * @param nList
+        *            NodeList of all Resources contained in the XML response 
from
+        *            DBpedia Spotlight
+        * @return a Collection<DBPSLSurfaceForm> with all annotations
+        */
+       private Collection<DBPSLSurfaceForm> getAnnotations(NodeList nList) {
                Collection<DBPSLSurfaceForm> dbpslAnnos = new 
HashSet<DBPSLSurfaceForm>();
-               
+
                for (int temp = 0; temp < nList.getLength(); temp++) {
-                       DBPSLSurfaceForm dbpslann        = new 
DBPSLSurfaceForm();
-                       Element node                     = (Element) 
nList.item(temp);
-                       dbpslann.name                    = node.getAttribute( 
"name" );
-                       dbpslann.offset                  = (new Integer( 
node.getAttribute( "offset" ) ) ).intValue();
-                       dbpslann.type                    = node.getAttribute( 
"type" );
-                       
-                       dbpslAnnos.add( dbpslann );
+                       DBPSLSurfaceForm dbpslann = new DBPSLSurfaceForm();
+                       Element node = (Element) nList.item(temp);
+                       dbpslann.name = node.getAttribute("name");
+                       dbpslann.offset = (new 
Integer(node.getAttribute("offset")))
+                                       .intValue();
+                       dbpslann.type = node.getAttribute("type");
+
+                       dbpslAnnos.add(dbpslann);
                }
-               
+
                return dbpslAnnos;
        }
 
+       public Map<String, Object> getServiceProperties() {
+               return Collections.unmodifiableMap(Collections.singletonMap(
+                               ENHANCEMENT_ENGINE_ORDERING, (Object) 
defaultOrder));
+       }
+
+       public String getMetadataLanguage(MGraph model, NonLiteral subj) {
+               Iterator<Triple> it = model.filter(subj, DC_LANGUAGE, null);
+               if (it.hasNext()) {
+                       Resource langNode = it.next().getObject();
+                       return getLexicalForm(langNode);
+               }
+               return null;
+       }
+
+       public String getLexicalForm(Resource res) {
+               if (res == null) {
+                       return null;
+               } else if (res instanceof Literal) {
+                       return ((Literal) res).getLexicalForm();
+               } else {
+                       return res.toString();
+               }
+       }
 
-    public Map<String, Object> getServiceProperties() {
-        return 
Collections.unmodifiableMap(Collections.singletonMap(ENHANCEMENT_ENGINE_ORDERING,
 (Object) defaultOrder));
-    }
-
-
-    public String getMetadataLanguage(MGraph model, NonLiteral subj) {
-        Iterator<Triple> it = model.filter(subj, DC_LANGUAGE, null);
-        if (it.hasNext()) {
-            Resource langNode = it.next().getObject();
-            return getLexicalForm(langNode);
-        }
-        return null;
-    }
-
-    public String getLexicalForm(Resource res) {
-        if (res == null) {
-            return null;
-        } else if (res instanceof Literal) {
-            return ((Literal) res).getLexicalForm();
-        } else {
-            return res.toString();
-        }
-    }
-
-    
-    /**
-     * This method is used by the test class to set the endpoint url
-     * @param url String the url of the Spotlight endpoint
-     */
-    public void setEndpointUrl( String url ) {
-       spotlightUrl = url;
-    }
+       /**
+        * This method is used by the test class to set the endpoint url
+        * 
+        * @param url
+        *            String the url of the Spotlight endpoint
+        */
+       public void setEndpointUrl(String url) {
+               spotlightUrl = url;
+       }
 
 }

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/XMLParser.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/XMLParser.java?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/XMLParser.java
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/XMLParser.java
 Mon Aug 20 13:48:31 2012
@@ -29,38 +29,37 @@ import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-
 /**
  * Parses the XML results given by DBPedia Spotlight.
- *
+ * 
  * @author <a href="mailto:[email protected]";>Iavor Jelev</a>
  */
 
 public class XMLParser {
- 
-       public NodeList getElementsByTagName( Document doc, String tagName ) {
-               
-               return doc.getElementsByTagName( tagName );
+
+       public NodeList getElementsByTagName(Document doc, String tagName) {
+
+               return doc.getElementsByTagName(tagName);
        }
-       
 
-       public Document loadXMLFromString( String xml ) throws SAXException, 
IOException {
-               Document doc = loadXMLFromInputStream( new 
ByteArrayInputStream( xml.getBytes() ) );
+       public Document loadXMLFromString(String xml) throws SAXException,
+                       IOException {
+               Document doc = loadXMLFromInputStream(new ByteArrayInputStream(
+                               xml.getBytes()));
                doc.getDocumentElement().normalize();
 
                return doc;
        }
 
-       
-       public Document loadXMLFromInputStream( InputStream is ) throws 
SAXException, IOException {
+       public Document loadXMLFromInputStream(InputStream is) throws 
SAXException,
+                       IOException {
                DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
-               factory.setNamespaceAware( true );
-               DocumentBuilder builder        = null;
+               factory.setNamespaceAware(true);
+               DocumentBuilder builder = null;
                try {
                        builder = factory.newDocumentBuilder();
+               } catch (ParserConfigurationException ex) {
                }
-               catch ( ParserConfigurationException ex ) {
-               }  
                Document doc = builder.parse(is);
                is.close();
                doc.getDocumentElement().normalize();
@@ -68,14 +67,14 @@ public class XMLParser {
                return doc;
        }
 
-
-       public Document loadXMLFromFile( String filePath ) throws 
ParserConfigurationException, SAXException, IOException {
-               File fXmlFile = new File( filePath );
+       public Document loadXMLFromFile(String filePath)
+                       throws ParserConfigurationException, SAXException, 
IOException {
+               File fXmlFile = new File(filePath);
                DocumentBuilderFactory dbFactory = 
DocumentBuilderFactory.newInstance();
                DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
                Document doc = dBuilder.parse(fXmlFile);
                doc.getDocumentElement().normalize();
-               
+
                return doc;
        }
 }
\ No newline at end of file

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/core/DBPSpotlightSpotEnhancementTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/core/DBPSpotlightSpotEnhancementTest.java?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/core/DBPSpotlightSpotEnhancementTest.java
 (original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/dbpspotlightspot/src/test/java/org/apache/stanbol/enhancer/engines/dbpspotlightspot/core/DBPSpotlightSpotEnhancementTest.java
 Mon Aug 20 13:48:31 2012
@@ -29,38 +29,43 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * This class provides a JUnit test for DBpedia Spotlight Spot 
EnhancementEngine.
+ * This class provides a JUnit test for DBpedia Spotlight Spot
+ * EnhancementEngine.
+ * 
  * @author Iavor Jelev, babelmonkeys / GzEvD
  */
 public class DBPSpotlightSpotEnhancementTest {
 
-         /**
-          * This contains the logger.
-          */
-         private static final Logger LOG  = 
LoggerFactory.getLogger(DBPSpotlightSpotEnhancementTest.class);
-         private static String SPL_URL    = 
System.getProperty(DBPSpotlightSpotEnhancementEngine.SL_URL_KEY) == null ? 
-                                                                               
                                "http://spotlight.dbpedia.org/rest/spot"; : 
(String) System.getProperty(DBPSpotlightSpotEnhancementEngine.SL_URL_KEY);
-         private static String TEST_TEXT  = "President Obama is meeting Angela 
Merkel in Berlin on Monday";
-         private static DBPSpotlightSpotEnhancementEngine dbpslight;
-         
-         @BeforeClass
-         public static void oneTimeSetup() throws ConfigurationException {
-                 dbpslight = new DBPSpotlightSpotEnhancementEngine();
-                 dbpslight.setEndpointUrl( SPL_URL );
-         }
+       /**
+        * This contains the logger.
+        */
+       private static final Logger LOG = LoggerFactory
+                       .getLogger(DBPSpotlightSpotEnhancementTest.class);
+       private static String SPL_URL = System
+                       
.getProperty(DBPSpotlightSpotEnhancementEngine.SL_URL_KEY) == null ? 
"http://spotlight.dbpedia.org/rest/spot";
+                       : (String) System
+                                       
.getProperty(DBPSpotlightSpotEnhancementEngine.SL_URL_KEY);
+       private static String TEST_TEXT = "President Obama is meeting Angela 
Merkel in Berlin on Monday";
+       private static DBPSpotlightSpotEnhancementEngine dbpslight;
 
-         
-         @Test
-         public void testEntityExtraction() {
-           Collection<DBPSLSurfaceForm> entities;
+       @BeforeClass
+       public static void oneTimeSetup() throws ConfigurationException {
+               dbpslight = new DBPSpotlightSpotEnhancementEngine();
+               dbpslight.setEndpointUrl(SPL_URL);
+       }
+
+       @Test
+       public void testEntityExtraction() {
+               Collection<DBPSLSurfaceForm> entities;
                try {
-                       entities = dbpslight.doPostRequest( TEST_TEXT );
-                   LOG.info("Found entities: {}",entities.size());
-                   LOG.debug("Entities:\n{}",entities);
-                   Assert.assertFalse("No entities were found!", 
entities.isEmpty());
+                       entities = dbpslight.doPostRequest(TEST_TEXT);
+                       LOG.info("Found entities: {}", entities.size());
+                       LOG.debug("Entities:\n{}", entities);
+                       Assert.assertFalse("No entities were found!", 
entities.isEmpty());
                } catch (EngineException e) {
-                   Assert.assertFalse("An EngineException occurred! The 
message was: " + e.getMessage(), true);
+                       Assert.assertFalse("An EngineException occurred! The 
message was: "
+                                       + e.getMessage(), true);
                }
-         }
+       }
 
 }

Modified: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/geonames/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/dbpedia-spotlight-engines/engines/geonames/pom.xml?rev=1375018&r1=1375017&r2=1375018&view=diff
==============================================================================
--- 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/geonames/pom.xml 
(original)
+++ 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/geonames/pom.xml 
Mon Aug 20 13:48:31 2012
@@ -1,153 +1,146 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-   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.
--->
+<!-- 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. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
 
-  <modelVersion>4.0.0</modelVersion>
+       <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <groupId>org.apache.stanbol</groupId>
-    <artifactId>org.apache.stanbol.enhancer.parent</artifactId>
-    <version>0.10.0-incubating-SNAPSHOT</version>
-    <relativePath>../../parent</relativePath>
-  </parent>
-
-  <groupId>org.apache.stanbol</groupId>
-  <artifactId>org.apache.stanbol.enhancer.engines.geonames</artifactId>
-  <version>0.10.0-incubating-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+       <parent>
+               <groupId>org.apache.stanbol</groupId>
+               <artifactId>org.apache.stanbol.enhancer.parent</artifactId>
+               <version>0.10.0-incubating-SNAPSHOT</version>
+               <relativePath>../../parent</relativePath>
+       </parent>
+
+       <groupId>org.apache.stanbol</groupId>
+       <artifactId>org.apache.stanbol.enhancer.engines.geonames</artifactId>
+       <version>0.10.0-incubating-SNAPSHOT</version>
+       <packaging>bundle</packaging>
 
-  <name>Apache Stanbol Enhancer Enhancement Engine : geonames.org GIS 
service</name>
-  <description>
+       <name>Apache Stanbol Enhancer Enhancement Engine : geonames.org GIS 
service</name>
+       <description>
     Simple of an enhancement engine that consumes TextAnnotations and
     creates EntityAnnotations using the geonames.org GIS service
   </description>
 
-  <inceptionYear>2010</inceptionYear>
+       <inceptionYear>2010</inceptionYear>
 
-  <scm>
-    <connection>
+       <scm>
+               <connection>
       
scm:svn:http://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/engines/geonames/
     </connection>
-    <developerConnection>
+               <developerConnection>
       
scm:svn:https://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/engines/geonames/
     </developerConnection>
-    <url>http://incubator.apache.org/stanbol/</url>
-  </scm>
+               <url>http://incubator.apache.org/stanbol/</url>
+       </scm>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Export-Package>
-              
org.apache.stanbol.enhancer.engines.geonames;version=${project.version}
-            </Export-Package>
-            <Private-Package>
-              
org.apache.stanbol.enhancer.engines.geonames.impl.*;version=${project.version}
-            </Private-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-scr-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <!-- Reactivated this test. If it fails because of geonames.org
-                 we might need to deactivate it again.
-            <exclude>**/TestLocationEnhancementEngine*.java</exclude> -->
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
-      <version>0.10.0-incubating-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.commons.stanboltools.offline</artifactId>
-      <version>0.9.0-incubating</version>
-    </dependency>
-
-    <dependency> <!-- used to parse json responses of geonames.org -->
-      <groupId>org.codehaus.jettison</groupId>
-      <artifactId>jettison</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.scr.annotations</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.clerezza</groupId>
-      <artifactId>rdf.core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <!-- Dependencies for testing -->
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.enhancer.core</artifactId>
-      <version>0.10.0-incubating-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.enhancer.test</artifactId>
-      <version>0.10.0-incubating-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.stanbol</groupId>
-      <artifactId>org.apache.stanbol.enhancer.rdfentities</artifactId>
-      <version>0.10.0-incubating-SNAPSHOT</version>
-      <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>
-  </dependencies>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration>
+                                       <instructions>
+                                               <Export-Package>
+                                                       
org.apache.stanbol.enhancer.engines.geonames;version=${project.version}
+                                               </Export-Package>
+                                               <Private-Package>
+                                                       
org.apache.stanbol.enhancer.engines.geonames.impl.*;version=${project.version}
+                                               </Private-Package>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-scr-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                               <configuration>
+                                       <excludes>
+                                               <!-- Reactivated this test. If 
it fails because of geonames.org we 
+                                                       might need to 
deactivate it again. <exclude>**/TestLocationEnhancementEngine*.java</exclude> 
-->
+                                       </excludes>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
+                       <version>0.10.0-incubating-SNAPSHOT</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.stanboltools.offline</artifactId>
+                       <version>0.9.0-incubating</version>
+               </dependency>
+
+               <dependency> <!-- used to parse json responses of geonames.org 
-->
+                       <groupId>org.codehaus.jettison</groupId>
+                       <artifactId>jettison</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>commons-io</groupId>
+                       <artifactId>commons-io</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.felix</groupId>
+                       
<artifactId>org.apache.felix.scr.annotations</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>rdf.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-api</artifactId>
+               </dependency>
+
+               <!-- Dependencies for testing -->
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.enhancer.core</artifactId>
+                       <version>0.10.0-incubating-SNAPSHOT</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.enhancer.test</artifactId>
+                       <version>0.10.0-incubating-SNAPSHOT</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.enhancer.rdfentities</artifactId>
+                       <version>0.10.0-incubating-SNAPSHOT</version>
+                       <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>
+       </dependencies>
 
 </project>

Propchange: 
incubator/stanbol/branches/dbpedia-spotlight-engines/engines/langdetect/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 20 13:48:31 2012
@@ -0,0 +1,7 @@
+target
+
+.project
+
+.classpath
+
+.settings


Reply via email to