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 2011/07/25 16:14:37 UTC

svn commit: r1150714 - in /incubator/stanbol/trunk: ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/conf/ ontologymanager/ontonet/src...

Author: alexdma
Date: Mon Jul 25 14:14:34 2011
New Revision: 1150714

URL: http://svn.apache.org/viewvc?rev=1150714&view=rev
Log:
- Changed ONManagerConfiguration to OfflineConfiguration (thus killing old unused OfflineConfiguration) and moved all non-offline-specific properties back to ONManager (STANBOL-178)
- Added ontology manager factory as utility class in stanbol.owl (TODO: remove old one from ontonet) (STANBOL-178)
- RegistryManagerImpl now shares the same OfflineConfiguration component as ontonet (STANBOL-285)
- Fixed corresponding metatypes (STANBOL-103)

Added:
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OfflineConfiguration.java
      - copied, changed from r1150576, incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManagerConfiguration.java
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/OfflineConfigurationImpl.java
      - copied, changed from r1150576, incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerConfigurationImpl.java
    incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/OWLOntologyManagerFactory.java
Removed:
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManagerConfiguration.java
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/conf/OfflineConfiguration.java
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerConfigurationImpl.java
Modified:
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManager.java
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerImpl.java
    incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties
    incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/ontology/TestIndexing.java
    incubator/stanbol/trunk/ontologymanager/registry/pom.xml
    incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/api/model/CachingPolicy.java
    incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/impl/RegistryManagerImpl.java
    incubator/stanbol/trunk/ontologymanager/registry/src/main/resources/OSGI-INF/metatype/metatype.properties
    incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyLibrary.java
    incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyRegistry.java
    incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestRegistryManager.java
    incubator/stanbol/trunk/ontologymanager/web/src/main/java/org/apache/stanbol/ontologymanager/web/resources/GraphsResource.java
    incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RefactorResource.java

Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManager.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManager.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManager.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManager.java Mon Jul 25 14:14:34 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.stanbol.ontologymanager.ontonet.api;
 
+import java.io.File;
+
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyIndex;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScopeFactory;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpaceFactory;
@@ -31,18 +33,30 @@ import org.semanticweb.owlapi.model.OWLO
  * An Ontology Network Manager holds all references and tools for creating, modifying and deleting the logical
  * realms that store Web Ontologies, as well as offer facilities for handling the ontologies contained
  * therein.
