[jboss-cvs] JBossAS SVN: r78891 - trunk/system/src/main/org/jboss/system/server/profile/basic.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 26 10:46:47 EDT 2008
Author: alesj
Date: 2008-09-26 10:46:47 -0400 (Fri, 26 Sep 2008)
New Revision: 78891
Added:
trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
Modified:
trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
Log:
Add pattern filter support.
Added: trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/AbstractPatternVirtualFileFilter.java 2008-09-26 14:46:47 UTC (rev 78891)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system.server.profile.basic;
+
+import java.util.regex.Pattern;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Pattern filter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractPatternVirtualFileFilter implements VirtualFileFilter
+{
+ private Pattern pattern;
+
+ protected AbstractPatternVirtualFileFilter(String patternString)
+ {
+ this.pattern = Pattern.compile(patternString);
+ }
+
+ public boolean accepts(VirtualFile file)
+ {
+ return pattern.matcher(file.getName()).find() == doMatch();
+ }
+
+ /**
+ * Should we match the pattern.
+ *
+ * @return
+ */
+ protected abstract boolean doMatch();
+}
\ No newline at end of file
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java 2008-09-26 14:26:10 UTC (rev 78890)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java 2008-09-26 14:46:47 UTC (rev 78891)
@@ -21,22 +21,15 @@
*/
package org.jboss.system.server.profile.basic;
-import java.util.regex.Pattern;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
/**
* Exclude .jsp and .(x)html files.
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class JspAndHtmlExcludeVirtualFileFilter implements VirtualFileFilter
+public class JspAndHtmlExcludeVirtualFileFilter extends PatternExcludeVirtualFileFilter
{
- private static Pattern pattern = Pattern.compile("\\.(jsp|[x]?html)$");
-
- public boolean accepts(VirtualFile file)
+ public JspAndHtmlExcludeVirtualFileFilter()
{
- return pattern.matcher(file.getName()).find() == false;
+ super("\\.(jsp|[x]?html)$");
}
}
\ No newline at end of file
Copied: trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java (from rev 78890, trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java)
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/PatternExcludeVirtualFileFilter.java 2008-09-26 14:46:47 UTC (rev 78891)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system.server.profile.basic;
+
+/**
+ * Pattern exclude filter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PatternExcludeVirtualFileFilter extends AbstractPatternVirtualFileFilter
+{
+ public PatternExcludeVirtualFileFilter(String patternString)
+ {
+ super(patternString);
+ }
+
+ protected boolean doMatch()
+ {
+ return false;
+ }
+}
\ No newline at end of file
Added: trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/PatternIncludeVirtualFileFilter.java 2008-09-26 14:46:47 UTC (rev 78891)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.system.server.profile.basic;
+
+/**
+ * Pattern include filter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PatternIncludeVirtualFileFilter extends AbstractPatternVirtualFileFilter
+{
+ public PatternIncludeVirtualFileFilter(String patternString)
+ {
+ super(patternString);
+ }
+
+ protected boolean doMatch()
+ {
+ return true;
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list