ruote 0.9.18 → 0.9.19
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +2 -0
- data/examples/about_state.rb +29 -29
- data/examples/bigflow.rb +9 -9
- data/examples/csv_weather.rb +4 -4
- data/examples/engine_template.rb +141 -129
- data/examples/flowtracing.rb +8 -8
- data/examples/homeworkreview.rb +15 -15
- data/examples/kotoba.rb +9 -9
- data/examples/mano_tracker.rb +63 -63
- data/examples/openwferu.rb +22 -20
- data/examples/quotereporter.rb +79 -79
- data/lib/openwfe/contextual.rb +72 -72
- data/lib/openwfe/def.rb +21 -21
- data/lib/openwfe/engine.rb +19 -19
- data/lib/openwfe/engine/engine.rb +578 -614
- data/lib/openwfe/engine/expool_methods.rb +144 -115
- data/lib/openwfe/engine/file_persisted_engine.rb +77 -77
- data/lib/openwfe/engine/participant_methods.rb +96 -96
- data/lib/openwfe/engine/status_methods.rb +271 -247
- data/lib/openwfe/engine/update_exp_methods.rb +69 -69
- data/lib/openwfe/exceptions.rb +25 -25
- data/lib/openwfe/expool/errorjournal.rb +334 -348
- data/lib/openwfe/expool/expool_pause_methods.rb +98 -0
- data/lib/openwfe/expool/expressionpool.rb +793 -800
- data/lib/openwfe/expool/expstorage.rb +284 -313
- data/lib/openwfe/expool/history.rb +193 -105
- data/lib/openwfe/expool/journal.rb +163 -163
- data/lib/openwfe/expool/journal_replay.rb +228 -228
- data/lib/openwfe/expool/parser.rb +178 -142
- data/lib/openwfe/{orest/exception.rb → expool/paused_error.rb} +49 -32
- data/lib/openwfe/expool/representation.rb +59 -59
- data/lib/openwfe/expool/threadedexpstorage.rb +137 -134
- data/lib/openwfe/expool/wfidgen.rb +289 -287
- data/lib/openwfe/expool/yamlexpstorage.rb +154 -154
- data/lib/openwfe/expressions/condition.rb +175 -168
- data/lib/openwfe/expressions/environment.rb +165 -165
- data/lib/openwfe/expressions/expressionmap.rb +135 -131
- data/lib/openwfe/expressions/fe_cancel.rb +68 -68
- data/lib/openwfe/expressions/fe_command.rb +190 -190
- data/lib/openwfe/expressions/fe_concurrence.rb +531 -531
- data/lib/openwfe/expressions/fe_cron.rb +152 -197
- data/lib/openwfe/expressions/fe_cursor.rb +152 -186
- data/lib/openwfe/expressions/fe_define.rb +118 -118
- data/lib/openwfe/expressions/fe_do.rb +109 -109
- data/lib/openwfe/expressions/fe_equals.rb +219 -219
- data/lib/openwfe/expressions/fe_filter.rb +98 -98
- data/lib/openwfe/expressions/fe_filter_definition.rb +122 -122
- data/lib/openwfe/expressions/fe_fqv.rb +203 -203
- data/lib/openwfe/expressions/fe_http.rb +212 -0
- data/lib/openwfe/expressions/fe_if.rb +214 -214
- data/lib/openwfe/expressions/fe_iterator.rb +91 -91
- data/lib/openwfe/expressions/fe_listen.rb +268 -268
- data/lib/openwfe/expressions/fe_losfor.rb +73 -73
- data/lib/openwfe/expressions/fe_misc.rb +343 -351
- data/lib/openwfe/expressions/fe_participant.rb +206 -206
- data/lib/openwfe/expressions/fe_reserve.rb +153 -142
- data/lib/openwfe/expressions/fe_save.rb +226 -226
- data/lib/openwfe/expressions/fe_sequence.rb +66 -56
- data/lib/openwfe/expressions/fe_set.rb +80 -80
- data/lib/openwfe/expressions/fe_sleep.rb +132 -125
- data/lib/openwfe/expressions/fe_step.rb +113 -111
- data/lib/openwfe/expressions/fe_subprocess.rb +139 -136
- data/lib/openwfe/expressions/fe_timeout.rb +74 -78
- data/lib/openwfe/expressions/fe_wait.rb +48 -49
- data/lib/openwfe/expressions/fe_when.rb +106 -106
- data/lib/openwfe/expressions/filter.rb +60 -60
- data/lib/openwfe/expressions/flowexpression.rb +618 -612
- data/lib/openwfe/expressions/iterator.rb +158 -158
- data/lib/openwfe/expressions/merge.rb +53 -53
- data/lib/openwfe/expressions/raw.rb +396 -397
- data/lib/openwfe/expressions/rprocdef.rb +261 -266
- data/lib/openwfe/expressions/time.rb +238 -243
- data/lib/openwfe/expressions/timeout.rb +135 -135
- data/lib/openwfe/expressions/value.rb +55 -55
- data/lib/openwfe/extras/engine/db_persisted_engine.rb +94 -0
- data/lib/openwfe/extras/expool/dberrorjournal.rb +189 -0
- data/lib/openwfe/extras/expool/dbexpstorage.rb +355 -0
- data/lib/openwfe/extras/expool/dbhistory.rb +135 -0
- data/lib/openwfe/extras/listeners/sqslisteners.rb +146 -0
- data/lib/openwfe/extras/misc/activityfeed.rb +264 -0
- data/lib/openwfe/extras/misc/basecamp.rb +485 -0
- data/lib/openwfe/extras/participants/activeparticipants.rb +749 -0
- data/lib/openwfe/extras/participants/atomfeed_participants.rb +173 -0
- data/lib/openwfe/extras/participants/atompub_participants.rb +267 -0
- data/lib/openwfe/extras/participants/basecamp_participants.rb +87 -0
- data/lib/openwfe/extras/participants/csvparticipants.rb +127 -0
- data/lib/openwfe/extras/participants/sqsparticipants.rb +125 -0
- data/lib/openwfe/extras/participants/twitterparticipants.rb +176 -0
- data/lib/openwfe/filterdef.rb +191 -191
- data/lib/openwfe/flowexpressionid.rb +271 -269
- data/lib/openwfe/listeners/listener.rb +61 -61
- data/lib/openwfe/listeners/listeners.rb +81 -81
- data/lib/openwfe/listeners/socketlisteners.rb +189 -189
- data/lib/openwfe/logging.rb +74 -74
- data/lib/openwfe/omixins.rb +55 -54
- data/lib/openwfe/orest/definitions.rb +90 -90
- data/lib/openwfe/orest/osocket.rb +91 -91
- data/lib/openwfe/orest/xmlcodec.rb +471 -459
- data/lib/openwfe/participants.rb +19 -19
- data/lib/openwfe/participants/enoparticipants.rb +187 -187
- data/lib/openwfe/participants/participant.rb +100 -100
- data/lib/openwfe/participants/participantmap.rb +170 -170
- data/lib/openwfe/participants/participants.rb +316 -316
- data/lib/openwfe/participants/soapparticipants.rb +90 -90
- data/lib/openwfe/participants/socketparticipants.rb +143 -143
- data/lib/openwfe/participants/storeparticipants.rb +198 -198
- data/lib/openwfe/rexml.rb +44 -0
- data/lib/openwfe/rudefinitions.rb +87 -91
- data/lib/openwfe/service.rb +65 -65
- data/lib/openwfe/storage/yamlcustom.rb +71 -71
- data/lib/openwfe/storage/yamlfilestorage.rb +190 -190
- data/lib/openwfe/tools/flowtracer.rb +41 -45
- data/lib/openwfe/util/dollar.rb +125 -139
- data/lib/openwfe/util/irb.rb +42 -42
- data/lib/openwfe/util/observable.rb +93 -99
- data/lib/openwfe/util/ometa.rb +36 -36
- data/lib/openwfe/util/treechecker.rb +122 -0
- data/lib/openwfe/util/workqueue.rb +73 -73
- data/lib/openwfe/util/xml.rb +285 -279
- data/lib/openwfe/utils.rb +415 -442
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/workitem.rb +444 -437
- data/lib/openwfe/worklist/oldrest.rb +161 -161
- data/lib/openwfe/worklist/storelocks.rb +218 -218
- data/lib/openwfe/worklist/storeparticipant.rb +19 -19
- data/lib/openwfe/worklist/worklist.rb +223 -223
- data/test/back_0916_test.rb +57 -59
- data/test/bm/bm_1_xml_vs_prog.rb +25 -22
- data/test/bm/bm_2_step.rb +81 -81
- data/test/bm/ft_0f_5ms.rb +13 -13
- data/test/bm/ft_26_load.rb +177 -179
- data/test/bm/ft_26b_load.rb +57 -59
- data/test/bm/ft_26c_load.rb +70 -65
- data/test/bm/ft_recu.rb +51 -51
- data/test/clone_test.rb +145 -99
- data/test/concurrence_test.rb +41 -41
- data/test/condition_test.rb +104 -90
- data/test/description_test.rb +46 -45
- data/test/eno_test.rb +36 -36
- data/test/expmap_test.rb +26 -26
- data/test/extras/README.txt +5 -0
- data/test/extras/active_connection.rb +48 -0
- data/test/extras/active_with_engine_test.rb +140 -0
- data/test/extras/activityfeed_test.rb +85 -0
- data/test/extras/ap_0_test.rb +287 -0
- data/test/extras/ap_1_test.rb +53 -0
- data/test/extras/ap_test_base.rb +24 -0
- data/test/extras/atomfeedp_test.rb +113 -0
- data/test/extras/atompubp_test.rb +91 -0
- data/test/extras/basecamp_test.rb +53 -0
- data/test/extras/db_errorjournal_utest.rb +75 -0
- data/test/extras/db_expstorage_utest.rb +171 -0
- data/test/extras/db_history_0_test.rb +58 -0
- data/test/extras/ft_19_csv.rb +58 -0
- data/test/extras/ft_71_b14008.rb +85 -0
- data/test/extras/sqs_test.rb +57 -0
- data/test/extras/twitter_test.rb +62 -0
- data/test/fe_lookup_att_test.rb +41 -41
- data/test/fei_test.rb +131 -131
- data/test/file_persisted_engine_test.rb +30 -30
- data/test/file_persistence_test.rb +112 -111
- data/test/filep_cancel_test.rb +58 -58
- data/test/filter_test.rb +67 -67
- data/test/flowtestbase.rb +207 -219
- data/test/ft_0.rb +35 -35
- data/test/ft_0b_sequence.rb +15 -15
- data/test/ft_0c_testname.rb +12 -12
- data/test/ft_0d_participant.rb +9 -9
- data/test/ft_0e_multibody.rb +11 -11
- data/test/ft_10_loop.rb +103 -104
- data/test/ft_11_ppd.rb +285 -289
- data/test/ft_11b_ppd.rb +26 -26
- data/test/ft_12_blockparticipant.rb +57 -57
- data/test/ft_13_eno.rb +31 -31
- data/test/ft_14_subprocess.rb +45 -45
- data/test/ft_14b_subprocess.rb +107 -107
- data/test/ft_14c_subprocess.rb +33 -33
- data/test/ft_15_iterator.rb +127 -127
- data/test/ft_15b_iterator.rb +41 -41
- data/test/ft_16_fqv.rb +44 -44
- data/test/ft_17_condition.rb +48 -48
- data/test/ft_18_pname.rb +26 -26
- data/test/ft_1_unset.rb +140 -140
- data/test/ft_1b_unset.rb +17 -17
- data/test/ft_20_cron.rb +33 -33
- data/test/ft_21_cron.rb +51 -51
- data/test/ft_21b_cron_pause.rb +41 -41
- data/test/ft_22_history.rb +45 -41
- data/test/ft_23_when.rb +51 -51
- data/test/ft_23b_when.rb +43 -43
- data/test/ft_23c_wait.rb +48 -48
- data/test/ft_23d_cww.rb +28 -28
- data/test/ft_24_def.rb +15 -15
- data/test/ft_25_cancel.rb +57 -54
- data/test/ft_27_getflowpos.rb +79 -83
- data/test/ft_28_fileparticipant.rb +25 -25
- data/test/ft_29_httprb.rb +57 -57
- data/test/ft_2_concurrence.rb +99 -97
- data/test/ft_2b_concurrence.rb +132 -132
- data/test/ft_2c_concurrence.rb +37 -37
- data/test/ft_30_socketlistener.rb +133 -133
- data/test/ft_31_flowname.rb +15 -16
- data/test/ft_32_journal.rb +48 -48
- data/test/ft_32c_journal.rb +54 -54
- data/test/ft_32d_journal.rb +43 -46
- data/test/ft_33_description.rb +62 -62
- data/test/ft_34_cancelwfid.rb +37 -37
- data/test/ft_35_localdefs.rb +36 -34
- data/test/ft_36_subprocids.rb +61 -61
- data/test/ft_37_pnames.rb +33 -33
- data/test/ft_38_tag.rb +82 -82
- data/test/ft_38b_tag.rb +97 -97
- data/test/ft_38c_tag.rb +50 -50
- data/test/ft_38d_tag.rb +53 -0
- data/test/ft_39_reserve.rb +33 -33
- data/test/ft_39b_reserve.rb +59 -59
- data/test/ft_3_equals.rb +131 -131
- data/test/ft_3b_lookup_vf.rb +43 -43
- data/test/ft_40_defined.rb +33 -33
- data/test/ft_41_case.rb +80 -80
- data/test/ft_42_environments.rb +48 -48
- data/test/ft_43_pat10.rb +51 -51
- data/test/ft_44_save.rb +37 -37
- data/test/ft_44b_restore.rb +151 -151
- data/test/ft_45_citerator.rb +149 -149
- data/test/ft_45b_citerator.rb +77 -0
- data/test/ft_46_pparams.rb +27 -27
- data/test/ft_47_filter.rb +100 -100
- data/test/ft_48_fe_filter.rb +41 -41
- data/test/ft_49_condition.rb +101 -94
- data/test/ft_4_misc.rb +185 -190
- data/test/ft_50_xml_attribute.rb +101 -104
- data/test/ft_51_stack.rb +30 -30
- data/test/ft_52_obs_participant.rb +73 -73
- data/test/ft_53_null_noop_participant.rb +31 -31
- data/test/ft_54_listen.rb +183 -183
- data/test/ft_54b_listen.rb +32 -32
- data/test/ft_54c_listen.rb +60 -60
- data/test/ft_55_ptimeout.rb +29 -30
- data/test/ft_56_timeout.rb +29 -29
- data/test/ft_57_a.rb +105 -102
- data/test/ft_58_ejournal.rb +83 -80
- data/test/ft_58b_ejournal.rb +82 -0
- data/test/ft_59_ps.rb +148 -86
- data/test/ft_5_time.rb +77 -77
- data/test/ft_60_ecancel.rb +98 -98
- data/test/ft_61_elsub.rb +23 -23
- data/test/ft_62_procparticipant.rb +46 -46
- data/test/ft_63_pause.rb +82 -69
- data/test/ft_64_alias.rb +56 -57
- data/test/ft_65_stringlaunch.rb +29 -29
- data/test/ft_66_subforget.rb +42 -42
- data/test/ft_67_schedlaunch.rb +58 -59
- data/test/ft_68_ifparticipant.rb +39 -39
- data/test/ft_69_cancelmissing.rb +23 -21
- data/test/ft_6_lambda.rb +37 -37
- data/test/ft_70_lookupvar.rb +25 -25
- data/test/ft_71_log.rb +35 -35
- data/test/ft_72_lookup_processes.rb +43 -40
- data/test/ft_73_cancel_sub.rb +79 -79
- data/test/ft_74_block_and_workitem_dup.rb +42 -42
- data/test/ft_75_ruby_attributes.rb +53 -51
- data/test/ft_76_merge_isolate.rb +57 -57
- data/test/ft_77_segments.rb +13 -13
- data/test/ft_78_eval.rb +94 -94
- data/test/ft_79_tticket.rb +79 -79
- data/test/ft_79b_tticket.rb +73 -73
- data/test/ft_79c_outcome.rb +36 -36
- data/test/ft_7_lose.rb +73 -73
- data/test/ft_7b_lose.rb +49 -49
- data/test/ft_80_spname.rb +65 -65
- data/test/ft_81_exp.rb +30 -30
- data/test/ft_82_trecu.rb +30 -24
- data/test/ft_83_badpause.rb +35 -35
- data/test/ft_84_updateexp.rb +118 -118
- data/test/ft_84b_subrepr.rb +72 -0
- data/test/ft_85_dolhash.rb +18 -18
- data/test/ft_86_dollar_fv.rb +33 -33
- data/test/ft_87_define.rb +47 -47
- data/test/ft_88_http.rb +100 -0
- data/test/ft_8_forget.rb +25 -25
- data/test/ft_9_cursor.rb +119 -110
- data/test/ft_9b_cursor.rb +70 -70
- data/test/ft_tests.rb +6 -0
- data/test/hash_test.rb +52 -34
- data/test/hparticipant_test.rb +92 -88
- data/test/lookup_att_test.rb +70 -70
- data/test/lookup_vf_test.rb +52 -52
- data/test/misc_test.rb +55 -51
- data/test/obs_test.rb +82 -82
- data/test/param_test.rb +181 -181
- data/test/participant_test.rb +46 -46
- data/test/pending.rb +12 -12
- data/test/ps_representation.rb +70 -70
- data/test/rake_ltest.rb +2 -2
- data/test/rake_qtest.rb +11 -11
- data/test/raw_prog_test.rb +303 -308
- data/test/restart_cron_test.rb +74 -74
- data/test/restart_paused_test.rb +52 -47
- data/test/restart_sleep_test.rb +80 -80
- data/test/restart_when_test.rb +64 -64
- data/test/ruby_procdef_test.rb +71 -71
- data/test/rutest_utils.rb +32 -32
- data/test/sec_test.rb +143 -142
- data/test/slock_test.rb +41 -41
- data/test/storage_test.rb +15 -15
- data/test/timeout_test.rb +53 -53
- data/test/treechecker_test.rb +111 -0
- data/test/util_xml_test.rb +57 -57
- data/test/wfid_test.rb +93 -93
- data/test/wi_test.rb +58 -58
- metadata +64 -19
- data/examples/scheduler_cron_usage.rb +0 -48
- data/examples/scheduler_usage.rb +0 -56
- data/lib/openwfe/orest/controlclient.rb +0 -119
- data/lib/openwfe/orest/oldrestservlet.rb +0 -279
- data/lib/openwfe/orest/restclient.rb +0 -176
- data/lib/openwfe/orest/workitem.rb +0 -206
- data/lib/openwfe/orest/worklistclient.rb +0 -272
- data/test/bm/ft_26d_load.rb +0 -97
- data/test/ft_59b_ps_for_pat.rb +0 -58
- data/test/ft_64_clone.rb +0 -69
- data/test/orest_test.rb +0 -251
@@ -2,31 +2,31 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
|
-
#
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# . Redistributions of source code must retain the above copyright notice, this
|
10
|
-
# list of conditions and the following disclaimer.
|
11
|
-
#
|
12
|
-
# . Redistributions in binary form must reproduce the above copyright notice,
|
13
|
-
# this list of conditions and the following disclaimer in the documentation
|
10
|
+
# list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# . Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
14
|
# and/or other materials provided with the distribution.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# . Neither the name of the "OpenWFE" nor the names of its contributors may be
|
17
17
|
# used to endorse or promote products derived from this software without
|
18
18
|
# specific prior written permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
24
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
30
|
# POSSIBILITY OF SUCH DAMAGE.
|
31
31
|
#++
|
32
32
|
#
|
@@ -44,61 +44,61 @@
|
|
44
44
|
|
45
45
|
module OpenWFE
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
#
|
48
|
+
# This mixin adds filtering capabilities to a FlowExpression.
|
49
|
+
#
|
50
|
+
# It's used by the 'participant' and 'filter' expressions.
|
51
|
+
#
|
52
|
+
module FilterMixin
|
53
53
|
|
54
|
-
|
54
|
+
attr_accessor :filter
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
#
|
57
|
+
# Used when the workitem enters the 'filtered zone'. Will replace
|
58
|
+
# the attributes of the workitem with filtered ones.
|
59
|
+
# Assumes the original workitem is kept under @applied_workitem.
|
60
|
+
#
|
61
|
+
def filter_in workitem, filter_attribute_name=:filter
|
62
62
|
|
63
|
-
|
63
|
+
@filter = get_filter filter_attribute_name, workitem
|
64
64
|
|
65
|
-
|
65
|
+
return unless @filter
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
workitem.attributes = @filter.filter_in workitem.attributes
|
68
|
+
workitem.filter = @filter.dup
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
#
|
72
|
+
# Prepares the workitem for leaving the 'filtered zone'. Makes sure
|
73
|
+
# hidden and unwritable fields haven't been tampered with. Enforces
|
74
|
+
# the 'add_ok', 'remove_ok', 'closed' filter directives.
|
75
|
+
# Assumes the original workitem is kept under @applied_workitem.
|
76
|
+
#
|
77
|
+
def filter_out incoming_workitem
|
78
78
|
|
79
|
-
|
79
|
+
return unless @filter
|
80
80
|
|
81
|
-
|
81
|
+
incoming_workitem.filter = nil
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
incoming_workitem.attributes = @filter.filter_out(
|
84
|
+
@applied_workitem.attributes, incoming_workitem.attributes)
|
85
|
+
end
|
86
86
|
|
87
|
-
|
87
|
+
protected
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
#
|
90
|
+
# Fetches the filter pointed at via the 'filter' attribute
|
91
|
+
# of the including expression class.
|
92
|
+
#
|
93
|
+
def get_filter filter_attribute_name, workitem
|
94
94
|
|
95
|
-
|
95
|
+
filter_name = lookup_attribute filter_attribute_name, workitem
|
96
96
|
|
97
|
-
|
97
|
+
return nil unless filter_name
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
lookup_variable filter_name
|
100
|
+
end
|
101
|
+
end
|
102
102
|
|
103
103
|
end
|
104
104
|
|
@@ -47,801 +47,807 @@ require 'openwfe/util/dollar'
|
|
47
47
|
|
48
48
|
module OpenWFE
|
49
49
|
|
50
|
+
#
|
51
|
+
# When this variable is set to true (at the process root),
|
52
|
+
# it means the process is paused.
|
53
|
+
#
|
54
|
+
VAR_PAUSED = '/__paused__'
|
55
|
+
|
56
|
+
#
|
57
|
+
# FlowExpression
|
58
|
+
#
|
59
|
+
# The base class for all OpenWFE flow expression classes.
|
60
|
+
# It gathers all the methods for attributes and variable lookup.
|
61
|
+
#
|
62
|
+
class FlowExpression < ObjectWithMeta
|
63
|
+
include Contextual, Logging, OwfeServiceLocator
|
64
|
+
|
50
65
|
#
|
51
|
-
#
|
52
|
-
#
|
66
|
+
# The 'flow expression id' the unique identifier within a
|
67
|
+
# workflow instance for this expression instance.
|
53
68
|
#
|
54
|
-
|
69
|
+
attr_accessor :fei
|
55
70
|
|
56
71
|
#
|
57
|
-
#
|
72
|
+
# The 'flow expression id' of the parent expression.
|
73
|
+
# Will yield 'nil' if this expression is the root of its process
|
74
|
+
# instance.
|
75
|
+
#
|
76
|
+
attr_accessor :parent_id
|
77
|
+
|
58
78
|
#
|
59
|
-
# The
|
60
|
-
#
|
79
|
+
# The 'flow expression id' of the environment this expression works
|
80
|
+
# with.
|
61
81
|
#
|
62
|
-
|
63
|
-
include Contextual, Logging, OwfeServiceLocator
|
82
|
+
attr_accessor :environment_id
|
64
83
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
84
|
+
#
|
85
|
+
# The attributes of the expression, as found in the process definition.
|
86
|
+
#
|
87
|
+
# <participant ref='toto' timeout='1d10h' />
|
88
|
+
#
|
89
|
+
# The attributes will be ref => "toto" and timeout => "1d10h" (yes,
|
90
|
+
# 'attributes' contains a hash.
|
91
|
+
#
|
92
|
+
attr_accessor :attributes
|
70
93
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
94
|
+
#
|
95
|
+
# An array of 'flow expression id' instances. These are the ids of
|
96
|
+
# the expressions children to this one.
|
97
|
+
#
|
98
|
+
# <sequence>
|
99
|
+
# <participant ref="toto" />
|
100
|
+
# <participant ref="bert" />
|
101
|
+
# </sequence>
|
102
|
+
#
|
103
|
+
# The expression instance for 'sequence' will hold the feis of toto and
|
104
|
+
# bert in its children array.
|
105
|
+
#
|
106
|
+
attr_accessor :children
|
77
107
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
108
|
+
#
|
109
|
+
# When the FlowExpression instance is applied, this time stamp is set
|
110
|
+
# to the current date.
|
111
|
+
#
|
112
|
+
attr_accessor :apply_time
|
83
113
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
# 'attributes' contains a hash.
|
91
|
-
#
|
92
|
-
attr_accessor :attributes
|
114
|
+
#
|
115
|
+
# Used by raw expressions to store the not yet interpreted branches
|
116
|
+
# of a process, used by other expressions to store their
|
117
|
+
# representation at 'eval time'.
|
118
|
+
#
|
119
|
+
attr_accessor :raw_representation
|
93
120
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
# The expression instance for 'sequence' will hold the feis of toto and
|
104
|
-
# bert in its children array.
|
105
|
-
#
|
106
|
-
attr_accessor :children
|
121
|
+
#
|
122
|
+
# Meant to contain a boolean value. If set to 'true' it means that
|
123
|
+
# this expression raw_representation has been modified after
|
124
|
+
# the expression instantiation.
|
125
|
+
#
|
126
|
+
# It's used to keep track effectively of in-flight modifications
|
127
|
+
# of process instances.
|
128
|
+
#
|
129
|
+
attr_accessor :raw_rep_updated
|
107
130
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
attr_accessor :apply_time
|
131
|
+
#
|
132
|
+
# When was this expression last updated ?
|
133
|
+
#
|
134
|
+
attr_accessor :updated_at
|
113
135
|
|
114
|
-
#
|
115
|
-
# Used by raw expressions to store the not yet interpreted branches
|
116
|
-
# of a process, used by other expressions to store their
|
117
|
-
# representation at 'eval time'.
|
118
|
-
#
|
119
|
-
attr_accessor :raw_representation
|
120
136
|
|
137
|
+
#
|
138
|
+
# The classical no-params constructors.
|
139
|
+
#
|
140
|
+
def initialize
|
141
|
+
|
142
|
+
super
|
121
143
|
#
|
122
|
-
#
|
123
|
-
|
124
|
-
# the expression instantiation.
|
125
|
-
#
|
126
|
-
# It's used to keep track effectively of in-flight modifications
|
127
|
-
# of process instances.
|
128
|
-
#
|
129
|
-
attr_accessor :raw_rep_updated
|
144
|
+
# very necessary as this class includes the MonitorMixin
|
145
|
+
end
|
130
146
|
|
147
|
+
#
|
148
|
+
# Builds a new instance of an expression
|
149
|
+
#
|
150
|
+
def self.new_exp (fei, parent_id, env_id, app_context, attributes)
|
131
151
|
|
132
|
-
|
133
|
-
# The classical no-params constructors.
|
134
|
-
#
|
135
|
-
def initialize
|
152
|
+
e = self.new
|
136
153
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
154
|
+
e.fei = fei
|
155
|
+
e.parent_id = parent_id
|
156
|
+
e.environment_id = env_id
|
157
|
+
e.application_context = app_context
|
158
|
+
e.attributes = attributes
|
141
159
|
|
142
|
-
|
143
|
-
|
144
|
-
#
|
145
|
-
def self.new_exp (fei, parent_id, env_id, app_context, attributes)
|
160
|
+
e.children = []
|
161
|
+
e.apply_time = nil
|
146
162
|
|
147
|
-
|
163
|
+
e
|
164
|
+
end
|
148
165
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
e.application_context = app_context
|
153
|
-
e.attributes = attributes
|
166
|
+
#--
|
167
|
+
# the two most important methods for flow expressions
|
168
|
+
#++
|
154
169
|
|
155
|
-
|
156
|
-
|
170
|
+
#
|
171
|
+
# this default implementation immediately replies to the
|
172
|
+
# parent expression
|
173
|
+
#
|
174
|
+
def apply (workitem)
|
157
175
|
|
158
|
-
|
159
|
-
|
176
|
+
get_parent.reply(workitem) if @parent_id
|
177
|
+
end
|
160
178
|
|
161
|
-
|
162
|
-
|
163
|
-
|
179
|
+
#
|
180
|
+
# this default implementation immediately replies to the
|
181
|
+
# parent expression
|
182
|
+
#
|
183
|
+
def reply (workitem)
|
164
184
|
|
165
|
-
|
166
|
-
|
167
|
-
# parent expression
|
168
|
-
#
|
169
|
-
def apply (workitem)
|
185
|
+
reply_to_parent workitem
|
186
|
+
end
|
170
187
|
|
171
|
-
|
172
|
-
|
188
|
+
#
|
189
|
+
# Triggers the reply to the parent expression (of course, via the
|
190
|
+
# expression pool).
|
191
|
+
# Expressions do call this method when their job is done and the flow
|
192
|
+
# should resume without them.
|
193
|
+
#
|
194
|
+
def reply_to_parent (workitem)
|
173
195
|
|
174
|
-
|
175
|
-
|
176
|
-
# parent expression
|
177
|
-
#
|
178
|
-
def reply (workitem)
|
196
|
+
get_expression_pool.reply_to_parent self, workitem
|
197
|
+
end
|
179
198
|
|
180
|
-
|
181
|
-
|
199
|
+
#
|
200
|
+
# a default implementation for cancel :
|
201
|
+
# cancels all the children
|
202
|
+
# Attempts to return an InFlowWorkItem
|
203
|
+
#
|
204
|
+
def cancel
|
182
205
|
|
183
|
-
|
184
|
-
# Triggers the reply to the parent expression (of course, via the
|
185
|
-
# expression pool).
|
186
|
-
# Expressions do call this method when their job is done and the flow
|
187
|
-
# should resume without them.
|
188
|
-
#
|
189
|
-
def reply_to_parent (workitem)
|
206
|
+
return nil unless @children
|
190
207
|
|
191
|
-
|
192
|
-
end
|
208
|
+
inflowitem = nil
|
193
209
|
|
194
|
-
|
195
|
-
# a default implementation for cancel :
|
196
|
-
# cancels all the children
|
197
|
-
# Attempts to return an InFlowWorkItem
|
198
|
-
#
|
199
|
-
def cancel
|
210
|
+
@children.each do |child|
|
200
211
|
|
201
|
-
|
212
|
+
next if child.is_a?(String)
|
202
213
|
|
203
|
-
|
214
|
+
i = get_expression_pool.cancel child
|
215
|
+
inflowitem ||= i
|
216
|
+
end
|
204
217
|
|
205
|
-
|
218
|
+
inflowitem
|
219
|
+
end
|
206
220
|
|
207
|
-
|
221
|
+
#
|
222
|
+
# some convenience methods
|
208
223
|
|
209
|
-
|
210
|
-
|
211
|
-
|
224
|
+
#
|
225
|
+
# Returns the parent expression (not as a FlowExpressionId but directly
|
226
|
+
# as the FlowExpression instance it is).
|
227
|
+
#
|
228
|
+
def get_parent
|
212
229
|
|
213
|
-
|
214
|
-
|
230
|
+
get_expression_pool.fetch_expression @parent_id
|
231
|
+
end
|
215
232
|
|
216
|
-
|
217
|
-
|
233
|
+
#
|
234
|
+
# Stores itself in the expression pool.
|
235
|
+
# It's very important for expressions in persisted context to save
|
236
|
+
# themselves as soon as their state changed.
|
237
|
+
# Else this information would be lost at engine restart or
|
238
|
+
# simply if the expression got swapped out of memory and reloaded later.
|
239
|
+
#
|
240
|
+
def store_itself
|
218
241
|
|
219
|
-
|
220
|
-
|
221
|
-
# as the FlowExpression instance it is).
|
222
|
-
#
|
223
|
-
def get_parent
|
242
|
+
ldebug { "store_itself() for #{@fei.to_debug_s}" }
|
243
|
+
#ldebug { "store_itself() \n#{OpenWFE::caller_to_s(0, 6)}" }
|
224
244
|
|
225
|
-
|
226
|
-
|
245
|
+
get_expression_pool.update self
|
246
|
+
end
|
227
247
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
def store_itself
|
248
|
+
#
|
249
|
+
# Returns the environment instance this expression uses.
|
250
|
+
# An environment is a container (a scope) for variables in the process
|
251
|
+
# definition.
|
252
|
+
# Environments themselves are FlowExpression instances.
|
253
|
+
#
|
254
|
+
def get_environment
|
236
255
|
|
237
|
-
|
238
|
-
|
256
|
+
fetch_environment || get_expression_pool.fetch_engine_environment
|
257
|
+
end
|
239
258
|
|
240
|
-
|
241
|
-
|
259
|
+
#
|
260
|
+
# A shortcut for fetch_environment.get_root_environment
|
261
|
+
#
|
262
|
+
# Returns the environment of the top process (the environement
|
263
|
+
# just before the engine environment in the hierarchy).
|
264
|
+
#
|
265
|
+
def get_root_environment
|
242
266
|
|
243
|
-
|
244
|
-
|
245
|
-
# An environment is a container (a scope) for variables in the process
|
246
|
-
# definition.
|
247
|
-
# Environments themselves are FlowExpression instances.
|
248
|
-
#
|
249
|
-
def get_environment
|
267
|
+
fetch_environment.get_root_environment
|
268
|
+
end
|
250
269
|
|
251
|
-
|
252
|
-
|
270
|
+
#
|
271
|
+
# Just fetches the environment for this expression.
|
272
|
+
#
|
273
|
+
def fetch_environment
|
253
274
|
|
254
|
-
|
255
|
-
|
256
|
-
#
|
257
|
-
# Returns the environment of the top process (the environement
|
258
|
-
# just before the engine environment in the hierarchy).
|
259
|
-
#
|
260
|
-
def get_root_environment
|
275
|
+
get_expression_pool.fetch_expression @environment_id
|
276
|
+
end
|
261
277
|
|
262
|
-
|
263
|
-
|
278
|
+
#
|
279
|
+
# Returns true if the expression's environment was generated
|
280
|
+
# for itself (usually DefineExpression do have such envs)
|
281
|
+
#
|
282
|
+
def owns_its_environment?
|
264
283
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
284
|
+
#ldebug do
|
285
|
+
# "owns_its_environment?()\n" +
|
286
|
+
# " #{@fei.to_debug_s}\n" +
|
287
|
+
# " #{@environment_id.to_debug_s}"
|
288
|
+
#end
|
269
289
|
|
270
|
-
|
271
|
-
end
|
290
|
+
return false if not @environment_id
|
272
291
|
|
273
|
-
|
274
|
-
|
275
|
-
# for itself (usually DefineExpression do have such envs)
|
276
|
-
#
|
277
|
-
def owns_its_environment?
|
292
|
+
ei = @fei.dup
|
293
|
+
vi = @environment_id.dup
|
278
294
|
|
279
|
-
|
280
|
-
|
281
|
-
# " #{@fei.to_debug_s}\n" +
|
282
|
-
# " #{@environment_id.to_debug_s}"
|
283
|
-
#end
|
295
|
+
ei.expression_name = "neutral"
|
296
|
+
vi.expression_name = "neutral"
|
284
297
|
|
285
|
-
|
298
|
+
#ldebug do
|
299
|
+
# "owns_its_environment?()\n"+
|
300
|
+
# " exp #{ei.to_debug_s}\n"+
|
301
|
+
# " env #{vi.to_debug_s}"
|
302
|
+
#end
|
286
303
|
|
287
|
-
|
288
|
-
|
304
|
+
(ei == vi)
|
305
|
+
end
|
289
306
|
|
290
|
-
|
291
|
-
|
307
|
+
#
|
308
|
+
# Returns true if this expression belongs to a paused flow
|
309
|
+
#
|
310
|
+
def paused?
|
292
311
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
# " env #{vi.to_debug_s}"
|
297
|
-
#end
|
312
|
+
#(lookup_variable(VAR_PAUSED) == true)
|
313
|
+
get_expression_pool.is_paused?(self)
|
314
|
+
end
|
298
315
|
|
299
|
-
|
300
|
-
|
316
|
+
#
|
317
|
+
# Sets a variable in the current environment. Is usually
|
318
|
+
# called by the 'set' expression.
|
319
|
+
#
|
320
|
+
# The variable name may be prefixed by / to indicate process level scope
|
321
|
+
# or by // to indicate engine level (global) scope.
|
322
|
+
#
|
323
|
+
def set_variable (varname, value)
|
301
324
|
|
302
|
-
|
303
|
-
# Returns true if this expression belongs to a paused flow
|
304
|
-
#
|
305
|
-
def paused?
|
325
|
+
env, var = lookup_environment varname
|
306
326
|
|
307
|
-
|
308
|
-
|
309
|
-
|
327
|
+
ldebug do
|
328
|
+
"set_variable() '#{varname}' to '#{value}' " +
|
329
|
+
"in #{env.fei.to_debug_s}"
|
330
|
+
end
|
310
331
|
|
311
|
-
|
312
|
-
|
313
|
-
# called by the 'set' expression.
|
314
|
-
#
|
315
|
-
# The variable name may be prefixed by / to indicate process level scope
|
316
|
-
# or by // to indicate engine level (global) scope.
|
317
|
-
#
|
318
|
-
def set_variable (varname, value)
|
332
|
+
env[var] = value
|
333
|
+
end
|
319
334
|
|
320
|
-
|
335
|
+
alias :sv :set_variable
|
321
336
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
337
|
+
#
|
338
|
+
# Looks up the value of a variable in the current environment.
|
339
|
+
# If not found locally will lookup at the process level and even
|
340
|
+
# further in the engine scope.
|
341
|
+
#
|
342
|
+
# The variable name may be prefixed by / to indicate process level scope
|
343
|
+
# or by // to indicate engine level (global) scope.
|
344
|
+
#
|
345
|
+
def lookup_variable (varname)
|
326
346
|
|
327
|
-
|
328
|
-
|
347
|
+
env, var = lookup_environment varname
|
348
|
+
env[var]
|
349
|
+
end
|
329
350
|
|
330
|
-
|
331
|
-
# Looks up the value of a variable in the current environment.
|
332
|
-
# If not found locally will lookup at the process level and even
|
333
|
-
# further in the engine scope.
|
334
|
-
#
|
335
|
-
# The variable name may be prefixed by / to indicate process level scope
|
336
|
-
# or by // to indicate engine level (global) scope.
|
337
|
-
#
|
338
|
-
def lookup_variable (varname)
|
351
|
+
alias :lv :lookup_variable
|
339
352
|
|
340
|
-
|
341
|
-
|
353
|
+
#
|
354
|
+
# Unsets a variable in the current environment.
|
355
|
+
#
|
356
|
+
# The variable name may be prefixed by / to indicate process level scope
|
357
|
+
# or by // to indicate engine level (global) scope.
|
358
|
+
#
|
359
|
+
def delete_variable (varname)
|
342
360
|
|
343
|
-
|
344
|
-
|
345
|
-
|
361
|
+
env, var = lookup_environment varname
|
362
|
+
env.delete var
|
363
|
+
end
|
346
364
|
|
347
|
-
|
348
|
-
# Unsets a variable in the current environment.
|
349
|
-
#
|
350
|
-
# The variable name may be prefixed by / to indicate process level scope
|
351
|
-
# or by // to indicate engine level (global) scope.
|
352
|
-
#
|
353
|
-
def delete_variable (varname)
|
365
|
+
alias :unset_variable :delete_variable
|
354
366
|
|
355
|
-
|
356
|
-
|
357
|
-
|
367
|
+
#
|
368
|
+
# Looks up the value for an attribute of this expression.
|
369
|
+
#
|
370
|
+
# if the expression is
|
371
|
+
#
|
372
|
+
# <participant ref="toto" />
|
373
|
+
#
|
374
|
+
# then
|
375
|
+
#
|
376
|
+
# participant_expression.lookup_attribute("toto", wi)
|
377
|
+
#
|
378
|
+
# will yield "toto"
|
379
|
+
#
|
380
|
+
# The various methods for looking up attributes do perform dollar
|
381
|
+
# variable substitution.
|
382
|
+
# It's ok to pass a Symbol for the attribute name.
|
383
|
+
#
|
384
|
+
def lookup_attribute (attname, workitem, options={})
|
358
385
|
|
359
|
-
|
386
|
+
default = options[:default]
|
387
|
+
escape = options[:escape]
|
388
|
+
tostring = options[:to_s]
|
360
389
|
|
361
|
-
|
362
|
-
|
363
|
-
#
|
364
|
-
# if the expression is
|
365
|
-
#
|
366
|
-
# <participant ref="toto" />
|
367
|
-
#
|
368
|
-
# then
|
369
|
-
#
|
370
|
-
# participant_expression.lookup_attribute("toto", wi)
|
371
|
-
#
|
372
|
-
# will yield "toto"
|
373
|
-
#
|
374
|
-
# The various methods for looking up attributes do perform dollar
|
375
|
-
# variable substitution.
|
376
|
-
# It's ok to pass a Symbol for the attribute name.
|
377
|
-
#
|
378
|
-
def lookup_attribute (attname, workitem, options={})
|
390
|
+
attname = OpenWFE::symbol_to_name(attname) \
|
391
|
+
if attname.kind_of?(Symbol)
|
379
392
|
|
380
|
-
|
381
|
-
escape = options[:escape]
|
382
|
-
tostring = options[:to_s]
|
393
|
+
#ldebug { "lookup_attribute() '#{attname}' in #{@fei.to_debug_s}" }
|
383
394
|
|
384
|
-
|
385
|
-
if attname.kind_of?(Symbol)
|
395
|
+
text = @attributes[attname]
|
386
396
|
|
387
|
-
|
397
|
+
text = if text == nil
|
388
398
|
|
389
|
-
|
399
|
+
default
|
390
400
|
|
391
|
-
|
401
|
+
elsif escape == true
|
392
402
|
|
393
|
-
|
403
|
+
text
|
394
404
|
|
395
|
-
|
405
|
+
else
|
396
406
|
|
397
|
-
|
407
|
+
OpenWFE::dosub text, self, workitem
|
408
|
+
end
|
398
409
|
|
399
|
-
|
410
|
+
text = text.to_s if text and tostring
|
400
411
|
|
401
|
-
|
402
|
-
|
412
|
+
text
|
413
|
+
end
|
403
414
|
|
404
|
-
|
415
|
+
#
|
416
|
+
# Returns the attribute value as a String (or nil if it's not found).
|
417
|
+
#
|
418
|
+
def lookup_string_attribute (attname, workitem, options={})
|
405
419
|
|
406
|
-
|
407
|
-
|
420
|
+
result = lookup_attribute attname, workitem, options
|
421
|
+
result = result.to_s if result
|
422
|
+
result
|
423
|
+
end
|
408
424
|
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
425
|
+
#
|
426
|
+
# Like lookup_attribute() but returns the value downcased [
|
427
|
+
# (and stripped).
|
428
|
+
# Returns nil if no such attribute was found.
|
429
|
+
#
|
430
|
+
def lookup_downcase_attribute (attname, workitem, options={})
|
413
431
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
432
|
+
result = lookup_string_attribute attname, workitem, options
|
433
|
+
result = result.strip.downcase if result
|
434
|
+
result
|
435
|
+
end
|
418
436
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
def lookup_downcase_attribute (attname, workitem, options={})
|
437
|
+
#
|
438
|
+
# Returns the value of the attribute as a Symbol.
|
439
|
+
# Returns nil if there is no attribute under the given name.
|
440
|
+
#
|
441
|
+
def lookup_sym_attribute (attname, workitem, options={})
|
425
442
|
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
443
|
+
result = lookup_downcase_attribute attname, workitem, options
|
444
|
+
result = result.to_sym if result
|
445
|
+
result
|
446
|
+
end
|
430
447
|
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
448
|
+
#
|
449
|
+
# A convenience method for looking up a boolean value.
|
450
|
+
# It's ok to pass a Symbol for the attribute name.
|
451
|
+
#
|
452
|
+
def lookup_boolean_attribute (attname, workitem, default=false)
|
436
453
|
|
437
|
-
|
438
|
-
|
439
|
-
result
|
440
|
-
end
|
454
|
+
result = lookup_downcase_attribute attname, workitem
|
455
|
+
return default if result == nil
|
441
456
|
|
442
|
-
|
443
|
-
|
444
|
-
# It's ok to pass a Symbol for the attribute name.
|
445
|
-
#
|
446
|
-
def lookup_boolean_attribute (attname, workitem, default=false)
|
457
|
+
(result == 'true')
|
458
|
+
end
|
447
459
|
|
448
|
-
|
449
|
-
|
460
|
+
#
|
461
|
+
# looks up an attribute, if it's an array, returns it. Else
|
462
|
+
# (probably a string) will split it (comma) and return it
|
463
|
+
# (each element trimmed).
|
464
|
+
#
|
465
|
+
def lookup_array_attribute (attname, workitem, options={})
|
450
466
|
|
451
|
-
|
452
|
-
end
|
467
|
+
tostring = options.delete :to_s
|
453
468
|
|
454
|
-
|
455
|
-
# looks up an attribute, if it's an array, returns it. Else
|
456
|
-
# (probably a string) will split it (comma) and return it
|
457
|
-
# (each element trimmed).
|
458
|
-
#
|
459
|
-
def lookup_array_attribute (attname, workitem, options={})
|
469
|
+
v = lookup_attribute attname, workitem, options
|
460
470
|
|
461
|
-
|
471
|
+
return nil unless v
|
462
472
|
|
463
|
-
|
473
|
+
v = v.to_s.split(",").collect { |e| e.strip } \
|
474
|
+
unless v.is_a?(Array)
|
464
475
|
|
465
|
-
|
476
|
+
v = v.collect { |e| e.to_s } \
|
477
|
+
if tostring
|
466
478
|
|
467
|
-
|
468
|
-
|
479
|
+
v
|
480
|
+
end
|
469
481
|
|
470
|
-
|
471
|
-
|
482
|
+
#
|
483
|
+
# Returns true if the expression has the given attribute.
|
484
|
+
# The attname parameter can be a String or a Symbol.
|
485
|
+
#
|
486
|
+
def has_attribute (attname)
|
472
487
|
|
473
|
-
|
474
|
-
|
488
|
+
attname = OpenWFE::symbol_to_name(attname) \
|
489
|
+
if attname.kind_of?(Symbol)
|
475
490
|
|
476
|
-
|
477
|
-
|
478
|
-
# The attname parameter can be a String or a Symbol.
|
479
|
-
#
|
480
|
-
def has_attribute (attname)
|
491
|
+
(@attributes[attname] != nil)
|
492
|
+
end
|
481
493
|
|
482
|
-
|
483
|
-
|
494
|
+
#
|
495
|
+
# Returns a hash of all the FlowExpression attributes with their
|
496
|
+
# values having undergone dollar variable substitution.
|
497
|
+
# If the _attributes parameter is set (to an Array instance) then
|
498
|
+
# only the attributes named in that list will be looked up.
|
499
|
+
#
|
500
|
+
# It's ok to pass an array of Symbol instances for the attributes
|
501
|
+
# parameter.
|
502
|
+
#
|
503
|
+
def lookup_attributes (workitem, _attributes=nil)
|
484
504
|
|
485
|
-
|
486
|
-
end
|
505
|
+
return {} unless @attributes
|
487
506
|
|
488
|
-
|
489
|
-
# Returns a hash of all the FlowExpression attributes with their
|
490
|
-
# values having undergone dollar variable substitution.
|
491
|
-
# If the _attributes parameter is set (to an Array instance) then
|
492
|
-
# only the attributes named in that list will be looked up.
|
493
|
-
#
|
494
|
-
# It's ok to pass an array of Symbol instances for the attributes
|
495
|
-
# parameter.
|
496
|
-
#
|
497
|
-
def lookup_attributes (workitem, _attributes=nil)
|
507
|
+
(_attributes || @attributes.keys).inject({}) do |r, k|
|
498
508
|
|
499
|
-
|
509
|
+
k = k.to_s
|
510
|
+
v = @attributes[k]
|
500
511
|
|
501
|
-
|
512
|
+
r[k] = OpenWFE::dosub v, self, workitem
|
502
513
|
|
503
|
-
|
504
|
-
|
514
|
+
r
|
515
|
+
end
|
516
|
+
end
|
505
517
|
|
506
|
-
|
518
|
+
#
|
519
|
+
# creates a new environment just for this expression
|
520
|
+
#
|
521
|
+
def new_environment (initial_vars=nil)
|
507
522
|
|
508
|
-
|
509
|
-
end
|
510
|
-
end
|
523
|
+
ldebug { "new_environment() for #{@fei.to_debug_s}" }
|
511
524
|
|
512
|
-
|
513
|
-
|
514
|
-
#
|
515
|
-
def new_environment (initial_vars=nil)
|
525
|
+
@environment_id = @fei.dup
|
526
|
+
@environment_id.expression_name = EN_ENVIRONMENT
|
516
527
|
|
517
|
-
|
528
|
+
parent_fei = nil
|
529
|
+
parent = nil
|
518
530
|
|
519
|
-
|
520
|
-
|
531
|
+
parent, _fei = get_expression_pool.fetch(@parent_id) \
|
532
|
+
if @parent_id
|
521
533
|
|
522
|
-
|
523
|
-
parent = nil
|
534
|
+
parent_fei = parent.environment_id if parent
|
524
535
|
|
525
|
-
|
526
|
-
|
536
|
+
env = Environment.new_env(
|
537
|
+
@environment_id, parent_fei, nil, @application_context, nil)
|
527
538
|
|
528
|
-
|
539
|
+
env.variables.merge! initial_vars if initial_vars
|
529
540
|
|
530
|
-
|
531
|
-
|
541
|
+
env[@fei.wfname] = self.raw_representation \
|
542
|
+
if (not @parent_id) and (self.is_a?(RawExpression))
|
543
|
+
#
|
544
|
+
# keeping track of the raw representation
|
545
|
+
# of the top expression (for top recursion)
|
532
546
|
|
533
|
-
|
547
|
+
ldebug { "new_environment() is #{env.fei.to_debug_s}" }
|
534
548
|
|
535
|
-
|
536
|
-
if (not @parent_id) and (self.is_a?(RawExpression))
|
537
|
-
#
|
538
|
-
# keeping track of the raw representation
|
539
|
-
# of the top expression (for top recursion)
|
549
|
+
env.store_itself
|
540
550
|
|
541
|
-
|
551
|
+
env
|
552
|
+
end
|
542
553
|
|
543
|
-
|
554
|
+
#
|
555
|
+
# This method is called in expressionpool.forget(). It duplicates
|
556
|
+
# the expression's current environment (deep copy) and attaches
|
557
|
+
# it as the expression own environment.
|
558
|
+
# Returns the duplicated environment.
|
559
|
+
#
|
560
|
+
def dup_environment
|
544
561
|
|
545
|
-
|
546
|
-
|
562
|
+
env = fetch_environment
|
563
|
+
env = env.dup
|
564
|
+
env.fei = @fei.dup
|
565
|
+
env.fei.expression_name = EN_ENVIRONMENT
|
566
|
+
@environment_id = env.fei
|
547
567
|
|
548
|
-
|
549
|
-
|
550
|
-
# the expression's current environment (deep copy) and attaches
|
551
|
-
# it as the expression own environment.
|
552
|
-
# Returns the duplicated environment.
|
553
|
-
#
|
554
|
-
def dup_environment
|
568
|
+
env.store_itself
|
569
|
+
end
|
555
570
|
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
@environment_id = env.fei
|
571
|
+
#
|
572
|
+
# Takes care of removing all the children of this expression, if any.
|
573
|
+
#
|
574
|
+
def clean_children
|
561
575
|
|
562
|
-
|
563
|
-
end
|
576
|
+
return unless @children
|
564
577
|
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
578
|
+
@children.each do |child_fei|
|
579
|
+
get_expression_pool.remove(child_fei) \
|
580
|
+
if child_fei.kind_of?(FlowExpressionId)
|
581
|
+
end
|
582
|
+
end
|
569
583
|
|
570
|
-
|
584
|
+
#
|
585
|
+
# Removes a child from the expression children list.
|
586
|
+
#
|
587
|
+
def remove_child (child_fei)
|
571
588
|
|
572
|
-
|
573
|
-
|
574
|
-
if child_fei.kind_of?(FlowExpressionId)
|
575
|
-
end
|
576
|
-
end
|
589
|
+
#fei = @children.delete child_fei
|
590
|
+
#store_itself if fei
|
577
591
|
|
578
|
-
|
579
|
-
# Removes a child from the expression children list.
|
580
|
-
#
|
581
|
-
def remove_child (child_fei)
|
592
|
+
i = @children.index child_fei
|
582
593
|
|
583
|
-
|
584
|
-
#store_itself if fei
|
594
|
+
return unless i
|
585
595
|
|
586
|
-
|
596
|
+
@children.delete_at i
|
597
|
+
raw_children.delete_at i
|
598
|
+
@raw_rep_updated = true
|
587
599
|
|
588
|
-
|
600
|
+
store_itself
|
601
|
+
end
|
589
602
|
|
590
|
-
|
591
|
-
|
592
|
-
|
603
|
+
#
|
604
|
+
# Currently only used by dollar.rb and its ${r:some_ruby_code},
|
605
|
+
# returns the binding in this flow expression.
|
606
|
+
#
|
607
|
+
def get_binding
|
593
608
|
|
594
|
-
|
595
|
-
|
609
|
+
binding()
|
610
|
+
end
|
596
611
|
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
612
|
+
#--
|
613
|
+
# Used like the classical Ruby synchronize, but as the OpenWFE
|
614
|
+
# expression pool manages its own set of monitors, it's one of those
|
615
|
+
# monitors that is used. But the synchronize code looks like the class
|
616
|
+
# just included the MonitorMixin. No hassle.
|
617
|
+
#
|
618
|
+
#def synchronize
|
619
|
+
# #ldebug { "synchronize() ---in--- for #{@fei.to_debug_s}" }
|
620
|
+
# get_expression_pool.get_monitor(@fei).synchronize do
|
621
|
+
# yield
|
622
|
+
# end
|
623
|
+
# #ldebug { "synchronize() --out-- for #{@fei.to_debug_s}" }
|
624
|
+
#end
|
625
|
+
#++
|
602
626
|
|
603
|
-
|
604
|
-
|
627
|
+
#
|
628
|
+
# Returns the text stored among the children
|
629
|
+
#
|
630
|
+
def fetch_text_content (workitem, escape=false)
|
605
631
|
|
606
|
-
|
607
|
-
# Used like the classical Ruby synchronize, but as the OpenWFE
|
608
|
-
# expression pool manages its own set of monitors, it's one of those
|
609
|
-
# monitors that is used. But the synchronize code looks like the class
|
610
|
-
# just included the MonitorMixin. No hassle.
|
611
|
-
#
|
612
|
-
#def synchronize
|
613
|
-
# #ldebug { "synchronize() ---in--- for #{@fei.to_debug_s}" }
|
614
|
-
# get_expression_pool.get_monitor(@fei).synchronize do
|
615
|
-
# yield
|
616
|
-
# end
|
617
|
-
# #ldebug { "synchronize() --out-- for #{@fei.to_debug_s}" }
|
618
|
-
#end
|
619
|
-
#++
|
632
|
+
cs = children || raw_children
|
620
633
|
|
621
|
-
|
622
|
-
# Returns the text stored as the children of the given expression
|
623
|
-
#
|
624
|
-
def fetch_text_content (workitem, escape=false)
|
634
|
+
text = cs.inject("") do |r, child|
|
625
635
|
|
626
|
-
|
636
|
+
if child.is_a?(RawExpression)
|
627
637
|
|
628
|
-
|
638
|
+
r << child.fei.to_s
|
629
639
|
|
630
|
-
|
640
|
+
elsif child.is_a?(FlowExpressionId)
|
631
641
|
|
632
|
-
|
642
|
+
r << get_expression_pool\
|
643
|
+
.fetch_expression(child).raw_representation.to_s
|
633
644
|
|
634
|
-
|
645
|
+
else
|
635
646
|
|
636
|
-
|
637
|
-
|
647
|
+
r << child.to_s
|
648
|
+
end
|
649
|
+
end
|
638
650
|
|
639
|
-
|
651
|
+
return nil if text == ""
|
640
652
|
|
641
|
-
|
642
|
-
|
643
|
-
end
|
653
|
+
text = OpenWFE::dosub(text, self, workitem) \
|
654
|
+
unless escape
|
644
655
|
|
645
|
-
|
656
|
+
text
|
657
|
+
end
|
646
658
|
|
647
|
-
|
648
|
-
|
659
|
+
#
|
660
|
+
# looks up for 'value', 'variable-value' and then for 'field-value'
|
661
|
+
# if necessary.
|
662
|
+
#
|
663
|
+
def lookup_value (workitem, options={})
|
649
664
|
|
650
|
-
|
651
|
-
|
665
|
+
lookup_vf_attribute(workitem, 'value', options) ||
|
666
|
+
lookup_vf_attribute(workitem, 'val', options)
|
667
|
+
end
|
652
668
|
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
669
|
+
#
|
670
|
+
# looks up for 'ref', 'variable-ref' and then for 'field-ref'
|
671
|
+
# if necessary.
|
672
|
+
#
|
673
|
+
def lookup_ref (workitem, prefix='')
|
658
674
|
|
659
|
-
|
660
|
-
|
661
|
-
|
675
|
+
ref = lookup_vf_attribute workitem, 'ref', :prefix => prefix
|
676
|
+
return ref.to_s if ref
|
677
|
+
nil
|
678
|
+
end
|
662
679
|
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
def lookup_ref (workitem, prefix='')
|
680
|
+
#
|
681
|
+
# Looks up for value attributes like 'field-ref' or 'variable-value'
|
682
|
+
#
|
683
|
+
def lookup_vf_attribute (workitem, att_name, options={})
|
668
684
|
|
669
|
-
|
670
|
-
return ref.to_s if ref
|
671
|
-
nil
|
672
|
-
end
|
685
|
+
att_name = att_name.to_s
|
673
686
|
|
674
|
-
|
675
|
-
|
676
|
-
#
|
677
|
-
def lookup_vf_attribute (workitem, att_name, options={})
|
687
|
+
prefix = options[:prefix] || ''
|
688
|
+
prefix = prefix.to_s
|
678
689
|
|
679
|
-
|
690
|
+
dash = (att_name.size > 0 and prefix.size > 0) ? "-" : ""
|
680
691
|
|
681
|
-
|
682
|
-
|
692
|
+
v = lookup_attribute(
|
693
|
+
"#{prefix}#{dash}#{att_name}", workitem, options)
|
683
694
|
|
684
|
-
|
695
|
+
att_name = "-#{att_name}" if att_name.size > 0
|
696
|
+
prefix = "#{prefix}-" if prefix.size > 0
|
685
697
|
|
686
|
-
|
687
|
-
"#{prefix}#{dash}#{att_name}", workitem, options)
|
698
|
+
return v if v
|
688
699
|
|
689
|
-
|
690
|
-
|
700
|
+
v = lookup_attribute(
|
701
|
+
"#{prefix}variable#{att_name}", workitem, options) ||
|
702
|
+
lookup_attribute(
|
703
|
+
"#{prefix}var#{att_name}", workitem, options) ||
|
704
|
+
lookup_attribute(
|
705
|
+
"#{prefix}v#{att_name}", workitem, options)
|
691
706
|
|
692
|
-
|
707
|
+
return lookup_variable(v) if v
|
693
708
|
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
lookup_attribute(
|
699
|
-
"#{prefix}v#{att_name}", workitem, options)
|
709
|
+
f = lookup_attribute(
|
710
|
+
"#{prefix}field#{att_name}", workitem, options) ||
|
711
|
+
lookup_attribute(
|
712
|
+
"#{prefix}f#{att_name}", workitem, options)
|
700
713
|
|
701
|
-
|
714
|
+
#return workitem.attributes[f] if f
|
715
|
+
return workitem.attributes[f.to_s] if f
|
702
716
|
|
703
|
-
|
704
|
-
|
705
|
-
lookup_attribute(
|
706
|
-
"#{prefix}f#{att_name}", workitem, options)
|
717
|
+
nil
|
718
|
+
end
|
707
719
|
|
708
|
-
|
709
|
-
|
720
|
+
#
|
721
|
+
# Since OpenWFEru 0.9.17, each expression keeps his @raw_representation
|
722
|
+
# this is a shortcut for exp.raw_representation[2]
|
723
|
+
#
|
724
|
+
def raw_children
|
710
725
|
|
711
|
-
|
712
|
-
|
726
|
+
@raw_representation[2]
|
727
|
+
end
|
713
728
|
|
714
|
-
|
715
|
-
# Since OpenWFEru 0.9.17, each expression keeps his @raw_representation
|
716
|
-
# this is a shortcut for exp.raw_representation[2]
|
717
|
-
#
|
718
|
-
def raw_children
|
729
|
+
SUBIDMUTEX = Mutex.new
|
719
730
|
|
720
|
-
|
721
|
-
|
731
|
+
#
|
732
|
+
# Returns the next sub process id available (this counter
|
733
|
+
# is stored in the process environment under the key :next_sub_id)
|
734
|
+
#
|
735
|
+
def get_next_sub_id
|
722
736
|
|
723
|
-
|
737
|
+
#env = get_environment
|
738
|
+
env = get_root_environment
|
724
739
|
|
725
|
-
|
726
|
-
# Returns the next sub process id available (this counter
|
727
|
-
# is stored in the process environment under the key :next_sub_id)
|
728
|
-
#
|
729
|
-
def get_next_sub_id
|
740
|
+
c = nil
|
730
741
|
|
731
|
-
|
732
|
-
env = get_root_environment
|
742
|
+
#env.synchronize do
|
733
743
|
|
734
|
-
|
744
|
+
c = env.variables[:next_sub_id]
|
745
|
+
n = if c
|
746
|
+
c + 1
|
747
|
+
else
|
748
|
+
c = 0
|
749
|
+
1
|
750
|
+
end
|
751
|
+
env.variables[:next_sub_id] = n
|
752
|
+
env.store_itself
|
753
|
+
#end
|
735
754
|
|
736
|
-
|
755
|
+
c
|
756
|
+
end
|
737
757
|
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
c = 0
|
743
|
-
1
|
744
|
-
end
|
745
|
-
env.variables[:next_sub_id] = n
|
746
|
-
env.store_itself
|
747
|
-
#end
|
758
|
+
#
|
759
|
+
# Some eye candy
|
760
|
+
#
|
761
|
+
def to_s
|
748
762
|
|
749
|
-
|
750
|
-
end
|
763
|
+
s = "* #{@fei.to_debug_s} [#{self.class.name}]"
|
751
764
|
|
752
|
-
|
753
|
-
|
754
|
-
#
|
755
|
-
def to_s
|
765
|
+
s << "\n `--p--> #{@parent_id.to_debug_s}" \
|
766
|
+
if @parent_id
|
756
767
|
|
757
|
-
|
768
|
+
s << "\n `--e--> #{@environment_id.to_debug_s}" \
|
769
|
+
if @environment_id
|
758
770
|
|
759
|
-
|
760
|
-
if @parent_id
|
771
|
+
return s unless @children
|
761
772
|
|
762
|
-
|
763
|
-
|
773
|
+
@children.each do |c|
|
774
|
+
sc = if c.kind_of?(OpenWFE::FlowExpressionId)
|
775
|
+
c.to_debug_s
|
776
|
+
else
|
777
|
+
">#{c.to_s}<"
|
778
|
+
end
|
779
|
+
s << "\n `--c--> #{sc}"
|
780
|
+
end
|
764
781
|
|
765
|
-
|
782
|
+
s
|
783
|
+
end
|
766
784
|
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
785
|
+
#
|
786
|
+
# a nice 'names' tag/method for registering the names of the
|
787
|
+
# Expression classes.
|
788
|
+
#
|
789
|
+
def self.names (*exp_names)
|
790
|
+
|
791
|
+
exp_names = exp_names.collect do |n|
|
792
|
+
n.to_s
|
793
|
+
end
|
794
|
+
meta_def :expression_names do
|
795
|
+
exp_names
|
796
|
+
end
|
797
|
+
end
|
775
798
|
|
776
|
-
|
777
|
-
|
799
|
+
#
|
800
|
+
# returns true if the expression class is a 'definition'.
|
801
|
+
#
|
802
|
+
def self.is_definition?
|
803
|
+
false
|
804
|
+
end
|
805
|
+
def self.is_definition
|
806
|
+
meta_def :is_definition? do
|
807
|
+
true
|
808
|
+
end
|
809
|
+
end
|
778
810
|
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
end
|
811
|
+
#
|
812
|
+
# returns true if the expression class 'uses a template'
|
813
|
+
# (children will not immediately get expanded at 'parse' time)
|
814
|
+
#
|
815
|
+
def self.uses_template?
|
816
|
+
false
|
817
|
+
end
|
818
|
+
def self.uses_template
|
819
|
+
meta_def :uses_template? do
|
820
|
+
true
|
821
|
+
end
|
822
|
+
end
|
792
823
|
|
793
|
-
|
794
|
-
# returns true if the expression class is a 'definition'.
|
795
|
-
#
|
796
|
-
def self.is_definition?
|
797
|
-
false
|
798
|
-
end
|
799
|
-
def self.is_definition
|
800
|
-
meta_def :is_definition? do
|
801
|
-
true
|
802
|
-
end
|
803
|
-
end
|
824
|
+
protected
|
804
825
|
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
826
|
+
#
|
827
|
+
# If the varname starts with '//' will return the engine
|
828
|
+
# environment and the truncated varname...
|
829
|
+
# If the varname starts with '/' will return the root environment
|
830
|
+
# for the current process instance and the truncated varname...
|
831
|
+
#
|
832
|
+
def lookup_environment (varname)
|
833
|
+
|
834
|
+
if varname[0, 2] == '//'
|
835
|
+
return [
|
836
|
+
get_expression_pool.fetch_engine_environment,
|
837
|
+
varname[2..-1]
|
838
|
+
]
|
811
839
|
end
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
840
|
+
|
841
|
+
if varname[0, 1] == '/'
|
842
|
+
return [
|
843
|
+
get_environment.get_root_environment,
|
844
|
+
varname[1..-1]
|
845
|
+
]
|
816
846
|
end
|
817
847
|
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
# If the varname starts with '//' will return the engine
|
822
|
-
# environment and the truncated varname...
|
823
|
-
# If the varname starts with '/' will return the root environment
|
824
|
-
# for the current process instance and the truncated varname...
|
825
|
-
#
|
826
|
-
def lookup_environment (varname)
|
827
|
-
|
828
|
-
if varname[0, 2] == '//'
|
829
|
-
return [
|
830
|
-
get_expression_pool.fetch_engine_environment,
|
831
|
-
varname[2..-1]
|
832
|
-
]
|
833
|
-
end
|
834
|
-
|
835
|
-
if varname[0, 1] == '/'
|
836
|
-
return [
|
837
|
-
get_environment.get_root_environment,
|
838
|
-
varname[1..-1]
|
839
|
-
]
|
840
|
-
end
|
841
|
-
|
842
|
-
[ get_environment, varname ]
|
843
|
-
end
|
844
|
-
end
|
848
|
+
[ get_environment, varname ]
|
849
|
+
end
|
850
|
+
end
|
845
851
|
|
846
852
|
end
|
847
853
|
|