import java.io.File;\r
import java.util.HashMap;\r
import java.util.Iterator;\r
-import java.util.Map;\r
import java.util.Set;\r
import java.util.Vector;\r
\r
import javax.swing.event.TableModelListener;\r
import javax.swing.table.DefaultTableModel;\r
import javax.swing.table.TableModel;\r
-\r
-import org.apache.xmlbeans.XmlObject;\r
import org.tianocore.PackageSurfaceAreaDocument;\r
import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.Tools;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
import org.tianocore.frameworkwizard.platform.ui.ListEditor;\r
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
\r
\r
/**\r
private void getLibInstances(String libClass){\r
libNameGuidMap.clear();\r
try {\r
- WorkspaceProfile.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
- \r
- Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
- Iterator ispi = spi.iterator();\r
- \r
- while (ispi.hasNext()) {\r
- PackageIdentification pi = (PackageIdentification) ispi.next();\r
-\r
- Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);\r
- Iterator ismi = smi.iterator();\r
+ Iterator ismi = GlobalData.vModuleList.iterator();\r
while (ismi.hasNext()) {\r
ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
- Map<String, XmlObject> m = WorkspaceProfile.getNativeMsa(mi);\r
- SurfaceAreaQuery.setDoc(m);\r
+ \r
Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
for (int i = 0; i < classProduced.size(); ++i) {\r
if (classProduced.get(i).equals(libClass)) {\r
}\r
}\r
}\r
- }\r
+ \r
}\r
catch(Exception e){\r
JOptionPane.showMessageDialog(frame, "Search Instances Failed.");\r
import org.tianocore.UserExtensionsDocument;\r
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
/**\r
This class processes fpd file contents such as add remove xml elements. \r
String mn = libMi.getName();\r
String mg = libMi.getGuid();\r
String mv = libMi.getVersion();\r
- String pn = libMi.getPackage().getName();\r
- String pg = libMi.getPackage().getGuid();\r
- String pv = libMi.getPackage().getVersion();\r
+ String pn = libMi.getPackageId().getName();\r
+ String pg = libMi.getPackageId().getGuid();\r
+ String pv = libMi.getPackageId().getVersion();\r
LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();\r
XmlCursor cursor = instance.newCursor();\r
try{\r
String comment = "Pkg: " + pn + " Mod: " + mn \r
- + " Path: " + WorkspaceProfile.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+ + " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
cursor.insertComment(comment);\r
}\r
catch (Exception e){\r
\r
private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {\r
\r
- Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;\r
for (int i = 0; i < depPkgs.length; ++i) {\r
- m.put("PackageSurfaceArea", WorkspaceProfile.getPackageXmlObject(depPkgs[i]));\r
- SurfaceAreaQuery.setDoc(m);\r
- XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations();\r
+\r
+ XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]);\r
if (xo == null) {\r
continue;\r
}\r
ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();\r
XmlCursor cursor = msa.newCursor();\r
try{\r
- String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "\r
- + WorkspaceProfile.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+ String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "\r
+ + mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
cursor.insertComment(comment);\r
}\r
catch(Exception e){\r
\r
PcdItemTypeConflictException(String pcdName, String info){\r
ModuleIdentification mi = WorkspaceProfile.getModuleId(info);\r
- details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();\r
+ details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName();\r
}\r
\r
public String getMessage() {\r
\r
import javax.swing.AbstractAction;\r
import javax.swing.DefaultCellEditor;\r
+import javax.swing.JComponent;\r
import javax.swing.JFileChooser;\r
import javax.swing.JFrame;\r
import javax.swing.JOptionPane;\r
import java.awt.event.ComponentEvent;\r
import java.awt.event.ItemEvent;\r
import java.awt.event.ItemListener;\r
+import java.io.BufferedReader;\r
import java.io.File;\r
+import java.io.FileReader;\r
import java.util.Iterator;\r
import java.util.LinkedHashMap;\r
import java.util.Map;\r
import java.util.Set;\r
+import java.util.Vector;\r
\r
import javax.swing.JCheckBox;\r
import javax.swing.JTextField;\r
import javax.swing.table.TableModel;\r
import javax.swing.JComboBox;\r
import java.awt.Dimension;\r
+import javax.swing.JSplitPane;\r
\r
public class FpdFlash extends IInternalFrame {\r
\r
private JScrollPane jScrollPane = null;\r
private JTable jTableFvImageOpts = null;\r
private JButton jButtonUpdateFvImage = null;\r
+ private JButton jButtonTest = null;\r
+ private JPanel jPanelFdfN = null;\r
+ private JPanel jPanelFdfS = null;\r
+ private JSplitPane jSplitPaneFdfC = null;\r
+ private JPanel jPanelFdfCTop = null;\r
+ private JPanel jPanelFdfCBottom = null;\r
+ private JPanel jPanelFdfCTopN = null;\r
+ private JPanel jPanelFdfCTopS = null;\r
+ private JPanel jPanelFdfCTopC = null;\r
+ private JPanel jPanelFdfCBottomN = null;\r
+ private JPanel jPanelFdfCBottomC = null;\r
+ private JLabel jLabelFvInFdf = null;\r
+ private JLabel jLabelFvAdditional = null;\r
+ private JScrollPane jScrollPaneFvInFdf = null;\r
+ private JTable jTableFvInFdf = null;\r
+ private NonEditableTableModel fvInFdfTableModel = null; // @jve:decl-index=0:visual-constraint=""\r
+ private JButton jButtonFvInFdfOptions = null;\r
+ private JScrollPane jScrollPaneFvAdditional = null;\r
+ private JTable jTableFvAdditional = null;\r
+ private DefaultTableModel fvAddtionalTableModel = null; // @jve:decl-index=0:visual-constraint=""\r
+ private JButton jButtonAddFv = null;\r
+ private JButton jButtonDelFv = null;\r
+ private JButton jButtonAddFvOptions = null;\r
+ \r
+ private NonEditableTableModel nonEditableTableModel = null; // @jve:decl-index=0:visual-constraint=""\r
+ \r
+ private JPanel jPanelModOrder = null;\r
+ private JPanel jPanelModOrderN = null;\r
+ private JPanel jPanelModOrderS = null;\r
+ private JPanel jPanelModOrderC = null;\r
+ private JScrollPane jScrollPaneModInFv = null;\r
+ private JTable jTableModInFv = null;\r
+ private JPanel jPanelController = null;\r
+ private JScrollPane jScrollPaneFpdModules = null;\r
+ private JTable jTableFpdModules = null;\r
+ private JButton jButtonUp = null;\r
+ private JButton jButtonInsert = null;\r
+ private JButton jButtonRemove = null;\r
+ private JButton jButtonDown = null;\r
+ private JButton jButtonOk = null;\r
+ private JButton jButtonCancel = null;\r
+ \r
+ /**\r
+ * This method initializes jPanelModOrder \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelModOrder() {\r
+// if (jPanelModOrder == null) {\r
+ jPanelModOrder = new JPanel();\r
+ jPanelModOrder.setLayout(new BorderLayout());\r
+ jPanelModOrder.add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH);\r
+ jPanelModOrder.add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH);\r
+ jPanelModOrder.add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER);\r
+ jPanelModOrder.addComponentListener(new java.awt.event.ComponentAdapter() {\r
+ public void componentShown(java.awt.event.ComponentEvent e) {\r
+ System.out.println("componentShown()" + jTabbedPane.getTitleAt(jTabbedPane.getSelectedIndex())); // TODO Auto-generated Event stub componentShown()\r
+ }\r
+ });\r
+// }\r
+ return jPanelModOrder;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelModOrderN \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelModOrderN() {\r
+// if (jPanelModOrderN == null) {\r
+ jPanelModOrderN = new JPanel();\r
+// }\r
+ return jPanelModOrderN;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelModOrderS \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelModOrderS() {\r
+// if (jPanelModOrderS == null) {\r
+ FlowLayout flowLayout6 = new FlowLayout();\r
+ flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT);\r
+ jPanelModOrderS = new JPanel();\r
+ jPanelModOrderS.setLayout(flowLayout6);\r
+ jPanelModOrderS.add(getJButtonOk(), null);\r
+ jPanelModOrderS.add(getJButtonCancel(), null);\r
+// }\r
+ return jPanelModOrderS;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelModOrderC \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelModOrderC() {\r
+// if (jPanelModOrderC == null) {\r
+ jPanelModOrderC = new JPanel();\r
+ jPanelModOrderC.add(getJScrollPaneModInFv(), null);\r
+ jPanelModOrderC.add(getJPanelController(), null);\r
+ jPanelModOrderC.add(getJScrollPaneFpdModules(), null);\r
+// }\r
+ return jPanelModOrderC;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jScrollPaneModInFv \r
+ * \r
+ * @return javax.swing.JScrollPane \r
+ */\r
+ private JScrollPane getJScrollPaneModInFv() {\r
+// if (jScrollPaneModInFv == null) {\r
+ jScrollPaneModInFv = new JScrollPane();\r
+ jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(150,500));\r
+ jScrollPaneModInFv.setViewportView(getJTableModInFv());\r
+// }\r
+ return jScrollPaneModInFv;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jTableModInFv \r
+ * \r
+ * @return javax.swing.JTable \r
+ */\r
+ private JTable getJTableModInFv() {\r
+// if (jTableModInFv == null) {\r
+ NonEditableTableModel modInFvTableModel = new NonEditableTableModel();\r
+ modInFvTableModel.addColumn("Module Orders in FV");\r
+ jTableModInFv = new JTable(modInFvTableModel);\r
+ jTableModInFv.setRowHeight(20);\r
+// }\r
+ return jTableModInFv;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelController \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelController() {\r
+// if (jPanelController == null) {\r
+ FlowLayout flowLayout5 = new FlowLayout();\r
+ flowLayout5.setVgap(50);\r
+ flowLayout5.setHgap(50);\r
+ jPanelController = new JPanel();\r
+ jPanelController.setLayout(flowLayout5);\r
+ jPanelController.setPreferredSize(new java.awt.Dimension(150,500));\r
+ jPanelController.add(getJButtonUp(), null);\r
+ jPanelController.add(getJButtonInsert(), null);\r
+ jPanelController.add(getJButtonRemove(), null);\r
+ jPanelController.add(getJButtonDown(), null);\r
+// }\r
+ return jPanelController;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jScrollPaneFpdModules \r
+ * \r
+ * @return javax.swing.JScrollPane \r
+ */\r
+ private JScrollPane getJScrollPaneFpdModules() {\r
+// if (jScrollPaneFpdModules == null) {\r
+ jScrollPaneFpdModules = new JScrollPane();\r
+ jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(150,500));\r
+ jScrollPaneFpdModules.setViewportView(getJTableFpdModules());\r
+// }\r
+ return jScrollPaneFpdModules;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jTableFpdModules \r
+ * \r
+ * @return javax.swing.JTable \r
+ */\r
+ private JTable getJTableFpdModules() {\r
+// if (jTableFpdModules == null) {\r
+ NonEditableTableModel fpdModTableModel = new NonEditableTableModel();\r
+ fpdModTableModel.addColumn("Modules in Platform");\r
+ jTableFpdModules = new JTable(fpdModTableModel);\r
+ jTableFpdModules.setRowHeight(20);\r
+// }\r
+ return jTableFpdModules;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonUp \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonUp() {\r
+// if (jButtonUp == null) {\r
+ jButtonUp = new JButton();\r
+ jButtonUp.setPreferredSize(new java.awt.Dimension(60,20));\r
+ jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));\r
+ jButtonUp.setText("^");\r
+// }\r
+ return jButtonUp;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonInsert \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonInsert() {\r
+// if (jButtonInsert == null) {\r
+ jButtonInsert = new JButton();\r
+ jButtonInsert.setText("<<");\r
+ jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20));\r
+// }\r
+ return jButtonInsert;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonRemove \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonRemove() {\r
+// if (jButtonRemove == null) {\r
+ jButtonRemove = new JButton();\r
+ jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20));\r
+ jButtonRemove.setText(">>");\r
+// }\r
+ return jButtonRemove;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonDown \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonDown() {\r
+// if (jButtonDown == null) {\r
+ jButtonDown = new JButton();\r
+ jButtonDown.setPreferredSize(new java.awt.Dimension(60,20));\r
+ jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));\r
+ jButtonDown.setText("v");\r
+// }\r
+ return jButtonDown;\r
+ }\r
+ \r
+ /**\r
+ * This method initializes jButtonOk \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonOk() {\r
+// if (jButtonOk == null) {\r
+ jButtonOk = new JButton();\r
+ jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));\r
+ jButtonOk.setText("Ok");\r
+// }\r
+ return jButtonOk;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonCancel \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonCancel() {\r
+// if (jButtonCancel == null) {\r
+ jButtonCancel = new JButton();\r
+ jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));\r
+ jButtonCancel.setText("Cancel");\r
+ jButtonCancel.addActionListener(new java.awt.event.ActionListener() {\r
+ public void actionPerformed(java.awt.event.ActionEvent e) {\r
+ getJTabbedPane().setSelectedIndex(0);\r
+ }\r
+ });\r
+// }\r
+ return jButtonCancel;\r
+ }\r
+\r
+ \r
public FpdFlash() {\r
super();\r
// TODO Auto-generated constructor stub\r
private JTabbedPane getJTabbedPane() {\r
if (jTabbedPane == null) {\r
jTabbedPane = new JTabbedPane();\r
- jTabbedPane.addTab("FV Images", null, getJPanelFvImages(), null);\r
- jTabbedPane.addTab("Flash Definition File", null, getJPanelFdf(), null);\r
+ jTabbedPane.addTab("General", null, getJPanelFdf(), null);\r
+ jTabbedPane.addTab("FV Parameters", null, getJPanelFvImages(), null);\r
\r
}\r
return jTabbedPane;\r
jLabelFvPropName.setEnabled(false);\r
jLabelFvPropName.setPreferredSize(new java.awt.Dimension(38,20));\r
FlowLayout flowLayout2 = new FlowLayout();\r
- flowLayout2.setAlignment(java.awt.FlowLayout.CENTER);\r
+ flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);\r
flowLayout2.setHgap(15);\r
jPanelFvImageN = new JPanel();\r
jPanelFvImageN.setPreferredSize(new java.awt.Dimension(576,100));\r
private JCheckBox getJCheckBoxFvProperty() {\r
if (jCheckBoxFvProperty == null) {\r
jCheckBoxFvProperty = new JCheckBox();\r
- jCheckBoxFvProperty.setText("FV Properties");\r
+ jCheckBoxFvProperty.setText("Global FV Variables");\r
jCheckBoxFvProperty.addItemListener(new ItemListener(){\r
\r
public void itemStateChanged(ItemEvent arg0) {\r
*/\r
private JPanel getJPanelFdf() {\r
if (jPanelFdf == null) {\r
- FlowLayout flowLayout1 = new FlowLayout();\r
- flowLayout1.setAlignment(FlowLayout.LEFT);\r
jPanelFdf = new JPanel();\r
- jPanelFdf.setLayout(flowLayout1);\r
- jPanelFdf.add(getJCheckBoxFdf(), null);\r
- jPanelFdf.add(getJTextFieldFdf(), null);\r
- jPanelFdf.add(getJButtonFdfBrowse(), null);\r
- jPanelFdf.addComponentListener(new ComponentAdapter(){\r
- public void componentShown(ComponentEvent e) {\r
- if (ffc.getFlashDefinitionFile() != null) {\r
- jTextFieldFdf.setText(ffc.getFlashDefinitionFile());\r
- }\r
- }\r
- public void componentHidden(ComponentEvent e) {\r
- if (jCheckBoxFdf.isSelected()) {\r
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());\r
- }\r
- }\r
- });\r
+ jPanelFdf.setLayout(new BorderLayout());\r
+\r
+ jPanelFdf.add(getJPanelFdfN(), java.awt.BorderLayout.NORTH);\r
+ jPanelFdf.add(getJPanelFdfS(), java.awt.BorderLayout.SOUTH);\r
+ jPanelFdf.add(getJSplitPaneFdfC(), java.awt.BorderLayout.CENTER);\r
+// jPanelFdf.addComponentListener(new ComponentAdapter(){\r
+// public void componentShown(ComponentEvent e) {\r
+// if (ffc.getFlashDefinitionFile() != null) {\r
+// jTextFieldFdf.setText(ffc.getFlashDefinitionFile());\r
+// }\r
+// }\r
+// public void componentHidden(ComponentEvent e) {\r
+// if (jCheckBoxFdf.isSelected()) {\r
+// ffc.genFlashDefinitionFile(jTextFieldFdf.getText());\r
+// }\r
+// }\r
+// });\r
}\r
return jPanelFdf;\r
}\r
return;\r
}\r
jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));\r
+ ffc.genFlashDefinitionFile(jTextFieldFdf.getText());\r
+ docConsole.setSaved(false);\r
+ Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();\r
+ getFvInfoFromFdf(filePath, vFvInfo);\r
+ getFvInFdfTableModel().setRowCount(0);\r
+ for (int j = 0; j < vFvInfo.size(); ++j) {\r
+ FvInfoFromFdf fvInfo = vFvInfo.get(j);\r
+ String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};\r
+ getFvInFdfTableModel().addRow(row);\r
+ }\r
}\r
}\r
\r
return jButtonUpdateFvImage;\r
}\r
\r
+ /**\r
+ * This method initializes jButtonTest \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+// private JButton getJButtonTest() {\r
+// if (jButtonTest == null) {\r
+// jButtonTest = new JButton();\r
+// jButtonTest.addActionListener(new java.awt.event.ActionListener() {\r
+// public void actionPerformed(java.awt.event.ActionEvent e) {\r
+// docConsole.setSaved(false);\r
+// String[][] includeModules = {{"1", "a"}, {"2", "b"}};\r
+// ffc.genBuildOptionsUserExtensions("FV_RECOVERY", "FvRecovery.inf", null, includeModules);\r
+// int i = ffc.getUserExtsIncModCount("FV_RECOVERY");\r
+// String[][] saa = new String[i][2];\r
+// ffc.getUserExtsIncMods("FV_RECOVERY", saa);\r
+// jTextFieldFdf.setText(saa[0][0] + saa[0][1] + saa[1][0] + saa[1][1]);\r
+// \r
+// }\r
+// });\r
+// }\r
+// return jButtonTest;\r
+// }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfN \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfN() {\r
+ if (jPanelFdfN == null) {\r
+ jPanelFdfN = new JPanel();\r
+ jPanelFdfN.add(getJCheckBoxFdf(), null);\r
+ jPanelFdfN.add(getJTextFieldFdf(), null);\r
+ jPanelFdfN.add(getJButtonFdfBrowse(), null);\r
+ }\r
+ return jPanelFdfN;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfS \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfS() {\r
+ if (jPanelFdfS == null) {\r
+ FlowLayout flowLayout4 = new FlowLayout();\r
+ flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);\r
+ jPanelFdfS = new JPanel();\r
+ jPanelFdfS.setLayout(flowLayout4);\r
+ jPanelFdfS.add(getJButtonAddFv(), null);\r
+ jPanelFdfS.add(getJButtonDelFv(), null);\r
+ jPanelFdfS.add(getJButtonAddFvOptions(), null);\r
+ }\r
+ return jPanelFdfS;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jSplitPaneFdfC \r
+ * \r
+ * @return javax.swing.JSplitPane \r
+ */\r
+ private JSplitPane getJSplitPaneFdfC() {\r
+ if (jSplitPaneFdfC == null) {\r
+ jSplitPaneFdfC = new JSplitPane();\r
+ jSplitPaneFdfC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);\r
+ jSplitPaneFdfC.setDividerSize(5);\r
+ jSplitPaneFdfC.setTopComponent(getJPanelFdfCTop());\r
+ jSplitPaneFdfC.setBottomComponent(getJPanelFdfCBottom());\r
+ jSplitPaneFdfC.setDividerLocation(280);\r
+ }\r
+ return jSplitPaneFdfC;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCTop \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCTop() {\r
+ if (jPanelFdfCTop == null) {\r
+ jPanelFdfCTop = new JPanel();\r
+ jPanelFdfCTop.setLayout(new BorderLayout());\r
+ jPanelFdfCTop.add(getJPanelFdfCTopN(), java.awt.BorderLayout.NORTH);\r
+ jPanelFdfCTop.add(getJPanelFdfCTopS(), java.awt.BorderLayout.SOUTH);\r
+ jPanelFdfCTop.add(getJPanelFdfCTopC(), java.awt.BorderLayout.CENTER);\r
+ }\r
+ return jPanelFdfCTop;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCBottom \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCBottom() {\r
+ if (jPanelFdfCBottom == null) {\r
+ jPanelFdfCBottom = new JPanel();\r
+ jPanelFdfCBottom.setLayout(new BorderLayout());\r
+ jPanelFdfCBottom.add(getJPanelFdfCBottomN(), java.awt.BorderLayout.NORTH);\r
+ jPanelFdfCBottom.add(getJPanelFdfCBottomC(), java.awt.BorderLayout.CENTER);\r
+ }\r
+ return jPanelFdfCBottom;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCTopN \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCTopN() {\r
+ if (jPanelFdfCTopN == null) {\r
+ jLabelFvInFdf = new JLabel();\r
+ jLabelFvInFdf.setText("FVs in Flash Definition File");\r
+ jPanelFdfCTopN = new JPanel();\r
+ jPanelFdfCTopN.add(jLabelFvInFdf, null);\r
+ }\r
+ return jPanelFdfCTopN;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCTopS \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCTopS() {\r
+ if (jPanelFdfCTopS == null) {\r
+ FlowLayout flowLayout1 = new FlowLayout();\r
+ flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);\r
+ jPanelFdfCTopS = new JPanel();\r
+ jPanelFdfCTopS.setLayout(flowLayout1);\r
+ jPanelFdfCTopS.add(getJButtonFvInFdfOptions(), null);\r
+ }\r
+ return jPanelFdfCTopS;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCTopC \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCTopC() {\r
+ if (jPanelFdfCTopC == null) {\r
+ jPanelFdfCTopC = new JPanel();\r
+ jPanelFdfCTopC.add(getJScrollPaneFvInFdf(), null);\r
+ }\r
+ return jPanelFdfCTopC;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCBottomN \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCBottomN() {\r
+ if (jPanelFdfCBottomN == null) {\r
+ jLabelFvAdditional = new JLabel();\r
+ jLabelFvAdditional.setText("Additional FVs");\r
+ jPanelFdfCBottomN = new JPanel();\r
+ jPanelFdfCBottomN.add(jLabelFvAdditional, null);\r
+ }\r
+ return jPanelFdfCBottomN;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jPanelFdfCBottomC \r
+ * \r
+ * @return javax.swing.JPanel \r
+ */\r
+ private JPanel getJPanelFdfCBottomC() {\r
+ if (jPanelFdfCBottomC == null) {\r
+ jPanelFdfCBottomC = new JPanel();\r
+ jPanelFdfCBottomC.add(getJScrollPaneFvAdditional(), null);\r
+ }\r
+ return jPanelFdfCBottomC;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jScrollPaneFvInFdf \r
+ * \r
+ * @return javax.swing.JScrollPane \r
+ */\r
+ private JScrollPane getJScrollPaneFvInFdf() {\r
+ if (jScrollPaneFvInFdf == null) {\r
+ jScrollPaneFvInFdf = new JScrollPane();\r
+ jScrollPaneFvInFdf.setPreferredSize(new java.awt.Dimension(653,200));\r
+ jScrollPaneFvInFdf.setViewportView(getJTableFvInFdf());\r
+ }\r
+ return jScrollPaneFvInFdf;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jTableFvInFdf \r
+ * \r
+ * @return javax.swing.JTable \r
+ */\r
+ private JTable getJTableFvInFdf() {\r
+ if (jTableFvInFdf == null) {\r
+ jTableFvInFdf = new JTable();\r
+ jTableFvInFdf.setRowHeight(20);\r
+ jTableFvInFdf.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);\r
+ jTableFvInFdf.setModel(getFvInFdfTableModel());\r
+ }\r
+ return jTableFvInFdf;\r
+ }\r
+\r
+ /**\r
+ * This method initializes fvInFdfTableModel \r
+ * \r
+ * @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel \r
+ */\r
+ private NonEditableTableModel getFvInFdfTableModel() {\r
+ if (fvInFdfTableModel == null) {\r
+ fvInFdfTableModel = new NonEditableTableModel();\r
+ fvInFdfTableModel.addColumn("FV Name");\r
+ fvInFdfTableModel.addColumn("Size");\r
+ fvInFdfTableModel.addColumn("Corresponding File Name");\r
+ }\r
+ return fvInFdfTableModel;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonFvInFdfOptions \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonFvInFdfOptions() {\r
+ if (jButtonFvInFdfOptions == null) {\r
+ jButtonFvInFdfOptions = new JButton();\r
+ jButtonFvInFdfOptions.setPreferredSize(new java.awt.Dimension(80,20));\r
+ jButtonFvInFdfOptions.setText("Options");\r
+ jButtonFvInFdfOptions.addActionListener(new java.awt.event.ActionListener() {\r
+ public void actionPerformed(java.awt.event.ActionEvent e) {\r
+ int selectedRow = jTableFvInFdf.getSelectedRow();\r
+ if (selectedRow <= 0) {\r
+ return;\r
+ }\r
+ fvInFdfTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1);\r
+ jTableFvInFdf.changeSelection(selectedRow - 1, 0, false, false);\r
+ }\r
+ });\r
+ }\r
+ return jButtonFvInFdfOptions;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jScrollPaneFvAdditional \r
+ * \r
+ * @return javax.swing.JScrollPane \r
+ */\r
+ private JScrollPane getJScrollPaneFvAdditional() {\r
+ if (jScrollPaneFvAdditional == null) {\r
+ jScrollPaneFvAdditional = new JScrollPane();\r
+ jScrollPaneFvAdditional.setPreferredSize(new java.awt.Dimension(653,200));\r
+ jScrollPaneFvAdditional.setViewportView(getJTableFvAdditional());\r
+ }\r
+ return jScrollPaneFvAdditional;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jTableFvAdditional \r
+ * \r
+ * @return javax.swing.JTable \r
+ */\r
+ private JTable getJTableFvAdditional() {\r
+ if (jTableFvAdditional == null) {\r
+ jTableFvAdditional = new JTable();\r
+ jTableFvAdditional.setRowHeight(20);\r
+ jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);\r
+ jTableFvAdditional.setModel(getFvAddtionalTableModel());\r
+ }\r
+ return jTableFvAdditional;\r
+ }\r
+\r
+ /**\r
+ * This method initializes fvAddtionalTableModel \r
+ * \r
+ * @return javax.swing.table.DefaultTableModel \r
+ */\r
+ private DefaultTableModel getFvAddtionalTableModel() {\r
+ if (fvAddtionalTableModel == null) {\r
+ fvAddtionalTableModel = new DefaultTableModel();\r
+ fvAddtionalTableModel.addColumn("FV Name");\r
+ fvAddtionalTableModel.addColumn("Size");\r
+ fvAddtionalTableModel.addColumn("Corresponding File Name");\r
+ }\r
+ return fvAddtionalTableModel;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonAddFv \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonAddFv() {\r
+ if (jButtonAddFv == null) {\r
+ jButtonAddFv = new JButton();\r
+ jButtonAddFv.setPreferredSize(new java.awt.Dimension(80,20));\r
+ jButtonAddFv.setText("New");\r
+ }\r
+ return jButtonAddFv;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonDelFv \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonDelFv() {\r
+ if (jButtonDelFv == null) {\r
+ jButtonDelFv = new JButton();\r
+ jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));\r
+ jButtonDelFv.setText("Delete");\r
+ }\r
+ return jButtonDelFv;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jButtonAddFvOptions \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonAddFvOptions() {\r
+ if (jButtonAddFvOptions == null) {\r
+ jButtonAddFvOptions = new JButton();\r
+ jButtonAddFvOptions.setPreferredSize(new java.awt.Dimension(80,20));\r
+ jButtonAddFvOptions.setText("Options");\r
+ }\r
+ return jButtonAddFvOptions;\r
+ }\r
+\r
+ \r
+\r
+ /**\r
+ * This method initializes nonEditableTableModel \r
+ * \r
+ * @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel \r
+ */\r
+ private NonEditableTableModel getNonEditableTableModel() {\r
+ if (nonEditableTableModel == null) {\r
+ nonEditableTableModel = new NonEditableTableModel();\r
+ }\r
+ return nonEditableTableModel;\r
+ }\r
+\r
+ \r
/**\r
* @param args\r
*/\r
return;\r
}\r
String[][] saa = new String[ffc.getFvImagesFvImageCount()][2];\r
-// ArrayList<LinkedHashMap<String, String>> options = new ArrayList<LinkedHashMap<String, String>>(ffc.getFvImagesFvImageCount());\r
-//\r
-// for (int j = 0; j < ffc.getFvImagesFvImageCount(); ++j){\r
-// options.add(new LinkedHashMap<String, String>());\r
-// }\r
ffc.getFvImagesFvImages(saa);\r
- \r
\r
int i = 0;\r
while (i < saa.length) {\r
++i;\r
}\r
\r
-// String fdfFile = ffc.getFlashDefinitionFile();\r
-// if (fdfFile != null) {\r
-// jTextField3.setText(fdfFile);\r
-// }\r
+ saa = new String[ffc.getFvImagesNameValueCount()][2];\r
+ ffc.getFvImagesNameValues(saa);\r
+ for (int m = 0; m < saa.length; ++m) {\r
+ fvPropertyTableModel.addRow(saa[m]);\r
+ }\r
+ \r
+ jTextFieldFdf.setText("");\r
+ String fdfFile = ffc.getFlashDefinitionFile();\r
+ if (fdfFile != null) {\r
+ jTextFieldFdf.setText(fdfFile);\r
+ }\r
+ \r
+ String fdfPath = System.getenv("WORKSPACE") + File.separator + fdfFile;\r
+ Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();\r
+ getFvInfoFromFdf(fdfPath, vFvInfo);\r
+ getFvInFdfTableModel().setRowCount(0);\r
+ for (int j = 0; j < vFvInfo.size(); ++j) {\r
+ FvInfoFromFdf fvInfo = vFvInfo.get(j);\r
+ String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};\r
+ getFvInFdfTableModel().addRow(row);\r
+ }\r
+ \r
+\r
+ for (int k = 0; k < vFvInfo.size(); ++k) {\r
+ FvInfoFromFdf fvInfo = vFvInfo.get(k);\r
+ getJTabbedPane().addTab(fvInfo.getFvName(), null, getJPanelModOrder(), null);\r
+\r
+ }\r
}\r
\r
private void getOptionNameValue(Map<String, String> m){\r
}\r
return jContentPane;\r
}\r
+ \r
+ private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {\r
+ File fdf = new File(fdfPath);\r
+ if (!fdf.exists()) {\r
+ return;\r
+ }\r
+ int lines = 0;\r
+\r
+ try {\r
+ FileReader reader = new FileReader(fdf);\r
+ BufferedReader in = new BufferedReader(reader);\r
+ String str;\r
+\r
+ while ((str = in.readLine()) != null) {\r
+ ++lines;\r
+ str = str.trim();\r
+ //\r
+ // skip empty line, comment (start with //) \r
+ //\r
+ if (str.length() == 0 || str.startsWith("//")) {\r
+ continue;\r
+ }\r
+ //\r
+ // dig into Region {} section, create FvInfoFromFdf object for it.\r
+ //\r
+ if (str.startsWith("Region") && str.endsWith("{")) {\r
+ FvInfoFromFdf fvInfo = new FvInfoFromFdf();\r
+ boolean nameFound = false;\r
+ boolean sizeFound = false;\r
+ while ((str = in.readLine()) != null) {\r
+ ++lines;\r
+ str = str.trim();\r
+ //\r
+ // skip empty line, comment (start with //) \r
+ //\r
+ if (str.length() == 0 || str.startsWith("//")) {\r
+ continue;\r
+ }\r
+ \r
+ if (str.startsWith("Name")) {\r
+ int firstQuote = str.indexOf("\"");\r
+ int lastQuote = str.lastIndexOf("\"");\r
+ fvInfo.setFvName(str.substring(firstQuote + 1, lastQuote));\r
+ nameFound = true;\r
+ }\r
+ \r
+ if (str.startsWith("Size")) {\r
+ int equalIndex = str.indexOf("=");\r
+ int commaIndex = str.indexOf(",");\r
+ fvInfo.setSize(str.substring(equalIndex + 1, commaIndex).trim());\r
+ sizeFound = true;\r
+ }\r
+ \r
+ if (nameFound && sizeFound) {\r
+ break;\r
+ }\r
+ }\r
+ \r
+ vFvInfo.add(fvInfo);\r
+ }\r
+ //\r
+ // dig into File {} section, supply file name information to existing FvInfoFromFdf object.\r
+ //\r
+ if (str.startsWith("File")) {\r
+ boolean fileNameFound = false;\r
+ boolean fvFound = false;\r
+ String fileName = "";\r
+ String fvName = "";\r
+ while ((str = in.readLine()) != null) {\r
+ ++lines;\r
+ str = str.trim();\r
+ //\r
+ // skip empty line, comment (start with //) \r
+ //\r
+ if (str.length() == 0 || str.startsWith("//")) {\r
+ continue;\r
+ }\r
+ \r
+ if (str.startsWith("Name")) {\r
+ int firstQuote = str.indexOf("\"");\r
+ int lastQuote = str.lastIndexOf("\"");\r
+ fileName = str.substring(firstQuote + 1, lastQuote);\r
+ fileNameFound = true;\r
+ }\r
+ \r
+ if (str.startsWith("Region")) {\r
+ int firstQuote = str.indexOf("\"");\r
+ int lastQuote = str.lastIndexOf("\"");\r
+ fvName = str.substring(firstQuote + 1, lastQuote);\r
+ fvFound = true;\r
+ }\r
+ \r
+ if (fileNameFound && fvFound) {\r
+ break;\r
+ }\r
+ }\r
+ \r
+ for (int i = 0; i <vFvInfo.size(); ++i) {\r
+ if (vFvInfo.get(i).getFvName().equals(fvName)) {\r
+ vFvInfo.get(i).setEfiFileName(fileName);\r
+ }\r
+ }\r
+ }\r
+ \r
+ }\r
+ } catch (Exception e) {\r
+ \r
+ }\r
+\r
+ }\r
+ \r
+ \r
\r
} // @jve:decl-index=0:visual-constraint="10,10"\r
\r
}\r
}\r
\r
+class FvInfoFromFdf {\r
+ private String fvName;\r
+ private String size;\r
+ private String efiFileName;\r
+ \r
+ public FvInfoFromFdf () {\r
+ fvName = "";\r
+ size = "";\r
+ efiFileName = "";\r
+ }\r
+ public FvInfoFromFdf (String f, String s, String e) {\r
+ this();\r
+ fvName = f;\r
+ size = s;\r
+ efiFileName = e;\r
+ }\r
+ public String getEfiFileName() {\r
+ return efiFileName;\r
+ }\r
+ public void setEfiFileName(String efiFileName) {\r
+ this.efiFileName = efiFileName;\r
+ }\r
+ public String getFvName() {\r
+ return fvName;\r
+ }\r
+ public void setFvName(String fvName) {\r
+ this.fvName = fvName;\r
+ }\r
+ public String getSize() {\r
+ return size;\r
+ }\r
+ public void setSize(String size) {\r
+ this.size = size;\r
+ }\r
+ \r
+}\r
import javax.swing.table.TableModel;\r
\r
import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
+import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
\r
import java.awt.FlowLayout;\r
-import java.io.File;\r
import java.util.ArrayList;\r
import java.util.HashMap;\r
import java.util.Iterator;\r
import java.util.Map;\r
-import java.util.Set;\r
import java.util.Vector;\r
\r
public class FpdFrameworkModules extends IInternalFrame {\r
String archsAdded = "";\r
String mg = mi.getGuid();\r
String mv = mi.getVersion();\r
- String pg = mi.getPackage().getGuid();\r
- String pv = mi.getPackage().getVersion();\r
- String mType = mi.getModuleType();\r
+ String pg = mi.getPackageId().getGuid();\r
+ String pv = mi.getPackageId().getVersion();\r
+ String mType = SurfaceAreaQuery.getModuleType(mi);\r
\r
ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);\r
if (al == null) {\r
\r
if (mi != null) {\r
row[modNameColForFpdModTable] = mi.getName();\r
- row[pkgNameColForFpdModTable] = mi.getPackage().getName();\r
+ row[pkgNameColForFpdModTable] = mi.getPackageId().getName();\r
row[pathColForFpdModTable] = path;\r
row[archColForFpdModTable] = arch;\r
row[pkgVerColForFpdModTable] = pv;\r
String arch = sa[ffcModArch];\r
ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);\r
mv = mi.getVersion();\r
- pv = mi.getPackage().getVersion();\r
+ pv = mi.getPackageId().getVersion();\r
modelFpdModules.removeRow(selectedRow);\r
if (arch == null) {\r
// if no arch specified in ModuleSA\r
}\r
\r
private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
- try {\r
- WorkspaceProfile.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
- }\r
- catch(Exception e){\r
- JOptionPane.showMessageDialog(frame, "Error occurred when getting module data.");\r
- }\r
\r
if (ffc == null) {\r
ffc = new FpdFileContents(fpd);\r
if (mi != null) {\r
row[modNameColForFpdModTable] = mi.getName();\r
row[modVerColForFpdModTable] = mi.getVersion();\r
- row[typeColForFpdModTable] = mi.getModuleType();\r
- row[pkgNameColForFpdModTable] = mi.getPackage().getName();\r
- row[pkgVerColForFpdModTable] = mi.getPackage().getVersion();\r
+ row[typeColForFpdModTable] = SurfaceAreaQuery.getModuleType(mi);\r
+ row[pkgNameColForFpdModTable] = mi.getPackageId().getName();\r
+ row[pkgVerColForFpdModTable] = mi.getPackageId().getVersion();\r
row[archColForFpdModTable] = saa[i][ffcModArch];\r
try {\r
- row[pathColForFpdModTable] = WorkspaceProfile.getMsaFile(mi).getPath().substring(\r
- System.getenv("WORKSPACE")\r
- .length() + 1);\r
+ row[pathColForFpdModTable] = mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
} catch (Exception e) {\r
JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());\r
}\r
if (miList == null) {\r
miList = new ArrayList<ModuleIdentification>();\r
}\r
- Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
- Iterator ispi = spi.iterator();\r
\r
- while (ispi.hasNext()) {\r
- PackageIdentification pi = (PackageIdentification) ispi.next();\r
String[] s = { "", "", "", "", "", "" };\r
-\r
- Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);\r
- Iterator ismi = smi.iterator();\r
+ \r
+ Iterator ismi = GlobalData.vModuleList.iterator();\r
while (ismi.hasNext()) {\r
ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
s[modNameColForAllModTable] = mi.getName();\r
s[modVerColForAllModTable] = mi.getVersion();\r
- s[typeColForAllModTable] = mi.getModuleType();\r
- s[pkgNameColForAllModTable] = pi.getName();\r
- s[pkgVerColForAllModTable] = pi.getVersion();\r
+ s[typeColForAllModTable] = SurfaceAreaQuery.getModuleType(mi);\r
+ s[pkgNameColForAllModTable] = mi.getPackageId().getName();\r
+ s[pkgVerColForAllModTable] = mi.getPackageId().getVersion();\r
try {\r
- s[pathColForAllModTable] = WorkspaceProfile.getMsaFile(mi).getPath()\r
- .substring(System.getenv("WORKSPACE").length() + 1);\r
+ s[pathColForAllModTable] = mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
} catch (Exception e) {\r
JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());\r
}\r
modelAllModules.addRow(s);\r
miList.add(mi);\r
}\r
- }\r
+ \r
\r
TableSorter sorter = (TableSorter)jTableAllModules.getModel();\r
sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);\r
private void init() {\r
//this.setSize(500, 515);\r
this.setContentPane(getJContentPane());\r
- this.setTitle("Package Surface Area Header");\r
+ this.setTitle("Platform Surface Area Header");\r
initFrame();\r
\r
}\r
import javax.swing.table.TableModel;\r
\r
import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
import java.awt.FlowLayout;\r
import java.awt.event.ActionEvent;\r
import java.util.HashMap;\r
import java.util.Iterator;\r
import java.util.ListIterator;\r
-import java.util.Set;\r
import java.util.Vector;\r
\r
import javax.swing.JTextField;\r
if (mi != null) {\r
saa[i][0] = mi.getName();\r
saa[i][2] = mi.getVersion();\r
- saa[i][4] = mi.getPackage().getVersion();\r
+ saa[i][4] = mi.getPackageId().getVersion();\r
//\r
// re-evaluate lib instance usage when adding a already-selected lib instance.\r
//\r
ArrayList<String> al = new ArrayList<String>();\r
\r
for (int i = 0; i < depPkgList.length; ++i) {\r
- Set<ModuleIdentification> smi = WorkspaceProfile.getModules(depPkgList[i]);\r
- Iterator ismi = smi.iterator();\r
+ Iterator ismi = GlobalData.vModuleList.iterator();\r
while(ismi.hasNext()) {\r
ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
- \r
+ if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {\r
+ continue;\r
+ }\r
String[] clsProduced = getClassProduced(mi);\r
\r
boolean isPotential = false;\r
+++ /dev/null
-/** @file\r
- Spd class.\r
-\r
- This class is to generate a global table for the content of spd file.\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-package org.tianocore.frameworkwizard.platform.ui.global;\r
-\r
-import java.io.File;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
-\r
-/**\r
- \r
- This class is to generate a global table for the content of spd file.\r
- \r
- **/\r
-public class Spd {\r
- ///\r
- ///\r
- ///\r
- Map<ModuleIdentification, File> msaInfo = new HashMap<ModuleIdentification, File>();\r
- \r
- //\r
- // Xml Doc of Spd file, Msa file\r
- //\r
- public Map<String, XmlObject> spdDocMap = new HashMap<String, XmlObject>();\r
- public Map<ModuleIdentification, XmlObject> msaDocMap = new HashMap<ModuleIdentification, XmlObject>();\r
- ///\r
- /// Package path.\r
- ///\r
- PackageIdentification packageId;\r
-\r
- /**\r
- Constructor function\r
- \r
- This function mainly initialize some member variables. \r
- **/\r
- Spd(File packageFile) throws Exception {\r
- try {\r
- XmlObject spdDoc = XmlObject.Factory.parse(packageFile);\r
- //\r
- // Verify SPD file, if is invalid, throw Exception\r
- //\r
-// if (! spdDoc.validate()) {\r
-// throw new Exception("Package Surface Area file [" + packageFile.getPath() + "] is invalid. ");\r
-// }\r
- // We can change Map to XmlObject\r
- \r
- spdDocMap.put("PackageSurfaceArea", spdDoc);\r
- SurfaceAreaQuery.setDoc(spdDocMap);\r
- //\r
- //\r
- //\r
- packageId = SurfaceAreaQuery.getSpdHeader();\r
- packageId.setSpdFile(packageFile);\r
- \r
- //\r
- // initialize Msa Files\r
- // MSA file is absolute file path\r
- //\r
- String[] msaFilenames = SurfaceAreaQuery.getSpdMsaFile();\r
- for (int i = 0; i < msaFilenames.length; i++){\r
- File msaFile = new File(packageId.getPackageDir() + File.separatorChar + msaFilenames[i]);\r
- if (!msaFile.exists()) {\r
- continue;\r
- }\r
- Map<String, XmlObject> msaDoc = WorkspaceProfile.getNativeMsa( msaFile );\r
- SurfaceAreaQuery.push(msaDoc);\r
- ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader();\r
- SurfaceAreaQuery.pop();\r
- moduleId.setPackage(packageId);\r
- msaInfo.put(moduleId, msaFile);\r
- msaDocMap.put(moduleId, msaDoc.get("ModuleSurfaceArea"));\r
- }\r
- \r
- }\r
- catch (Exception e) {\r
- \r
- throw new Exception("Parse package description file [" + packageId.getSpdFile() + "] Error.\n"\r
- + e.getMessage());\r
- }\r
- }\r
-\r
- public PackageIdentification getPackageId() {\r
- return packageId;\r
- }\r
-\r
- public File getModuleFile(ModuleIdentification moduleId) {\r
- return msaInfo.get(moduleId);\r
- }\r
- \r
- public Set<ModuleIdentification> getModules(){\r
- return msaInfo.keySet();\r
- }\r
- \r
-}\r
package org.tianocore.frameworkwizard.platform.ui.global;\r
\r
import java.util.ArrayList;\r
-import java.util.HashMap;\r
import java.util.Iterator;\r
-import java.util.LinkedHashMap;\r
import java.util.List;\r
import java.util.Map;\r
-import java.util.Set;\r
import java.util.Stack;\r
import java.util.Vector;\r
import java.util.regex.Matcher;\r
import java.util.regex.Pattern;\r
\r
-import org.apache.xmlbeans.XmlNormalizedString;\r
import org.apache.xmlbeans.XmlObject;\r
-import org.apache.xmlbeans.XmlString;\r
import org.tianocore.BuildTargetList;\r
-import org.tianocore.DataIdDocument;\r
-import org.tianocore.ExternsDocument;\r
-import org.tianocore.FileNameConvention;\r
-//import org.tianocore.FvImageDocument;\r
-import org.tianocore.GuidDeclarationsDocument;\r
-import org.tianocore.LibrariesDocument;\r
-import org.tianocore.LibraryClassDeclarationsDocument;\r
import org.tianocore.LibraryClassDocument;\r
-import org.tianocore.ModuleSADocument;\r
import org.tianocore.ModuleSurfaceAreaDocument;\r
-import org.tianocore.ModuleTypeDef;\r
-import org.tianocore.MsaFilesDocument;\r
-import org.tianocore.MsaHeaderDocument;\r
import org.tianocore.PackageDependenciesDocument;\r
-import org.tianocore.PackageHeadersDocument;\r
-import org.tianocore.PpiDeclarationsDocument;\r
-import org.tianocore.ProtocolDeclarationsDocument;\r
-import org.tianocore.SpdHeaderDocument;\r
+import org.tianocore.PackageSurfaceAreaDocument;\r
import org.tianocore.FilenameDocument.Filename;\r
-import org.tianocore.MsaHeaderDocument.MsaHeader;\r
-import org.tianocore.PlatformHeaderDocument;\r
-import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PlatformIdentification;\r
+\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
/**\r
* SurfaceAreaQuery class is used to query Surface Area information from msa,\r
* @returns The module type name if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String getModuleType() {\r
- String[] xPath = new String[] { "/ModuleType" };\r
-\r
- XmlObject[] returns = get(xPath);\r
- if (returns != null && returns.length > 0) {\r
- ModuleTypeDef type = (ModuleTypeDef) returns[0];\r
- return type.enumValue().toString();\r
- }\r
+ public static String getModuleType(ModuleIdentification mi) {\r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = WorkspaceProfile.getModuleXmlObject(mi);\r
\r
- return null;\r
+ return msa.getMsaHeader().getModuleType()+"";\r
}\r
\r
/**\r
packageGuid = item.getPackageGuid();\r
packageVersion = item.getPackageVersion();\r
\r
- Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
- Iterator<PackageIdentification> ispi = spi.iterator();\r
+ Iterator<PackageIdentification> ispi = GlobalData.vPackageList.iterator();\r
String ver = "";\r
while(ispi.hasNext()) {\r
PackageIdentification pi = ispi.next();\r
return libraryClassName;\r
}\r
\r
- /**\r
- * Retrieve ModuleEntryPoint names\r
- * \r
- * @returns ModuleEntryPoint name list if elements are found at the known\r
- * xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getModuleEntryPointArray() {\r
- String[] xPath = new String[] { "/Extern/ModuleEntryPoint" };\r
-\r
- XmlObject[] returns = get("Externs", xPath);\r
-\r
- if (returns != null && returns.length > 0) {\r
- String[] entryPoints = new String[returns.length];\r
-\r
- for (int i = 0; i < returns.length; ++i) {\r
- entryPoints[i] = ((XmlNormalizedString) returns[i])\r
- .getStringValue();\r
- }\r
-\r
- return entryPoints;\r
- }\r
-\r
- return null;\r
- }\r
-\r
- \r
- \r
-\r
- /**\r
- * Retrieve ModuleUnloadImage names\r
- * \r
- * @returns ModuleUnloadImage name list if elements are found at the known\r
- * xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getModuleUnloadImageArray() {\r
- String[] xPath = new String[] { "/Extern/ModuleUnloadImage" };\r
-\r
- XmlObject[] returns = get("Externs", xPath);\r
- if (returns != null && returns.length > 0) {\r
- String[] stringArray = new String[returns.length];\r
- XmlNormalizedString[] doc = (XmlNormalizedString[]) returns;\r
-\r
- for (int i = 0; i < returns.length; ++i) {\r
- stringArray[i] = doc[i].getStringValue();\r
- }\r
-\r
- return stringArray;\r
- }\r
-\r
- return null;\r
- }\r
-\r
- /**\r
- * Retrieve Extern\r
- * \r
- * @returns Extern objects list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static ExternsDocument.Externs.Extern[] getExternArray() {\r
- String[] xPath = new String[] { "/Extern" };\r
-\r
- XmlObject[] returns = get("Externs", xPath);\r
- if (returns != null && returns.length > 0) {\r
- return (ExternsDocument.Externs.Extern[]) returns;\r
- }\r
-\r
- return null;\r
- }\r
- \r
- /**\r
- * Retrieve Library instance information\r
- * \r
- * @param arch\r
- * Architecture name\r
- * @param usage\r
- * Library instance usage\r
- * \r
- * @returns library instance name list if elements are found at the known\r
- * xpath\r
- * @returns null if nothing is there\r
- */\r
- public static ModuleIdentification[] getLibraryInstance(String arch) {\r
- String[] xPath;\r
- String saGuid = null;\r
- String saVersion = null;\r
- String pkgGuid = null;\r
- String pkgVersion = null;\r
-\r
- if (arch == null || arch.equalsIgnoreCase("")) {\r
- xPath = new String[] { "/Instance" };\r
- } else {\r
- xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='"\r
- + arch + "']" };\r
- }\r
-\r
- XmlObject[] returns = get("Libraries", xPath);\r
- if (returns == null || returns.length == 0) {\r
- return new ModuleIdentification[0];\r
- }\r
-\r
- ModuleIdentification[] saIdList = new ModuleIdentification[returns.length];\r
- for (int i = 0; i < returns.length; i++) {\r
- LibrariesDocument.Libraries.Instance library = (LibrariesDocument.Libraries.Instance) returns[i];\r
- saGuid = library.getModuleGuid();\r
- saVersion = library.getModuleVersion();\r
-\r
- pkgGuid = library.getPackageGuid();\r
- pkgVersion = library.getPackageVersion();\r
-\r
- ModuleIdentification saId = new ModuleIdentification(null, saGuid,\r
- saVersion);\r
- PackageIdentification pkgId = new PackageIdentification(null,\r
- pkgGuid, pkgVersion);\r
- saId.setPackage(pkgId);\r
-\r
- saIdList[i] = saId;\r
-\r
- }\r
- return saIdList;\r
- }\r
-\r
- // /\r
- // / This method is used for retrieving the elements information which has\r
- // / CName sub-element\r
- // /\r
- private static String[] getCNames(String from, String xPath[]) {\r
- XmlObject[] returns = get(from, xPath);\r
- if (returns == null || returns.length == 0) {\r
- return null;\r
- }\r
-\r
- String[] strings = new String[returns.length];\r
- for (int i = 0; i < returns.length; ++i) {\r
- // TBD\r
- // strings[i] = ((CName) returns[i]).getStringValue();\r
- }\r
-\r
- return strings;\r
- }\r
-\r
- /**\r
- * Retrive library's constructor name\r
- * \r
- * @returns constructor name list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String getLibConstructorName() {\r
- String[] xPath = new String[] { "/Extern/Constructor" };\r
-\r
- XmlObject[] returns = get("Externs", xPath);\r
- if (returns != null && returns.length > 0) {\r
- // CName constructor = (CName) returns[0];\r
- // return constructor.getStringValue();\r
- }\r
-\r
- return null;\r
- }\r
-\r
- /**\r
- * Retrive library's destructor name\r
- * \r
- * @returns destructor name list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String getLibDestructorName() {\r
- String[] xPath = new String[] { "/Extern/Destructor" };\r
-\r
- XmlObject[] returns = get("Externs", xPath);\r
- if (returns != null && returns.length > 0) {\r
- // CName destructor = (CName) returns[0];\r
- // return destructor.getStringValue();\r
- }\r
-\r
- return null;\r
- }\r
-\r
- /**\r
- * Retrive DriverBinding names\r
- * \r
- * @returns DriverBinding name list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getDriverBindingArray() {\r
- String[] xPath = new String[] { "/Extern/DriverBinding" };\r
- return getCNames("Externs", xPath);\r
- }\r
-\r
- /**\r
- * Retrive ComponentName names\r
- * \r
- * @returns ComponentName name list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getComponentNameArray() {\r
- String[] xPath = new String[] { "/Extern/ComponentName" };\r
- return getCNames("Externs", xPath);\r
- }\r
-\r
- /**\r
- * Retrive DriverConfig names\r
- * \r
- * @returns DriverConfig name list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getDriverConfigArray() {\r
- String[] xPath = new String[] { "/Extern/DriverConfig" };\r
- return getCNames("Externs", xPath);\r
- }\r
-\r
- /**\r
- * Retrive DriverDiag names\r
- * \r
- * @returns DriverDiag name list if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getDriverDiagArray() {\r
- String[] xPath = new String[] { "/Extern/DriverDiag" };\r
- return getCNames("Externs", xPath);\r
- }\r
-\r
- /**\r
- * Retrive SetVirtualAddressMapCallBack names\r
- * \r
- * @returns SetVirtualAddressMapCallBack name list if elements are found at\r
- * the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getSetVirtualAddressMapCallBackArray() {\r
- String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" };\r
- return getCNames("Externs", xPath);\r
- }\r
-\r
- /**\r
- * Retrive ExitBootServicesCallBack names\r
- * \r
- * @returns ExitBootServicesCallBack name list if elements are found at the\r
- * known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[] getExitBootServicesCallBackArray() {\r
- String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" };\r
- return getCNames("Externs", xPath);\r
- }\r
-\r
- /**\r
- * Retrieve module surface area file information\r
- * \r
- * @returns ModuleSA objects list if elements are found at the known xpath\r
- * @returns Empty ModuleSA list if nothing is there\r
- */\r
- public static Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() {\r
- String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };\r
- XmlObject[] result = get("FrameworkPlatformDescription", xPath);\r
- String arch = null;\r
- String fvBinding = null;\r
- String saGuid = null;\r
- String saVersion = null;\r
- String pkgGuid = null;\r
- String pkgVersion = null;\r
-\r
- Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleMap = new LinkedHashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
-\r
- if (result == null) {\r
- return fpdModuleMap;\r
- }\r
-\r
- for (int i = 0; i < result.length; i++) {\r
- //\r
- // Get Fpd SA Module element node and add to xmlObjectMap.\r
- //\r
- Map<String, XmlObject> xmlObjectMap = new HashMap<String, XmlObject>();\r
- ModuleSADocument.ModuleSA moduleSA = (ModuleSADocument.ModuleSA) result[i];\r
- if (((ModuleSADocument.ModuleSA) result[i]).getLibraries() != null) {\r
- xmlObjectMap.put("Libraries", moduleSA.getLibraries());\r
- }\r
- if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) {\r
- xmlObjectMap.put("PcdBuildDefinition", moduleSA\r
- .getPcdBuildDefinition());\r
- }\r
- if (((ModuleSADocument.ModuleSA) result[i])\r
- .getModuleSaBuildOptions() != null) {\r
- xmlObjectMap.put("ModuleSaBuildOptions", moduleSA\r
- .getModuleSaBuildOptions());\r
- }\r
-\r
- //\r
- // Get Fpd SA Module attribute and create FpdMoudleIdentification.\r
- //\r
- arch = moduleSA.getSupArchList().toString();\r
-\r
- // TBD\r
- fvBinding = null;\r
- saVersion = ((ModuleSADocument.ModuleSA) result[i])\r
- .getModuleVersion();\r
-\r
- saGuid = moduleSA.getModuleGuid();\r
- pkgGuid = moduleSA.getPackageGuid();\r
- pkgVersion = moduleSA.getPackageVersion();\r
-\r
- //\r
- // Create Module Identification which have class member of package\r
- // identification.\r
- //\r
- PackageIdentification pkgId = new PackageIdentification(null,\r
- pkgGuid, pkgVersion);\r
- ModuleIdentification saId = new ModuleIdentification(null, saGuid,\r
- saVersion);\r
-\r
- saId.setPackage(pkgId);\r
-\r
- //\r
- // Create FpdModule Identification which have class member of module\r
- // identification\r
- //\r
- FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId,\r
- arch);\r
- if (arch != null) {\r
- fpdSaId.setArch(arch);\r
- }\r
- if (fvBinding != null) {\r
- fpdSaId.setFvBinding(fvBinding);\r
- }\r
-\r
- //\r
- // Put element to Map<FpdModuleIdentification, Map<String,\r
- // XmlObject>>.\r
- //\r
- fpdModuleMap.put(fpdSaId, xmlObjectMap);\r
- }\r
- return fpdModuleMap;\r
- }\r
-\r
- /**\r
- * Retrieve valid image names\r
- * \r
- * @returns valid iamges name list if elements are found at the known xpath\r
- * @returns empty list if nothing is there\r
- */\r
- public static String[] getFpdValidImageNames() {\r
- String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FvImages/FvImage[@Type='ValidImageNames']/FvImageNames" };\r
-\r
- XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);\r
- if (queryResult == null) {\r
- return new String[0];\r
- }\r
-\r
- String[] result = new String[queryResult.length];\r
- for (int i = 0; i < queryResult.length; i++) {\r
- result[i] = ((XmlString) queryResult[i]).getStringValue();\r
- }\r
-\r
- return result;\r
- }\r
-\r
- \r
-\r
- public static XmlObject getFpdBuildOptions() {\r
- String[] xPath = new String[] { "/BuildOptions" };\r
-\r
- XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);\r
-\r
- if (queryResult == null || queryResult.length == 0) {\r
- return null;\r
- }\r
- return queryResult[0];\r
- }\r
-\r
- public static PlatformIdentification getFpdHeader() {\r
- String[] xPath = new String[] { "/PlatformHeader" };\r
-\r
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);\r
-\r
- if (returns == null || returns.length == 0) {\r
- return null;\r
- }\r
- PlatformHeaderDocument.PlatformHeader header = (PlatformHeaderDocument.PlatformHeader) returns[0];\r
-\r
- String name = header.getPlatformName();\r
-\r
- String guid = header.getGuidValue();\r
-\r
- String version = header.getVersion();\r
-\r
- return new PlatformIdentification(name, guid, version);\r
- }\r
-\r
- /**\r
- * Retrieve flash definition file name\r
- * \r
- * @returns file name if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String getFlashDefinitionFile() {\r
- String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };\r
-\r
- XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);\r
- if (queryResult == null || queryResult.length == 0) {\r
- return null;\r
- }\r
-\r
- FileNameConvention filename = (FileNameConvention) queryResult[queryResult.length - 1];\r
- return filename.getStringValue();\r
- }\r
-\r
- /**\r
- * Retrieve FV image component options\r
- * \r
- * @param fvName\r
- * FV image name\r
- * \r
- * @returns name/value pairs list if elements are found at the known xpath\r
- * @returns empty list if nothing is there\r
- */\r
- public static String[][] getFpdComponents(String fvName) {\r
- String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/DataRegions/FvDataRegion[@Name='"\r
- + fvName.toUpperCase() + "']/DataId" };\r
-\r
- XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath);\r
- if (queryResult == null) {\r
- return new String[0][];\r
- }\r
-\r
- ArrayList<String[]> list = new ArrayList<String[]>();\r
- for (int i = 0; i < queryResult.length; i++) {\r
- DataIdDocument.DataId item = (DataIdDocument.DataId) queryResult[i];\r
- list\r
- .add(new String[] { item.getStringValue(),\r
- item.getDataSize() });\r
- }\r
-\r
- String[][] result = new String[list.size()][2];\r
- for (int i = 0; i < list.size(); i++) {\r
- result[i][0] = list.get(i)[0];\r
- result[i][1] = list.get(i)[1];\r
- }\r
-\r
- return result;\r
- }\r
-\r
- /**\r
- * Retrieve PCD tokens\r
- * \r
- * @returns CName/ItemType pairs list if elements are found at the known\r
- * xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String[][] getPcdTokenArray() {\r
- String[] xPath = new String[] { "/PcdData" };\r
-\r
- XmlObject[] returns = get("PCDs", xPath);\r
- if (returns == null || returns.length == 0) {\r
- return null;\r
- }\r
-\r
- // PcdCoded.PcdData[] pcds = (PcdCoded.PcdData[]) returns;\r
- // String[][] result = new String[pcds.length][2];\r
- // for (int i = 0; i < returns.length; ++i) {\r
- // if (pcds[i].getItemType() != null) {\r
- // result[i][1] = pcds[i].getItemType().toString();\r
- // } else {\r
- // result[i][1] = null;\r
- // }\r
- // result[i][0] = pcds[i].getCName();\r
- // }\r
-\r
- return null;\r
- }\r
-\r
- \r
-\r
- /**\r
- * Retrieve MSA header\r
- * \r
- * @return\r
- * @return\r
- */\r
- public static ModuleIdentification getMsaHeader() {\r
- String[] xPath = new String[] { "/" };\r
- XmlObject[] returns = get("MsaHeader", xPath);\r
-\r
- if (returns == null || returns.length == 0) {\r
- return null;\r
- }\r
-\r
- MsaHeader msaHeader = (MsaHeader) returns[0];\r
- //\r
- // Get BaseName, ModuleType, GuidValue, Version\r
- // which in MsaHeader.\r
- //\r
- String name = msaHeader.getModuleName();\r
- String moduleType = "";\r
- if (msaHeader.getModuleType() != null) {\r
- moduleType = msaHeader.getModuleType().toString();\r
+ public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) {\r
+ XmlObject[] returns = null;\r
+ PackageSurfaceAreaDocument.PackageSurfaceArea psa = WorkspaceProfile.getPackageXmlObject(pi);\r
+ if (psa.getPcdDeclarations() != null && psa.getPcdDeclarations().getPcdEntryList() != null) {\r
+ int size = psa.getPcdDeclarations().getPcdEntryList().size();\r
+ returns = new XmlObject[size];\r
+ for (int i = 0; i < size; ++i) {\r
+ returns[i] = psa.getPcdDeclarations().getPcdEntryList().get(i);\r
+ }\r
}\r
- \r
- String guid = msaHeader.getGuidValue();\r
- String version = msaHeader.getVersion();\r
-\r
- ModuleIdentification moduleId = new ModuleIdentification(name, guid,\r
- version);\r
-\r
- moduleId.setModuleType(moduleType);\r
-\r
- return moduleId;\r
- }\r
-\r
- /**\r
- * Retrieve Extern Specification\r
- * \r
- * @param\r
- * \r
- * @return String[] If have specification element in the <extern> String[0]\r
- * If no specification element in the <extern>\r
- * \r
- */\r
-\r
- public static String[] getExternSpecificaiton() {\r
- String[] xPath = new String[] { "/Specification" };\r
-\r
- XmlObject[] queryResult = get("Externs", xPath);\r
- if (queryResult == null) {\r
- return new String[0];\r
- }\r
-\r
- String[] specificationList = new String[queryResult.length];\r
- for (int i = 0; i < queryResult.length; i++) {\r
- // specificationList[i] = ((SpecificationDocument.Specification)\r
- // queryResult[i])\r
- // .getStringValue();\r
- }\r
- return specificationList;\r
- }\r
-\r
- /**\r
- * Retreive MsaFile which in SPD\r
- * \r
- * @param\r
- * @return String[][3] The string sequence is ModuleName, ModuleGuid,\r
- * ModuleVersion, MsaFile String[0][] If no msafile in SPD\r
- */\r
- public static String[] getSpdMsaFile() {\r
- String[] xPath = new String[] { "/MsaFiles" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
- if (returns == null) {\r
- return new String[0];\r
- }\r
-\r
- List<String> filenameList = ((MsaFilesDocument.MsaFiles) returns[0])\r
- .getFilenameList();\r
- return filenameList.toArray(new String[filenameList.size()]);\r
- }\r
-\r
- /**\r
- * Reteive\r
- */\r
- public static Map<String, String[]> getSpdLibraryClasses() {\r
- String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
-\r
- //\r
- // Create Map, Key - LibraryClass, String[] - LibraryClass Header file.\r
- //\r
- Map<String, String[]> libClassHeaderMap = new HashMap<String, String[]>();\r
-\r
- if (returns == null) {\r
- return libClassHeaderMap;\r
- }\r
-\r
- for (int i = 0; i < returns.length; i++) {\r
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass library = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) returns[i];\r
- libClassHeaderMap.put(library.getName(), new String[] { library\r
- .getIncludeHeader() });\r
- }\r
- return libClassHeaderMap;\r
- }\r
-\r
- /**\r
- * Reteive\r
- */\r
- public static Map<String, String> getSpdPackageHeaderFiles() {\r
- String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
-\r
- //\r
- // Create Map, Key - ModuleType, String - PackageInclude Header file.\r
- //\r
- Map<String, String> packageIncludeMap = new HashMap<String, String>();\r
-\r
- if (returns == null) {\r
- return packageIncludeMap;\r
- }\r
- WorkspaceProfile.log.info("" + returns[0].getClass().getName());\r
- for (int i = 0; i < returns.length; i++) {\r
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];\r
- packageIncludeMap.put(includeHeader.getModuleType().toString(),\r
- includeHeader.getStringValue());\r
- }\r
- return packageIncludeMap;\r
- }\r
-\r
- public static PackageIdentification getSpdHeader() {\r
- String[] xPath = new String[] { "/SpdHeader" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
-\r
- if (returns == null || returns.length == 0) {\r
- return null;\r
- }\r
-\r
- SpdHeaderDocument.SpdHeader header = (SpdHeaderDocument.SpdHeader) returns[0];\r
-\r
- String name = header.getPackageName();\r
-\r
- String guid = header.getGuidValue();\r
-\r
- String version = header.getVersion();\r
-\r
- return new PackageIdentification(name, guid, version);\r
- }\r
-\r
- /**\r
- * Reteive\r
- */\r
- public static Map<String, String[]> getSpdGuid() {\r
- String[] xPath = new String[] { "/GuidDeclarations/Entry" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
-\r
- //\r
- // Create Map, Key - GuidName, String[] - C_NAME & GUID value.\r
- //\r
- Map<String, String[]> guidDeclMap = new HashMap<String, String[]>();\r
- if (returns == null) {\r
- return guidDeclMap;\r
- }\r
-\r
- for (int i = 0; i < returns.length; i++) {\r
- GuidDeclarationsDocument.GuidDeclarations.Entry entry = (GuidDeclarationsDocument.GuidDeclarations.Entry) returns[i];\r
- String[] guidPair = new String[2];\r
- guidPair[0] = entry.getCName();\r
- guidPair[1] = entry.getGuidValue();\r
- guidDeclMap.put(entry.getName(), guidPair);\r
- }\r
- return guidDeclMap;\r
- }\r
-\r
- /**\r
- * Reteive\r
- */\r
- public static Map<String, String[]> getSpdProtocol() {\r
- String[] xPath = new String[] { "/ProtocolDeclarations/Entry" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
-\r
- //\r
- // Create Map, Key - protocolName, String[] - C_NAME & GUID value.\r
- //\r
- Map<String, String[]> protoclMap = new HashMap<String, String[]>();\r
-\r
- if (returns == null) {\r
- return protoclMap;\r
- }\r
-\r
- for (int i = 0; i < returns.length; i++) {\r
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry entry = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) returns[i];\r
- String[] protocolPair = new String[2];\r
-\r
- protocolPair[0] = entry.getCName();\r
- protocolPair[1] = entry.getGuidValue();\r
- protoclMap.put(entry.getName(), protocolPair);\r
- }\r
- return protoclMap;\r
- }\r
-\r
- /**\r
- * getSpdPpi() Retrieve the SPD PPI Entry\r
- * \r
- * @param\r
- * @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI\r
- * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI\r
- * entry in SPD.\r
- */\r
- public static Map<String, String[]> getSpdPpi() {\r
- String[] xPath = new String[] { "/PpiDeclarations/Entry" };\r
-\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
-\r
- //\r
- // Create Map, Key - protocolName, String[] - C_NAME & GUID value.\r
- //\r
- Map<String, String[]> ppiMap = new HashMap<String, String[]>();\r
-\r
- if (returns == null) {\r
- return ppiMap;\r
- }\r
-\r
- for (int i = 0; i < returns.length; i++) {\r
- PpiDeclarationsDocument.PpiDeclarations.Entry entry = (PpiDeclarationsDocument.PpiDeclarations.Entry) returns[i];\r
- String[] ppiPair = new String[2];\r
- ppiPair[0] = entry.getCName();\r
- ppiPair[1] = entry.getGuidValue();\r
- ppiMap.put(entry.getName(), ppiPair);\r
- }\r
- return ppiMap;\r
- }\r
-\r
- /**\r
- * getModuleSupportedArchs()\r
- * \r
- * This function is to Retrieve Archs one module supported.\r
- * \r
- * @param\r
- * @return supportArch String of supporting archs. null No arch specified in\r
- * <MouduleSupport> element.\r
- */\r
- public static List<String> getModuleSupportedArchs() {\r
- String[] xPath = new String[] { "/ModuleDefinitions/SupportedArchitectures" };\r
-\r
- XmlObject[] returns = get("ModuleSurfaceArea", xPath);\r
-\r
- if (returns == null) {\r
- return null;\r
- }\r
-\r
- return (List<String>)returns[0];\r
- }\r
-\r
- public static XmlObject[] getSpdPcdDeclarations() {\r
- String[] xPath = null;\r
-// if (tsGuid != null){\r
-// xPath = new String[] { "/PcdDeclarations/PcdEntry[C_Name='" + cName + "' and TokenSpaceGuid='"+ tsGuid + "']" };\r
-// }\r
-// else{\r
-// xPath = new String[] { "/PcdDeclarations/PcdEntry[C_Name='" + cName + "']" };\r
-// } \r
- xPath = new String[] { "/PcdDeclarations/PcdEntry"};\r
- XmlObject[] returns = get("PackageSurfaceArea", xPath);\r
\r
return returns;\r
}\r
- \r
- public static XmlObject[] getFpdPcdBuildDefinitions(String cName, String tsGuid, String type) {\r
- String[] xPath = new String[] { "/PcdBuildDefinition/PcdData[C_Name='" + cName + "' and TokenSpaceGuid='"\r
- + tsGuid + "' and DatumType!='" + type + "']" };\r
-\r
- XmlObject[] returns = get("ModuleSA", xPath);\r
-\r
- return returns;\r
- }\r
- /**\r
- * getToolChainFamily\r
- * \r
- * This function is to retrieve ToolChainFamily attribute of FPD\r
- * <BuildOptions>\r
- * \r
- * @param\r
- * @return toolChainFamily If find toolChainFamily attribute in\r
- * <BuildOptions> Null If don't have toolChainFamily in\r
- * <BuildOptions>.\r
- */\r
- public String getToolChainFamily() {\r
- String[] xPath = new String[] { "/BuildOptions" };\r
-\r
- XmlObject[] result = get("FrameworkPlatformDescription", xPath);\r
- if (result == null) {\r
- return null;\r
- }\r
- // toolChainFamily =\r
- // ((BuildOptionsDocument.BuildOptions)result[0]).getToolChainFamilies();\r
- // return toolChainFamily;\r
- return null;\r
- }\r
\r
- /**\r
- * Retrieve module Guid string\r
- * \r
- * @returns GUILD string if elements are found at the known xpath\r
- * @returns null if nothing is there\r
- */\r
- public static String getModuleGuid() {\r
- String[] xPath = new String[] { "" };\r
-\r
- XmlObject[] returns = get("MsaHeader", xPath);\r
- if (returns != null && returns.length > 0) {\r
- String guid = ((MsaHeaderDocument.MsaHeader) returns[0])\r
- .getGuidValue();\r
- return guid;\r
- }\r
-\r
- return null;\r
- }\r
-\r
- //\r
- // For new Pcd\r
- //\r
- public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() {\r
- String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };\r
- XmlObject[] result = get("FrameworkPlatformDescription", xPath);\r
- if (result != null) {\r
- return (ModuleSADocument.ModuleSA[]) result;\r
- }\r
- return new ModuleSADocument.ModuleSA[0];\r
-\r
- }\r
-}\r
+}
\ No newline at end of file
**/\r
package org.tianocore.frameworkwizard.platform.ui.global;\r
\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.DbPathAndFilename;\r
-import org.tianocore.FrameworkDatabaseDocument;\r
import org.tianocore.ModuleSurfaceAreaDocument;\r
+import org.tianocore.PackageSurfaceAreaDocument;\r
import org.tianocore.PcdCodedDocument;\r
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
-import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PlatformIdentification;\r
-\r
-import java.io.File;\r
-import java.util.Comparator;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
import java.util.Iterator;\r
-import java.util.List;\r
import java.util.ListIterator;\r
-import java.util.Map;\r
-import java.util.Set;\r
import java.util.Vector;\r
-import java.util.logging.Logger;\r
\r
/**\r
WorkspaceProfile provide initializing, instoring, querying and update global data.\r
@since GenBuild 1.0\r
**/\r
public class WorkspaceProfile {\r
-\r
-\r
- public static Logger log = Logger.getAnonymousLogger();\r
- public static KeyComparator comparator = new KeyComparator();\r
///\r
/// Record current WORKSPACE Directory\r
///\r
private static String workspaceDir = "";\r
\r
- ///\r
- /// Be used to ensure Global data will be initialized only once.\r
- ///\r
-// private static boolean globalFlag = false;\r
- \r
- ///\r
- /// Framework Database information: package list and platform list\r
- ///\r
- private static Set<PackageIdentification> packageList = new HashSet<PackageIdentification>(); \r
-\r
- private static Set<PlatformIdentification> platformList = new HashSet<PlatformIdentification>();\r
-\r
- ///\r
- /// Every detail SPD informations: Module list, Library class definition,\r
- /// Package header file, GUID/PPI/Protocol definitions\r
- ///\r
- private static final Map<PackageIdentification, Spd> spdTable = new HashMap<PackageIdentification, Spd>();\r
-\r
- ///\r
- /// Build informations are divided into three parts:\r
- /// 1. From MSA 2. From FPD 3. From FPD' ModuleSA\r
- ///\r
- private static Map<ModuleIdentification, Map<String, XmlObject>> nativeMsa = new HashMap<ModuleIdentification, Map<String, XmlObject>>();\r
-\r
- private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
-\r
- private static XmlObject fpdBuildOptions;\r
-\r
- private static XmlObject fpdDynamicPcds;\r
- \r
- ///\r
- /// Parsed modules list\r
- ///\r
- private static Map<FpdModuleIdentification, Map<String, XmlObject>> parsedModules = new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
- \r
- ///\r
- /// built modules list with ARCH, TARGET, TOOLCHAIN\r
- ///\r
- private static Set<FpdModuleIdentification> builtModules = new HashSet<FpdModuleIdentification>();\r
- \r
- /**\r
- Parse framework database (DB) and all SPD files listed in DB to initialize\r
- the environment for next build. This method will only be executed only once\r
- in the whole build process. \r
- \r
- @param workspaceDatabaseFile the file name of framework database\r
- @param workspaceDir current workspace directory path\r
- @throws Exception\r
- Framework Dababase or SPD or MSA file is not valid\r
- **/\r
- public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir) throws Exception {\r
- \r
- //\r
- // Backup workspace directory. It will be used by other method\r
- //\r
- WorkspaceProfile.workspaceDir = workspaceDir.replaceAll("(\\\\)", "/");\r
- File dbFile = new File(workspaceDir + File.separatorChar + workspaceDatabaseFile);\r
- try {\r
- FrameworkDatabaseDocument db = (FrameworkDatabaseDocument) XmlObject.Factory.parse(dbFile);\r
- //\r
- // validate FrameworkDatabaseFile\r
- //\r
-// if (! db.validate()) {\r
-// throw new Exception("Framework Database file [" + dbFile.getPath() + "] is invalid.");\r
-// }\r
- //\r
- // Get package list\r
- //\r
- packageList.clear();\r
- List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList();\r
- \r
- Iterator iter = packages.iterator();\r
- while (iter.hasNext()) {\r
- DbPathAndFilename dbPath = (DbPathAndFilename)iter.next();\r
- String fileName = dbPath.getStringValue();\r
- Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName));\r
- packageList.add(spd.getPackageId());\r
- spdTable.put(spd.getPackageId(), spd);\r
- }\r
-\r
- \r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- throw new Exception("Parse workspace Database [" + dbFile.getPath() + "] Error.\n" + e.getMessage());\r
- }\r
- }\r
- \r
/**\r
Get the current WORKSPACE Directory. \r
\r
return workspaceDir;\r
}\r
\r
-\r
- /**\r
- Get the MSA file name with absolute path\r
- */\r
- public synchronized static File getMsaFile(ModuleIdentification moduleId) throws Exception {\r
- File msaFile = null;\r
- //\r
- // TBD. Do only when package is null. \r
- //\r
- Iterator iter = packageList.iterator();\r
- while (iter.hasNext()) {\r
- PackageIdentification packageId = (PackageIdentification)iter.next();\r
- Spd spd = spdTable.get(packageId);\r
- msaFile = spd.getModuleFile(moduleId);\r
- if (msaFile != null ) {\r
- break ;\r
- }\r
- }\r
- if (msaFile == null){\r
- throw new Exception("Can not find Module [" + moduleId.getName() + "] in any packages in this workspace.");\r
- }\r
- else {\r
- return msaFile;\r
- }\r
- }\r
-\r
public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) {\r
//\r
// If package already defined in module\r
//\r
- if (moduleId.getPackage() != null) {\r
- return moduleId.getPackage();\r
+ if (moduleId.getPackageId() != null) {\r
+ return moduleId.getPackageId();\r
}\r
\r
- PackageIdentification packageId = null;\r
- Iterator iter = packageList.iterator();\r
- while (iter.hasNext()) {\r
- packageId = (PackageIdentification)iter.next();\r
- \r
- Spd spd = spdTable.get(packageId);\r
- if (spd.getModuleFile(moduleId) != null ) {\r
- moduleId.setPackage(packageId);\r
- break ;\r
- }\r
- }\r
- if (packageId == null){\r
- return null;\r
- }\r
- else {\r
- return packageId;\r
- }\r
- }\r
- \r
- /**\r
- Difference between build and parse: ToolChain and Target\r
- **/\r
- public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId) {\r
- return builtModules.contains(moduleId);\r
- }\r
- \r
- public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId) {\r
- builtModules.add(fpdModuleId);\r
- }\r
-\r
- \r
- public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId, Map<String, XmlObject> doc) throws Exception{\r
- Map<String, XmlObject> result = new HashMap<String, XmlObject>();\r
- Set keySet = doc.keySet();\r
- Iterator iter = keySet.iterator();\r
- while (iter.hasNext()){\r
- String key = (String)iter.next();\r
- XmlObject item = cloneXmlObject(doc.get(key), true);\r
- result.put(key, item);\r
- }\r
- fpdModuleSA.put(fpdModuleId, result);\r
- }\r
- \r
- /**\r
- Query overrided module surface area information. If current is Package\r
- or Platform build, also include the information from FPD file. \r
- \r
- <p>Note that surface area parsing is incremental. That means the method will \r
- only parse the MSA and MBD files if necessary. </p>\r
- \r
- @param moduleName the base name of the module\r
- @return the overrided module surface area information\r
- @throws Exception\r
- MSA or MBD is not valid\r
- **/\r
- public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws Exception {\r
- if (parsedModules.containsKey(fpdModuleId)) {\r
- return parsedModules.get(fpdModuleId);\r
- }\r
- Map<String, XmlObject> doc = new HashMap<String, XmlObject>();\r
- ModuleIdentification moduleId = fpdModuleId.getModule();\r
- //\r
- // First part: get the MSA files info\r
- //\r
- doc = getNativeMsa(moduleId);\r
- \r
- //\r
- // Second part: put build options\r
- //\r
- doc.put("BuildOptions", fpdBuildOptions);\r
- \r
- //\r
- // Third part: get Module info from FPD, such as Library instances, PCDs\r
- //\r
- if (fpdModuleSA.containsKey(fpdModuleId)){\r
- //\r
- // merge module info in FPD to final Doc\r
- // For Library Module, do nothing here\r
- //\r
- doc.putAll(fpdModuleSA.get(fpdModuleId));\r
- }\r
- parsedModules.put(fpdModuleId, doc);\r
- return doc;\r
- }\r
-\r
- public synchronized static Map<String, XmlObject> getDoc(ModuleIdentification moduleId, String arch) throws Exception {\r
- FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, arch);\r
- return getDoc(fpdModuleId);\r
- }\r
- /**\r
- Query the native MSA information with module base name. \r
- \r
- <p>Note that MSA parsing is incremental. That means the method will \r
- only to parse the MSA files when never parsed before. </p>\r
- \r
- @param moduleName the base name of the module\r
- @return the native MSA information\r
- @throws Exception\r
- MSA file is not valid\r
- **/\r
- public synchronized static Map<String, XmlObject> getNativeMsa(ModuleIdentification moduleId) throws Exception {\r
- if (nativeMsa.containsKey(moduleId)) {\r
- return nativeMsa.get(moduleId);\r
- }\r
- File msaFile = getMsaFile(moduleId);\r
- Map<String, XmlObject> msaMap = getNativeMsa(msaFile);\r
- nativeMsa.put(moduleId, msaMap);\r
- return msaMap;\r
- }\r
- \r
- public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws Exception {\r
- \r
- try {\r
- ModuleSurfaceAreaDocument doc = (ModuleSurfaceAreaDocument)XmlObject.Factory.parse(msaFile);\r
- //\r
- // Validate File if they accord with XML Schema\r
- //\r
-// if ( ! doc.validate()){\r
-// throw new Exception("Module Surface Area file [" + msaFile.getPath() + "] is invalid.");\r
-// }\r
- //\r
- // parse MSA file\r
- //\r
- ModuleSurfaceArea msa= doc.getModuleSurfaceArea();\r
- Map<String, XmlObject> msaMap = new HashMap<String, XmlObject>();\r
- msaMap.put("ModuleSurfaceArea", msa);\r
- msaMap.put("MsaHeader", cloneXmlObject(msa.getMsaHeader(), true));\r
- msaMap.put("LibraryClassDefinitions", cloneXmlObject(msa.getLibraryClassDefinitions(), true));\r
- msaMap.put("SourceFiles", cloneXmlObject(msa.getSourceFiles(), true));\r
- msaMap.put("PackageDependencies", cloneXmlObject(msa.getPackageDependencies(), true));\r
- msaMap.put("Protocols", cloneXmlObject(msa.getProtocols(), true));\r
- msaMap.put("PPIs", cloneXmlObject(msa.getPPIs(), true));\r
- msaMap.put("Guids", cloneXmlObject(msa.getGuids(), true));\r
- msaMap.put("Externs", cloneXmlObject(msa.getExterns(), true));\r
- return msaMap;\r
- }\r
- catch (Exception ex){\r
- throw new Exception(ex.getMessage());\r
- }\r
- }\r
- \r
- public static Map<String, XmlObject> getFpdBuildOptions() {\r
- Map<String, XmlObject> map = new HashMap<String, XmlObject>();\r
- map.put("BuildOptions", fpdBuildOptions);\r
- return map;\r
- }\r
- \r
- public static void setFpdBuildOptions(XmlObject fpdBuildOptions) throws Exception{\r
- WorkspaceProfile.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);\r
- }\r
-\r
- public static XmlObject getFpdDynamicPcds() {\r
- return fpdDynamicPcds;\r
- }\r
-\r
- public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds) {\r
- WorkspaceProfile.fpdDynamicPcds = fpdDynamicPcds;\r
- }\r
-\r
- //////////////////////////////////////////////\r
- //////////////////////////////////////////////\r
- \r
- public static Set<ModuleIdentification> getModules(PackageIdentification packageId){\r
- Spd spd = spdTable.get(packageId);\r
- if (spd == null ) {\r
- Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();\r
- return dummy;\r
- }\r
- else {\r
- return spd.getModules();\r
- }\r
- }\r
-\r
- public synchronized static PlatformIdentification getPlatform(String name) throws Exception {\r
- Iterator iter = platformList.iterator();\r
- while(iter.hasNext()){\r
- PlatformIdentification platformId = (PlatformIdentification)iter.next();\r
- if (platformId.getName().equalsIgnoreCase(name)) {\r
- WorkspaceProfile.log.info("Platform: " + platformId + platformId.getFpdFile());\r
- return platformId;\r
- }\r
- }\r
- throw new Exception("Can not find platform [" + name + "] in the current workspace. ");\r
- }\r
- \r
- public synchronized static File getPackageFile(PackageIdentification packageId) throws Exception {\r
- Iterator iter = packageList.iterator();\r
- while(iter.hasNext()){\r
- PackageIdentification packageItem = (PackageIdentification)iter.next();\r
- if (packageItem.equals(packageId)) {\r
- packageId.setName(packageItem.getName());\r
- return packageItem.getSpdFile();\r
- }\r
- }\r
- throw new Exception("Can not find " + packageId + " in the current workspace. ");\r
- }\r
- \r
- public synchronized static File getModuleFile(ModuleIdentification moduleId) throws Exception {\r
- PackageIdentification packageId = getPackageForModule(moduleId);\r
- moduleId.setPackage(packageId);\r
- Spd spd = spdTable.get(packageId);\r
- return spd.getModuleFile(moduleId);\r
+ return null;\r
}\r
//\r
// expanded by FrameworkWizard\r
//\r
- public synchronized static XmlObject getModuleXmlObject(ModuleIdentification moduleId) throws Exception {\r
- PackageIdentification packageId = getPackageForModule(moduleId);\r
- moduleId.setPackage(packageId);\r
- Spd spd = spdTable.get(packageId);\r
- return spd.msaDocMap.get(moduleId);\r
+ public synchronized static ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleXmlObject(ModuleIdentification moduleId) {\r
+ return GlobalData.openingModuleList.getModuleSurfaceAreaFromId(moduleId);\r
}\r
\r
- public synchronized static XmlObject getPackageXmlObject(PackageIdentification packageId) {\r
- Spd spd = spdTable.get(packageId);\r
- if (spd != null){\r
- return spd.spdDocMap.get("PackageSurfaceArea");\r
- }\r
- return null;\r
+ public synchronized static PackageSurfaceAreaDocument.PackageSurfaceArea getPackageXmlObject(PackageIdentification packageId) {\r
+ return GlobalData.openingPackageList.getPackageSurfaceAreaFromId(packageId);\r
}\r
\r
- public synchronized static Set<PackageIdentification> getPackageList(){\r
- return packageList;\r
- }\r
- ///// remove!!\r
- private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws Exception {\r
- if ( object == null) {\r
- return null;\r
- }\r
- XmlObject result = null;\r
- try {\r
- result = XmlObject.Factory.parse(object.getDomNode()\r
- .cloneNode(deep));\r
- } catch (Exception ex) {\r
- throw new Exception(ex.getMessage());\r
- }\r
- return result;\r
- }\r
-\r
public static ModuleIdentification getModuleId(String key){\r
//\r
// Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.\r
//\r
String[] keyPart = key.split(" ");\r
- Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
- Iterator ispi = spi.iterator();\r
+\r
+ Iterator<ModuleIdentification> iMiList = GlobalData.vModuleList.iterator();\r
\r
- while(ispi.hasNext()) {\r
- PackageIdentification pi = (PackageIdentification)ispi.next();\r
- if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){ \r
+ while (iMiList.hasNext()) {\r
+ ModuleIdentification mi = iMiList.next();\r
+ if (mi.getGuid().equalsIgnoreCase(keyPart[0])){\r
+ if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){\r
+ if(!mi.getVersion().equals(keyPart[1])){\r
+ continue;\r
+ }\r
+ }\r
\r
- continue;\r
- }\r
- if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){\r
- if(!pi.getVersion().equals(keyPart[3])){\r
+ PackageIdentification pi = mi.getPackageId();\r
+ if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){ \r
continue;\r
}\r
- }\r
- Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);\r
- Iterator ismi = smi.iterator();\r
- while(ismi.hasNext()) {\r
- ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
- if (mi.getGuid().equalsIgnoreCase(keyPart[0])){\r
- if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){\r
- if(!mi.getVersion().equals(keyPart[1])){\r
- continue;\r
- }\r
+ if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){\r
+ if(!pi.getVersion().equals(keyPart[3])){\r
+ continue;\r
}\r
-\r
- return mi;\r
}\r
+ return mi;\r
}\r
}\r
+ \r
return null;\r
}\r
\r
\r
}\r
\r
-final class KeyComparator implements Comparator<String> {\r
- public int compare(String x, String y) {\r
- return x.compareToIgnoreCase(y);\r
- }\r
- \r
-}\r
\r
+++ /dev/null
-/** @file\r
- Java class FpdModuleIdentification is used to present a module identification\r
- from BaseName, GUID, Version, PackageName, and ARCH. \r
- \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-package org.tianocore.frameworkwizard.platform.ui.id;\r
-\r
-\r
-/**\r
- This class is used to identify a module with BaseName, GUID, Version, PackageName\r
- and ARCH.\r
- \r
- @since GenBuild 1.0\r
- **/\r
-public class FpdModuleIdentification {\r
- \r
- private String arch;\r
- \r
- private String fvBinding = "NULL"; // Optional\r
- \r
- private String sequence = "0"; // Optional\r
- \r
- private ModuleIdentification module;\r
- \r
- public FpdModuleIdentification(String arch, String fvBinding, String sequence, ModuleIdentification module){\r
- this.arch = arch;\r
- this.fvBinding = fvBinding;\r
- this.sequence = sequence;\r
- this.module = module;\r
- }\r
- \r
- public FpdModuleIdentification(ModuleIdentification module, String arch){\r
- this.arch = arch;\r
- this.module = module;\r
- }\r
- /**\r
- Override java.lang.Object#equals. \r
- \r
- <p>Currently, use BaseName and ARCH to identify a module. It will enhance\r
- in the next version. </p>\r
- \r
- @see java.lang.Object#equals(java.lang.Object)\r
- **/\r
- public boolean equals(Object obj) {\r
- if (obj instanceof FpdModuleIdentification) {\r
- FpdModuleIdentification moduleIdObj = (FpdModuleIdentification)obj;\r
- if ( module.equals(moduleIdObj.module) && arch.equalsIgnoreCase(moduleIdObj.arch)) {\r
- return true;\r
- }\r
- return false;\r
- }\r
- else {\r
- return super.equals(obj);\r
- }\r
- }\r
-\r
- public void setFvBinding(String fvBinding) {\r
- this.fvBinding = fvBinding;\r
- }\r
-\r
- public void setSequence(String sequence) {\r
- this.sequence = sequence;\r
- }\r
-\r
- public String toString(){\r
- return arch + ":" + module;\r
- }\r
-\r
- public String getFvBinding() {\r
- return fvBinding;\r
- }\r
-\r
- public String getSequence() {\r
- return sequence;\r
- }\r
-\r
- public ModuleIdentification getModule() {\r
- return module;\r
- }\r
-\r
- public void setModule(ModuleIdentification module) {\r
- this.module = module;\r
- }\r
-\r
- public String getArch() {\r
- return arch;\r
- }\r
-\r
- public void setArch(String arch) {\r
- this.arch = arch;\r
- }\r
- \r
- public int hashCode(){\r
- return module.hashCode();\r
- }\r
-}\r
+++ /dev/null
-package org.tianocore.frameworkwizard.platform.ui.id;\r
-\r
-public class Identification {\r
-\r
- String name;\r
- \r
- String guid;\r
- \r
- String version;\r
- \r
- String type; // Optional\r
- \r
- Identification(String name, String guid, String version){\r
- this.name = name;\r
- this.guid = guid;\r
- this.version = version;\r
- }\r
- \r
- public boolean equals(Object obj) {\r
- if (obj instanceof Identification) {\r
- Identification id = (Identification)obj;\r
- if ( guid.equalsIgnoreCase(id.guid)) {\r
- if (version == null || id.version == null) {\r
- updateName(name, id.name);\r
- return true;\r
- }\r
- else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){\r
- return true;\r
- }\r
- else if (version.equalsIgnoreCase(id.version)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
- else {\r
- return super.equals(obj);\r
- }\r
- }\r
- \r
- void updateName(String name1, String name2) {\r
- if (name1 == null) {\r
- name1 = name2;\r
- }\r
- if (name2 == null) {\r
- name2 = name1;\r
- }\r
- }\r
- \r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
- public void setGuid(String guid) {\r
- this.guid = guid;\r
- }\r
-\r
- public void setVersion(String version) {\r
- this.version = version;\r
- }\r
-\r
- public String getGuid() {\r
- return guid;\r
- }\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public String getVersion() {\r
- return version;\r
- }\r
- \r
- public int hashCode(){\r
- return guid.hashCode();\r
- }\r
-}\r
+++ /dev/null
-package org.tianocore.frameworkwizard.platform.ui.id;\r
-\r
-import java.io.File;\r
-\r
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
-\r
-public class ModuleIdentification extends Identification {\r
- \r
- private PackageIdentification packageId;\r
- \r
- private File msaFile;\r
- \r
- private String moduleType;\r
- \r
- private boolean isLibrary = false;\r
-\r
- public boolean isLibrary() {\r
- return isLibrary;\r
- }\r
-\r
- public void setLibrary(boolean isLibrary) {\r
- this.isLibrary = isLibrary;\r
- }\r
-\r
- public File getMsaFile() throws Exception{\r
- prepareMsaFile();\r
- return msaFile;\r
- }\r
- \r
- public String getModuleRelativePath() throws Exception{\r
- prepareMsaFile();\r
- return msaFile.getParent().substring(packageId.getPackageDir().length() + 1);\r
- }\r
-\r
- private void prepareMsaFile()throws Exception{\r
- if (msaFile == null) {\r
- msaFile = WorkspaceProfile.getModuleFile(this);\r
- }\r
- }\r
- public void setMsaFile(File msaFile) {\r
- this.msaFile = msaFile;\r
- }\r
-\r
- public ModuleIdentification(String name, String guid, String version){\r
- super(name, guid, version);\r
- }\r
- \r
- public ModuleIdentification(String name, String guid, String version, PackageIdentification packageId){\r
- super(name, guid, version);\r
- this.packageId = packageId;\r
- }\r
- \r
- public boolean equals(Object obj) {\r
- if (obj instanceof ModuleIdentification) {\r
- ModuleIdentification id = (ModuleIdentification)obj;\r
- if (guid.equals(id.getGuid()) && packageId.equals(id.getPackage())) {\r
- if (version == null || id.version == null) {\r
- updateName(name, id.name);\r
- return true;\r
- }\r
- else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")){\r
- updateName(name, id.name);\r
- return true;\r
- }\r
- else if (version.equalsIgnoreCase(id.version)) {\r
- updateName(name, id.name);\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
- else {\r
- return super.equals(obj);\r
- }\r
- }\r
- \r
- public String toString(){\r
- if (version == null || version.trim().equalsIgnoreCase("")) {\r
- return "Module [" + name + "] in " + packageId;\r
- }\r
- else {\r
- return "Module [" + name + " " + version + "] in " + packageId; \r
- }\r
- }\r
-\r
- public void setPackage(PackageIdentification packageId) {\r
- this.packageId = packageId;\r
- }\r
-\r
- public PackageIdentification getPackage() {\r
- return packageId;\r
- }\r
-\r
- public String getModuleType() {\r
- return moduleType;\r
- }\r
-\r
- public void setModuleType(String moduleType) {\r
- this.moduleType = moduleType;\r
- }\r
-}\r
+++ /dev/null
-package org.tianocore.frameworkwizard.platform.ui.id;\r
-import java.io.File;\r
-\r
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
-\r
-public class PackageIdentification extends Identification{\r
- \r
- //\r
- // It is optional\r
- //\r
- private File spdFile;\r
- \r
- public PackageIdentification(String name, String guid, String version){\r
- super(name, guid, version);\r
- }\r
- \r
- public PackageIdentification(String name, String guid, String version, String spdFilename){\r
- super(name, guid, version);\r
- this.spdFile = new File(spdFilename);\r
- }\r
- \r
- public PackageIdentification(String name, String guid, String version, File spdFile){\r
- super(name, guid, version);\r
- this.spdFile = spdFile;\r
- }\r
- \r
- public void setSpdFile(File spdFile) {\r
- this.spdFile = spdFile;\r
- }\r
-\r
- public File getSpdFile() {\r
- return spdFile;\r
- }\r
-\r
- public String toString(){\r
- if (version == null || version.trim().equalsIgnoreCase("")) {\r
- return "package [" + name + "]";\r
- }\r
- else {\r
- return "package [" + name + " " + version + "]";\r
- }\r
- }\r
- \r
- public String getPackageDir()throws Exception{\r
- prepareSpdFile();\r
- return spdFile.getParent();\r
- }\r
- \r
- public String getPackageRelativeDir()throws Exception{\r
- prepareSpdFile();\r
- return spdFile.getParent().substring(WorkspaceProfile.getWorkspacePath().length() + 1);\r
- }\r
- \r
- private void prepareSpdFile() throws Exception{\r
- if (spdFile == null) {\r
- spdFile = WorkspaceProfile.getPackageFile(this);\r
- }\r
- }\r
-}\r
+++ /dev/null
-package org.tianocore.frameworkwizard.platform.ui.id;\r
-import java.io.File;\r
-\r
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
-\r
-public class PlatformIdentification extends Identification{\r
- \r
- private File fpdFile;\r
- \r
- public PlatformIdentification(String name, String guid, String version){\r
- super(name, guid, version);\r
- }\r
- \r
- public PlatformIdentification(String name, String guid, String version, String fpdFilename){\r
- super(name, guid, version);\r
- this.fpdFile = new File(fpdFilename);\r
- }\r
- \r
- public PlatformIdentification(String name, String guid, String version, File fpdFile){\r
- super(name, guid, version);\r
- this.fpdFile = fpdFile;\r
- }\r
- \r
- public String toString(){\r
- return "Platform " + name + "["+guid+"]";\r
- }\r
-\r
- public void setFpdFile(File fpdFile) {\r
- this.fpdFile = fpdFile;\r
- }\r
-\r
- public File getFpdFile() {\r
- return fpdFile;\r
- }\r
- \r
- public String getPlatformRelativeDir(){\r
- return fpdFile.getParent().substring(WorkspaceProfile.getWorkspacePath().length());\r
- }\r
-}
\ No newline at end of file