incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1076551 - in /sling/trunk/installer/factories/configuration: ./ src/main/java/org/apache/sling/installer/factories/configuration/ src/main/java/org/apache/sling/installer/factories/configuration/impl/
Date Thu, 03 Mar 2011 08:08:24 GMT
Author: cziegeler
Date: Thu Mar  3 08:08:24 2011
New Revision: 1076551

URL: http://svn.apache.org/viewvc?rev=1076551&view=rev
Log:
SLING-2014 : Provide a possibility to not persist configuration changes

Added:
    sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
  (with props)
Modified:
    sling/trunk/installer/factories/configuration/pom.xml
    sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java

Modified: sling/trunk/installer/factories/configuration/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/pom.xml?rev=1076551&r1=1076550&r2=1076551&view=diff
==============================================================================
--- sling/trunk/installer/factories/configuration/pom.xml (original)
+++ sling/trunk/installer/factories/configuration/pom.xml Thu Mar  3 08:08:24 2011
@@ -51,6 +51,9 @@
                         <Bundle-Activator>
                             org.apache.sling.installer.factories.configuration.impl.Activator
                         </Bundle-Activator>
+                        <Export-Package>
+                            org.apache.sling.installer.factories.configuration
+                        </Export-Package>
                         <Private-Package>
                             org.apache.sling.installer.factories.configuration.impl.*
                         </Private-Package>

Added: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java?rev=1076551&view=auto
==============================================================================
--- sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
(added)
+++ sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
Thu Mar  3 08:08:24 2011
@@ -0,0 +1,31 @@
+/*
+ * 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.sling.installer.factories.configuration;
+
+public abstract class ConfigurationConstants {
+
+    /**
+     * This property defines if a configuration should be persisted by the
+     * installer. This property is a boolean value defaulting to true.
+     *
+     * The property should be used, if a configuration should not be persisted
+     * by clients creating the configuration.
+     */
+    public static final String PROPERTY_PERSISTENCE = "org.apache.sling.installer.configuration.persist";
+}

Propchange: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/ConfigurationConstants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java?rev=1076551&r1=1076550&r2=1076551&view=diff
==============================================================================
--- sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
(original)
+++ sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
Thu Mar  3 08:08:24 2011
@@ -32,6 +32,7 @@ import org.apache.sling.installer.api.ta
 import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.api.tasks.TaskResourceGroup;
 import org.apache.sling.installer.api.tasks.TransformationResult;
+import org.apache.sling.installer.factories.configuration.ConfigurationConstants;
 import org.osgi.framework.Constants;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
@@ -92,10 +93,21 @@ public class ConfigTaskCreator
                             false);
                     if ( config != null ) {
                         final Dictionary<String, Object> dict = ConfigUtil.cleanConfiguration(config.getProperties());
-                        this.changeListener.resourceAddedOrUpdated(InstallableResource.TYPE_CONFIG,
id, null, dict);
+                        boolean persist = true;
+                        final Object persistProp = dict.get(ConfigurationConstants.PROPERTY_PERSISTENCE);
+                        if ( persistProp != null ) {
+                            if (persistProp instanceof Boolean) {
+                                persist = ((Boolean) persistProp).booleanValue();
+                            } else {
+                                persist = Boolean.valueOf(String.valueOf(persistProp));
+                            }
+                        }
+                        if ( persist ) {
+                            this.changeListener.resourceAddedOrUpdated(InstallableResource.TYPE_CONFIG,
id, null, dict);
+                        }
                     }
                 } catch ( final Exception ignore) {
-                    // ignore for now (TODO)
+                    // ignore for now
                 }
             }
         }



Mime
View raw message