2 This file is to define ModuleIdentification class.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 package org
.tianocore
.build
.id
;
19 This class is used to identify a module with Module Guid, Module Version,
20 Package Guid, Package Version.
24 public class ModuleIdentification
extends Identification
{
26 private PackageIdentification packageId
;
30 private String moduleType
;
32 private boolean isLibrary
= false;
36 @param version Version
38 public ModuleIdentification(String guid
, String version
){
44 @param version Version
45 @param packageId Package Identification
47 public ModuleIdentification(String guid
, String version
, PackageIdentification packageId
){
49 this.packageId
= packageId
;
55 @param version Version
57 public ModuleIdentification(String name
, String guid
, String version
){
58 super(name
, guid
, version
);
64 @param version Version
65 @param packageId PackageIdentification
67 public ModuleIdentification(String name
, String guid
, String version
, PackageIdentification packageId
){
68 super(name
, guid
, version
);
69 this.packageId
= packageId
;
73 @return boolean is this module is library
75 public boolean isLibrary() {
82 public void setLibrary(boolean isLibrary
) {
83 this.isLibrary
= isLibrary
;
89 public File
getMsaFile() {
94 @return Module relative path to package
96 public String
getModuleRelativePath() {
97 if (msaFile
.getParent().length() == packageId
.getPackageDir().length()) {
100 return msaFile
.getParent().substring(packageId
.getPackageDir().length() + 1);
104 @param msaFile Set Msa File
106 public void setMsaFile(File msaFile
) {
107 this.msaFile
= msaFile
;
110 public boolean equals(Object obj
) {
111 if (obj
instanceof ModuleIdentification
) {
112 ModuleIdentification id
= (ModuleIdentification
)obj
;
113 if (guid
.equalsIgnoreCase(id
.getGuid()) && packageId
.equals(id
.getPackage())) {
114 if (version
== null || id
.version
== null) {
117 else if (version
.trim().equalsIgnoreCase("") || id
.version
.trim().equalsIgnoreCase("")){
120 else if (version
.equalsIgnoreCase(id
.version
)) {
127 return super.equals(obj
);
131 public String
toString() {
133 String versionString
;
134 String packageString
;
136 if (name
!= null && name
!= "") {
139 if (guid
!= null && guid
!= "") {
142 nameString
= "UNKNOWN";
146 if (version
!= null) {
147 versionString
= version
;
152 if (packageId
!= null) {
153 packageString
= packageId
.toString();
155 packageString
= "Package [UNKNOWN]";
158 return "Module [" + nameString
+ versionString
+ "] in " + packageString
;
162 @param packageId set package identification
164 public void setPackage(PackageIdentification packageId
) {
165 this.packageId
= packageId
;
169 @return get package identification
171 public PackageIdentification
getPackage() {
176 @return get module type
178 public String
getModuleType() {
183 @param moduleType set module type
185 public void setModuleType(String moduleType
) {
186 this.moduleType
= moduleType
;
189 public String
getName() {