1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import share
.LogWriter
;
32 import java
.io
.FileWriter
;
34 public class SimpleFileOutProducer
implements LogWriter
{
37 /** initialization, here a filename might be given
40 public boolean initialize(share
.DescEntry entry
, boolean active
) {
46 public void println(String msg
) {
50 /** will mostly be used by outproducers to sum up
51 * the information, maybe write them to a db
53 public boolean summary(share
.DescEntry entry
) {
55 String outpath
= (String
) entry
.UserDefinedParams
.get("OutputPath");
57 System
.out
.println("## Parameter OutputPath isn't defined using default");
58 return summary_default(entry
);
60 String FileName
= entry
.longName
+ ".out";
61 if (!entry
.EntryType
.equals("component")) {
62 FileName
= entry
.longName
.substring(0,
63 entry
.longName
.indexOf(":")) + ".out";
65 util
.utils
.make_Directories("",outpath
);
66 File outputFile
= new File(outpath
, FileName
);
67 FileWriter out
= new FileWriter(outputFile
.toString(),true);
68 String ls
= System
.getProperty("line.separator");
69 String date
= new java
.util
.Date().toString();
70 String header
= "***** State for "+entry
.longName
+"( "+ date
+" ) ******";
72 if (entry
.hasErrorMsg
) {
73 out
.write(entry
.ErrorMsg
+ls
);
74 out
.write("Whole "+entry
.EntryType
+": "+entry
.State
+ls
);
76 out
.write("Whole "+entry
.EntryType
+": "+entry
.State
+ls
);
79 for (int i
=0;i
<header
.length();i
++) {
85 } catch (java
.io
.IOException e
) {
91 public boolean summary_default(share
.DescEntry entry
) {
92 String header
= "***** State for "+entry
.longName
+" ******";
93 System
.out
.println(header
);
94 if (entry
.hasErrorMsg
) {
95 System
.out
.println(entry
.ErrorMsg
);
96 System
.out
.println("Whole "+entry
.EntryType
+": "+entry
.State
);
98 System
.out
.println("Whole "+entry
.EntryType
+": "+entry
.State
);
100 for (int i
=0;i
<header
.length();i
++) {
101 System
.out
.print("*");
103 System
.out
.println("");
107 public Object
getWatcher() {
111 public void setWatcher(Object watcher
) {