geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan CreateMBeanInstance.java
Date Sat, 06 Sep 2003 14:30:32 GMT
chirino     2003/09/06 07:30:32

  Modified:    modules/core/src/java/org/apache/geronimo/deployment
                        DeploymentException.java
               modules/core/src/java/org/apache/geronimo/deployment/plan
                        CreateMBeanInstance.java
  Log:
  Allowed MBeanMetatdata to be passed to the DeploymentException.  A deployment exception
can now say what MBean was being deployed when the exception happened.
  
  Revision  Changes    Path
  1.2       +46 -1     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/DeploymentException.java
  
  Index: DeploymentException.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/DeploymentException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentException.java	11 Aug 2003 17:59:10 -0000	1.1
  +++ DeploymentException.java	6 Sep 2003 14:30:32 -0000	1.2
  @@ -55,24 +55,69 @@
    */
   package org.apache.geronimo.deployment;
   
  +import org.apache.geronimo.deployment.service.MBeanMetadata;
  +
   /**
    *
    *
    * @version $Revision$ $Date$
    */
   public class DeploymentException extends Exception {
  +    
  +    private MBeanMetadata metadata;
  +
  +    /**
  +     * @return
  +     */
  +    public MBeanMetadata getMetadata() {
  +        return metadata;
  +    }
  +
       public DeploymentException() {
       }
   
  +    public DeploymentException(MBeanMetadata metadata) {
  +        this.metadata=metadata;
  +    }
  +
       public DeploymentException(Throwable cause) {
           super(cause);
       }
   
  +    public DeploymentException(Throwable cause, MBeanMetadata metadata) {
  +        super(cause);
  +        this.metadata=metadata;
  +    }
  +
       public DeploymentException(String message) {
           super(message);
       }
   
  +    public DeploymentException(String message, MBeanMetadata metadata) {
  +        super(message);
  +        this.metadata=metadata;
  +    }
  +
       public DeploymentException(String message, Throwable cause) {
           super(message, cause);
  +    }
  +
  +    public DeploymentException(String message, Throwable cause, MBeanMetadata metadata)
{
  +        super(message, cause);
  +        this.metadata=metadata;
  +    }
  +    
  +    /**
  +     * @see java.lang.Throwable#getMessage()
  +     */
  +    public String getMessage() {
  +        if( metadata==null)
  +            return super.getMessage();
  +        StringBuffer sb = new StringBuffer();
  +        sb.append("[");
  +        sb.append(metadata.getName());
  +        sb.append("] ");
  +        sb.append( super.getMessage() );
  +        return sb.toString();
       }
   }
  
  
  
  1.15      +9 -9      incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/CreateMBeanInstance.java
  
  Index: CreateMBeanInstance.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/CreateMBeanInstance.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CreateMBeanInstance.java	5 Sep 2003 04:52:04 -0000	1.14
  +++ CreateMBeanInstance.java	6 Sep 2003 14:30:32 -0000	1.15
  @@ -163,7 +163,7 @@
                           // load class code is more friendly then the Sun code
                           constructorTypeStrings.set(i, type.getName());
                       } catch (ClassNotFoundException e) {
  -                        throw new DeploymentException(e);
  +                        throw new DeploymentException(e,metadata);
                       }
                       constructorTypes.add(type);
   
  @@ -217,19 +217,19 @@
                   dependencyService.addStartDependency(actualName, metadata.getParentName());
                   dependencyService.addRelationships(actualName, metadata.getRelationships());
               } catch (MalformedObjectNameException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               } catch (RuntimeException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               } catch (InstanceNotFoundException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               } catch (ReflectionException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               } catch (InstanceAlreadyExistsException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               } catch (MBeanException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               } catch (NotCompliantMBeanException e) {
  -                throw new DeploymentException(e);
  +                throw new DeploymentException(e,metadata);
               }
           } catch (DeploymentException e) {
               undo();
  
  
  

Mime
View raw message