}\r
\r
// Datebase update for SPD and FPD files\r
- result = fixDB(workspace, dbFile, VERBOSE_FLAG, TEST, QUIET);\r
+ result = fixDB(workspace, dbFile, VERBOSE_FLAG, INTERACTIVE, TEST, QUIET);\r
if ((result == 0) && (TEST) && (QUIET == false))\r
System.out.println("Workspace is consistent with current database!");\r
return PASS;\r
}\r
\r
public int findSpds(String workspace, int VERBOSE_FLAG) {\r
- System.out.println("The following Package (SPD) files are in the workspace!"); \r
+ System.out.println("The following Package (SPD) files are in the workspace" + workspace); \r
File wsDir = new File(workspace);\r
findSPDFiles(wsDir, workspace, VERBOSE);\r
for (int i = 0; i < spdList.size(); i++) {\r
- System.out.println(" " + spdList.get(i).trim());\r
- // TODO: get the PackageName from the file\r
+ String Filename = workspace + File.separator + spdList.get(i).trim();\r
+ File spdFilename = new File(Filename);\r
+ try {\r
+ FileReader fileReader = new FileReader(spdFilename);\r
+ BufferedReader reader = new BufferedReader(fileReader);\r
+ String PackageName = null;\r
+ String rLine = null;\r
+ while ((rLine = reader.readLine()) != null) {\r
+ if (rLine.contains("<PackageName>")) {\r
+ PackageName = rLine.replace("<PackageName>", "").trim();\r
+ PackageName = PackageName.replace("</PackageName>", "").trim();\r
+ System.out.printf(" %25s - %s\n",PackageName, spdList.get(i).trim());\r
+ break;\r
+ }\r
+ }\r
+ reader.close();\r
+ } catch (IOException e) {\r
+ System.out.println("ERROR Reading File: " + Filename + e);\r
+ System.exit(FAIL);\r
+ }\r
+ \r
}\r
- return FAIL;\r
+ return PASS;\r
}\r
\r
public int findFpds(String workspace, int VERBOSE_FLAG) {\r
- System.out.println("The following Platform (FPD) files are in the workspace!");\r
+ System.out.println("The following Platform (FPD) files are in the workspace: " + workspace);\r
File wsDir = new File(workspace);\r
findFPDFiles(wsDir, workspace, VERBOSE);\r
for (int i = 0; i < fpdList.size(); i++) {\r
- System.out.println(" " + fpdList.get(i).trim());\r
- // TODO: get the PlatformName from the file\r
+ String Filename = workspace + File.separator + fpdList.get(i).trim();\r
+ File fpdFilename = new File(Filename);\r
+ try {\r
+ FileReader fileReader = new FileReader(fpdFilename);\r
+ BufferedReader reader = new BufferedReader(fileReader);\r
+ String PlatformName = null;\r
+ String rLine = null;\r
+ while ((rLine = reader.readLine()) != null) {\r
+ if (rLine.contains("<PlatformName>")) {\r
+ PlatformName = rLine.replace("<PlatformName>", "").trim();\r
+ PlatformName = PlatformName.replace("</PlatformName>", "").trim();\r
+ System.out.printf(" %25s - %s\n",PlatformName, fpdList.get(i).trim());\r
+ break;\r
+ }\r
+ }\r
+ reader.close();\r
+ } catch (IOException e) {\r
+ System.out.println("ERROR Reading File: " + Filename + e);\r
+ System.exit(FAIL);\r
+ }\r
}\r
- return FAIL;\r
+ return PASS;\r
}\r
\r
// copy from source file to destination file\r
return PASS;\r
}\r
\r
- private int fixDB(String workspace, String dbFile, int VERBOSE, boolean TEST, boolean QUIET) {\r
+ private int fixDB(String workspace, String dbFile, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET) {\r
File wsDir = new File(workspace);\r
int retValue = PASS;\r
// Find all .spd and .fpd files in workspace and put them in spdList and fpdList\r
\r
try {\r
// check database file for possible update\r
- retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, TEST, QUIET);\r
+ retValue = checkDBForUpdate(workspace, dbFile, VERBOSE, INTERACTIVE, TEST, QUIET);\r
} catch (IOException e) {\r
if (QUIET == false)\r
System.out.println("Error: Updating " + dbFile + " file.");\r
}\r
}\r
\r
- private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean TEST, boolean QUIET)\r
+ private int checkDBForUpdate(String workspace, String dbFileName, int VERBOSE, boolean INTERACTIVE, boolean TEST, boolean QUIET)\r
throws IOException {\r
int SpdFlag = 0;\r
int FpdFlag = 0;\r