]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/GenBuild/org/tianocore/build/pcd/action/ShowPCDDatabaseAction.java
Tip break because EdkFatPkg was introduced into FrameworkDatabase.db, But EdkFatPkg...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / action / ShowPCDDatabaseAction.java
CommitLineData
878ddf1f 1/** @file\r
2 ShowPCDDatabase class.\r
3\r
4 This class is the action to diplay the PCD database.\r
5 \r
6Copyright (c) 2006, Intel Corporation\r
7All rights reserved. This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11 \r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16package org.tianocore.build.pcd.action;\r
17\r
18import java.io.File;\r
19\r
20import org.tianocore.build.global.GlobalData;\r
21import org.tianocore.build.pcd.exception.UIException;\r
22import org.tianocore.build.pcd.ui.PCDDatabaseFrame;\r
23\r
24/** This class is the action to show PCD database.\r
25**/\r
26public class ShowPCDDatabaseAction extends UIAction {\r
27 ///\r
28 /// The workspace path parameter.\r
29 ///\r
30 private String workspacePath;\r
31 ///\r
32 /// The FpdfileName parameter.\r
33 ///\r
34 private String fpdFilePath;\r
35\r
36 /**\r
37 set workspace path parameter for this action.\r
38 \r
39 @param workspacePath the string of workspace path.\r
40 **/\r
41 public void setWorkspacePath(String workspacePath) {\r
42 this.workspacePath = workspacePath;\r
43 }\r
44\r
45 /**\r
46 set fpd file path parameter for this action.\r
47\r
48 @param fpdFilePath file path string\r
49 **/\r
50 public void setFPDFilePath(String fpdFilePath) {\r
51 this.fpdFilePath = "./" + fpdFilePath;\r
52 }\r
53\r
54 /**\r
55 check paramter for this action.\r
56 \r
57 @throw UIException wrong paramter.\r
58 **/\r
59 void checkParamter() throws UIException {\r
60 File file = null;\r
61\r
62 if((fpdFilePath == null) ||(workspacePath == null)) {\r
63 throw new UIException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
64 }\r
65\r
66 if(fpdFilePath.length() == 0 || workspacePath.length() == 0) {\r
67 throw new UIException("WorkspacePath and FPDFileName should be blank for CollectPCDAtion!");\r
68 }\r
69\r
70 file = new File(workspacePath);\r
71 if(!file.exists()) {\r
72 throw new UIException("WorkpacePath " + workspacePath + " does not exist!");\r
73 }\r
74\r
75 file = new File(fpdFilePath);\r
76\r
77 if(!file.exists()) {\r
78 throw new UIException("FPD File " + fpdFilePath + " does not exist!");\r
79 }\r
80 }\r
81\r
82 /**\r
83 Core workflow function.\r
84 \r
85 @throw UIException Fail to show PCD database.\r
86 **/\r
87 void performAction() throws UIException {\r
88 CollectPCDAction collectAction = null;\r
89 PCDDatabaseFrame dbFrame = null;\r
90\r
91 //\r
92 // Initialize global data.\r
93 //\r
94 GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",\r
95 workspacePath);\r
96 GlobalData.getPCDMemoryDBManager().setLogFileName(fpdFilePath + ".PCDMemroyDatabaseLog.txt");\r
97\r
98 //\r
99 // Collect PCD information.\r
100 //\r
101 collectAction = new CollectPCDAction();\r
102\r
103 try {\r
104 collectAction.perform(workspacePath,\r
105 fpdFilePath,\r
106 ActionMessage.LOG_MESSAGE_LEVEL);\r
107 } catch(Exception exp) {\r
108 throw new UIException(exp.getMessage());\r
109 }\r
110\r
111 //\r
112 // Start tree windows.\r
113 //\r
114 dbFrame = new PCDDatabaseFrame(GlobalData.getPCDMemoryDBManager());\r
115 }\r
116\r
117 /**\r
118 Entry function.\r
119 \r
120 The action is run from command line.\r
121 \r
122 @param argv command line parameter.\r
123 **/\r
124 public static void main(String[] argv) throws UIException {\r
125 ShowPCDDatabaseAction showAction = new ShowPCDDatabaseAction();\r
126 showAction.setWorkspacePath(argv[0]);\r
127 showAction.setFPDFilePath(argv[1]);\r
128 showAction.execute();\r
129 }\r
130}\r