bump product version to 4.1.6.2
[LibreOffice.git] / qadevOOo / runner / stats / SimpleFileOutProducer.java
blob0f7f96d978d416a257272346741f1bae8f1633bd
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package stats;
21 import share.LogWriter;
22 import java.io.File;
23 import java.io.FileWriter;
25 public class SimpleFileOutProducer implements LogWriter {
28 /** initialization, here a filename might be given
29 * or a dbUrL
31 public boolean initialize(share.DescEntry entry, boolean active) {
32 return true;
35 /** Method to print
37 public void println(String msg) {
41 /** will mostly be used by outproducers to sum up
42 * the information, maybe write them to a db
44 public boolean summary(share.DescEntry entry) {
45 try {
46 String outpath = (String) entry.UserDefinedParams.get("OutputPath");
47 if (outpath==null) {
48 System.out.println("## Parameter OutputPath isn't defined using default");
49 return summary_default(entry);
51 String FileName = entry.longName + ".out";
52 if (!entry.EntryType.equals("component")) {
53 FileName = entry.longName.substring(0,
54 entry.longName.indexOf(":")) + ".out";
56 util.utils.make_Directories("",outpath);
57 File outputFile = new File(outpath, FileName);
58 FileWriter out = new FileWriter(outputFile.toString(),true);
59 String ls = System.getProperty("line.separator");
60 String date = new java.util.Date().toString();
61 String header = "***** State for "+entry.longName+"( "+ date +" ) ******";
62 out.write(header+ls);
63 if (entry.hasErrorMsg) {
64 out.write(entry.ErrorMsg+ls);
65 out.write("Whole "+entry.EntryType+": "+entry.State+ls);
66 } else {
67 out.write("Whole "+entry.EntryType+": "+entry.State+ls);
69 String bottom="";
70 for (int i=0;i<header.length();i++) {
71 bottom += "*";
73 out.write(bottom+ls);
74 out.write(""+ls);
75 out.close();
76 } catch (java.io.IOException e) {
79 return true;
82 public boolean summary_default(share.DescEntry entry) {
83 String header = "***** State for "+entry.longName+" ******";
84 System.out.println(header);
85 if (entry.hasErrorMsg) {
86 System.out.println(entry.ErrorMsg);
87 System.out.println("Whole "+entry.EntryType+": "+entry.State);
88 } else {
89 System.out.println("Whole "+entry.EntryType+": "+entry.State);
91 for (int i=0;i<header.length();i++) {
92 System.out.print("*");
94 System.out.println("");
95 return true;
98 public Object getWatcher() {
99 return null;
102 public void setWatcher(Object watcher) {