Forum OpenACS Q&A: Re: proc_name in acs_sc_call

Collapse
Posted by Neophytos Demetriou on
Hi Aldert, that command checks whether the proc with name $proc_name exists. If it exists it makes the call. Otherwise, nothing happens.

Here's how acs_sc_call works:

- Generate the name for the specified contract, implementation and operation. The proc name is a dotted expression of the form: AcsSc.${contract}.${operation}.${impl}

- If the proc exists, call it. Otherwise, do nothing.

Basically, the proc with name AcsSc.FtsContentProvider.DataSource.note (autogenerated proc by acs_sc_proc) would redirect a call like:

    acs_sc_call -contract FtsContentProvider -operation DataSource -impl note

to the concrete procedure that implements the ''DataSource'' operation of the contract ''FtsContentProvider'' in the implementation named ''note'', i.e to the proc ''notes__datasource'' defined in ''package/notes/tcl/notes-procs.tcl''.

I hope that helps.

Collapse
Posted by xx xx on
Thanks fo your reply, but I was wondering where the proc 'lives'. At one time, when debugging, I was trying to find out whether a proc was available. Does it live in the environment or is it stored in a table. Are there other ways to find out the existence, except for [info proc]?

Second, I would like to know where the redirect 'lives'. Which part/procedure of OpenACS redirects the 'AcsSc-proc' to the 'package-proc' (in your example "notes_datasource").

Collapse
Posted by Neophytos Demetriou on
Aldert, upon startup, the acs-service-contract looks into the available bindings (contract <--> implementation) in the db and foreach operation in the service contract it *generates* a proc of the form AcsSc.${contract}.${operation}.${impl}.

That proc is nothing more but a redirect to the concrete/actual implementation (provided by ${impl}) of the abstract contract operation. Check out the following url that is the API documentation of the **autogenerated** proc for the redirection for the operation ''datasource'' of the
service contract ''FtsContentProvider'' based on the implementation named ''forums_message'':

https://openacs.org/api-doc/proc-view?proc=AcsSc.FtsContentProvider.datasource.forums_message&source_p=1

For more autogenerated procs, check out:
https://openacs.org/api-doc/procs-file-view?path=packages%2facs%2dservice%2dcontract%2ftcl%2facs%2dservice%2dcontract%2dinit%2etcl

Collapse
Posted by xx xx on
Now it's clear Neophytos, thanks a lot.