SLING-4271 : Provide a way to mark a resource as a template

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1648543 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 2221d25..b5bde25 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,8 +72,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.installer.api</artifactId>
-            <version>1.0.0</version>
+            <artifactId>org.apache.sling.installer.core</artifactId>
+            <version>3.5.5-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java b/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
index f3fdd94..bb01629 100644
--- a/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
+++ b/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
@@ -73,8 +73,9 @@
             // if this is an uninstall, check if we have to install an older version
             // in this case we should do an update instead of uninstall/install (!)
             final TaskResource second = group.getNextActiveResource();
-            if ( second != null &&
-                ( second.getState() == ResourceState.IGNORED || second.getState() == ResourceState.INSTALLED || second.getState() == ResourceState.INSTALL ) ) {
+            if ( second != null
+                && ( second.getState() == ResourceState.IGNORED || second.getState() == ResourceState.INSTALLED || second.getState() == ResourceState.INSTALL )
+                && ( second.getDictionary() == null || second.getDictionary().get(InstallableResource.RESOURCE_IS_TEMPLATE) == null)) {
                 result = new ChangeStateTask(group, ResourceState.UNINSTALLED);
             } else {
                 result = new ConfigRemoveTask(group, this.configAdmin);