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 UnresolvedProviderException.java UnresolvedManagerException.java DefaultAssemblyService.java AssemblyService.java AssemblyException.java
Date Thu, 19 Dec 2002 10:38:30 GMT
mcconnell    2002/12/19 02:38:30

  Added:       assembly/src/java/org/apache/avalon/assembly/lifecycle
                        UnresolvedProviderException.java
                        UnresolvedManagerException.java
                        DefaultAssemblyService.java AssemblyService.java
                        AssemblyException.java
  Log:
  Moved from engine to lifecycle package.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/UnresolvedProviderException.java
  
  Index: UnresolvedProviderException.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.assembly.lifecycle;
  
  import org.apache.avalon.meta.info.DependencyDescriptor;
  
  /**
   * Exception to indicate that a service provider could not be found.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/12/19 10:38:30 $
   */
  public final class UnresolvedProviderException
      extends AssemblyException
  {
  
      private DependencyDescriptor m_dependency;
  
      /**
       * Construct a new <code>UnresolvedProviderException</code> instance.
       *
       * @param dependency the unresolved dependency
       */
      public UnresolvedProviderException( DependencyDescriptor dependency )
      {
          this( dependency, null );
      }
  
      /**
       * Construct a new <code>UnresolvedProviderException</code> instance.
       *
       * @param dependency the unresolved dependency
       * @param cause the causal exception
       */
      public UnresolvedProviderException( DependencyDescriptor dependency, Throwable cause
)
      {
          super( getStandardMessage( dependency ), cause );
          m_dependency = dependency;
      }
  
      /**
       * Return the dependency description.
       * @return the unresolved dependency.
       */
      public DependencyDescriptor getDependency()
      {
          return m_dependency;
      }
  
      private static String getStandardMessage( DependencyDescriptor dependency )
      {
          return "Unable to resolve a provider for the dependency '"
              + dependency.getReference() + "' for the role: " + dependency.getRole();
      }
  
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/UnresolvedManagerException.java
  
  Index: UnresolvedManagerException.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.assembly.lifecycle;
  
  import org.apache.avalon.meta.info.StageDescriptor;
  
  /**
   * Exception to indicate that a service provider could not be found.
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/12/19 10:38:30 $
   */
  public final class UnresolvedManagerException
      extends AssemblyException
  {
  
      private StageDescriptor m_phase;
  
      /**
       * Construct a new <code>UnresolvedManagerException</code> instance.
       *
       * @param phase the unresolved phase
       */
      public UnresolvedManagerException( StageDescriptor phase )
      {
          this( phase, null );
      }
  
      /**
       * Construct a new <code>UnresolvedManagerException</code> instance.
       *
       * @param phase the unresolved phase
       * @param cause the causal exception
       */
      public UnresolvedManagerException( StageDescriptor phase, Throwable cause )
      {
          super( getStandardMessage( phase ), cause );
          m_phase = phase;
      }
  
      /**
       * Return the dependency description.
       * @return the unresolved dependency.
       */
      public StageDescriptor getPhase()
      {
          return m_phase;
      }
  
      private static String getStandardMessage( StageDescriptor phase )
      {
          return "Unable to resolve an extensions for the phase '"
              + phase.getReference();
      }
  
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/DefaultAssemblyService.java
  
  Index: DefaultAssemblyService.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.lifecycle;
  
  import java.util.List;
  import java.util.ArrayList;
  import java.util.Map;
  
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.assembly.appliance.Appliance;
  import org.apache.avalon.assembly.engine.Engine;
  import org.apache.avalon.assembly.appliance.DependencyGraph;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.info.ReferenceDescriptor;
  import org.apache.avalon.meta.info.ContextDescriptor;
  
  /**
   * A assembly service is responsible for the resolution of a component 
   * service depedencies, and the construction supply of a component or
   * service manager to a target object.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/12/19 10:38:30 $
   */
  public class DefaultAssemblyService extends AbstractLogEnabled implements AssemblyService,
Contextualizable, Serviceable, Initializable
  {
      //==============================================================
      // static
      //==============================================================
  
      private static final String ENGINE_KEY = "urn:assembly:engine.classloader";
  
      //==============================================================
      // state
      //==============================================================
  
      private ServiceManager m_manager;
  
      private boolean m_initialized = false;
  
      private DependencyGraph m_map;
  
      private Engine m_engine;
  
      private ArrayList m_visited = new ArrayList();
  
      //==============================================================
      // Contextualizable
      //==============================================================
  
     /**
      * <p>Application of a runtime context to this component.
      * Context entries that may be supplied to an appliance manager are detailed in the
      * following table.</p>
      * <table>
      *   <tr>
      *     <td>key</td><td>type</td><td>default</td>
      *   </tr>
      *   <tr>
      *     <td>urn:assembly:dependency-map</td>
      *     <td>org.apache.avalon.assembly.appliance.DepedendencyGraph</td>
      *     <td>The depedency graph.</td> 
      *   </tr>
      * </table>
      * @param context the runtime context
      */
      public void contextualize( Context context ) throws ContextException
      {
          m_map = (DependencyGraph) context.get( "urn:assembly:dependency-map" );
      }
  
      //==============================================================
      // Serviceable
      //==============================================================
  
     /**
      * <p>Supply of container based services that may be used by the 
      * assembly service as supplimentary resources.</p>
      * @param manager the service manager
      */
      public void service( ServiceManager manager ) throws ServiceException
      {
           if( manager.hasService( ENGINE_KEY ) )
           {
               m_manager = manager;
           }
           else
           {
               throw new ServiceException( ENGINE_KEY );
           }
      }
  
      //==============================================================
      // Initializable
      //==============================================================
  
     /**
      * Initialization fo the component by the container.  The implementation
      * validates a logger has been assigned and that the context phase has 
      * been executed, following which it flags initialization as complete and 
      * marks the component as ready to serve requests.
      *
      * @exception Exception if the manager has not been suppied with a context
      */
      public void initialize() throws Exception
      {
          if( getLogger() == null )
          {
              throw new IllegalStateException("logger");
          }
          if( m_map == null )
          {
              throw new IllegalStateException("contextaulize");
          }
          if( m_manager == null )
          {
              throw new IllegalStateException("service");
          }
  
          m_initialized = true;
      }
  
      //==============================================================
      // AssemblyService
      //==============================================================
  
     /**
      * Assemble the supplied appliance.
      * @param appliance the object to assembly
      */
      public void assemble( Appliance appliance ) throws AssemblyException
      {
          if( appliance == null )
          {
              throw new NullPointerException( "appliance" );
          }
          assembleAppliance( m_map, appliance, m_visited, "" );
      }
  
     /**
      * Disassemble the supplied appliance.
      * @param appliance the object to disassemble
      */
      public void disassemble( Appliance appliance )
      {
          if( getLogger().isDebugEnabled() )
          {
              getLogger().debug("dissasemble: " + appliance );
          }
          Appliance[] consumers = m_map.getConsumerGraph( appliance );
          for( int i=0; i<consumers.length; i++ )
          {
              Appliance consumer = consumers[i];
              if( getLogger().isDebugEnabled() )
              {
                  getLogger().debug("terminating consumer: " + consumer );
              }
              consumer.terminate();
              m_map.remove( consumer );
          }
      }
  
     /**
      * Utility to get the engine from the service manager.  This operation
      * should not be invoked before completion of initialization.
      * @return the engine
      * @exception IllegalStateException if invoked during or prior to 
      *    component initialization
      */
      protected Engine getEngine() throws IllegalStateException
      {
          if( m_engine == null )
          {
              if( !m_initialized )
              {
                  throw new IllegalStateException("initialization");
              }
              try
              {
                  m_engine = (Engine) m_manager.lookup( ENGINE_KEY );
              }
              catch( ServiceException e )
              {
                  throw new IllegalStateException("engine");
              }
          }
          return m_engine;
      }
  
      /**
       * Assemble a single appliance.
       * @param map the current depedency map to populate
       * @param profile the profile to assemble
       * @param context the assembly context
       * @param visited the set of profiles already assessed
       * @param pad used in formatting log messages
       * @exception AssemblyException if an assembly related error occurs
       */
      private void assembleAppliance(
          DependencyGraph map, Appliance appliance, List visited, String pad )
          throws AssemblyException
      {
          if( map == null )
          {
              throw new NullPointerException( "map" );
          }
          if( appliance == null )
          {
              throw new NullPointerException( "appliance" );
          }
          if( visited == null )
          {
              throw new NullPointerException( "visited" );
          }
  
          String name = appliance.getProfile().getName();
          getLogger().debug( pad + "assemble: " + name );
          String pad2 = pad + " ";
  
          visited.add( appliance );
  
          ContextDescriptor context = appliance.getProfile().getType().getContext();
          String ext = context.getAttribute( "urn:assembly:lifecycle.context.extension" );
          if(( ext != null ) && ( appliance.getContextProvider() == null ))
          {
              final String message = "resolving context handler for: " + appliance ;
              getLogger().debug( message );
  
              Appliance supplier;
              ReferenceDescriptor ref = ReferenceDescriptor.newInstance( ext );
              StageDescriptor stage = new StageDescriptor( ref );
              try
              {
                  supplier = 
                    getEngine().resolve( stage, appliance.getPartitionName() );
              }
              catch( Throwable e )
              {
                  appliance.setEnabled( false );
                  final String error =
                     "Unable to resolve a supplier for a context stage: " + ext
                     + " in appliance: " + appliance;
                  throw new AssemblyException( error, e );
              }
  
              if( supplier == null )
              {
                  final String error =
                    "Unresolved context handler: "
                    + ext + " in appliance: " + appliance;
                  appliance.setEnabled( false );
                  final Exception problem = new Exception( error );
                  throw new AssemblyException( error );
              }
              else
              {
                  appliance.setContextProvider( supplier );
                  map.add( supplier );
                  getLogger().debug( 
                    "assigning context handler: " + supplier 
                    + " to: " + appliance );
              }
          }
  
          //
          // for all of the declared dependencies - make sure the
          // dependency is satisfied
          //
  
          DependencyDescriptor[] dependencies = appliance.getProfile().getType().getDependencies();
          for( int i = 0; i < dependencies.length; i++ )
          {
              DependencyDescriptor dependency = dependencies[ i ];
              String role = dependency.getRole();
              if( appliance.getServiceProvider( role ) == null )
              {
  
                  getLogger().debug( "resolving role: [" + role + "] on [" + name + "]");
  
                  //
                  // select the preferred provider for the dependency - the dependency
                  // argument contains the selection policy to apply
                  //
  
                  Appliance supplier = null;
  
                  try
                  {
                      supplier = getEngine().resolve( dependency, appliance.getPartitionName()
);
                  }
                  catch( Throwable e )
                  {
                      appliance.setEnabled( false );
                      final String error =
                          "Unable to deploy a supplier for a service dependency: "
                          + dependency;
                      throw new AssemblyException( error, e );
                  }
  
                  if( supplier == null )
                  {
                      final String message =
                          "Unresolved supplied for the dependency: "
                          + dependency.getReference() + " in appliance: " + appliance
                          + ", for the role: " + dependency.getRole();
  
                      appliance.setEnabled( false );
                      final Exception problem = new Exception( message );
                      throw new UnresolvedProviderException( dependency, problem );
                  }
  
                  //
                  // associate the supplier to the appliance
                  //
  
                  appliance.addServiceProvider( role, supplier );
  
                  getLogger().debug( 
                    pad 
                    + "  associated supplier: " + supplier.getProfile().getName()
                    + " with appliance: " + name
                    + " under the role: " + role );
  
                  map.add( supplier );
              }
          }
  
          //
          // for all of the lifecycle phases - make sure we assign an extension
          // manager
          //
  
          StageDescriptor[] stages = appliance.getProfile().getType().getStages();
          for( int i = 0; i < stages.length; i++ )
          {
              StageDescriptor stage = stages[ i ];
              if( appliance.getExtensionProvider( stage ) == null )
              {
  
                  Appliance supplier = null;
  
                  try
                  {
                      supplier = getEngine().resolve( stage, appliance.getPartitionName()
);
                  }
                  catch( Throwable e )
                  {
                      final String error =
                          "Unable to resolve a supplier for a stage: '"
                          + stage
                          + "' within the appliance '" 
                          + appliance + "'.";
                      throw new AssemblyException( error, e );
                  }
  
                  if( supplier == null )
                  {
                      final String message =
                          "Unresolved supplied for the stage: "
                          + stage + " in appliance: " + appliance;
  
                      appliance.setEnabled( false );
                      final Exception problem = new Exception( message );
                      throw new UnresolvedManagerException( stage, problem );
                  }
  
                  //
                  // associate the supplier to the appliance
                  //
  
                  appliance.addExtensionProvider( stage, supplier );
  
                  getLogger().debug( 
                    pad 
                    + "  associated extension provider: " + supplier.getProfile().getName()
                    + " with appliance: " + appliance.getProfile().getName() );
  
                  map.add( supplier );
              }
          }
      }
  
      private boolean assembleManagers(
          DependencyGraph map, Appliance appliance, StageDescriptor stage,
          List visited, String pad )
          throws AssemblyException
      {
          boolean ok = false;
          Appliance provider;
          try
          {
              provider = getEngine().resolve( stage, appliance.getPartitionName() );
          }
          catch( Throwable e )
          {
              final String error = 
                "Assembly error while resolving stage: " + stage 
                + " for the appliance: " + appliance;
              throw new AssemblyException( error, e );
          }
          if( provider != null )
          {
              assembleAppliance( map, appliance, visited, pad + "  " );
              ok = true;
          }
          return ok;
      }
  
      private boolean assembleProviders(
          DependencyGraph map, Appliance appliance,
          DependencyDescriptor dependency, List visited, String pad )
          throws AssemblyException
      {
          boolean ok = false;
          Appliance provider;
          try
          {
              provider = getEngine().resolve( dependency, appliance.getPartitionName() );
          }
          catch( Throwable e )
          {
              final String error = 
                "Assembly error while resolving dependency: " + dependency 
                + " for the appliance: " + appliance;
              throw new AssemblyException( error, e );
          }
          if( provider != null )
          {
              assembleAppliance( map, appliance, visited, pad + "  " );
              ok = true;
          }
          return ok;
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/AssemblyService.java
  
  Index: AssemblyService.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.lifecycle;
  
  import org.apache.avalon.assembly.appliance.Appliance;
  
  
  /**
   * A assembly service is responsible for the resolution of a component 
   * service depedencies, and the construction supply of a component or
   * service manager to a target object.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/12/19 10:38:30 $
   */
  public interface AssemblyService
  {
     /**
      * Assemble the supplied appliance.
      * @param appliance the object to assembly
      */
      void assemble( Appliance appliance ) throws AssemblyException;
  
     /**
      * Disassemble the supplied appliance.
      * @param appliance the object to disassemble
      */
      void disassemble( Appliance appliance );
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/AssemblyException.java
  
  Index: AssemblyException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.lifecycle;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a assembly related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/12/19 10:38:30 $
   */
  public class AssemblyException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>AssemblyException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public AssemblyException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>AssemblyException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public AssemblyException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  

--
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