1. Update to just keep several line JAVA related msg; 2. Remove file PropertyManager...
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / id / PackageIdentification.java
CommitLineData
5f42a4ba 1/** @file\r
2This file is to define PackageIdentification class.\r
3\r
4Copyright (c) 2006, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12**/\r
13\r
a29c47e0 14package org.tianocore.build.id;\r
15import java.io.File;\r
16\r
17import org.tianocore.build.global.GlobalData;\r
18\r
01413f0c 19/**\r
20 This class is used to identify a package. \r
21\r
22 @since GenBuild 1.0\r
23**/\r
a29c47e0 24public class PackageIdentification extends Identification{\r
25 \r
26 //\r
01413f0c 27 // SPD file\r
a29c47e0 28 //\r
29 private File spdFile;\r
30 \r
01413f0c 31 /**\r
32 @param guid Guid\r
33 @param version Version\r
34 **/\r
a29c47e0 35 public PackageIdentification(String guid, String version){\r
36 super(guid, version);\r
37 }\r
38 \r
01413f0c 39 /**\r
40 @param name Name\r
41 @param guid Guid\r
42 @param version Version\r
43 **/\r
a29c47e0 44 public PackageIdentification(String name, String guid, String version){\r
45 super(name, guid, version);\r
46 }\r
47 \r
01413f0c 48 /**\r
49 @param name Name\r
50 @param guid Guid\r
51 @param version Version\r
52 @param spdFilename SPD file name\r
53 **/\r
a29c47e0 54 public PackageIdentification(String name, String guid, String version, String spdFilename){\r
55 super(name, guid, version);\r
56 this.spdFile = new File(spdFilename);\r
57 }\r
58 \r
01413f0c 59 /**\r
60 @param name Name\r
61 @param guid Guid\r
62 @param version Version\r
63 @param spdFile SPD file\r
64 **/\r
a29c47e0 65 public PackageIdentification(String name, String guid, String version, File spdFile){\r
66 super(name, guid, version);\r
67 this.spdFile = spdFile;\r
68 }\r
69 \r
01413f0c 70 /**\r
71 set SPD file.\r
72 @param spdFile SPD file\r
73 **/\r
a29c47e0 74 public void setSpdFile(File spdFile) {\r
75 this.spdFile = spdFile;\r
76 }\r
77\r
01413f0c 78 /**\r
79 get SPD file\r
80 @return SPD file\r
81 **/\r
a29c47e0 82 public File getSpdFile() {\r
83 return spdFile;\r
84 }\r
85\r
86 public String toString(){\r
a29c47e0 87 if (version == null || version.trim().equalsIgnoreCase("")) {\r
88 return "package [" + name + "]";\r
89 }\r
90 else {\r
91 return "package [" + name + " " + version + "]";\r
92 }\r
93 }\r
94 \r
01413f0c 95 /**\r
96 get package directory\r
97 @return Package Directory\r
98 **/\r
a29c47e0 99 public String getPackageDir(){\r
a29c47e0 100 return spdFile.getParent();\r
101 }\r
102 \r
01413f0c 103 /**\r
104 get package relative directory. \r
105 @return package relative directory\r
106 **/\r
a29c47e0 107 public String getPackageRelativeDir(){\r
53d853a6 108 String relativeDir =spdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
109 if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
110 relativeDir = relativeDir.substring(1);\r
111 }\r
112 return relativeDir;\r
a29c47e0 113 }\r
114 \r
a29c47e0 115 public String getName() {\r
a29c47e0 116 return name;\r
117 }\r
118}\r