avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/context DefaultContextualizationService.java
Date Tue, 17 Dec 2002 05:01:53 GMT
mcconnell    2002/12/16 21:01:53

  Modified:    assembly/src/java/org/apache/avalon/assembly/lifecycle/context
                        DefaultContextualizationService.java
  Log:
  Added error handling for a component the request a context entry but does not declare the
context enty.
  
  Revision  Changes    Path
  1.4       +35 -3     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/context/DefaultContextualizationService.java
  
  Index: DefaultContextualizationService.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/context/DefaultContextualizationService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultContextualizationService.java	30 Nov 2002 18:12:06 -0000	1.3
  +++ DefaultContextualizationService.java	17 Dec 2002 05:01:53 -0000	1.4
  @@ -133,9 +133,41 @@
                     "[" + appliance.getProfile().getName() + "]";
                   getLogger().debug( message );
               }
  +            Context source;
  +            if( appliance.getDeploymentContext() != null )
  +            {
  +                source = new DefaultContext( appliance.getDeploymentContext(), context
);
  +            }
  +            else
  +            {
  +                source = context;
  +            }
               Context standard =
  -              createStandardContext( appliance.getProfile(), context );
  -            ((Contextualizable)object).contextualize( standard );
  +              createStandardContext( appliance.getProfile(), source );
  +
  +            try
  +            {
  +                ((Contextualizable)object).contextualize( standard );
  +            }
  +            catch( ContextException e )
  +            {
  +                //
  +                // this could be improved if the framework ContextException 
  +                // held the context key that the client is accessing
  +                //
  +
  +                final String error = 
  +                  "Target component is requesting a context entry that has not been declared."
  +                  + " Please check component xinfo descriptor context criteria in type:
"
  +                  + appliance.getProfile().getType();
  +                throw new ContextException( error, e );
  +            }
  +            catch( Throwable e )
  +            {
  +                final String error = 
  +                  "Unexpected exception during contextualization of target: " + appliance;
  +                throw new ContextException( error, e );
  +            }
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message