You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by le...@apache.org on 2001/04/14 17:06:32 UTC

cvs commit: jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context ContextualizationException.java ContextException.java Recontextualizable.java DefaultContext.java Contextualizable.java Context.java

leosimons    01/04/14 08:06:32

  Modified:    proposal/4.0/src/java/org/apache/framework/context
                        Recontextualizable.java DefaultContext.java
                        Contextualizable.java Context.java
  Added:       proposal/4.0/src/java/org/apache/framework/context
                        ContextualizationException.java
                        ContextException.java
  Log:
  updating the lifecycle methods as discussed.
  
  Revision  Changes    Path
  1.2       +1 -1      jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Recontextualizable.java
  
  Index: Recontextualizable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Recontextualizable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Recontextualizable.java	2001/03/15 04:35:06	1.1
  +++ Recontextualizable.java	2001/04/14 15:06:29	1.2
  @@ -15,5 +15,5 @@
   public interface Recontextualizable
       extends Contextualizable
   {
  -    void recontextualizable( Context context ) ;
  +    void recontextualizable( Context context ) throws ContextException ;
   }
  
  
  
  1.2       +10 -9     jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/DefaultContext.java
  
  Index: DefaultContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/DefaultContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultContext.java	2001/04/03 23:18:04	1.1
  +++ DefaultContext.java	2001/04/14 15:06:29	1.2
  @@ -19,14 +19,15 @@
    * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
  + * @author <a href="mailto:mail@leosimons.com">Leo Simons</a>
    */
  -public class DefaultContext 
  -    implements Context 
  +public class DefaultContext
  +    implements Context
   {
       protected final Map                       m_contextData;
       protected final Context                   m_parent;
   
  -    public DefaultContext( final Map contextData, final Context parent ) 
  +    public DefaultContext( final Map contextData, final Context parent )
       {
           m_parent = parent;
           m_contextData = contextData;
  @@ -36,18 +37,18 @@
       {
           this( contextData, null );
       }
  -    
  -    public DefaultContext( final Context parent ) 
  +
  +    public DefaultContext( final Context parent )
       {
           this( new Hashtable(), parent );
       }
   
  -    public DefaultContext() 
  +    public DefaultContext()
       {
           this( (Context)null );
       }
  -    
  -    public Object get( final Object key ) 
  +
  +    public Object get( final Object key ) throws ContextException
       {
           final Object data = m_contextData.get( key );
   
  @@ -59,7 +60,7 @@
           return m_parent.get( key );
       }
   
  -    public void put( final Object key, final Object value ) 
  +    public void put( final Object key, final Object value )
       {
           m_contextData.put( key, value );
       }
  
  
  
  1.2       +4 -4      jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Contextualizable.java
  
  Index: Contextualizable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Contextualizable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Contextualizable.java	2001/03/15 04:35:06	1.1
  +++ Contextualizable.java	2001/04/14 15:06:30	1.2
  @@ -8,8 +8,8 @@
   package org.apache.framework.context;
   
   /**
  - * This inteface should be implemented by classes that need 
  - * a Context to work. Context contains runtime generated object 
  + * This inteface should be implemented by classes that need
  + * a Context to work. Context contains runtime generated object
    * provided by the parent to this class.
    *
    * @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
  @@ -20,9 +20,9 @@
   {
       /**
        * Pass the Context to the contextualizable class. This method
  -     * is always called after the constructor and, if present, 
  +     * is always called after the constructor and, if present,
        * after configure but before any other method.
        *
        */
  -    void contextualize( Context context );
  +    void contextualize( Context context ) throws ContextException;
   }
  
  
  
  1.2       +2 -1      jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/Context.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Context.java	2001/03/15 04:35:06	1.1
  +++ Context.java	2001/04/14 15:06:30	1.2
  @@ -12,8 +12,9 @@
    * @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
    * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  + * @author <a href="mailto:mail@leosimons.com">Leo Simons</a>
    */
   public interface Context
   {
  -    Object get( Object key );
  +    Object get( Object key ) throws ContextException;
   }
  
  
  
  1.1                  jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/ContextualizationException.java
  
  Index: ContextualizationException.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.framework.context;
  
  /**
   * Thrown when a <code>Contextualizable</code> component cannot be contextualized
   * properly, or if a value cannot be retrieved properly.
   *
   * @author <a href="mailto:mail@leosimons.com">Leo Simons</a>
   */
  public final class ContextualizationException
      extends ContextException
  {
      /**
       * Construct a new <code>ContextualizationException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ContextualizationException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ContextualizationException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ContextualizationException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  1.1                  jakarta-avalon/proposal/4.0/src/java/org/apache/framework/context/ContextException.java
  
  Index: ContextException.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.framework.context;
  
  import org.apache.framework.CascadingException;
  
  /**
   * Thrown when an error regarding a <code>Context</code> occurs.
   *
   * @author <a href="mailto:mail@leosimons.com">Leo Simons</a>
   */
  public class ContextException
      extends CascadingException
  {
      /**
       * Construct a new <code>ContextualizationException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ContextException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ContextualizationException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ContextException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Disposable

Posted by Stephen McConnell <mc...@osm.net>.
The javadoc in the description of Disposable seems to me to be inconsistent
with the interface.

Here is the current description:
--------------------------------

   /**
    * This interface should be implemented by those classes that
    * need to provide a service that requires some resources to be
    * initialised before being able to operate and properly destroyed
    * before termination and unloading.
    */

    Here is a proposed interface javadoc replacement:
   --------------------------------------------------

   /**
    * The Dispose interface should be implemented by classes that
    * need to dispose of internal resources prior to the destruction
    * of the implementing instance.
    */

Here current operation javadoc
------------------------------

    /**
     * Destroys the service. This method is guaranteed to be called always
     * after the stop() method if this class implements
<code>Stoppable</code>.
     */
    void dispose() throws Exception;

    Here current dispose operation javadoc replacement
   ---------------------------------------------------
    /**
     * The dispose operation will be invoked by a client on completion
     * of the useful life of instance.  An implementation of dispose is
     * responsible for cleanup internal state members and executing any
     * finalisation actions.  This method is guaranteed to be called
     * after the stop() method if the implementing class supports the
     * <code>Stoppable</code>.  If an implementation also supports the
     * Loggable interface, any log related state members may set to null.
     */
    void dispose() throws Exception;

Ok ..?

Cheers, Steve.



---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org