You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by al...@apache.org on 2012/03/16 14:34:24 UTC

svn commit: r1301497 [1/2] - in /incubator/stanbol/trunk: enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/ enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/ reasoners...

Author: alexdma
Date: Fri Mar 16 13:34:23 2012
New Revision: 1301497

URL: http://svn.apache.org/viewvc?rev=1301497&view=rev
Log:
This commit applies the following patches proposed by Alberto Musetti:
* Add CORS support to Reasoners, Rules and Reengineer (STANBOL-105)
* Replaced most stdout prints in Rules with SLF4j (STANBOL-253)
* Introduces default (inactive) SEO configuration for refactor engine and fixes two bugs for boolean conversion and graph clearing (STANBOL-468)

Modified:
    incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/DefaultRefactorEnhancementEngineConf.java
    incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngine.java
    incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngineConf.java
    incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/Dereferencer.java
    incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/IDereferencer.java
    incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/JobsResource.java
    incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServiceTaskResource.java
    incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource.java
    incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/utils/ResponseTaskBuilder.java
    incubator/stanbol/trunk/reengineer/web/src/main/java/org/apache/stanbol/reengineer/web/resources/ReengineerResource.java
    incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleParser.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/LetAtom.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/UObjectAtom.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRule.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/GetRecipe.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/GetRule.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/LoadRuleFile.java
    incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/RemoveRecipe.java
    incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/LoadRuleFileTest.java
    incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/RuleStoreTest.java
    incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java
    incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RecipeResource.java
    incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RefactorResource.java
    incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RuleResource.java
    incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RuleStoreResource.java
    incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RulesRootResource.java

Modified: incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/DefaultRefactorEnhancementEngineConf.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/DefaultRefactorEnhancementEngineConf.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/DefaultRefactorEnhancementEngineConf.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/DefaultRefactorEnhancementEngineConf.java Fri Mar 16 13:34:23 2012
@@ -14,96 +14,93 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.stanbol.enhancer.engines.refactor;
 
 import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * Default configuration of the Refactor Enhancement Engine.<br/>
- * The default configuration load an instance of Refactor Engine which maps named-entities recognized by
- * other Enhancement Engines to Schema.org.
- *  
+ * The default configuration load an instance of Refactor Engine which maps named-entities recognized by other
+ * Enhancement Engines to Schema.org.
+ * 
  * @author anuzzolese
  * @author alberto.musetti
- *
+ * 
  */
 public class DefaultRefactorEnhancementEngineConf implements RefactorEnhancementEngineConf {
 
-	private Dictionary<String, Object> conf;
-	
-	/*
-	public DefaultRefactorEnhancementEngineConf() {
-		
-	}
-	*/
-	public DefaultRefactorEnhancementEngineConf(Dictionary<String, Object> map) {
-		this.conf = map;
-	}
-	
-	@Override
-	public String getScope() {
-		return (String) conf.get(SCOPE);
-	}
-
-	@Override
-	public void setScope(String scopeId) {
-		conf.put(SCOPE, scopeId);
-	}
-
-	@Override
-	public String getRecipeLocation() {
-		return (String) conf.get(RECIPE_LOCATION);
-	}
-
-	@Override
-	public void setRecipeLocation(String recipeLocation) {
-		conf.put(RECIPE_LOCATION, recipeLocation);
-		
-	}
-
-	@Override
-	public String getRecipeId() {
-		return (String) conf.get(RECIPE_ID);
-	}
-
-	@Override
-	public void setRecipeId(String recipeId) {
-		conf.put(RECIPE_ID, recipeId);
-	}
-
-	@Override
-	public String[] getScopeCoreOntology() {
-		return (String[]) conf.get(SCOPE_CORE_ONTOLOGY);
-	}
-
-	@Override
-	public void setScopeCoreOntology(String[] coreOntologyURI) {
-		conf.put(SCOPE_CORE_ONTOLOGY, coreOntologyURI);
-	}
-
-	@Override
-	public boolean isInGraphAppendMode() {
-		return ((Boolean) conf.get(APPEND_OTHER_ENHANCEMENT_GRAPHS)).booleanValue();
-	}
-
-	@Override
-	public void setInGraphAppendMode(boolean b) {
-		conf.put(APPEND_OTHER_ENHANCEMENT_GRAPHS, b);
-		
-	}
-
-	@Override
-	public boolean isEntityHubUsed() {
-		return ((Boolean) conf.get(USE_ENTITY_HUB)).booleanValue();
-	}
-
-	@Override
-	public void setEntityHubUsed(boolean b) {
-		conf.put(USE_ENTITY_HUB, b);
-		
-	}
+    private Dictionary<String,Object> conf;
+
+    /*
+     * public DefaultRefactorEnhancementEngineConf() {
+     * 
+     * }
+     */
+    public DefaultRefactorEnhancementEngineConf(Dictionary<String,Object> map) {
+        this.conf = map;
+    }
+
+    @Override
+    public String getScope() {
+        return (String) conf.get(SCOPE);
+    }
+
+    @Override
+    public void setScope(String scopeId) {
+        conf.put(SCOPE, scopeId);
+    }
+
+    @Override
+    public String getRecipeLocation() {
+        return (String) conf.get(RECIPE_LOCATION);
+    }
+
+    @Override
+    public void setRecipeLocation(String recipeLocation) {
+        conf.put(RECIPE_LOCATION, recipeLocation);
+
+    }
+
+    @Override
+    public String getRecipeId() {
+        return (String) conf.get(RECIPE_ID);
+    }
+
+    @Override
+    public void setRecipeId(String recipeId) {
+        conf.put(RECIPE_ID, recipeId);
+    }
+
+    @Override
+    public String[] getScopeCoreOntology() {
+        return (String[]) conf.get(SCOPE_CORE_ONTOLOGY);
+    }
+
+    @Override
+    public void setScopeCoreOntology(String[] coreOntologyURI) {
+        conf.put(SCOPE_CORE_ONTOLOGY, coreOntologyURI);
+    }
+
+    @Override
+    public boolean isInGraphAppendMode() {
+        return Boolean.valueOf(conf.get(APPEND_OTHER_ENHANCEMENT_GRAPHS).toString()).booleanValue();
+    }
+
+    @Override
+    public void setInGraphAppendMode(boolean b) {
+        conf.put(APPEND_OTHER_ENHANCEMENT_GRAPHS, b);
+
+    }
+
+    @Override
+    public boolean isEntityHubUsed() {
+        return Boolean.valueOf(conf.get(USE_ENTITY_HUB).toString()).booleanValue();
+    }
+
+    @Override
+    public void setEntityHubUsed(boolean b) {
+        conf.put(USE_ENTITY_HUB, b);
+
+    }
 
 }

Modified: incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngine.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngine.java Fri Mar 16 13:34:23 2012
@@ -105,7 +105,7 @@ import org.slf4j.LoggerFactory;
 
 @Component(configurationFactory = true, policy = ConfigurationPolicy.REQUIRE, specVersion = "1.1", metatype = true, immediate = true, inherit = true)
 @Service
