Remove node that contains groovy script.

@param repository repository name
@param workspace workspace name
@param path JCR path to node that contains script
@LevelAPI Provisional
503842
@POST
   @Path("delete/{repository}/{workspace}/{path:.*}")
   public Response deleteScript(@PathParam("repository") String repository, @PathParam("workspace") String workspace,
      @PathParam("path") String path)
   {
      Session ses = null;
      try
      {
         ses =
            sessionProviderService.getSessionProvider(null).getSession(workspace,
               repositoryService.getRepository(repository));
         ses.getItem("/" + path).remove();
         ses.save();
         return Response.status(Response.Status.NO_CONTENT).build();
      }
      catch (PathNotFoundException e)
      {
         String msg = "Path " + path + " does not exists";
         LOG.error(msg);
         return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
      }
      catch (Exception e)
      {
         LOG.error(e.getMessage(), e);
         return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
            .type(MediaType.TEXT_PLAIN).build();
      }
      finally
      {
         if (ses != null)
         {
            ses.logout();
         }
      }
   }
932422
public void deleteResource(final String resourcePath) {

        CmsDeleteWarningDialog dialog = new CmsDeleteWarningDialog(resourcePath);
        Command callback = new Command() {

            /**
             * @see com.google.gwt.user.client.Command#execute()
             */
            public void execute() {

                updateResultsTab(false);
            }
        };
        dialog.loadAndShow(callback);
    }
236046
static void deletePath(String path) {
        try {
            ZkConnection.client.delete().guaranteed().deletingChildrenIfNeeded().forPath(path);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
386452
@Delete("/projects/{projectName}/repos/{repoName}")
    @RequiresRole(roles = ProjectRole.OWNER)
    public CompletableFuture<Void> removeRepository(ServiceRequestContext ctx,
                                                    @Param("repoName") String repoName,
                                                    Repository repository,
                                                    Author author) {
        if (Project.isReservedRepoName(repoName)) {
            return HttpApiUtil.throwResponse(ctx, HttpStatus.FORBIDDEN,
                                             "A reserved repository cannot be removed.");
        }
        return execute(Command.removeRepository(author, repository.parent().name(), repository.name()))
                .thenCompose(unused -> mds.removeRepo(author, repository.parent().name(), repository.name()))
                .handle(HttpApiUtil::throwUnsafelyIfNonNull);
    }
199039
protected Node getContentNode(Session session, String path)
            throws RepositoryException {
        Node node = null;
        try {
            Item item = session.getItem(path);
            if (item.isNode()) {
                node = (Node) item;
            } else {
                node = item.getParent();
            }
            while (node != null
                    && !isTargetNode(node)
                    && (path = getTargetPath(node)) != null) {
                node = node.getParent();
            }
        } catch (PathNotFoundException ignore) {
            // probably removed... ignore
        }
        return path != null ? node : null;
    }
327555
public void removeRepository(Repository repo) throws GreenPepperServerException
    {
        if(!repositories.contains(repo))
        {
            throw new GreenPepperServerException( GreenPepperServerErrorKey.REPOSITORY_NOT_FOUND, "Repository not found");
        }

        repositories.remove(repo);
        repo.setProject(null);
    }
1118753
@Override
  public void onFileDelete(Path rawPath) {
    URI jobSpecUri = this.converter.computeURI(rawPath);
    // TODO: fix version
    listeners.onDeleteJob(jobSpecUri, null);
  }
762113
public void deletePath(final Path path, final boolean recursive) {
    this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        Lock lock = ParallelRunner.this.locks.get(path.toString());
        lock.lock();
        try {
          HadoopUtils.deletePath(ParallelRunner.this.fs, path, recursive);
          return null;
        } finally {
          lock.unlock();
        }
      }
    }), "Delete path " + path));
  }
1306573
public void deleteNode(String path, long zxid)
            throws KeeperException.NoNodeException {
        int lastSlash = path.lastIndexOf('/');
        String parentName = path.substring(0, lastSlash);
        String childName = path.substring(lastSlash + 1);
        DataNode node = nodes.get(path);
        if (node == null) {
            throw new KeeperException.NoNodeException();
        }
        nodes.remove(path);
        DataNode parent = nodes.get(parentName);
        if (parent == null) {
            throw new KeeperException.NoNodeException();
        }
        synchronized (parent) {
            parent.removeChild(childName);
            parent.stat.setCversion(parent.stat.getCversion() + 1);
            parent.stat.setPzxid(zxid);
            long eowner = node.stat.getEphemeralOwner();
            if (eowner != 0) {
                HashSet<String> nodes = ephemerals.get(eowner);
                if (nodes != null) {
                    synchronized (nodes) {
                        nodes.remove(path);
                    }
                }
            }
            node.parent = null;
        }
        if (parentName.startsWith(procZookeeper)) {
            // delete the node in the trie.
            if (Quotas.limitNode.equals(childName)) {
                // we need to update the trie
                // as well
                pTrie.deletePath(parentName.substring(quotaZookeeper.length()));
            }
        }

        // also check to update the quotas for this node
        String lastPrefix = pTrie.findMaxPrefix(path);
        if (!rootZookeeper.equals(lastPrefix) && !("".equals(lastPrefix))) {
            // ok we have some match and need to update
            updateCount(lastPrefix, -1);
            int bytes = 0;
            synchronized (node) {
                bytes = (node.data == null ? 0 : -(node.data.length));
            }
            updateBytes(lastPrefix, bytes);
        }
        if (LOG.isTraceEnabled()) {
            ZooTrace.logTraceMessage(LOG, ZooTrace.EVENT_DELIVERY_TRACE_MASK,
                    "dataWatches.triggerWatch " + path);
            ZooTrace.logTraceMessage(LOG, ZooTrace.EVENT_DELIVERY_TRACE_MASK,
                    "childWatches.triggerWatch " + parentName);
        }
        Set<Watcher> processed = dataWatches.triggerWatch(path,
                EventType.NodeDeleted);
        childWatches.triggerWatch(path, EventType.NodeDeleted, processed);
        childWatches.triggerWatch(parentName.equals("") ? "/" : parentName,
                EventType.NodeChildrenChanged);
    }
