This project is read-only.
Modules

Modules are a deployment packages of certain functionality. E.g. Pages, Blog, News, User Management … Rabbit Module is extremely simple and light weight. It is a static class that has methods with the Hook attribute. It is much simpler than many other frameworks.

public static class ModuleName
{
    [Hook("get-module-admin-menu")]
    public static dynamic GetAdminMenu(dynamic data)
    {
       //reacts to the hook
    }
}
Hooks are call backs to events. The sample module code above can be explained as the module tells the Rabbit site engine that when event get-module-admin-menu happened, run this.

The Hook attribute by default takes method name as hook name. You can override the name explicitly in the attribute.

The convention is to save the module classes in folder: App_Code\Rabbit\Modules\<ModuleName>\<ModuleName>.cs.

Rabbit framework will scan the child folders under App_Code\Rabbit\Modules. When found modules, they can be enable and disable at runtime using the Rabbit-Admin page.

Rabbit-Admin-1.png

The Rabbit-Admin page is a UI to configure Rabbit Framework. It is extensible if you will. But out-of-box page is simple yet straight forward. All modules are listed as a line in the text box. To disable a module, comment it out by adding a # in front of it.

Rabbit-Admin-2.png

When the module is disabled, its admin menus will not be shown on the Rabbit Admin page. Its hooks will not run.

The order of the modules are listed is important. It decides the order that modules to be loaded. Hooks in later modules will run later than earlier modules. This allows the later modules adding more functions on top of earlier modules. It can also be describe differently as earlier modules publish extension points. Later modules implement the extension points. Later modules are the plug-ins to earlier modules.

Using the Rabbit Admin Page, you can turn on the logging to see how the modules being loaded and hooks being added.

3/5/2011 5:56:14 PM SiteEngine: Start Loading Module Core
3/5/2011 5:56:14 PM SiteEngine:  AddHook getsitesettings
3/5/2011 5:56:14 PM SiteEngine:  AddHook get_layout
3/5/2011 5:56:14 PM SiteEngine:  AddHook get_templates
3/5/2011 5:56:14 PM SiteEngine: Done Loading Module Core

3/5/2011 5:56:14 PM SiteEngine: Start Loading Module Pages
3/5/2011 5:56:14 PM SiteEngine:  AddHook get_homepage
3/5/2011 5:56:14 PM SiteEngine:  AddHook get_menu
3/5/2011 5:56:14 PM SiteEngine:  AddHook save_menu
3/5/2011 5:56:14 PM SiteEngine:  AddHook getmoduleadmin_menu
3/5/2011 5:56:14 PM SiteEngine:  AddHook getpagespage_list
3/5/2011 5:56:14 PM SiteEngine:  AddHook getpagespage
3/5/2011 5:56:14 PM SiteEngine:  AddHook savepagespage
3/5/2011 5:56:14 PM SiteEngine:  AddHook deletepagespage
3/5/2011 5:56:14 PM SiteEngine: Done Loading Module Pages


Rabbit Modules are distributed as NuGet Package. NuGet can help managing the versions and dependencies between modules.

Last edited Mar 9, 2011 at 6:29 PM by yysun, version 3

Comments

No comments yet.