mannie-taverna-scufl 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = Taverna[http://taverna.sourceforge.net] 1 Interaction Gem
2
2
 
3
3
  Authors:: Stian Soiland, David Withers, Emmanuel Tagarira
4
- Version:: 0.6.2
4
+ Version:: 0.7.0
5
5
  Contact:: taverna-hackers@lists.sourceforge.net
6
6
  URL:: http://taverna.sourceforge.net/
7
7
  Licence:: LGPL 3 (See LICENCE or http://www.gnu.org/licenses/lgpl.html)
data/Release_Notes.rdoc CHANGED
@@ -1,8 +1,8 @@
1
- = Version 0.6.2
2
- Released:: Friday, September 11, 2009
3
-
4
- == Bug fixes
5
- - none
1
+ = Version 0.7.0
2
+ Released:: Monday, September 14, 2009
6
3
 
7
4
  == Added Functionality
8
- - Extraction of more metadata for soaplab and biomoby services, and artitrary wsdls.
5
+ - Retrieval of processors directly connected/linked to the given processor.
6
+ === New instance method in Scufl::Model
7
+ get_processor_links(processor)
8
+ === New supporting object Scufl::ProcessorLinks
data/lib/scufl/model.rb CHANGED
@@ -41,11 +41,85 @@ module Scufl # :nodoc:
41
41
  @coordinations = Array.new
42
42
  end
43
43
 
44
- # Retrieve ALL the beanshell processors within the workflow.
44
+ # Retrieve ALL the beanshell processors WITHIN the given workflow model.
45
45
  def beanshells
46
- return get_beanshells(self, [])
46
+ self.all_processors.select { |x| x.type == "beanshell" }
47
47
  end
48
48
 
49
+ # Retrieve ALL processors of that are webservices WITHIN the model.
50
+ def web_services
51
+ self.all_processors.select { |x| x.type =~ /wsdl|soaplab|biomoby/i }
52
+ end
53
+
54
+ # Retrieve ALL processor objects WITHIN the given workflow model.
55
+ def all_processors
56
+ return get_processors(self, [])
57
+ end
58
+
59
+
60
+ # Retrieve ALL the links WITHIN the given workflow model.
61
+ def all_links
62
+ return get_links(self, [])
63
+ end
64
+
65
+ # Retrieve ALL the sinks(outputs) WITHIN the given workflow model.
66
+ def all_sinks
67
+ return get_sinks(self, [])
68
+ end
69
+
70
+ # Retrieve ALL the sources(inputs) WITHIN the given workflow model.
71
+ def all_sources
72
+ return get_sources(self, [])
73
+ end
74
+
75
+ # For the given dataflow, return the beanshells and/or services which
76
+ # have direct links to or from the given processor.
77
+ # == Usage
78
+ # my_processor = model.processor[0]
79
+ # linked_processors = model.get_processors_linked_to(my_processor)
80
+ # processors_feeding_into_my_processor = linked_processors.sources
81
+ # processors_feeding_from_my_processor = linked_processors.sinks
82
+ def get_processor_links(processor)
83
+ return nil unless processor
84
+ proc_links = ProcessorLinks.new
85
+
86
+ # SOURCES
87
+ sources = self.all_links.select { |x| x.sink =~ /#{processor.name}:.+/ }
88
+ proc_links.sources = []
89
+
90
+ # SINKS
91
+ sinks = self.all_links.select { |x| x.source =~ /#{processor.name}:.+/ }
92
+ proc_links.sinks = []
93
+ temp_sinks = []
94
+ sinks.each { |x| temp_sinks << x.sink }
95
+
96
+ # Match links by port into format
97
+ # my_port:name_of_link_im_linked_to:its_port
98
+ sources.each do |connection|
99
+ link = connection.sink
100
+ connected_proc_name = link.split(":")[0]
101
+ my_connection_port = link.split(":")[1]
102
+
103
+ if my_connection_port
104
+ source = my_connection_port << ":" << connection.source
105
+ proc_links.sources << source if source.split(":").size == 3
106
+ end
107
+ end
108
+
109
+ sinks.each do |connection|
110
+ link = connection.source
111
+ connected_proc_name = link.split(":")[0]
112
+ my_connection_port = link.split(":")[1]
113
+
114
+ if my_connection_port
115
+ sink = my_connection_port << ":" << connection.sink
116
+ proc_links.sinks << sink if sink.split(":").size == 3
117
+ end
118
+ end
119
+
120
+ return proc_links
121
+ end
122
+
49
123
  private
50
124
 
51
125
  def get_beanshells(given_model, beans_collected) # :nodoc:
@@ -57,6 +131,46 @@ module Scufl # :nodoc:
57
131
 
58
132
  return beans_collected
59
133
  end
134
+
135
+ def get_processors(given_model, procs_collected) # :nodoc:
136
+ wf_procs = given_model.processors.select { |x| x.type == "workflow" }
137
+ wf_procs.each { |x| get_processors(x.model, procs_collected) if x.model }
138
+
139
+ procs = given_model.processors
140
+ procs.each { |a| procs_collected << a }
141
+
142
+ return procs_collected
143
+ end
144
+
145
+ def get_links(given_model, links_collected) # :nodoc:
146
+ wf_procs = given_model.processors.select { |x| x.type == "workflow" }
147
+ wf_procs.each { |x| get_links(x.model, links_collected) if x.model }
148
+
149
+ links = given_model.links
150
+ links.each { |a| links_collected << a }
151
+
152
+ return links_collected
153
+ end
154
+
155
+ def get_sinks(given_model, sinks_collected) # :nodoc:
156
+ wf_procs = given_model.processors.select { |x| x.type == "workflow" }
157
+ wf_procs.each { |x| get_sinks(x.model, sinks_collected) if x.model }
158
+
159
+ sinks = given_model.sinks
160
+ sinks.each { |a| sinks_collected << a }
161
+
162
+ return sinks_collected
163
+ end
164
+
165
+ def get_sources(given_model, sources_collected) # :nodoc:
166
+ wf_procs = given_model.processors.select { |x| x.type == "workflow" }
167
+ wf_procs.each { |x| get_sources(x.model, sources_collected) if x.model }
168
+
169
+ sources = given_model.sources
170
+ sources.each { |a| sources_collected << a }
171
+
172
+ return sources_collected
173
+ end
60
174
  end
61
175
 
62
176
 
@@ -110,6 +224,24 @@ module Scufl # :nodoc:
110
224
  end
111
225
 
112
226
 
227
+
228
+ # This object is returned after invoking model.get_processor_links(processor)
229
+ # . The object contains two lists of processors. Each element consists of:
230
+ # the input or output port the processor uses as a link, the name of the
231
+ # processor being linked, and the port of the processor used for the linking,
232
+ # all seperated by a colon (:) i.e.
233
+ # my_port:name_of_processor:processor_port
234
+ class ProcessorLinks
235
+ # The processors whose output is fed as input into the processor used in
236
+ # model.get_processors_linked_to(processor).
237
+ attr_accessor :sources
238
+
239
+ # A list of processors that are fed the output from the processor (used in
240
+ # model.get_processors_linked_to(processor) ) as input.
241
+ attr_accessor :sinks
242
+ end
243
+
244
+
113
245
 
114
246
  # This contains basic descriptive information about the workflow model.
115
247
  class WorkflowDescription
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mannie-taverna-scufl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Withers
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire: baclava, client, document, scufl
10
10
  bindir: bin
11
11
  cert_chain:
12
- date: 2009-09-11 00:00:00 -07:00
12
+ date: 2009-09-14 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,6 @@ files:
65
65
  - Release_Notes.rdoc
66
66
  has_rdoc: true
67
67
  homepage: http://www.mygrid.org.uk/
68
- licenses:
69
68
  post_install_message:
70
69
  rdoc_options:
71
70
  - -N
@@ -89,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
88
  requirements: []
90
89
 
91
90
  rubyforge_project:
92
- rubygems_version: 1.3.5
91
+ rubygems_version: 1.2.0
93
92
  signing_key:
94
93
  specification_version: 1
95
94
  summary: Support for interacting with the Taverna workflow system (Scufl).