public String copy(RequestContext requestContext) throws RegistryException { checkWriteLock(requestContext.getTargetPath(), requestContext); return requestContext.getTargetPath(); }
public String move(RequestContext requestContext) throws RegistryException { requestContext.setProcessingComplete(true); return requestContext.getTargetPath(); }
public String rename(RequestContext requestContext) throws RegistryException { requestContext.setProcessingComplete(true); return requestContext.getTargetPath(); }
public String copy(RequestContext requestContext) throws RegistryException { requestContext.setProcessingComplete(true); return requestContext.getTargetPath(); }
public String move(RequestContext requestContext) throws RegistryException { checkDeleteLock(requestContext.getSourcePath(), requestContext); checkWriteLock(requestContext.getTargetPath(), requestContext); return requestContext.getTargetPath(); }
@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 handleCreateLink(RequestContext requestContext) throws RegistryException { String targetPath = requestContext.getTargetPath(); if (!requestContext.getRegistry().resourceExists(targetPath)) { return false; } Resource targetResource = requestContext.getRegistry().get(targetPath); String mType = targetResource.getMediaType(); return mType != null && (invert != (mType.matches( "application/vnd\\.[a-zA-Z0-9.-]+\\+xml") & !mType.matches( "application/vnd.wso2-service\\+xml"))); } },
public String move(RequestContext requestContext) throws RegistryException { Registry registry = requestContext.getRegistry(); String sourcePath = requestContext.getSourcePath(); checkEndpointDependency(registry, sourcePath); return requestContext.getTargetPath(); }
public String copy(RequestContext requestContext) throws RegistryException { validateUpdateInProgress(); String sourcePath = requestContext.getSourcePath(); String targetPath = requestContext.getTargetPath(); if (sourcePath.startsWith(mountPath) && targetPath.startsWith(mountPath)) { filesystemManager.copy(RegistryUtils.getRelativePathToOriginal(sourcePath, mountPath), RegistryUtils.getRelativePathToOriginal(targetPath, mountPath)); } else if (targetPath.startsWith(mountPath)) { preparePut(RegistryUtils.getRelativePathToOriginal(targetPath, mountPath), requestContext); } return null; }
public String move(RequestContext requestContext) throws RegistryException { validateUpdateInProgress(); String sourcePath = requestContext.getSourcePath(); String targetPath = requestContext.getTargetPath(); if (sourcePath.startsWith(mountPath) && targetPath.startsWith(mountPath)) { String source = RegistryUtils.getRelativePathToOriginal(sourcePath, mountPath); filesystemManager.copy(source, RegistryUtils.getRelativePathToOriginal(targetPath, mountPath)); filesystemManager.delete(source); } else if (targetPath.startsWith(mountPath)) { preparePut(RegistryUtils.getRelativePathToOriginal(targetPath, mountPath), requestContext); } else if (sourcePath.startsWith(mountPath)) { filesystemManager.delete( RegistryUtils.getRelativePathToOriginal(sourcePath, mountPath)); } return null; }
public String rename(RequestContext requestContext) throws RegistryException { validateUpdateInProgress(); String sourcePath = requestContext.getSourcePath(); String targetPath = requestContext.getTargetPath(); String source = RegistryUtils.getRelativePathToOriginal(sourcePath, mountPath); filesystemManager.copy(source, RegistryUtils.getRelativePathToOriginal(targetPath, mountPath)); filesystemManager.delete(source); return null; }
public void removeAssociation(RequestContext requestContext) throws RegistryException { String type = requestContext.getAssociationType(); if (!type.equals(ASSOCIATION_TYPE_VOTED)) { log.debug("Non-voted association added to votes resource"); return; } Registry registry = Utils.getRegistryService().getSystemRegistry(); Resource shutterbugCollection = registry.get(shutterbugHome); String tenantUser = Utils.getTenantUser(); String uuid = shutterbugCollection.getProperty(tenantUser); if (uuid == null) { throw new RegistryException("You need to upload an image before you vote"); } String destination = requestContext.getTargetPath(); if (!registry.resourceExists(destination)) { throw new RegistryException("Provided image path is invalid"); } String source = shutterbugHome + RegistryConstants.PATH_SEPARATOR + uuid + RegistryConstants.PATH_SEPARATOR + VOTE_PATH; registry.removeAssociation(destination, source, ASSOCIATION_TYPE_USED_BY); registry.removeAssociation(source, destination, ASSOCIATION_TYPE_VOTED); requestContext.setProcessingComplete(true); }
@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); } }
try { String targetPath = requestContext.getTargetPath(); String sourcePath = requestContext.getSourcePath();
try { String targetPath = requestContext.getTargetPath(); String sourcePath = requestContext.getSourcePath();
public void addAssociation(RequestContext requestContext) throws RegistryException { String type = requestContext.getAssociationType(); if (!type.equals(ASSOCIATION_TYPE_VOTED)) { log.debug("Non-voted association added to votes resource"); return; } Registry registry = Utils.getRegistryService().getSystemRegistry(); Resource shutterbugCollection = registry.get(shutterbugHome); String tenantUser = Utils.getTenantUser(); String uuid = shutterbugCollection.getProperty(tenantUser); if (uuid == null) { throw new RegistryException("You need to upload an image before you vote"); } String destination = requestContext.getTargetPath(); if (!registry.resourceExists(destination)) { throw new RegistryException("Provided image path is invalid"); } String source = shutterbugHome + RegistryConstants.PATH_SEPARATOR + uuid + RegistryConstants.PATH_SEPARATOR + VOTE_PATH; Association[] associations = registry.getAssociations(source, ASSOCIATION_TYPE_VOTED); if (voteLimit < associations.length + 1) { throw new RegistryException("You have reached the vote limit of " + voteLimit); } registry.addAssociation(destination, source, ASSOCIATION_TYPE_USED_BY); registry.addAssociation(source, destination, ASSOCIATION_TYPE_VOTED); requestContext.setProcessingComplete(true); }
@Override public final void addAssociation(RequestContext requestContext) throws RegistryException { super.addAssociation(requestContext); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); UserRegistry registry = GovernanceRegistryExtensionsDataHolder.getInstance().getRegistryService() .getGovernanceUserRegistry(tenantDomain); GenericArtifact source = (GenericArtifact) GovernanceUtils.retrieveGovernanceArtifactByPath(registry, getUserRegistryPath(requestContext.getSourcePath())); GenericArtifact target = (GenericArtifact) GovernanceUtils.retrieveGovernanceArtifactByPath(registry, getUserRegistryPath(requestContext.getTargetPath())); onAddAssociation(requestContext.getAssociationType(), source, target); }
@Override public final void removeAssociation(RequestContext requestContext) throws RegistryException { super.removeAssociation(requestContext); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); UserRegistry registry = GovernanceRegistryExtensionsDataHolder.getInstance().getRegistryService() .getGovernanceUserRegistry(tenantDomain); GenericArtifact source = (GenericArtifact) GovernanceUtils.retrieveGovernanceArtifactByPath(registry, getUserRegistryPath(requestContext.getSourcePath())); GenericArtifact target = (GenericArtifact) GovernanceUtils.retrieveGovernanceArtifactByPath(registry, getUserRegistryPath(requestContext.getTargetPath())); onRemoveAssociation(requestContext.getAssociationType(), source, target); }
public void createLink(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); String target = requestContext.getTargetPath(); String relativeTarget = RegistryUtils.getRelativePath(requestContext.getRegistryContext(), target); RegistryEvent<String> event = new CollectionUpdatedEvent<String>("A link to " + relativeTarget + " was created at " + relativePath + "."); event.setParameter("Destination", relativeTarget); event.setParameter("SymbolicLink", relativePath); event.setParameter("RegistryOperation", "createLink"); ((CollectionUpdatedEvent)event).setResourcePath(parentPath); event.setTenantId(CurrentSession.getCallerTenantId()); try { notify(event, requestContext.getRegistry(), parentPath); } catch (Exception e) { handleException("Unable to send notification for Create Link Operation", e); } }
return; String targetPath = getPathWithoutVersion(requestContext.getTargetPath()); String relativeTargetPath = RegistryUtils.getRelativePath(requestContext.getRegistryContext(), targetPath);