public void readManifestXML()

in taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/odf/ODFManifest.java [201:242]


	public void readManifestXML() throws IOException {
		Path manifestXml = manifestXmlPath(bundle);
		Manifest odfManifest;
		try (InputStream inStream = newInputStream(manifestXml)) {
			JAXBElement<Manifest> element = (JAXBElement<Manifest>) createUnMarshaller().unmarshal(inStream);
			odfManifest = element.getValue();
		} catch (JAXBException e) {
			// logger.warning("Could not parse " + manifestXml);
			throw new IOException("Could not parse " + manifestXml, e);
		}
		if (!manifest.getManifest().contains(manifestXml))
			manifest.getManifest().add(manifestXml);
		for (FileEntry f : odfManifest.getFileEntry()) {
			Path path = bundle.getRoot().resolve(f.getFullPath());
			if (!exists(path)) {
				logger.warning(MANIFEST_XML + " listed " + path
						+ ", but it does not exist in bundle");
				continue;
			}
			PathMetadata metadata = manifest.getAggregation(path);
			if (f.getMediaType() != null && f.getMediaType().contains("/"))
				metadata.setMediatype(f.getMediaType());
			if (f.getEncryptionData() != null) {
				logger.warning("Unsupported encryption for " + path);
				continue;
			}
			try {
				if (f.getVersion() != null)
					metadata.setConformsTo(new URI(f.getVersion()));
			} catch (URISyntaxException e) {
				logger.warning("Ignoring unsupported version " + f.getVersion());
			}
			if (isRegularFile(path) && f.getSize() != null) {
				long actualSize = size(path);
				long expectedSize = f.getSize().longValue();
				if (expectedSize != actualSize)
					logger.warning("Wrong file size for " + path
							+ ", expected: " + expectedSize + ", actually: "
							+ actualSize);
			}
		}
	}