474513
protected void removeRepositoryLocally(String repositoryName, boolean forceRemove) throws RepositoryCreationException
   {
      try
      {
         // extract list of all datasources
         ManageableRepository repositorty = repositoryService.getRepository(repositoryName);
         Set<String> datasources = extractDataSourceNames(repositorty.getConfiguration(), false);

         // close all opened sessions
         for (String workspaceName : repositorty.getWorkspaceNames())
         {
            WorkspaceContainerFacade wc = repositorty.getWorkspaceContainer(workspaceName);
            SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);

            sessionRegistry.closeSessions(workspaceName);
         }

         // remove repository from configuration
         repositoryService.removeRepository(repositoryName, forceRemove);
         repositoryService.getConfig().retain();
         
         // unbind datasource and close connections
         for (String dsName : datasources)
         {
            try
            {
               // we suppose that lookup() method returns the same instance of datasource by the same name
               DataSource ds = (DataSource)initialContextInitializer.getInitialContext().lookup(dsName);
               initialContextInitializer.getInitialContextBinder().unbind(dsName);

               // close datasource
               if (ds instanceof CloseableDataSource)
               {
                  ((CloseableDataSource)ds).close();
               }
            }
            catch (NamingException e)
            {
               LOG.error("Can't unbind datasource " + dsName, e);
            }
            catch (FileNotFoundException e)
            {
               LOG.error("Can't unbind datasource " + dsName, e);
            }
            catch (XMLStreamException e)
            {
               LOG.error("Can't unbind datasource " + dsName, e);
            }
         }
      }
      catch (RepositoryException e)
      {
         throw new RepositoryCreationException("Can't remove repository", e);
      }
      catch (RepositoryConfigurationException e)
      {
         throw new RepositoryCreationException("Can't remove repository", e);
      }
   }
833652
protected void leaving(NodeData node, int level) throws RepositoryException
   {

      try
      {
         if (!node.getQPath().getName().equals(Constants.JCR_XMLTEXT))
         {

            if (Constants.ROOT_PATH.equals(node.getQPath()))
               contentHandler.endElement(Constants.NS_JCR_URI, Constants.NS_JCR_PREFIX, JCR_ROOT);

            else
               contentHandler.endElement(node.getQPath().getName().getNamespace(), node.getQPath().getName().getName(),
                  getExportName(node, true));
         }
      }
      catch (SAXException e)
      {
         throw new RepositoryException(e);
      }
   }
499920
protected void doDelete(final ItemData item, final WorkspaceStorageConnection con, ChangedSizeHandler sizeHandler)
      throws RepositoryException, InvalidItemStateException
   {

      if (item.isNode())
      {
         con.delete((NodeData)item);
      }
      else
      {
         con.delete((PropertyData)item, sizeHandler);
      }
   }
607502
protected void removeExecutionLink(JobEntity jobEntity) {
        if (jobEntity.getExecutionId() != null) {
            ExecutionEntity execution = getExecutionEntityManager().findById(jobEntity.getExecutionId());
            if (execution != null) {
                execution.getJobs().remove(jobEntity);
            }
        }
    }
1228298
@Override
    public void remove(Iterable<? extends Statement> statements) throws RepositoryException {
        Iterator <? extends Statement> iter = statements.iterator();
        while(iter.hasNext()){
            Statement st = iter.next();
            getClient().sendRemove(null, st.getSubject(), st.getPredicate(), st.getObject());
        }
    }
776880
private void removeMemberships(Node userNode, boolean broadcast) throws RepositoryException
   {
      PropertyIterator refUserProps = userNode.getReferences();
      while (refUserProps.hasNext())
      {
         Node refUserNode = refUserProps.nextProperty().getParent();
         refUserNode.remove();
      }
   }
910767
public static void deleteFilePath(FilePath workspace, String path) throws IOException {
        if (StringUtils.isNotBlank(path)) {
            try {
                FilePath propertiesFile = new FilePath(workspace, path);
                propertiesFile.delete();
            } catch (Exception e) {
                throw new IOException("Could not delete temp file: " + path);
            }
        }
    }
815316
@Override
    public Node delete(String archivePath) {
        Validate.notNull(archivePath, "No path was specified");
        return getArchive().delete(archivePath);
    }