User: user57  
  Date: 01/12/08 23:35:14

  Modified:    src/main/org/jboss/deployment Installer.java
                        InstallerFactory.java
  Log:
   o changed some info logs to debug, when the same information was logged as
     info by a component before or after it
   o Installer & InstallerFactory create there own Loggers to make them easier
     to debug.  They don't pass around Loggers anymore, so those contructors
     (the the instance where they were used) have been updated to reflect this
     change.
  
  Revision  Changes    Path
  1.19      +51 -27    jboss/src/main/org/jboss/deployment/Installer.java
  
  Index: Installer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/Installer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Installer.java    2001/11/26 21:46:50     1.18
  +++ Installer.java    2001/12/09 07:35:14     1.19
  @@ -51,7 +51,7 @@
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Schulze</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph G. Jung</a>
  - * @version $Revision: 1.18 $
  + * @version $Revision: 1.19 $
    */
   
   public class Installer
  @@ -75,7 +75,7 @@
      Deployment d;
      
      // the log4j category for output
  -   Logger log;
  +   Logger log = Logger.getLogger(Installer.class);
   
      // to get the Log and the temprary deployment dir
      InstallerFactory factory;
  @@ -104,7 +104,6 @@
      public Installer(InstallerFactory factory, URL src) throws IOException
      {
         this.factory = factory;
  -      log = factory.log;
         this.src = src;
      }
   
  @@ -113,7 +112,10 @@
      /** install pure ejb module */
      protected URL executeEJBModule(String name, Deployment d, InputStream in, URL 
libraryRoot)  throws IOException {
          // just install the package
  -       log.info("install EJB module "+name);
  +       if (log.isDebugEnabled()) {
  +          log.debug("install EJB module "+name);
  +       }
  +       
          File f = install(in, "ejb");
          // Check for libs declared int the EJB jar manifest
          JarFile jar = new JarFile(f);
  @@ -127,7 +129,10 @@
      /** install pure war module */
      protected URL executeWarModule(String name, Deployment d, InputStream in, URL 
libraryRoot, String webContext) throws IOException {
          // just inflate the package and determine the context name
  -       log.info("inflate and install WEB module "+name);
  +       if (log.isDebugEnabled()) {
  +          log.debug("inflate and install WEB module "+name);
  +       }
  +      
          File f = installInflate(in, "web");
          // Check for libs declared int the WAR jar manifest
          URL[] libs = {};
  @@ -146,7 +151,10 @@
      
      /** install pure rar module */
      protected URL executeConnectorModule(String name, Deployment d, InputStream in, 
URL libraryRoot) throws IOException {
  -       log.info("install CONNECTOR module "+name);
  +       if (log.isDebugEnabled()) {
  +          log.debug("install CONNECTOR module "+name);
  +       }
  +       
          File f = install(in, "rar");
          // Check for libs declared int the EJB jar manifest
          JarFile jar = new JarFile(f);
  @@ -159,7 +167,9 @@
   
      /** install pure java client module */
      protected URL executeJavaModule(String name, Deployment d, InputStream in, URL 
libraryRoot) throws IOException {
  -       log.info("install JAVA application module "+name);
  +       if (log.isDebugEnabled()) {
  +          log.debug("install JAVA application module "+name);
  +       }
          File f = install(in, "java");
          // Check for libs declared int the EJB jar manifest
          JarFile jar = new JarFile(f);
  @@ -242,7 +252,7 @@
                      throw _ioe;
                  }
                  catch (NullPointerException _npe) {
  -                   log.info("module "+modName+" not found in "+d.name);
  +                   log.warn("module "+modName+" not found in "+d.name);
                      throw new J2eeDeploymentException("module "+modName+" not found 
in "+d.name);
                  }
              }
  @@ -264,7 +274,7 @@
                      throw _ioe;
                  }
                  catch (NullPointerException _npe) {
  -                   log.info("module "+modName+" not found in "+d.name);
  +                   log.warn("module "+modName+" not found in "+d.name);
                      throw new J2eeDeploymentException("module "+modName+" not found 
in "+d.name);
                  }
              } 
  @@ -273,7 +283,7 @@
                      executeConnectorModule(modName,d,jarFile.
                       getInputStream(jarFile.getEntry(modName)),libraryRoot);
                  } catch(NullPointerException e) {
  -                   log.info("module "+modName+" not found in "+d.name);
  +                   log.warn("module "+modName+" not found in "+d.name);
                      throw new J2eeDeploymentException("module "+modName+" not found 
in "+d.name);
                  }
              } else if(mod.isJava()) {
  @@ -281,7 +291,7 @@
                      executeJavaModule(modName,d,
                       jarFile.getInputStream(jarFile.getEntry(modName)),libraryRoot);
                   } catch(NullPointerException e) {
  -                   log.info("module "+modName+" not found in "+d.name);
  +                   log.warn("module "+modName+" not found in "+d.name);
                      throw new J2eeDeploymentException("module "+modName+" not found 
in "+d.name);
                  }
              } //
  @@ -290,11 +300,12 @@
          }
          
          // put all ejb jars to the common classpath too
  -       if( ejbJars.size() > 0 )
  -           log.info("add all ejb jar files to the common classpath");
  -       for(int e = 0; e < ejbJars.size(); e ++) {
  -           URL jar = (URL) ejbJars.get(e);
  -           d.commonUrls.add(jar);
  +       if( ejbJars.size() > 0 ) {
  +          log.debug("add all ejb jar files to the common classpath");
  +          for(int e = 0; e < ejbJars.size(); e ++) {
  +             URL jar = (URL) ejbJars.get(e);
  +             d.commonUrls.add(jar);
  +          }
          }
      }
   
  @@ -307,8 +318,10 @@
       */
      public Deployment execute() throws J2eeDeploymentException, IOException
      {
  -      if (done)
  -         throw new IllegalStateException("this object ("+src+")is already 
executed.");
  +      if (done) {
  +         throw new IllegalStateException
  +            ("this object ("+src+")is already executed.");
  +      }
         
         File localCopy = null;
         d = new Deployment();
  @@ -337,8 +350,11 @@
            
            // determine the type...
            int type = determineType(new JarFile(localCopy));
  -                  
  -         log.info("Create application " + d.name);
  +
  +         if (log.isDebugEnabled()) {
  +            log.debug("Create application " + d.name);
  +         }
  +         
            switch (type)
            {
               case EJB_MODULE:
  @@ -377,7 +393,8 @@
            }
            catch (Exception _e)
            {
  -            log.debug("couldnt remove unused files in 
"+baseDir.getAbsolutePath()+": "+_e.getMessage());
  +            log.warn("could not remove unused files in " +
  +                     baseDir.getAbsolutePath(), _e);
            }
            
            if (_ex instanceof J2eeDeploymentException)
  @@ -387,7 +404,7 @@
               throw (IOException) _ex;
            
            log.error("unexpected exception occured", _ex);
  -         throw new J2eeDeploymentException("unexpected exception occured (see 
server trace)");
  +         throw new J2eeDeploymentException("unexpected exception occured", _ex);
         }
         finally
         {
  @@ -403,7 +420,7 @@
            }
            catch (Exception _e)
            {
  -            log.debug("couldnt remove temporary copy "+localCopy+": 
"+_e.getMessage());
  +            log.warn("could not remove temporary copy " + localCopy, _e);
            }
         }
         
  @@ -490,12 +507,17 @@
            classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH);
         }
   
  +      boolean debug = log.isDebugEnabled();
  +      
         URL[] libs = {};
         if (classPath != null)
         {
            ArrayList tmp = new ArrayList();
            StringTokenizer st = new StringTokenizer(classPath);
  -         log.debug("resolveLibraries: "+classPath);
  +         if (debug) {
  +            log.debug("resolveLibraries: "+classPath);
  +         }
  +         
            while (st.hasMoreTokens())
            {
               String tk = st.nextToken();
  @@ -505,11 +527,13 @@
                  URL baseDir = factory.baseDir.toURL();
                  URL localURL = URLWizzard.downloadTemporary(lib, baseDir, "lib", 
".jar");
                  tmp.add(localURL);
  -               log.debug("added "+lib+" to common classpath");
  +               if (debug) {
  +                  log.debug("added "+lib+" to common classpath");
  +               }
               }
               catch (IOException _ioe)
               {
  -               log.warn("Failed to add "+tk+" to common classpath: 
"+_ioe.getMessage());
  +               log.warn("Failed to add "+tk+" to common classpath", _ioe);
               }
            }
            libs = new URL[tmp.size()];
  @@ -728,7 +752,7 @@
         while (result.exists());
         
         if (!result.mkdirs())
  -         throw new IOException("couldnt create directory: 
"+result.getCanonicalPath());
  +         throw new IOException("could not create directory: 
"+result.getCanonicalPath());
         
         return result;
      }
  
  
  
  1.12      +13 -12    jboss/src/main/org/jboss/deployment/InstallerFactory.java
  
  Index: InstallerFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/deployment/InstallerFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- InstallerFactory.java     2001/11/26 03:17:47     1.11
  +++ InstallerFactory.java     2001/12/09 07:35:14     1.12
  @@ -26,30 +26,31 @@
    *   @see <related>
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Schulze</a>
    *  @author <a href="mailto:[EMAIL PROTECTED]";>Bill Burke</a>
  - *   @version $Revision: 1.11 $
  + *   @version $Revision: 1.12 $
    */
   public class InstallerFactory
   {
      // Constants -----------------------------------------------------
      
  -   
      // Attributes ----------------------------------------------------
  -   // the deployment base directory (for the temporary files)
  +
  +   /** The deployment base directory (for the temporary files). */
      protected File baseDir;
  -   // the logger if there is something to say
  -   protected Logger log;
  +   
  +   /** Instance logger. */
  +   protected Logger log = Logger.getLogger(InstallerFactory.class);
      
      // Constructors --------------------------------------------------
      
      /** Constructs a new InstallerFactory, only one is needed per J2eeDeployer
       * @param _tmpDir the temporary deployment directory
  -    * @param _log the Log for output
       */
  -   public InstallerFactory(File _tmpDir, Logger _log) throws IOException
  -   
  +   public InstallerFactory(File _tmpDir) throws IOException
      {
         baseDir = _tmpDir.getCanonicalFile();
  -      log = _log;
  +      if (log.isDebugEnabled()) {
  +         log.debug("Using base directory: " + baseDir);
  +      }
      }
      
      // Public --------------------------------------------------------
  @@ -99,7 +100,7 @@
               }
               catch (IOException _ioe)
               {
  -               log.error("exception while searching deployments: ", _ioe);
  +               log.error("exception while searching deployments", _ioe);
               }
            }
         }
  @@ -171,7 +172,7 @@
               }
               catch (IOException _ioe)
               {
  -               log.error("exception while searching deployment: ", _ioe);
  +               log.error("exception while searching deployment", _ioe);
               }
            }
         }
  @@ -208,7 +209,7 @@
               }
               catch (IOException _ioe)
               {
  -               log.error("exception while uncluttering deployment "+files[i]+": ", 
_ioe);
  +               log.error("exception while uncluttering deployment "+files[i], _ioe);
               }
            }
            else
  
  
  

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

Reply via email to