You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/07/25 20:04:59 UTC

cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model CategoriesDescriptor.java Category.java

mcconnell    2002/07/25 11:04:58

  Added:       assembly/src/java/org/apache/excalibur/merlin/model
                        CategoriesDescriptor.java Category.java
  Log:
  Replaces CategoryDescriptor
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/CategoriesDescriptor.java
  
  Index: CategoriesDescriptor.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.txt file.
   */
  package org.apache.excalibur.merlin.model;
  
  import java.io.Serializable;
  
  /**
   * Description of a set of categories.
   *
   * @see Category
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/07/25 18:04:58 $
   */
  public final class CategoriesDescriptor extends Category implements Serializable
  {
      /**
       * The root category hierachy.
       */
      private Category[] m_categories;
  
      /**
       * The default priority.
       */
      private String m_priority;
  
      /**
       * The default target.
       */
      private String m_target;
  
      /**
       * Create a CategoriesDescriptor instance.
       *
       * @param name the base category name
       * @param priority the default logging priority
       * @param target the default logging target
       * @param categories the logging category descriptors
       */
      public CategoriesDescriptor( final String name,
                             final String priority,
                             final String target,
                             final Category[] categories )
      {
          super( name, priority, target );
          m_priority = priority;
          m_target = target;
          m_categories = categories;
      }
  
  
      /**
       * Return the set of logging categories.
       *
       * @return the set of category declarations
       */
      public Category[] getCategories()
      {
          return m_categories;
      }
  
  
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/model/Category.java
  
  Index: Category.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.txt file.
   */
  package org.apache.excalibur.merlin.model;
  
  import java.util.Hashtable;
  import java.io.Serializable;
  
  /**
   * A logging category descriptor hierachy.  The descriptor contains a category name, a
   * optional priority value, and an optional target.  If the priority or target values
   * null, the resulting value will be derived from the parent category desciptor. A 
   * category descriptor may 0-n subsidiary categories.  Category names are relative.
   * For example, the category "orb" will appear as "my-app.orb" if the parent category 
   * name is "my-app".
   *
   * <p><b>XML</b></p>
   * <pre>
   *    &lt;loggers priority="<font color="darkred">INFO</font>"&gt;
   *      &lt;category priority="<font color="darkred">DEBUG</font>"  name="<font color="darkred">loader</font>" /&gt;
   *      &lt;category priority="<font color="darkred">WARN</font>"  name="<font color="darkred">types</font>" /&gt;
   *      &lt;category priority="<font color="darkred">ERROR</font>"  name="<font color="darkred">types.builder</font>" target="<font color="darkred">default</font>"/&gt;
   *      &lt;category name="<font color="darkred">profiles</font>" /&gt;
   *      &lt;category name="<font color="darkred">lifecycle</font>" /&gt;
   *      &lt;category name="<font color="darkred">verifier</font>" /&gt;
   *    &lt;/loggers&gt;
   * </pre>
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2002/07/25 18:04:58 $
   */
  public class Category implements Serializable
  {
  
       public static final String DEBUG = "DEBUG";
       public static final String INFO = "INFO";
       public static final String WARN = "WARN";
       public static final String ERROR = "ERROR";
  
       public static final String DEFAULT_LOGGING_TARGET = "default";
       public static final String DEFAULT_LOGGING_PRIORITY = INFO;
  
      /**
       * The logging category name.
       */
      private String m_name;
  
      /**
       * The default logging priority.
       */
      private final String m_priority;
  
      /**
       * The default logging target.
       */
      private final String m_target;
  
      /**
       * Creation of a new Category using a supplied name, priority, target and 
       * collection of subsidiary categories. 
       *
       * @param name the category name
       * @param priority the category priority - DEBUG, INFO, WARN, or ERROR
       * @param target the name of a logging category target
       *
       * @see TargetDescriptor
       */
      public Category( 
        final String name, final String priority, final String target )
      {
          m_name = name;
          m_target = target;
          m_priority = priority;
      }
  
      /**
       * Return the category name.
       *
       * @return the category name
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Return the default logging priority for the group of categories.
       *
       * @return the logging priority for the category
       */
      public String getPriority( )
      {
          return m_priority;
      }
  
      /**
       * Return the default log target for the group of categories.
       *
       * @return the default target name
       */
      public String getTarget( )
      {
          return m_target;
      }
  }
  
  
  

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