[MAGNOLIA-3064] check for an existing repository mapping before adding a new workspace for a module Created: 09/Feb/10  Updated: 23/Jan/13  Resolved: 10/Feb/10

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 4.3

Type: Improvement Priority: Major
Reporter: Fabrizio Giustina Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
supersession
is superseded by MAGNOLIA-3120 Remove repository/workspace mappings ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

This change is needed in order to be able to setup a separate clustered repository for specific workspaces.

Although we have the repository mapping in place, which converts between a logical workspace name to a repository/workspace name pair for jackrabbit, the jackrabbit repository name is specified also in each module descriptor.

So if we have a module with a repository declared as:

<repositories>
    <repository>
      <name>magnolia</name>
      <workspaces>
        <workspace>commenting</workspace>
      </workspaces>
      <nodeTypeFile>/mgnl-nodetypes/commenting/magnolia-nodetypes.xml</nodeTypeFile>
    </repository>
  </repositories>

the only way to move this workspace to a shared repository is to patch the module descriptor, changing the repository name to a different value, e.g. "shared".

A good solution would have been avoiding the repository name in the module descriptor at all, defaulting to Magnolia if there is no mapping already defined in repositories.xml (but it's too late for a similar change, module descriptors needs to be compatible with previous versions).

The proposed solution is to fix ModuleManagerImpl.loadRepository() in order to look for an existing repo mapping using the workspace name. If the mapping is found just use such repository instead of creating a new one, whatever repository name is set in the module descriptor.

For the previous scenario, we will look for a mapping for the "commenting" workspace. If found, we proceed using the jackrabbit repository name specified in the mapping. (side note: ModuleManagerImpl actually always creates an additional workspace with the same name of the repository - this should not be done, the actual jackrabbit repository name could be any user-invented value)



 Comments   
Comment by Fabrizio Giustina [ 10/Feb/10 ]

done for 4.3.

Now if a modules defined a workspace, the mapping in repository.xml is checked: if a workspace with such (logical) name is already defined, use the configured repository instead of creating a new one.

Generated at Mon Feb 12 03:42:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.