apm_invoke_callback_proc (public)

 apm_invoke_callback_proc [ -proc_name proc_name ] \
    [ -version_id version_id ] [ -package_key package_key ] \
    [ -arg_list arg_list ] -type type

Defined in packages/acs-tcl/tcl/apm-procs.tcl

Invoke the Tcl callback proc of a given type for a given package version. Any errors during invocation are logged.

Switches:
-proc_name (optional)
if this is provided it is called instead of attempting to look up the proc via the package_key or version_id (needed for before-install callbacks since the db is not populated when those are called).
-version_id (optional)
-package_key (optional)
-arg_list (optional)
-type (required)
Returns:
1 if invocation was carried out successfully, 0 if no proc to invoke could be found. Will propagate any error thrown by the callback.
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm__test_callback_invoke apm__test_callback_invoke (test acs-tcl) apm_invoke_callback_proc apm_invoke_callback_proc test_apm__test_callback_invoke->apm_invoke_callback_proc apm_callback_format_args apm_callback_format_args (public) apm_invoke_callback_proc->apm_callback_format_args apm_get_callback_proc apm_get_callback_proc (public) apm_invoke_callback_proc->apm_get_callback_proc apm_package_key_from_version_id apm_package_key_from_version_id (public) apm_invoke_callback_proc->apm_package_key_from_version_id apm_post_instantiation_tcl_proc_from_key apm_post_instantiation_tcl_proc_from_key (private) apm_invoke_callback_proc->apm_post_instantiation_tcl_proc_from_key apm::convert_type apm::convert_type (public) apm::convert_type->apm_invoke_callback_proc apm_package_delete apm_package_delete (public) apm_package_delete->apm_invoke_callback_proc apm_package_install apm_package_install (public) apm_package_install->apm_invoke_callback_proc apm_package_instance_delete apm_package_instance_delete (public) apm_package_instance_delete->apm_invoke_callback_proc apm_package_instance_new apm_package_instance_new (public) apm_package_instance_new->apm_invoke_callback_proc

Testcases:
apm__test_callback_invoke
Source code:
    array set arg_array $arg_list

    if {$proc_name eq ""} {
        set proc_name [apm_get_callback_proc  -version_id $version_id  -package_key $package_key  -type $type]
    }

    if { $proc_name eq "" } {
        if {$type eq "after-instantiate"} {
            # We check for the old proc on format: package_key_post_instantiation package_id
            if { $package_key eq "" } {
                set package_key [apm_package_key_from_version_id $version_id]
            }
            set proc_name [apm_post_instantiation_tcl_proc_from_key $package_key]
            if { $proc_name eq "" } {
                # No callback and no old-style callback proc - no options left
                return 0
            }

            {*}$proc_name $arg_array(package_id)

            return 1

        } else {
            # No other callback procs to fall back on
            return 0
        }
    }

    # We have a nonempty name of a callback proc to invoke
    # Form the full command including arguments
    set command [list {*}$proc_name {*}[apm_callback_format_args -type $type -arg_list $arg_list]]

    # We are ready for invocation
    ns_log notice "apm_invoke_callback_proc: invoking callback $type with command <$command>"
    {*}$command

    return 1
Generic XQL file:
packages/acs-tcl/tcl/apm-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: