[dna-commits] DNA SVN: r660 - trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Fri Dec 5 13:21:36 EST 2008


Author: spagop
Date: 2008-12-05 13:21:36 -0500 (Fri, 05 Dec 2008)
New Revision: 660

Modified:
   trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
Log:
a small impl. for the read all children and read all properties request processing

Modified: trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java	2008-12-05 15:49:58 UTC (rev 659)
+++ trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java	2008-12-05 18:21:36 UTC (rev 660)
@@ -30,8 +30,10 @@
 import org.jboss.dna.common.i18n.I18n;
 import org.jboss.dna.graph.ExecutionContext;
 import org.jboss.dna.graph.JcrLexicon;
+import org.jboss.dna.graph.JcrNtLexicon;
 import org.jboss.dna.graph.Location;
 import org.jboss.dna.graph.connectors.RepositorySourceException;
+import org.jboss.dna.graph.properties.DateTimeFactory;
 import org.jboss.dna.graph.properties.Name;
 import org.jboss.dna.graph.properties.NameFactory;
 import org.jboss.dna.graph.properties.Path;
@@ -215,19 +217,13 @@
                 SVNProperties fileProperties = new SVNProperties();
                 List<Property> properties = new ArrayList<Property>();
                 getData(parent.getString(getExecutionContext().getNamespaceRegistry()), fileProperties, os);
-
-                Property ntResourceproperty = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, "nt:resource");
+                Property ntResourceproperty = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.RESOURCE);
                 properties.add(ntResourceproperty);
                 String mimeType = fileProperties.getStringValue(SVNProperty.MIME_TYPE);
                 if (mimeType != null) {
                     Property jcrMimeTypeProperty = propertyFactory().create(JcrLexicon.MIMETYPE, mimeType);
                     properties.add(jcrMimeTypeProperty);
                 }
-                String created = fileProperties.getStringValue(SVNProperty.COMMITTED_DATE);
-                if (created != null) {
-                    Property jcrCreatedProperty = propertyFactory().create(JcrLexicon.CREATED, created);
-                    properties.add(jcrCreatedProperty);
-                }
                 SVNDirEntry entry = getEntryInfo(parent.getString(getExecutionContext().getNamespaceRegistry()));
                 Date lastModified = entry.getDate();
                 if (lastModified != null) {
@@ -243,14 +239,24 @@
                 SVNNodeKind kind = validateNodeKind(nodePath);
                 if (kind == SVNNodeKind.FILE) {
                     // "jcr:primaryType" property whose value is "nt:file".
-                    Property ntFileProperty = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, "nt:file");
+                    Property ntFileProperty = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE);
                     request.addProperty(ntFileProperty);
+                    ByteArrayOutputStream os = new ByteArrayOutputStream();
+                    SVNProperties fileProperties = new SVNProperties();
+                    getData(nodePath.getString(getExecutionContext().getNamespaceRegistry()), fileProperties, os);
+                    String created = fileProperties.getStringValue(SVNProperty.COMMITTED_DATE);
+                    if (created != null) {
+                        Property jcrCreatedProperty = propertyFactory().create(JcrLexicon.CREATED, created);
+                        request.addProperty(jcrCreatedProperty);
+                    }
 
                 } else if (kind == SVNNodeKind.DIR) {
                     // A directory maps to a single node with a name that represents the name of the directory and a
                     // "jcr:primaryType" property whose value is "nt:folder"
-                    Property property = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, "nt:folder");
+                    Property property = propertyFactory().create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FOLDER);
                     request.addProperty(property);
+                    SVNDirEntry dirEntry = getEntryInfo(nodePath.getString(getExecutionContext().getNamespaceRegistry()));
+                    request.addProperty(propertyFactory().create(JcrLexicon.CREATED, dateFactory().create(dirEntry.getDate())));
                 }
             }
             request.setActualLocationOfNode(myLocation);
@@ -311,6 +317,10 @@
         return getExecutionContext().getPropertyFactory();
     }
 
+    protected DateTimeFactory dateFactory() {
+        return getExecutionContext().getValueFactories().getDateFactory();
+    }
+
     protected Path getPathFor( Location location,
                                Request request ) {
         Path path = location.getPath();




More information about the dna-commits mailing list