/** * This method will return mounted path of the path if the path * is mounted. Else path will be returned. * * @param registryContext Registry Context instance which holds path mappings * @param path default path of the registry * @return mounted path or path */ public static String getMountedPath(RegistryContext registryContext, String path) { if (registryContext != null && path != null) { List<Mount> mounts = registryContext.getMounts(); if (mounts != null) { for (Mount mount : mounts) { if (path.equals(mount.getPath())) { return mount.getTargetPath(); } } } } return path; }
/** * This method used to generate mount path.(Fix need to go to kernel, Since Kernel 4.4.0 already released * will maintain fix here.) * @param requestContext * @param servicePath * @return */ public static String getRegistryPath(RegistryContext requestContext, String servicePath){ List<Mount> mounts = requestContext.getMounts(); for (Mount mount: mounts) { String mountPath = mount.getPath(); if (servicePath.startsWith(mountPath) && !servicePath.startsWith(mount.getTargetPath())){ return servicePath.replace(mountPath, mount.getTargetPath()); } } return servicePath; }
/** * Method will add Local PathMap to the CurrentSession, if it is not exists * Set ARCHIEVE_UPLOAD param to true, it param is accessed to calculate registry path in mounted env. * @param requestContext the request context to get mount points * @return whether pathMap is set or not */ private boolean setSessionLocalPathMap(RequestContext requestContext) { boolean pathMapSet = false; if (CurrentSession.getLocalPathMap() == null) { RegistryContext registryContext = requestContext.getRegistry().getRegistryContext(); if (registryContext != null && registryContext.getMounts() != null && !registryContext.getMounts().isEmpty()) { Map<String, String> localPathMap = new HashMap<String, String>(); CurrentSession.setLocalPathMap(localPathMap); CurrentSession.getLocalPathMap().put(CommonConstants.ARCHIEVE_UPLOAD, "true"); pathMapSet = true; } } else { CurrentSession.getLocalPathMap().put(CommonConstants.ARCHIEVE_UPLOAD, "true"); } return pathMapSet; }
private String getRegistryPath(RequestContext requestContext) { String servicePath = requestContext.getResourcePath().getPath(); List<Mount> mounts = requestContext.getRegistry().getRegistryContext().getMounts(); for (Mount mount: mounts) { String mountPath = mount.getPath(); if (servicePath.startsWith(mount.getTargetPath())){ return servicePath.replace(mount.getTargetPath(), mountPath); } } return servicePath; }
resourceMediaType = requestContext.getResource().getMediaType(); List<Mount> mounts = requestContext.getRegistry().getRegistryContext().getMounts(); for (Mount mount: mounts) { String mountPath = mount.getPath();
for (Mount mount : registry.getRegistryContext().getMounts()) { for (RemoteConfiguration configuration : registry.getRegistryContext().getRemoteInstances()) { if (updatedPath.startsWith(mount.getPath())) {
for (Mount mount : registry.getRegistryContext().getMounts()) { for (RemoteConfiguration configuration : registry.getRegistryContext().getRemoteInstances()) { if (resourcePath.startsWith(mount.getPath())) {