auth::authority::batch_sync (public)

 auth::authority::batch_sync -authority_id authority_id

Defined in packages/acs-authentication/tcl/authority-procs.tcl

Execute batch synchronization for this authority now.

Switches:
-authority_id
(required)
Returns:
job_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_sync_batch_for_local sync_batch_for_local (test acs-authentication) auth::authority::batch_sync auth::authority::batch_sync test_sync_batch_for_local->auth::authority::batch_sync test_sync_batch_ims_example_doc sync_batch_ims_example_doc (test acs-authentication) test_sync_batch_ims_example_doc->auth::authority::batch_sync test_sync_batch_ims_test sync_batch_ims_test (test acs-authentication) test_sync_batch_ims_test->auth::authority::batch_sync ad_log ad_log (public) auth::authority::batch_sync->ad_log ad_try ad_try (public) auth::authority::batch_sync->ad_try auth::authority::get auth::authority::get (public) auth::authority::batch_sync->auth::authority::get auth::sync::GetAcknowledgementDocument auth::sync::GetAcknowledgementDocument (private) auth::authority::batch_sync->auth::sync::GetAcknowledgementDocument auth::sync::GetDocument auth::sync::GetDocument (private) auth::authority::batch_sync->auth::sync::GetDocument auth::sync::sweeper auth::sync::sweeper (private) auth::sync::sweeper->auth::authority::batch_sync packages/acs-admin/www/auth/batch-job-run.tcl packages/acs-admin/ www/auth/batch-job-run.tcl packages/acs-admin/www/auth/batch-job-run.tcl->auth::authority::batch_sync

Testcases:
sync_batch_for_local, sync_batch_ims_example_doc, sync_batch_ims_test
Source code:
    set job_id [auth::sync::job::start  -authority_id $authority_id]

    get -authority_id $authority_id -array authority

    set message {}

    # Verify that we have implementations
    if { $authority(get_doc_impl_id) eq "" } {
        set message "No Get Document implementation"
    } elseif$authority(process_doc_impl_id) eq "" } {
        set message "No Process Document implementation"
    } else {
        auth::sync::job::start_get_document -job_id $job_id

        array set doc_result {
            doc_status failed_to_connect
            doc_message {}
            document {}
            snapshot_p f
        }
        ad_try {
            array set doc_result [auth::sync::GetDocument -authority_id $authority_id]
        } on error {errorMsg} {
            ad_log Error "Error getting sync document: errorMsg"
            set doc_result(doc_status) failed_to_connect
            set doc_result(doc_message) $errorMsg
        }

        set snapshot_p [string is true -strict $doc_result(snapshot_p)]

        auth::sync::job::end_get_document  -job_id $job_id  -doc_status $doc_result(doc_status)  -doc_message $doc_result(doc_message)  -document $doc_result(document)  -snapshot=$snapshot_p

        if { $doc_result(doc_status) eq "ok" && $doc_result(document) ne "" } {
            ad_try {
                auth::sync::ProcessDocument  -authority_id $authority_id  -job_id $job_id  -document $doc_result(document)

                set ack_doc [auth::sync::GetAcknowledgementDocument  -authority_id $authority_id  -job_id $job_id  -document $doc_result(document)]

                set ack_file_name [parameter::get_from_package_key  -parameter AcknowledgementFileName  -package_key acs-authentication  -default {}]

                if { $ack_file_name ne "" } {
                    # Interpolate
                    set pairs [list  acs_root_dir $::acs::rootdir  ansi_date [clock format [clock seconds] -format %Y-%m-%d]  authority $authority(short_name)]
                    foreach { var value } $pairs {
                        regsub -all "{$var}" $ack_file_name $value ack_file_name
                    }

                    template::util::write_file  $ack_file_name  $ack_doc
                }
            } on error {errorMsg} {
                ad_log Error "Error processing sync document: $errorMsg"
                set message "Error processing sync document: $errorMsg"
            }
        } else {
            if { $message eq "" } {
                set message $doc_result(doc_message)
            }
        }

        if { $snapshot_p } {
            # If this is a snapshot, we need to delete all the users belonging to this authority
            # that weren't included in the snapshot.
            auth::sync::job::snapshot_delete_remaining  -job_id $job_id
        }
    }

    auth::sync::job::end  -job_id $job_id  -message $message

    return $job_id
Generic XQL file:
packages/acs-authentication/tcl/authority-procs.xql

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

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

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