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
.Identifications
.Identification
;
27 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpenFile
;
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
, boolean library
) {
49 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
50 this.isLibrary
= library
;
53 public ModuleIdentification(String name
, String guid
, String version
, String path
, PackageIdentification packageId
){
54 super(name
, guid
, version
, path
);
55 this.packageId
= packageId
;
59 public ModuleIdentification(String name
, String guid
, String version
, String path
, PackageIdentification packageId
, String type
){
60 super(name
, guid
, version
, path
);
61 this.packageId
= packageId
;
62 this.moduleType
= type
;
65 public ModuleIdentification(Identification id
, PackageIdentification packageId
) {
66 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
67 this.packageId
= packageId
;
71 public ModuleIdentification(Identification id
, PackageIdentification packageId
, boolean library
) {
72 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
73 this.packageId
= packageId
;
74 this.isLibrary
= library
;
77 public ModuleIdentification(Identification id
, PackageIdentification packageId
, String type
) {
78 super(id
.getName(), id
.getGuid(), id
.getVersion(), id
.getPath());
79 this.packageId
= packageId
;
80 this.moduleType
= type
;
83 public String
toString(){
84 return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId
;
87 public PackageIdentification
getPackageId() {
91 public void setPackageId(PackageIdentification packageId
) {
92 this.packageId
= packageId
;
95 public String
getModuleType() {
99 public void setModuleType(String moduleType
) {
100 this.moduleType
= moduleType
;
103 private void setModuleType() {
104 ModuleSurfaceArea msa
= null;
106 msa
= OpenFile
.openMsaFile(this.getPath());
107 } catch (IOException e
) {
108 // TODO Auto-generated catch block
110 } catch (XmlException e
) {
111 // TODO Auto-generated catch block
113 } catch (Exception e
) {
114 // TODO Auto-generated catch block
117 setModuleType(DataType
.MODULE_TYPE_MODULE
);
120 LibraryClassDefinitions lib
= msa
.getLibraryClassDefinitions();
122 for (int index
= 0; index
< lib
.getLibraryClassList().size(); index
++) {
123 if (lib
.getLibraryClassList().get(index
).getUsage().equals(LibraryUsage
.ALWAYS_PRODUCED
)) {
124 setModuleType(DataType
.MODULE_TYPE_LIBRARY
);
133 public boolean isLibrary() {
137 public void setLibrary(boolean isLibrary
) {
138 this.isLibrary
= isLibrary
;