Removes the chains from the Walkmod config file.

@param chains
Chain names to remove
@param recursive
If it necessary to remove the chains from all the submodules.
@throws Exception
If the walkmod configuration file can't be read.
494620
public void removeChains(List<String> chains, boolean recursive) throws Exception {
        long startTime = System.currentTimeMillis();
        Exception exception = null;
        if (cfg.exists()) {

            userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
            System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
            try {
                ConfigurationManager manager = new ConfigurationManager(cfg, false);
                manager.getProjectConfigurationProvider().removeChains(chains, recursive);
            } catch (Exception e) {
                exception = e;
            } finally {
                System.setProperty("user.dir", userDir);
                updateMsg(startTime, exception);
            }
        }

    }
45362
@Override
    public void chainUpdated(ChainData chainData) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "chainUpdated", chainData);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "chainUpdated");

    }
538056
private void removeListenerFromChain(ChainEventListener listener, ChainData chainData) {
        ChainGroupData[] otherGroups = null;
        boolean foundOtherGroupWithListener = false;
        // Extract the groups that this chain is involved in.
        try {
            otherGroups = this.framework.getAllChainGroups(chainData.getName());
            foundOtherGroupWithListener = false;
            int i = 0;
            for (i = 0; i < otherGroups.length; i++) {
                if (((ChainGroupDataImpl) otherGroups[i]).containsChainEventListener(listener)) {
                    // Chain is in another group that has this listener.
                    foundOtherGroupWithListener = true;
                    break;
                }
            }
            if (!foundOtherGroupWithListener) {
                // Chain is NOT in another group that has this listener, so listener can
                // be removed.
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Removing listener from chain config, " + chainData.getName());
                }
                ((ChainDataImpl) chainData).removeChainEventListener(listener);
            } else {
                // Chain was found in another group with this listener
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Found chain " + chainData.getName() + " in another group, " + otherGroups[i].getName());
                }
            }
        } catch (ChainException e) {
            // This shouldn't ever happen, but in case it does, we know no refs were
            // found.
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Chain not found in config: " + chainData.getName() + ", but will remove listener.");
            }
            ((ChainDataImpl) chainData).removeChainEventListener(listener);
        }
    }
968789
public static void deleteIfExists(FileSystem fs, Path path, boolean recursive) throws IOException {
    if (fs.exists(path)) {
      deletePath(fs, path, recursive);
    }
  }
327410
@Override
    protected void disconnectTransactions(StoredBlock oldBlock) throws PrunedException, BlockStoreException {
        checkState(lock.isHeldByCurrentThread());
        blockStore.beginDatabaseBatchWrite();
        try {
            StoredUndoableBlock undoBlock = blockStore.getUndoBlock(oldBlock.getHeader().getHash());
            if (undoBlock == null) throw new PrunedException(oldBlock.getHeader().getHash());
            TransactionOutputChanges txOutChanges = undoBlock.getTxOutChanges();
            for (UTXO out : txOutChanges.txOutsSpent)
                blockStore.addUnspentTransactionOutput(out);
            for (UTXO out : txOutChanges.txOutsCreated)
                blockStore.removeUnspentTransactionOutput(out);
        } catch (PrunedException e) {
            blockStore.abortDatabaseBatchWrite();
            throw e;
        } catch (BlockStoreException e) {
            blockStore.abortDatabaseBatchWrite();
            throw e;
        }
    }
429693
private void setExchangeRateChain(List<ExchangeRate> chain) {
        this.chain.clear();
        if (chain==null || chain.isEmpty()) {
            this.chain.add(this);
        } else {
            for (ExchangeRate rate : chain) {
                if (rate==null) {
                    throw new IllegalArgumentException("Rate Chain element can not be null.");
                }
            }
            this.chain.addAll(chain);
        }
    }
717437
@Override
    public synchronized void startChain(String chainName) throws ChannelException, ChainException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "startChain: " + chainName);
        }
        if (null == chainName) {
            throw new InvalidChainNameException("Null chain name");
        }

        // Get the chain configuration
        ChainData chainData = this.chainDataMap.get(chainName);
        if (null == chainData) {
            InvalidChainNameException e = new InvalidChainNameException("Nonexistent chain configuration");
            throw e;
        }

        // Ensure we have an inbound chain.
        if (FlowType.OUTBOUND.equals(chainData.getType())) {
            throw new InvalidChainNameException("Outbound chain cannot use this interface.");
        }

        startChainInternal(chainData);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "startChain");
        }
    }
