Index: openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl,v
diff -u -r1.34 -r1.35
--- openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl 6 Dec 2018 23:14:31 -0000 1.34
+++ openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl 6 Dec 2018 23:16:30 -0000 1.35
@@ -1,6 +1,6 @@
ad_library {
- Support library for acs service contracts.
-
+ Support library for acs service contracts.
+
@author Neophytos Demetriou
@creation-date 2001-09-01
@cvs-id $Id$
@@ -28,15 +28,15 @@
the contract you passed in. If you supply both impl_id and impl, we throw an error.
Additional documentation and commentary at http://openacs.org/forums/message-view?message_id=108614.
-
+
@param contract The name of the contract you wish to use.
@param operation The name of the operation in the contract you wish to call.
@param impl The name of the implementation you wish to use.
@param impl_id The ID of the implementation you wish to use.
@param call_args The arguments you want to pass to the proc.
@param error If specified, will throw an error if the operation isn't implemented.
-
+
@author Lars Pind (lars@collaboraid.biz)
@see acs_sc_call
} {
@@ -58,13 +58,13 @@
set proc_name [acs_sc_generate_name $contract $impl $operation]
if { [info commands $proc_name] ne "" } {
- return [ad_apply $proc_name $call_args]
- }
+ return [ad_apply $proc_name $call_args]
+ }
if { $error_p } {
- error "Operation $operation is not implemented in '$impl' implementation of contract '$contract'"
+ error "Operation $operation is not implemented in '$impl' implementation of contract '$contract'"
} else {
- ns_log warning "ACS-SC: Function Not Found: $proc_name [info commands $proc_name]"
+ ns_log warning "ACS-SC: Function Not Found: $proc_name [info commands $proc_name]"
}
return
}
@@ -80,14 +80,14 @@
contract
impl
} {
- Returns a boolean depending on whether or not the binding between
+ Returns a boolean depending on whether or not the binding between
the contract and implementation exists.
- @param contract the contract name
- @param impl the implementation name
+ @param contract the contract name
+ @param impl the implementation name
@return 0 or 1
-
+
@author Neophytos Demetriou
} {
@@ -113,10 +113,10 @@
operation
impl
} {
- Returns the implementation alias (the
- proc defined to handle a given operation
- for a given implementation).
-
+ Returns the implementation alias (the
+ proc defined to handle a given operation
+ for a given implementation).
+
@author Neophytos Demetriou
} {
# LARS
@@ -125,7 +125,7 @@
#set exists_p [util_memoize [list acs_sc_binding_exists_p $contract $impl]]
if {![set exists_p]} {return ""}
-
+
db_0or1row get_alias {
select impl_alias, impl_pl
from acs_sc_impl_aliases
@@ -145,7 +145,7 @@
{impl_alias {}}
{impl_pl {}}
} {
- Builds the proc used by acs_sc::invoke, generally only called
+ Builds the proc used by acs_sc::invoke, generally only called
in acs-service-contract-init.tcl at startup.
@return 0 on failure, 1 on success.
@@ -157,26 +157,26 @@
set proc_name [acs_sc_generate_name $contract $impl $operation]
acs_sc_log SCDebug "ACS_SC_PROC: proc_name = $proc_name"
-
+
if { $impl_alias eq "" } {
- lassign [acs_sc_get_alias $contract $operation $impl] impl_alias impl_pl
+ lassign [acs_sc_get_alias $contract $operation $impl] impl_alias impl_pl
}
if { $impl_alias eq "" } {
- error "ACS-SC: Cannot find alias for $proc_name"
+ error "ACS-SC: Cannot find alias for $proc_name"
}
if {![db_0or1row get_operation_definition {
- select
- operation_desc,
- coalesce(operation_iscachable_p,'f') as operation_iscachable_p,
- operation_nargs,
- operation_inputtype_id,
- operation_outputtype_id
- from acs_sc_operations
- where contract_name = :contract
- and operation_name = :operation
- }]} {
+ select
+ operation_desc,
+ coalesce(operation_iscachable_p,'f') as operation_iscachable_p,
+ operation_nargs,
+ operation_inputtype_id,
+ operation_outputtype_id
+ from acs_sc_operations
+ where contract_name = :contract
+ and operation_name = :operation
+ }]} {
ns_log warning "ACS-SC: operation definition not found for contract $contract operation $operation"
return 0
}
@@ -185,27 +185,27 @@
set msg_type_id $operation_inputtype_id
db_foreach operation_msgtype_element {} {
- lappend arguments "$element_name"
- append docblock "\n@param $element_name $element_msg_type_name"
- if { $element_msg_type_isset_p } {
- append docblock " \[\]"
- }
+ lappend arguments "$element_name"
+ append docblock "\n@param $element_name $element_msg_type_name"
+ if { $element_msg_type_isset_p } {
+ append docblock " \[\]"
+ }
}
- set msg_type_id $operation_outputtype_id
+ set msg_type_id $operation_outputtype_id
db_foreach operation_msgtype_element {} {
- append docblock "\n@return $element_name - $element_msg_type_name"
- if { $element_msg_type_isset_p } {
- append docblock " \[\]"
- }
+ append docblock "\n@return $element_name - $element_msg_type_name"
+ if { $element_msg_type_isset_p } {
+ append docblock " \[\]"
+ }
}
append docblock "\n@see $impl_alias\n@see acs_sc::invoke"
set full_statement [acs_sc_get_statement $impl_alias $impl_pl $arguments]
if { $operation_iscachable_p } {
- set full_statement "util_memoize \"$full_statement\""
+ set full_statement "util_memoize \"$full_statement\""
}
#FIX ME: CALL BY NAME USING UPVAR
@@ -214,7 +214,7 @@
set arguments [join $arguments]
acs_sc_log SCDebug "ACS-SC: ad_proc $proc_name $arguments\n$docblock\n$body\n"
ad_proc -private $proc_name $arguments $docblock $body
-
+
return 1
}
@@ -224,10 +224,10 @@
and call "acs_sc_proc" for all of these.
@see acs_sc_proc
-
+
} {
db_foreach impl_operation {
- select ia.impl_contract_name,
+ select ia.impl_contract_name,
ia.impl_operation_name,
ia.impl_name,
ia.impl_alias,
@@ -251,7 +251,7 @@
}
} errorMsg]} {
ns_log error "Service contract initialization failed, call was:\n\
- acs_sc_proc $impl_contract_name $impl_operation_name $impl_name $impl_alias $impl_pl"
+ acs_sc_proc $impl_contract_name $impl_operation_name $impl_name $impl_alias $impl_pl"
}
}
}
@@ -272,24 +272,24 @@
switch $impl_pl {
- TCL {
- set full_statement [list $impl_alias]
- for {set __i 0} {$__i < [llength $arguments]} {incr __i} {
- lappend full_statement "\$[lindex $arguments $__i]"
- }
- set full_statement [join $full_statement]
- }
- PLPGSQL {
- set args_list [list]
- for {set __i 0} {$__i < [llength $arguments]} {incr __i} {
- lappend args_list "\$[lindex $arguments $__i]"
- }
- set args_final [join $args_list ,]
- set full_statement "db_exec_plsql full_statement \"select ${impl_alias}(${args_final})\""
- }
- default {
- error "ACS-SC: Unknown impl_pl: $impl_pl"
- }
+ TCL {
+ set full_statement [list $impl_alias]
+ for {set __i 0} {$__i < [llength $arguments]} {incr __i} {
+ lappend full_statement "\$[lindex $arguments $__i]"
+ }
+ set full_statement [join $full_statement]
+ }
+ PLPGSQL {
+ set args_list [list]
+ for {set __i 0} {$__i < [llength $arguments]} {incr __i} {
+ lappend args_list "\$[lindex $arguments $__i]"
+ }
+ set args_final [join $args_list ,]
+ set full_statement "db_exec_plsql full_statement \"select ${impl_alias}(${args_final})\""
+ }
+ default {
+ error "ACS-SC: Unknown impl_pl: $impl_pl"
+ }
}
return $full_statement
@@ -304,7 +304,7 @@
} {
Additional documentation and commentary at http://openacs.org/forums/message-view?message_id=108614.
- @param contract the contract name
+ @param contract the contract name
@param operation the method to invoke
@param arguments list of arguments to pass to the method
@param impl the implementation name.
@@ -315,10 +315,9 @@
@see acs_sc::invoke
} {
acs_sc::invoke -contract $contract -operation $operation -impl $impl -call_args $arguments -error=$error_p
-}
+}
-
##
## Logging
##
@@ -328,7 +327,7 @@
# If you want to debug the SC, uncomment the Debug log below
if { "SCDebug" ne $level } {
ns_log $level "$msg"
- } else {
+ } else {
# ns_log Debug "$msg"
}
}