You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/11/13 03:16:50 UTC

cvs commit: jakarta-avalon-excalibur/info/src/xdocs MyComponent.java.txt MyComponent-info.xml.txt

donaldp     2002/11/12 18:16:49

  Added:       info/src/xdocs MyComponent.java.txt MyComponent-info.xml.txt
  Log:
  Add in worked sample of qdox generation - both a before and after
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/info/src/xdocs/MyComponent.java.txt
  
  Index: MyComponent.java.txt
  ===================================================================
  /*
   * 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.txt file.
   */
  package com.biz;
  
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  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.activity.Initializable;
  
  /**
   * A sample component that shows the info descriptor that
   * is created for a particular component that has been marked up
   * using javadoc tags.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/13 02:16:49 $
   * @avalon.component
   * @avalon.service type="Service1"
   */
  public class MyComponent
      implements LogEnabled, Contextualizable, Serviceable,
      Configurable, Initializable, Service1
  {
      private Logger m_logger;
      private Logger m_authLogger;
      private ClassLoader m_classLoader;
      private Service2 m_service2Variation;
      private Service2 m_service2;
  
      /**
       * @avalon.logger
       * @avalon.logger name="auth"
       */
      public void enableLogging( Logger logger )
      {
          m_logger = logger;
          m_authLogger = logger.getChildLogger( "auth" );
      }
  
      /**
       * @avalon.entry key="component.classloader" type="ClassLoader"
       */
      public void contextualize( Context context )
          throws ContextException
      {
          m_classLoader = (ClassLoader)context.get( "component.classloader" );
      }
  
      /**
       * @avalon.dependency type="Service2"
       * @avalon.dependency type="Service2/Variation" optional="true"
       */
      public void service( final ServiceManager manager )
          throws ServiceException
      {
          m_service2 = (Service2)manager.lookup( Service2.ROLE );
  
          final String key = Service2.ROLE + "/Variation";
          if( manager.hasService( key ) )
          {
              m_service2Variation =
                  (Service2)manager.lookup( key );
          }
      }
  
      /**
       * @avalon.configuration
       */
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
      }
  
      public void initialize()
          throws Exception
      {
          m_logger.info( "Aquired ClassLoader: " + m_classLoader );
          m_logger.info( "Aquired first Service2: " + m_service2 );
  
          if( null != m_service2Variation )
          {
              m_logger.info( "Aquired second Service2: " + m_service2Variation );
          }
  
          m_authLogger.info( "Success!" );
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/info/src/xdocs/MyComponent-info.xml.txt
  
  Index: MyComponent-info.xml.txt
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  <!DOCTYPE component-info
        PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/info/componentinfo_1_0.dtd" >
  
  <component-info>
      <component type="com.biz.MyComponent">
      </component>
  
      <loggers>
          <logger/>
          <logger name="auth"/>
      </loggers>
  
      <context>
          <entry key="component.classloader" type="java.lang.ClassLoader"/>
      </context>
  
      <services>
          <service type="com.biz.Service1"/>
      </services>
  
      <dependencies>
          <dependency type="com.biz.Service2"/>
          <dependency key="com.biz.Service1/Variation" type="com.biz.Service1"
                      optional="true"/>
      </dependencies>
  
      <schema category="configuration"  location="MyComponent-schema.xml"/>
  
  </component-info>
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>