You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2013/09/19 15:25:02 UTC

svn commit: r1524735 - in /sling/branches/tooling-ide-vlt/tooling/ide: eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java

Author: stefanegli
Date: Thu Sep 19 13:25:01 2013
New Revision: 1524735

URL: http://svn.apache.org/r1524735
Log:
SLING-3085 : (cleanup and todo added, for:) support nt:resource/jcr:data patterns to be treated as a FILE (for serialization)

Modified:
    sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
    sling/branches/tooling-ide-vlt/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java

Modified: sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java
URL: http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java?rev=1524735&r1=1524734&r2=1524735&view=diff
==============================================================================
--- sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java (original)
+++ sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ImportRepositoryContentAction.java Thu Sep 19 13:25:01 2013
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.apache.sling.ide.eclipse.core.ISlingLaunchpadServer;
 import org.apache.sling.ide.eclipse.core.ProjectUtil;
@@ -202,7 +204,8 @@ public class ImportRepositoryContentActi
         System.out.println("For resource at path " + resource.getPath() + " got serialization data "
                 + serializationData);
 
-        if (serializationData != null) {
+        final List<ResourceProxy> resourceChildren = new LinkedList<ResourceProxy>(resource.getChildren());
+		if (serializationData != null) {
 	
 	        IPath fileOrFolderPath = projectRelativePath.append(serializationData.getFileOrFolderNameHint());
 	
@@ -219,7 +222,7 @@ public class ImportRepositoryContentActi
 	                            serializationData.getContents());
 	                    
 	                    // filter out the child of type Repository.NT_RESOURCE
-	                    for (Iterator<ResourceProxy> it = resource.getChildren().iterator(); it
+	                    for (Iterator<ResourceProxy> it = resourceChildren.iterator(); it
 								.hasNext();) {
 	                    	ResourceProxy child = it.next();
 	                        if (Repository.NT_RESOURCE.equals(child.getProperties().get(Repository.JCR_PRIMARY_TYPE))) {
@@ -248,19 +251,14 @@ public class ImportRepositoryContentActi
 	            }
 	        }
 	
-	        System.out.println("Children: " + resource.getChildren());
+	        System.out.println("Children: " + resourceChildren);
 	
 	        if (serializationData.getSerializationKind() == SerializationKind.METADATA_FULL) {
 	            return;
 	        }
         }
 
-        for (ResourceProxy child : resource.getChildren()) {
-
-            // TODO - still needed?
-//            if (Repository.NT_RESOURCE.equals(child.getProperties().get(Repository.JCR_PRIMARY_TYPE))) {
-//                continue;
-//            }
+        for (ResourceProxy child : resourceChildren) {
 
             if (filter != null) {
                 FilterResult filterResult = filter.filter(contentSyncRoot, child.getPath(),

Modified: sling/branches/tooling-ide-vlt/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java
URL: http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java?rev=1524735&r1=1524734&r2=1524735&view=diff
==============================================================================
--- sling/branches/tooling-ide-vlt/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java (original)
+++ sling/branches/tooling-ide-vlt/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationDataBuilder.java Thu Sep 19 13:25:01 2013
@@ -140,6 +140,9 @@ public class VltSerializationDataBuilder
             Aggregate aggregate = vaultFile.getAggregate();
 
             if (aggregate == null) {
+            	//TODO: there are valid cases apparently when aggregate is null and yet there
+            	// are children which must be honored.. so we can't throw an exception here
+            	// but we should review why this aggregate is null here and if that's valid.
             	System.err.println("No aggregate found for path " + resource.getPath());
             	return null;
             }