-@Properties(value = {@Property(name = EnhancementEngine.PROPERTY_NAME)
+@Properties(value = {@Property(name = EnhancementEngine.PROPERTY_NAME, value = "seo_refactoring")
 
 })
 public class RefactorEnhancementEngine extends AbstractEnhancementEngine<RuntimeException,RuntimeException>
@@ -115,22 +115,22 @@ public class RefactorEnhancementEngine e
      * TODO This are the scope and recipe IDs to be used by this implementation In future implementation this
      * will be configurable
      */
-    @Property()
+    @Property(value = "seo")
     public static final String SCOPE = RefactorEnhancementEngineConf.SCOPE;
 
-    @Property()
+    @Property(value = "")
     public static final String RECIPE_LOCATION = RefactorEnhancementEngineConf.RECIPE_LOCATION;
 
-    @Property()
+    @Property(value = "google_rich_snippet_rules")
     public static final String RECIPE_ID = RefactorEnhancementEngineConf.RECIPE_ID;
 
-    @Property(cardinality = 1000)
+    @Property(cardinality = 1000, value = {"http://ontologydesignpatterns.org/ont/iks/kres/dbpedia_demo.owl"})
     public static final String SCOPE_CORE_ONTOLOGY = RefactorEnhancementEngineConf.SCOPE_CORE_ONTOLOGY;
 
-    @Property()
+    @Property(boolValue = true)
     public static final String APPEND_OTHER_ENHANCEMENT_GRAPHS = RefactorEnhancementEngineConf.APPEND_OTHER_ENHANCEMENT_GRAPHS;
 
-    @Property()
+    @Property(boolValue = true)
     public static final String USE_ENTITY_HUB = RefactorEnhancementEngineConf.USE_ENTITY_HUB;
 
     @Reference
@@ -387,7 +387,8 @@ public class RefactorEnhancementEngine e
                     mGraph.addAll(OWLAPIToClerezzaConverter.owlOntologyToClerezzaTriples(ontology));
                     log.debug("Metadata of the content passd have been substituted", this);
                 } else {
-                    mGraph.removeAll(mGraph);
+                    // mGraph.removeAll(mGraph);
+                    mGraph.clear();
                     mGraph.addAll(OWLAPIToClerezzaConverter.owlOntologyToClerezzaTriples(ontology));
                     log.debug("Metadata of the content is appended to the existent one", this);
                 }

Modified: incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngineConf.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngineConf.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngineConf.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/RefactorEnhancementEngineConf.java Fri Mar 16 13:34:23 2012
@@ -17,10 +17,8 @@
 
 package org.apache.stanbol.enhancer.engines.refactor;
 
-import org.apache.felix.scr.annotations.Property;
-
 /**
- *
+ * 
  * @author anuzzolese
  * @author alberto.musetti
  * 
@@ -36,58 +34,55 @@ public interface RefactorEnhancementEngi
      * The OntoNet scope that the engine should use.
      */
     String SCOPE = "org.apache.stanbol.enhancer.engines.refactor.scope";
-    
+
     /**
      * The location from which the recipe is loaded.
      */
     String RECIPE_LOCATION = "org.apache.stanbol.enhancer.engines.refactor.recipe.location";
-    
+
     /**
      * The ID used for identifying the recipe in the RuleStore.
      */
     String RECIPE_ID = "org.apache.stanbol.enhancer.engines.refactor.recipe.id";
-    
+
     /**
      * The set of ontology URIs that should be loaded in the core space of the scope.
      */
     String SCOPE_CORE_ONTOLOGY = "org.apache.stanbol.enhancer.engines.refactor.scope.core.ontology";
-    
+
     /**
-     * If true: the previously generated RDF is deleted and substituted with the new one. 
-     * If false: the new one is appended to the old RDF. 
-     * Possible value in the configuration: true or false.
+     * If true: the previously generated RDF is deleted and substituted with the new one. If false: the new
+     * one is appended to the old RDF. Possible value in the configuration: true or false.
      */
     String APPEND_OTHER_ENHANCEMENT_GRAPHS = "org.apache.stanbol.enhancer.engines.refactor.append.graphs";
-    
+
     /**
-     * If true: entities are fetched via the EntityHub. 
-     * If false: entities are fetched on-line. 
-     * Possible value in the configuration: true or false.
-     */
-    String USE_ENTITY_HUB  = "org.apache.stanbol.enhancer.engines.refactor.entityhub";
-    
-    
+     * If true: entities are fetched via the EntityHub. If false: entities are fetched on-line. Possible value
+     * in the configuration: true or false.
+     */
+    String USE_ENTITY_HUB = "org.apache.stanbol.enhancer.engines.refactor.entityhub";
+
     public String getScope();
-    
+
     public void setScope(String scopeId);
-    
+
     public String getRecipeLocation();
-    
+
     public void setRecipeLocation(String recipeLocation);
-    
+
     public String getRecipeId();
-    
+
     public void setRecipeId(String recipeId);
-    
+
     public String[] getScopeCoreOntology();
-    
+
     public void setScopeCoreOntology(String[] coreOntologyIRI);
-    
+
     public boolean isInGraphAppendMode();
-    
+
     public void setInGraphAppendMode(boolean b);
-    
+
     public boolean isEntityHubUsed();
-    
+
     public void setEntityHubUsed(boolean b);
 }

Modified: incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/Dereferencer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/Dereferencer.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/Dereferencer.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/Dereferencer.java Fri Mar 16 13:34:23 2012
@@ -1,19 +1,19 @@
 /*
-* 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.
+ */
 package org.apache.stanbol.enhancer.engines.refactor.dereferencer;
 
 import java.io.File;
@@ -32,85 +32,82 @@ import org.apache.felix.scr.annotations.
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * 
  * @author andrea.nuzzolese
- *
+ * 
  */
 @Component(immediate = true, metatype = true)
 @Service(IDereferencer.class)
 public class Dereferencer implements IDereferencer {
 
-	private final Logger log = LoggerFactory.getLogger(getClass());
-	
-	@Override
-	public InputStream resolve(String location) throws FileNotFoundException {
-		InputStream inputStream = null;
-		try {
-			URI uri = new URI(location);
-			if(uri.isAbsolute()){
-				log.info("The Refactor is fecthing on-line the graph associated to the resource "+location);
-				URL url = new URL(location);
-				
-				URLConnection connection= url.openConnection();
-				connection.addRequestProperty("Accept","application/rdf+xml");
-				inputStream = connection.getInputStream();
-			}
-			else{
-				log.info("The Refactor is fecthing on your local machine the graph associated to the resource "+location);
-				inputStream = new FileInputStream(location);
-			}
-			
-		} catch (MalformedURLException e) {
-			e.printStackTrace();
-			throw new FileNotFoundException();
-		} catch (IOException e) {
-			throw new FileNotFoundException();
-		} catch (URISyntaxException e) {
-			e.printStackTrace();
-			throw new FileNotFoundException();
-		}
-		
-		return inputStream;
-		
-	}
-	
-	public boolean isAbsoluteLocation(String location){
-		URI uri;
-		
-		try {
-			uri = new URI(location);
-			return uri.isAbsolute();
-		} catch (URISyntaxException e) {
-			e.printStackTrace();
-		}
-		
-		return false;
-		
-	}
-	
-	
-	public String getLocalName(String location) throws FileNotFoundException {
-		String localName = null;
-		try {
-			URI uri = new URI(location);
-			if(uri.isAbsolute()){
-				localName = location;
-			}
-			else{
-				System.out.println("URL : not absolute "+location);
-				File file = new File(location);
-				localName = file.getName();
-			}
-			
-		} catch (URISyntaxException e) {
-			e.printStackTrace();
-			throw new FileNotFoundException();
-		}
-		
-		return localName;
-		
-	}
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public InputStream resolve(String location) throws FileNotFoundException {
+        InputStream inputStream = null;
+        try {
+            URI uri = new URI(location);
+            if (uri.isAbsolute()) {
+                log.info("The Refactor is fecthing on-line the graph associated to the resource " + location);
+                URL url = new URL(location);
+
+                URLConnection connection = url.openConnection();
+                connection.addRequestProperty("Accept", "application/rdf+xml");
+                inputStream = connection.getInputStream();
+            } else {
+                log.info("The Refactor is fecthing on your local machine the graph associated to the resource "
+                         + location);
+                inputStream = new FileInputStream(location);
+            }
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+            throw new FileNotFoundException();
+        } catch (IOException e) {
+            throw new FileNotFoundException();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+            throw new FileNotFoundException();
+        }
+
+        return inputStream;
+
+    }
+
+    public boolean isAbsoluteLocation(String location) {
+        URI uri;
+
+        try {
+            uri = new URI(location);
+            return uri.isAbsolute();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        }
+
+        return false;
+
+    }
+
+    public String getLocalName(String location) throws FileNotFoundException {
+        String localName = null;
+        try {
+            URI uri = new URI(location);
+            if (uri.isAbsolute()) {
+                localName = location;
+            } else {
+                System.out.println("URL : not absolute " + location);
+                File file = new File(location);
+                localName = file.getName();
+            }
+
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+            throw new FileNotFoundException();
+        }
+
+        return localName;
+
+    }
 
 }

