/** * Returns the logical workspace name given a physical workspace name. Note that this method will return the FIRST * physical workspace it finds with this name. If there are more workspaces with this name it is not defined which * is returned. * * @return the logical workspace name or if no such logical workspace exists returns the physical workspace name given as an argument * @deprecated since 4.5 - do not use. */ public static String getInternalWorkspaceName(String physicalWorkspaceName) { RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class); Collection<WorkspaceMappingDefinition> repositoryNameMap = repositoryManager.getWorkspaceMappings(); for (WorkspaceMappingDefinition mappingDefinition : repositoryNameMap) { if (mappingDefinition.getPhysicalWorkspaceName().equalsIgnoreCase(physicalWorkspaceName)) { return mappingDefinition.getLogicalWorkspaceName(); } } log.error("No Repository/Workspace name mapping defined for {}", physicalWorkspaceName); return physicalWorkspaceName; }
/** * Returns magnolia specific Repository name where this workspace is registered within <Repository/>. * * Note: if more than one repository has a physical workspace by this name this method is ambigious as to which it returns * * @throws RepositoryException if no physical workspace exists by that name * @deprecated since 4.5 - do not use. */ public static String getParentRepositoryName(String physicalWorkspaceName) throws RepositoryException { RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class); for (WorkspaceMappingDefinition mapping : repositoryManager.getWorkspaceMappings()) { if (physicalWorkspaceName.equalsIgnoreCase(mapping.getPhysicalWorkspaceName())) { return mapping.getRepositoryName(); } } throw new RepositoryException("No mapping found for " + physicalWorkspaceName + " repository in magnolia repositories.xml"); }