User: d_jencks
  Date: 02/02/12 19:38:33

  Modified:    src/main/org/jboss/deployment MainDeployer.java
  Log:
  made redeploy work yet again
  
  Revision  Changes    Path
  1.16      +25 -45    jboss/src/main/org/jboss/deployment/MainDeployer.java
  
  Index: MainDeployer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/MainDeployer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- MainDeployer.java 12 Feb 2002 06:59:22 -0000      1.15
  +++ MainDeployer.java 13 Feb 2002 03:38:32 -0000      1.16
  @@ -45,7 +45,7 @@
    * Takes a series of URL to watch, detects changes and calls the appropriate 
Deployers 
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
  - * @version $Revision: 1.15 $
  + * @version $Revision: 1.16 $
    */
   public class MainDeployer
      extends ServiceMBeanSupport
  @@ -76,6 +76,9 @@
      /** The temporary directory for deployments. */
      private File tempDir;
   
  +   /** The string naming the tempDir **/
  +   private String tempDirString;
  +
      /** The system home directory (for dealing with relative file names). */
      private File homeDir;
   
  @@ -182,38 +185,34 @@
         return name == null ? OBJECT_NAME : name;
      }
   
  -   /**
  -    * Get the local state data directory from the server configuration.
  -    */
  -   public ObjectName preRegister(MBeanServer server, ObjectName name)
  +   protected void createService()
         throws Exception
      {
  -      name = super.preRegister(server, name);
  -      
  +      // watch the deploy directory, it is a set so multiple adds 
  +      // (start/stop) only one entry is present
         // get the temporary directory to use
  -      tempDir = (File)
  -         server.getAttribute(ServerConfigMBean.OBJECT_NAME, "TempDir");
  -      tempDir = new File(tempDir, "deploy");
  +      tempDir = new File((File)server.getAttribute(ServerConfigMBean.OBJECT_NAME, 
"TempDir"),
  +                         "deploy");
  +
  +      //used in isWatched
  +      tempDirString = tempDir.toURL().toString(); 
   
         // get the system home directory
  -      homeDir = (File)
  -         server.getAttribute(ServerConfigMBean.OBJECT_NAME, "HomeDir");
  -      
  -      return name;
  +      homeDir = (File)server.getAttribute(ServerConfigMBean.OBJECT_NAME, "HomeDir");
  +
  +      //Watch in our standard directory.  This should be derived from configuration 
info.      
  +      addDirectory("deploy");
      }
      
  +   /**
  +    * Get the local state data directory from the server configuration.
  +    */
      protected void startService()
         throws Exception
      {
  -      // watch the deploy directory, it is a set so multiple adds 
  -      // (start/stop) only one entry is present
  -
  -      // FIXME: Should pull this from ServerConfig
  -      addDirectory("deploy");
  -      
  -      // Do a first pass
  +      //just so we can time startup...
         scan();
  -      
  +
         // Start auto deploy thread
         running = true;
         
  @@ -244,7 +243,6 @@
      {
         do
         {   
  -         scan();
            // Sleep
            try
            {
  @@ -254,6 +252,7 @@
            {
               log.debug("interrupted");
            }
  +         scan();
         } 
         while (running);
      }
  @@ -472,8 +471,9 @@
            //watch it, it will be picked up as modified below, deployments is a map 
duplicates are ok
            deployments.put(deployment.url, deployment);
            
  -         // Do we watch it?
  -         if (isWatched(deployment)) {
  +         // Do we watch it? Watch only urls outside our copy directory.
  +         if (!deployment.url.toString().startsWith(tempDirString)) 
  +         {
               deploymentsList.add(deployment);
               if (debug)
               {
  @@ -483,21 +483,6 @@
         }
      }
   
  -   private boolean isWatched(DeploymentInfo deployment) {
  -      String tmp = null;
  -      try {
  -         tmp = tempDir.toURL().toString();
  -      }
  -      catch (java.net.MalformedURLException e) {
  -         // this will never happen, yet must make the compiler happy
  -         throw new Error("Failed to convert File to URL: " + e);
  -      }
  -      
  -      if (deployment.url.toString().startsWith(tmp)) {
  -         return true;
  -      }
  -      return false;
  -   }
   
      public void findDeployer(DeploymentInfo sdi) 
      {
  @@ -529,11 +514,6 @@
         }
      }
   
  -   public void preDeregister()
  -      throws Exception
  -   {
  -      running = false;
  -   }
      
      /**
       * ScanNew scans the directories that are given to it and returns a 
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to