Modified: incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/IDereferencer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/IDereferencer.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/IDereferencer.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/refactor/src/main/java/org/apache/stanbol/enhancer/engines/refactor/dereferencer/IDereferencer.java Fri Mar 16 13:34:23 2012
@@ -1,19 +1,19 @@
 /*
-* 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.
+ */
 package org.apache.stanbol.enhancer.engines.refactor.dereferencer;
 
 import java.io.FileNotFoundException;
@@ -22,18 +22,19 @@ import java.io.InputStream;
 /**
  * 
  * @author andrea.nuzzolese
- *
+ * 
  */
 public interface IDereferencer {
 
-	/**
-	 * 
-	 * The resolve method dereferences location and returns input streams.
-	 * Locations can be local to the file system or remote URIs.
-	 * 
-	 * @param location
-	 * @return {@link InputStream} if the location is resolved. Otherwise a {@link FileNotFoundException} is thrown.
-	 * @throws FileNotFoundException
-	 */
+    /**
+     * 
+     * The resolve method dereferences location and returns input streams. Locations can be local to the file
+     * system or remote URIs.
+     * 
+     * @param location
+     * @return {@link InputStream} if the location is resolved. Otherwise a {@link FileNotFoundException} is
+     *         thrown.
+     * @throws FileNotFoundException
+     */
     InputStream resolve(String location) throws FileNotFoundException;
 }

Modified: incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/JobsResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/JobsResource.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/JobsResource.java (original)
+++ incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/JobsResource.java Fri Mar 16 13:34:23 2012
@@ -16,21 +16,28 @@
  */
 package org.apache.stanbol.reasoners.web.resources;
 
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
+import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
+
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
 import javax.servlet.ServletContext;
 import javax.ws.rs.GET;
+import javax.ws.rs.OPTIONS;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
 
+import org.apache.stanbol.commons.jobs.api.JobManager;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
-import org.apache.stanbol.commons.jobs.api.JobManager;
 import org.apache.stanbol.reasoners.web.utils.ReasoningServiceResult;
 import org.apache.stanbol.reasoners.web.utils.ResponseTaskBuilder;
 import org.slf4j.Logger;
@@ -65,12 +72,17 @@ public class JobsResource extends BaseSt
      */
     @GET
     @Path("/{jid}")
-    public Response get(@PathParam("jid") String id) {
+    public Response get(@PathParam("jid") String id,
+                        @Context HttpHeaders headers) {
+        
+        
         log.info("Pinging job {}", id);
 
         // No id
         if(id == null || id.equals("")){
-            return Response.status(Response.Status.BAD_REQUEST).build();
+            ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         }
         
         JobManager m = getJobManager();
@@ -109,11 +121,22 @@ public class JobsResource extends BaseSt
                 String jobService = new StringBuilder().append(getPublicBaseUri()).append("jobs/").append(id).toString();
                 this.jobLocation = jobService;
                 Viewable viewable = new Viewable("404.ftl",this);
-                return Response.status(404).header("Content-Location", jobService).header("Content-type","text/html").entity( viewable ).build();
+                //return Response.status(404).header("Content-Location", jobService).header("Content-type","text/html").entity( viewable ).build();
+                
+                ResponseBuilder rb = Response.status(Status.NOT_FOUND);
+                rb.header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_HTML+ "; charset=utf-8");
+                addCORSOrigin(servletContext, rb, headers);
+                rb.entity(viewable);
+                return rb.build();
             }
         } else {
             log.info("No job found with id {}", id);
-            return Response.status(Response.Status.NOT_FOUND).build();
+            //return Response.status(Response.Status.NOT_FOUND).build();
+            ResponseBuilder rb = Response.status(Status.NOT_FOUND);
+            rb.header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_HTML+ "; charset=utf-8");
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
+            
         }
     }
 
@@ -135,4 +158,11 @@ public class JobsResource extends BaseSt
         log.debug("(getJobManager()) ");
         return (JobManager) ContextHelper.getServiceFromContext(JobManager.class, this.context);
     }
+    
+    @OPTIONS
+    public Response handleCorsPreflight(@Context HttpHeaders headers) {
+        ResponseBuilder rb = Response.ok();
+        enableCORS(servletContext, rb, headers);
+        return rb.build();
+    }
 }

Modified: incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServiceTaskResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServiceTaskResource.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServiceTaskResource.java (original)
+++ incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServiceTaskResource.java Fri Mar 16 13:34:23 2012
@@ -19,6 +19,7 @@ package org.apache.stanbol.reasoners.web
 import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
 import static javax.ws.rs.core.MediaType.MULTIPART_FORM_DATA;
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
 
 import java.io.File;
 import java.net.MalformedURLException;
@@ -44,6 +45,7 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
 
 import org.apache.clerezza.rdf.core.access.TcManager;
 import org.apache.stanbol.commons.jobs.api.JobManager;
