]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | \r | |
3 | The file is used to override AbstractCellEditor to provides customized interfaces \r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | package org.tianocore.packaging.workspace.command;\r | |
17 | \r | |
18 | import java.io.File;\r | |
19 | import java.io.IOException;\r | |
20 | \r | |
21 | import org.tianocore.common.Log;\r | |
22 | import org.tianocore.common.Tools;\r | |
23 | import org.tianocore.packaging.MdkPkg;\r | |
24 | \r | |
25 | /**\r | |
26 | The class is used to override AbstractCellEditor to provides customized interfaces \r | |
27 | \r | |
28 | @since CreateMdkPkg 1.0\r | |
29 | \r | |
30 | **/\r | |
31 | public class InstallWorkspace {\r | |
32 | /**\r | |
33 | Main class, reserved for test\r | |
34 | \r | |
35 | @param args\r | |
36 | \r | |
37 | **/\r | |
38 | public static void main(String[] args) {\r | |
39 | // TODO Auto-generated method stub\r | |
40 | \r | |
41 | }\r | |
42 | \r | |
43 | /**\r | |
44 | This is the default constructor\r | |
45 | Reserved\r | |
46 | \r | |
47 | **/\r | |
48 | public InstallWorkspace() {\r | |
49 | // TODO\r | |
50 | }\r | |
51 | \r | |
52 | /**\r | |
53 | Check if exist target dir\r | |
54 | \r | |
55 | @param strInstallDir The install target dir\r | |
56 | @retval true - The target exists\r | |
57 | @retval false - The target doesn't exist\r | |
58 | \r | |
59 | **/\r | |
60 | public static boolean isExistInstallDir(String strInstallDir) {\r | |
61 | File id = new File(strInstallDir);\r | |
62 | return id.exists();\r | |
63 | }\r | |
64 | \r | |
65 | /**\r | |
66 | Create install target dir\r | |
67 | \r | |
68 | @param strInstallDir The install target dir\r | |
69 | @retval true - Install success\r | |
70 | @retval false - Install fail\r | |
71 | \r | |
72 | **/\r | |
73 | public static boolean createInstallDir(String strInstallDir) {\r | |
74 | File id = new File(strInstallDir);\r | |
75 | try {\r | |
76 | return id.mkdir();\r | |
77 | } catch (Exception e) {\r | |
78 | System.out.print(e.getMessage());\r | |
79 | return false;\r | |
80 | }\r | |
81 | }\r | |
82 | \r | |
83 | /**\r | |
84 | Reserved\r | |
85 | \r | |
86 | @return boolean\r | |
87 | \r | |
88 | **/\r | |
89 | public static boolean setSystemEnvironment() {\r | |
90 | return true;\r | |
91 | }\r | |
92 | \r | |
93 | /**\r | |
94 | Reserved \r | |
95 | \r | |
96 | @return boolean\r | |
97 | **/\r | |
98 | public static boolean setToolChainPath() {\r | |
99 | return true;\r | |
100 | }\r | |
101 | \r | |
102 | /**\r | |
103 | Reserved\r | |
104 | \r | |
105 | @return boolean\r | |
106 | **/\r | |
107 | public static boolean setToolChain() {\r | |
108 | return true;\r | |
109 | }\r | |
110 | \r | |
111 | /**\r | |
112 | Reserved\r | |
113 | \r | |
114 | @return boolean\r | |
115 | **/\r | |
116 | public static boolean setFrameworkDatabase() {\r | |
117 | return true;\r | |
118 | }\r | |
119 | \r | |
120 | /**\r | |
121 | Delete setup files and directory\r | |
122 | \r | |
123 | @param strPath The delete target dir\r | |
124 | @retval true - Delete success\r | |
125 | @retval false - Delete fail\r | |
126 | \r | |
127 | **/\r | |
128 | public static boolean delSetupPackage(String strPath) {\r | |
129 | File f = new File(strPath);\r | |
130 | try {\r | |
131 | Tools.deleteFolder(f);\r | |
132 | } catch (Exception e) {\r | |
133 | e.printStackTrace();\r | |
134 | }\r | |
135 | return true;\r | |
136 | }\r | |
137 | \r | |
138 | /**\r | |
139 | \r | |
140 | @param strInstallDir The install target dir\r | |
141 | @param strJarFile The install target file\r | |
142 | @retval true - Install success\r | |
143 | @retval false - Install fail\r | |
144 | @throws IOException\r | |
145 | \r | |
146 | **/\r | |
147 | public static boolean installPackage(String strInstallDir, String strJarFile) throws IOException {\r | |
148 | Log.log("Install Dir", strInstallDir);\r | |
149 | Log.log("Jar File Path", strJarFile);\r | |
150 | \r | |
151 | MdkPkg mp = new MdkPkg(strJarFile);\r | |
152 | try {\r | |
153 | mp.install(strInstallDir + System.getProperty("file.separator"));\r | |
154 | return true;\r | |
155 | } catch (Exception e) {\r | |
156 | e.printStackTrace();\r | |
157 | Log.log("Install Err", e.toString());\r | |
158 | }\r | |
159 | return false;\r | |
160 | }\r | |
161 | }\r |