PublishingWorkflow

Introduction

This page explains the workings of the Brix Publishing Plugin, and the steps you need to take to integrate it with the brix-demo project. The purpose of a publishing workflow is to ensure that content can be checked by several pairs of eyes, in different environments, from the developers machine, to a ‘staging’ or ‘preview’ website, and finally in the live or ‘customer’ website. This helps to ensure the quality of the content, as it has a better chance of passing through ‘proof’ reading.

The Plugin

The publishing plugin uses three different workspaces for each stage in the process of getting new content in production:

  1. Development
  2. Staging (also known as preview)
  3. Production

You can find these states in the class brix.plugin.publishing.PublishingPlugin

Integration with the brix-demo web application

There are a few things you need to change the brix-demo project into a project with the three workspaces required for the publishing plugin:

    <dependency>
      <groupId>brix</groupId>
      <artifactId>brix-plugin-publish</artifactId>
    </dependency>
    // register plugins
    config.getRegistry().register(Plugin.POINT, new MenuPlugin(this));
    config.getRegistry().register(Plugin.POINT, new SnapshotPlugin(this));
    config.getRegistry().register(Plugin.POINT, new PrototypePlugin(this));
    config.getRegistry().register(Plugin.POINT, new PublishingPlugin(this));
    config.getRegistry().register(Plugin.POINT, new WebdavUrlPlugin());
    ...
    brix.attachTo(this);
    initializeRepository();
    initDefaultWorkspace();
    ...

to:

    ...
    brix.attachTo(this);
    initializeRepository();
    String[] statesForWorkspaces = new String[] 
    {
        PublishingPlugin.STATE_DEVELOPMENT,
        PublishingPlugin.STATE_STAGING,
        PublishingPlugin.STATE_PRODUCTION
    };
    for (String state : statesForWorkspaces) 
    {
        initDefaultWorkspace(state);
    }

Now, we just parameterize the ‘initDefaultWorkspace’ method with the state.

    private void initDefaultWorkspace(String state)
    {
        try
        {
            final String defaultState = state;
    ...

The final change you have to make is in the URLMapper that is created in the ‘init’ method. Change the block below:

    final String name = getProperties().getJcrDefaultWorkspace();
    SitePlugin sitePlugin = SitePlugin.get(brix);
    return sitePlugin.getSiteWorkspace(name, "");

to:

    final String name = getProperties().getJcrDefaultWorkspace();
    SitePlugin sitePlugin = SitePlugin.get(brix);
    return sitePlugin.getSiteWorkspace(name, PublishingPlugin.STATE_PRODUCTION);

This initializes the demo application with the ‘PRODUCTION’ workspace state as default.

That’s it, now you can start up everything like you’re used to and you should have the three different states. Using the Publish tab, you can copy the contents of one state to the next state. As the web application is in ‘PRODUCTION’ state by default, you will see no content in the publishing tab. Try switching to the ‘DEVELOPMENT’ state with the site selector drop down.

Once you have done this, you will be able to publish to ‘STAGING’. If you change the state to ‘STAGING’, you can then publish to ‘PRODUCTION’.

This is a unique website which will require a more modern browser to work!

Please upgrade today!