Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-999

custom namespaces

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 3.1 M1
    • 3.0 RC2
    • None
    • None
    • linux

    Description

      I set up a module with custom node types and found that my node types couldn't be registered because the name space prefix I used (also custom) was not known to the underlying repository. The exception is thrown from code called in AbstractModule.registerRepositories(ModuleDefinition). The problem is that at the time registerRepositories is called from AbstractModule.register(ModuleDefinition, Content, int), the module hasn't had a chance to register the namespaces potentially used in the custom node definitions.

      I wanted to fix this by overriding the register method, but it is final. I looked for another built in hook, and found I could only add code to my Module Constructor. I added:

      try {
      HierarchyManager hierarchyManager = ContentRepository.getHierarchyManager("luxoom", "luxoom");
      if (hierarchyManager != null)

      { Workspace workspace = hierarchyManager.getWorkspace(); ContentRepository.getRepositoryProvider("magnolia").registerNamespace("lxm", "http://www.luxoom.com/jcr/lxm/1.0", workspace); }

      } catch (RepositoryException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }

      registerRepositories itself would be another place to override the functionality but that is protected. While looking at the register code, I also thought it strange that bootstrapping (a step which may involve the newly defined data types) is done after the repositories are registered.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                pbaerfuss Philipp Bärfuss
                chris_miner Chris Miner
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD