acs_sc::impl::new_from_spec (public)

 acs_sc::impl::new_from_spec -spec spec

Defined in packages/acs-service-contract/tcl/implementation-procs.tcl

Add new service contract implementation from an array-list style implementation, and binds it to the specified contract.

The specification takes the following form:

    set spec {
        contract_name "Action_SideEffect"
        owner "bug-tracker"
        name "CaptureResolutionCode"
        pretty_name "Capture Resolution Code"
        aliases {
            GetObjectType bug_tracker::bug::object_type
            GetPrettyName bug_tracker::bug::capture_resolution_code::pretty_name
            DoSideEffect  bug_tracker::bug::capture_resolution_code::do_side_effect
        }
    }
    acs_sc::impl::new_from_spec -spec $spec
    
And here's the explanation:

The spec is an array-list with the following entries:

  • contract_name: The name of the service contract you're implementing.
  • owner: Owner of the implementation, use the package-key.
  • name: Name of your implementation.
  • name: Pretty name of your implementation. You'd typically use this when displaying the service contract implementation through a UI.
  • aliases: Specification of the Tcl procedures for each of the service contract's operations.
The aliases section is itself an array-list. The keys are the operation names from the service contract. The values are the names of Tcl procedures in your package, which implement these operations.

Switches:
-spec (required)
The specification for the new service contract implementation.
Returns:
the impl_id of the newly registered implementation

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_sc_impl_new_from_spec acs_sc_impl_new_from_spec (test acs-service-contract) acs_sc::impl::new_from_spec acs_sc::impl::new_from_spec test_acs_sc_impl_new_from_spec->acs_sc::impl::new_from_spec acs_sc::impl::alias::parse_aliases_spec acs_sc::impl::alias::parse_aliases_spec (private) acs_sc::impl::new_from_spec->acs_sc::impl::alias::parse_aliases_spec acs_sc::impl::binding::init_procs acs_sc::impl::binding::init_procs (private) acs_sc::impl::new_from_spec->acs_sc::impl::binding::init_procs acs_sc::impl::binding::new acs_sc::impl::binding::new (public) acs_sc::impl::new_from_spec->acs_sc::impl::binding::new acs_sc::impl::new acs_sc::impl::new (public) acs_sc::impl::new_from_spec->acs_sc::impl::new db_transaction db_transaction (public) acs_sc::impl::new_from_spec->db_transaction acs::test::auth::registration::register_impl acs::test::auth::registration::register_impl (private) acs::test::auth::registration::register_impl->acs_sc::impl::new_from_spec auth::local::authentication::register_impl auth::local::authentication::register_impl (private) auth::local::authentication::register_impl->acs_sc::impl::new_from_spec auth::local::password::register_impl auth::local::password::register_impl (private) auth::local::password::register_impl->acs_sc::impl::new_from_spec auth::local::registration::register_impl auth::local::registration::register_impl (private) auth::local::registration::register_impl->acs_sc::impl::new_from_spec auth::local::user_info::register_impl auth::local::user_info::register_impl (private) auth::local::user_info::register_impl->acs_sc::impl::new_from_spec

Testcases:
acs_sc_impl_new_from_spec
Source code:
    # Spec contains: contract_name, name, pretty_name, owner, aliases
    array set impl $spec

    if { ![info exists impl(pretty_name)] } {
        set impl(pretty_name) ""
    }

    db_transaction {
        set impl_id [new  -contract_name $impl(contract_name)  -name $impl(name)  -pretty_name $impl(pretty_name)  -owner $impl(owner)]

        acs_sc::impl::alias::parse_aliases_spec  -contract_name $impl(contract_name)  -impl_name $impl(name)  -spec $impl(aliases)

        acs_sc::impl::binding::new  -contract_name $impl(contract_name)  -impl_name $impl(name)
    }

    # Initialize the procs so we can start calling them right away
    acs_sc::impl::binding::init_procs -impl_id $impl_id

    return $impl_id
Generic XQL file:
packages/acs-service-contract/tcl/implementation-procs.xql

PostgreSQL XQL file:
packages/acs-service-contract/tcl/implementation-procs-postgresql.xql

Oracle XQL file:
packages/acs-service-contract/tcl/implementation-procs-oracle.xql

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