3 The file is used to init workspace
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.frameworkwizard
.workspace
;
20 import org
.tianocore
.frameworkwizard
.common
.DataType
;
22 public class Workspace
{
24 // Define static return value
26 public final static int WORKSPACE_VALID
= 0;
28 public final static int WORKSPACE_NOT_DEFINED
= 1;
30 public final static int WORKSPACE_NOT_EXIST
= 2;
32 public final static int WORKSPACE_NOT_DIRECTORY
= 3;
34 public final static int WORKSPACE_NOT_VALID
= 4;
37 // Define class members
39 private static String currentWorkspace
= null;
41 private static String strWorkspaceDatabaseFile
= DataType
.FILE_SEPARATOR
+ "Tools" + DataType
.FILE_SEPARATOR
42 + "Conf" + DataType
.FILE_SEPARATOR
+ "FrameworkDatabase.db";
49 public static void main(String
[] args
) {
50 // TODO Auto-generated method stub
57 @return currentWorkspace
60 public static String
getCurrentWorkspace() {
61 return currentWorkspace
;
67 @param currentWorkspace
68 The input data of currentWorkspace
71 public static void setCurrentWorkspace(String currentWorkspace
) {
72 Workspace
.currentWorkspace
= currentWorkspace
;
76 Check if current workspace exists of not
78 @retval true - The current WORKSPACE exists
79 @retval false - The current WORKSPACE doesn't exist
82 public static int checkCurrentWorkspace() {
83 return checkWorkspace(getCurrentWorkspace());
87 Check if current workspace exists or not via input workspace path
90 The input data of WORKSPACE path
91 @retval true - The current WORKSPACE exists
92 @retval false - The current WORKSPACE doesn't exist
95 public static int checkWorkspace(String strWorkspace
) {
97 // Check if WORKSPACE Environment is defined
99 if (strWorkspace
== null || strWorkspace
== "") {
100 return Workspace
.WORKSPACE_NOT_DEFINED
;
104 // Check if WORKSPACE Environment exists
106 File f
= new File(strWorkspace
);
108 return Workspace
.WORKSPACE_NOT_EXIST
;
112 // Check if WORKSPACE Environment is a directory
114 if (!f
.isDirectory()) {
115 return Workspace
.WORKSPACE_NOT_DIRECTORY
;
119 // Check if FrameworkDatabase.db exists
121 f
= new File(strWorkspace
+ Workspace
.getStrWorkspaceDatabaseFile());
123 return Workspace
.WORKSPACE_NOT_VALID
;
126 return Workspace
.WORKSPACE_VALID
;
129 public static String
getStrWorkspaceDatabaseFile() {
130 return strWorkspaceDatabaseFile
;
133 public static void setStrWorkspaceDatabaseFile(String strWorkspaceDatabaseFile
) {
134 //Workspace.strWorkspaceDatabaseFile = strWorkspaceDatabaseFile;