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 package org.openoffice.setup.Util;
25 
26 import java.util.Vector;
27 
28 public class LogManager {
29 
30     static private Vector logfile; /* collects all logging information during installation */
31     static private Vector commandsLogFile;  /* collects all system commands information during installation */
32     static private Vector saveLogFile;  /* contains the content of the saved log file */
33     static private Vector modulesLogFile;
34 
LogManager()35     private LogManager() {
36     }
37 
getSaveLogfile()38     static public Vector getSaveLogfile() {
39         return saveLogFile;
40     }
41 
addLogfileComment(String text)42     static public void addLogfileComment(String text) {
43         logfile.add(text);
44     }
45 
addCommandsLogfileComment(String text)46     static public void addCommandsLogfileComment(String text) {
47         commandsLogFile.add(text);
48     }
49 
addModulesLogfileComment(String text)50     static public void addModulesLogfileComment(String text) {
51         modulesLogFile.add(text);
52     }
53 
setCommandsHeaderLine(String text)54     static public void setCommandsHeaderLine(String text) {
55         String line = "*************************************";
56         commandsLogFile.add("");
57         commandsLogFile.add(line);
58         commandsLogFile.add("<b>" + text + "</b>");
59         commandsLogFile.add(line);
60         commandsLogFile.add("");
61     }
62 
setModulesLogFileHeaderLine(String text)63     static public void setModulesLogFileHeaderLine(String text) {
64         String line = "*************************************";
65         modulesLogFile.add(line);
66         modulesLogFile.add(text);
67         modulesLogFile.add(line);
68     }
69 
publishLogfileContent(String text, String separatorline)70     static public String publishLogfileContent(String text, String separatorline) {
71         for (int i = 0; i < logfile.size(); i++) {
72             text = text + logfile.get(i) + "<br>";
73         }
74 
75         if ( ! logfile.isEmpty() ) {
76             text = text + separatorline + "<br>";
77         }
78 
79         return text;
80     }
81 
publishCommandsLogfileContent(String text)82     static public String publishCommandsLogfileContent(String text) {
83         for (int i = 0; i < commandsLogFile.size(); i++) {
84             text = text + commandsLogFile.get(i) + "<br>";
85         }
86 
87         return text;
88     }
89 
getModulesLogFile()90     static public Vector getModulesLogFile() {
91         return modulesLogFile;
92     }
93 
94     static {
95         logfile = new Vector();
96         commandsLogFile = new Vector();
97         saveLogFile = new Vector();
98         modulesLogFile = new Vector();
99     }
100 
101 }
102