wiki:Malted/PluginDevelopmentNotes

Version 3 (modified by Malte, 8 years ago) (diff)

adding rule of thumb for plugins introducing custom-types

A page for taking my notes on server- and client-side plugin development with DeepaMehta 4.

DeepaMehta Webclient Development

Implementing Many Simple Renderers

It seems to me that one can not register many simple_renderer-implementations* in one js-renderer file.
Doing so, will make the webclient crash on initial startup with random error messages, mostly of the like "(parsererror: TypeCacheError?: topic type "dm4.core.topic_type" not found)".
Hint: A simple_renderer implementaton looks usually like this: dm4c.add_simple_renderer('tld.project.type.renderer_name', { render_info:function(model, $parent){}, render_form:function(model, $parent){}})

After slicing all my simple_renderers into seperate .js-files, webclient startup works fine again.

Introducing my custom types to DeepaMehta's default workspace

Assigning your custom types to a workspace is not yet configurable. And manually assigning custom types to the default workspace opens up space for errors.

So, especially in a clean installation (DB from scratch) your plugins migration assigning your types to the defualt workspace depends on the "de.deepamehta.workspaces"-plugin which initially creates the "Default Workspace Topic (uri: de.workspaces.deepamehta)".

Adding de.deepamehta.workspaces into the line "importModels=" of my plugin.poperties file makes sure that the dm4-workspaces-plugin is started, and thus the default workspace topic is created, before my custom plugin starts running any of its migrations.

Addendum: Since the "importModels=" property influences the starting order of all plugins, a rule of thumb was identified in Ticket #465: "If your plugin introduces new types, you have to import the "de.deepamehta.accesscontrol" model". Otherwise ACL-Entries may not be set correct during installation of your plugin since the ACL-Plugin is not there to do it's job.

Working on server-side with dms (Application Service)

As a rule of thumb: Whenever you pass the ClientState?-Object into a dms.*-call, all necessary ACL- and Workspace-Assignments should be set automatically by DeepaMehta. This happens because the information which "User" is currrently active in which "Workspace" is part of the Session-Cookie.

DeepaMehtas? default behaviour for new types introduced by a plugin

DeepaMehtas? default behaviour for new (programmatically introduced) types is to not automatically assign type's to a "Workspace" if the types uri does not begin with the identifier "dm4.*".