Concatenate files - echo results but no files
Created: 2010-10-28 14:42:17
The split_string_into_string_list_by_regular_expresson outputs an empty list since the string to be split is defaulted to ''. As there are no input values, the create_and_populate_temporary_file generates an empty list.
The create_temporary_file beanshell creates a file to which the concatentation can be written.
The concatenate_files service does not write anything to the temporary output file. Because the displayresults port has been given a default value of 'true', the empty string is also copied to the results port of concatenate_files.
The temporary file to which the results were written is read by the read_text_file service and its contents output.
Both of the workflow outputs contain '' i.e. the empty string.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (3)
Concatenate files - echo results but no files |
Concatenate files - echo results but no files |
Concatenate files - echo results but no files |
Descriptions (1)
The split_string_into_string_list_by_regular_expresson outputs an empty list since the string to be split is defaulted to ''. As there are no input values, the create_and_populate_temporary_file generates an empty list.
The create_temporary_file beanshell creates a file to which the concatentation can be written.
The concatenate_files service does not write anything to the temporary output file. Because the displayresults port has been given a default value of 'true', the empty string is also copied to the results port of concatenate_files.
The temporary file to which the results were written is read by the read_text_file service and its contents output.
Both of the workflow outputs contain '' i.e. the empty string. |
Dependencies (0)
Processors (7)
Name |
Type |
Description |
Create_temporary_file |
beanshell |
ScriptFile f = File.createTempFile("taverna", ".tmp");
filepath = f.getCanonicalPath(); |
Create_and_populate_temporary_file |
beanshell |
ScriptFile f = File.createTempFile("taverna", ".tmp");
BufferedWriter writer = new BufferedWriter(new FileWriter(f));
writer.write(content);
writer.close();
filepath = f.getCanonicalPath(); |
true |
stringconstant |
Valuetrue |
string_list |
stringconstant |
Value |
Split_string_into_string_list_by_regular_expression |
localworker |
ScriptList split = new ArrayList();
if (!string.equals("")) {
String regexString = ",";
if (regex != void) {
regexString = regex;
}
String[] result = string.split(regexString);
for (int i = 0; i < result.length; i++) {
split.add(result[i]);
}
}
|
Concatenate_Files |
localworker |
ScriptBufferedReader getReader (String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
reader = new InputStreamReader (url.openStream());
}
return new BufferedReader(reader);
}
String NEWLINE = System.getProperty("line.separator");
boolean displayResults = false;
if (displayresults != void) {
displayResults = Boolean.valueOf(displayresults).booleanValue();
}
StringBuffer sb = new StringBuffer(2000);
if (outputfile == void) {
throw new RuntimeException("The 'outputfile' parameter cannot be null");
}
if (filelist == null) {
throw new RuntimeException("The 'filelist' parameter cannot be null");
}
String str = null;
Writer writer = new FileWriter(outputfile);
for (int i = 0; i < filelist.size(); i++) {
BufferedReader reader = getReader(filelist.get(i));
while ((str = reader.readLine()) != null) {
writer.write(str);
writer.write(NEWLINE);
if (displayResults) {
sb.append(str);
sb.append(NEWLINE);
}
}
reader.close();
}
writer.flush();
writer.close();
if (displayResults) {
results= sb.toString();
}
|
Read_Text_File |
localworker |
ScriptBufferedReader getReader (String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
reader = new InputStreamReader (url.openStream());
}
return new BufferedReader(reader);
}
StringBuffer sb = new StringBuffer(4000);
BufferedReader in = getReader(fileurl);
String str;
String lineEnding = System.getProperty("line.separator");
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(lineEnding);
}
in.close();
filecontents = sb.toString();
|
Beanshells (2)
Name |
Description |
Inputs |
Outputs |
Create_temporary_file |
|
|
filepath
|
Create_and_populate_temporary_file |
|
content
|
filepath
|
Outputs (2)
Name |
Description |
content_of_outputfile |
|
echoed_concatenation_results |
|
Datalinks (8)
Source |
Sink |
Split_string_into_string_list_by_regular_expression:split |
Create_and_populate_temporary_file:content |
string_list:value |
Split_string_into_string_list_by_regular_expression:string |
Create_and_populate_temporary_file:filepath |
Concatenate_Files:filelist |
true:value |
Concatenate_Files:displayresults |
Create_temporary_file:filepath |
Concatenate_Files:outputfile |
Create_temporary_file:filepath |
Read_Text_File:fileurl |
Read_Text_File:filecontents |
content_of_outputfile |
Concatenate_Files:results |
echoed_concatenation_results |
Coordinations (1)
Controller |
Target |
Concatenate_Files |
Read_Text_File |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (0)
(People/Groups)
None
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment