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 .
21 import share
.LogWriter
;
23 import java
.io
.FileWriter
;
25 public class SimpleFileOutProducer
implements LogWriter
{
28 /** initialization, here a filename might be given
31 public boolean initialize(share
.DescEntry entry
, boolean active
) {
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
) {
46 String outpath
= (String
) entry
.UserDefinedParams
.get("OutputPath");
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
+" ) ******";
63 if (entry
.hasErrorMsg
) {
64 out
.write(entry
.ErrorMsg
+ls
);
65 out
.write("Whole "+entry
.EntryType
+": "+entry
.State
+ls
);
67 out
.write("Whole "+entry
.EntryType
+": "+entry
.State
+ls
);
70 for (int i
=0;i
<header
.length();i
++) {
76 } catch (java
.io
.IOException e
) {
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
);
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("");
98 public Object
getWatcher() {
102 public void setWatcher(Object watcher
) {