Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ScmLogDispatcher |
|
| 2.588235294117647;2,588 |
1 | package org.apache.maven.scm.log; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import java.util.ArrayList; | |
23 | import java.util.List; | |
24 | ||
25 | /** | |
26 | * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a> | |
27 | * @version $Id: ScmLogDispatcher.java 1054130 2010-12-31 16:01:45Z olamy $ | |
28 | */ | |
29 | 0 | public class ScmLogDispatcher |
30 | implements ScmLogger | |
31 | { | |
32 | 0 | private List<ScmLogger> listeners = new ArrayList<ScmLogger>(); |
33 | ||
34 | public void addListener( ScmLogger logger ) | |
35 | { | |
36 | 0 | listeners.add( logger ); |
37 | 0 | } |
38 | ||
39 | /** {@inheritDoc} */ | |
40 | public void debug( String content, Throwable error ) | |
41 | { | |
42 | 0 | for ( ScmLogger logger : listeners ) |
43 | { | |
44 | 0 | logger.debug( content, error ); |
45 | } | |
46 | 0 | } |
47 | ||
48 | /** {@inheritDoc} */ | |
49 | public void debug( String content ) | |
50 | { | |
51 | 0 | for ( ScmLogger logger : listeners ) |
52 | { | |
53 | 0 | logger.debug( content ); |
54 | } | |
55 | 0 | } |
56 | ||
57 | /** {@inheritDoc} */ | |
58 | public void debug( Throwable error ) | |
59 | { | |
60 | 0 | for ( ScmLogger logger : listeners ) |
61 | { | |
62 | 0 | logger.debug( error ); |
63 | } | |
64 | 0 | } |
65 | ||
66 | /** {@inheritDoc} */ | |
67 | public void error( String content, Throwable error ) | |
68 | { | |
69 | 0 | for ( ScmLogger logger : listeners ) |
70 | { | |
71 | 0 | logger.error( content, error ); |
72 | } | |
73 | 0 | } |
74 | ||
75 | /** {@inheritDoc} */ | |
76 | public void error( String content ) | |
77 | { | |
78 | 0 | for ( ScmLogger logger : listeners ) |
79 | { | |
80 | 0 | logger.error( content ); |
81 | } | |
82 | 0 | } |
83 | ||
84 | /** {@inheritDoc} */ | |
85 | public void error( Throwable error ) | |
86 | { | |
87 | 0 | for ( ScmLogger logger : listeners ) |
88 | { | |
89 | 0 | logger.error( error ); |
90 | } | |
91 | 0 | } |
92 | ||
93 | /** {@inheritDoc} */ | |
94 | public void info( String content, Throwable error ) | |
95 | { | |
96 | 0 | for ( ScmLogger logger : listeners ) |
97 | { | |
98 | 0 | if ( logger.isInfoEnabled() ) |
99 | { | |
100 | 0 | logger.info( content, error ); |
101 | } | |
102 | } | |
103 | 0 | } |
104 | ||
105 | /** {@inheritDoc} */ | |
106 | public void info( String content ) | |
107 | { | |
108 | 0 | for ( ScmLogger logger : listeners ) |
109 | { | |
110 | 0 | if ( logger.isInfoEnabled() ) |
111 | { | |
112 | 0 | logger.info( content ); |
113 | } | |
114 | } | |
115 | 0 | } |
116 | ||
117 | /** {@inheritDoc} */ | |
118 | public void info( Throwable error ) | |
119 | { | |
120 | 0 | for ( ScmLogger logger : listeners ) |
121 | { | |
122 | 0 | if ( logger.isInfoEnabled() ) |
123 | { | |
124 | 0 | logger.info( error ); |
125 | } | |
126 | } | |
127 | 0 | } |
128 | ||
129 | /** {@inheritDoc} */ | |
130 | public boolean isDebugEnabled() | |
131 | { | |
132 | 0 | for ( ScmLogger logger : listeners ) |
133 | { | |
134 | 0 | if ( logger.isDebugEnabled() ) |
135 | { | |
136 | 0 | return true; |
137 | } | |
138 | } | |
139 | ||
140 | 0 | return false; |
141 | } | |
142 | ||
143 | /** {@inheritDoc} */ | |
144 | public boolean isErrorEnabled() | |
145 | { | |
146 | 0 | for ( ScmLogger logger : listeners ) |
147 | { | |
148 | 0 | if ( logger.isErrorEnabled() ) |
149 | { | |
150 | 0 | return true; |
151 | } | |
152 | } | |
153 | ||
154 | 0 | return false; |
155 | } | |
156 | ||
157 | /** {@inheritDoc} */ | |
158 | public boolean isInfoEnabled() | |
159 | { | |
160 | 0 | for ( ScmLogger logger : listeners ) |
161 | { | |
162 | 0 | if ( logger.isInfoEnabled() ) |
163 | { | |
164 | 0 | return true; |
165 | } | |
166 | } | |
167 | ||
168 | 0 | return false; |
169 | } | |
170 | ||
171 | /** {@inheritDoc} */ | |
172 | public boolean isWarnEnabled() | |
173 | { | |
174 | 0 | for ( ScmLogger logger : listeners ) |
175 | { | |
176 | 0 | if ( logger.isWarnEnabled() ) |
177 | { | |
178 | 0 | return true; |
179 | } | |
180 | } | |
181 | ||
182 | 0 | return false; |
183 | } | |
184 | ||
185 | /** {@inheritDoc} */ | |
186 | public void warn( String content, Throwable error ) | |
187 | { | |
188 | 0 | for ( ScmLogger logger : listeners ) |
189 | { | |
190 | 0 | logger.warn( content, error ); |
191 | } | |
192 | 0 | } |
193 | ||
194 | /** {@inheritDoc} */ | |
195 | public void warn( String content ) | |
196 | { | |
197 | 0 | for ( ScmLogger logger : listeners ) |
198 | { | |
199 | 0 | logger.warn( content ); |
200 | } | |
201 | 0 | } |
202 | ||
203 | /** {@inheritDoc} */ | |
204 | public void warn( Throwable error ) | |
205 | { | |
206 | 0 | for ( ScmLogger logger : listeners ) |
207 | { | |
208 | 0 | logger.warn( error ); |
209 | } | |
210 | 0 | } |
211 | } |