当前位置: 首页>>代码示例>>Java>>正文


Java Bundle类代码示例

本文整理汇总了Java中org.apache.taverna.robundle.Bundle的典型用法代码示例。如果您正苦于以下问题:Java Bundle类的具体用法?Java Bundle怎么用?Java Bundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Bundle类属于org.apache.taverna.robundle包,在下文中一共展示了Bundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filesOverLimit

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
/**
 * Test file size limit
 */
@Test
public void filesOverLimit() throws Exception {

    // RO details
    GitDetails lobSTRdraft3RoDetails = new GitDetails("https://github.com/common-workflow-language/workflows.git",
            "933bf2a1a1cce32d88f88f136275535da9df0954", "lobstr-draft3/");

    // Create new RO bundle
    Bundle bundle = roBundleServiceZeroSizeLimit.createBundle(lobSTRdraft3, lobSTRdraft3RoDetails);

    Manifest manifest = bundle.getManifest();

    // Check files are externally linked in the aggregate
    assertEquals(14, manifest.getAggregates().size());

    PathMetadata urlAggregate = manifest.getAggregation(
            new URI("https://w3id.org/cwl/view/git/933bf2a1a1cce32d88f88f136275535da9df0954/lobstr-draft3/models/illumina_v3.pcrfree.stepmodel?format=raw"));
    assertEquals("Mark Robinson", urlAggregate.getAuthoredBy().get(0).getName());

}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:24,代码来源:ROBundleServiceTest.java

示例2: createWorkflowRO

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
/**
 * Creates a new Workflow Research Object Bundle from Git details
 * and saves it to a file
 * @param workflow The workflow to generate a RO bundle for
 * @throws IOException Any API errors which may have occurred
 */
@Async
public void createWorkflowRO(Workflow workflow)
        throws IOException, InterruptedException {
    logger.info("Creating Research Object Bundle");

    // Get the whole containing folder, not just the workflow itself
    GitDetails githubInfo = workflow.getRetrievedFrom();
    GitDetails roDetails = new GitDetails(githubInfo.getRepoUrl(), githubInfo.getBranch(),
            FilenameUtils.getPath(githubInfo.getPath()));

    // Create a new Research Object Bundle
    Bundle bundle = roBundleService.createBundle(workflow, roDetails);

    // Save the bundle to the storage location in properties
    Path bundleLocation = roBundleService.saveToFile(bundle);

    // Add RO Bundle to associated workflow model
    workflow.setRoBundlePath(bundleLocation.toString());
    workflowRepository.save(workflow);
    logger.info("Finished saving Research Object Bundle");
}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:28,代码来源:ROBundleFactory.java