@@ -299,7 +301,11 @@ public class ReasoningServiceTaskResourc
         // If all parameters are missing we produce the service/task welcome
         // page
         if (this.parameters.isEmpty()) {
-            return Response.ok(new Viewable("index", this)).build();
+            //return Response.ok(new Viewable("index", this)).build();
+            ResponseBuilder rb = Response.ok(new Viewable("index", this));
+            rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         }
         try {
             String target = getTarget();

Modified: incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource.java (original)
+++ incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/resources/ReasoningServicesResource.java Fri Mar 16 13:34:23 2012
@@ -17,6 +17,7 @@
 package org.apache.stanbol.reasoners.web.resources;
 
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -30,7 +31,9 @@ import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.Response.Status;
 import javax.ws.rs.core.UriInfo;
 
@@ -69,8 +72,11 @@ public class ReasoningServicesResource e
 
     @GET
     @Produces(TEXT_HTML)
-    public Response getDocumentation() {
-        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
+    public Response getDocumentation(@Context HttpHeaders headers) {
+        ResponseBuilder rb = Response.ok(new Viewable("index", this));
+        rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+        addCORSOrigin(servletContext, rb, headers);
+        return rb.build();
     }
 
     private ReasoningService<?,?,?> service = null;
@@ -78,14 +84,23 @@ public class ReasoningServicesResource e
     @GET
     @Produces(TEXT_HTML)
     @Path("{service}")
-    public Response getServiceDocumentation(@PathParam(value = "service") String serviceID) {
+    public Response getServiceDocumentation(@PathParam(value = "service") String serviceID,
+                                            @Context HttpHeaders headers) {
     	try {
 			this.service = this.getServicesManager().get(serviceID);
 		} catch (UnboundReasoningServiceException e) {
 			log.info("Service {} is not bound", serviceID);
-			return Response.status(Status.NOT_FOUND).build();
+			
+			ResponseBuilder rb = Response.status(Status.NOT_FOUND);
+	        rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+	        addCORSOrigin(servletContext, rb, headers);
+	        return rb.build();
+			
 		}
-        return Response.ok(new Viewable("service", this), TEXT_HTML).build();
+    	 ResponseBuilder rb = Response.ok(new Viewable("service", this));
+         rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+         addCORSOrigin(servletContext, rb, headers);
+         return rb.build();
     }
     
     private ReasoningServicesManager getServicesManager() {

Modified: incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/utils/ResponseTaskBuilder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/utils/ResponseTaskBuilder.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/utils/ResponseTaskBuilder.java (original)
+++ incubator/stanbol/trunk/reasoners/web/src/main/java/org/apache/stanbol/reasoners/web/utils/ResponseTaskBuilder.java Fri Mar 16 13:34:23 2012
@@ -17,6 +17,7 @@
 package org.apache.stanbol.reasoners.web.utils;
 
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
 
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
@@ -30,6 +31,7 @@ import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.Response.Status;
 
 import org.apache.stanbol.commons.web.base.format.KRFormat;
@@ -74,7 +76,10 @@ public class ResponseTaskBuilder {
     }
     
     private Response build(){
-        return Response.ok().build();
+        //return Response.ok().build();
+        ResponseBuilder rb = Response.ok();
+        addCORSOrigin(context, rb, headers);
+        return rb.build();
     }
     
     /**
@@ -87,13 +92,27 @@ public class ResponseTaskBuilder {
     private Response build(Object object){
         if (isHTML()) {
             OutputStream out = stream(object);
-            return Response.ok(
+            
+            ResponseBuilder rb = Response.ok( 
+                   new Viewable("result",
+                       new ReasoningPrettyResultResource(
+                           context, info, out)
+                       )
+                    );
+            
+            rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+            addCORSOrigin(context, rb, headers);
+            return rb.build();
+        /*    return Response.ok(
                     new Viewable("result",
                             new ReasoningPrettyResultResource(
                                     context, info, out)),
-                    TEXT_HTML).build();
+                    TEXT_HTML).build();*/
         } else {
-            return Response.ok(object).build();
+            //return Response.ok(object).build();
+            ResponseBuilder rb = Response.ok( object );
+            addCORSOrigin(context, rb, headers);
+            return rb.build();
         }
     }
     
@@ -170,29 +189,55 @@ public class ResponseTaskBuilder {
         if (isHTML()) {
             if (isConsistent) {
                 log.debug("The input is consistent");
-                return Response.ok(
+                
+                ResponseBuilder rb = Response.ok( 
+                    new Viewable("result",
+                        new ReasoningPrettyResultResource(
+                            context, info, "The input is consistent :)")
+                        )
+                     );
+             
+                rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+                addCORSOrigin(context, rb, headers);
+                return rb.build();
+             
+               /*return Response.ok(
                         new Viewable("result",
                                 new ReasoningPrettyResultResource(
                                         context, info,
                                         "The input is consistent :)")),
-                        TEXT_HTML).build();
+                        TEXT_HTML).build();*/
             } else {
                 log.debug("The input is not consistent");
-                return Response
+                ResponseBuilder rb = Response.status(Status.CONFLICT);
+                rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+                addCORSOrigin(context, rb, headers);
+                rb.entity(new Viewable("result", new ReasoningPrettyResultResource(context, info,
+                        "The input is NOT consistent :(")));
+                return rb.build();
+                
+                /*return Response
                         .status(Status.CONFLICT)
                         .entity(new Viewable("result",
                                 new ReasoningPrettyResultResource(
                                         context, info,
                                         "The input is NOT consistent :(")))
-                        .type(TEXT_HTML).build();
+                        .type(TEXT_HTML).build();*/
             }
         } else {
             if (isConsistent) {
                 log.debug("The input is consistent");
-                return Response.ok("The input is consistent :)").build();
+                //return Response.ok("The input is consistent :)").build();
+                ResponseBuilder rb = Response.ok("The input is consistent :)");
+                addCORSOrigin(context, rb, headers);
+                return rb.build();
             } else {
                 log.debug("The input is not consistent");
-                return Response.status(Status.CONFLICT).build();
+                //return Response.status(Status.CONFLICT).build();
+                
+                ResponseBuilder rb = Response.status(Status.CONFLICT);
+                addCORSOrigin(context, rb, headers);
+                return rb.build();
             }
         }
     }

Modified: incubator/stanbol/trunk/reengineer/web/src/main/java/org/apache/stanbol/reengineer/web/resources/ReengineerResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/reengineer/web/src/main/java/org/apache/stanbol/reengineer/web/resources/ReengineerResource.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/reengineer/web/src/main/java/org/apache/stanbol/reengineer/web/resources/ReengineerResource.java (original)
+++ incubator/stanbol/trunk/reengineer/web/src/main/java/org/apache/stanbol/reengineer/web/resources/ReengineerResource.java Fri Mar 16 13:34:23 2012
@@ -18,6 +18,8 @@
 package org.apache.stanbol.reengineer.web.resources;
 
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
+import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
 
 import java.io.InputStream;
 import java.util.Collection;
@@ -27,6 +29,7 @@ import javax.servlet.http.HttpServletReq
 import javax.ws.rs.Consumes;
 import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
+import javax.ws.rs.OPTIONS;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
@@ -35,6 +38,8 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
 
 import org.apache.clerezza.rdf.core.Literal;
 import org.apache.clerezza.rdf.core.LiteralFactory;
@@ -93,12 +98,17 @@ public class ReengineerResource extends 
     public Response countReengineers(@Context HttpHeaders headers) {
 
         return Response.ok(reengineeringManager.countReengineers()).build();
+        
+        
     }
 
     @GET
     @Produces(TEXT_HTML)
-    public Response get() {
-        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
+    public Response get(@Context HttpHeaders headers) {
+        ResponseBuilder rb = Response.ok(new Viewable("index", this));
+        rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+        addCORSOrigin(servletContext, rb, headers);
+        return rb.build();
     }
 
     @GET
@@ -114,7 +124,11 @@ public class ReengineerResource extends 
             mGraph.add(new TripleImpl(semionRef, hasReengineer, reenginnerLiteral));
         }
 
-        return Response.ok(mGraph).build();
+        //return Response.ok(mGraph).build();
+        ResponseBuilder rb = Response.ok(mGraph);
+        rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+        addCORSOrigin(servletContext, rb, headers);
+        return rb.build();
     }
 
     @POST
@@ -125,12 +139,15 @@ public class ReengineerResource extends 
                                   @Context HttpHeaders headers,
                                   @Context HttpServletRequest httpServletRequest) {
 
-        System.out.println("Reengineering: " + inputType);
+        log.debug("Reengineering: " + inputType);
         int reengineerType = -1;
         try {
             reengineerType = ReengineerType.getType(inputType);
         } catch (UnsupportedReengineerException e) {
-            Response.status(404).build();
+            //Response.status(404).build();
+            ResponseBuilder rb = Response.status(Status.NOT_FOUND);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         }
 
         try {
@@ -146,23 +163,40 @@ public class ReengineerResource extends 
                               + httpServletRequest.getLocalPort();
                 if (outputGraph == null || outputGraph.equals("")) {
                     ontology = reengineeringManager.performReengineering(servletPath, null, dataSource);
-                    return Response.ok().build();
+                    //return Response.ok().build();
+                    ResponseBuilder rb = Response.ok();
+                    addCORSOrigin(servletContext, rb, headers);
+                    return rb.build();
+                    
                 } else {
                     ontology = reengineeringManager.performReengineering(servletPath,
                         IRI.create(outputGraph), dataSource);
 
                     store(ontology);
-                    return Response.ok(ontology).build();
+                    //return Response.ok(ontology).build();
+                    ResponseBuilder rb = Response.ok(ontology);
+                    addCORSOrigin(servletContext, rb, headers);
+                    return rb.build();
                 }
             } catch (ReengineeringException e) {
                 e.printStackTrace();
-                return Response.status(500).build();
+                //return Response.status(500).build();
+                ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             }
 
         } catch (NoSuchDataSourceExpection e) {
-            return Response.status(415).build();
+            //return Response.status(415).build();
+            ResponseBuilder rb = Response.status(415);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
+            
         } catch (InvalidDataSourceForTypeSelectedException e) {
-            return Response.status(204).build();
+            //return Response.status(204).build();
+            ResponseBuilder rb = Response.status(204);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         }
 
     }
