apm_package_instance_new (public)
apm_package_instance_new -package_key package_key \ [ -instance_name instance_name ] [ -package_id package_id ] \ [ -context_id context_id ]
Defined in packages/acs-tcl/tcl/apm-procs.tcl
Creates a new instance of a package and calls the post instantiation proc, if any. If the package is a singleton and already exists then this procedure will silently do nothing.
- Switches:
- -package_key (required)
- The package_key of the package to instantiate.
- -instance_name (optional)
- The name of the package instance, defaults to the pretty name of the package type.
- -package_id (optional)
- The id of the new package. Optional.
- -context_id (optional)
- The context_id of the new package. Optional.
- Returns:
- The id of the instantiated package
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- test_apm_package_instance__new
Source code: if { $instance_name eq "" } { set p_name [apm::package_version::attributes::get_instance_name $package_key] if {$p_name eq ""} { set instance_name [db_string pretty_name_from_key {select pretty_name from apm_enabled_package_versions where package_key = :package_key}] } else { set instance_name "$p_name" } } # # Do not do anything for already instantiated singleton packages # if {![db_0or1row instantiated_singleton_p { select package_id from apm_package_types t, apm_packages p where t.singleton_p = 't' and t.package_key = p.package_key and t.package_key = :package_key}] } { # # Instantiate package # set package_id [db_exec_plsql invoke_new {}] apm_parameter_sync $package_key $package_id foreach inherited_package_key [nsv_get apm_package_inherit_order $package_key] { apm_invoke_callback_proc -package_key $inherited_package_key -type after-instantiate -arg_list [list package_id $package_id] } } return $package_idGeneric XQL file: packages/acs-tcl/tcl/apm-procs.xql
PostgreSQL XQL file: <fullquery name="apm_package_instance_new.invoke_new"> <querytext> select apm_package__new( :package_id, :instance_name, :package_key, 'apm_package', now(), null, null, :context_id ); </querytext> </fullquery>packages/acs-tcl/tcl/apm-procs-postgresql.xql
Oracle XQL file: <fullquery name="apm_package_instance_new.invoke_new"> <querytext> begin :1 := apm_package.new( package_id => :package_id, instance_name => :instance_name, package_key => :package_key, context_id => :context_id ); end; </querytext> </fullquery>packages/acs-tcl/tcl/apm-procs-oracle.xql