- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.writeBundle()
方法的一些代码示例,展示了WorkflowBundleIO.writeBundle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowBundleIO.writeBundle()
方法的具体详情如下:
包路径:org.apache.taverna.scufl2.api.io.WorkflowBundleIO
类名称:WorkflowBundleIO
方法名:writeBundle
[英]Write a WorkflowBundle
to a file with specified media type.
Scufl2Tools#setParents(WorkflowBundle) will be called on the bundle to ensure everything contained by the bundle has it as an ancestor.
[中]将WorkflowBundle
写入具有指定媒体类型的文件。
Scufl2Tools#setParents(WorkflowBundle)将在包上被调用,以确保包中包含的所有内容都将其作为祖先。
代码示例来源:origin: org.apache.taverna.language/taverna-databundle
public static void setWorkflowBundle(Bundle dataBundle,
WorkflowBundle wfBundle) throws IOException {
Path bundlePath = withExtension(getWorkflow(dataBundle), DOT_WFBUNDLE);
checkExistingAnyExtension(bundlePath);
// TODO: Save as nested folder?
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);
}
// wfdesc
Path wfdescPath = getWorkflowDescription(dataBundle);
try (OutputStream outputStream = newOutputStream(wfdescPath)) {
getWfBundleIO().writeBundle(wfBundle, outputStream, WFDESC_TURTLE);
} catch (IllegalArgumentException | WriterException e) {
logger.warn("Can't write wfdesc to: " + bundlePath, e);
delete(wfdescPath);
// throw new IOException("Can't write wfdesc to: " + bundlePath, e);
}
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Test(expected = IOException.class)
public void writeBundleWrongLocation() throws Exception {
File bundleDir = tempFile();
bundleDir.delete();
File bundleFile = new File(bundleDir, "nonExistingDir");
bundleIO.writeBundle(wfBundle, bundleFile,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Test
public void writeBundleStream() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
bundleIO.writeBundle(wfBundle, output, TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
String bundleTxt = new String(output.toByteArray(), UTF_8);
String getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle();
bundleTxt = bundleTxt.replaceAll("\r", "").replaceAll("\n", "");
getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle.replaceAll("\r", "").replaceAll("\n", "");
assertEquals(getStructureFormatWorkflowBundle, bundleTxt);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Test
public void writeBundleFile() throws Exception {
File bundleFile = tempFile();
bundleIO.writeBundle(wfBundle, bundleFile,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
String bundleTxt = FileUtils.readFileToString(bundleFile, UTF_8);
String getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle();
bundleTxt = bundleTxt.replaceAll("\r", "").replaceAll("\n", "");
getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle.replaceAll("\r", "").replaceAll("\n", "");
assertEquals(getStructureFormatWorkflowBundle, bundleTxt);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Test
public void readToWriteRoundTrip() throws Exception {
InputStream inputStream = new ByteArrayInputStream(
getStructureFormatWorkflowBundle().getBytes("utf-8"));
WorkflowBundle readBundle = bundleIO.readBundle(inputStream,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
ByteArrayOutputStream output = new ByteArrayOutputStream();
bundleIO.writeBundle(readBundle, output, TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
String bundleTxt = new String(output.toByteArray(), UTF_8);
String getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle();
bundleTxt = bundleTxt.replaceAll("\r", "").replaceAll("\n", "");
getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle.replaceAll("\r", "").replaceAll("\n", "");
assertEquals(getStructureFormatWorkflowBundle, bundleTxt);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-wfbundle
@Test
public void writeBundleToStream() throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
bundleIO.writeBundle(workflowBundle, outStream,
APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
outStream.close();
InputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
UCFPackage ucfPackage;
try {
// Avoid UCFPackage from creating a temporary file
System.setProperty("org.odftoolkit.odfdom.tmpfile.disable", "true");
ucfPackage = new UCFPackage(inStream);
} finally {
System.clearProperty("org.odftoolkit.odfdom.tmpfile.disable");
}
verifyPackageStructure(ucfPackage);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Test(expected = IllegalArgumentException.class)
public void writeBundleUnknownMediaType() throws Exception {
File bundleFile = tempFile();
bundleIO.writeBundle(wfBundle, bundleFile,
"application/vnd.example.unknownStuff");
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-wfbundle
@Ignore
@Test
public void testParsedWorkflow() throws Exception {
assertEquals("HelloWorld", workflowBundle.getName());
ByteArrayOutputStream output = new ByteArrayOutputStream();
bundleIO.writeBundle(workflowBundle, output,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
String bundleTxt = new String(output.toByteArray(), "UTF-8");
assertEquals(testWorkflowBundleIO.getStructureFormatWorkflowBundle(),
bundleTxt);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-t2flow
@Test
public void readSimpleWorkflow() throws Exception {
URL wfResource = getClass().getResource(AS_T2FLOW);
assertNotNull("Could not find workflow " + AS_T2FLOW, wfResource);
WorkflowBundle wfBundle = io.readBundle(wfResource,
APPLICATION_VND_TAVERNA_T2FLOW_XML);
Profile profile = wfBundle.getMainProfile();
assertEquals(1, wfBundle.getProfiles().size());
assertEquals(profile,
wfBundle.getProfiles().getByName("taverna-2.1.0"));
String report = IOUtils.toString(getClass().getResourceAsStream("/as.txt"));
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
io.writeBundle(wfBundle, byteStream, StructureReader.TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
String byteStreamTtoString = byteStream.toString("utf-8");
report = report.replaceAll("\r", "").replaceAll("\n", "");
byteStreamTtoString = byteStreamTtoString.replaceAll("\r", "").replaceAll("\n", "");
assertEquals(report, byteStreamTtoString);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-t2flow
@Test
public void readSemanticAnnotations() throws Exception {
URL wfResource = getClass().getResource(SEMANTIC_ANNOTATIONS);
assertNotNull("Could not find workflow " + SEMANTIC_ANNOTATIONS, wfResource);
T2FlowParser parser = new T2FlowParser();
parser.setValidating(true);
parser.setStrict(false);
WorkflowBundle wfBundle = parser.parseT2Flow(wfResource.openStream());
assertEquals(4, wfBundle.getAnnotations().size());
for (Annotation x : wfBundle.getAnnotations()) {
System.out.println(x.getTarget());
// System.out.println(x.getBodyStatements().get(0));
}
File f = File.createTempFile("annotation", ".wfbundle");
System.err.println(f);
new WorkflowBundleIO().writeBundle(wfBundle, f, "application/vnd.taverna.scufl2.workflow-bundle");
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-wfbundle
@Test
public void writeBundleToFile() throws Exception {
File bundleFile = tempFile();
bundleIO.writeBundle(workflowBundle, bundleFile,
APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
UCFPackage ucfPackage = new UCFPackage(bundleFile);
verifyRootFile(ucfPackage);
verifyPackageStructure(ucfPackage);
// TODO: Check RDF/XML using xpath
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-wfbundle
@Test
public void differentMediaType() throws Exception {
UCFPackage resources = originalBundle.getResources();
resources.setPackageMediaType("application/x-something-else");
assertEquals("application/x-something-else", resources.getPackageMediaType());
resources.addResource("Hello there", "hello.txt", "text/plain");
File bundleFile = tempFile();
bundleIO.writeBundle(originalBundle, bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
assertEquals("application/x-something-else", resources.getPackageMediaType());
assertEquals(0, resources.getRootFiles().size());
// RDFXMLWriter does not touch the rootFile or media type if it's non-null
ZipFile zipFile = new ZipFile(bundleFile);
ZipEntry hello = zipFile.getEntry("hello.txt");
assertEquals("hello.txt", hello.getName());
assertEquals("Hello there",
IOUtils.toString(zipFile.getInputStream(hello), "ASCII"));
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-wfbundle
@Test
public void singleFile() throws Exception {
UCFPackage resources = originalBundle.getResources();
assertEquals(APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE, resources.getPackageMediaType());
resources.addResource("Hello there", "hello.txt", "text/plain");
File bundleFile = tempFile();
bundleIO.writeBundle(originalBundle, bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
assertEquals(APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE, resources.getPackageMediaType());
assertEquals(1, resources.getRootFiles().size());
assertEquals("workflowBundle.rdf", resources.getRootFiles().get(0).getPath());
ZipFile zipFile = new ZipFile(bundleFile);
ZipEntry hello = zipFile.getEntry("hello.txt");
assertEquals("hello.txt", hello.getName());
assertEquals("Hello there",
IOUtils.toString(zipFile.getInputStream(hello), "ASCII"));
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Test
public void configurationReadTwice() throws Exception {
InputStream inputStream = new ByteArrayInputStream(
getStructureFormatWorkflowBundle().getBytes("utf-8"));
WorkflowBundle readBundle = bundleIO.readBundle(inputStream,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
assertEquals(1, readBundle.getMainProfile().getConfigurations().size());
new Scufl2Tools().setParents(readBundle);
assertEquals(1, readBundle.getMainProfile().getConfigurations().size());
ByteArrayOutputStream output = new ByteArrayOutputStream();
bundleIO.writeBundle(readBundle, output, TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
assertEquals(1, readBundle.getMainProfile().getConfigurations().size());
String bundleTxt = new String(output.toByteArray(), UTF_8);
String getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle();
bundleTxt = bundleTxt.replaceAll("\r", "").replaceAll("\n", "");
getStructureFormatWorkflowBundle = getStructureFormatWorkflowBundle.replaceAll("\r", "").replaceAll("\n", "");
assertEquals(getStructureFormatWorkflowBundle, bundleTxt);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-wfbundle
@Test
public void awkwardFilenames() throws Exception {
workflowBundle.getProfiles().removeByName("tavernaServer");
String funnyName = "Funny_%2f_characters_50%_of the time";
workflowBundle.getMainProfile().setName(funnyName);
workflowBundle.getMainWorkflow().setName(funnyName);
File bundleFile = tempFile();
bundleIO.writeBundle(workflowBundle, bundleFile,
APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
UCFPackage ucfPackage = new UCFPackage(bundleFile);
Map<String, ResourceEntry> profiles = ucfPackage.listResources("profile");
assertEquals(2, profiles.size());
assertTrue(profiles.keySet().contains("Funny_%252f_characters_50%25_of%20the%20time.rdf"));
assertTrue(profiles.keySet().contains("Funny_%252f_characters_50%25_of%20the%20time/"));
Map<String, ResourceEntry> workflows = ucfPackage.listResources("workflow");
assertEquals(1, workflows.size());
assertEquals("Funny_%252f_characters_50%25_of%20the%20time.rdf", workflows.keySet().iterator().next());
// and.. can we read it in again correctly?
WorkflowBundle readBundle = bundleIO.readBundle(bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
assertEquals(funnyName, readBundle.getMainProfile().getName());
assertEquals(funnyName, readBundle.getMainWorkflow().getName());
// did the JSON parse back in?
JsonNode oldJson = workflowBundle.getMainProfile().getConfigurations().getByName("Hello").getJson();
assertTrue(oldJson.get("script").asText().startsWith("hello"));
JsonNode newJson = readBundle.getMainProfile().getConfigurations().getByName("Hello").getJson();
assertTrue(newJson.get("script").asText().startsWith("hello"));
assertEquals(oldJson, newJson);
}
代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api
@Ignore
@Test
public void writeBundleFileSetParents() throws Exception {
File bundleFile = tempFile();
// Deliberately orphan a profile and a processor
Profile profile = wfBundle.getProfiles().getByName("tavernaWorkbench");
profile.setParent(null);
wfBundle.getProfiles().add(profile);
processor.setParent(null);
workflow.getProcessors().add(processor);
assertNull(processor.getParent());
assertNull(profile.getParent());
bundleIO.writeBundle(wfBundle, bundleFile,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
assertNotNull(processor.getParent());
assertNotNull(profile.getParent());
String bundleTxt = FileUtils.readFileToString(bundleFile, UTF_8);
assertTrue(bundleTxt.contains("Processor 'Hello'"));
assertTrue(bundleTxt.contains("Profile 'tavernaWorkbench'"));
}
本文整理了Java中net.sf.taverna.zaria.ZBasePane类的一些代码示例,展示了ZBasePane类的具体用法。这些代码示例主要来源于Github/Stackoverflow/
本文整理了Java中net.sf.taverna.t2.workflowmodel.WorkflowStructureException类的一些代码示例,展示了WorkflowStructureExc
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO类的一些代码示例,展示了WorkflowBundleIO类的具体用法。这些代码示例
本文整理了Java中net.sf.taverna.zaria.ZBasePane.lockFrame()方法的一些代码示例,展示了ZBasePane.lockFrame()的具体用法。这些代码示例主要
本文整理了Java中net.sf.taverna.zaria.ZBasePane.configure()方法的一些代码示例,展示了ZBasePane.configure()的具体用法。这些代码示例主要
本文整理了Java中net.sf.taverna.zaria.ZBasePane.getToggleEditAction()方法的一些代码示例,展示了ZBasePane.getToggleEditAc
本文整理了Java中net.sf.taverna.zaria.ZBasePane.setEditable()方法的一些代码示例,展示了ZBasePane.setEditable()的具体用法。这些代码
本文整理了Java中net.sf.taverna.zaria.ZBasePane.getElement()方法的一些代码示例,展示了ZBasePane.getElement()的具体用法。这些代码示例
本文整理了Java中net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView类的一些代码示例,展示了WorkflowView类的具体用法。这些代
本文整理了Java中net.sf.taverna.t2.workflowmodel.serialization.xml.XMLDeserializerImpl类的一些代码示例,展示了XMLDeseri
本文整理了Java中net.sf.taverna.t2.workflowmodel.WorkflowStructureException.()方法的一些代码示例,展示了WorkflowStructur
本文整理了Java中net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializerImpl类的一些代码示例,展示了XMLSerializ
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.getReaders()方法的一些代码示例,展示了WorkflowBundleI
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.getReaderForMediaType()方法的一些代码示例,展示了Work
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.()方法的一些代码示例,展示了WorkflowBundleIO.()的具体用法。
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.createBundle()方法的一些代码示例,展示了WorkflowBundl
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.writeBundle()方法的一些代码示例,展示了WorkflowBundle
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.guessMediaTypeForSignature()方法的一些代码示例,展示
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.readBundle()方法的一些代码示例,展示了WorkflowBundleI
本文整理了Java中org.apache.taverna.scufl2.api.io.WorkflowBundleIO.getWriters()方法的一些代码示例,展示了WorkflowBundleI
我是一名优秀的程序员,十分优秀!