mcconnell    2002/07/19 18:35:50

  Modified:    assembly/demo/src/java/org/apache/excalibur/playground
                        SimpleComponent.java
               assembly/src/etc activation-demo.xml
  Log:
  examples
  
  Revision  Changes    Path
  1.6       +49 -1     
jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java
  
  Index: SimpleComponent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/assembly/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SimpleComponent.java      20 Jul 2002 00:54:06 -0000      1.5
  +++ SimpleComponent.java      20 Jul 2002 01:35:50 -0000      1.6
  @@ -9,6 +9,7 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.activity.Startable;
   
   /**
    * This is a minimal demonstration component that a dependency on 
  @@ -18,11 +19,13 @@
    */
   
   public class SimpleComponent extends AbstractLogEnabled 
  -implements Configurable, Serviceable, Initializable, SimpleService
  +implements Configurable, Serviceable, Initializable, Startable, SimpleService
   {
   
       private String m_message;
       private BasicService m_basic;
  +    private Thread m_thread;
  +    private boolean CONTINUE = false;
   
       //=======================================================================
       // PrimaryService
  @@ -63,4 +66,49 @@
           doObjective();
       }
   
  +    //=======================================================================
  +    // Startable
  +    //=======================================================================
  +
  +   /**
  +    */
  +    public void start() throws Exception
  +    {
  +        getLogger().debug( "starting" );
  +        CONTINUE = true;
  +        m_thread = new Thread(
  +          new Runnable() {
  +            public void run()
  +            {
  +                while( CONTINUE )
  +                {
  +                    try
  +                    {
  +                        Thread.currentThread().sleep( 100 );
  +                    }
  +                    catch( Throwable e )
  +                    {
  +                    }
  +                }
  +            }
  +          }
  +        );
  +        m_thread.start();
  +        getLogger().debug( "started" );
  +    }
  +
  +   /**
  +    */
  +    public void stop()
  +    {
  +        getLogger().debug( "stopping" );
  +        CONTINUE = false;
  +        try
  +        {
  +            m_thread.join();
  +        }
  +        catch( Throwable e )
  +        {
  +        }
  +    }
   }
  
  
  
  1.2       +3 -5      
jakarta-avalon-excalibur/assembly/src/etc/activation-demo.xml
  
  Index: activation-demo.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/assembly/src/etc/activation-demo.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- activation-demo.xml       20 Jul 2002 01:26:55 -0000      1.1
  +++ activation-demo.xml       20 Jul 2002 01:35:50 -0000      1.2
  @@ -22,12 +22,10 @@
      </classpath>
   
      <component name="simple"
  -       class="org.apache.excalibur.playground.SimpleComponent" 
activation="true"/>
  +       class="org.apache.excalibur.playground.SimpleComponent" 
activation="true" />
   
  -   <container name="lazy-container">
  -     <component name="lazy"
  -       class="org.apache.excalibur.playground.SimpleComponent" 
activation="false"/>
  -   </container>
  +   <component name="lazy"
  +       class="org.apache.excalibur.playground.SimpleComponent"/>
   
    </container>
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to