DataBundles extends Bundles { public static void setWorkflowBundle(Bundle dataBundle, WorkflowBundle wfBundle) throws IOException { Path bundlePath = withExtension(getWorkflow(dataBundle), DOT_WFBUNDLE); checkExistingAnyExtension(bundlePath); try (OutputStream outputStream = newOutputStream(bundlePath)) { getWfBundleIO().writeBundle(wfBundle, outputStream, WFBUNDLE_CONTENT_TYPE); } catch (WriterException e) { throw new IOException("Can't write workflow bundle to: " + bundlePath, e); } Path wfdescPath = getWorkflowDescription(dataBundle); try (OutputStream outputStream = newOutputStream(wfdescPath)) { getWfBundleIO().writeBundle(wfBundle, outputStream, WFDESC_TURTLE); } catch (IllegalArgumentException | WriterException e) { logger.log(Level.WARNING, "Can't write wfdesc to: " + bundlePath, e); delete(wfdescPath); } }  static void createList(Path path); static void deleteAllExtensions(final Path file); static ErrorDocument getError(Path path); static Path getInputs(Bundle dataBundle); static List<Path> getList(Path list); static Path getListItem(Path list, long position); static Path getOutputs(Bundle dataBundle); static Path getPort(Path map, String portName); static NavigableMap<String, Path> getPorts(Path path); static boolean hasInputs(Bundle dataBundle); static boolean hasOutputs(Bundle dataBundle); static boolean isError(Path path); static boolean isList(Path path); static boolean isMissing(Path item); static boolean isValue(Path item); static Path newListItem(Path list); static Path setError(Path path, ErrorDocument error); static Path setError(Path errorPath, String message, String trace,
			Path... causedBy); static Path setReference(Path path, URI reference); static void setStringValue(Path path, String string); static Path getWorkflowRunProvenance(Bundle dataBundle); static Path getWorkflowRunReport(Bundle dataBundle); static JsonNode getWorkflowRunReportAsJson(Bundle dataBundle); static void setWorkflowRunReport(Bundle dataBundle,
			JsonNode workflowRunReport); static Path getWorkflow(Bundle dataBundle); static Path getWorkflowDescription(Bundle dataBundle); static void setWorkflowBundle(Bundle dataBundle,
			WorkflowBundle wfBundle); static WorkflowBundle getWorkflowBundle(Bundle dataBundle); static Path getIntermediates(Bundle dataBundle); static Path getIntermediate(Bundle dataBundle, UUID uuid); static long getListSize(Path list); @SuppressWarnings({ "unchecked", "rawtypes" }) static Object resolve(Path path, ResolveOptions... options); static Stream<T> resolveAsStream(Path path, Class<T> type); static WorkflowBundleIO getWfBundleIO(); static void setWfBundleIO(WorkflowBundleIO wfBundleIO);  }
@Test public void setWorkflowBundle() throws Exception { WorkflowBundleIO wfBundleIO = new WorkflowBundleIO(); WorkflowBundle wfBundle = wfBundleIO.createBundle(); DataBundles.setWorkflowBundle(dataBundle, wfBundle); Path wf = DataBundles.getWorkflow(dataBundle); assertEquals("/workflow.wfbundle", wf.toString()); assertEquals("application/vnd.taverna.scufl2.workflow-bundle", Files.probeContentType(wf)); }