Author: angelo.vandersijpt at luminis.eu
Date: Mon Oct 18 17:59:02 2010
New Revision: 186

Log:
AMDATU-103 The SesameServiceImpl no longer uses ConfigAdmin, since the storage 
directory cannot be meaningfully changed anyway.

Modified:
   
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/osgi/Activator.java
   
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/service/SesameServiceImpl.java

Modified: 
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/osgi/Activator.java
==============================================================================
--- 
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/osgi/Activator.java
  (original)
+++ 
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/osgi/Activator.java
  Mon Oct 18 17:59:02 2010
@@ -21,7 +21,6 @@
 import org.apache.felix.dm.DependencyActivatorBase;
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.log.LogService;
 
 
@@ -42,7 +41,6 @@
                 createComponent()
                 .setImplementation(SesameServiceImpl.class)
                 .setInterface(SesameService.class.getName(), null)
-                
.add(createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true))
                 
.add(createServiceDependency().setService(LogService.class).setRequired(true)));
      
     }
 

Modified: 
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/service/SesameServiceImpl.java
==============================================================================
--- 
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/service/SesameServiceImpl.java
       (original)
+++ 
trunk/platform-bundles/sesame-application/src/main/java/org/amdatu/platform/sesame/application/service/SesameServiceImpl.java
       Mon Oct 18 17:59:02 2010
@@ -20,8 +20,6 @@
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
 import java.util.List;
 
 import org.amdatu.platform.sesame.application.SPARQLQueryHandler;
@@ -43,20 +41,12 @@
 import org.openrdf.sail.inferencer.fc.ForwardChainingRDFSInferencer;
 import org.openrdf.sail.memory.MemoryStore;
 import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.log.LogService;
 
 public class SesameServiceImpl implements SesameService {
-    // The PID for storing configuration entries
-    private final static String CONFIGURATION_PID = 
SesameService.class.getName();
-
-    // Properties stored in the configuration admin
-    private final static String PROPERTY_REPOSDIR = 
"org.amdatu.platform.sesame.application.repositorydir";
 
     // Service depedencies, injected by the Felix dependency manager
     private volatile BundleContext m_bundleContext;
-    private volatile ConfigurationAdmin m_configurationAdmin;
     private volatile LogService m_logService;
 
     // The Sesame repository
@@ -66,9 +56,6 @@
      * The init() method is invoked by the Felix dependency manager.
      */
     public void init() {
-        // Initialze configuration entries
-        initializeConfiguration();
-
         // Create a new repository, writing to disk. Note that we could use 
several storages, as long
         // as they implement the SAIL interface. Alternatives could be OWLim, 
AllegroGraph, Open Virtuoso
         // and Neo4j
@@ -102,44 +89,12 @@
     }
 
     /**
-     * Initializes the configuration properties for the Pax Web HTTP service.
-     */
-    @SuppressWarnings("unchecked")
-    private void initializeConfiguration() {
-        Configuration config;
-        try {
-            config = m_configurationAdmin.getConfiguration(CONFIGURATION_PID);
-            Dictionary properties = config.getProperties();
-            if (properties == null) {
-                // Properties not yet set, initialize the defaults
-                properties = new Hashtable();
-                String felixCacheDir = 
m_bundleContext.getProperty("felix.cache.rootdir");
-                String reposDir = felixCacheDir.substring(0, 
felixCacheDir.indexOf("/")) + "/sesame";
-                properties.put(PROPERTY_REPOSDIR, reposDir);
-                config.update(properties);
-                m_logService.log(LogService.LOG_DEBUG, "Http context 
configuration properties initialized.");
-            }
-        } catch (IOException e) {
-            m_logService.log(LogService.LOG_ERROR, "Configuration properties 
for '"
-                    + CONFIGURATION_PID + "' could not be initialized.");
-        }
-    }
-
-    /**
      * Returns the location of the repository directory.
      * @return the location of the repository directory.
      */
     private String getRepositoryDirectory() {
-        Configuration config;
-        try {
-            config = m_configurationAdmin.getConfiguration(CONFIGURATION_PID);
-            String reposDir = 
config.getProperties().get(PROPERTY_REPOSDIR).toString();
-            return reposDir;
-        } catch (IOException e) {
-            m_logService.log(LogService.LOG_ERROR, "Could not read property '" 
+ PROPERTY_REPOSDIR
-                    + "' from configuration '" + CONFIGURATION_PID + "'.");
-            return null;
-        }
+        String felixCacheDir = 
m_bundleContext.getProperty("felix.cache.rootdir");
+        return felixCacheDir.substring(0, felixCacheDir.indexOf("/")) + 
"/sesame";
     }
     
     /**

Reply via email to