@@ -182,7 +216,6 @@ public class ReengineerResource extends 
                                     @Context HttpServletRequest httpServletRequest) {
 
         log.info("There are " + tcManager.listMGraphs().size() + " mGraphs");
-        System.out.println("There are " + tcManager.listMGraphs().size() + " mGraphs");
 
         // UriRef uri = ContentItemHelper.makeDefaultUri(databaseURI, databaseURI.getBytes());
         ConnectionSettings connectionSettings = new DBConnectionSettings(protocol, host, port,
@@ -198,17 +231,31 @@ public class ReengineerResource extends 
             try {
                 ontology = reengineeringManager.performReengineering(servletPath, IRI.create(outputGraph),
                     dataSource);
-                return Response.ok(ontology).build();
+                //return Response.ok(ontology).build();
+                ResponseBuilder rb = Response.ok(ontology);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
+                
             } catch (ReengineeringException e) {
-                return Response.status(500).build();
+                //return Response.status(500).build();
+                
+                ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             }
 
         } else {
             try {
                 reengineeringManager.performReengineering(servletPath, null, dataSource);
-                return Response.ok().build();
+                //return Response.ok().build();
+                ResponseBuilder rb = Response.ok();
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             } catch (ReengineeringException e) {
-                return Response.status(500).build();
+                //return Response.status(500).build();
+                ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             }
         }
     }
@@ -228,7 +275,6 @@ public class ReengineerResource extends 
                                           @Context HttpServletRequest httpServletRequest) {
 
         log.info("There are " + tcManager.listMGraphs().size() + " mGraphs");
-        System.out.println("There are " + tcManager.listMGraphs().size() + " mGraphs");
 
         // UriRef uri = ContentItemHelper.makeDefaultUri(databaseURI, databaseURI.getBytes());
         ConnectionSettings connectionSettings = new DBConnectionSettings(protocol, host, port,
@@ -248,16 +294,28 @@ public class ReengineerResource extends 
                  * MediaType mediaType = headers.getMediaType(); String res =
                  * OntologyRenderUtils.renderOntology(ontology, mediaType.getType());
                  */
-                return Response.ok(ontology).build();
+                //return Response.ok(ontology).build();
+                ResponseBuilder rb = Response.ok(ontology);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             } catch (ReengineeringException e) {
-                return Response.status(500).build();
+                //return Response.status(500).build();
+                ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             }
         } else {
             try {
                 reengineeringManager.performSchemaReengineering(servletPath, null, dataSource);
-                return Response.ok().build();
+                //return Response.ok().build();
+                ResponseBuilder rb = Response.ok();
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             } catch (ReengineeringException e) {
-                return Response.status(500).build();
+                //return Response.status(500).build();
+                ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             }
         }
 
@@ -276,7 +334,9 @@ public class ReengineerResource extends 
         try {
             reengineerType = ReengineerType.getType(inputType);
         } catch (UnsupportedReengineerException e) {
-            Response.status(404).build();
+            ResponseBuilder rb = Response.status(Status.NOT_FOUND);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         }
 
         try {
@@ -290,20 +350,31 @@ public class ReengineerResource extends 
                               + httpServletRequest.getLocalPort();
                 if (outputGraph == null) {
                     ontology = reengineeringManager.performSchemaReengineering(servletPath, null, dataSource);
-                    return Response.ok().build();
+                    ResponseBuilder rb = Response.ok();
+                    addCORSOrigin(servletContext, rb, headers);
+                    return rb.build();
                 } else {
                     ontology = reengineeringManager.performSchemaReengineering(servletPath,
                         IRI.create(outputGraph), dataSource);
-                    return Response.ok(ontology).build();
+                    ResponseBuilder rb = Response.ok(ontology);
+                    addCORSOrigin(servletContext, rb, headers);
+                    return rb.build();
                 }
             } catch (ReengineeringException e) {
-                return Response.status(500).build();
+                //return Response.status(500).build();
+                ResponseBuilder rb = Response.status(Status.BAD_REQUEST);
+                addCORSOrigin(servletContext, rb, headers);
+                return rb.build();
             }
 
         } catch (NoSuchDataSourceExpection e) {
-            return Response.status(415).build();
+            ResponseBuilder rb = Response.status(415);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         } catch (InvalidDataSourceForTypeSelectedException e) {
-            return Response.status(204).build();
+            ResponseBuilder rb = Response.status(204);
+            addCORSOrigin(servletContext, rb, headers);
+            return rb.build();
         }
 
     }
@@ -331,5 +402,12 @@ public class ReengineerResource extends 
 
         mg2.addAll(mg);
     }
+    
+    @OPTIONS
+    public Response handleCorsPreflight(@Context HttpHeaders headers) {
+        ResponseBuilder rb = Response.ok();
+        enableCORS(servletContext, rb, headers);
+        return rb.build();
+    }
 
 }

