buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/AntScmLogger.java
changeset 628 7c4a911dc066
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
       
     1 /*
       
     2  * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  
       
    15  *
       
    16  */
       
    17 package com.nokia.helium.scm.ant;
       
    18 
       
    19 import org.apache.maven.scm.log.ScmLogger;
       
    20 import org.apache.tools.ant.Project;
       
    21 import org.apache.tools.ant.Task;
       
    22 
       
    23 /**
       
    24  * This class provides an implementation of 
       
    25  * an ScmLogger using Ant logging for
       
    26  * reporting issues.
       
    27  *
       
    28  */
       
    29 public class AntScmLogger implements ScmLogger {
       
    30 
       
    31     private Task task;
       
    32     
       
    33     /**
       
    34      * Creating an AntScmLogger instance using
       
    35      * a task to log messages.
       
    36      * @param task
       
    37      */
       
    38     public AntScmLogger(Task task) {
       
    39         this.task = task;
       
    40     }
       
    41     
       
    42     /**
       
    43      * {@inheritDoc}
       
    44      */
       
    45     @Override
       
    46     public void debug(String message) {
       
    47         task.log(message, Project.MSG_DEBUG);
       
    48     }
       
    49 
       
    50     /**
       
    51      * {@inheritDoc}
       
    52      */
       
    53     @Override
       
    54     public void debug(Throwable cause) {
       
    55         task.log(cause.toString(), Project.MSG_DEBUG);
       
    56     }
       
    57 
       
    58     /**
       
    59      * {@inheritDoc}
       
    60      */
       
    61     @Override
       
    62     public void debug(String message, Throwable cause) {
       
    63         task.log(message + " " + cause.toString(), Project.MSG_DEBUG);        
       
    64     }
       
    65 
       
    66     /**
       
    67      * {@inheritDoc}
       
    68      */
       
    69     @Override
       
    70     public void error(String message) {
       
    71         task.log(message, Project.MSG_ERR);        
       
    72     }
       
    73 
       
    74     /**
       
    75      * {@inheritDoc}
       
    76      */
       
    77     @Override
       
    78     public void error(Throwable cause) {
       
    79         task.log(cause.toString(), Project.MSG_ERR);
       
    80     }
       
    81 
       
    82     /**
       
    83      * {@inheritDoc}
       
    84      */
       
    85     @Override
       
    86     public void error(String message, Throwable cause) {
       
    87         task.log(message + " " + cause.toString(), Project.MSG_ERR);        
       
    88     }
       
    89 
       
    90     /**
       
    91      * {@inheritDoc}
       
    92      */
       
    93     @Override
       
    94     public void info(String message) {
       
    95         task.log(message, Project.MSG_INFO);        
       
    96     }
       
    97 
       
    98     /**
       
    99      * {@inheritDoc}
       
   100      */
       
   101     @Override
       
   102     public void info(Throwable cause) {
       
   103         task.log(cause.toString(), Project.MSG_INFO);
       
   104     }
       
   105 
       
   106     /**
       
   107      * {@inheritDoc}
       
   108      */
       
   109     @Override
       
   110     public void info(String message, Throwable cause) {
       
   111         task.log(message + " " + cause.toString(), Project.MSG_INFO);        
       
   112     }
       
   113 
       
   114     @Override
       
   115     public boolean isDebugEnabled() {
       
   116         return true;
       
   117     }
       
   118 
       
   119     /**
       
   120      * {@inheritDoc}
       
   121      */
       
   122     @Override
       
   123     public boolean isErrorEnabled() {
       
   124         return true;
       
   125     }
       
   126 
       
   127     /**
       
   128      * {@inheritDoc}
       
   129      */
       
   130     @Override
       
   131     public boolean isInfoEnabled() {
       
   132         return true;
       
   133     }
       
   134 
       
   135     /**
       
   136      * {@inheritDoc}
       
   137      */
       
   138     @Override
       
   139     public boolean isWarnEnabled() {
       
   140         return true;
       
   141     }
       
   142 
       
   143     /**
       
   144      * {@inheritDoc}
       
   145      */
       
   146     @Override
       
   147     public void warn(String message) {
       
   148         task.log(message, Project.MSG_WARN);
       
   149     }
       
   150 
       
   151     /**
       
   152      * {@inheritDoc}
       
   153      */
       
   154     @Override
       
   155     public void warn(Throwable cause) {
       
   156         task.log(cause.toString(), Project.MSG_WARN);
       
   157     }
       
   158 
       
   159     /**
       
   160      * {@inheritDoc}
       
   161      */
       
   162     @Override
       
   163     public void warn(String message, Throwable cause) {
       
   164         task.log(message + " " + cause.toString(), Project.MSG_WARN);
       
   165     }
       
   166 
       
   167 }