You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2005/03/01 11:45:28 UTC

cvs commit: jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component AvalonServiceComponentImpl.java ServiceComponent.java ServiceComponentImpl.java ServiceComponentLifecycle.java

sgoeschl    2005/03/01 02:45:28

  Added:       yaafi/src/java/org/apache/fulcrum/yaafi/framework/component
                        AvalonServiceComponentImpl.java
                        ServiceComponent.java ServiceComponentImpl.java
                        ServiceComponentLifecycle.java
  Log:
  Synchronizing my development CVS with Fulrum
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
  
  Index: AvalonServiceComponentImpl.java
  ===================================================================
  package org.apache.fulcrum.yaafi.framework.component;
  
  /*
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   *
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Executable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.activity.Suspendable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.configuration.Reconfigurable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameterizable;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.fulcrum.yaafi.framework.role.RoleEntry;
  import org.apache.fulcrum.yaafi.framework.util.Validate;
  
  /**
   * This class implements a service component singleton with
   * an arbitray lifecycle.
   *
   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
   */
  
  public class AvalonServiceComponentImpl
      extends ServiceComponentImpl
  {       
      /**
       * Constructor to parse the configuration.
       * 
       * @param roleEntry The information extracted from the role configuration file
       * @param logger The logger of the service container
       */
      public AvalonServiceComponentImpl( RoleEntry roleEntry, Logger logger )
      {
          super( roleEntry, logger );
      }
  	
      /////////////////////////////////////////////////////////////////////////
      // Service Component Lifecycle Implementation
      /////////////////////////////////////////////////////////////////////////
      
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponent#incarnate()
       */
      protected void incarnateInstance() throws Exception
      {
          this.getLogger().debug( "Incarnating the service " + this.getShorthand() );
          
          if( this.getLogger() != null )
          {
              this.enableLogging( this.getLogger() );
          }
          
          if( this.getContext() != null )
          {
              this.contextualize( this.getContext() );
          }
          
          if( this.getServiceManager() != null )
          {
              this.service( this.getServiceManager() );    
          }
          
          if( this.getConfiguration() != null )
          {
              this.configure( this.getConfiguration() );
          }
          
          if( this.getParamaters() != null )
          {
              this.parameterize( this.getParamaters() );
          }
          
          this.initialize();
          this.execute();
          this.start();
      }
  
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponent#reconfigure()
       */
      public void reconfigure() throws Exception
      {
          Throwable lastThrowable = null;
          
          this.getLogger().debug( "Reconfiguring " + this.getShorthand() );
  
          try
          {
              this.suspend();
          }
          catch (Throwable t)
          {
              String msg = "Suspending the following service failed : " + this.getShorthand();
              this.getLogger().error( msg, t );
              lastThrowable = t;
          }
  
          try
          {
              if( this.getConfiguration() != null )
              {
                  this.reconfigure( this.getConfiguration() );
              }
          }
          catch (Throwable t)
          {
              String msg = "Reconfiguring the following service failed : " + this.getShorthand();
              this.getLogger().error( msg, t );
              lastThrowable = t;
          }
          
          try
          {
              this.resume();
          }
          catch (Throwable t)
          {
              String msg = "Resumimg the following service failed : " + this.getShorthand();
              this.getLogger().error( msg, t );
              lastThrowable = t;
          }
  
          if( lastThrowable != null )
          {
              if( lastThrowable instanceof Exception )
              {
                  throw (Exception) lastThrowable;
              }
              else
              {
                  throw new RuntimeException( lastThrowable.getMessage() );
              }
          }
      }
  
      /** 
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponent#decommision()
       */
      public void decommision() throws Exception
      {
          this.getLogger().debug( "Decommisioning the service " + this.getShorthand() );
       
          try
          {
              this.stop();
          }
          catch (Throwable e)
          {
              String msg = "Stopping the following service failed : " + this.getShorthand();
              this.getLogger().error( msg, e );
          }
  
          try
          {
              this.dispose();
          }
          catch (Throwable e)
          {
              String msg = "Disposing the following service failed : " + this.getShorthand();
              this.getLogger().error( msg, e );
          }
          
          super.decommision();
      }
  
      /////////////////////////////////////////////////////////////////////////
      // Avalon Lifecycle Implementation
      /////////////////////////////////////////////////////////////////////////
  
      /**
       * @see org.apache.avalon.framework.logger.LogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)
       */
      public void enableLogging(Logger logger)
      {
  		if( this.getRawInstance() instanceof LogEnabled )
  		{
  			try
  			{
  				this.getLogger().debug( "LogEnabled.enableLogging() for " + this.getShorthand() );
  				((LogEnabled )this.getInstance()).enableLogging(logger);
  			}
  			catch (Throwable t)
  			{
  				String msg = "LogEnable the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,t);
  				throw new RuntimeException(msg);
  			}		    
  		}
      }
  
      /**
       * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
       */
      public void contextualize(Context context) throws ContextException
      {        
  		if( this.getRawInstance() instanceof Contextualizable )
  		{
  			try
  			{
  				this.getLogger().debug( "Contextualizable.contextualize() for " + this.getShorthand() );
  				((Contextualizable )this.getInstance()).contextualize(context);
  			}
  			catch (ContextException e)
  			{
  				String msg = "Contextualizing the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,e);
  				throw e;
  			}
  			catch (Throwable t)
  			{
  				String msg = "Contextualizing the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,t);
  				throw new ContextException(msg,t);
  			}
  		}
      }
  
  	/**
  	 * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
  	 */
  	public void service(ServiceManager serviceManager) throws ServiceException
  	{
  		if( this.getRawInstance() instanceof Serviceable )
  		{
  			try
  			{
  				this.getLogger().debug( "Serviceable.service() for " + this.getShorthand() );
  				((Serviceable )this.getInstance()).service(serviceManager);
  			}
  			catch (ServiceException e)
  			{
  				String msg = "Servicing the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,e);
  				throw e;
  			}
  			catch (Throwable t)
  			{
  				String msg = "Servicing the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,t);
  				throw new ServiceException(this.getShorthand(),msg,t);
  			}
  		}
  	}
  
      /**
       * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
       */
      public void configure(Configuration configuration) throws ConfigurationException
      {
          if( this.getRawInstance() instanceof Configurable )
          {
              try
              {
                  this.getLogger().debug( "Configurable.configure() for " + this.getShorthand() );
              	((Configurable )this.getInstance()).configure(configuration);
              }
              catch (ConfigurationException e)
              {
                  String msg = "Configuring the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,e);
                  throw e;
              }
              catch (Throwable t)
              {
                  String msg = "Configuring the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new ConfigurationException(msg,t);
              }
          }
      }
  
      /**
       * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
       */
      public void parameterize(Parameters parameters) throws ParameterException
      {
  		if( this.getRawInstance() instanceof Parameterizable )
  		{
  			try
  			{
  				this.getLogger().debug( "Parameterizable.parametrize() for " + this.getShorthand() );
  				((Parameterizable )this.getInstance()).parameterize(parameters);
  			}
  			catch (ParameterException e)
  			{
  				String msg = "Parameterizing the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,e);
  				throw e;
  			}
  			catch (Throwable t)
  			{
  				String msg = "Parameterizing the following service failed : " + this.getShorthand();
  				this.getLogger().error(msg,t);
  				throw new ParameterException(msg,t);
  			}
  		}
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Initializable#initialize()
       */
      public void initialize() throws Exception
      {
          if( this.getRawInstance() instanceof Initializable )
          {
              try
              {
                  this.getLogger().debug( "Initializable.initialize() for " + this.getShorthand() );
                  ((Initializable )this.getInstance()).initialize();
              }
              catch (Exception e)
              {
                  String msg = "Initializing the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,e);
                  throw e;
              }
              catch (Throwable t)
              {
                  String msg = "Initializing the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }
          }
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Executable#execute()
       */
      public void execute() throws Exception
      {
          if( this.getRawInstance() instanceof Executable )
          {
              try
              {
                  this.getLogger().debug( "Executable.execute() for " + this.getShorthand() );
                  ((Executable )this.getInstance()).execute();
              }
              catch (Exception e)
              {
                  String msg = "Executing the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,e);
                  throw e;
              }
              catch (Throwable t)
              {
                  String msg = "Executing the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }            
          }        
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Startable#start()
       */
      public void start() throws Exception
      {
          if( this.getRawInstance() instanceof Startable )
          {
              try
              {
                  this.getLogger().debug( "Startable.start() for " + this.getShorthand() );
                  ((Startable )this.getInstance()).start();
              }
              catch (Exception e)
              {
                  String msg = "Starting the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,e);
                  throw e;
              }
              catch (Throwable t)
              {
                  String msg = "Starting the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }
          }        
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Startable#stop()
       */
      public void stop() throws Exception
      {
          if( this.getRawInstance() instanceof Startable )
          {
              try
              {
                  this.getLogger().debug( "Startable.stop() for " + this.getShorthand() );
                  ((Startable )this.getInstance()).stop();
              }
              catch (Exception e)
              {
                  String msg = "Stopping the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,e);
                  throw e;
              }
              catch (Throwable t)
              {
                  String msg = "Stopping the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }            
          }
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Suspendable#resume()
       */
      public void resume()
      {
          if( this.getRawInstance() instanceof Suspendable )
          {
              try
              {
                  this.getLogger().debug( "Suspendable.resume() for " + this.getShorthand() );
                  ((Suspendable )this.getInstance()).resume();
              }
              catch (Throwable t)
              {
                  String msg = "Resuming the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }            
          }
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Suspendable#suspend()
       */
      public void suspend()
      {
          if( this.getRawInstance() instanceof Suspendable )
          {
              try
              {
                  this.getLogger().debug( "Suspendable.suspend() for " + this.getShorthand() );
                  ((Suspendable )this.getInstance()).suspend();
              }
              catch (Throwable t)
              {
                  String msg = "Suspending the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }
          }
      }
  
      /**
       * @see org.apache.avalon.framework.configuration.Reconfigurable#reconfigure(org.apache.avalon.framework.configuration.Configuration)
       */
      public void reconfigure(Configuration configuration) throws ConfigurationException
      {
          Validate.notNull( configuration, "configuration" );
          
          if( this.getRawInstance() instanceof Reconfigurable )
          {
              try
              {
                  this.getLogger().debug( "Reconfigurable.reconfigure() for " + this.getShorthand() );
                  ((Reconfigurable )this.getInstance()).reconfigure(configuration);
              }
              catch (Throwable t)
              {
                  String msg = "Reconfiguring the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,t);
                  throw new RuntimeException(msg);
              }            
          }
      }
  
      /**
       * @see org.apache.avalon.framework.activity.Disposable#dispose()
       */
      public void dispose()
      {
          if( this.getRawInstance() instanceof Disposable )
          {
              try
              {
                  this.getLogger().debug( "Disposable.dispose() for " + this.getShorthand() );
                  ((Disposable )this.getInstance()).dispose();
              }
              catch (Exception e)
              {
                  String msg = "Disposing the following service failed : " + this.getShorthand();
                  this.getLogger().error(msg,e);
                  throw new RuntimeException(msg);
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponent.java
  
  Index: ServiceComponent.java
  ===================================================================
  package org.apache.fulcrum.yaafi.framework.component;
  
  import org.apache.fulcrum.yaafi.framework.role.RoleEntry;
  
  /*
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   *
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * This interface defines a service component singleton with
   * an arbitrary lifecycle.
   * 
   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a> 
   */
  
  public interface ServiceComponent extends ServiceComponentLifecycle
  {
      /**
       * Get the unique name of the service component instance.
       * @return the name of the service component
       */
      String getName();
  
      /**
       * Get the shorthand of the service component instance. The
       * shorthand is usually used to lookup the configuration
       * entries.
       * @return the shorthand of the service component
       */
      String getShorthand();
  
      /**
       * Returns the associates role entry parsed from the role configuration file.
       * @return the role entry
       */
      RoleEntry getRoleEntry();       
  }
  
  
  1.1                  jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentImpl.java
  
  Index: ServiceComponentImpl.java
  ===================================================================
  package org.apache.fulcrum.yaafi.framework.component;
  
  /*
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   *
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.fulcrum.yaafi.framework.role.RoleEntry;
  import org.apache.fulcrum.yaafi.framework.util.Validate;
  
  /**
   * This class implements am abstract base service component singleton with
   * an arbitrary lifecycle.
   *
   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
   */
  
  public abstract class ServiceComponentImpl
      implements ServiceComponent
  {
      /** the information from the role configuration file */
      private RoleEntry roleEntry;
      
      /** the actual implementation class of the service component */
      private Class implementationClazz;
  
      /** the instance of the implementation class of the service component */
      private Object instance;
  
      /** the Avalon logger to be passed to the service component instance */
      private Logger logger;
     
      /** The Avalon ServiceManager passed to the service component instance */
      private ServiceManager serviceManager;
  
      /** The Avalon Context passed to the service component instance */
      private Context context;
      
      /** The Avalon Configuration passed to the service component instance */
      private Configuration configuration;
  
      /** The Avalon Parameters passed to the service component instance */
      private Parameters parameters;
         
      /**
       * Constructor to parse the configuration.
       * 
       * @param roleEntry The information extracted from the role configuration file
       * @param logger The logger of the service container
       */
      public ServiceComponentImpl( RoleEntry roleEntry, Logger logger )
      {
          Validate.notNull( roleEntry, "roleEntry" );
          Validate.notNull( logger, "logger" );
          
          this.roleEntry = roleEntry;
          this.logger = logger;
      }
  	
      /////////////////////////////////////////////////////////////////////////
      // Service Component Lifecycle Implementation
      /////////////////////////////////////////////////////////////////////////
  
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponentLifecycle#getInstance()
       */
      public Object getInstance()
      	throws Exception
      {
          if( this.isInstantiated() == false )
          {
              this.createInstance();
              this.incarnateInstance();
          }
          
          return this.instance;
      }
  
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponentLifecycle#incarnate()
       */
      public void incarnate() throws Exception
      {
          try
          {
              this.implementationClazz = this.getClass().getClassLoader().loadClass(
                  this.getRoleEntry().getImplementationClazzName()
                	);
              
              if( this.getRoleEntry().isEarlyInit() )
              {
                  this.getInstance();
              }
          }
          catch(Throwable t)
          {
              String msg = "Failed initialize " 
                  + this.getRoleEntry().getImplementationClazzName();
              
              throw new ConfigurationException(msg,t);
          }
      }
      
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponentLifecycle#reconfigure()
       */
      public abstract void reconfigure() throws Exception;
      
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponentLifecycle#decommision()
       */
      public void decommision() throws Exception
      {
          this.instance = null;
      }
  
      /**
       * @param logger The logger to set.
       */
      public void setLogger(Logger logger)
      {
          this.logger = logger;
      }
  
      /**
       * @param context The context to set.
       */
      public void setContext(Context context)
      {
          this.context = context;
      }
  
      /**
       * @param serviceManager The serviceManager to set.
       */
      public void setServiceManager(ServiceManager serviceManager)
      {
          this.serviceManager = serviceManager;
      }
      
      /**
       * @param configuration The configuration to set.
       */
      public void setConfiguration(Configuration configuration)
      {
          this.configuration = configuration;
      }
  
      /**
       * @param parameters The parameters to set.
       */
      public void setParameters(Parameters parameters)
      {
          this.parameters = parameters;
      }
              
      /////////////////////////////////////////////////////////////////////////
      // Generated getters and setters
      /////////////////////////////////////////////////////////////////////////
  
      /**
       * @return Return true if the service is created on startup
       */
      public boolean isEarlyInit()
      {
          return this.getRoleEntry().isEarlyInit();
      }
  
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponent#getName()
       */
      public String getName()
      {
          return this.getRoleEntry().getName();
      }
      
      /**
       * @return Returns the roleEntry.
       */
      public RoleEntry getRoleEntry()
      {
          return roleEntry;
      }
      
      /**
       * @return Returns the logger.
       */
      public Logger getLogger()
      {
          return this.logger;
      }
  
      /**
       * @return Returns the implementationClazz.
       */
      public Class getImplementationClazz()
      {
          return this.implementationClazz;
      }
      
      /**
       * @return Returns the configuration.
       */
      public Configuration getConfiguration()
      {
          return configuration;
      }
          
      /**
       * @return Returns the context.
       */
      public Context getContext()
      {
          return context;
      }
          
      /**
       * @return Returns the paramaters.
       */
      public Parameters getParamaters()
      {
          return parameters;
      }
         
      /**
       * @return Returns the serviceManager.
       */
      public ServiceManager getServiceManager()
      {
          return serviceManager;
      }
          
      /**
       * @return the shorthand of the service
       */
      public String getShorthand()
      {
          return roleEntry.getShorthand();
      }
  
      /////////////////////////////////////////////////////////////////////////
      // Class implementation
      /////////////////////////////////////////////////////////////////////////
  
      /**
       * @return Returns <b>true</b> if the service instance was already instantiated.
       */
      protected boolean isInstantiated()
      {
          return ( this.instance != null ? true : false );
      }
  
      /**
       * Create an instance of the service component implementation class
       *
       * @throws InstantiationException th
       * @throws IllegalAccessException
       */
      protected Object createInstance()
          throws InstantiationException, IllegalAccessException
      {
          this.getLogger().debug( "Instantiating the implementation class for " + this.getShorthand() );
          this.instance =  this.implementationClazz.newInstance();
          return this.instance;
      }
  
      /**
       * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponent#incarnate()
       */
      protected abstract void incarnateInstance() throws Exception;
  
      /**
       * @return Returns the raw instance, i.e. does not incarnate
       * the instance.
       */
      protected Object getRawInstance()
      {
          return this.instance;
      }
  }
  
  
  
  1.1                  jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentLifecycle.java
  
  Index: ServiceComponentLifecycle.java
  ===================================================================
  package org.apache.fulcrum.yaafi.framework.component;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.framework.service.ServiceManager;
  
  /*
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   *
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * This class implements the lifecycle contract of a service component
   * instance.
   * 
   * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a> 
   */
  
  public interface ServiceComponentLifecycle
  {
      /**
       * Incarnates a service component instance.
       */
      void incarnate() throws Exception;
      
      /**
       * Reconfigures a service component instance
       */
      void reconfigure() throws Exception;
      
      /**
       * Decommisions a service component instance
       */
      void decommision() throws Exception;
  
      /**
       * @return Returns the instance of the singleton
       */
      Object getInstance() throws Exception;
  
      /**
       * @param logger The logger to set.
       */
      void setLogger(Logger logger);
      
      /**
       * @param serviceManager The serviceManager to set.
       */
      void setServiceManager(ServiceManager serviceManager);
  
      /**
       * @param context The context to set.
       */
      void setContext(Context context);
      
      /**
       * @param configuration The configuration to set.
       */
      void setConfiguration(Configuration configuration);
  
      /**
       * @param parameters The paramaters to set.
       */
      void setParameters(Parameters parameters);
  }
  
  

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