avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger DefaultLogTargetFactoryManager.java DefaultLogTargetManager.java Resources.properties
Date Tue, 26 Nov 2002 08:05:45 GMT
colus       2002/11/26 00:05:45

  Modified:    logger/src/java/org/apache/avalon/excalibur/logger
                        DefaultLogTargetFactoryManager.java
                        DefaultLogTargetManager.java Resources.properties
  Log:
  I18N. extract messages to Resources.properties.
  
  Revision  Changes    Path
  1.5       +11 -6     jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/DefaultLogTargetFactoryManager.java
  
  Index: DefaultLogTargetFactoryManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/DefaultLogTargetFactoryManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultLogTargetFactoryManager.java	26 Nov 2002 07:44:45 -0000	1.4
  +++ DefaultLogTargetFactoryManager.java	26 Nov 2002 08:05:45 -0000	1.5
  @@ -59,6 +59,8 @@
   import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   
   /**
    * Default LogTargetFactoryManager implementation.  It populates the LogTargetFactoryManager
  @@ -72,6 +74,9 @@
       extends AbstractLogEnabled
       implements LogTargetFactoryManager, Contextualizable, Configurable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources(DefaultLogTargetFactoryManager.class);
  +
       /** Map for name to logger mapping */
       private final Map m_factories = new HashMap();
   
  @@ -174,19 +179,19 @@
               catch( final ClassNotFoundException cnfe )
               {
                   final String message =
  -                    "cannot find LogTargetFactory class " + factoryClass;
  +                    REZ.getString( "target-factory.error.find-class", factoryClass );
                   throw new ConfigurationException( message, cnfe );
               }
               catch( final InstantiationException ie )
               {
                   final String message =
  -                    "cannot instantiate LogTargetFactory class " + factoryClass;
  +                    REZ.getString( "target-factory.error.instantiate-class", factoryClass
);
                   throw new ConfigurationException( message, ie );
               }
               catch( final IllegalAccessException iae )
               {
                   final String message =
  -                    "cannot access LogTargetFactory class " + factoryClass;
  +                    REZ.getString( "target-factory.error.access-class", factoryClass );
                   throw new ConfigurationException( message, iae );
               }
   
  @@ -198,7 +203,7 @@
               catch( final ContextException ce )
               {
                   final String message =
  -                    "cannot contextualize LogTargetFactory " + factoryClass;
  +                    REZ.getString( "target-factory.error.contextualize", factoryClass );
                   throw new ConfigurationException( message, ce );
               }
               ContainerUtil.configure( logTargetFactory, confs[ i ] );
  @@ -211,7 +216,7 @@
               if( getLogger().isDebugEnabled() )
               {
                   final String message =
  -                    "added new LogTargetFactory of type " + factoryType;
  +                    REZ.getString( "target-factory.notice.add", factoryType );
                   getLogger().debug( message );
               }
               m_factories.put( factoryType, logTargetFactory );
  
  
  
  1.7       +9 -5      jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/DefaultLogTargetManager.java
  
  Index: DefaultLogTargetManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/DefaultLogTargetManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultLogTargetManager.java	26 Nov 2002 07:44:45 -0000	1.6
  +++ DefaultLogTargetManager.java	26 Nov 2002 08:05:45 -0000	1.7
  @@ -55,6 +55,8 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.log.LogTarget;
   
   /**
  @@ -69,6 +71,9 @@
       extends AbstractLogEnabled
       implements LogTargetManager, LogTargetFactoryManageable, Configurable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources(DefaultLogTargetManager.class);
  +
       /** Map for ID to LogTarget mapping */
       final private Map m_targets = new HashMap();
   
  @@ -106,7 +111,7 @@
       {
           if( null == m_factoryManager )
           {
  -            final String message = "LogTargetFactory not received";
  +            final String message = REZ.getString("target.error.null-target-factory");
               throw new ConfigurationException( message );
           }
   
  @@ -117,15 +122,14 @@
               final LogTargetFactory logTargetFactory = m_factoryManager.getLogTargetFactory(
targetName );
               if( logTargetFactory == null )
               {
  -                final String message = "Factory definition for '" + targetName
  -                    + "' missing from logger configuration.";
  +                final String message = REZ.getString("target.error.missing", targetName);
                   throw new ConfigurationException( message );
               }
               final LogTarget logTarget = logTargetFactory.createTarget( confs[ i ] );
               final String targetId = confs[ i ].getAttribute( "id" );
               if( getLogger().isDebugEnabled() )
               {
  -                final String message = "added new LogTarget of id " + targetId;
  +                final String message = REZ.getString("target.notice.add", targetId);
                   getLogger().debug( message );
               }
               m_targets.put( targetId, logTarget );
  
  
  
  1.2       +10 -0     jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/logger/src/java/org/apache/avalon/excalibur/logger/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	23 Oct 2002 07:13:13 -0000	1.1
  +++ Resources.properties	26 Nov 2002 08:05:45 -0000	1.2
  @@ -2,3 +2,13 @@
   unknown-target=Unable to locate LogTarget named "{0}" for Logger named "{1}".
   unknown-priority=Unknown priority "{0}" for Logger named "{1}".
   category-create=Creating a log category named "{0}" that writes to "{1}" target at priority
"{2}".
  +
  +target-factory.error.contextualize=Cannot contextualize LogTargetFactory {0}.
  +target-factory.error.find-class=Cannot instantiate LogTargetFactory class {0}.
  +target-factory.error.instantiate-class=Cannot instantiate LogTargetFactory class {0}.
  +target-factory.error.access-class=Cannot access LogTargetFactory class {0}.
  +target-factory.notice.add=Added new LogTargetFactory of type {0}.
  +
  +target.error.target-factory=LogTargetFactory not received.
  +target.error.missing=Factory definition for '{0}' missing from logger configuration.
  +target.notice.add=Added new LogTarget of id {0}.
  
  
  

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