Modified: incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java (original)
+++ incubator/stanbol/trunk/rules/base/src/main/java/org/apache/stanbol/rules/base/api/RuleAtom.java Fri Mar 16 13:34:23 2012
@@ -23,7 +23,7 @@ import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.Resource;
 
 public interface RuleAtom {
-
+    
 	Resource toSWRL(Model model);
 	SPARQLObject toSPARQL();
 	SWRLAtom toSWRL(OWLDataFactory factory);

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleParser.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleParser.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleParser.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/RuleParser.java Fri Mar 16 13:34:23 2012
@@ -21,6 +21,8 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.stanbol.rules.base.SWRL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.hp.hpl.jena.ontology.OntModel;
 import com.hp.hpl.jena.ontology.OntModelSpec;
@@ -36,6 +38,8 @@ import com.hp.hpl.jena.vocabulary.RDF;
 
 public class RuleParser {
 
+    private Logger log = LoggerFactory.getLogger(getClass());
+    
 	public static String ruleNS = "http://www.prova.org/rules.rdf#";
 
 	private Model sourceModel;
@@ -83,7 +87,6 @@ public class RuleParser {
 		
 		Resource imp = null;
 		
-		System.out.println("INPUT");
 		//inputOntology.write(System.out);
 		
 		String[] ruleSplit = ruleString.split("->");
@@ -94,8 +97,8 @@ public class RuleParser {
 			//rule divided into body and head
 			String bodyString = ruleSplit[0];
 			String headString = ruleSplit[1];
-			System.out.println("BODY : "+bodyString);
-			System.out.println("HEAD : "+headString);
+			log.debug("BODY : "+bodyString);
+			log.debug("HEAD : "+headString);
 			
 			//RDFList list = createList(bodyString);
 			
@@ -176,7 +179,6 @@ public class RuleParser {
 		}
 		if(!found){
 			variableResource = ruleOntology.createResource(variable, SWRL.Variable);
-			System.out.println("LA CREO");
 		}
 
 		return variableResource;
@@ -186,7 +188,7 @@ public class RuleParser {
 		
 		Resource sameASAtom = ruleOntology.createResource(SWRL.SameIndividualAtom);
 		String argumentString = token.substring(openPar+1, closePar);
-		System.out.println("ARGUMENT STRING : "+argumentString);
+		log.debug("ARGUMENT STRING : "+argumentString);
 		
 		String[] arguments = argumentString.split(",");
 		if(arguments.length == 2){
@@ -194,7 +196,7 @@ public class RuleParser {
 			for(int j=0; j<arguments.length; j++){
 				String argument = arguments[j];
 				argument = argument.replaceAll(" ", "");
-				System.out.println("ARGUMENT : "+argument);
+				log.debug("ARGUMENT : "+argument);
 				RDFNode argRes;
 				if(argument.startsWith("?")){
 					argRes = getSWRLVariable(argument);
@@ -222,7 +224,7 @@ public class RuleParser {
 		
 		Resource differentIndividualAtom = ruleOntology.createResource(SWRL.DifferentIndividualsAtom);
 		String argumentString = token.substring(openPar+1, closePar);
-		System.out.println("ARGUMENT STRING : "+argumentString);
+		log.debug("ARGUMENT STRING : "+argumentString);
 		
 		String[] arguments = argumentString.split(",");
 		if(arguments.length == 2){
@@ -230,7 +232,7 @@ public class RuleParser {
 			for(int j=0; j<arguments.length; j++){
 				String argument = arguments[j];
 				argument = argument.replaceAll(" ", "");
-				System.out.println("ARGUMENT : "+argument);
+				log.debug("ARGUMENT : "+argument);
 				RDFNode argRes;
 				if(argument.startsWith("?")){
 					argRes = getSWRLVariable(argument);
@@ -258,7 +260,7 @@ public class RuleParser {
 		
 		Resource classAtom = ruleOntology.createResource(SWRL.ClassAtom);
 		String argumentString = token.substring(openPar+1, closePar);
-		System.out.println("ARGUMENT STRING : "+argumentString);
+		log.debug("ARGUMENT STRING : "+argumentString);
 		
 		classAtom.addProperty(SWRL.classPredicate, ontResource);
 		
@@ -267,7 +269,7 @@ public class RuleParser {
 		if(arguments.length == 1){
 			String argument = arguments[0];
 			argument = argument.replaceAll(" ", "");
-			System.out.println("ARGUMENT : "+argument);
+			log.debug("ARGUMENT : "+argument);
 			RDFNode argRes;
 			if(argument.startsWith("?")){
 				argRes = getSWRLVariable(argument);
@@ -286,7 +288,7 @@ public class RuleParser {
 	private Resource createIndividualAtom(OntResource ontResource, String token, int openPar, int closePar){
 		Resource individualPropertyAtom = ruleOntology.createResource(SWRL.IndividualPropertyAtom);
 		String argumentString = token.substring(openPar+1, closePar);
-		System.out.println("ARGUMENT STRING INDIVIDUAL PROPERTY ATOM: "+argumentString);
+		log.debug("ARGUMENT STRING INDIVIDUAL PROPERTY ATOM: "+argumentString);
 		
 		individualPropertyAtom.addProperty(SWRL.propertyPredicate, ontResource);
 		
@@ -296,7 +298,7 @@ public class RuleParser {
 			for(int j=0; j<arguments.length; j++){
 				String argument = arguments[j];
 				argument = argument.replaceAll(" ", "");
-				System.out.println("ARGUMENT : "+argument);
+				log.debug("ARGUMENT : "+argument);
 				RDFNode argRes;
 				if(argument.startsWith("?")){
 					argRes = getSWRLVariable(argument);
@@ -324,7 +326,7 @@ public class RuleParser {
 		
 		Resource databaluedPropertyAtom = ruleOntology.createResource(SWRL.DatavaluedPropertyAtom);
 		String argumentString = token.substring(openPar+1, closePar);
-		System.out.println("ARGUMENT STRING : "+argumentString);
+		log.debug("ARGUMENT STRING : "+argumentString);
 		
 		databaluedPropertyAtom.addProperty(SWRL.propertyPredicate, ontResource);
 		
@@ -334,7 +336,7 @@ public class RuleParser {
 			for(int j=0; j<arguments.length; j++){
 				String argument = arguments[j];
 				argument = argument.replaceAll(" ", "");
-				System.out.println("ARGUMENT : "+argument);
+				log.debug("ARGUMENT : "+argument);
 				RDFNode argRes;
 				if(argument.startsWith("?")){
 					argRes = getSWRLVariable(argument);
@@ -363,7 +365,7 @@ public class RuleParser {
 		
 		Resource dataRangeAtom = ruleOntology.createResource(SWRL.DataRangeAtom);
 		String argumentString = token.substring(openPar+1, closePar);
-		System.out.println("ARGUMENT STRING : "+argumentString);
+		log.debug("ARGUMENT STRING : "+argumentString);
 		
 		dataRangeAtom.addProperty(SWRL.propertyPredicate, ontResource);
 		
@@ -373,7 +375,7 @@ public class RuleParser {
 		
 			String argument = arguments[0];
 			argument = argument.replaceAll(" ", "");
-			System.out.println("ARGUMENT : "+argument);
+			log.debug("ARGUMENT : "+argument);
 			RDFNode argRes;
 			if(argument.startsWith("?")){
 				argRes = getSWRLVariable(argument);
@@ -406,7 +408,7 @@ public class RuleParser {
 				int closePar = token.indexOf(")");
 
 				String atom = token.substring(0, openPar);
-				System.out.println("ATOM : "+atom);
+				log.debug("ATOM : "+atom);
 
 				Resource atomResource = null;
 
@@ -425,50 +427,49 @@ public class RuleParser {
 						String atomName = atomComponents[1];
 
 						OntResource ontResource = null;
-						System.out.println("atomNSPrefix : "+atomNSPrefix);
+						log.debug("atomNSPrefix : "+atomNSPrefix);
 						//ruleOntology.write(System.out);
 						String namespaceURI = ruleOntology.getNsPrefixURI(atomNSPrefix);
 
-						System.out.println("SEMION RULE PARSER : ontology "+namespaceURI.replace("#", ""));
+						log.debug("SEMION RULE PARSER : ontology "+namespaceURI.replace("#", ""));
 
 						OntModel ontModelExternal = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
 						ontModelExternal.read(namespaceURI.replace("#", ""));
 
 						ontResource = ontModelExternal.getOntResource(namespaceURI+atomName);
 
-						System.out.println("NAME ATOOOOM: "+namespaceURI+atomName);
+						log.debug("NAME ATOOOOM: "+namespaceURI+atomName);
 
 						if(ontResource != null){
-							System.out.println("QUIIIIIIIIIIIIIIII");
 							if(ontResource.isClass()){
 								atomResource = createClassAtom(ontResource, token, openPar, closePar);
-								System.out.println(ontResource.getURI()+ " CLASS ");
+								log.debug(ontResource.getURI()+ " CLASS ");
 							}
 							else if(ontResource.isObjectProperty()){
 								atomResource = createIndividualAtom(ontResource, token, openPar, closePar);
-								System.out.println(ontResource.getURI()+ " OBJECT PROPERTY");
+								log.debug(ontResource.getURI()+ " OBJECT PROPERTY");
 							}
 							else if(ontResource.isDatatypeProperty()){
 								atomResource = createDatavaluedPropertyAtom(ontResource, token, openPar, closePar);
-								System.out.println(ontResource.getURI()+ " OBJECT DATATYPE PROPERTY");
+								log.debug(ontResource.getURI()+ " OBJECT DATATYPE PROPERTY");
 							}
 							else if(ontResource.isDataRange()){
 								atomResource = createDataRangeAtom(ontResource, token, openPar, closePar);
-								System.out.println(ontResource.getURI()+ " DATA RANGE");
+								log.debug(ontResource.getURI()+ " DATA RANGE");
 							}
 							else{
 								if(ontResource.isProperty()){
 									atomResource = createIndividualAtom(ontResource, token, openPar, closePar);
-									System.out.println(ontResource.getURI()+ " PROPERTY");
+									log.debug(ontResource.getURI()+ " PROPERTY");
 								}
 								else{
-									System.out.println(ontResource.getURI()+ " nil");
+									log.debug(ontResource.getURI()+ " nil");
 								}
 							}
 
 						}
 						else{
-							System.out.println("SONO UNA MINCHIA");
+							//log.debug("SONO UNA MINCHIA");
 						}
 
 
@@ -478,7 +479,7 @@ public class RuleParser {
 				if(atomResource != null){
 
 					list = list.cons(atomResource);
-					System.out.println("ENTRO QUI "+list.size());
+					log.debug("ENTRO QUI "+list.size());
 
 				}
 

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/CreateLabelAtom.java Fri Mar 16 13:34:23 2012
@@ -22,14 +22,16 @@ import org.apache.stanbol.rules.base.api
 import org.apache.stanbol.rules.manager.SPARQLFunction;
 import org.semanticweb.owlapi.model.OWLDataFactory;
 import org.semanticweb.owlapi.model.SWRLAtom;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
 
 
 public class CreateLabelAtom extends StringFunctionAtom {
 
+    private Logger log = LoggerFactory.getLogger(getClass());
 	
 	private StringFunctionAtom stringFunctionAtom;
 	
@@ -46,7 +48,7 @@ public class CreateLabelAtom extends Str
 	@Override
 	public SPARQLObject toSPARQL() {
 		
-		System.out.println("Argument instance of "+stringFunctionAtom.getClass().getCanonicalName());
+		log.debug("Argument instance of "+stringFunctionAtom.getClass().getCanonicalName());
 		
 		String argument = stringFunctionAtom.toSPARQL().getObject();
 		

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/LetAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/LetAtom.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/LetAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/LetAtom.java Fri Mar 16 13:34:23 2012
@@ -24,12 +24,16 @@ import org.apache.stanbol.rules.base.api
 import org.apache.stanbol.rules.manager.SPARQLFunction;
 import org.semanticweb.owlapi.model.OWLDataFactory;
 import org.semanticweb.owlapi.model.SWRLAtom;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.Resource;
 
 
 public class LetAtom implements RuleAtom {
+    
+    private Logger log = LoggerFactory.getLogger(getClass());
 
 	private URIResource variable;
 	private StringFunctionAtom parameterFunctionAtom;
@@ -47,11 +51,7 @@ public class LetAtom implements RuleAtom
 
 	@Override
 	public SPARQLObject toSPARQL() {
-		System.out.println();
-		System.out.println();
-		System.out.println("Parameter Function : "+parameterFunctionAtom.toSPARQL().getObject());
-		System.out.println();
-		System.out.println();
+		log.debug("Parameter Function : "+parameterFunctionAtom.toSPARQL().getObject());
 		String variableArgument = variable.toString().replace("http://kres.iks-project.eu/ontology/meta/variables#", "");
 		String let = "LET (?" + variableArgument + " := " + parameterFunctionAtom.toSPARQL().getObject() + ")";
 		SPARQLObject sparqlObject = new SPARQLFunction(let);

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/UObjectAtom.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/UObjectAtom.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/UObjectAtom.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/atoms/UObjectAtom.java Fri Mar 16 13:34:23 2012
@@ -51,7 +51,6 @@ public class UObjectAtom extends StringF
 			actualType = 1;
 		}
 		
-		System.out.println("UObject : " + argument);
 	}
 	
 	@Override

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRecipe.java Fri Mar 16 13:34:23 2012
@@ -44,6 +44,8 @@ import org.semanticweb.owlapi.model.OWLO
 import org.semanticweb.owlapi.model.OWLOntologyChange;
 import org.semanticweb.owlapi.model.OWLOntologyCreationException;
 import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This class will add new recipe to the KReSRuleStore used as input.<br/>
@@ -59,6 +61,8 @@ public class AddRecipe {
    private String owlIDrmi;
    private String owlID;
    private RuleStore storeaux;
+   
+   private Logger log = LoggerFactory.getLogger(getClass());
 
    /**
      * To create a list of imported ontlogy to be added as import declarations
@@ -183,7 +187,7 @@ public class AddRecipe {
                    owlmanager.addAxiom(owlmodel, objectPropAssertion);
                    ok = true;
                } else {
-                   System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                   log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                    ok = false;
                    return (ok);
                }
@@ -194,7 +198,7 @@ public class AddRecipe {
                    owlmanager.addAxiom(owlmodel, objectPropAssertion);
                    ok = true;
                } else {
-                   System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                   log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                    ok = false;
                    return (ok);
 
@@ -227,12 +231,12 @@ public class AddRecipe {
                            owlmanager.addAxiom(owlmodel, objectPropAssertion);
                            ok = true;
                        } else {
-                           System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                           log.error("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                            ok = false;
                            return (ok);
                        }
                    } else {
-                       System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                       log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                        ok = false;
                        return (ok);
                    }
@@ -246,19 +250,19 @@ public class AddRecipe {
                    owlmanager.addAxiom(owlmodel, objectPropAssertion);
                    ok = true;
                } else {
-                   System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                   log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                    ok = false;
                    return (ok);
                }
 
            } else {
-               System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+               log.error("The recipe with name " + recipeName + " already exists. Pleas check the name.");
                ok = false;
                return (ok);
            }
 
        } else {
-           System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+           log.error("The recipe with name and the set of rules cannot be empity or null.");
            ok = false;
            return (ok);
        }
@@ -308,13 +312,13 @@ public class AddRecipe {
                     ok = true;
 
             } else {
-                System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+                log.error("The recipe with name " + recipeName + " already exists. Pleas check the name.");
                 ok = false;
                 return (ok);
             }
 
         } else {
-            System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+            log.error("The recipe with name and the set of rules cannot be empity or null.");
             ok = false;
             return (ok);
         }
@@ -360,13 +364,13 @@ public class AddRecipe {
                 ok = true;
 
             } else {
-                System.err.println("The recipe with name " + recipeIRI + " already exists. Pleas check the name.");
+                log.error("The recipe with name " + recipeIRI + " already exists. Pleas check the name.");
                 ok = false;
                 return (ok);
             }
 
         } else {
-            System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+            log.error("The recipe with name and the set of rules cannot be empity or null.");
             ok = false;
             return (ok);
         }
@@ -415,7 +419,7 @@ public class AddRecipe {
                    owlmanager.addAxiom(owlmodel, objectPropAssertion);
                    ok = true;
                } else {
-                   System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                   log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                    ok = false;
                    return (ok);
                }
@@ -426,7 +430,7 @@ public class AddRecipe {
                    owlmanager.addAxiom(owlmodel, objectPropAssertion);
                    ok = true;
                } else {
-                   System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                   log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                    ok = false;
                    return (ok);
                }
@@ -467,12 +471,12 @@ public class AddRecipe {
                            owlmanager.addAxiom(owlmodel, objectPropAssertion);
                            ok = true;
                        } else {
-                           System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                           log.error("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                            ok = false;
                            return (ok);
                        }
                    } else {
-                       System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                       log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                        ok = false;
                        return (ok);
                    }
@@ -486,19 +490,19 @@ public class AddRecipe {
                    owlmanager.addAxiom(owlmodel, objectPropAssertion);
                    ok = true;
                } else {
-                   System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                   log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                    ok = false;
                    return (ok);
                }
 
            } else {
-               System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+               log.error("The recipe with name " + recipeName + " already exists. Pleas check the name.");
                ok = false;
                return (ok);
            }
 
        } else {
-           System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+           log.error("The recipe with name and the set of rules cannot be empity or null.");
            ok = false;
            return (ok);
        }
@@ -563,7 +567,7 @@ public class AddRecipe {
                         owlmanager.addAxiom(owlmodel, objectPropAssertion);
                         ok = true;
                     } else {
-                        System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                        log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                         ok = false;
                         return (ok);
                     }
@@ -574,7 +578,7 @@ public class AddRecipe {
                         owlmanager.addAxiom(owlmodel, objectPropAssertion);
                         ok = true;
                     } else {
-                        System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                        log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                         ok = false;
                         return (ok);
                     }
@@ -607,12 +611,12 @@ public class AddRecipe {
                                 owlmanager.addAxiom(owlmodel, objectPropAssertion);
                                 ok = true;
                             } else {
-                                System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                                log.error("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                                 ok = false;
                                 return (ok);
                             }
                         } else {
-                            System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                            log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                             ok = false;
                             return (ok);
                         }
@@ -627,19 +631,19 @@ public class AddRecipe {
                         owlmanager.addAxiom(owlmodel, objectPropAssertion);
                         ok = true;
                     } else {
-                        System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                        log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                         ok = false;
                         return (ok);
                     }
 
                 } else {
-                    System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+                    log.error("The recipe with name " + recipeName + " already exists. Pleas check the name.");
                     ok = false;
                     return (ok);
                 }
 
             } else {
-                System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+                log.error("The recipe with name and the set of rules cannot be empity or null.");
                 ok = false;
                 return (ok);
             }
@@ -705,7 +709,7 @@ public class AddRecipe {
                         owlmanager.addAxiom(owlmodel, objectPropAssertion);
                         ok = true;
                     } else {
-                        System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                        log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                         ok = false;
                         return (ok);
                     }
@@ -716,7 +720,7 @@ public class AddRecipe {
                         owlmanager.addAxiom(owlmodel, objectPropAssertion);
                         ok = true;
                     } else {
-                        System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                        log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                         ok = false;
                         return (ok);
                     }
@@ -749,12 +753,12 @@ public class AddRecipe {
                                 owlmanager.addAxiom(owlmodel, objectPropAssertion);
                                 ok = true;
                             } else {
-                                System.err.println("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                                log.error("The rule with IRI " + indf.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                                 ok = false;
                                 return (ok);
                             }
                         } else {
-                            System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                            log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                             ok = false;
                             return (ok);
                         }
@@ -768,19 +772,19 @@ public class AddRecipe {
                         owlmanager.addAxiom(owlmodel, objectPropAssertion);
                         ok = true;
                     } else {
-                        System.err.println("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
+                        log.error("The rule with IRI " + ind.getIRI() + " is not inside the ontology. Pleas check its IRI.");
                         ok = false;
                         return (ok);
                     }
 
                 } else {
-                    System.err.println("The recipe with name " + recipeName + " already exists. Pleas check the name.");
+                    log.error("The recipe with name " + recipeName + " already exists. Pleas check the name.");
                     ok = false;
                     return (ok);
                 }
 
             } else {
-                System.err.println("The recipe with name and the set of rules cannot be empity or null.");
+                log.error("The recipe with name and the set of rules cannot be empity or null.");
                 ok = false;
                 return (ok);
             }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRule.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRule.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRule.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/AddRule.java Fri Mar 16 13:34:23 2012
@@ -41,6 +41,8 @@ import org.semanticweb.owlapi.model.OWLO
 import org.semanticweb.owlapi.model.OWLOntologyChange;
 import org.semanticweb.owlapi.model.OWLOntologyCreationException;
 import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.hp.hpl.jena.reasoner.rulesys.ClauseEntry;
 import com.hp.hpl.jena.reasoner.rulesys.Rule;
@@ -52,6 +54,8 @@ import com.hp.hpl.jena.reasoner.rulesys.
  *
  */
 public class AddRule {
+    
+   private Logger log = LoggerFactory.getLogger(getClass());
 
    private OWLOntology owlmodel;
    private OWLOntologyManager owlmanager;
@@ -182,14 +186,14 @@ public class AddRule {
 		        ok = true;
     	   }
     	   else{
-	           System.err.println("The rule with name "+ruleName+" already exists. Pleas check the name.");
+	           log.error("The rule with name "+ruleName+" already exists. Pleas check the name.");
 	           ok = false;
 	           return(ok);
     	   }
 
        }
        else{
-	       System.err.println("The rule with name and the body-head string cannot be empity or null.");
+	       log.error("The rule with name and the body-head string cannot be empity or null.");
 	       ok=false;
 	       return(ok);
        }
@@ -216,7 +220,6 @@ public class AddRule {
        OWLDataProperty bodyhead = factory.getOWLDataProperty(IRI.create(owlIDrmi+"hasBodyAndHead"));
        
        if(((ruleName!=null)&&!ruleName.toString().isEmpty())&&((ruleBodyHead!=null)&&!ruleBodyHead.isEmpty())){
-    	   System.out.println("entriamo "+ruleName);
     	   if(!owlmodel.containsAxiom(factory.getOWLClassAssertionAxiom(ontocls, ontoind))){
 	     
 	            //Add the rule istance
@@ -236,14 +239,14 @@ public class AddRule {
             ok = true;
 	       }
 	       else{
-	           System.err.println("The rule with name "+ruleName+" already exists. Pleas check the name.");
+	           log.error("The rule with name "+ruleName+" already exists. Pleas check the name.");
 	           ok = false;
 	           return(ok);
 	       }
 
        }
        else{
-	       System.err.println("The rule with name and the body-head string cannot be empity or null.");
+	       log.error("The rule with name and the body-head string cannot be empity or null.");
 	       ok=false;
 	       return(ok);
        }
@@ -302,13 +305,13 @@ public class AddRule {
 
            ok = true;
        }else{
-           System.err.println("The rule with name "+ruleName+" already exists. Pleas check the name.");
+           log.error("The rule with name "+ruleName+" already exists. Pleas check the name.");
            ok = false;
            return(ok);
        }
 
     }else{
-       System.err.println("The rule with name and the body-head string cannot be empity or null.");
+       log.error("The rule with name and the body-head string cannot be empity or null.");
        ok=false;
        return(ok);
     }
@@ -368,13 +371,13 @@ public class AddRule {
 
             ok= true;
        }else{
-           System.err.println("The rule with name "+ruleName+" already exists. Pleas check the name.");
+           log.error("The rule with name "+ruleName+" already exists. Pleas check the name.");
            ok = false;
            return(ok);
        }
 
     }else{
-       System.err.println("The rule with name and the body-head string cannot be empity or null.");
+       log.error("The rule with name and the body-head string cannot be empity or null.");
        ok=false;
        return(ok);
     }

Modified: incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/GetRecipe.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/GetRecipe.java?rev=1301497&r1=1301496&r2=1301497&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/GetRecipe.java (original)
+++ incubator/stanbol/trunk/rules/manager/src/main/java/org/apache/stanbol/rules/manager/changes/GetRecipe.java Fri Mar 16 13:34:23 2012
@@ -36,12 +36,16 @@ import org.semanticweb.owlapi.model.OWLL
 import org.semanticweb.owlapi.model.OWLNamedIndividual;
 import org.semanticweb.owlapi.model.OWLOntology;
 import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  *
  * @author elvio
  */
 public class GetRecipe {
+    
+    private Logger log = LoggerFactory.getLogger(getClass());
 
     private OWLOntology owlmodel;
     private String owlID;
@@ -86,7 +90,7 @@ public class GetRecipe {
             }
 
         }else{
-            System.err.println("The recipe with name "+recipename+" doesn't exist.");
+            log.error("The recipe with name "+recipename+" doesn't exist.");
             return(null);
         }
 
@@ -115,7 +119,7 @@ public class GetRecipe {
             }
 
         }else{
-            System.err.println("The recipe with name "+recipename+" doesn't exist.");
+           log.error("The recipe with name "+recipename+" doesn't exist.");
             return(null);
         }