1 /*
2 * Copyright (C) 2011 simpligility technologies inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.simpligility.maven.plugins.android.common;
17
18
19 import com.android.ddmlib.SyncService;
20 import org.apache.maven.plugin.logging.Log;
21
22 /**
23 * LogSyncProgressMonitor is an implementation of the ISyncProgressMonitor
24 * from the Android ddmlib that logs to the Maven Plugin log passed into it.
25 *
26 * @author Manfred Moser - manfred@simpligility.com
27 */
28 public class LogSyncProgressMonitor implements SyncService.ISyncProgressMonitor
29 {
30 private static final String INDENT = " ";
31 private Log log;
32
33 public LogSyncProgressMonitor( Log log )
34 {
35 this.log = log;
36 }
37
38 public void start( int totalWork )
39 {
40 log.info( "Starting transfer of " + totalWork + ". See debug log for progress" );
41 }
42
43 public void stop()
44 {
45 log.info( "Stopped transfer" );
46 }
47
48 public boolean isCanceled()
49 {
50 return false;
51 }
52
53 public void startSubTask( String name )
54 {
55 log.info( INDENT + "Started sub task " + name );
56 }
57
58 public void advance( int work )
59 {
60 log.debug( INDENT + "Transferred " + work );
61 }
62 }