"alesj" wrote :
| We need to move "Deployment::hasBeenModified" off the VFSDeploymentContext.
| I guess some combination of VFSDeployment and VFSDeploymentContext's metadata
locations.
|
| I'll see what can be done ...
|
|
Does this look legit enough?
| Index:
src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
| ===================================================================
| ---
src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
(revision 83887)
| +++
src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
(working copy)
| @@ -37,8 +37,10 @@
| import java.util.concurrent.locks.ReentrantReadWriteLock;
| import java.util.zip.ZipInputStream;
|
| +import org.jboss.deployers.client.spi.Deployment;
| import org.jboss.deployers.structure.spi.DeploymentContext;
| import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
| +import org.jboss.deployers.vfs.spi.client.VFSDeployment;
| import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
| import org.jboss.profileservice.spi.DeploymentContentFlags;
| import org.jboss.profileservice.spi.ModificationInfo;
| @@ -320,9 +322,19 @@
| */
| protected boolean hasBeenModified(VFSDeploymentContext deploymentContext, boolean
checkRoot) throws IOException
| {
| + Deployment clientDeployment = deploymentContext.getDeployment();
| + if (clientDeployment instanceof VFSDeployment == false)
| + {
| + if (log.isTraceEnabled())
| + log.trace("Deployment is not VFS based: " + clientDeployment);
| + return false;
| + }
| +
| + VFSDeployment deployment = VFSDeployment.class.cast(clientDeployment);
| + VirtualFile root = deployment.getRoot();
| +
| if (checkRoot)
| {
| - VirtualFile root = deploymentContext.getRoot();
| // no need to check metadata locations if archive or root
| if (root.isArchive() || root.isLeaf())
| return root.hasBeenModified();
| @@ -338,15 +350,20 @@
| {
| for(VirtualFile child : children)
| {
| - String pathName = child.getPathName();
| - Long timestamp = lastModifiedCache.get(pathName);
| - long lastModified = child.getLastModified();
| - lastModifiedCache.put(pathName, lastModified);
| - if (timestamp != null && timestamp < lastModified)
| + // get client side metadata - if exists
| + VirtualFile clientChild = getClientChild(root, child);
| + if (clientChild != null)
| {
| - if (log.isTraceEnabled())
| - log.trace("Metadata location modified: " + child);
| - return true;
| + String pathName = child.getPathName();
| + Long timestamp = lastModifiedCache.get(pathName);
| + long lastModified = clientChild.getLastModified();
| + lastModifiedCache.put(pathName, lastModified);
| + if (timestamp != null && timestamp < lastModified)
| + {
| + if (log.isTraceEnabled())
| + log.trace("Metadata location modified: " +
clientChild);
| + return true;
| + }
| }
| }
| }
| @@ -368,6 +385,21 @@
| }
|
| /**
| + * Get client side child.
| + *
| + * @param root the client root
| + * @param child the server child
| + * @return matching client child if exists
| + * @throws IOException for any error
| + */
| + protected VirtualFile getClientChild(VirtualFile root, VirtualFile child) throws
IOException
| + {
| + String rootPathName = root.getPathName();
| + String childPathName = child.getPathName();
| + return root.getChild(childPathName.substring(rootPathName.length()));
| + }
| +
| + /**
| * Cleanup last modified cache for path name.
| *
| * @param pathName the path name
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207385#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...