package org.tianocore.migration;\r
\r
-public interface MsaOwner {\r
- public void addSourceFiles(String filename, int arch);\r
-}\r
+import org.tianocore.*;\r
+\r
+public class MsaOwner {\r
+ public static final String COPYRIGHT = "Copyright (c) 2006, Intel Corporation";\r
+ public static final String VERSION = "1.0";\r
+ public static final String ABSTRACT = "Component name for module ";\r
+ public static final String DESCRIPTION = "FIX ME!";\r
+ public static final String LICENSE = "All rights reserved.\n" +\r
+ " This software and associated documentation (if any) is furnished\n" +\r
+ " under a license and may only be used or copied in accordance\n" +\r
+ " with the terms of the license. Except as permitted by such\n" +\r
+ " license, no part of this software or documentation may be\n" +\r
+ " reproduced, stored in a retrieval system, or transmitted in any\n" +\r
+ " form or by any means without the express written consent of\n" +\r
+ " Intel Corporation.";\r
+ public static final String SPECIFICATION = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r
+ \r
+ private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();\r
+ \r
+ private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
+ private MsaHeaderDocument.MsaHeader msaheader = null;\r
+ private LicenseDocument.License license = null;\r
+ private ModuleDefinitionsDocument.ModuleDefinitions md = null;\r
+ private SourceFilesDocument.SourceFiles sourcefiles = null; //found local .h files are not written\r
+ private GuidsDocument.Guids guids = null;\r
+ private ProtocolsDocument.Protocols protocols = null;\r
+ private PPIsDocument.PPIs ppis = null;\r
+ private PackageDependenciesDocument.PackageDependencies pd = null;\r
+ private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = null;\r
+ private ExternsDocument.Externs externs = null;\r
+\r
+ //-----------------------------msaheader-------------------------------------//\r
+ public final boolean addSpecification (String specification) {\r
+ if (msaheader.getSpecification() == null) {\r
+ if (specification == null) {\r
+ msaheader.setSpecification(SPECIFICATION);\r
+ } else {\r
+ msaheader.setSpecification(specification);\r
+ }\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate Specification");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addLicense (String licensecontent) {\r
+ if (msaheader.getLicense() == null) {\r
+ license = msaheader.addNewLicense();\r
+ if (licensecontent == null) {\r
+ license.setStringValue(LICENSE);\r
+ } else {\r
+ license.setStringValue(licensecontent);\r
+ }\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate License");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addDescription (String description) {\r
+ if (msaheader.getDescription() == null) {\r
+ if (description == null) {\r
+ msaheader.setDescription(DESCRIPTION);\r
+ } else {\r
+ msaheader.setDescription(description);\r
+ }\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate Description");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addAbstract (String abs) {\r
+ if (msaheader.getAbstract() == null) {\r
+ if (abs == null) {\r
+ msaheader.setAbstract(ABSTRACT + msaheader.getModuleName());\r
+ } else {\r
+ msaheader.setVersion(abs);\r
+ }\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate Abstract");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addVersion (String version) {\r
+ if (msaheader.getVersion() == null) {\r
+ if (version == null) {\r
+ msaheader.setVersion(VERSION);\r
+ } else {\r
+ msaheader.setVersion(version);\r
+ }\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate Version");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addCopyRight (String copyright) {\r
+ if (msaheader.getCopyright() == null) {\r
+ if (copyright == null) {\r
+ msaheader.setCopyright(COPYRIGHT);\r
+ } else {\r
+ msaheader.setCopyright(copyright);\r
+ }\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate CopyRight");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addModuleType (String moduletype) {\r
+ if (msaheader.getModuleType() == null) {\r
+ msaheader.setModuleType(ModuleTypeDef.Enum.forString(moduletype));\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate ModuleType");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addGuidValue (String guidvalue) {\r
+ if (msaheader.getGuidValue() == null) {\r
+ msaheader.setGuidValue(guidvalue);\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate GuidValue");\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ public final boolean addModuleName (String modulename) {\r
+ if (msaheader.getModuleName() == null) {\r
+ msaheader.setModuleName(modulename);\r
+ return true;\r
+ } else {\r
+ MigrationTool.ui.println ("Warning: Duplicate ModuleName");\r
+ return false;\r
+ }\r
+ }\r
+ //-----------------------------msaheader-------------------------------------//\r
+ \r
+ public final void addSourceFiles (String filename, int arch) {\r
+ \r
+ }\r
+ \r
+ private final MsaOwner init () {\r
+ msa = msadoc.addNewModuleSurfaceArea();\r
+ msaheader = msa.addNewMsaHeader();\r
+ md = msa.addNewModuleDefinitions();\r
+ sourcefiles = msa.addNewSourceFiles();\r
+ pd = msa.addNewPackageDependencies();\r
+ libclassdefs = msa.addNewLibraryClassDefinitions();\r
+ externs = msa.addNewExterns();\r
+ return this;\r
+ }\r
+ \r
+ public static final MsaOwner initNewMsaOwner() {\r
+ return new MsaOwner().init();\r
+ }\r
+}
\ No newline at end of file