User: schulze 
  Date: 00/11/10 15:33:30

  Modified:    src/main/org/jboss/deployment J2eeDeployer.java
  Log:
  fixed the MANIFEST.MF NullPointerException in J2eeDeployer
  
  added multible instance capabilities to J2eeDeployer and AutoDeployer (see separate 
post on jboss-user)
  
  Revision  Changes    Path
  1.11      +30 -12    jboss/src/main/org/jboss/deployment/J2eeDeployer.java
  
  Index: J2eeDeployer.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/deployment/J2eeDeployer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- J2eeDeployer.java 2000/11/07 12:17:29     1.10
  +++ J2eeDeployer.java 2000/11/10 23:33:30     1.11
  @@ -54,7 +54,7 @@
   *  (ContainerFactory for jBoss and EmbededTomcatService for Tomcat).
   *
   *   @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a>
  -*   @version $Revision: 1.10 $
  +*   @version $Revision: 1.11 $
   */
   public class J2eeDeployer 
   extends ServiceMBeanSupport
  @@ -67,6 +67,8 @@
      // Attributes ----------------------------------------------------
      // my server to lookup for the special deployers
      MBeanServer server;
  +
  +     String name;
      
      // names of the specials deployers
      ObjectName jarDeployer;
  @@ -75,9 +77,6 @@
      String jarDeployerName;
      String warDeployerName;
      
  -   // The logger for this service
  -   Log log = new Log(getName());
  -   
      
      // Static --------------------------------------------------------
      /** only for testing...*/
  @@ -90,10 +89,19 @@
      /** */
      public J2eeDeployer (String _deployDir, String jarDeployerName, String 
warDeployerName)
      {
  +        this ("", _deployDir, jarDeployerName, warDeployerName);
  +   }
  +
  +   /** */
  +   public J2eeDeployer (String _name, String _deployDir, String jarDeployerName, 
String warDeployerName)
  +   {
  +       name = _name.equals("") ? "" : " "+_name;
         DEPLOYMENT_DIR = new File (_deployDir);
         
         this.jarDeployerName = jarDeployerName;
         this.warDeployerName = warDeployerName;
  +
  +       this.log = new Log(getName());
      
      }
      
  @@ -250,14 +258,14 @@
      // ServiceMBeanSupport overrides ---------------------------------
      public String getName()
      {
  -      return "J2EE Deployer";
  +      return "J2EE Deployer" + this.name;
      }
      
      protected ObjectName getObjectName(MBeanServer server, ObjectName name)
      throws javax.management.MalformedObjectNameException
      {
         this.server = server;
  -      return new ObjectName(OBJECT_NAME);
  +      return new ObjectName(OBJECT_NAME+this.name);
      }
      
      /** */
  @@ -499,7 +507,10 @@
         
         // download libraries we depend on
         Manifest mf = new JarFile (localUrl.getFile ()).getManifest ();
  -      addCommonLibs (_d, mf, _source);
  +      if (mf != null)
  +               addCommonLibs (_d, mf, _source);
  +       else
  +               log.debug(m.name+" doesnt contain MANIFEST.MF");
   
         // add module to the deployment
         _d.ejbModules.add (m);
  @@ -528,10 +539,17 @@
         m.localUrls.add (localUrl);
         
         // download libraries we depend on
  -      FileInputStream in = new FileInputStream (localUrl.getFile 
()+File.separator+"META-INF"+File.separator+"MANIFEST.MF");
  -      Manifest mf = new Manifest (in);
  -      in.close ();
  -      addCommonLibs (_d, mf, _source);
  +       try
  +       {
  +               FileInputStream in = new FileInputStream (localUrl.getFile 
()+File.separator+"META-INF"+File.separator+"MANIFEST.MF");
  +               Manifest mf = new Manifest (in);
  +               in.close ();
  +               addCommonLibs (_d, mf, _source);
  +       }
  +       catch (IOException _ioe)
  +       {
  +               log.debug(m.name+" doesnt contain MANIFEST.MF");
  +       }
   
         // add module to the deployment
         _d.webModules.add (m);
  @@ -544,7 +562,7 @@
      *   @param _base the base url to which the manifest entries are relative
      *   @throws IOExcepiton in case of error while downloading
      */
  -   private void addCommonLibs (Deployment _d, Manifest _mf, URL _base) throws 
IOException
  +   private void addCommonLibs (Deployment _d, Manifest _mf, URL _base)
      {
         String cp = _mf.getMainAttributes ().getValue(Attributes.Name.CLASS_PATH);
         
  
  
  

Reply via email to