Load chains within the channel framework based on the provided
chain configurations.

@param chains
@param start
@param restart
@return List<String> - chains created successfully
428358
private static List<String> loadChains(Map<String, String[]> chains, boolean start, boolean restart) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
        List<String> createdChains = new ArrayList<String>(chains.size());

        String key, value;
        for (Entry<String, String[]> entry : chains.entrySet()) {
            String chain = entry.getKey();
            FlowType flow = FlowType.INBOUND;
            boolean enable = true;
            boolean missingChannels = false;
            String[] chanList = null;
            for (String prop : entry.getValue()) {
                key = extractKey(prop);
                value = extractValue(prop);
                if ("enable".equalsIgnoreCase(key)) {
                    enable = Boolean.parseBoolean(value);
                } else if ("channels".equalsIgnoreCase(key)) {
                    // parse the channel list
                    chanList = extractList(value, ',');
                    for (String channel : chanList) {
                        if (null == cf.getChannel(channel)) {
                            if (bTrace && tc.isEventEnabled()) {
                                Tr.event(tc, "Chain contains missing channel: " + channel);
                            }
                            chanList = null;
                            missingChannels = true;
                            break; // out of channel check loop
                        }
                    }
                } else if ("flow".equalsIgnoreCase(key)) {
                    flow = "inbound".equalsIgnoreCase(value) ? FlowType.INBOUND : FlowType.OUTBOUND;
                }
            }
            if (null == chanList) {
                // chain either had no channels configured or it has channels
                // that are waiting on their providers
                if (!missingChannels) {
                    if (bTrace && tc.isEventEnabled()) {
                        Tr.event(tc, "Chain had no channels; " + chain);
                    }
                    continue;
                }
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Delay; chain missing channels; " + chain);
                }
                if (start) {
                    delayedStarts.put(chain, Boolean.valueOf(restart));
                }
                delayedConfig.put(CHAIN_PREFIX + chain, entry.getValue());
                createdChains.add(chain);
                continue;
            }
            try {
                ChainData cd = cf.getChain(chain);
                if (null == cd) {
                    cd = cf.addChain(chain, flow, chanList);
                } else {
                    cd = cf.updateChain(chain, chanList);
                }
                cd.setEnabled(enable);
                createdChains.add(chain);
            } catch (Exception e) {
                FFDCFilter.processException(e, "ChannelUtils.loadChains",
                                            "create", new Object[] { entry, cf });
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Unable to add chain " + chain + "; " + e);
                }
            }
        } // end-chains

        return createdChains;
    }
386662
public void start(String ... routes) {
		StartCamelRouteAction camelRouteAction = new StartCamelRouteAction();
		camelRouteAction.setRouteIds(Arrays.asList(routes));

		camelRouteAction.setCamelContext(getCamelContext());
		action.setDelegate(camelRouteAction);
	}
1208816
@Override
    public synchronized ChainData[] getAllChains(String channelName) throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getAllChains: " + channelName);
        }
        if (null == channelName) {
            throw new InvalidChannelNameException("Null channelName found");
        }

        ChainDataImpl chainData = null;
        List<ChainData> chainDataList = new ArrayList<ChainData>();

        // Collect all chains referring to the channel
        Iterator<ChainDataImpl> chainDataIter = chainDataMap.values().iterator();
        while (chainDataIter.hasNext()) {
            chainData = chainDataIter.next();
            if (chainData.containsChannel(channelName)) {
                chainDataList.add(chainData);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getAllChains");
        }
        return chainDataList.toArray(new ChainData[chainDataList.size()]);
    }
1311730
public static br_restart[] restart(nitro_service client, br_restart[] resources) throws Exception
	{
		if(resources == null)
			throw new Exception("Null resource array");
		
		
		if(resources.length == 1)
			return ((br_restart[]) resources[0].perform_operation(client, "restart"));
		
		return ((br_restart[]) perform_operation_bulk_request(client, resources, "restart"));
	}
463178
private List<ImageConfiguration> getImagesWhoseDependenciesHasStarted(Queue<ImageConfiguration> imagesRemaining,
                                                                          Set<String> containersStarted,
                                                                          Set<String> aliases) {
        final List<ImageConfiguration> ret = new ArrayList<>();

        // Check for all images which can be already started
        for (ImageConfiguration imageWaitingToStart : imagesRemaining) {
            List<String> allDependencies = imageWaitingToStart.getDependencies();
            List<String> aliasDependencies = filterOutNonAliases(aliases, allDependencies);
            if (containersStarted.containsAll(aliasDependencies)) {
                ret.add(imageWaitingToStart);
            }
        }
        return ret;
    }
