3 The file is used to save basic information of module
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
.module
.Identifications
;
19 import java
.io
.IOException
;
21 import org
.apache
.xmlbeans
.XmlException
;
22 import org
.tianocore
.LibraryUsage
;
23 import org
.tianocore
.LibraryClassDefinitionsDocument
.LibraryClassDefinitions
;
24 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
25 import org
.tianocore
.frameworkwizard
.common
.DataType
;
26 import org
.tianocore
.frameworkwizard
.common
.OpenFile
;
27 import org
.tianocore
.frameworkwizard
.common
.Identifications
.Identification
;
28 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
30 public class ModuleIdentification
extends Identification
{
32 private PackageIdentification packageId
;
34 private String moduleType
;
36 private boolean isLibrary
;
38 public ModuleIdentification(String name
, String guid
, String version
, String path
) {
39 super(name
, guid
, version
, path
);
43 public ModuleIdentification(String name
, String guid
, String version
, String path
, boolean library
) {
44 super(name
, guid
, version
, path
);
45 this.isLibrary
= library
;
48 public ModuleIdentification(Identification id
) {
49 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
52 public ModuleIdentification(Identification id
, boolean library
) {
53 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
54 this.isLibrary
= library
;
57 public ModuleIdentification(String name
, String guid
, String version
, String path
, PackageIdentification packageId
){
58 super(name
, guid
, version
, path
);
59 this.packageId
= packageId
;
63 public ModuleIdentification(String name
, String guid
, String version
, String path
, PackageIdentification packageId
, String type
){
64 super(name
, guid
, version
, path
);
65 this.packageId
= packageId
;
66 this.moduleType
= type
;
69 public ModuleIdentification(Identification id
, PackageIdentification packageId
) {
70 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
71 this.packageId
= packageId
;
75 public ModuleIdentification(Identification id
, PackageIdentification packageId
, boolean library
) {
76 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
77 this.packageId
= packageId
;
78 this.isLibrary
= library
;
81 public ModuleIdentification(Identification id
, PackageIdentification packageId
, String type
) {
82 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
83 this.packageId
= packageId
;
84 this.moduleType
= type
;
87 public String
toString(){
88 return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId
;
91 public PackageIdentification
getPackageId() {
95 public void setPackageId(PackageIdentification packageId
) {
96 this.packageId
= packageId
;
99 public String
getModuleType() {
103 public void setModuleType(String moduleType
) {
104 this.moduleType
= moduleType
;
107 private void setModuleType() {
108 ModuleSurfaceArea msa
= null;
110 msa
= OpenFile
.openMsaFile(this.getPath());
111 } catch (IOException e
) {
112 // TODO Auto-generated catch block
114 } catch (XmlException e
) {
115 // TODO Auto-generated catch block
117 } catch (Exception e
) {
118 // TODO Auto-generated catch block
121 setModuleType(DataType
.MODULE_TYPE_MODULE
);
124 LibraryClassDefinitions lib
= msa
.getLibraryClassDefinitions();
126 for (int index
= 0; index
< lib
.getLibraryClassList().size(); index
++) {
127 if (lib
.getLibraryClassList().get(index
).getUsage().equals(LibraryUsage
.ALWAYS_PRODUCED
)) {
128 setModuleType(DataType
.MODULE_TYPE_LIBRARY
);
137 public boolean isLibrary() {
141 public void setLibrary(boolean isLibrary
) {
142 this.isLibrary
= isLibrary
;