\r
public class Far {\r
//\r
- // Class member Mainfest\r
+ // Class member Manifest\r
//\r
- public Mainfest mainfest = null;\r
+ public Manifest manifest = null;\r
\r
//\r
// Jar file\r
//\r
public Far(JarFile farFile) throws Exception {\r
jf = farFile;\r
- this.mainfest = new Mainfest(getMainfestFile());\r
+ this.manifest = new Manifest(getManifestFile());\r
}\r
\r
public void creatFar(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,\r
//\r
// Generate Manifest and get file lists\r
//\r
- this.mainfest = new Mainfest();\r
- this.mainfest.setFarHeader(fHeader);\r
- this.mainfest.createManifest(pkgList, plfList, fileFilter);\r
+ this.manifest = new Manifest();\r
+ this.manifest.setFarHeader(fHeader);\r
+ this.manifest.createManifest(pkgList, plfList, fileFilter);\r
\r
- this.mainfest.hibernateToFile();\r
+ this.manifest.hibernateToFile();\r
\r
//\r
// Write Mainifest file to JAR.\r
//\r
- if (this.mainfest.mfFile != null) {\r
- writeToJar(this.mainfest.mfFile, jos);\r
+ if (this.manifest.mfFile != null) {\r
+ writeToJar(this.manifest.mfFile, jos);\r
}\r
\r
//\r
// Write all files to JAR\r
//\r
- Set<File> files = this.mainfest.files;\r
+ Set<File> files = this.manifest.files;\r
Iterator<File> iter = files.iterator();\r
while (iter.hasNext()) {\r
writeToJar(iter.next(), jos);\r
}\r
\r
public void InstallFar(String dir) throws Exception {\r
- List<FarFileItem> allFile = mainfest.getAllFileItem();\r
+ List<FarFileItem> allFile = manifest.getAllFileItem();\r
extract(allFile, dir);\r
}\r
\r
Iterator<PlatformIdentification> plfIter = plfKeys.iterator();\r
while (plfIter.hasNext()) {\r
PlatformIdentification item = plfIter.next();\r
- extract(this.mainfest.getPlatformContents(item), plfMap.get(item).getPath());\r
+ extract(this.manifest.getPlatformContents(item), plfMap.get(item).getPath());\r
}\r
\r
Set<PackageIdentification> pkgKeys = pkgMap.keySet();\r
}\r
\r
public void installPackage(PackageIdentification packageId, File installPath) throws Exception {\r
- List<FarFileItem> contents = this.mainfest.getPackageContents(packageId);\r
+ List<FarFileItem> contents = this.manifest.getPackageContents(packageId);\r
extract(contents, installPath.getPath());\r
}\r
\r
- public InputStream getMainfestFile() throws Exception {\r
+ public InputStream getManifestFile() throws Exception {\r
JarEntry je = null;\r
for (Enumeration e = jf.entries(); e.hasMoreElements();) {\r
je = (JarEntry) e.nextElement();\r
- if (je.getName().equalsIgnoreCase(Mainfest.mfFileName))\r
+ if (je.getName().equalsIgnoreCase(Manifest.mfFileName))\r
return jf.getInputStream(je);\r
}\r
return null;\r
PackageQuery pkgQ = new PackageQuery();\r
List<PackageIdentification> result = new ArrayList<PackageIdentification>();\r
\r
- entry = this.mainfest.getPackgeSpd(pkgId);\r
+ entry = this.manifest.getPackgeSpd(pkgId);\r
if (entry == null) {\r
return result;\r
}\r
/** @file\r
\r
- The file is used to create Far's mainfest file\r
+ The file is used to create Far's manifest file\r
\r
Copyright (c) 2006, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
import org.w3c.dom.Node;\r
import org.w3c.dom.NodeList;\r
\r
-public class Mainfest implements ManifestInterface {\r
+public class Manifest implements ManifestInterface {\r
// /\r
- // / mainfest document\r
+ // / manifest document\r
// /\r
- Document mainfestDoc = null;\r
+ Document manifestDoc = null;\r
\r
// /\r
- // / Mainfest file element name\r
+ // / Manfiest file element name\r
// /\r
- final static String mfFileName = "FrameworkArhciveMainfest.xml";\r
+ final static String mfFileName = "FrameworkArchiveManifest.xml";\r
\r
//\r
// Header\r
final static String farFileName_Md5sum = "Md5sum";\r
\r
//\r
- // mainfest header information.\r
+ // manifest header information.\r
//\r
FarHeader fhInfo = new FarHeader();\r
\r
Set<File> files = new LinkedHashSet<File>();\r
\r
//\r
- // Mainfest file\r
+ // Manifest file\r
//\r
public File mfFile = null;\r
\r
return fhInfo;\r
}\r
\r
- public Mainfest() throws Exception {\r
+ public Manifest() throws Exception {\r
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
Document document = dombuilder.newDocument();\r
- this.mainfestDoc = document;\r
+ this.manifestDoc = document;\r
\r
}\r
\r
- public Mainfest(InputStream mainfestInputStream) throws Exception {\r
+ public Manifest(InputStream manifestInputStream) throws Exception {\r
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
try {\r
- if (mainfestInputStream != null) {\r
+ if (manifestInputStream != null) {\r
DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
- this.mainfestDoc = dombuilder.parse(mainfestInputStream);\r
- parseMainfest();\r
+ this.manifestDoc = dombuilder.parse(manifestInputStream);\r
+ parseManifest();\r
}\r
\r
} catch (Exception e) {\r
}\r
}\r
\r
- public void setManifestFile(File mainfestFile) throws Exception {\r
+ public void setManifestFile(File manifestFile) throws Exception {\r
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
- InputStream is = new FileInputStream(mainfestFile);\r
- this.mainfestDoc = dombuilder.parse(is);\r
+ InputStream is = new FileInputStream(manifestFile);\r
+ this.manifestDoc = dombuilder.parse(is);\r
}\r
\r
public void addPkgToPkgList(PackageIdentification packageId, Set<String> fileFilter) throws Exception {\r
//\r
// Add far files in <FarPlatformList> to list\r
//\r
- NodeList elementList = this.mainfestDoc.getElementsByTagName(farPlatformList);\r
+ NodeList elementList = this.manifestDoc.getElementsByTagName(farPlatformList);\r
for (int i = 0; i < elementList.getLength(); i++) {\r
//\r
// Get <farPlatform> node list.\r
\r
public void hibernateToFile() throws Exception {\r
//\r
- // create mainfest root node\r
+ // create manifest root node\r
//\r
- Element rootNode = this.mainfestDoc.createElement("FrameworkArchiveManifest");\r
- this.mainfestDoc.appendChild(rootNode);\r
+ Element rootNode = this.manifestDoc.createElement("FrameworkArchiveManifest");\r
+ this.manifestDoc.appendChild(rootNode);\r
\r
//\r
- // create mainfest header node\r
+ // create manifest header node\r
//\r
- Element headerNode = this.mainfestDoc.createElement(farHeader);\r
+ Element headerNode = this.manifestDoc.createElement(farHeader);\r
rootNode.appendChild(headerNode);\r
//\r
// Add FarHeader to headerNode.\r
//\r
- Element farName = this.mainfestDoc.createElement(farHeader_FarName);\r
+ Element farName = this.manifestDoc.createElement(farHeader_FarName);\r
farName.setTextContent(this.fhInfo.getFarName());\r
headerNode.appendChild(farName);\r
\r
- Element gv = this.mainfestDoc.createElement(guidValue);\r
+ Element gv = this.manifestDoc.createElement(guidValue);\r
gv.setTextContent(this.fhInfo.getGuidValue());\r
headerNode.appendChild(gv);\r
\r
- Element ver = this.mainfestDoc.createElement(version);\r
+ Element ver = this.manifestDoc.createElement(version);\r
ver.setTextContent(this.fhInfo.getVersion());\r
headerNode.appendChild(ver);\r
\r
- Element abstra = this.mainfestDoc.createElement(farHeader_Abstract);\r
+ Element abstra = this.manifestDoc.createElement(farHeader_Abstract);\r
abstra.setTextContent(this.fhInfo.getAbstractStr());\r
headerNode.appendChild(abstra);\r
\r
- Element descr = this.mainfestDoc.createElement(farHeader_Description);\r
+ Element descr = this.manifestDoc.createElement(farHeader_Description);\r
descr.setTextContent(this.fhInfo.getDescription());\r
headerNode.appendChild(descr);\r
\r
- Element copyright = this.mainfestDoc.createElement(farHeader_CopyRight);\r
+ Element copyright = this.manifestDoc.createElement(farHeader_CopyRight);\r
copyright.setTextContent(this.fhInfo.getCopyright());\r
headerNode.appendChild(copyright);\r
\r
- Element license = this.mainfestDoc.createElement(farHeader_License);\r
+ Element license = this.manifestDoc.createElement(farHeader_License);\r
license.setTextContent(this.fhInfo.getLicense());\r
headerNode.appendChild(license);\r
\r
- Element spec = this.mainfestDoc.createElement(farHeader_Specification);\r
+ Element spec = this.manifestDoc.createElement(farHeader_Specification);\r
spec.setTextContent(this.fhInfo.getSpecification());\r
System.out.println(this.fhInfo.getSpecification());\r
headerNode.appendChild(spec);\r
\r
//\r
- // create mainfest FarPackageList node\r
+ // create manifest FarPackageList node\r
//\r
- Element pkgListNode = this.mainfestDoc.createElement(farPackageList);\r
+ Element pkgListNode = this.manifestDoc.createElement(farPackageList);\r
rootNode.appendChild(pkgListNode);\r
\r
//\r
}\r
\r
//\r
- // create mainfest FarPlatformList node\r
+ // create manifest FarPlatformList node\r
//\r
- Element plfListNode = this.mainfestDoc.createElement(farPlatformList);\r
+ Element plfListNode = this.manifestDoc.createElement(farPlatformList);\r
rootNode.appendChild(plfListNode);\r
\r
//\r
//\r
// Prepare the DOM document for writing\r
//\r
- Source source = new DOMSource(this.mainfestDoc);\r
+ Source source = new DOMSource(this.manifestDoc);\r
//\r
// Prepare the output file, get the Mainifest file name from <FarHeader>\r
// <FarName>.\r
}\r
\r
public void pkgToFarPkgNode(Element parentNode, FarPackage pkgItem) {\r
- Element pkgNode = this.mainfestDoc.createElement(farPackageList_FarPackage);\r
+ Element pkgNode = this.manifestDoc.createElement(farPackageList_FarPackage);\r
//\r
// Add <FarFileName>\r
//\r
//\r
// Add <Contents>\r
//\r
- Element contentNode = this.mainfestDoc.createElement(contents);\r
+ Element contentNode = this.manifestDoc.createElement(contents);\r
Iterator iterator = pkgItem.getContentList().iterator();\r
while (iterator.hasNext()) {\r
ffiToFfNode(contentNode, (FarFileItem) iterator.next());\r
}\r
\r
public void PlfToPlatformNode(Element parentNode, FarPlatformItem fplItem) {\r
- Element fplNode = this.mainfestDoc.createElement(farPlatformList_FarPlatform);\r
+ Element fplNode = this.manifestDoc.createElement(farPlatformList_FarPlatform);\r
//\r
// Add <FarFileName>\r
//\r
}\r
\r
public void ffiToFfNode(Element parentNode, FarFileItem ffi) {\r
- Element farFileName = this.mainfestDoc.createElement(farPackage_FarfileName);\r
+ Element farFileName = this.manifestDoc.createElement(farPackage_FarfileName);\r
farFileName.setTextContent(ffi.getRelativeFilename());\r
System.out.println(farFileName.getTextContent());\r
System.out.println(ffi.getRelativeFilename());\r
}\r
\r
public void setStrItemToNode(Element parentNode, String strValue, String strName) {\r
- Element node = this.mainfestDoc.createElement(strName);\r
+ Element node = this.manifestDoc.createElement(strName);\r
node.setTextContent(strValue);\r
parentNode.appendChild(node);\r
}\r
\r
- private void parseMainfest() {\r
+ private void parseManifest() {\r
\r
//\r
// Parse header\r
//\r
// parse <farPlatformList>\r
//\r
- NodeList ele = this.mainfestDoc.getElementsByTagName(farPlatformList);\r
+ NodeList ele = this.manifestDoc.getElementsByTagName(farPlatformList);\r
Node plfNode;\r
if (ele.getLength() > 0) {\r
//\r
- // Only have one <FarPlatformList> node under mainfest root node.\r
+ // Only have one <FarPlatformList> node under manifest root node.\r
//\r
plfNode = ele.item(0);\r
parseFarPlatformList(plfNode, this.fPlfList);\r
\r
private void parseMfHeader() {\r
Node headerNode;\r
- NodeList ele = this.mainfestDoc.getElementsByTagName(farHeader);\r
+ NodeList ele = this.manifestDoc.getElementsByTagName(farHeader);\r
if (ele.getLength() > 0) {\r
//\r
- // For mainfest file only have one <FarHeader>\r
+ // For manifest file only have one <FarHeader>\r
//\r
headerNode = ele.item(0);\r
} else {\r
\r
public void parseHeaderFarPackageList() {\r
Node farPkgNode;\r
- NodeList ele = this.mainfestDoc.getElementsByTagName(farPackageList);\r
+ NodeList ele = this.manifestDoc.getElementsByTagName(farPackageList);\r
if (ele.getLength() > 0) {\r
//\r
- // For mainfest file only have one <FarHeader>\r
+ // For manifest file only have one <FarHeader>\r
//\r
farPkgNode = ele.item(0);\r
} else {\r