Creating Blueprints is fun!

Page and Space blueprints are a great tool to structure information in Confluence. They support teams to create pages and spaces with focusing on the content, less on the structure, not on the layout. With this tool new pages and whole spaces can be created with wizards in very little time.

One great thing about blueprints is that they can be managed as add-ons. Teams can have their blueprints designed and maintained as versioned Maven projects. These add-ons can be easily shared by team working on different Confluence instances. Unfortunately creating new blueprints takes quiet some time. And the work is often not very rewarding since a little misspelling can require some minutes in getting it right. Error messages are not the API's strong suite.

After about two year of writing a number of blueprints for the projectdoc Toolbox, we finally came to the conclusion that we need to have some tool support to write blueprints. We want to come to the point where writing blueprints and create new add-ons with blueprint sets is no longer a great deal.

Principles

In the past we have come up with some simple observations that we like when using blueprints.

  1. Have sets of blueprints that work together, using existing blueprints
  2. Have at least one space that provides a basic structure for the domain of the blueprint set
  3. Create navigation by dynamic linking
    1. Provide a type blueprint for most of the blueprints
    2. Show pages of a given type
    3. Show child pages and a reference to the parent
    4. After the creation of a new space or new page, everything should be ready to work - no remove this, paste that

The Mission

To create a blueprint you need to touch a number of files.

  1. There is the XML file containing the template,
  2. the Soy file to specify the wizard.
  3. A JavaScript file for the validators for the wizard,
  4. probably a Java file to manipulate the blueprint context.
  5. Add localized resource files for one or more languages,
  6. create one or more index pages,
  7. and finally a number of edits to the atlassian-plugin.xml file.

So the basic course of events is this:

> mvn doctype:create 
  -DshortId=services 
  -DprojectName="Service Management Doctypes" 
  -DprojectDescription="Provides Blueprints for System Management."
  -DcreateExamples=false
> [add your descriptor files]
> mvn doctype:generate
> atlas-run

Types of Pages

To make this simplification we define some constraints.

First, we think of pages as documents with properties (key-value pairs) and sections (a title with text, possibly nested). We call this a projectdoc document. With this in mind, we define a document type with a doctype descriptor (there is also a descriptor for spaces and one for the context of the add-on).

When we create new doctype add-ons there are typically three kind of documents:

  1. Documents that contain information of a given type (e.g. a doctype to document systems)
  2. Documents that categorize this type (e.g. system type documents)
  3. Documents that categorize this and other types (e.g. documents that specify phases in a lifecycle)

The Tool

We created a first beta version of the Doctypes Maven Plugin that should make it a lot easier to create these three kinds of pages.

Everything starts with the archetype project. But you control the archtetype for doctype add-ons with the doctype:create goal which sets some defaults and makes creating new add-on projects quite easy.

> mvn doctype:create 
  -DshortId=services 
  -DprojectName="Service Management Doctypes" 
  -DprojectDescription="Provides Blueprints for System Management."
  -DcreateExamples=false

To simplify this process of blueprint creation, we do specify one descriptor per document and space type (currently there can only be one space).

Then generate all the blueprint related stuff (note there are XML schema files to support writing these). And startup Confluence with the Atlas SDK.

> mvn doctype:generate
> atlas-run

Limitations

We started our internal beta (although the sources are already published on Bitbucket) to check how it is working. Needless to say that at this early stage it has some limitations:

  • The syntax for defining sections is not final - property values (with alternate forms as seen above) and whole sections (without alternatives if you need to specify more than a placeholder) are specified in their storage format within an xml element
  • Only one space blueprint can be defined
  • There are grammatical problems with the boiler plate texts (especially in German), so there is the need to run over the generated localization bundles
  • No roundtrip: You should not need to edit the generated files (or if you do, should not use the descriptor again)
  • Very simple wizards currently
  • No support to add CSS or JavaScript
  • Currently the localized resources need to be written to the descriptor
  • There is also a redundancy specifying the central base templates - but you won't see this until you need to create your own base template

We'll work to improve the tools to remove these limitations.

What is next?

As stated above the tools have some rough edges. So we need to run this internally first. If you are interested to use this tool, it is available at Bitbucket and available from our Nexus server.

Please check out the documentation for the Doctypes Maven Plugin to get everything set up. Do not hesitate to get in touch, if you have questions or are being interested in this topic!

Hopefully we can soon truthfully say: Creating Blueprints is fun!