[MGNLDATA-178] Remove fixed repository name in ImportHandler Created: 21/May/13 Updated: 15/Mar/21 Resolved: 15/Mar/21 |
|
| Status: | Closed |
| Project: | Magnolia Data Module (closed) |
| Component/s: | None |
| Affects Version/s: | 1.7.4 |
| Fix Version/s: | 1.7.x |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Lars Fischer | Assignee: | Unassigned |
| Resolution: | Obsolete | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Template: |
|
| Patch included: |
Yes
|
| Acceptance criteria: |
Empty
|
| Description |
|
In it's current version the ImportHandler standard implementation is limited to the data repository (otherwise you have to override the backup method) if you use the backup mechanism because the backup method uses a fixed name for the repository: HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(DataModule.getRepository()); This should be like the rest of the code: HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(repository); It's even possible to remove the deprecated HierarchyManager in the backup method: Replace DataTransporter.executeExport(stream, false, false, hm.getWorkspace().getSession(), target.getTargetPath(), repository, ".gz"); with DataTransporter.executeExport(stream, false, false, MgnlContext.getJCRSession(repository), target.getTargetPath(), repository, ".gz"); and catch the exception. The full method could be like this: protected void backup(ImportTarget target) throws ImportException { catch (FileNotFoundException e) { throw new ImportException("can't create backup file [" + backupFile + "] "); } // export data catch (RepositoryException e) { throw new ImportException("can't get JCR session for repository " + repository, e); }catch (IOException e) { throw new ImportException("can't export data for backuping", e); } IOUtils.closeQuietly(stream); The use case is when you extend an ImportHandler and use a target workspace other than data (e. g. DMS). This currently works only if you also overwrite the backup method. |