- * 
- * @author andrea.nuzzolese
- * 
  */
 public interface ONManager {
+    
+    /**
+     * The key used to configure the path of the ontology network configuration.
+     */
+    String CONFIG_ONTOLOGY_PATH = "org.apache.stanbol.ontologymanager.ontonet.onconfig";
+
+    /**
+     * The key used to configure the ID of the ontology network manager.
+     */
+    String ID = "org.apache.stanbol.ontologymanager.ontonet.id";
+
+    /**
+     * The key used to configure the base namespace of the ontology network.
+     */
+    String ONTOLOGY_NETWORK_NS = "org.apache.stanbol.ontologymanager.ontonet.ns";
 
     /**
-     * Returns the String that represent the namespace used by KReS for its ontologies
+     * Returns the ID of the ontology network manager.
      * 
-     * @return the namespace of KReS.
+     * @return the ID of the ontology network manager.
      */
-    String getKReSNamespace();
+    String getID();
 
     /**
      * Returns the default object that automatically indexes ontologies as they are loaded within scopes.
@@ -50,10 +64,25 @@ public interface ONManager {
      * @return the default ontology index.
      */
     OntologyIndex getOntologyIndex();
-
+    
     OWLOntologyManagerFactoryImpl getOntologyManagerFactory();
 
     /**
+     * Implementations should be able to create a {@link File} object from this path.
+     * 
+     * @return the local path of the ontology storing the ontology network configuration.
+     */
+    String getOntologyNetworkConfigurationPath();
+
+    /**
+     * Returns the base namespace to be used for the Stanbol ontology network (e.g. for the creation of new
+     * scopes). For convenience, it is returned as a string so that it can be concatenated to form IRIs.
+     * 
+     * @return the base namespace of the Stanbol ontology network.
+     */
+    String getOntologyNetworkNamespace();
+
+    /**
      * Returns the ontology scope factory that was created along with the manager context.
      * 
      * @return the default ontology scope factory

Copied: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OfflineConfiguration.java (from r1150576, incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManagerConfiguration.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OfflineConfiguration.java?p2=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OfflineConfiguration.java&p1=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManagerConfiguration.java&r1=1150576&r2=1150714&rev=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ONManagerConfiguration.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OfflineConfiguration.java Mon Jul 25 14:14:34 2011
@@ -16,29 +16,13 @@
  */
 package org.apache.stanbol.ontologymanager.ontonet.api;
 
-import java.io.File;
 import java.util.List;
 
 /**
  * Provides the configuration needed for the {@link ONManager}. A configuration should only be handled
  * internally by the {@link ONManager} implementation.
  */
-public interface ONManagerConfiguration {
-
-    /**
-     * The key used to configure the path of the ontology network configuration.
-     */
-    String CONFIG_ONTOLOGY_PATH = "org.apache.stanbol.ontologymanager.ontonet.onconfig";
-
-    /**
-     * The key used to configure the ID of the ontology network manager.
-     */
-    String ID = "org.apache.stanbol.ontologymanager.ontonet.id";
-
-    /**
-     * The key used to configure the base namespace of the ontology network.
-     */
-    String ONTOLOGY_NETWORK_NS = "org.apache.stanbol.ontologymanager.ontonet.ns";
+public interface OfflineConfiguration {
 
     /**
      * The key used to configure the paths of local ontologies.
@@ -46,28 +30,6 @@ public interface ONManagerConfiguration 
     String ONTOLOGY_PATHS = "org.apache.stanbol.ontologymanager.ontonet.ontologypaths";
 
     /**
-     * Returns the ID of the ontology network manager.
-     * 
-     * @return the ID of the ontology network manager.
-     */
-    String getID();
-
-    /**
-     * Implementations should be able to create a {@link File} object from this path.
-     * 
-     * @return the local path of the ontology storing the ontology network configuration.
-     */
-    String getOntologyNetworkConfigurationPath();
-
-    /**
-     * Returns the base namespace to be used for the Stanbol ontology network (e.g. for the creation of new
-     * scopes). For convenience, it is returned as a string so that it can be concatenated to form IRIs.
-     * 
-     * @return the base namespace of the Stanbol ontology network.
-     */
-    String getOntologyNetworkNamespace();
-
-    /**
      * Returns the paths of all the directories where the ontology network manager will try to locate
      * ontologies. These directories will be prioritaire if the engine is set to run in offline mode. This
      * list is ordered in that the higher-ordered directories generally override lower-ordered ones, that is,

Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerImpl.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerImpl.java Mon Jul 25 14:14:34 2011
@@ -28,6 +28,7 @@ import org.apache.clerezza.rdf.core.acce
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.ReferencePolicy;
@@ -35,7 +36,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Service;
 import org.apache.stanbol.commons.stanboltools.offline.OfflineMode;
 import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
-import org.apache.stanbol.ontologymanager.ontonet.api.ONManagerConfiguration;
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.BlankOntologySource;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.RootOntologyIRISource;
@@ -81,7 +82,7 @@ import org.slf4j.LoggerFactory;
  * @see ONManager
  * 
  */
-@Component(immediate = true)
+@Component(immediate = true, metatype = true)
 @Service(ONManager.class)
 public class ONManagerImpl implements ONManager {
 
@@ -130,8 +131,17 @@ public class ONManagerImpl implements ON
 
     }
 
+    public static final String _CONFIG_ONTOLOGY_PATH_DEFAULT = "";
+
+    public static final String _ID_DEFAULT = "ontonet";
+
+    public static final String _ONTOLOGY_NETWORK_NS_DEFAULT = "http://stanbol.apache.org/";
+
     @Reference
-    private ONManagerConfiguration config;
+    private OfflineConfiguration config;
+
+    @Property(name = ONManager.CONFIG_ONTOLOGY_PATH, value = _CONFIG_ONTOLOGY_PATH_DEFAULT)
+    private String configPath;
 
     private Helper helper = null;
 
@@ -156,6 +166,12 @@ public class ONManagerImpl implements ON
 
     private OntologySpaceFactory ontologySpaceFactory;
 
+    @Property(name = ONManager.ID, value = _ID_DEFAULT)
+    private String ontonetID;
+
+    @Property(name = ONManager.ONTOLOGY_NETWORK_NS, value = _ONTOLOGY_NETWORK_NS_DEFAULT)
+    private String ontonetNS;
+
     private OWLOntologyManager owlCacheManager;
 
     private OWLDataFactory owlFactory;
@@ -182,10 +198,9 @@ public class ONManagerImpl implements ON
      * Component Runtime support.
      * <p>
      * DO NOT USE to manually create instances - the ReengineerManagerImpl instances do need to be configured!
-     * YOU NEED TO USE
-     * {@link #ONManagerImpl(TcManager, WeightedTcProvider, ONManagerConfiguration, Dictionary)} or its
-     * overloads, to parse the configuration and then initialise the rule store if running outside an OSGI
-     * environment.
+     * YOU NEED TO USE {@link #ONManagerImpl(TcManager, WeightedTcProvider, OfflineConfiguration, Dictionary)}
+     * or its overloads, to parse the configuration and then initialise the rule store if running outside an
+     * OSGI environment.
      */
     public ONManagerImpl() {
         super();
@@ -193,10 +208,9 @@ public class ONManagerImpl implements ON
     }
 
     /**
-     * @deprecated use
-     *             {@link #ONManagerImpl(TcManager, WeightedTcProvider, ONManagerConfiguration, Dictionary)}
+     * @deprecated use {@link #ONManagerImpl(TcManager, WeightedTcProvider, OfflineConfiguration, Dictionary)}
      *             instead. Note that if the deprecated method is used instead, its effect will be to copy the
-     *             Dictionary context to a new {@link ONManagerConfiguration} object.
+     *             Dictionary context to a new {@link OfflineConfiguration} object.
      * @param tcm
      * @param wtcp
      * @param configuration
@@ -204,7 +218,7 @@ public class ONManagerImpl implements ON
     @Deprecated
     public ONManagerImpl(TcManager tcm, WeightedTcProvider wtcp, Dictionary<String,Object> configuration) {
         // Copy the same configuration to the ONManagerConfigurationImpl.
-        this(tcm, wtcp, new ONManagerConfigurationImpl(configuration), configuration);
+        this(tcm, wtcp, new OfflineConfigurationImpl(configuration), configuration);
     }
 
     /**
@@ -217,11 +231,11 @@ public class ONManagerImpl implements ON
      * @param onmconfig
      *            the configuration of this ontology network manager.
      * @param configuration
-     *            additional parameters for the ONManager not included in {@link ONManagerConfiguration}.
+     *            additional parameters for the ONManager not included in {@link OfflineConfiguration}.
      */
     public ONManagerImpl(TcManager tcm,
                          WeightedTcProvider wtcp,
-                         ONManagerConfiguration onmconfig,
+                         OfflineConfiguration onmconfig,
                          Dictionary<String,Object> configuration) {
         this();
         // Assume this.tcm this.wtcp and this.wtcp were not filled in by OSGi-DS.
@@ -259,7 +273,14 @@ public class ONManagerImpl implements ON
     protected void activate(Dictionary<String,Object> configuration) throws IOException {
 
         // Parse configuration
-        if (config.getID() == null || config.getID().isEmpty()) {
+        ontonetID = (String) configuration.get(ONManager.ID);
+        if (ontonetID == null) ontonetID = _ID_DEFAULT;
+        ontonetNS = (String) configuration.get(ONManager.ONTOLOGY_NETWORK_NS);
+        if (ontonetNS == null) ontonetNS = _ONTOLOGY_NETWORK_NS_DEFAULT;
+        configPath = (String) configuration.get(ONManager.CONFIG_ONTOLOGY_PATH);
+        if (configPath == null) configPath = _CONFIG_ONTOLOGY_PATH_DEFAULT;
+
+        if (ontonetID == null || ontonetID.isEmpty()) {
             log.warn("The Ontology Network Manager configuration does not define a ID for the Ontology Network Manager");
         }
 
@@ -292,7 +313,7 @@ public class ONManagerImpl implements ON
          * If there is no configuration file, just start with an empty scope set
          */
 
-        String configPath = config.getOntologyNetworkConfigurationPath();
+        String configPath = getOntologyNetworkConfigurationPath();
 
         if (configPath != null && !configPath.trim().isEmpty()) {
             OWLOntology oConf = null;
@@ -459,6 +480,9 @@ public class ONManagerImpl implements ON
      */
     @Deactivate
     protected void deactivate(ComponentContext context) {
+        ontonetID = null;
+        ontonetNS = null;
+        configPath = null;
         log.info("in " + ONManagerImpl.class + " deactivate with context " + context);
     }
 
@@ -481,8 +505,9 @@ public class ONManagerImpl implements ON
     }
 
     @Override
-    public String getKReSNamespace() {
-        return config.getOntologyNetworkNamespace();
+    public String getID() {
+        // TODO Auto-generated method stub
+        return null;
     }
 
     public OntologyIndex getOntologyIndex() {
@@ -493,6 +518,16 @@ public class ONManagerImpl implements ON
         return omgrFactory;
     }
 
+    @Override
+    public String getOntologyNetworkConfigurationPath() {
+        return configPath;
+    }
+
+    @Override
+    public String getOntologyNetworkNamespace() {
+        return ontonetNS;
+    }
+
     /**
      * Returns the ontology scope factory that was created along with the manager context.
      * 

Copied: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/OfflineConfigurationImpl.java (from r1150576, incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerConfigurationImpl.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/OfflineConfigurationImpl.java?p2=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/OfflineConfigurationImpl.java&p1=incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerConfigurationImpl.java&r1=1150576&r2=1150714&rev=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/ONManagerConfigurationImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/impl/OfflineConfigurationImpl.java Mon Jul 25 14:14:34 2011
@@ -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.ontologymanager.ontonet.impl;
 
 import java.util.Arrays;
@@ -25,60 +25,45 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.stanbol.ontologymanager.ontonet.api.ONManagerConfiguration;
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Default implementation of the {@link ONManagerConfiguration}.
+ * Default implementation of the {@link OfflineConfiguration}.
  * 
  * @author alessandro
  * 
  */
 @Component(immediate = true, metatype = true)
 @Service
-public class ONManagerConfigurationImpl implements ONManagerConfiguration {
-
-    public static final String _CONFIG_ONTOLOGY_PATH_DEFAULT = "";
-
-    public static final String _ID_DEFAULT = "ontonet";
-
-    public static final String _ONTOLOGY_NETWORK_NS_DEFAULT = "http://kres.iksproject.eu/";
-
-    @Property(name = ONManagerConfiguration.CONFIG_ONTOLOGY_PATH, value = _CONFIG_ONTOLOGY_PATH_DEFAULT)
-    private String configPath;
+public class OfflineConfigurationImpl implements OfflineConfiguration {
 
     protected Logger log = LoggerFactory.getLogger(getClass());
 
     /**
      * TODO how do you use array initializers in Property annotations without causing compile errors?
      */
-    @Property(name = ONManagerConfiguration.ONTOLOGY_PATHS, value = {".", "/ontologies"})
+    @Property(name = OfflineConfiguration.ONTOLOGY_PATHS, value = {".", "/ontologies"})
     private String[] ontologyDirs;
 
-    @Property(name = ONManagerConfiguration.ID, value = _ID_DEFAULT)
-    private String ontonetID;
-
-    @Property(name = ONManagerConfiguration.ONTOLOGY_NETWORK_NS, value = _ONTOLOGY_NETWORK_NS_DEFAULT)
-    private String ontonetNS;
-
     /**
      * This default constructor is <b>only</b> intended to be used by the OSGI environment with Service
      * Component Runtime support.
      * <p>
-     * DO NOT USE to manually create instances - the ONManagerConfigurationImpl instances do need to be configured!
-     * YOU NEED TO USE {@link #ONManagerConfigurationImpl(Dictionary)} or its overloads, to parse the
-     * configuration and then initialise the rule store if running outside an OSGI environment.
+     * DO NOT USE to manually create instances - the ONManagerConfigurationImpl instances do need to be
+     * configured! YOU NEED TO USE {@link #ONManagerConfigurationImpl(Dictionary)} or its overloads, to parse
+     * the configuration and then initialise the rule store if running outside an OSGI environment.
      */
-    public ONManagerConfigurationImpl() {}
+    public OfflineConfigurationImpl() {}
 
     /**
      * To be invoked by non-OSGi environments.
      * 
      * @param configuration
      */
-    public ONManagerConfigurationImpl(Dictionary<String,Object> configuration) {
+    public OfflineConfigurationImpl(Dictionary<String,Object> configuration) {
         this();
         activate(configuration);
     }
@@ -95,41 +80,18 @@ public class ONManagerConfigurationImpl 
 
     protected void activate(Dictionary<String,Object> configuration) {
         // Parse configuration.
-        ontonetID = (String) configuration.get(ONManagerConfiguration.ID);
-        if (ontonetID == null) ontonetID = _ID_DEFAULT;
-        ontologyDirs = (String[]) configuration.get(ONManagerConfiguration.ONTOLOGY_PATHS);
+        ontologyDirs = (String[]) configuration.get(OfflineConfiguration.ONTOLOGY_PATHS);
         if (ontologyDirs == null) ontologyDirs = new String[] {".", "/ontologies"};
-        ontonetNS = (String) configuration.get(ONManagerConfiguration.ONTOLOGY_NETWORK_NS);
-        if (ontonetNS == null) ontonetNS = _ONTOLOGY_NETWORK_NS_DEFAULT;
-        configPath = (String) configuration.get(ONManagerConfiguration.CONFIG_ONTOLOGY_PATH);
-        if (configPath == null) configPath = _CONFIG_ONTOLOGY_PATH_DEFAULT;
+
     }
 
     @Deactivate
     protected void deactivate(ComponentContext context) {
-        ontonetID = null;
         ontologyDirs = null;
-        ontonetNS = null;
-        configPath = null;
         log.info("in {} deactivate with context {}", getClass(), context);
     }
 
     @Override
-    public String getID() {
-        return ontonetID;
-    }
-
-    @Override
-    public String getOntologyNetworkConfigurationPath() {
-        return configPath;
-    }
-
-    @Override
-    public String getOntologyNetworkNamespace() {
-        return ontonetNS;
-    }
-
-    @Override
     public List<String> getOntologySourceDirectories() {
         return Arrays.asList(ontologyDirs);
     }

Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/main/resources/OSGI-INF/metatype/metatype.properties Mon Jul 25 14:14:34 2011
@@ -19,13 +19,6 @@
 org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl.name = Apache Stanbol Ontology Network Manager
 org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl.description = A controlled environment for managing Web ontology networks.
 
-
-#===============================================================================
-#Properties defined by the Ontology Network Manager configuration
-#===============================================================================
-org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerConfigurationImpl.name = Apache Stanbol Ontology Network Manager configuration
-org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerConfigurationImpl.description = Holds the properties needed for creating an Ontology Network Manager.
-
 org.apache.stanbol.ontologymanager.ontonet.id.name = ID
 org.apache.stanbol.ontologymanager.ontonet.id.description = The identifier of this Ontology Network Manager instance.
 
@@ -35,5 +28,12 @@ org.apache.stanbol.ontologymanager.onton
 org.apache.stanbol.ontologymanager.ontonet.onconfig.name = Configuration ontology
 org.apache.stanbol.ontologymanager.ontonet.onconfig.description = The physical location of the ontology storing the configuration of the Stanbol ontology network. Can be an absolute URI or a file path (either absolute or relative to the bundle resource directory).
 
+
+#===============================================================================
+#Properties defined by the Ontology Manager offline configuration
+#===============================================================================
+org.apache.stanbol.ontologymanager.ontonet.impl.OfflineConfigurationImpl.name = Apache Stanbol Ontology Manager offline configuration
+org.apache.stanbol.ontologymanager.ontonet.impl.OfflineConfigurationImpl.description = Holds the properties needed to manage the offline state of an Ontology Network Manager.
+
 org.apache.stanbol.ontologymanager.ontonet.ontologypaths.name = Ontology directories
 org.apache.stanbol.ontologymanager.ontonet.ontologypaths.description = The local directories for ontology sources.

Modified: incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/ontology/TestIndexing.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/ontology/TestIndexing.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/ontology/TestIndexing.java (original)
+++ incubator/stanbol/trunk/ontologymanager/ontonet/src/test/java/org/apache/stanbol/ontologymanager/ontonet/ontology/TestIndexing.java Mon Jul 25 14:14:34 2011
@@ -32,7 +32,7 @@ import org.apache.stanbol.ontologymanage
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyIndex;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScope;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpace;
-import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerConfigurationImpl;
+import org.apache.stanbol.ontologymanager.ontonet.impl.OfflineConfigurationImpl;
 import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
 import org.junit.BeforeClass;
 import org.semanticweb.owlapi.model.IRI;
@@ -59,7 +59,7 @@ public class TestIndexing {
         final Dictionary<String,Object> emptyConfig = new Hashtable<String,Object>();
 //        RegistryManager regman = new RegistryManagerImpl(emptyConfig);
         // An ONManagerImpl with no store and default settings
-        onm = new ONManagerImpl(null, null, new ONManagerConfigurationImpl(emptyConfig), emptyConfig);
+        onm = new ONManagerImpl(null, null, new OfflineConfigurationImpl(emptyConfig), emptyConfig);
         mgr = onm.getOntologyManagerFactory().createOntologyManager(true);
 
         // Since it is registered, this scope must be unique, or subsequent

Modified: incubator/stanbol/trunk/ontologymanager/registry/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/pom.xml?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/pom.xml (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/pom.xml Mon Jul 25 14:14:34 2011
@@ -117,10 +117,6 @@
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-api</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-		</dependency>
 
 		<!-- Testing deps -->
 		<dependency>

Modified: incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/api/model/CachingPolicy.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/api/model/CachingPolicy.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/api/model/CachingPolicy.java (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/api/model/CachingPolicy.java Mon Jul 25 14:14:34 2011
@@ -9,11 +9,11 @@ public enum CachingPolicy {
      * A single ontology manager will be used for all known registries, which implies that only one possible
      * version of each ontology can be loaded at one time.
      */
-    CROSS_REGISTRY,
+    CENTRALISED,
 
     /**
      * Every registry is assigned its own ontology manager for caching ontologies once they are loaded. If a
      * library is referenced across multiple registries, an ontology set will be instantiated for each.
      */
-    PER_REGISTRY;
+    DISTRIBUTED;
 }

Modified: incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/impl/RegistryManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/impl/RegistryManagerImpl.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/impl/RegistryManagerImpl.java (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/src/main/java/org/apache/stanbol/ontologymanager/registry/impl/RegistryManagerImpl.java Mon Jul 25 14:14:34 2011
@@ -16,10 +16,13 @@
  */
 package org.apache.stanbol.ontologymanager.registry.impl;
 
+import java.io.File;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
@@ -29,7 +32,9 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.PropertyOption;
+import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryContentException;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryContentListener;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryItemFactory;
@@ -42,6 +47,7 @@ import org.apache.stanbol.ontologymanage
 import org.apache.stanbol.ontologymanager.registry.api.model.RegistryOntology;
 import org.apache.stanbol.ontologymanager.registry.impl.util.RegistryUtils;
 import org.apache.stanbol.ontologymanager.registry.xd.vocabulary.CODOVocabulary;
+import org.apache.stanbol.owl.OWLOntologyManagerFactory;
 import org.osgi.service.component.ComponentContext;
 import org.semanticweb.owlapi.apibinding.OWLManager;
 import org.semanticweb.owlapi.model.IRI;
@@ -72,7 +78,7 @@ import org.slf4j.LoggerFactory;
 @Service(RegistryManager.class)
 public class RegistryManagerImpl implements RegistryManager, RegistryContentListener {
 
-    private static final CachingPolicy _CACHING_POLICY_DEFAULT = CachingPolicy.CROSS_REGISTRY;
+    private static final CachingPolicy _CACHING_POLICY_DEFAULT = CachingPolicy.CENTRALISED;
 
     private static final boolean _LAZY_LOADING_DEFAULT = false;
 
@@ -80,8 +86,6 @@ public class RegistryManagerImpl impleme
 
     private static final OWLObjectProperty hasPart, hasOntology, isPartOf, isOntologyOf;
 
-    private OWLOntologyManager cache = null;
-
     static {
         OWLDataFactory factory = OWLManager.getOWLDataFactory();
         cOntology = factory.getOWLClass(IRI.create(CODOVocabulary.CODK_Ontology));
@@ -92,15 +96,20 @@ public class RegistryManagerImpl impleme
         hasOntology = factory.getOWLObjectProperty(IRI.create(CODOVocabulary.ODPM_HasOntology));
     }
 
+    private OWLOntologyManager cache = null;
+
     @Property(name = RegistryManager.CACHING_POLICY, options = {
                                                                 @PropertyOption(value = '%'
                                                                                         + RegistryManager.CACHING_POLICY
-                                                                                        + ".option.registry", name = "PER_REGISTRY"),
+                                                                                        + ".option.distributed", name = "DISTRIBUTED"),
                                                                 @PropertyOption(value = '%'
                                                                                         + RegistryManager.CACHING_POLICY
-                                                                                        + ".option.all", name = "CROSS_REGISTRY")}, value = "CROSS_REGISTRY")
+                                                                                        + ".option.centralised", name = "CENTRALISED")}, value = "CENTRALISED")
     private String cachingPolicyString;
 
+    @Reference
+    private OfflineConfiguration offline;
+
     @Property(name = RegistryManager.LAZY_LOADING, boolValue = _LAZY_LOADING_DEFAULT)
     private boolean lazyLoading = _LAZY_LOADING_DEFAULT;
 
@@ -138,8 +147,9 @@ public class RegistryManagerImpl impleme
      * 
      * @param configuration
      */
-    public RegistryManagerImpl(Dictionary<String,Object> configuration) {
+    public RegistryManagerImpl(OfflineConfiguration offline, Dictionary<String,Object> configuration) {
         this();
+        this.offline = offline;
         activate(configuration);
     }
 
@@ -169,8 +179,35 @@ public class RegistryManagerImpl impleme
             this.cachingPolicyString = cachingPolicy.toString();
         }
 
+        List<String> paths = offline.getOntologySourceDirectories();
+        final IRI[] offlineResources;
+        if (paths != null) {
+            List<IRI> list = new ArrayList<IRI>();
+            for (String path : paths) {
+                IRI iri = null;
+                if (path.startsWith("/")) {
+                    try {
+                        iri = IRI.create(getClass().getResource(path));
+                    } catch (Exception e) {
+                        // TODO: Don't give up. It could still an absolute path.
+                    }
+                } else try {
+                    iri = IRI.create(path);
+                } catch (Exception e1) {
+                    try {
+                        iri = IRI.create(new File(path));
+                    } catch (Exception e2) {
+                        log.warn("Unable to obtain a path for {}. Skipping...", iri, e2);
+                        iri = null;
+                    }
+                }
+                if (iri != null) list.add(iri);
+            }
+            offlineResources = list.toArray(new IRI[0]);
+        } else offlineResources = new IRI[0];
+
         // Used only for creating the registry model, do not use for caching.
-        OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
+        OWLOntologyManager mgr = OWLOntologyManagerFactory.createOWLOntologyManager(offlineResources);
         // Load registries
         Set<OWLOntology> regOnts = new HashSet<OWLOntology>();
         for (String loc : locations) {
@@ -182,19 +219,23 @@ public class RegistryManagerImpl impleme
             } catch (OWLOntologyCreationException e) {
                 log.warn("Failed to load ontology " + loc + " - Skipping...", e);
                 continue;
+            } catch (Exception e) {
+                log.warn("Invalid registry configuration " + loc + " - Skipping...", e);
+                continue;
             }
         }
+
         // Build the model.
         createModel(regOnts);
 
         // Set the cache.
-        if (cachingPolicyString.equals(CachingPolicy.CROSS_REGISTRY.name())) {
-            this.cache = OWLManager.createOWLOntologyManager();
+        if (cachingPolicyString.equals(CachingPolicy.CENTRALISED.name())) {
+            this.cache = OWLOntologyManagerFactory.createOWLOntologyManager(offlineResources);
             for (Registry reg : getRegistries())
                 reg.setCache(this.cache);
-        } else if (cachingPolicyString.equals(CachingPolicy.PER_REGISTRY.name())) {
+        } else if (cachingPolicyString.equals(CachingPolicy.DISTRIBUTED.name())) {
             for (Registry reg : getRegistries())
-                reg.setCache(OWLManager.createOWLOntologyManager());
+                reg.setCache(OWLOntologyManagerFactory.createOWLOntologyManager(offlineResources));
             this.cache = null;
         }
     }

Modified: incubator/stanbol/trunk/ontologymanager/registry/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/src/main/resources/OSGI-INF/metatype/metatype.properties Mon Jul 25 14:14:34 2011
@@ -21,8 +21,8 @@ org.apache.stanbol.ontologymanager.regis
 
 org.apache.stanbol.ontologymanager.registry.cachingPolicy.name = Caching policy
 org.apache.stanbol.ontologymanager.registry.cachingPolicy.description = Specifies if ontology caching should spread across all registries or maintained separate for each registry.
-org.apache.stanbol.ontologymanager.registry.cachingPolicy.option.registry = Per Registry
-org.apache.stanbol.ontologymanager.registry.cachingPolicy.option.all = All Registries
+org.apache.stanbol.ontologymanager.registry.cachingPolicy.option.distributed = Distributed
+org.apache.stanbol.ontologymanager.registry.cachingPolicy.option.centralised = Centralised
 
 org.apache.stanbol.ontologymanager.registry.laziness.name = Lazy ontology loading
 org.apache.stanbol.ontologymanager.registry.laziness.description = If set, the ontologies referenced in a library will not be loaded until the library is requested.

Modified: incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyLibrary.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyLibrary.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyLibrary.java (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyLibrary.java Mon Jul 25 14:14:34 2011
@@ -16,9 +16,7 @@
  */
 package org.apache.stanbol.ontologymanager.registry;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import java.io.File;
 import java.net.URL;
@@ -26,9 +24,10 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
-import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerConfigurationImpl;
 import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
+import org.apache.stanbol.ontologymanager.ontonet.impl.OfflineConfigurationImpl;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryLoader;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryManager;
 import org.apache.stanbol.ontologymanager.registry.api.model.Library;
@@ -67,10 +66,12 @@ public class TestOntologyLibrary {
      */
     @BeforeClass
     public static void setupTest() throws Exception {
-        final Dictionary<String,Object> emptyConfig = new Hashtable<String,Object>();
-        RegistryManager regman = new RegistryManagerImpl(emptyConfig);
+        final Dictionary<String,Object> config = new Hashtable<String,Object>();
+        config.put(OfflineConfiguration.ONTOLOGY_PATHS, new String[] {"/ontologies", "/ontologies/registry"});
+        OfflineConfiguration offline = new OfflineConfigurationImpl(config);
+        RegistryManager regman = new RegistryManagerImpl(offline, config);
         // An ONManagerImpl with no store and default settings
-        onm = new ONManagerImpl(null, null, new ONManagerConfigurationImpl(emptyConfig), emptyConfig);
+        onm = new ONManagerImpl(null, null, offline, config);
         loader = new RegistryLoaderImpl(regman, onm);
     }
 

Modified: incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyRegistry.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyRegistry.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyRegistry.java (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestOntologyRegistry.java Mon Jul 25 14:14:34 2011
@@ -16,10 +16,7 @@
  */
 package org.apache.stanbol.ontologymanager.registry;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 import java.io.File;
 import java.net.URL;
@@ -31,13 +28,13 @@ import java.util.Set;
 
 import org.apache.stanbol.ontologymanager.ontonet.api.DuplicateIDException;
 import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
-import org.apache.stanbol.ontologymanager.ontonet.api.ONManagerConfiguration;
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.CoreOntologySpace;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScope;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.SessionOntologySpace;
 import org.apache.stanbol.ontologymanager.ontonet.api.ontology.UnmodifiableOntologySpaceException;
-import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerConfigurationImpl;
 import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
+import org.apache.stanbol.ontologymanager.ontonet.impl.OfflineConfigurationImpl;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryManager;
 import org.apache.stanbol.ontologymanager.registry.api.model.Registry;
 import org.apache.stanbol.ontologymanager.registry.api.model.RegistryItem;
@@ -55,17 +52,17 @@ import org.semanticweb.owlapi.util.AutoI
 public class TestOntologyRegistry {
 
     private static RegistryIRISource ontologySource;
-    private static ONManagerConfiguration configuration;
     private static ONManager onm;
     private static RegistryManager regman;
 
     @BeforeClass
     public static void setup() {
-        final Dictionary<String,Object> emptyConfig = new Hashtable<String,Object>();
-        configuration = new ONManagerConfigurationImpl(emptyConfig);
-        regman = new RegistryManagerImpl(emptyConfig);
-        // An ONManagerImpl with no store and default settings
-        onm = new ONManagerImpl(null, null, configuration, emptyConfig);
+        final Dictionary<String,Object> config = new Hashtable<String,Object>();
+        config.put(OfflineConfiguration.ONTOLOGY_PATHS, new String[] {"/ontologies", "/ontologies/registry"});
+        OfflineConfiguration offline = new OfflineConfigurationImpl(config);
+        regman = new RegistryManagerImpl(offline, config);
+        // An ONManagerImpl with no store and same offline settings as the registry manager.
+        onm = new ONManagerImpl(null, null, offline, config);
     }
 
     // private static boolean mapperIsSet = false;

Modified: incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestRegistryManager.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestRegistryManager.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestRegistryManager.java (original)
+++ incubator/stanbol/trunk/ontologymanager/registry/src/test/java/org/apache/stanbol/ontologymanager/registry/TestRegistryManager.java Mon Jul 25 14:14:34 2011
@@ -6,6 +6,9 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.Iterator;
 
+import org.apache.stanbol.ontologymanager.ontonet.api.OfflineConfiguration;
+import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
+import org.apache.stanbol.ontologymanager.ontonet.impl.OfflineConfigurationImpl;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryManager;
 import org.apache.stanbol.ontologymanager.registry.api.model.CachingPolicy;
 import org.apache.stanbol.ontologymanager.registry.api.model.Registry;
@@ -22,14 +25,19 @@ public class TestRegistryManager {
 
     @Test
     public void testDistributedCaching() {
-        Dictionary<String,Object> configuration = new Hashtable<String,Object>();
-        configuration.put(RegistryManager.CACHING_POLICY, CachingPolicy.CROSS_REGISTRY);
+
+        final Dictionary<String,Object> configuration = new Hashtable<String,Object>();
+        configuration.put(OfflineConfiguration.ONTOLOGY_PATHS, new String[] {"/ontologies",
+                                                                             "/ontologies/registry"});
+        OfflineConfiguration offline = new OfflineConfigurationImpl(configuration);
+        configuration.put(RegistryManager.CACHING_POLICY, CachingPolicy.CENTRALISED);
         configuration.put(RegistryManager.REGISTRY_LOCATIONS,
             new String[] {getClass().getResource("/ontologies/registry/onmtest.owl").toString(),
                           getClass().getResource("/ontologies/registry/onmtest_additions.owl").toString()});
-        regman = new RegistryManagerImpl(configuration);
+        regman = new RegistryManagerImpl(offline, configuration);
+
         assertNotNull(regman);
-        assertSame(CachingPolicy.CROSS_REGISTRY, regman.getCachingPolicy());
+        assertSame(CachingPolicy.CENTRALISED, regman.getCachingPolicy());
         Iterator<Registry> it = regman.getRegistries().iterator();
         OWLOntologyManager cache = it.next().getCache();
         while (it.hasNext())

Modified: incubator/stanbol/trunk/ontologymanager/web/src/main/java/org/apache/stanbol/ontologymanager/web/resources/GraphsResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/ontologymanager/web/src/main/java/org/apache/stanbol/ontologymanager/web/resources/GraphsResource.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/ontologymanager/web/src/main/java/org/apache/stanbol/ontologymanager/web/resources/GraphsResource.java (original)
+++ incubator/stanbol/trunk/ontologymanager/web/src/main/java/org/apache/stanbol/ontologymanager/web/resources/GraphsResource.java Mon Jul 25 14:14:34 2011
@@ -1,21 +1,23 @@
 /*
-* 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.ontologymanager.web.resources;
 
+import static javax.ws.rs.core.Response.Status.*;
+
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
@@ -28,6 +30,7 @@ import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -61,19 +64,19 @@ import com.sun.jersey.multipart.FormData
 @ImplicitProduces(MediaType.TEXT_HTML + ";qs=2")
 public class GraphsResource extends BaseStanbolResource {
 
-    protected TcManager tcManager;
+    private final Logger log = LoggerFactory.getLogger(getClass());
     protected ONManager onManager;
     protected ClerezzaOntologyStorage storage;
 
-    private final Logger log = LoggerFactory.getLogger(getClass());
+    protected TcManager tcManager;
 
     public GraphsResource(@Context ServletContext servletContext) {
         storage = (ClerezzaOntologyStorage) (servletContext.getAttribute(ClerezzaOntologyStorage.class
                 .getName()));
         tcManager = (TcManager) servletContext.getAttribute(TcManager.class.getName());
-        
+
         onManager = (ONManager) ContextHelper.getServiceFromContext(ONManager.class, servletContext);
-        //onManager = (ONManager) (servletContext.getAttribute(ONManager.class.getName()));
+        // onManager = (ONManager) (servletContext.getAttribute(ONManager.class.getName()));
         if (onManager == null) {
             throw new IllegalStateException("OntologyStorage missing in ServletContext");
         } else {
@@ -82,6 +85,37 @@ public class GraphsResource extends Base
     }
 
     @GET
+    @Path("/{graphid:.+}")
+    public Response getGraph(@PathParam("graphid") String graphid,
+                             @Context UriInfo uriInfo,
+                             @Context HttpHeaders headers) {
+
+        IRI ontologyID = IRI.create(graphid);
+
+        // return Response.ok(tcManager.getMGraph(new UriRef(graphid))).build();
+        try {
+            return Response.ok(storage.getGraph(ontologyID)).build();
+        } catch (NoSuchStoreException e) {
+            return Response.status(NO_CONTENT).build();
+        }
+
+    }
+
+    public String getNamespace() {
+        return onManager.getOntologyNetworkNamespace();
+    }
+
+    public List<String> getStoredGraphs() {
+        Set<IRI> iris = storage.listGraphs();
+
+        ArrayList<String> graphs = new ArrayList<String>();
+        for (IRI iri : iris) {
+            graphs.add(iri.toString());
+        }
+        return graphs;
+    }
+
+    @GET
     @Path("/resume")
     @Produces({KRFormat.FUNCTIONAL_OWL, KRFormat.MANCHESTER_OWL, KRFormat.OWL_XML, KRFormat.RDF_XML,
                KRFormat.TURTLE, KRFormat.RDF_JSON})
@@ -96,7 +130,7 @@ public class GraphsResource extends Base
             try {
                 ontology = manager.createOntology();
 
-                String ns = onManager.getKReSNamespace();
+                String ns = onManager.getOntologyNetworkNamespace();
 
                 OWLNamedIndividual storage = factory.getOWLNamedIndividual(IRI.create(ns + "Storage"));
 
@@ -112,29 +146,12 @@ public class GraphsResource extends Base
 
                 return Response.ok(ontology).build();
             } catch (OWLOntologyCreationException e) {
-                return Response.status(500).build();
+                throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
             }
 
         }
 
-        return Response.status(404).build();
-    }
-
-    @GET
-    @Path("/{graphid:.+}")
-    public Response getGraph(@PathParam("graphid") String graphid,
-                             @Context UriInfo uriInfo,
-                             @Context HttpHeaders headers) {
-
-        IRI ontologyID = IRI.create(graphid);
-
-        // return Response.ok(tcManager.getMGraph(new UriRef(graphid))).build();
-        try {
-            return Response.ok(storage.getGraph(ontologyID)).build();
-        } catch (NoSuchStoreException e) {
-            return Response.status(204).build();
-        }
-
+        return Response.status(NOT_FOUND).build();
     }
 
     @POST
@@ -146,21 +163,7 @@ public class GraphsResource extends Base
             storage.store(ontology, IRI.create(id));
             return Response.ok().build();
         } catch (OWLOntologyCreationException e) {
-            return Response.status(500).build();
-        }
-    }
-
-    public String getNamespace() {
-        return onManager.getKReSNamespace();
-    }
-
-    public List<String> getStoredGraphs() {
-        Set<IRI> iris = storage.listGraphs();
-
-        ArrayList<String> graphs = new ArrayList<String>();
-        for (IRI iri : iris) {
-            graphs.add(iri.toString());
+            throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
         }
-        return graphs;
     }
 }

Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/OWLOntologyManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/OWLOntologyManagerFactory.java?rev=1150714&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/OWLOntologyManagerFactory.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/OWLOntologyManagerFactory.java Mon Jul 25 14:14:34 2011
@@ -0,0 +1,62 @@
+/*
+ * 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.owl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntologyIRIMapper;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.semanticweb.owlapi.util.AutoIRIMapper;
+
+public class OWLOntologyManagerFactory {
+
+    /**
+     * 
+     * @param localDirs
+     *            . If null or empty, no offline support will be added
+     * @return
+     */
+    public static OWLOntologyManager createOWLOntologyManager(IRI[] locations) {
+        OWLOntologyManager mgr = OWLManager.createOWLOntologyManager();
+        for (OWLOntologyIRIMapper mapper : getMappers(locations))
+            mgr.addIRIMapper(mapper);
+        return mgr;
+    }
+
+    private static List<OWLOntologyIRIMapper> getMappers(IRI[] dirs) {
+        List<OWLOntologyIRIMapper> mappers = new ArrayList<OWLOntologyIRIMapper>();
+        if (dirs != null) {
+            for (IRI path : dirs) {
+                File dir = null;
+                try {
+                    dir = new File(path.toURI());
+                } catch (Exception e) {
+                    // Keep dir null
+                }
+                if (dir != null) {
+                    if (dir.isDirectory()) mappers.add(new AutoIRIMapper(dir, true));
+                }
+            }
+        }
+        return mappers;
+    }
+
+}

Modified: incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RefactorResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RefactorResource.java?rev=1150714&r1=1150713&r2=1150714&view=diff
==============================================================================
--- incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RefactorResource.java (original)
+++ incubator/stanbol/trunk/rules/web/src/main/java/org/apache/stanbol/rules/web/resources/RefactorResource.java Mon Jul 25 14:14:34 2011
@@ -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.rules.web.resources;
 
 import static javax.ws.rs.core.Response.Status.*;
@@ -169,7 +169,7 @@ public class RefactorResource extends Ba
     }
 
     public String getNamespace() {
-        return onManager.getKReSNamespace();
+        return onManager.getOntologyNetworkNamespace();
     }
 
     @POST