Forum OpenACS Development: Canonical Way to Instantiate and Mount a Package

I am working on auto-mount feature discussed in this thread:

https://openacs.org/forums/message-view?message_id=70889

and I'm having some problems figuring out what the preferred way of creating a package instance and mounting it in the site map is.

It turns out that currently, OpenACS has at least three approaches to doing this:

1. apm_package_instantiate_and_mount Only used in acs-bootstrap-installer/installer/auto-install.tcl Does not update cache, does not invoke callbacks. I've removed this proc (not committed yet).

2. subsite::auto_mount_application, that invokes site_node_mount_application, that invokes site_node_apm_integration::new_site_node_and_package. This seems to do the right things (takes care of cache and callbacks). This proc will also make sure the name of the node to mount the instance is unique. This proc is only invoked on the auto-mount page in the subsite admin UI. As far as I can tell this page is nowhere linked to in the system.

3. site_node_create_package_instance. A deprecated proc that seems to do exactly what the procs 2 above do. The proc is used on the package-new page in the site-map admin UI and this page is actually used. So as it turns out this last deprecated proc (that fortunately seems to do the right thing) is the only one that most people ever use.

What I propose is removing procs 2 altogether and to make auto-install.tcl (proc 1) use proc 3. We can enhance the argument handling of site_node_create_package_instance so that all you must provide is the package_key. We would also undeprecate the proc and move it into the site_node:: namespage.

What do you think?

Collapse
Posted by Jeff Davis on
I am a little confused about which procs you plan to remove.
just subsite::auto_mount_application, or all the ones mentioned in #2?
Collapse
Posted by Don Baccus on
The site_node_apm_integration namespace has about four procs in it, are these used elsewhere?  It looks like the intent was to provide all mounting/deletion facilities there.  It seems that this functionality should just be part of the site_node namespace.  If the site_node namespace doesn't provide that functionality perhaps it should be moved over from site_node_apm_integration?

Whether you move proc #2 or proc #3 over doesn't much matter since they essentially are doing the same thing (the cache appears to be updated by proc #3 despite the lack of an explicit call to do so).

If you have time to clean these namespaces up and make things more consistent, in addition to simply fixing stuff as you're doing, it would be *greatly* appreciated!

Collapse
Posted by Peter Marklund on
Don,
you are probably right about the site_node_apm_integration namespace. I'll look into moving the functionality into the site_node namespace on monday.

Jeff,
I was actually proposing to remove all procs and the page in point 2. Or do we have a policy against removal? I don't like keeping legacy code around that is never used. Either way, I am going to check carefully first if any of this functionality is used in dotLRN.

Collapse
Posted by Jeff Davis on
Well, I use site_node_mount_application and I think the ability to simply mount a package at an existing site node should be retained, but don't have an opinion on the others.

I would like to see the function names (and namespace) rationalized a little (which is I guess what yon started and which is why that proc is deprecated).

Collapse
Posted by Peter Marklund on
I have made the procs site_node::instantiate_and_mount (new) and apm_package_instance_new the canonical procs. All other procs with similar behaviour have been deprecated and made to invoke the canonical procs.

Let me know if I overlooked something.

Peter