]>
Commit | Line | Data |
---|---|---|
6ef5feb5 | 1 | package org.tianocore.migration;\r |
2 | \r | |
5c55f71c | 3 | import org.tianocore.*;\r |
4 | \r | |
5 | public class MsaOwner {\r | |
6 | public static final String COPYRIGHT = "Copyright (c) 2006, Intel Corporation";\r | |
7 | public static final String VERSION = "1.0";\r | |
8 | public static final String ABSTRACT = "Component name for module ";\r | |
9 | public static final String DESCRIPTION = "FIX ME!";\r | |
10 | public static final String LICENSE = "All rights reserved.\n" +\r | |
11 | " This software and associated documentation (if any) is furnished\n" +\r | |
12 | " under a license and may only be used or copied in accordance\n" +\r | |
13 | " with the terms of the license. Except as permitted by such\n" +\r | |
14 | " license, no part of this software or documentation may be\n" +\r | |
15 | " reproduced, stored in a retrieval system, or transmitted in any\n" +\r | |
16 | " form or by any means without the express written consent of\n" +\r | |
17 | " Intel Corporation.";\r | |
18 | public static final String SPECIFICATION = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r | |
19 | \r | |
20 | private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();\r | |
21 | \r | |
22 | private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r | |
23 | private MsaHeaderDocument.MsaHeader msaheader = null;\r | |
24 | private LicenseDocument.License license = null;\r | |
25 | private ModuleDefinitionsDocument.ModuleDefinitions md = null;\r | |
26 | private SourceFilesDocument.SourceFiles sourcefiles = null; //found local .h files are not written\r | |
27 | private GuidsDocument.Guids guids = null;\r | |
28 | private ProtocolsDocument.Protocols protocols = null;\r | |
29 | private PPIsDocument.PPIs ppis = null;\r | |
30 | private PackageDependenciesDocument.PackageDependencies pd = null;\r | |
31 | private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = null;\r | |
32 | private ExternsDocument.Externs externs = null;\r | |
33 | \r | |
34 | //-----------------------------msaheader-------------------------------------//\r | |
35 | public final boolean addSpecification (String specification) {\r | |
36 | if (msaheader.getSpecification() == null) {\r | |
37 | if (specification == null) {\r | |
38 | msaheader.setSpecification(SPECIFICATION);\r | |
39 | } else {\r | |
40 | msaheader.setSpecification(specification);\r | |
41 | }\r | |
42 | return true;\r | |
43 | } else {\r | |
44 | MigrationTool.ui.println ("Warning: Duplicate Specification");\r | |
45 | return false;\r | |
46 | }\r | |
47 | }\r | |
48 | \r | |
49 | public final boolean addLicense (String licensecontent) {\r | |
50 | if (msaheader.getLicense() == null) {\r | |
51 | license = msaheader.addNewLicense();\r | |
52 | if (licensecontent == null) {\r | |
53 | license.setStringValue(LICENSE);\r | |
54 | } else {\r | |
55 | license.setStringValue(licensecontent);\r | |
56 | }\r | |
57 | return true;\r | |
58 | } else {\r | |
59 | MigrationTool.ui.println ("Warning: Duplicate License");\r | |
60 | return false;\r | |
61 | }\r | |
62 | }\r | |
63 | \r | |
64 | public final boolean addDescription (String description) {\r | |
65 | if (msaheader.getDescription() == null) {\r | |
66 | if (description == null) {\r | |
67 | msaheader.setDescription(DESCRIPTION);\r | |
68 | } else {\r | |
69 | msaheader.setDescription(description);\r | |
70 | }\r | |
71 | return true;\r | |
72 | } else {\r | |
73 | MigrationTool.ui.println ("Warning: Duplicate Description");\r | |
74 | return false;\r | |
75 | }\r | |
76 | }\r | |
77 | \r | |
78 | public final boolean addAbstract (String abs) {\r | |
79 | if (msaheader.getAbstract() == null) {\r | |
80 | if (abs == null) {\r | |
81 | msaheader.setAbstract(ABSTRACT + msaheader.getModuleName());\r | |
82 | } else {\r | |
83 | msaheader.setVersion(abs);\r | |
84 | }\r | |
85 | return true;\r | |
86 | } else {\r | |
87 | MigrationTool.ui.println ("Warning: Duplicate Abstract");\r | |
88 | return false;\r | |
89 | }\r | |
90 | }\r | |
91 | \r | |
92 | public final boolean addVersion (String version) {\r | |
93 | if (msaheader.getVersion() == null) {\r | |
94 | if (version == null) {\r | |
95 | msaheader.setVersion(VERSION);\r | |
96 | } else {\r | |
97 | msaheader.setVersion(version);\r | |
98 | }\r | |
99 | return true;\r | |
100 | } else {\r | |
101 | MigrationTool.ui.println ("Warning: Duplicate Version");\r | |
102 | return false;\r | |
103 | }\r | |
104 | }\r | |
105 | \r | |
106 | public final boolean addCopyRight (String copyright) {\r | |
107 | if (msaheader.getCopyright() == null) {\r | |
108 | if (copyright == null) {\r | |
109 | msaheader.setCopyright(COPYRIGHT);\r | |
110 | } else {\r | |
111 | msaheader.setCopyright(copyright);\r | |
112 | }\r | |
113 | return true;\r | |
114 | } else {\r | |
115 | MigrationTool.ui.println ("Warning: Duplicate CopyRight");\r | |
116 | return false;\r | |
117 | }\r | |
118 | }\r | |
119 | \r | |
120 | public final boolean addModuleType (String moduletype) {\r | |
121 | if (msaheader.getModuleType() == null) {\r | |
122 | msaheader.setModuleType(ModuleTypeDef.Enum.forString(moduletype));\r | |
123 | return true;\r | |
124 | } else {\r | |
125 | MigrationTool.ui.println ("Warning: Duplicate ModuleType");\r | |
126 | return false;\r | |
127 | }\r | |
128 | }\r | |
129 | \r | |
130 | public final boolean addGuidValue (String guidvalue) {\r | |
131 | if (msaheader.getGuidValue() == null) {\r | |
132 | msaheader.setGuidValue(guidvalue);\r | |
133 | return true;\r | |
134 | } else {\r | |
135 | MigrationTool.ui.println ("Warning: Duplicate GuidValue");\r | |
136 | return false;\r | |
137 | }\r | |
138 | }\r | |
139 | \r | |
140 | public final boolean addModuleName (String modulename) {\r | |
141 | if (msaheader.getModuleName() == null) {\r | |
142 | msaheader.setModuleName(modulename);\r | |
143 | return true;\r | |
144 | } else {\r | |
145 | MigrationTool.ui.println ("Warning: Duplicate ModuleName");\r | |
146 | return false;\r | |
147 | }\r | |
148 | }\r | |
149 | //-----------------------------msaheader-------------------------------------//\r | |
150 | \r | |
151 | public final void addSourceFiles (String filename, int arch) {\r | |
152 | \r | |
153 | }\r | |
154 | \r | |
155 | private final MsaOwner init () {\r | |
156 | msa = msadoc.addNewModuleSurfaceArea();\r | |
157 | msaheader = msa.addNewMsaHeader();\r | |
158 | md = msa.addNewModuleDefinitions();\r | |
159 | sourcefiles = msa.addNewSourceFiles();\r | |
160 | pd = msa.addNewPackageDependencies();\r | |
161 | libclassdefs = msa.addNewLibraryClassDefinitions();\r | |
162 | externs = msa.addNewExterns();\r | |
163 | return this;\r | |
164 | }\r | |
165 | \r | |
166 | public static final MsaOwner initNewMsaOwner() {\r | |
167 | return new MsaOwner().init();\r | |
168 | }\r | |
169 | } |