if (sfc.getSpdHdrSpec() != null) {\r
jTextFieldSpecification.setText(sfc.getSpdHdrSpec());\r
}\r
-\r
+ sfc.setSpdHdrSpec(jTextFieldSpecification.getText());\r
}\r
\r
/**\r
String lib = m.getValueAt(row, 0) + "";\r
String hdr = m.getValueAt(row, 1) + "";\r
String hlp = m.getValueAt(row, 2) + "";\r
- String guid = m.getValueAt(row, 3) + "";\r
+ String name = m.getValueAt(row, 3) + "";\r
String ver = m.getValueAt(row, 4) + "";\r
String arch = null;\r
if (m.getValueAt(row, 5) != null) {\r
return;\r
}\r
docConsole.setSaved(false);\r
+ \r
+ getLibInstances(lib);\r
+ String guid = nameToGuid(name);\r
+ \r
sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);\r
}\r
}\r
sfc.getSpdLibClassDeclarations(saa);\r
int i = 0;\r
while (i < saa.length) {\r
+ if (saa[i][3] != null && saa[i][3].length() > 0) {\r
+ getLibInstances(saa[i][0]);\r
+ saa[i][3] = guidToName(saa[i][3]);\r
+ }\r
+ \r
model.addRow(saa[i]);\r
i++;\r
}\r
if (arg0.getSource() == jButtonAdd) {\r
\r
//ToDo: check before add\r
- String[] row = {null, null, null, jTextField1.getText(), jTextField2.getText(), null, null};\r
+ String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2.getText(), null, null};\r
row[0] = jTextFieldAdd.getText();\r
row[1] = jTextField.getText().replace('\\', '/');\r
row[2] = jTextFieldHelp.getText();\r
model.addRow(row);\r
jTable.changeSelection(model.getRowCount()-1, 0, false, false);\r
docConsole.setSaved(false);\r
- sfc.genSpdLibClassDeclarations(row[0], row[3], row[1], row[2], row[5], null, null, row[4], null, row[6]);\r
+ //\r
+ //convert to GUID before storing recommended lib instance.\r
+ //\r
+ getLibInstances(row[0]);\r
+ String recommendGuid = nameToGuid(row[3]);\r
+ sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]);\r
\r
}\r
//\r
\r
}\r
\r
+ private String nameToGuid(String name) {\r
+ String s = "";\r
+ if (!libNameGuidMap.containsKey(name)) {\r
+ return s;\r
+ }\r
+ \r
+ s = libNameGuidMap.get(name);\r
+ return s;\r
+ }\r
+ \r
+ private String guidToName(String guid){\r
+ String s = "";\r
+ if (!libNameGuidMap.containsValue(guid)) {\r
+ return s;\r
+ }\r
+ Set<String> key = libNameGuidMap.keySet();\r
+ Iterator<String> is = key.iterator();\r
+ while(is.hasNext()) {\r
+ s = is.next();\r
+ if (libNameGuidMap.get(s).equals(guid)) {\r
+ break;\r
+ }\r
+ }\r
+ return s;\r
+ }\r
+\r
}\r
\r
\r
while(li.hasNext()) {\r
ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next();\r
if (msa.getModuleGuid().equals(s[0]) && msa.getPackageGuid().equals(s[2])) {\r
-// if (msa.getModuleVersion() != null) {\r
-// if (!msa.getModuleVersion().equals(s[1])) {\r
-// continue;\r
-// }\r
-// }\r
-// else{\r
-// if (s[1] != null) {\r
-// continue;\r
-// }\r
-// }\r
-// if (msa.getPackageVersion() != null) {\r
-// if (!msa.getPackageVersion().equals(s[3])) {\r
-// continue;\r
-// }\r
-// }\r
-// else{\r
-// if (s[3] != null) {\r
-// continue;\r
-// }\r
-// }\r
+ if (msa.getModuleVersion() != null) {\r
+ if (!msa.getModuleVersion().equals(s[1])) {\r
+ continue;\r
+ }\r
+ }\r
+ if (msa.getPackageVersion() != null) {\r
+ if (!msa.getPackageVersion().equals(s[3])) {\r
+ continue;\r
+ }\r
+ }\r
return msa;\r
}\r
}\r
while(ispi.hasNext()) {\r
PackageIdentification pi = (PackageIdentification)ispi.next();\r
if ( !pi.getGuid().equals(keyPart[2])){ \r
-// || !pi.getVersion().equals(keyPart[3])){\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
continue;\r
}\r
+ }\r
Set<ModuleIdentification> smi = GlobalData.getModules(pi);\r
Iterator ismi = smi.iterator();\r
while(ismi.hasNext()) {\r
ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
if (mi.getGuid().equals(keyPart[0])){\r
-// && mi.getVersion().equals(keyPart[1])){\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
return mi;\r
}\r
if (ffc.getFpdHdrSpec() != null) {\r
jTextFieldSpecification.setText(ffc.getFpdHdrSpec());\r
}\r
- \r
+ ffc.setFpdHdrSpec(jTextFieldSpecification.getText()); \r
}\r
\r
/**\r
}\r
}\r
\r
- /**\r
- The header file path is relative to workspace dir\r
- **/\r
- public static String[] getLibraryClassHeaderFiles(PackageIdentification[] packages, String name) {\r
- if (packages == null ){\r
- // throw Exception or not????\r
- return new String[0];\r
- }\r
- String[] result = null;\r
- for (int i = 0; i < packages.length; i++){\r
- Spd spd = spdTable.get(packages[i]);\r
- //\r
- // If find one package defined the library class\r
- //\r
- if( (result = spd.getLibClassIncluder(name)) != null){\r
- return result;\r
- } \r
- }\r
- return null;\r
- \r
- }\r
- \r
- /**\r
- The header file path is relative to workspace dir\r
- **/ \r
- public static String getPackageHeaderFiles(PackageIdentification packages, String moduleType) throws Exception {\r
- if (packages == null ){\r
- return new String("");\r
- }\r
- Spd spd = spdTable.get(packages);\r
- //\r
- // If can't find package header file, skip it\r
- //\r
- String temp = null;\r
- if (spd != null){\r
- if( (temp = spd.getPackageIncluder(moduleType)) != null){\r
- return temp;\r
- }else {\r
- temp = "";\r
- return temp;\r
- }\r
- }else {\r
- return null;\r
- }\r
- } \r
- \r
- /**\r
- return two values: {cName, GuidValue}\r
- **/\r
- public static String[] getGuid(PackageIdentification[] packages, String name) throws Exception {\r
- if (packages == null ){\r
- // throw Exception or not????\r
- return new String[0];\r
- }\r
- String[] result = null;\r
- for (int i = 0; i < packages.length; i++){\r
- Spd spd = spdTable.get(packages[i]);\r
- //\r
- // If find one package defined the GUID\r
- //\r
- if( (result = spd.getGuid(name)) != null){\r
- return result;\r
- }\r
- }\r
- return null;\r
- }\r
- \r
- /**\r
- return two values: {cName, GuidValue}\r
- **/ \r
- public static String[] getPpiGuid(PackageIdentification[] packages, String name) throws Exception {\r
- if (packages == null ){\r
- return new String[0];\r
- }\r
- String[] result = null;\r
- for (int i = 0; i < packages.length; i++){\r
- Spd spd = spdTable.get(packages[i]);\r
- //\r
- // If find one package defined the Ppi GUID\r
- //\r
- if( (result = spd.getPpi(name)) != null){\r
- return result;\r
- }\r
- }\r
- return null;\r
- \r
- }\r
- \r
- /**\r
- return two values: {cName, GuidValue}\r
- **/ \r
- public static String[] getProtocolGuid(PackageIdentification[] packages, String name) throws Exception {\r
- if (packages == null ){\r
- return new String[0];\r
- }\r
- String[] result = null;\r
- for (int i = 0; i < packages.length; i++){\r
- Spd spd = spdTable.get(packages[i]);\r
- //\r
- // If find one package defined the protocol GUID\r
- //\r
- if( (result = spd.getProtocol(name)) != null){\r
- return result;\r
- }\r
- }\r
- return null;\r
- \r
- }\r
- \r
- /////////////////////////// Update!! Update!! Update!!\r
-// public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() {\r
-// return pcdDbManager;\r
-// }\r
- ///////////////////////////\r
public synchronized static PlatformIdentification getPlatform(String name) throws Exception {\r
Iterator iter = platformList.iterator();\r
while(iter.hasNext()){\r
\r
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
\r
///\r
///\r
Map<ModuleIdentification, File> msaInfo = new HashMap<ModuleIdentification, File>();\r
-\r
- ///\r
- /// Map of module info. \r
- /// Key : moduletype\r
- /// Value: moduletype related include file\r
- ///\r
- Map<String, String> packageHeaderInfo = new HashMap<String, String>();\r
-\r
- ///\r
- /// Map of PPI info.\r
- /// Key : PPI name\r
- /// value: String[] a. PPI C_NAME; b. PPI GUID;\r
- ///\r
- Map<String, String[]> ppiInfo = new HashMap<String, String[]>();\r
-\r
- ///\r
- /// Map of Protocol info.\r
- /// Key : Protocol name\r
- /// value: String[] a. Protocol C_NAME; b. Protocol GUID;\r
- ///\r
- Map<String, String[]> protocolInfo = new HashMap<String, String[]>();\r
-\r
- ///\r
- /// Map of Guid info.\r
- /// Key : Guid name\r
- /// value: String[] a. Guid C_NAME; b. Guid's GUID;\r
- ///\r
- Map<String, String[]> guidInfo = new HashMap<String, String[]>();\r
-\r
- ///\r
- /// Map of library class and its exposed header file.\r
- /// Key : library class name\r
- /// value : library class corresponding header file\r
- ///\r
- Map<String, String[]> libClassHeaderList = new HashMap<String, String[]>();\r
-\r
+ \r
//\r
// Xml Doc of Spd file, Msa file\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 = GlobalData.getNativeMsa( msaFile );\r
SurfaceAreaQuery.push(msaDoc);\r
ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader();\r
msaInfo.put(moduleId, msaFile);\r
msaDocMap.put(moduleId, msaDoc.get("ModuleSurfaceArea"));\r
}\r
- //\r
- // initialize Package header files\r
- //\r
-// Map<String, String> packageHeaders = SurfaceAreaQuery.getSpdPackageHeaderFiles();\r
-// Set keys = packageHeaders.keySet();\r
-// Iterator iter = keys.iterator();\r
-// while (iter.hasNext()){\r
-// String moduleType = (String)iter.next();\r
-// String header = packageId.getPackageRelativeDir() + File.separatorChar + packageHeaders.get(moduleType);\r
-// //\r
-// // Change path seperator to system-dependent path separator\r
-// //\r
-// File file = new File (header);\r
-// header = file.getParent();\r
-// packageHeaderInfo.put(moduleType, header);\r
-// }\r
- //\r
- // initialize Guid Info\r
- //\r
- guidInfo.putAll(SurfaceAreaQuery.getSpdGuid());\r
- //\r
- // initialize PPI info\r
- //\r
- ppiInfo.putAll(SurfaceAreaQuery.getSpdPpi());\r
- //\r
- // initialize Protocol info\r
- //\r
- protocolInfo.putAll(SurfaceAreaQuery.getSpdProtocol());\r
- //\r
- // initialize library class declaration\r
- //\r
- Map<String, String[]> libraryClassHeaders = SurfaceAreaQuery.getSpdLibraryClasses();\r
- Set<String> keys = libraryClassHeaders.keySet();\r
- Iterator iter = keys.iterator();\r
- while (iter.hasNext()){\r
- String libraryClassName = (String)iter.next();\r
- String[] headerFiles = libraryClassHeaders.get(libraryClassName);\r
- for (int i = 0; i < headerFiles.length; i++){\r
- headerFiles[i] = packageId.getPackageRelativeDir() + File.separatorChar + headerFiles[i];\r
- \r
- //\r
- // Change path separator to system system-dependent path separator. \r
- //\r
- File file = new File (headerFiles[i]);\r
- headerFiles[i] = file.getPath();\r
- }\r
- libClassHeaderList.put(libraryClassName, headerFiles);\r
- }\r
+ \r
}\r
catch (Exception e) {\r
- e.setStackTrace(e.getStackTrace());\r
+ \r
throw new Exception("Parse package description file [" + packageId.getSpdFile() + "] Error.\n"\r
+ e.getMessage());\r
}\r
public Set<ModuleIdentification> getModules(){\r
return msaInfo.keySet();\r
}\r
-\r
- /**\r
- return two value {CName, Guid}. If not found, return null.\r
- **/\r
- public String[] getPpi(String ppiName) {\r
- return ppiInfo.get(ppiName);\r
- }\r
-\r
- /**\r
- return two value {CName, Guid}. If not found, return null.\r
- **/\r
- public String[] getProtocol(String protocolName) {\r
- return protocolInfo.get(protocolName);\r
- }\r
-\r
- /**\r
- return two value {CName, Guid}. If not found, return null.\r
- **/\r
- public String[] getGuid(String guidName) {\r
- return guidInfo.get(guidName);\r
- }\r
-\r
- /**\r
- getLibClassInclude \r
- \r
- This function is to get the library exposed header file name according \r
- library class name.\r
- \r
- @param libName Name of library class \r
- @return Name of header file\r
- **/\r
- String[] getLibClassIncluder(String libName) {\r
- return libClassHeaderList.get(libName);\r
- }\r
-\r
- /**\r
- getModuleTypeIncluder\r
\r
- This function is to get the header file name from module info map \r
- according to module type.\r
- \r
- @param moduleType Module type.\r
- @return Name of header file.\r
- **/\r
- String getPackageIncluder(String moduleType) {\r
- return packageHeaderInfo.get(moduleType);\r
- }\r
}\r