]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | ShowPCDDatabase class.\r | |
3 | \r | |
4 | This class is the action to diplay the PCD database.\r | |
5 | \r | |
6 | Copyright (c) 2006, Intel Corporation\r | |
7 | All rights reserved. This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | package org.tianocore.build.pcd.action;\r | |
17 | \r | |
18 | import java.io.File;\r | |
19 | \r | |
20 | import org.tianocore.build.global.GlobalData;\r | |
21 | import org.tianocore.build.pcd.exception.UIException;\r | |
22 | import org.tianocore.build.pcd.ui.PCDDatabaseFrame;\r | |
23 | \r | |
24 | /** This class is the action to show PCD database.\r | |
25 | **/\r | |
26 | public 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 | |
136adffc | 95 | workspacePath,null);\r |
878ddf1f | 96 | \r |
97 | //\r | |
98 | // Collect PCD information.\r | |
99 | //\r | |
100 | collectAction = new CollectPCDAction();\r | |
101 | \r | |
102 | try {\r | |
103 | collectAction.perform(workspacePath,\r | |
104 | fpdFilePath,\r | |
105 | ActionMessage.LOG_MESSAGE_LEVEL);\r | |
106 | } catch(Exception exp) {\r | |
107 | throw new UIException(exp.getMessage());\r | |
108 | }\r | |
109 | \r | |
110 | //\r | |
111 | // Start tree windows.\r | |
112 | //\r | |
113 | dbFrame = new PCDDatabaseFrame(GlobalData.getPCDMemoryDBManager());\r | |
114 | }\r | |
115 | \r | |
116 | /**\r | |
117 | Entry function.\r | |
118 | \r | |
119 | The action is run from command line.\r | |
120 | \r | |
121 | @param argv command line parameter.\r | |
122 | **/\r | |
123 | public static void main(String[] argv) throws UIException {\r | |
124 | ShowPCDDatabaseAction showAction = new ShowPCDDatabaseAction();\r | |
8840ad58 | 125 | //showAction.setWorkspacePath(argv[0]);\r |
126 | //showAction.setFPDFilePath(argv[1]);\r | |
6ff7a41c | 127 | showAction.setWorkspacePath("e:/tianocore/edk2");\r |
8840ad58 | 128 | showAction.setFPDFilePath("EdkNt32Pkg/Nt32.fpd");\r |
878ddf1f | 129 | showAction.execute();\r |
130 | }\r | |
131 | }\r |