You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/04/30 13:31:41 UTC

svn commit: r652339 - in /incubator/sling/trunk: ./ jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ jcr/resource/ jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/loader/

Author: cziegeler
Date: Wed Apr 30 04:31:40 2008
New Revision: 652339

URL: http://svn.apache.org/viewvc?rev=652339&view=rev
Log:
SLING-400: Move content loading to own bundle.

Removed:
    incubator/sling/trunk/jcr/resource/LICENSE.kxml2
    incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/loader/
Modified:
    incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
    incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/PathEntry.java
    incubator/sling/trunk/jcr/resource/NOTICE
    incubator/sling/trunk/jcr/resource/pom.xml
    incubator/sling/trunk/pom.xml

Modified: incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java?rev=652339&r1=652338&r2=652339&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java (original)
+++ incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java Wed Apr 30 04:31:40 2008
@@ -658,7 +658,7 @@
                 bundle.getSymbolicName());
             while (pathIter.hasNext() ) {
                 final PathEntry entry = pathIter.next();
-                if ( entry.isOverwrite() ) {
+                if ( entry.isUninstall() ) {
                     this.uninstallFromPath(bundle, entry.getPath(), session.getRootNode());
                 } else {
                     log.debug("Ignoring to uninstall content at {}, overwrite flag is not set.", entry.getPath());

Modified: incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/PathEntry.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/PathEntry.java?rev=652339&r1=652338&r2=652339&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/PathEntry.java (original)
+++ incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/PathEntry.java Wed Apr 30 04:31:40 2008
@@ -36,12 +36,18 @@
     /** The overwrite flag specifying if content should be overwritten or just initially added. */
     public static final String OVERWRITE_FLAG = "overwrite";
 
+    /** The uninstall flag specifying if content should be uninstalled. */
+    public static final String UNINSTALL_FLAG = "uninstall";
+
     /** The path for the initial content. */
     private final String path;
 
     /** Should existing content be overwritten? */
     private final boolean overwrite;
 
+    /** Should existing content be uninstalled? */
+    private final boolean uninstall;
+
     public static Iterator<PathEntry> getContentPaths(final Bundle bundle) {
         final List<PathEntry> entries = new ArrayList<PathEntry>();
 
@@ -62,7 +68,8 @@
 
     public PathEntry(String path) {
         // check for overwrite flag
-        boolean overwrite = false;
+        boolean overwriteFlag = false;
+        Boolean uninstallFlag = null;
         int flagPos = path.indexOf(";");
         if ( flagPos != -1 ) {
             final StringTokenizer flagTokenizer = new StringTokenizer(path.substring(flagPos+1), ";");
@@ -70,15 +77,24 @@
                 final String token = flagTokenizer.nextToken();
                 int pos = token.indexOf(":=");
                 if ( pos != -1 ) {
-                    if ( token.substring(0, pos).equals(OVERWRITE_FLAG) ) {
-                        overwrite = Boolean.valueOf(token.substring(pos+2));
+                    final String name = token.substring(0, pos);
+                    final String value = token.substring(pos+2);
+                    if ( name.equals(OVERWRITE_FLAG) ) {
+                        overwriteFlag = Boolean.valueOf(value).booleanValue();
+                    } else if (name.equals(UNINSTALL_FLAG) ) {
+                        uninstallFlag = Boolean.valueOf(value);
                     }
                 }
             }
             path = path.substring(0, flagPos);
         }
         this.path = path;
-        this.overwrite = overwrite;
+        this.overwrite = overwriteFlag;
+        if ( uninstallFlag != null ) {
+            this.uninstall = uninstallFlag;
+        } else {
+            this.uninstall = this.overwrite;
+        }
     }
 
     public String getPath() {
@@ -88,4 +104,8 @@
     public boolean isOverwrite() {
         return this.overwrite;
     }
+
+    public boolean isUninstall() {
+        return this.uninstall;
+    }
 }

Modified: incubator/sling/trunk/jcr/resource/NOTICE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/NOTICE?rev=652339&r1=652338&r2=652339&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/NOTICE (original)
+++ incubator/sling/trunk/jcr/resource/NOTICE Wed Apr 30 04:31:40 2008
@@ -7,6 +7,3 @@
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
 Licensed under the Apache License 2.0.
-
-This product includes software from http://kxml.sourceforge.net.
-Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany.

Modified: incubator/sling/trunk/jcr/resource/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/pom.xml?rev=652339&r1=652338&r2=652339&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/pom.xml (original)
+++ incubator/sling/trunk/jcr/resource/pom.xml Wed Apr 30 04:31:40 2008
@@ -30,11 +30,9 @@
     <version>2.0.0-incubator-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <name>Sling - Resource Resolver and Initial Content Loader</name>
+    <name>Sling - Resource Resolver</name>
     <description>
-        This bundle provides two kinds of Repository Content related
-        functionality: The JCR based ResourceResolver and initial
-        content installation.
+        This bundle provides the JCR based ResourceResolver.
     </description>
 
     <scm>
@@ -62,27 +60,17 @@
                 <configuration>
                     <instructions>
                         <Export-Package>
-                            org.apache.sling.jcr.resource;version=${pom.version},
+                            org.apache.sling.jcr.resource;version=${pom.version}
                         </Export-Package>
                         <Private-Package>
                             org.apache.sling.jcr.resource.internal.*,
-                            org.apache.jackrabbit.net,
-                            org.apache.jackrabbit;
-                            org.apache.jackrabbit.name;
-                            org.apache.jackrabbit.util;
-                            org.apache.jackrabbit.uuid;
-                            org.apache.jackrabbit.value;-split-package:=merge-first,
-                            org.kxml2.io, org.xmlpull.v1
+                            org.apache.jackrabbit.net
                         </Private-Package>
 
                         <Sling-Namespaces>
                             sling=http://sling.apache.org/jcr/sling/1.0
                         </Sling-Namespaces>
 
-                        <Embed-Dependency>
-                            jackrabbit-classloader, kxml2
-                        </Embed-Dependency>
-
                         <Sling-Nodetypes>
                             SLING-INF/nodetypes/resource.cnd
                         </Sling-Nodetypes>
@@ -112,21 +100,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.mime</artifactId>
-            <version>2.0.0-incubator-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.json</artifactId>
-            <version>2.0.0-incubator-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.osgi.commons</artifactId>
-            <version>2.0.0-incubator-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.api</artifactId>
             <version>2.0.0-incubator-SNAPSHOT</version>
         </dependency>
@@ -136,21 +109,18 @@
             <version>2.0.0-incubator-SNAPSHOT</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.testing</artifactId>
-            <version>2.0.0-incubator-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
+            <artifactId>slf4j-api</artifactId>
         </dependency>
+       <dependency>
+           <groupId>commons-collections</groupId>
+           <artifactId>commons-collections</artifactId>
+       </dependency>
 
         <!-- for adapting JCR resources to URLs -->
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-commons</artifactId>
-            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
@@ -158,23 +128,13 @@
             <scope>compile</scope>
         </dependency>
 
+      <!-- Testing -->
         <dependency>
-            <groupId>net.sf.kxml</groupId>
-            <artifactId>kxml2</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-collections</groupId>
-            <artifactId>commons-collections</artifactId>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.testing</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+            <scope>test</scope>
         </dependency>
-
-      <!-- Testing -->
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
@@ -183,7 +143,11 @@
             <groupId>org.jmock</groupId>
             <artifactId>jmock-junit4</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-core</artifactId>

Modified: incubator/sling/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/pom.xml?rev=652339&r1=652338&r2=652339&view=diff
==============================================================================
--- incubator/sling/trunk/pom.xml (original)
+++ incubator/sling/trunk/pom.xml Wed Apr 30 04:31:40 2008
@@ -78,6 +78,7 @@
         <module>jcr/api</module>
         <module>jcr/base</module>
         <module>jcr/classloader</module>
+        <module>jcr/contentloader</module>
         <module>jcr/default-rtp</module>
         <module>jcr/jackrabbit-client</module>
         <module>jcr/jackrabbit-server</module>