Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004  * 
005  * Copyright 2008 by Sun Microsystems, Inc.
006  *
007  * OpenOffice.org - a multi-platform office productivity suite
008  *
009  * $RCSfile: Dumper.java,v $
010  * $Revision: 1.4 $
011  *
012  * This file is part of OpenOffice.org.
013  *
014  * OpenOffice.org is free software: you can redistribute it and/or modify
015  * it under the terms of the GNU Lesser General Public License version 3
016  * only, as published by the Free Software Foundation.
017  *
018  * OpenOffice.org is distributed in the hope that it will be useful,
019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
021  * GNU Lesser General Public License version 3 for more details
022  * (a copy is included in the LICENSE file that accompanied this code).
023  *
024  * You should have received a copy of the GNU Lesser General Public License
025  * version 3 along with OpenOffice.org.  If not, see
026  * <http://www.openoffice.org/license.html>
027  * for a copy of the LGPLv3 License.
028  *
029  ************************************************************************/
030 
031 package org.openoffice.setup.Util;
032 
033 import org.openoffice.setup.InstallData;
034 import org.openoffice.setup.SetupData.PackageDescription;
035 import java.util.Enumeration;
036 import java.util.Iterator;
037 import java.util.Map;
038 import java.util.Properties;
039 import java.util.Vector;
040 
041 
042 public class Dumper {
043     
044     private Dumper() {
045     }
046 
047     static public void dumpPackageSettings(PackageDescription packageData) {
048  
049         if ( packageData.isLeaf() ) {
050             System.out.println("Name: " + packageData.getName() +
051                                " State: " + packageData.getSelectionState()  +
052                                " " + packageData.getPackageName());
053         } else {
054             System.out.println("Nod-Name: " + packageData.getName() +
055                                " State: " + packageData.getSelectionState());
056         }
057         
058         for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
059             PackageDescription child = (PackageDescription) e.nextElement();
060             dumpPackageSettings(child);
061         }      
062 
063     }
064 
065     static public void dumpModuleStates(PackageDescription packageData) {
066 
067         System.err.println("Name: " + packageData.getName() + 
068                            " State: " + packageData.getSelectionState() +
069                            " " + packageData.getPackageName());
070 
071         for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
072             PackageDescription child = (PackageDescription) e.nextElement();
073             dumpModuleStates(child);
074         }        
075     }
076     
077     static private String getStateString(int state) {
078         String stateString = null;
079         
080         if ( state == 0 ) {
081             stateString = "DONT_INSTALL";
082         } else if ( state == 1 ) {
083             stateString = "INSTALL";
084         } else if ( state == 2 ) {
085             stateString = "INSTALL_SOME";
086         } else if ( state == 3 ) {
087             stateString = "REMOVE";
088         } else if ( state == 4 ) {
089             stateString = "DONT_REMOVE";
090         } else if ( state == 5 ) {
091             stateString = "REMOVE_SOME";
092         } else if ( state == 6 ) {
093             stateString = "IGNORE";
094         } else if ( state == 7 ) {
095             stateString = "DONT_KNOW";
096         } else {
097             stateString = null;
098         }
099 
100         return stateString;
101     }
102 
103     static private void logModuleStatesHelper(PackageDescription packageData) {
104         int state = packageData.getSelectionState();
105         String stateStr = getStateString(state);
106         
107         LogManager.addModulesLogfileComment("Name: " + packageData.getName() + 
108                            " State: " + stateStr +
109                            " " + packageData.getPackageName());
110 
111         // System.err.println("Name: " + packageData.getName() + 
112         //                    " State: " + stateStr +
113         //                    " " + packageData.getPackageName());
114         
115         for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
116             PackageDescription child = (PackageDescription) e.nextElement();
117             logModuleStatesHelper(child);
118         }        
119     }
120 
121     static public void logModuleStates(PackageDescription packageData, String text) {
122         LogManager.setModulesLogFileHeaderLine(text);
123         logModuleStatesHelper(packageData);
124     }
125     
126     static public void logPackagesToInstall(Vector packages, String text) {
127         PackageDescription packageData = null;
128         LogManager.setModulesLogFileHeaderLine(text);
129         for (int i = 0; i < packages.size(); i++) {
130             packageData = (PackageDescription)packages.get(i);
131             LogManager.addModulesLogfileComment("Name: " + packageData.getName() + 
132                                                 " " + packageData.getPackageName());
133         }    
134     }
135 
136     static public void dumpInstallPackages(PackageDescription packageData) {
137  
138         if (( packageData.isLeaf() ) && ( packageData.getSelectionState() == packageData.INSTALL )) {
139             System.out.println("Now installing: " + packageData.getPackageName());
140         }
141         
142         for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
143             PackageDescription child = (PackageDescription) e.nextElement();
144             dumpInstallPackages(child);
145         }
146     }
147     
148     static public void dumpUninstallPackages(PackageDescription packageData) {
149  
150         if (( packageData.isLeaf() ) && ( packageData.getSelectionState() == packageData.REMOVE )) {
151             System.out.println("Now uninstalling: " + packageData.getPackageName());
152         }
153         
154         for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
155             PackageDescription child = (PackageDescription) e.nextElement();
156             dumpUninstallPackages(child);
157         }
158     }
159     
160     static public void dumpAllRpmInfo(PackageDescription packageData) {
161 
162         if (( packageData.getPackageName() != null ) && ( ! packageData.getPackageName().equals(""))) {
163             if ( packageData.pkgExists() ) {
164                 System.err.println("RPM data: " + packageData.getPkgRealName() + " : " +
165                                                   packageData.getPkgVersion() + " : " +
166                                                   packageData.getPkgRelease() + " : " + 
167                                                   packageData.getPackageName() );            
168             }
169         }
170 
171         for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
172             PackageDescription child = (PackageDescription) e.nextElement();
173             dumpAllRpmInfo(child);
174         }        
175         
176     }
177 
178     static public void dumpNewInstallData() {
179         InstallData data = InstallData.getInstance();
180         System.err.println("PackagePath: " + data.getPackagePath());
181         System.err.println("AdminFileReloc: " + data.getAdminFileNameReloc());
182         System.err.println("AdminFileNoReloc: " + data.getAdminFileNameNoReloc());
183         System.err.println("DatabasePath: " + data.getDatabasePath());
184         System.err.println("InstallDir: " + data.getInstallDir());
185         System.err.println("Original privileges: " + data.getStoredInstallationPrivileges());        
186         System.err.println("getuid.so File: " + data.getGetUidPath());
187     }
188 
189     static public void dumpAllProperties() {
190         Properties properties = System.getProperties();
191 
192         int size = properties.size();
193         Iterator m = properties.entrySet().iterator();
194         int counter = 0;
195         
196         while ( m.hasNext() ) {
197             Map.Entry entry = (Map.Entry) m.next();
198             String env = entry.getKey() + "=" + entry.getValue();
199             System.err.println(env);
200         }        
201     }
202 
203 }

source navigation ] diff markup ] identifier search ] general search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!