643820
protected void removeUnreachableStms(List<? extends INode> ast)
			throws AnalysisException
	{
		UnreachableStmRemover remover = new UnreachableStmRemover();

		for (INode node : ast)
		{
			node.apply(remover);
		}
	}
1290406
public static void remove(Element elem, boolean recurse) {
		elem.removeAttributeNS(URI, SRC_ATTR);
		elem.removeAttributeNS(URI, LINE_ATTR);
		elem.removeAttributeNS(URI, COL_ATTR);
		if (recurse) {
			NodeList children = elem.getChildNodes();
			for (int i = 0; i < children.getLength(); i++) {
				Node child = children.item(i);
				if (child.getNodeType() == Node.ELEMENT_NODE) {
					remove((Element) child, recurse);
				}
			}
		}
	}
242354
public final void removeChainEventListener(ChainEventListener listener) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "removeChainEventListener: " + listener);
        }
        if (null != listener) {
            if (!this.chainEventListeners.remove(listener)) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "Cannot find listener to be removed");
                }
            }
        }
    }
886903
def delete(files=[], recurs=false)
      svn_session() do |svn|
        begin
          svn.delete(files)
        #rescue Svn::Error::AuthnNoProvider,
        #       #Svn::Error::WcNotDirectory,
        #       Svn::Error::ClientModified,
        #       Svn::Error::SvnError => e
        rescue Exception => err
          raise RepoAccessError, "Delete Failed: #{err.message}"
        end
      end
    end
467122
public synchronized void destroyChainInternal(Chain chain) throws ChannelException, ChainException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "destroyChainInternal: " + chain.getName());
        }
        if (RuntimeState.INITIALIZED.equals(chain.getState())) {
            Channel[] chainChannels = chain.getChannels();
            ChannelData[] channelData = chain.getChannelsData();
            for (int i = 0; i < chainChannels.length; i++) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Destroy channel in chain: " + chainChannels[i].getName());
                }
                try {
                    // Don't let one channel's exception mess up the whole chain.
                    destroyChannelInChain(chainChannels[i], chain, channelData[i]);
                } catch (Exception e) {
                    FFDCFilter.processException(e, getClass().getName() + ".destroyChainInternal", "2865", this, new Object[] { chain, channelData[i] });
                    Tr.error(tc, "chain.destroy.error", new Object[] { chain.getName(), e.toString() });
                }
            }
            chain.destroy();
            // Remove the chain from the framework.
            this.chainRunningMap.remove(chain.getName());
            // Clear out the outbound VCF if this is outbound - called internally
            // only.
            if (FlowType.OUTBOUND.equals(chain.getChainData().getType())) {
                this.outboundVCFactories.remove(chain.getName());
            }
        } else {
            InvalidRuntimeStateException e = new InvalidRuntimeStateException("Unable to destroy chain: " + chain.getName() + ", state: " + chain.getState().ordinal);
            //Race condition can occur where chain is stopped before we register the listener, no need to FFDC
            //FFDCFilter.processException(e, getClass().getName() + ".destroyChainInternal", "2861", this, new Object[] { chain, this });
            throw e;
        }
    }
1074988
public void deleteStates(Collection<MutableState> statesToDelete) {
    if (statesToDelete.isEmpty()) {
      return;
    }
    for (MutableState state : statesToDelete) {
      deleteState(state);
    }
    remapStateIds();
  }
843514
private void recursivelyRemoveNodesFromPage(final DOMNode parent, final SecurityContext securityContext) throws FrameworkException {

		// Remove node from page
		final PropertyMap changedProperties = new PropertyMap();

		changedProperties.put(StructrApp.key(DOMNode.class, "syncedNodes"), Collections.EMPTY_LIST);
		changedProperties.put(StructrApp.key(DOMNode.class, "pageId"),      null);

		parent.setProperties(securityContext, changedProperties);

		// recurse
		for (final DOMNode child : parent.getChildren()) {

			recursivelyRemoveNodesFromPage(child, securityContext);
		}
	}
1169067
private void setExchangeRateChain(List<ExchangeRate> chain) {
        this.chain.clear();
        if (Objects.isNull(chain) || chain.isEmpty()) {
            this.chain.add(this);
        } else {
            for (ExchangeRate rate : chain) {
                if (Objects.isNull(rate)) {
                    throw new IllegalArgumentException("Rate Chain element can not be null.");
                }
            }
            this.chain.addAll(chain);
        }
    }
