private void readAndProcessArchive() throws IOException,
XmlPullParserException {
shouldDeleteArchiveFileOnCompletion = false;
zipFile = new ZipFile(file);
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser parser = factory.newPullParser();
InputStream manifestIn = openEntry(zipFile, MANIFEST_FILE_NAME);
parser.setInput(manifestIn, ENCODING);
parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, ARCHIVE_ELEM);
if (!FILE_TYPE_ARCHIVE
.equals(parser.getAttributeValue(null, TYPE_ATTR)))
error("expected archive of type " + FILE_TYPE_ARCHIVE);
parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, EXPORTED_TAG);
owner = parser.getAttributeValue(null, OWNER_ATTR);
exportTimestamp = XMLUtils.parseDate(parser.getAttributeValue(null,
WHEN_ATTR));
ImportedDefectManager.closeDefects(prefix);
ImportedTimeLogManager.getInstance().closeTimeLogs(prefix);
ImportedEVManager.getInstance().closeTaskLists(prefix);
defns = new HashMap();
Map<String, String> packageIDs = new HashMap<String, String>();
while (parser.next() != XmlPullParser.END_DOCUMENT) {
if (parser.getEventType() == XmlPullParser.START_TAG) {
if (PACKAGE_ELEM.equals(parser.getName())) {
String id = parser.getAttributeValue(null, PACKAGE_ID_ATTR);
String version = parser.getAttributeValue(null, VERSION_ATTR);
packageIDs.put(id, version);
} else if (FILE_ELEM.equals(parser.getName())) {
String name = parser.getAttributeValue(null, FILE_NAME_ATTR);
String type = parser.getAttributeValue(null, TYPE_ATTR);
String version = parser.getAttributeValue(null, VERSION_ATTR);
readFile(zipFile, name, type, version);
}
}
}