+++ /dev/null
-/** @file\r
- \r
- The file is used to override AbstractCellEditor to provides customized interfaces \r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-\r
-package org.tianocore.packaging.workspace.command;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import org.tianocore.common.Log;\r
-import org.tianocore.common.Tools;\r
-import org.tianocore.packaging.MdkPkg;\r
-\r
-/**\r
- The class is used to override AbstractCellEditor to provides customized interfaces \r
- \r
- @since CreateMdkPkg 1.0\r
-\r
- **/\r
-public class InstallWorkspace {\r
- /**\r
- Main class, reserved for test\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- This is the default constructor\r
- Reserved\r
- \r
- **/\r
- public InstallWorkspace() {\r
- // TODO\r
- }\r
-\r
- /**\r
- Check if exist target dir\r
- \r
- @param strInstallDir The install target dir\r
- @retval true - The target exists\r
- @retval false - The target doesn't exist\r
- \r
- **/\r
- public static boolean isExistInstallDir(String strInstallDir) {\r
- File id = new File(strInstallDir);\r
- return id.exists();\r
- }\r
-\r
- /**\r
- Create install target dir\r
- \r
- @param strInstallDir The install target dir\r
- @retval true - Install success\r
- @retval false - Install fail\r
- \r
- **/\r
- public static boolean createInstallDir(String strInstallDir) {\r
- File id = new File(strInstallDir);\r
- try {\r
- return id.mkdir();\r
- } catch (Exception e) {\r
- System.out.print(e.getMessage());\r
- return false;\r
- }\r
- }\r
-\r
- /**\r
- Reserved\r
- \r
- @return boolean\r
- \r
- **/\r
- public static boolean setSystemEnvironment() {\r
- return true;\r
- }\r
-\r
- /**\r
- Reserved \r
- \r
- @return boolean\r
- **/\r
- public static boolean setToolChainPath() {\r
- return true;\r
- }\r
-\r
- /**\r
- Reserved\r
- \r
- @return boolean\r
- **/\r
- public static boolean setToolChain() {\r
- return true;\r
- }\r
-\r
- /**\r
- Reserved\r
- \r
- @return boolean\r
- **/\r
- public static boolean setFrameworkDatabase() {\r
- return true;\r
- }\r
-\r
- /**\r
- Delete setup files and directory\r
- \r
- @param strPath The delete target dir\r
- @retval true - Delete success\r
- @retval false - Delete fail\r
- \r
- **/\r
- public static boolean delSetupPackage(String strPath) {\r
- File f = new File(strPath);\r
- try {\r
- Tools.deleteFolder(f);\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- \r
- @param strInstallDir The install target dir\r
- @param strJarFile The install target file\r
- @retval true - Install success\r
- @retval false - Install fail\r
- @throws IOException\r
- \r
- **/\r
- public static boolean installPackage(String strInstallDir, String strJarFile) throws IOException {\r
- Log.log("Install Dir", strInstallDir);\r
- Log.log("Jar File Path", strJarFile);\r
-\r
- MdkPkg mp = new MdkPkg(strJarFile);\r
- try {\r
- mp.install(strInstallDir + System.getProperty("file.separator"));\r
- return true;\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- Log.log("Install Err", e.toString());\r
- }\r
- return false;\r
- }\r
-}\r