incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r711738 - in /incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl: BundleResourceProcessor.java ConfigResourceProcessor.java ConfigurationPid.java OsgiControllerImpl.java
Date Wed, 05 Nov 2008 23:21:38 GMT
Author: bdelacretaz
Date: Wed Nov  5 15:21:36 2008
New Revision: 711738

URL: http://svn.apache.org/viewvc?rev=711738&view=rev
Log:
SLING-719 - do not require .cfg extension for config nodes

Modified:
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/BundleResourceProcessor.java
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigResourceProcessor.java
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigurationPid.java
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/OsgiControllerImpl.java

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/BundleResourceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/BundleResourceProcessor.java?rev=711738&r1=711737&r2=711738&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/BundleResourceProcessor.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/BundleResourceProcessor.java
Wed Nov  5 15:21:36 2008
@@ -208,7 +208,7 @@
         final Long longId = (Long) attributes.get(KEY_BUNDLE_ID);
         if (longId == null) {
             log.debug(
-                "No bundle id in metadata for {}, bundle cannot be uninstalled.",
+                "Bundle {} cannot be uninstalled, bundle id not found, ignored",
                 uri);
         } else {
             final Bundle b = ctx.getBundle(longId);

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigResourceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigResourceProcessor.java?rev=711738&r1=711737&r2=711738&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigResourceProcessor.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigResourceProcessor.java
Wed Nov  5 15:21:36 2008
@@ -113,7 +113,7 @@
         final ConfigurationPid pid = new ConfigurationPid(uri);
         final Configuration cfg = getConfiguration(pid, false);
         if(cfg == null) {
-            log.debug("Config {} deleted but {} not found, ignoring", uri, pid);
+            log.debug("Cannot delete config {}, pid {} not found, ignored", uri, pid);
         } else {
             log.info("Deleting config {} (uri = {})", pid, uri);
             cfg.delete();

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigurationPid.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigurationPid.java?rev=711738&r1=711737&r2=711738&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigurationPid.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/ConfigurationPid.java
Wed Nov  5 15:21:36 2008
@@ -27,15 +27,19 @@
     private final String factoryPid;
 
     public ConfigurationPid(String path) {
-        // cut off path and extension
+        // cut off path
         String pid = path;
         final int lastSlash = path.lastIndexOf('/');
         if(lastSlash >= 0) {
             pid = path.substring(lastSlash + 1);
         }
-        final int lastDot = pid.lastIndexOf('.');
-        if(lastDot >= 0) {
-            pid = pid.substring(0, lastDot);
+        
+        // cut off extension if it's .cfg
+        if(pid.endsWith(ConfigResourceProcessor.CONFIG_EXTENSION)) {
+            final int lastDot = pid.lastIndexOf('.');
+            if(lastDot >= 0) {
+                pid = pid.substring(0, lastDot);
+            }
         }
 
         // split pid and factory pid alias

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/OsgiControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/OsgiControllerImpl.java?rev=711738&r1=711737&r2=711738&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/OsgiControllerImpl.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/osgi/impl/OsgiControllerImpl.java
Wed Nov  5 15:21:36 2008
@@ -129,15 +129,18 @@
     }
 
     public void uninstall(String uri) throws JcrInstallException {
-        final OsgiResourceProcessor p = getProcessor(uri, null);
-        if(p != null) {
-            try {
-                p.uninstall(uri, storage.getMap(uri));
-                storage.remove(uri);
-                storage.saveToFile();
-            } catch(Exception e) {
-                throw new JcrInstallException("Exception in uninstall (" + uri + ")", e);
-            }
+        try {
+	        // let each processor try to uninstall, one of them
+        	// should know how that handle uri
+	    	for(OsgiResourceProcessor p : this.processors) {
+	                p.uninstall(uri, storage.getMap(uri));
+	    	}
+	    	
+	        storage.remove(uri);
+	        storage.saveToFile();
+	        
+        } catch(Exception e) {
+            throw new JcrInstallException("Exception in uninstall (" + uri + ")", e);
         }
     }
 



Mime
View raw message