xref: /AOO41X/main/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/LogManager.java (revision 67e470dafe1997e73f56ff7ff4878983707e3e07)
1*9a1eeea9SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9a1eeea9SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9a1eeea9SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9a1eeea9SAndrew Rist  * distributed with this work for additional information
6*9a1eeea9SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9a1eeea9SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9a1eeea9SAndrew Rist  * "License"); you may not use this file except in compliance
9*9a1eeea9SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9a1eeea9SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9a1eeea9SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9a1eeea9SAndrew Rist  * software distributed under the License is distributed on an
15*9a1eeea9SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9a1eeea9SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9a1eeea9SAndrew Rist  * specific language governing permissions and limitations
18*9a1eeea9SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9a1eeea9SAndrew Rist  *************************************************************/
21*9a1eeea9SAndrew Rist 
22*9a1eeea9SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package org.openoffice.setup.Util;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import java.util.Vector;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir public class LogManager {
29cdf0e10cSrcweir 
30cdf0e10cSrcweir     static private Vector logfile; /* collects all logging information during installation */
31cdf0e10cSrcweir     static private Vector commandsLogFile;  /* collects all system commands information during installation */
32cdf0e10cSrcweir     static private Vector saveLogFile;  /* contains the content of the saved log file */
33cdf0e10cSrcweir     static private Vector modulesLogFile;
34cdf0e10cSrcweir 
LogManager()35cdf0e10cSrcweir     private LogManager() {
36cdf0e10cSrcweir     }
37cdf0e10cSrcweir 
getSaveLogfile()38cdf0e10cSrcweir     static public Vector getSaveLogfile() {
39cdf0e10cSrcweir         return saveLogFile;
40cdf0e10cSrcweir     }
41cdf0e10cSrcweir 
addLogfileComment(String text)42cdf0e10cSrcweir     static public void addLogfileComment(String text) {
43cdf0e10cSrcweir         logfile.add(text);
44cdf0e10cSrcweir     }
45cdf0e10cSrcweir 
addCommandsLogfileComment(String text)46cdf0e10cSrcweir     static public void addCommandsLogfileComment(String text) {
47cdf0e10cSrcweir         commandsLogFile.add(text);
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir 
addModulesLogfileComment(String text)50cdf0e10cSrcweir     static public void addModulesLogfileComment(String text) {
51cdf0e10cSrcweir         modulesLogFile.add(text);
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir 
setCommandsHeaderLine(String text)54cdf0e10cSrcweir     static public void setCommandsHeaderLine(String text) {
55cdf0e10cSrcweir         String line = "*************************************";
56cdf0e10cSrcweir         commandsLogFile.add("");
57cdf0e10cSrcweir         commandsLogFile.add(line);
58cdf0e10cSrcweir         commandsLogFile.add("<b>" + text + "</b>");
59cdf0e10cSrcweir         commandsLogFile.add(line);
60cdf0e10cSrcweir         commandsLogFile.add("");
61cdf0e10cSrcweir     }
62cdf0e10cSrcweir 
setModulesLogFileHeaderLine(String text)63cdf0e10cSrcweir     static public void setModulesLogFileHeaderLine(String text) {
64cdf0e10cSrcweir         String line = "*************************************";
65cdf0e10cSrcweir         modulesLogFile.add(line);
66cdf0e10cSrcweir         modulesLogFile.add(text);
67cdf0e10cSrcweir         modulesLogFile.add(line);
68cdf0e10cSrcweir     }
69cdf0e10cSrcweir 
publishLogfileContent(String text, String separatorline)70cdf0e10cSrcweir     static public String publishLogfileContent(String text, String separatorline) {
71cdf0e10cSrcweir         for (int i = 0; i < logfile.size(); i++) {
72cdf0e10cSrcweir             text = text + logfile.get(i) + "<br>";
73cdf0e10cSrcweir         }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         if ( ! logfile.isEmpty() ) {
76cdf0e10cSrcweir             text = text + separatorline + "<br>";
77cdf0e10cSrcweir         }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir         return text;
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir 
publishCommandsLogfileContent(String text)82cdf0e10cSrcweir     static public String publishCommandsLogfileContent(String text) {
83cdf0e10cSrcweir         for (int i = 0; i < commandsLogFile.size(); i++) {
84cdf0e10cSrcweir             text = text + commandsLogFile.get(i) + "<br>";
85cdf0e10cSrcweir         }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         return text;
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir 
getModulesLogFile()90cdf0e10cSrcweir     static public Vector getModulesLogFile() {
91cdf0e10cSrcweir         return modulesLogFile;
92cdf0e10cSrcweir     }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     static {
95cdf0e10cSrcweir         logfile = new Vector();
96cdf0e10cSrcweir         commandsLogFile = new Vector();
97cdf0e10cSrcweir         saveLogFile = new Vector();
98cdf0e10cSrcweir         modulesLogFile = new Vector();
99cdf0e10cSrcweir     }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir }
102