[opencoe-cvs] coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/util _OpenCOESegment.java,NONE,1
Status: Alpha
Brought to you by:
rbroberg
|
From: <rbr...@us...> - 2003-10-26 17:13:51
|
Update of /cvsroot/opencoe/coekernel/src/COE/src/COE/java/org/opencoe/coe/kernel/util In directory sc8-pr-cvs1:/tmp/cvs-serv763/java/org/opencoe/coe/kernel/util Added Files: _OpenCOESegment.java Log Message: 20031026:rb:829389 - COEInstaller Requires,Conflicts, and Release includes new classes _OpenCOESegment and _OpenCOETextDialog --- NEW FILE: _OpenCOESegment.java --- /** * Copyright (C) 2002, Federal Linux Systems The project home for this software * is http://www.opencoe.org This segment is free software; you can * redistribute it and/or modify it under the terms of the GNU Lesser General * Public License as published by the Free Software Foundation; either version * 2.1 of the License, or (at your option) any later version. This segment is * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. You should have received a copy of the GNU Lesser General Public * License along with this segment; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.opencoe.coe.kernel.util; import java.util.*; import java.io.File; import java.io.FileReader; import java.io.BufferedReader; /** * Description of the Class * *@author root *@created October 24, 2003 *@history 20031026:rb:829389 - COEInstaller Requires,Conflicts, and Release */ public class _OpenCOESegment { // SegDescrip files private File segDescripDir; private File deInstallFile; private File fileAttribsFile; private File installedFile; private File licenseFile; private File releaseNotesFile; private File postInstallFile; private File preInstallFile; private File segInfoFile; private File segNameFile; private File validatedFile; private File versionFile; // File Attribs Permissions private Vector fileAttribs; // Installed Properties private String installation; // ReleaseNotes Properties private String releasenotes; // SegInfo Properties private String accountgroup; private java.util.Vector apppaths; private String earliest; private java.util.Vector exceptions; private java.util.Vector conflicts; private java.util.Vector requires; private String cpu; private String disk; private String memory; private String opsys; private String partition; private String tempspace; private String classification; private java.util.Vector iconfiles; private java.util.Vector menufiles; private java.util.Vector permissionfiles; private String service; private java.util.Vector groups; private java.util.Vector passwords; private java.util.Vector services; // SegName Properties private String name; private String type; private String prefix; private String segment; // Validated Properties private String validation; // Version Properties private String version; // Segment attributes private boolean installed; private boolean validated; // File Reader handles File inputFile; FileReader in; BufferedReader buff; boolean eof; String[] prop; /// constructor methods /////////////////////////////////// /** * Constructor for the _OpenCOESegment object */ public _OpenCOESegment() { init(); } /** * Constructor for the _OpenCOESegment object * *@param dir Description of the Parameter */ public _OpenCOESegment(File dir) { init(); readSegDescrip(dir); } /** * Description of the Method */ private void init() { // Installed Properties installation = new String(); // ReleaseNotes Properties releasenotes = new String(); // SegInfo Properties //- accountgroup accountgroup = new String(); //- apppaths //apppaths = new Vector(); //- coeservices groups = new Vector(); passwords = new Vector(); services = new Vector(); //- community //- comm.deinstall //- compat //earliest = new String(); //exceptions = new Vector(); //list = new Vector(); //- conflicts conflicts = new Vector(); //- data //data = new Vector(); //- database //database = new Vector(); //- dceclientdef //- decserverdef //- fileslist //- hardware cpu = new String(); disk = new String(); memory = new String(); opsys = new String(); partition = new String(); tempspace = new String(); //- help //- icons iconfiles = new Vector(); //- menus menufiles = new Vector(); //- network //- permissions permissionfiles = new Vector(); //- processes //- process group //- priviledged process //- registry //- reqrdscripts //- requires requires = new Vector(); //- security classification = new String(); //- shared file // SegName Properties name = new String(); type = new String(); prefix = new String(); segment = new String(); // Validated Properties validation = new String(); // Version Properties version = new String(); // Segment attributes installed = false; validated = false; } /** * Description of the Method * *@param dir Description of the Parameter */ public void readSegDescrip(File dir) { this.segDescripDir = dir; //System.out.println("_OpenCOESegment::readSegDescrip::" + segDescripDir.getAbsolutePath()); deInstallFile = new File(segDescripDir.getAbsolutePath() + "/DEINSTALL"); if (deInstallFile.canRead()) { readDeInstallFile(); } else { deInstallFile = null; } fileAttribsFile = new File(segDescripDir.getAbsolutePath() + "/FileAttribs"); if (fileAttribsFile.canRead()) { readFileAttribsFile(); } else { fileAttribsFile = null; } installedFile = new File(segDescripDir.getAbsolutePath() + "/Installed"); if (installedFile.canRead()) { readInstalledFile(); } else { installedFile = null; } licenseFile = new File(segDescripDir.getAbsolutePath() + "/License"); if (licenseFile.canRead()) { readLicenseFile(); } else { licenseFile = null; } releaseNotesFile = new File(segDescripDir.getAbsolutePath() + "/ReleaseNotes"); readReleaseNotesFile(); preInstallFile = new File(segDescripDir.getAbsolutePath() + "/PreInstall"); if (preInstallFile.canRead()) { readPreInstallFile(); } else { preInstallFile = null; } postInstallFile = new File(segDescripDir.getAbsolutePath() + "/PostInstall"); if (postInstallFile.canRead()) { readPostInstallFile(); } else { postInstallFile = null; } segInfoFile = new File(segDescripDir.getAbsolutePath() + "/SegInfo"); if (segInfoFile.canRead()) { readSegInfoFile(); } else { segInfoFile = null; } segNameFile = new File(segDescripDir.getAbsolutePath() + "/SegName"); readSegNameFile(); validatedFile = new File(segDescripDir.getAbsolutePath() + "/Validated"); if (validatedFile.canRead()) { readValidatedFile(); } else { validatedFile = null; } versionFile = new File(segDescripDir.getAbsolutePath() + "/VERSION"); if (versionFile.canRead()) { readVersionFile(); } else { versionFile = null; } } /** * Description of the Method */ private void readDeInstallFile() { } /** * Description of the Method */ private void readFileAttribsFile() { } /** * Description of the Method */ private void readInstalledFile() { } /** * Description of the Method */ private void readLicenseFile() { } /** * Description of the Method */ private void readPreInstallFile() { } /** * Description of the Method */ private void readPostInstallFile() { } /** * Description of the Method */ private void readReleaseNotesFile() { try { buff = new BufferedReader(new FileReader(releaseNotesFile)); eof = false; while (!eof) { String line = buff.readLine(); if (line == null) { eof = true; } else { releasenotes = releasenotes + "\n" + line; } } } catch (java.io.FileNotFoundException fnfe) { releaseNotesFile = null; } catch (java.io.IOException ioe) { releaseNotesFile = null; } } /** * Description of the Method */ private void readSegInfoFile() { String section = new String(); String subsection = new String(); try { buff = new BufferedReader(new FileReader(segInfoFile)); eof = false; while (!eof) { String line = buff.readLine(); if (line == null) { eof = true; } else { line = line.trim(); } //System.out.println("SegInfo::" + section + "::" + line); if (line == null) { //line = line.trim(); } else if (line.matches("\\[AcctGroup\\]")) { section = "AcctGroup"; subsection = ""; } else if (line.matches("\\[AppPaths\\]")) { section = "AppPaths"; subsection = ""; } else if (line.matches("\\[COEServices\\]")) { section = "COEServices"; subsection = ""; } else if (line.matches("\\[Community\\]")) { section = "Community"; subsection = ""; } else if (line.matches("\\[Comm.deinstall\\]")) { section = "Community"; subsection = ""; } else if (line.matches("\\[Compat\\]")) { section = "Community"; subsection = ""; } else if (line.matches("\\[Conflicts\\]")) { section = "Conflicts"; subsection = ""; } else if (line.matches("\\[Data\\]")) { section = "Data"; subsection = ""; } else if (line.matches("\\[Database\\]")) { section = "Database"; subsection = ""; } else if (line.matches("\\[DCEClientDef\\]")) { section = "DCEClientDef"; subsection = ""; } else if (line.matches("\\[DCEServerDef\\]")) { section = "DCEServerDef"; subsection = ""; } else if (line.matches("\\[Direct\\]")) { section = "Direct"; subsection = ""; } else if (line.matches("\\[FilesList\\]")) { section = "FilesList"; subsection = ""; } else if (line.matches("\\[Hardware\\]")) { section = "Hardware"; subsection = ""; } else if (line.matches("\\[Help\\]")) { section = "Help"; subsection = ""; } else if (line.matches("\\[Icons\\]")) { section = "Icons"; subsection = ""; } else if (line.matches("\\[Menus\\]")) { section = "Menus"; subsection = ""; } else if (line.matches("\\[Network\\]")) { section = "Network"; subsection = ""; } else if (line.matches("\\[Permissions\\]")) { section = "Permissions"; subsection = ""; } else if (line.matches("\\[Processes\\]")) { section = "Processes"; subsection = ""; } else if (line.matches("\\[Process Group\\]")) { section = "Process Group"; subsection = ""; } else if (line.matches("\\[Registry\\]")) { section = "Registry"; subsection = ""; } else if (line.matches("\\[ReqrdScripts\\]")) { section = "ReqrdScripts"; subsection = ""; } else if (line.matches("\\[Requires\\]")) { section = "Requires"; subsection = ""; } else if (line.matches("\\[Security\\]")) { section = "Security"; subsection = ""; } else if (line.matches("\\[SharedFile\\]")) { section = "SharedFile"; subsection = ""; } else if (section.equals("AcctGroup")) { accountgroup = line; } else if (section.equals("AppPaths") && line.matches("^$.+=.+$")) { // list of Windows executables to add to PATH } else if (section.equals("COEServices")) { if (line.matches("^$GROUPS")) { subsection = "GROUPS"; } else if (line.matches("^$PASSWORDS")) { subsection = "PASSWORDS"; } else if (line.matches("^$SERVICES")) { subsection = "SERVICES"; } else if (subsection.matches("GROUPS") && line.matches("^\\w+:")) { groups.add(line); } else if (subsection.matches("GROUPS") && line.matches("^\\w+:")) { passwords.add(line); } else if (subsection.matches("GROUPS") && line.matches("^\\w+:")) { services.add(line); } } else if (section.equals("Community")) { if (line.matches("^$APPEND")) { subsection = "APPEND"; } else if (line.matches("^$COMMENT")) { subsection = "COMMENT"; } else if (line.matches("^$DELETE")) { subsection = "DELETE"; } else if (line.matches("^$FILE")) { subsection = "FILE"; } else if (line.matches("^$INSERT")) { subsection = "INSERT"; } else if (line.matches("^$REPLACE")) { subsection = "REPLACE"; } else if (line.matches("^$SUBSTR")) { subsection = "SUBSTR"; } else if (line.matches("^$UNCOMMENT")) { subsection = "UNCOMMENT"; } } else if (section.equals("Comm.deinstall")) { if (line.matches("^$APPEND")) { subsection = "APPEND"; } else if (line.matches("^$COMMENT")) { subsection = "COMMENT"; } else if (line.matches("^$DELETE")) { subsection = "DELETE"; } else if (line.matches("^$FILE")) { subsection = "FILE"; } else if (line.matches("^$INSERT")) { subsection = "INSERT"; } else if (line.matches("^$REPLACE")) { subsection = "REPLACE"; } else if (line.matches("^$SUBSTR")) { subsection = "SUBSTR"; } else if (line.matches("^$UNCOMMENT")) { subsection = "UNCOMMENT"; } } else if (section.equals("Compat")) { if (line.matches("^$EARLIST")) { subsection = "EARLIEST"; } else if (line.matches("^$EXCEPTIONS")) { subsection = "EXCEPTIONS"; } else if (line.matches("^$LIST")) { subsection = "LIST"; } else if (subsection.equals("EARLIEST")) { } else if (subsection.equals("EXCEPTIONS")) { } else if (subsection.equals("LIST")) { } //} else if (section.equals("Conflicts") && line.matches("^[a-zA-Z]+")) { } else if (section.equals("Conflicts")) { conflicts.add(line); } else if (section.equals("Data") && line.matches("^$.+=.+$")) { //data=line; } else if (section.equals("Database") && line.matches("^$.+=.+$")) { if (line.matches("^$DATABASE_ID")) { subsection = "DATABASE_ID"; } else if (line.matches("^$REFERENCES")) { subsection = "REFERENCES"; } else if (line.matches("^$MODIFIERS")) { subsection = "MODIFIERS"; } else if (line.matches("^$ROLES")) { subsection = "ROLES"; } else if (line.matches("^$SCOPE")) { subsection = "SCOPE"; } else if (line.matches("^$ACCESSES")) { subsection = "ACCESSES"; } } else if (section.equals("DCEClientDef") && line.matches("^$.+=.+$")) { if (line.matches("^$ATTRIBUTE")) { subsection = "ATTRIBUTE"; } else if (line.matches("^$DCECLIENT")) { subsection = "DCECLIENT"; } else if (line.matches("^$DCEGROUP")) { subsection = "DCEGROUP"; } else if (line.matches("^$DFSFILES")) { subsection = "DFSFILES"; } else if (line.matches("^$INTERFACE")) { subsection = "INTERFACE"; } } else if (section.equals("DCEServerDef") && line.matches("^$.+=.+$")) { if (line.matches("^$ACLMGRDEFAULT")) { subsection = "ACLMGRDEFAULT"; } else if (line.matches("^$ACLMGRINFO")) { subsection = "ACLMGRINFO"; } else if (line.matches("^$ACLMGRTYPE")) { subsection = "ACLMGRTYPE"; } else if (line.matches("^$ACLMGRUUID")) { subsection = "ACLMGRUUID"; } else if (line.matches("^$ATTRIBUTE")) { subsection = "ATTRIBUTE"; } else if (line.matches("^$AUDITINFO")) { subsection = "AUDITINFO"; } else if (line.matches("^$DCEADMINGROUP")) { subsection = "DCEADMINGROUP"; } else if (line.matches("^$DCEBOOT")) { subsection = "DCEBOOT"; } else if (line.matches("^$DCEGROUP")) { subsection = "DCEGROUP"; } else if (line.matches("^$DCESERVICE")) { subsection = "DCESERVICE"; } else if (line.matches("^$DEBUGMESSAGES")) { subsection = "DEBUGMESSAGES"; } else if (line.matches("^$DFSFiles")) { subsection = "DFSFiles"; } else if (line.matches("^$INTEFACE")) { subsection = "INTERFACE"; } else if (line.matches("^$MGMTMAPPING")) { subsection = "MGMTMAPPING"; } else if (line.matches("^$MESSAGES")) { subsection = "MESSAGES"; } else if (line.matches("^$OBJUUID")) { subsection = "OBJUUID"; } else if (line.matches("^$PERMISSION")) { subsection = "PERMISSION"; } else if (line.matches("^$RPCSECURITY")) { subsection = "RPCSECURITY"; } else if (line.matches("^$SERVERTHREAD")) { subsection = "SERVERTHREAD"; } else if (line.matches("^$SERVICEABILITY")) { subsection = "SERVICEABILITY"; } else if (line.matches("^$UUID")) { subsection = "UUID"; } } else if (section.equals("Direct") && line.matches("^$.+=.+$")) { if (line.matches("^$ACCTADD")) { subsection = "ACCTADD"; } else if (line.matches("^$ACCTDEL")) { subsection = "ACCTDEL"; } else if (line.matches("^$CMDLINE")) { subsection = "CMDLINE"; } else if (line.matches("^$KEY")) { subsection = "KEY"; } else if (line.matches("^$NOCOMPRESS")) { subsection = "NOCOMPRESS"; } else if (line.matches("^$PROFADD")) { subsection = "PROFADD"; } else if (line.matches("^$PROFDEL")) { subsection = "PROFDEL"; } else if (line.matches("^$PROFSWITCH")) { subsection = "PROFSWITCH"; } else if (line.matches("^$READ_ONLY")) { subsection = "READ_ONLY"; } else if (line.matches("^$REBOOT")) { subsection = "REBOOT"; } else if (line.matches("^$REMOTE")) { subsection = "REMOTE"; } else if (line.matches("^$ROOT")) { subsection = "ROOT"; } else if (line.matches("^$SELF_CONTAINER")) { subsection = "SELF_CONTAINER"; } else if (line.matches("^$SUPERUSER")) { subsection = "SUPERUSER"; } else if (line.matches("^$USES_UNINSTALL")) { subsection = "USES_UNINSTALL"; } } else if (section.equals("FilesList") && line.matches("^$.+=.+$")) { if (line.matches("^$DIRS")) { subsection = "DIRS"; } else if (line.matches("^$FILES")) { subsection = "FILES"; } else if (line.matches("^$PATH")) { subsection = "PATH"; } } else if (section.equals("Hardware") && line.matches("^$.+=.+$")) { // line is of form "$KEY=value"; prop = line.split("="); // Search for new object if (prop[0].equals("$OPSYS")) { opsys = prop[1]; } else if (prop[0].equals("$CPU")) { cpu = prop[1]; } else if (prop[0].equals("$DISK")) { disk = prop[1]; } else if (prop[0].equals("$MEMORY")) { memory = prop[1]; } else if (prop[0].equals("$PARTITION")) { partition = prop[1]; } else if (prop[0].equals("$TEMPSAPCE")) { tempspace = prop[1]; } } else if (section.equals("Help") && line.matches("^$.+=.+$")) { if (line.matches("^$HTML")) { subsection = "HTML"; } else if (line.matches("^$MAN")) { subsection = "MAN"; } else if (line.matches("^$MSHELP")) { subsection = "MSHELP"; } else if (line.matches("^$TEXT")) { subsection = "TEXT"; } else if (line.matches("^$OTHER")) { subsection = "OTHER"; } } else if (section.equals("Icons") && line.matches("^\\w+")) { iconfiles.add(line); } else if (section.equals("Menus") && line.matches("^\\w+")) { menufiles.add(line); } else if (section.equals("Network") && line.matches("^$.+=.+$")) { if (line.matches("^$HOST")) { subsection = "HOST"; } else if (line.matches("^$KEY")) { subsection = "KEY"; } else if (line.matches("^$MOUNT")) { subsection = "MOUNT"; } else if (line.matches("^$NETMASK")) { subsection = "NETMASK"; } else if (line.matches("^$SERVERS")) { subsection = "SERVERS"; } } else if (section.equals("Permissions") && line.matches("^\\w+")) { permissionfiles.add(line); } else if (section.equals("Processes") && line.matches("^$.+=.+$")) { if (line.matches("^$BOOT")) { subsection = "BOOT"; } else if (line.matches("^$BACKGROUND")) { subsection = "BACKGROUND"; } else if (line.matches("^$PERIODIC")) { subsection = "PERIODIC"; } else if (line.matches("^$RUN_ONCE")) { subsection = "RUN_ONCE"; } else if (line.matches("^$SESSION")) { subsection = "SESSION"; } else if (line.matches("^$SESSION_EXIT")) { subsection = "SESSION_EXIT"; } } else if (section.equals("Process Group") && line.matches("^$.+=.+$")) { } else if (section.equals("Registry") && line.matches("^$.+=.+$")) { } else if (section.equals("ReqrdScripts") && line.matches("^$.+=.+$")) { } else if (section.equals("Requires")) { requires.add(line); } else if (section.equals("Security") && line.matches("^$.+=.+$")) { } else if (section.equals("SharedFile") && line.matches("^$.+=.+$")) { } } } catch (java.io.FileNotFoundException fnfe) { segNameFile = null; } catch (java.io.IOException ioe) { segNameFile = null; } } /** * Description of the Method */ private void readSegNameFile() { try { buff = new BufferedReader(new FileReader(segNameFile)); eof = false; while (!eof) { String line = buff.readLine(); if (line == null) { eof = true; } else if (line.trim().matches("^$.+=.+$")) { // line is of form "$KEY=value"; line = line.trim(); prop = line.split("="); // Search for new object if (prop[0].equals("$NAME")) { name = prop[1]; } else if (prop[0].equals("$TYPE")) { type = prop[1]; } else if (prop[0].equals("$PREFIX")) { prefix = prop[1]; } else if (prop[0].equals("$SEGMENT")) { segment = prop[1]; } } } } catch (java.io.FileNotFoundException fnfe) { segNameFile = null; } catch (java.io.IOException ioe) { segNameFile = null; } } /** * Description of the Method */ private void readValidatedFile() { } /** * Description of the Method */ private void readVersionFile() { } /// setter methods /////////////////////////////////// /// getter methods /////////////////////////////////// /** * Gets the releaseNotes attribute of the _OpenCOESegment object * *@return The releaseNotes value */ public String getReleaseNotes() { return releasenotes; } /** * Gets the requires attribute of the _OpenCOESegment object * *@return The requires value */ public java.util.Vector getRequires() { return requires; } /** * Gets the conflicts attribute of the _OpenCOESegment object * *@return The conflicts value */ public java.util.Vector getConflicts() { return conflicts; } } |