341942
public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain chain)
	throws IOException, ServletException
    {
        String path=((HttpServletRequest)request).getServletPath();
        if (welcome!=null && path.endsWith("/"))
            request.getRequestDispatcher(path+welcome).forward(request,response);
        else
            chain.doFilter(request, response);
    }
826349
public synchronized void clear() throws ChannelException, ChainException, ChainGroupException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "clear");
        }

        StringBuilder sbErrors = new StringBuilder();

        // Stop destroy and remove all running chains.
        Chain[] chains = chainRunningMap.values().toArray(new Chain[chainRunningMap.size()]);
        for (int i = 0; i < chains.length; i++) {
            Chain chain = chains[i];
            if (chain.getState() == RuntimeState.STARTED || chain.getState() == RuntimeState.QUIESCED) {
                try {
                    stopChainInternal(chain, 0);
                } catch (Exception e) {
                    FFDCFilter.processException(e, getClass().getName() + ".clear", "322", this, new Object[] { chain, this });
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Caught stopChainInternal exception " + e.getMessage());
                    }
                    sbErrors.append(e.toString());
                }
            }
            try {
                destroyChainInternal(chain);
            } catch (ChannelException e) {
                // FFDC handled in destroyChainInternal.
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught destroyChainInternal exception " + e.getMessage());
                }
                sbErrors.append(e.toString());
            } catch (ChainException e) {
                // FFDC handled in destroyChainInternal.
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught destroyChainInternal exception " + e.getMessage());
                }
                sbErrors.append(e.toString());
            } catch (Exception e) {
                FFDCFilter.processException(e, getClass().getName() + ".clear", "329", this, new Object[] { chain, this });
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught destroyChainInternal exception " + e.getMessage());
                }
                sbErrors.append(e.toString());
            }
            try {
                removeChain(chain.getName());
            } catch (Exception e) {
                FFDCFilter.processException(e, getClass().getName() + ".clear", "335", this, new Object[] { chain, this });
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught removeChain exception " + e.getMessage());
                }
                sbErrors.append(e.toString());
            }
        }
        this.chainRunningMap.clear();
        this.channelRunningMap.clear();

        // Remove all chain groups
        String[] keys = chainGroups.keySet().toArray(new String[chainGroups.size()]);
        for (int i = 0; i < keys.length; i++) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Remove chainGroup, " + keys[i]);
            }
            try {
                removeChainGroup(keys[i]);
            } catch (Exception e) {
                FFDCFilter.processException(e, getClass().getName() + ".clear", "351", this, new Object[] { keys[i], this });
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught removeChainGroup exception " + e.getMessage());
                }
                sbErrors.append(e.toString());
            }
        }
        this.chainGroups.clear();

        // Remove all channels.
        keys = channelDataMap.keySet().toArray(new String[channelDataMap.size()]);
        for (int i = 0; i < keys.length; i++) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Remove channelData, " + keys[i]);
            }
            try {
                String name = keys[i];
                if (name != null)
                    removeChannel(name);
            } catch (Exception e) {
                FFDCFilter.processException(e, getClass().getName() + ".clear", "366", this, new Object[] { keys[i], this });
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught removeChannel exception " + e.getMessage());
                }
                sbErrors.append(e.toString());
            }
        }
        this.channelDataMap.clear();
        this.chainDataMap.clear();

        // Destroy all channel factories
        Class<?>[] factoryList = channelFactories.keySet().toArray(new Class<?>[channelFactories.size()]);
        for (Class<?> target : factoryList) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Remove channelFactory, " + target);
            }
            ChannelFactory factory = channelFactories.remove(target).getChannelFactory();
            if (factory != null) {
                try {
                    factory.destroy();
                } catch (Exception e) {
                    FFDCFilter.processException(e, getClass().getName() + ".clear", "384", this, new Object[] { factory, this });
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Caught factory.destroy exception " + e.getMessage());
                    }
                    sbErrors.append(e.toString());
                }
            }
        }
        this.channelFactories.clear();

        // Clear the chain event listeners
        this.globalChainEventListeners.clear();

        // Clear out the services.
        this.services.clear();

        // Check if an error occurred.
        if (sbErrors.length() > 0) {
            // Found an error. Throw an exception containing all the details of the
            // errors caught.
            throw new ChannelException(sbErrors.toString());
        }

        this.activatedProviders.clear();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "clear");
        }
    }