1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 /* 24 * Created on 04.11.2003 25 * 26 * To change the template for this generated file go to 27 * Window>Preferences>Java>Code Generation>Code and Comments 28 */ 29 package com.sun.star.wizards.web; 30 31 import com.sun.star.wizards.common.PropertyNames; 32 import java.io.PrintStream; 33 34 import com.sun.star.wizards.ui.event.TaskEvent; 35 import com.sun.star.wizards.ui.event.TaskListener; 36 37 /** 38 * used for debugging. 39 * @author rpiterman 40 */ 41 public class LogTaskListener implements TaskListener, ErrorHandler 42 { 43 44 private PrintStream out; 45 LogTaskListener(PrintStream os)46 public LogTaskListener(PrintStream os) 47 { 48 out = os; 49 } 50 LogTaskListener()51 public LogTaskListener() 52 { 53 this(System.out); 54 } 55 56 /* (non-Javadoc) 57 * @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent) 58 */ taskStarted(TaskEvent te)59 public void taskStarted(TaskEvent te) 60 { 61 out.println("TASK " + te.getTask().getTaskName() + " STARTED."); 62 63 } 64 65 /* (non-Javadoc) 66 * @see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent) 67 */ taskFinished(TaskEvent te)68 public void taskFinished(TaskEvent te) 69 { 70 out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded."); 71 72 } 73 74 /* (non-Javadoc) 75 * @see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent) 76 */ taskStatusChanged(TaskEvent te)77 public void taskStatusChanged(TaskEvent te) 78 { 79 out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax()); 80 } 81 82 /* (non-Javadoc) 83 * @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent) 84 */ subtaskNameChanged(TaskEvent te)85 public void subtaskNameChanged(TaskEvent te) 86 { 87 out.println("SUBTASK Name:" + te.getTask().getSubtaskName()); 88 } 89 90 /* (non-Javadoc) 91 * @see com.sun.star.wizards.web.status.ErrorReporter#error(java.lang.Exception, java.lang.Object, java.lang.String) 92 */ error(Exception ex, Object arg, int ix, int i)93 public boolean error(Exception ex, Object arg, int ix, int i) 94 { 95 System.out.println(PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage()); 96 ex.printStackTrace(); 97 return true; 98 } 99 } 100