Coverage Report - net.admin4j.util.notify.LogNotifier
 
Classes in this File Line Coverage Branch Coverage Complexity
LogNotifier
100%
15/15
100%
4/4
1.333
 
 1  
 /*
 2  
  * This software is licensed under the Apache License, Version 2.0
 3  
  * (the "License") agreement; you may not use this file except in compliance with
 4  
  * the License.  You may obtain a copy of the License at
 5  
  * 
 6  
  *      http://www.apache.org/licenses/LICENSE-2.0
 7  
  * 
 8  
  * Unless required by applicable law or agreed to in writing, software
 9  
  * distributed under the License is distributed on an "AS IS" BASIS,
 10  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11  
  * See the License for the specific language governing permissions and
 12  
  * limitations under the License.
 13  
  */
 14  
 package net.admin4j.util.notify;
 15  
 
 16  
 import java.util.Properties;
 17  
 
 18  
 import javax.servlet.FilterConfig;
 19  
 import javax.servlet.ServletConfig;
 20  
 import javax.servlet.ServletException;
 21  
 
 22  
 import net.admin4j.deps.commons.lang3.SystemUtils;
 23  
 
 24  
 import org.slf4j.Logger;
 25  
 import org.slf4j.LoggerFactory;
 26  
 
 27  
 /**
 28  
  * Places a notification in the log.
 29  
  * @author D. Ashmore
 30  
  * @since 1.0
 31  
  */
 32  12
 public class LogNotifier implements Notifier {
 33  
 
 34  9
     private static Logger logger = LoggerFactory.getLogger(LogNotifier.class);
 35  
     
 36  
     public void configure(ServletConfig config) throws ServletException {
 37  
         // No Op
 38  
 
 39  9
     }
 40  
 
 41  
     public void configure(FilterConfig config) throws ServletException {
 42  
         // No Op
 43  
 
 44  3
     }
 45  
 
 46  
     public void configure(String namePrefix, Properties config) {
 47  
         // No Op
 48  
 
 49  3
     }
 50  
 
 51  
     public void notify(String subject, String message) {
 52  9
         StringBuffer buffer = new StringBuffer(1024);
 53  
         
 54  9
         if (subject != null) {
 55  6
             buffer.append(subject);
 56  6
             buffer.append(SystemUtils.LINE_SEPARATOR);
 57  
         }
 58  9
         if (message != null) {
 59  6
             buffer.append(message);
 60  
         }
 61  
 
 62  9
         logger.error(message);
 63  9
     }
 64  
 
 65  
     public boolean supportsHtml() {
 66  3
         return false;
 67  
     }
 68  
 
 69  
     public boolean supportsSMS() {
 70  3
         return false;
 71  
     }
 72  
 
 73  
 }