示例3: openInputBundle

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
private Bundle openInputBundle(CommandLineOptions options) throws IOException {
	if (! options.hasInputBundle()) {
		return DataBundles.createBundle();
	} 
	Path inputBundlePath = Paths.get(options.getInputBundle());
	if (! Files.isReadable(inputBundlePath)) {
		throw new IOException("Can't read inputbundle: " + inputBundlePath);
	}
	if (options.hasSaveResultsToBundle() && 
			safeIsSameFile(inputBundlePath, Paths.get(options.getSaveResultsToBundle()))) {
		// Note: It is valid to do -bundle same.zip -inputbundle same.zip, 
		// in which case we should NOT open it as readOnly, as that
		// might make a copy unnecessarily. In case of symlinks we'll use the
		// path from -bundle to avoid double-opening later
		return DataBundles.openBundle(Paths.get(options.getSaveResultsToBundle()));				
	} else {			
		return DataBundles.openBundleReadOnly(inputBundlePath);
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-commandline,代码行数:20,代码来源:InputsHandler.java

示例4: LocalExecution

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
/**
 * Constructs an Execution for executing Taverna workflows on a local
 * Taverna Dataflow Engine.
 * 
 * @param workflowBundle
 *            the <code>WorkflowBundle</code> containing the
 *            <code>Workflow</code>s required for execution
 * @param workflow
 *            the <code>Workflow</code> to execute
 * @param profile
 *            the <code>Profile</code> to use when executing the
 *            <code>Workflow</code>
 * @param dataBundle
 *            the <code>Bundle</code> containing the data values for the
 *            <code>Workflow</code>
 * @param referenceService
 *            the <code>ReferenceService</code> used to register inputs,
 *            outputs and intermediate values
 * @throws InvalidWorkflowException
 *             if the specified workflow is invalid
 */
public LocalExecution(WorkflowBundle workflowBundle, Workflow workflow,
		Profile profile, Bundle dataBundle,
		ReferenceService referenceService, Edits edits,
		ActivityService activityService,
		DispatchLayerService dispatchLayerService)
		throws InvalidWorkflowException {
	super(workflowBundle, workflow, profile, dataBundle);
	this.referenceService = referenceService;
	try {
		mapping = new WorkflowToDataflowMapper(workflowBundle, profile,
				edits, activityService, dispatchLayerService);
		Dataflow dataflow = mapping.getDataflow(workflow);
		for (DataflowInputPort dataflowInputPort : dataflow.getInputPorts())
			inputPorts.put(dataflowInputPort.getName(), dataflowInputPort);
		facade = edits.createWorkflowInstanceFacade(dataflow,
				createContext(), "");
		executionMonitor = new LocalExecutionMonitor(getWorkflowReport(),
				getDataBundle(), mapping, facade.getIdentifier());
	} catch (InvalidDataflowException e) {
		throw new InvalidWorkflowException(e);
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:44,代码来源:LocalExecution.java

示例5: open

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Override
public String open(Path runFile) throws IOException {
	try {
		String runID = runFile.getFileName().toString();
		int dot = runID.indexOf('.');
		if (dot > 0)
			runID = runID.substring(0, dot);
		if (!runMap.containsKey(runID)) {
			Bundle bundle = DataBundles.openBundle(runFile);
			Run run = new Run(runID, bundle);
			runMap.put(run.getID(), run);
		}
		postEvent(RUN_OPENED, runID);
		return runID;
	} catch (ReaderException | ParseException e) {
		throw new IOException("Error opening file " + runFile, e);
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:19,代码来源:RunServiceImpl.java

示例6: exampleBundle

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Before
public void exampleBundle() throws IOException {
	Path source;
	try (Bundle bundle = Bundles.createBundle()) {
		source = bundle.getSource();
		Path r = bundle.getRoot();
		Files.createFile(r.resolve("hello.txt"));
		Path f = r.resolve("f");
		Files.createDirectory(f);
		Files.createFile(f.resolve("file3.txt"));
		Files.createFile(f.resolve("file2.txt"));
		Files.createFile(f.resolve("file1.txt"));

		Path nested = f.resolve("nested");
		Files.createDirectory(nested);
		Files.createFile(nested.resolve("file1.txt"));

		Files.createDirectory(nested.resolve("empty"));
		bundle.setDeleteOnClose(false);
	}
	bundle = Bundles.openBundle(source);
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:23,代码来源:TestManifest.java

示例7: openHelloWorld

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Test
public void openHelloWorld() throws Exception {
	URL helloworld = getClass().getResource("/helloworld.wfbundle");
	assertNotNull(helloworld);
	try (Bundle bundle = Bundles.openBundle(helloworld)) {
		assertEquals("application/vnd.taverna.scufl2.workflow-bundle",
				Bundles.getMimeType(bundle));
		Path t2flow = bundle
				.getPath("history/8781d5f4-d0ba-48a8-a1d1-14281bd8a917.t2flow");
		assertEquals("application/vnd.taverna.t2flow+xml", bundle
				.getManifest().getAggregation(t2flow).getMediatype());
		Path manifestRdf = bundle.getPath("META-INF/manifest.xml");
		assertTrue(Files.exists(manifestRdf));
		assertTrue(bundle.getManifest().getManifest().contains(manifestRdf));
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:17,代码来源:TestODFManifest.java

示例8: runWorkflow

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
private void runWorkflow(WorkflowBundle workflowBundle, Profile profile,
		ExecutionEnvironment executionEnvironment, Bundle workflowInputs) {
	try {
		RunProfile runProfile = createRunProfile(workflowBundle, profile,
				executionEnvironment, workflowInputs);
		if (runProfile != null) {
			String runId = runService.createRun(runProfile);
			runService.start(runId);
		}
	} catch (InvalidWorkflowException | RunProfileException | InvalidRunIdException
			| RunStateException | InvalidExecutionIdException e) {
		String message = "Could not run workflow " + workflowBundle.getName();
		logger.warn(message, e);
		InvalidDataflowReport.showErrorDialog(e.getMessage(), message);
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:17,代码来源:RunWorkflowAction.java

示例9: safeMove

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Test
public void safeMove() throws Exception {
	Path tmp = Files.createTempDirectory("test");
	tmp.toFile().deleteOnExit();
	Path f1 = tmp.resolve("f1");
	f1.toFile().deleteOnExit();
	Files.createFile(f1);
	assertFalse(isEmpty(tmp));

	try (Bundle db = Bundles.createBundle()) {
		Path f2 = db.getRoot().resolve("f2");
		Bundles.safeMove(f1, f2);
		assertFalse(Files.exists(f1));
		assertTrue(isEmpty(tmp));
		assertEquals(Arrays.asList("f2", "mimetype"), ls(db.getRoot()));
	}

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:19,代码来源:TestBundles.java

示例10: safeCopy

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Test
public void safeCopy() throws Exception {
	Path tmp = Files.createTempDirectory("test");
	tmp.toFile().deleteOnExit();
	Path f1 = tmp.resolve("f1");
	f1.toFile().deleteOnExit();
	Files.createFile(f1);
	assertFalse(isEmpty(tmp));

	try (Bundle db = Bundles.createBundle()) {
		Path f2 = db.getRoot().resolve("f2");
		Bundles.safeCopy(f1, f2);
		assertTrue(Files.exists(f1));
		assertTrue(Files.exists(f2));
		assertEquals(Arrays.asList("f2", "mimetype"), ls(db.getRoot()));
	}

}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:19,代码来源:TestBundles.java

示例11: setReference

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Test
public void setReference() throws Exception {
	try (Bundle bundle = Bundles.createBundle()) {

		Path ref = bundle.getRoot().resolve("ref");
		Bundles.setReference(ref, URI.create("http://example.org/test"));

		URI uri = URI.create("http://example.org/test");
		Path f = Bundles.setReference(ref, uri);
		assertEquals("ref.url", f.getFileName().toString());
		assertEquals(bundle.getRoot(), f.getParent());
		assertFalse(Files.exists(ref));

		List<String> uriLines = Files.readAllLines(f,
				Charset.forName("ASCII"));
		assertEquals(3, uriLines.size());
		assertEquals("[InternetShortcut]", uriLines.get(0));
		assertEquals("URL=http://example.org/test", uriLines.get(1));
		assertEquals("", uriLines.get(2));
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:22,代码来源:TestBundles.java

示例12: saveToFile

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
/**
 * Save the Research Object Bundle to disk
 * @param roBundle The bundle to be saved
 * @return The path to the research object
 * @throws IOException Any errors in saving
 */
public Path saveToFile(Bundle roBundle) throws IOException {
    String fileName = "bundle-" + java.util.UUID.randomUUID() + ".zip";
    Path bundleLocation = Files.createFile(bundleStorage.resolve(fileName));
    Bundles.closeAndSaveBundle(roBundle, bundleLocation);
    return bundleLocation;
}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:13,代码来源:ROBundleService.java

示例13: addAggregation

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
/**
 * Add an aggregation to the Research Object Bundle
 * @param roBundle The bundle to add to
 * @param fileName The file name of the aggregation
 * @param manifestAnnotations The list of manifest aggregations
 * @param content The identifier for the resource containing the
 *                body of the annotation
 * @throws IOException Errors accessing the bundle
 */
private void addAggregation(Bundle roBundle,
                            List<PathAnnotation> manifestAnnotations,
                            String fileName,
                            String content) throws IOException {
    Path annotations = Bundles.getAnnotations(roBundle);
    Path packedPath = annotations.resolve(fileName);
    Bundles.setStringValue(packedPath, content);
    PathAnnotation packedFile = new PathAnnotation();
    packedFile.setContent(packedPath);
    packedFile.setAbout(roBundle.getManifest().getId());
    packedFile.generateAnnotationId();
    manifestAnnotations.add(packedFile);
}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:23,代码来源:ROBundleService.java

示例14: registerInputs

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
public Bundle registerInputs(Map<String, InputWorkflowPort> portMap,
		CommandLineOptions options) throws InvalidOptionException,
		ReadInputException, IOException {
	
	Bundle inputDataBundle = openInputBundle(options);
	if (Boolean.getBoolean("debug.bundle")) {
		inputDataBundle.setDeleteOnClose(false);
		System.out.println("Bundle: " + inputDataBundle.getSource());
	}
	
	Path inputs = DataBundles.getInputs(inputDataBundle);

	URL url;
	try {
		url = new URL("file:");
	} catch (MalformedURLException e1) {
		// Should never happen, but just in case:
		throw new ReadInputException(
				"The was an internal error setting up the URL to open the inputs. You should contact Taverna support.",
				e1);
	}

	if (options.hasInputFiles()) {
		regesterInputsFromFiles(portMap, options, inputs, url);
	}

	if (options.hasInputValues()) {
		registerInputsFromValues(portMap, options, inputs);

	}

	return inputDataBundle;
}
 
开发者ID:apache,项目名称:incubator-taverna-commandline,代码行数:34,代码来源:InputsHandler.java

示例15: createExecutionImpl

import org.apache.taverna.robundle.Bundle; //导入依赖的package包/类
@Override
protected Execution createExecutionImpl(WorkflowBundle workflowBundle,
		Workflow workflow, Profile profile, Bundle dataBundle)
		throws InvalidWorkflowException {
	return new LocalExecution(workflowBundle, workflow, profile,
			dataBundle, referenceService, edits, activityService,
			dispatchLayerService);
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:9,代码来源:LocalExecutionService.java


注:本文中的org.apache.taverna.robundle.Bundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。