public String getManifestAsString()

in taverna-scufl2-ucfpackage/src/main/java/org/apache/taverna/scufl2/ucfpackage/impl/odfdom/pkg/OdfPackage.java [1156:1244]


	public String getManifestAsString() {
		StringBuilder buf = new StringBuilder();

		buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
		buf.append("<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">\n");

		Iterator<String> it = mManifestList.iterator();
		while (it.hasNext()) {
			String key = it.next();
			String s = null;
			OdfFileEntry fileEntry = mManifestEntries.get(key);
			if (fileEntry != null) {
				buf.append(" <manifest:file-entry");
				s = fileEntry.getMediaType();
				if (s == null)
					s = EMPTY_STRING;
				buf.append(" manifest:media-type=\"");
				buf.append(encodeXMLAttributes(s));
				buf.append("\"");
				s = fileEntry.getPath();

				if (s == null)
					s = EMPTY_STRING;
				buf.append(" manifest:full-path=\"");
				buf.append(encodeXMLAttributes(s));
				buf.append("\"");
				int i = fileEntry.getSize();
				if (i > 0) {
					buf.append(" manifest:size=\"");
					buf.append(i);
					buf.append("\"");
				}
				if (fileEntry.getVersion() != null) {
				    buf.append(" manifest:version=\"");
	                buf.append(encodeXMLAttributes(fileEntry.getVersion()));
	                buf.append("\"");
				}

				EncryptionData enc = fileEntry.getEncryptionData();

				if (enc != null) {
					buf.append(">\n");
					buf.append("  <manifest:encryption-data>\n");
					Algorithm alg = enc.getAlgorithm();
					if (alg != null) {
						buf.append("   <manifest:algorithm");
						s = alg.getName();
						if (s == null)
							s = EMPTY_STRING;
						buf.append(" manifest:algorithm-name=\"");
						buf.append(encodeXMLAttributes(s));
						buf.append("\"");
						s = alg.getInitializationVector();
						if (s == null)
							s = EMPTY_STRING;
						buf.append(" manifest:initialization-vector=\"");
						buf.append(encodeXMLAttributes(s));
						buf.append("\"/>\n");
					}
					KeyDerivation keyDerivation = enc.getKeyDerivation();
					if (keyDerivation != null) {
						buf.append("   <manifest:key-derivation");
						s = keyDerivation.getName();
						if (s == null)
							s = EMPTY_STRING;
						buf.append(" manifest:key-derivation-name=\"");
						buf.append(encodeXMLAttributes(s));
						buf.append("\"");
						s = keyDerivation.getSalt();
						if (s == null)
							s = EMPTY_STRING;
						buf.append(" manifest:salt=\"");
						buf.append(encodeXMLAttributes(s));
						buf.append("\"");

						buf.append(" manifest:iteration-count=\"");
						buf.append(keyDerivation.getIterationCount());
						buf.append("\"/>\n");
					}
					buf.append("  </manifest:encryption-data>\n");
					buf.append(" </manifest:file-entry>\n");
				} else
					buf.append("/>\n");
			}
		}
		buf.append("</manifest:manifest>");

		return buf.toString();
	}