private boolean isIdentityPolicyPath(RequestContext requestContext) { if (requestContext.getResourcePath() != null && requestContext.getResourcePath().getCompletePath().contains(identityPolicyPath)) { return true; } return false; } }
public void restore(RequestContext requestContext) throws RegistryException { log.warn("Skipping restoration to path: " + requestContext.getResourcePath().getPath()); }
public void put(RequestContext requestContext) throws RegistryException { String path = requestContext.getResourcePath().getPath(); String[] pathFragments = path.split(RegistryConstants.PATH_SEPARATOR); for (String pathFragment : pathFragments) { if (pathFragment.matches(CommonConstants.SERVICE_VERSION_REGEX.replace("$", "(-[a-zA-Z0-9]+)?$")) && !pathFragment.matches(expression)) { throw new RegistryException("The version " + pathFragment + " is not valid. " + "Please specify a version in the format " + exampleFormat + "."); } } } }
public void delete(RequestContext requestContext) throws RegistryException { final String id = requestContext.getResourcePath().getPath(); final int tenantId = CurrentSession.getTenantId(); new Thread(new Runnable() { int tid = tenantId; public void run() { try { deleteFromIndex(id, tid); } catch (SolrException e) { log.error("Could not delete file for Solr server", e); } catch (RegistryException e) { log.error("Could not delete file for Solr server", e); } } }).start(); }
public void put(RequestContext requestContext) throws RegistryException { checkWriteLock(requestContext.getResourcePath().getPath(), requestContext); }
public void delete(RequestContext requestContext) throws RegistryException { checkDeleteLock(requestContext.getResourcePath().getPath(), requestContext); }
public void restore(RequestContext requestContext) throws RegistryException { checkWriteLock(requestContext.getResourcePath().getPath(), requestContext); }
public void importResource(RequestContext requestContext) throws RegistryException { checkWriteLock(requestContext.getResourcePath().getPath(), requestContext); }
private void deleteOldResource(RequestContext context, Resource metaDataResource, WSDLInfo wsdlInfo, String wsdlPath, Resource wsdlResource) throws RegistryException { if(wsdlInfo.isMasterWSDL()){ if (metaDataResource != null) { wsdlResource.setUUID(metaDataResource.getUUID()); } if(!wsdlPath.equals(context.getResourcePath().getPath()) && registry.resourceExists(context.getResourcePath().getPath())){ registry.delete(context.getResourcePath().getPath()); } } }
@Override public void createLink(RequestContext requestContext) throws RegistryException { String symlinkPath = requestContext.getResourcePath().getPath(); if (!symlinkPath.startsWith(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH)) { throw new RegistryException("symlink creation is not allowed for artifact " + requestContext.getTargetPath()); } } });
@Override public boolean handleDelete(RequestContext requestContext) throws RegistryException { Resource resource = requestContext.getResource(); if (resource != null) { String mType = resource.getMediaType(); return mType != null && (invert != mType.equals(getMediaType())); } else if (requestContext.getResourcePath() != null) { resource = requestContext.getRegistry().get(requestContext. getResourcePath().getCompletePath()); if (resource != null) { String mType = resource.getMediaType(); return mType != null && (invert != mType.equals(getMediaType())); } } return false; } }
@Override public boolean handleDelete(RequestContext requestContext) throws RegistryException { Resource resource = requestContext.getResource(); if (resource != null) { String mType = resource.getMediaType(); return mType != null && (invert != mType.equals(getMediaType())); } else if (requestContext.getResourcePath() != null) { resource = requestContext.getRegistry().get(requestContext. getResourcePath().getCompletePath()); if (resource != null) { String mType = resource.getMediaType(); return mType != null && (invert != mType.equals(getMediaType())); } } return false; } }
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; }
public Resource get(RequestContext requestContext) throws RegistryException { Resource resource = requestContext.getRepository().get(requestContext.getResourcePath().getPath()); resource.setProperty("registry.externalLink", "true"); requestContext.setProcessingComplete(true); return resource; } }
public void put(RequestContext requestContext) throws RegistryException { if (!CommonUtil.isSCMLockAvailable()) { return; } validateUpdateInProgress(); String path = RegistryUtils.getRelativePathToOriginal( requestContext.getResourcePath().getPath(), mountPath); preparePut(path, requestContext); }
public void delete(RequestContext requestContext) throws RegistryException { if (!CommonUtil.isSCMLockAvailable()) { return; } validateUpdateInProgress(); String path = RegistryUtils.getRelativePathToOriginal( requestContext.getResourcePath().getPath(), mountPath); filesystemManager.delete(path); }
public void putChild(RequestContext requestContext) throws RegistryException { Registry registry = requestContext.getRegistry(); String thisCollectionPath = requestContext.getParentPath(); String thisCollectionName = RegistryUtils.getResourceName(thisCollectionPath); String parentContainerPath = RegistryUtils.getParentPath(thisCollectionPath); Resource parentContainer = registry.get(parentContainerPath); if (thisCollectionName.equals(parentContainer.getProperty( CommonConstants.LATEST_VERSION_PROP_NAME))) { String resourcePath = requestContext.getResourcePath().getPath(); String resourceName = RegistryUtils.getResourceName(resourcePath); registry.createLink(parentContainerPath + RegistryConstants.PATH_SEPARATOR + resourceName, resourcePath); } }
public void delete(RequestContext requestContext) throws RegistryException { if (!CommonUtil.isDeleteLockAvailable()) { return; } CommonUtil.acquireDeleteLock(); Registry registry = requestContext.getRegistry(); String path = requestContext.getResourcePath().getPath(); try { if (path == null) { throw new RegistryException("The resource path is not available."); } //checkEndpointDependency(registry, path); Resource resource = registry.get(path); } finally { CommonUtil.releaseDeleteLock(); } }
@Override public void createLink(RequestContext requestContext) throws RegistryException { String symlinkPath = requestContext.getResourcePath().getPath(); String targetResourcePath = requestContext.getTargetPath(); if (requestContext.getRegistry().resourceExists(targetResourcePath)) { Resource r = requestContext.getRegistry().get(targetResourcePath); r.addProperty("registry.resource.symlink.path", symlinkPath); requestContext.getRegistry().put(targetResourcePath, r); } }
public void removeLink(RequestContext requestContext) throws RegistryException { String path = requestContext.getResourcePath().getPath(); String relativePath = RegistryUtils.getRelativePath(requestContext.getRegistryContext(), path); if (!sendNotifications(requestContext, relativePath)){ return; } String parentPath = RegistryUtils.getParentPath(relativePath); RegistryEvent<String> event = new CollectionUpdatedEvent<String>("The link at " + relativePath + " was removed."); ((CollectionUpdatedEvent)event).setResourcePath(parentPath); event.setParameter("SymbolicLink", relativePath); event.setParameter("RegistryOperation", "removeLink"); event.setTenantId(CurrentSession.getCallerTenantId()); try { notify(event, requestContext.getRegistry(), parentPath); } catch (Exception e) { handleException("Unable to send notification for Remove Link Operation", e); } }