jvanzyl     2004/03/20 15:36:08

  Modified:    maven-core/src/main/java/org/apache/maven DefaultMaven.java
  Log:
  o using i18n component
  
  Revision  Changes    Path
  1.5       +4 -109    
maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultMaven.java 20 Mar 2004 23:29:32 -0000      1.4
  +++ DefaultMaven.java 20 Mar 2004 23:36:08 -0000      1.5
  @@ -1,69 +1,13 @@
   package org.apache.maven;
   
  -/* ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - *    "Apache Maven" must not be used to endorse or promote products
  - *    derived from this software without prior written permission. For
  - *    written permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Maven", nor may "Apache" appear in their name, without
  - *    prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - *
  - * ====================================================================
  - */
  -
   // use plexus getFiles
  -// use i18n
   
   import org.apache.maven.plugin.PluginExecutionResponse;
   import org.apache.maven.plugin.manager.PluginManagerManager;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
   import org.apache.maven.util.CollectionUtils;
  +import org.codehaus.plexus.i18n.I18N;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
   import org.codehaus.plexus.util.DirectoryScanner;
   import org.codehaus.plexus.util.PropertyUtils;
  @@ -74,11 +18,8 @@
   import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Locale;
   import java.util.Map;
  -import java.util.MissingResourceException;
   import java.util.Properties;
  -import java.util.ResourceBundle;
   import java.util.Set;
   
   public class DefaultMaven
  @@ -92,6 +33,8 @@
   
       private MavenProjectBuilder projectBuilder;
   
  +    private I18N i18n;
  +
       public DefaultMaven()
           throws Exception
       {
  @@ -142,7 +85,7 @@
           {
               if ( projectFile.length() == 0 )
               {
  -                throw new Exception( getMessage( "empty.descriptor.error", 
projectFile.getName() ) );
  +                throw new Exception( i18n.format( "empty.descriptor.error", 
projectFile.getName() ) );
               }
           }
   
  @@ -303,54 +246,6 @@
           }
   
           return list;
  -    }
  -
  -    /** Resource bundle with user messages. */
  -    private static ResourceBundle messages;
  -
  -    /**
  -     * Load MavenSession user messages from a resource bundle given the
  -     * user's locale.
  -     * @todo Move locale tools into their own class.
  -     */
  -    private static void loadMessages()
  -    {
  -        try
  -        {
  -            // Look for the message bundle corresponding to the user's locale.
  -            messages = ResourceBundle.getBundle( 
"org/apache/maven/messages/messages" );
  -        }
  -        catch ( MissingResourceException e )
  -        {
  -            // If we can't find the appropriate message bundle for the locale then
  -            // we will fall back to English.
  -            messages = ResourceBundle.getBundle( 
"org/apache/maven/messages/messages",
  -                                                 Locale.ENGLISH );
  -        }
  -    }
  -
  -    public static String getMessage( String messageId )
  -    {
  -        return getMessage( messageId, null );
  -    }
  -
  -    public static String getMessage( String messageId, Object variable )
  -    {
  -        if ( messages == null )
  -        {
  -            loadMessages();
  -        }
  -
  -        if ( variable == null )
  -        {
  -            return messages.getString( messageId );
  -        }
  -        else
  -        {
  -            return StringUtils.replace( messages.getString( messageId ),
  -                                        "${1}",
  -                                        variable.toString() );
  -        }
       }
   
       public List getSortedProjects( List projects )
  
  
  

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

Reply via email to