site_node::instantiate_and_mount (public)
site_node::instantiate_and_mount [ -node_id node_id ] \ [ -parent_node_id parent_node_id ] [ -node_name node_name ] \ [ -package_name package_name ] [ -context_id context_id ] \ -package_key package_key [ -package_id package_id ]
Defined in packages/acs-tcl/tcl/site-nodes-procs.tcl
Instantiate and mount a package of given type. Will use an existing site node if possible.
- Switches:
- -node_id (optional)
- The id of the node in the site map where the package should be mounted.
- -parent_node_id (optional)
- If no node_id is specified this will be the parent node under which the new node is created. Defaults to the main site node id.
- -node_name (optional)
- If node_id is not specified then this will be the name of the new site node that is created. Defaults to package_key.
- -package_name (optional)
- The name of the new package instance. Defaults to pretty name of package type.
- -context_id (optional)
- The context_id of the package. Defaults to the closest ancestor package in the site map.
- -package_key (required)
- The key of the package type to instantiate.
- -package_id (optional)
- The id of the new package. Optional.
- Returns:
- The id of the instantiated package
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- subsite_api, site_node_update_cache, site_node_closest_ancestor_package, ad_proc_permission_grant_and_revoke, ad_proc_permission_permission_p, test_inheritance_and_custom_permissions, fs_publish_file, xowiki_test_cases
Source code: # Create a new node if none was provided and none exists if { $node_id eq "" } { # Default parent node to the main site if { $parent_node_id eq "" } { set parent_node_id [site_node::get_node_id -url "/"] } # Default node_name to package_key if { $node_name eq "" } { set node_name $package_key } # Create the node if it doesn't exists set parent_url [get_url -notrailing -node_id $parent_node_id] set url "${parent_url}/${node_name}" if { ![exists_p -url $url] } { set node_id [site_node::new -name $node_name -parent_id $parent_node_id] #ns_log notice "site_node::instantiate_and_mount NEW sitenode '$node_id'" } else { # Check that there isn't already a package mounted at the node set node [get -url $url] set object_id [expr {[dict exists $node object_id] ? [dict get $node object_id] : ""}] if { $object_id ne "" } { error "Cannot mount package at url $url as package $object_id is already mounted there" } set node_id [dict get $node node_id] } } # Default context id to the closest ancestor package_id if { $context_id eq "" } { set context_id [site_node::closest_ancestor_package -node_id $node_id] } #ns_log notice "site_node::instantiate_and_mount -node_id '$node_id' context_id '$context_id'" # Instantiate the package set package_id [apm_package_instance_new -package_id $package_id -package_key $package_key -instance_name $package_name -context_id $context_id] #ns_log notice "site_node::instantiate_and_mount -node_id '$node_id' context_id '$context_id' package_id '$package_id'" # Mount the package site_node::mount -node_id $node_id -object_id $package_id return $package_idGeneric XQL file: packages/acs-tcl/tcl/site-nodes-procs.xql
PostgreSQL XQL file: packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql
Oracle XQL file: packages/acs-tcl/tcl/site-nodes-procs-oracle.xql