Chapter 2. Incision, Right Here

This chapter will explain the what, how and why of First Module. We will also create a module using the Webserver Pattern.

Inside [moduleroot]/module.xml

If were awake during the previous chapter, you noticed that the [moduleroot]/module.xml file contains most of the meat. It does in fact have two main purposes:

  1. Define your module.

  2. Define the ROC layout of your module.

Number one is obvious, and number two is important. If your ROC layout is done well, putting the rest of your module together will be easy (and short). So let’s study it in detail.

Template

Let’s start with a simple module.xml template.

<module version="2.0">
  <meta>
    <identity>
      <uri>urn:org:yourcompany:yourapplication:newmodule</uri>
      <version>0.0.1</version>
    </identity>
    <info>
      <name>New Module</name>
      <description>New Module Template</description>
    </info>
  </meta>

  <system>
    <dynamic/>
  </system>

  <rootspace>
  </rootspace>
</module>

Note

Having good templates available can seriously reduce your development time. You do not need a fancy system to manage them, though some editors have one, and if you feel comfortable with it, by all means use it. A simple directory will do. Make sure to put them under version control as well though!

The template contains nothing special:

<meta>

This contains the description of your module. Do note the use of colons in the URI.

<dynamic>

With <system><dynamic/></system> we indicate two things:

  1. Any change to [moduleroot]/module.xml will cause a hot reload of the module. ...

Get Resource-Oriented Computing with NetKernel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.