incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1060244 - in /sling/trunk/installer/providers/jcr/src: main/java/org/apache/sling/installer/provider/jcr/impl/ test/java/org/apache/sling/installer/provider/jcr/impl/
Date Tue, 18 Jan 2011 09:01:04 GMT
Author: cziegeler
Date: Tue Jan 18 09:01:04 2011
New Revision: 1060244

URL: http://svn.apache.org/viewvc?rev=1060244&view=rev
Log:
SLING-1934 : Provider should provide all resources to the installer

Removed:
    sling/trunk/installer/providers/jcr/src/test/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverterTest.java
Modified:
    sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
    sling/trunk/installer/providers/jcr/src/test/java/org/apache/sling/installer/provider/jcr/impl/JcrInstallTestBase.java

Modified: sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java?rev=1060244&r1=1060243&r2=1060244&view=diff
==============================================================================
--- sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
(original)
+++ sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
Tue Jan 18 09:01:04 2011
@@ -18,7 +18,6 @@ package org.apache.sling.installer.provi
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.regex.Pattern;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -27,17 +26,16 @@ import org.apache.sling.installer.api.In
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** Convert a Node that is a file to an InstallableResource that wraps an InputStream */
- public class FileNodeConverter implements JcrInstaller.NodeConverter {
-    // regexp for filenames that we accept
-    public static final String FILENAME_REGEXP = "[a-zA-Z0-9].*\\.(jar|cfg|properties)";
-
-    public static final String JCR_CONTENT = "jcr:content";
-    public static final String JCR_CONTENT_DATA = JCR_CONTENT + "/jcr:data";
-    public static final String JCR_LAST_MODIFIED = "jcr:lastModified";
-    public static final String JCR_CONTENT_LAST_MODIFIED = JCR_CONTENT + "/" + JCR_LAST_MODIFIED;
+/**
+ * Convert a Node that is a file to an InstallableResource that wraps an InputStream
+ */
+public class FileNodeConverter implements JcrInstaller.NodeConverter {
+
+    private static final String JCR_CONTENT = "jcr:content";
+    private static final String JCR_CONTENT_DATA = JCR_CONTENT + "/jcr:data";
+    private static final String JCR_LAST_MODIFIED = "jcr:lastModified";
+    private static final String JCR_CONTENT_LAST_MODIFIED = JCR_CONTENT + "/" + JCR_LAST_MODIFIED;
 
-    private final Pattern namePattern = Pattern.compile(FILENAME_REGEXP);
     private final Logger log = LoggerFactory.getLogger(getClass());
 
 	/**
@@ -48,15 +46,11 @@ import org.slf4j.LoggerFactory;
 	        final int priority)
 	throws RepositoryException {
 		InstallableResource result = null;
-		if(n.hasProperty(JCR_CONTENT_DATA) && n.hasProperty(JCR_CONTENT_LAST_MODIFIED))
{
-			if(acceptNodeName(n.getName())) {
-				try {
-					result = convert(n, n.getPath(), priority);
-				} catch(IOException ioe) {
-					log.info("Conversion failed, node {} ignored ({})", n.getPath(), ioe);
-				}
-			} else {
-				log.debug("Node {} ignored due to {}", n.getPath(), namePattern);
+		if (n.hasProperty(JCR_CONTENT_DATA) && n.hasProperty(JCR_CONTENT_LAST_MODIFIED))
{
+			try {
+				result = convert(n, n.getPath(), priority);
+			} catch(IOException ioe) {
+				log.info("Conversion failed, node {} ignored ({})", n.getPath(), ioe);
 			}
 			return result;
 		}
@@ -86,8 +80,4 @@ import org.slf4j.LoggerFactory;
 
         return new InstallableResource(path, is, null, digest, null, priority);
 	}
-
-	boolean acceptNodeName(String name) {
-		return namePattern.matcher(name).matches();
-	}
 }
\ No newline at end of file

Modified: sling/trunk/installer/providers/jcr/src/test/java/org/apache/sling/installer/provider/jcr/impl/JcrInstallTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/providers/jcr/src/test/java/org/apache/sling/installer/provider/jcr/impl/JcrInstallTestBase.java?rev=1060244&r1=1060243&r2=1060244&view=diff
==============================================================================
--- sling/trunk/installer/providers/jcr/src/test/java/org/apache/sling/installer/provider/jcr/impl/JcrInstallTestBase.java
(original)
+++ sling/trunk/installer/providers/jcr/src/test/java/org/apache/sling/installer/provider/jcr/impl/JcrInstallTestBase.java
Tue Jan 18 09:01:04 2011
@@ -22,7 +22,6 @@ import javax.jcr.Session;
 
 import org.apache.sling.commons.testing.jcr.EventHelper;
 import org.apache.sling.commons.testing.jcr.RepositoryTestBase;
-import org.apache.sling.installer.provider.jcr.impl.JcrInstaller;
 import org.apache.sling.jcr.api.SlingRepository;
 
 /** Base test class with common utilities */
@@ -66,7 +65,7 @@ abstract class JcrInstallTestBase extend
 
     protected void assertRegisteredPaths(String [] paths) {
         for(String path : paths) {
-            assertRegistered(path, !path.contains("NOT"));
+            assertRegistered(path, true);
         }
     }
 



Mime
View raw message