[jboss-cvs] JBossAS SVN: r86932 - projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 7 11:42:26 EDT 2009


Author: alesj
Date: 2009-04-07 11:42:25 -0400 (Tue, 07 Apr 2009)
New Revision: 86932

Added:
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java
Modified:
   projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
Log:
Initial synch code.

Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2009-04-07 15:42:20 UTC (rev 86931)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java	2009-04-07 15:42:25 UTC (rev 86932)
@@ -49,6 +49,10 @@
    /** The structure cache */
    private StructureCache<T> cache;
 
+   protected AbstractStructureModificationChecker()
+   {
+   }
+
    protected AbstractStructureModificationChecker(MainDeployerStructure mainDeployer)
    {
       if (mainDeployer == null)
@@ -81,6 +85,19 @@
    }
 
    /**
+    * Get main deployer structure.
+    *
+    * @return the main deployer structure
+    */
+   protected MainDeployerStructure getMainDeployerStructure()
+   {
+      if (mainDeployer == null)
+         throw new IllegalArgumentException("Null main deployer structure");
+
+      return mainDeployer;
+   }
+
+   /**
     * Get deployment context.
     *
     * @param name the deployment context name
@@ -89,7 +106,7 @@
    @SuppressWarnings("deprecation")
    protected VFSDeploymentContext getDeploymentContext(String name)
    {
-      DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
+      DeploymentContext deploymentContext = getMainDeployerStructure().getDeploymentContext(name);
       if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
          return null;
 

Copied: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java (from rev 86822, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java	2009-04-07 15:42:25 UTC (rev 86932)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Synch wrapper modification checker.
+ *
+ * If there is no modification, we check if the deployment is perhaps a temp,
+ * only then checking if we need to update some resource.
+ * e.g. some .jsp or .xhtml file for JBossWeb to pick up the change
+ *
+ * @param <T> exact checker type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SynchWrapperModificationChecker<T> extends AbstractStructureModificationChecker<T>
+{
+   /** The true checker delegate */
+   private AbstractStructureModificationChecker<T> delegate;
+
+   public SynchWrapperModificationChecker(AbstractStructureModificationChecker<T> delegate)
+   {
+      if (delegate == null)
+         throw new IllegalArgumentException("Null delegate");
+
+      this.delegate = delegate;
+   }
+
+   @Override
+   protected StructureCache<T> getCache()
+   {
+      return delegate.getCache();
+   }
+
+   @Override
+   protected MainDeployerStructure getMainDeployerStructure()
+   {
+      return delegate.getMainDeployerStructure();
+   }
+
+   protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
+   {
+      boolean modified = delegate.hasStructureBeenModifed(root, deploymentContext);
+      // it was not modifed & we're actually temped
+      if (modified == false && root != deploymentContext.getRoot())
+      {
+         // TODO - synch
+      }
+      return modified;
+   }
+
+   public void addStructureRoot(VirtualFile root)
+   {
+      delegate.addStructureRoot(root);
+   }
+
+   public void removeStructureRoot(VirtualFile root)
+   {
+      delegate.removeStructureRoot(root);
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list