[jboss-cvs] JBossAS SVN: r78887 - in trunk: system/src/main/org/jboss/system/server/profile/basic and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 26 09:57:02 EDT 2008
Author: alesj
Date: 2008-09-26 09:57:02 -0400 (Fri, 26 Sep 2008)
New Revision: 78887
Added:
trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java
Modified:
trunk/server/src/etc/conf/default/profile.xml
trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java
Log:
[JBAS-5998]; add metadata change filtering.
Modified: trunk/server/src/etc/conf/default/profile.xml
===================================================================
--- trunk/server/src/etc/conf/default/profile.xml 2008-09-26 13:42:25 UTC (rev 78886)
+++ trunk/server/src/etc/conf/default/profile.xml 2008-09-26 13:57:02 UTC (rev 78887)
@@ -19,6 +19,9 @@
</constructor>
<property name="profileRoot">${jboss.server.home.dir}</property>
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
+ <property name="filter">
+ <bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter"/>
+ </property>
</bean>
<bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
Added: trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/JspAndHtmlExcludeVirtualFileFilter.java 2008-09-26 13:57:02 UTC (rev 78887)
@@ -0,0 +1,43 @@
+/*
+* 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;
+
+/**
+ * Exclude .jsp and .(x)html files.
+ * // TODO - test this!
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class JspAndHtmlExcludeVirtualFileFilter implements VirtualFileFilter
+{
+ private static Pattern pattern = Pattern.compile("[.]+\\.(jsp|[x]?html)");
+
+ public boolean accepts(VirtualFile file)
+ {
+ return pattern.matcher(file.getName()).find() == false;
+ }
+}
\ No newline at end of file
Modified: trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java 2008-09-26 13:42:25 UTC (rev 78886)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java 2008-09-26 13:57:02 UTC (rev 78887)
@@ -36,6 +36,7 @@
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
/**
* Profile monitoring metadata changes.
@@ -49,6 +50,7 @@
public class MetaDataAwareProfile extends ProfileImpl
{
private MainDeployerStructure mainDeployer;
+ private VirtualFileFilter filter;
private Map<String, Long> lastModifiedCache;
public MetaDataAwareProfile(String profileRoot, ProfileKey key)
@@ -67,6 +69,16 @@
this.mainDeployer = mainDeployer;
}
+ /**
+ * Set the metadata resources filter.
+ *
+ * @param filter the metadata resources filter
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
protected boolean hasBeenModified(VirtualFile root) throws Exception
{
// get file:/ schema
@@ -104,7 +116,7 @@
{
for(VirtualFile metadataLocation : metadataLocations)
{
- List<VirtualFile> children = metadataLocation.getChildren();
+ List<VirtualFile> children = metadataLocation.getChildren(filter);
if (children != null && children.isEmpty() == false)
{
for(VirtualFile child : children)
Copied: trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java (from rev 78883, trunk/system/src/main/org/jboss/system/server/profile/basic/MetaDataAwareProfile.java)
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java 2008-09-26 13:57:02 UTC (rev 78887)
@@ -0,0 +1,38 @@
+/*
+* 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 org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Include only .xml files.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class XmlIncludeVirtualFileFilter implements VirtualFileFilter
+{
+ public boolean accepts(VirtualFile file)
+ {
+ return file.getName().endsWith(".xml");
+ }
+}
\ No newline at end of file
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java 2008-09-26 13:42:25 UTC (rev 78886)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/basic/MetaDataAwareProfileService.java 2008-09-26 13:57:02 UTC (rev 78887)
@@ -27,6 +27,7 @@
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.system.server.profile.basic.MetaDataAwareProfile;
+import org.jboss.virtual.VirtualFileFilter;
/**
@@ -38,6 +39,7 @@
public class MetaDataAwareProfileService extends ProfileServiceImpl
{
private MainDeployerStructure mainDeployer;
+ private VirtualFileFilter filter;
public MetaDataAwareProfileService(String name) throws IOException
{
@@ -51,6 +53,7 @@
MetaDataAwareProfile profile = new MetaDataAwareProfile(getProfileRoot(), key);
profile.setMainDeployer(mainDeployer);
+ profile.setFilter(filter);
return profile;
}
@@ -63,4 +66,14 @@
{
this.mainDeployer = mainDeployer;
}
+
+ /**
+ * Set the metadata resources filter.
+ *
+ * @param filter the metadata resources filter
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list