1062951
public synchronized void start(List<Long> weights) throws InterruptedException {
        for (int i = 0; i < weights.size(); i++) {
            this.weights.add(weights.get(i));
        }

        int number = latch.decrementAndGet();
        if (number == 0) {
            Long initWeight = this.weights.peek();
            if (initWeight != null) {
                barrier.single(initWeight);
            }
        }
    }
1317284
public synchronized Chain getRunningChain(String chainName) {
        Chain chain = null;
        if (null != chainName) {
            chain = this.chainRunningMap.get(chainName);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getRunningChain: " + chainName + " found=" + (null != chain));
        }
        return chain;
    }
1346453
private static Chain isKnownChain(String chainID, List<Chain> chains){

		for (int i = 0; i< chains.size();i++){
			Chain testchain =  chains.get(i);
			if (chainID.equals(testchain.getName())) {
				return testchain;
			}
		}

		return null;
	}
1202810
public Spider startUrls(List<String> startUrls) {
        checkIfRunning();
        this.startRequests = UrlUtils.convertToRequests(startUrls);
        return this;
    }
67473
def load_header_chain( cls, chain_path ):
        

        header_parser = BlockHeaderSerializer()
        chain = []
        height = 0
        with open(chain_path, "rb") as f:

            h = SPVClient.read_header_at( f )
            h['block_height'] = height 

            height += 1
            chain.append(h)

        return chain
106855
protected List<ServletDefinition> initServlets(
			List<ServletDefinition> servletDefinitions) throws Exception {

		// Sort the list taking in account the load-on-startup attribute
		Collections.sort(servletDefinitions);

		// Sets the Jawr context at "bundle processing at build time"
		ThreadLocalJawrContext.setBundleProcessingAtBuildTime(true);

		List<ServletDefinition> jawrServletDefinitions = new ArrayList<ServletDefinition>();
		for (Iterator<ServletDefinition> iterator = servletDefinitions
				.iterator(); iterator.hasNext();) {
			ServletDefinition servletDefinition = (ServletDefinition) iterator
					.next();
			servletDefinition.initServlet();
			if (servletDefinition.isJawrServletDefinition()) {
				jawrServletDefinitions.add(servletDefinition);
			}
		}

		return jawrServletDefinitions;
	}
293694
@SafeVarargs
    public static <T> Callback<T> chain(Callback<T>... callbacks)
    {
        return chain(Arrays.asList(callbacks));
    }
19876
public synchronized List<ChainData> getRunningChains(ChannelDataImpl parent) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getRunningChains");
        }
        ChannelContainer channelContainer = null;
        List<ChainData> chainDataList = new ArrayList<ChainData>();

        // Iterate the children - they are in the runtime.
        Iterator<ChildChannelDataImpl> children = parent.children();
        while (children.hasNext()) {
            // Get the runtime channel container for this child.
            channelContainer = this.channelRunningMap.get(children.next().getName());
            for (Chain chain : channelContainer.getChainMap().values()) {
                chainDataList.add(chain.getChainData());
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getRunningChains: " + chainDataList.size());
        }
        return chainDataList;
    }
1179101
private static List<List<Chain>> findChains(String chainName, List<List<Chain>> polyModels) {
		List<List<Chain>> models = new ArrayList<>();

		for (List<Chain> chains:polyModels) {
			List<Chain> matchingChains = new ArrayList<>();
			models.add(matchingChains);
			for (Chain c:chains) {
				if (c.getName().equals(chainName)) {
					matchingChains.add(c);
				}
			}
		}
		return models;
	}
674422
def add_mapped_chain_ids(self, mapped_chains):
        
        mapped_chains = ssbio.utils.force_list(mapped_chains)

        for c in mapped_chains:
            if c not in self.mapped_chains:
                self.mapped_chains.append(c)
                log.debug('{}: added to list of mapped chains'.format(c))
            else:
                log.debug('{}: chain already in list of mapped chains, not adding'.format(c))
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");
        }
    }
1005390
@Override
    public ChainLink[] onSuccess() {
        ChainLink[] chain = new ChainLink[onSuccessChains.size()];
        return onSuccessChains.toArray(chain);
    }