Load individual channels in the framework based on the provided
channel configurations.

@param channels
@return List<String> - channels created succesfully
175419
private static List<String> loadChannels(Map<String, String[]> channels) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
        List<String> createdChannels = new ArrayList<String>(channels.size());
        boolean fireMissingEvent = false;

        final EndPointMgr epm = EndPointMgrImpl.getRef();
        String key, value;
        for (Entry<String, String[]> entry : channels.entrySet()) {
            String channel = entry.getKey();
            Map<Object, Object> props = new HashMap<Object, Object>();
            int weight = -1;
            Class<?> factoryType = null;
            for (String prop : entry.getValue()) {
                key = extractKey(prop);
                value = extractValue(prop);
                if ("type".equalsIgnoreCase(key)) {
                    if (null != factoryType) {
                        // already set
                        continue;
                    }
                    factoryType = cf.lookupFactory(value);
                } else if ("endpoint".equalsIgnoreCase(key)) {
                    if (props.containsKey("hostname")) {
                        // already set
                        continue;
                    }
                    // convert to host/port
                    if (null != epm) {
                        EndPointInfo ep = epm.getEndPoint(value);
                        if (null != ep) {
                            if (bTrace && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Using endpoint: " + ep);
                            }
                            props.put("endPointName", value);
                            props.put("hostname", ep.getHost());
                            props.put("port", String.valueOf(ep.getPort()));
                        } else {
                            if (bTrace && tc.isEventEnabled()) {
                                Tr.event(tc, "Unknown endpoint: " + value);
                            }
                        }
                    } else {
                        if (bTrace && tc.isEventEnabled()) {
                            Tr.event(tc, "Unable to convert endpoint: " + value);
                        }
                    }
                } else if ("weight".equalsIgnoreCase(key)) {
                    if (0 > weight) {
                        // already set
                        continue;
                    }
                    try {
                        weight = Integer.parseInt(value);
                    } catch (NumberFormatException nfe) {
                        FFDCFilter.processException(nfe, "ChannelUtils.loadChannels",
                                                    "weight", new Object[] { entry, cf });
                        if (bTrace && tc.isEventEnabled()) {
                            Tr.event(tc, "Invalid discrimination weight: " + value);
                        }
                    }
                } else {
                    props.put(key, value);
                }
            } // end-props
            if (null == factoryType) {
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Delay; channel missing factory; " + channel);
                }
                delayedConfig.put(CHANNEL_PREFIX + channel, entry.getValue());
                createdChannels.add(channel);
                fireMissingEvent = true;
                continue;
            }
            // change invalid weights to the default number
            if (0 > weight) {
                weight = 10;
            }
            try {
                ChannelData cd = cf.getChannel(channel);
                if (null == cd) {
                    cd = cf.addChannel(channel, factoryType, props, weight);
                } else {
                    cf.updateAllChannelProperties(channel, props);
                }
                createdChannels.add(channel);
            } catch (Exception e) {
                FFDCFilter.processException(e, "ChannelUtils.loadChannels",
                                            "update", new Object[] { entry, cf });
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Unable to add channel: " + channel + "; " + e);
                }
            }
        } // end-channels

        if (fireMissingEvent) {
            fireMissingEvent();
        }

        return createdChannels;
    }
646670
public List<Pipeline> listByChannelIds(Long... channelId) {
        Assert.assertNotNull(channelId);
        List<Pipeline> pipelines = new ArrayList<Pipeline>();
        try {

            List<PipelineDO> pipelineDos = pipelineDao.listByChannelIds(channelId);
            if (pipelineDos.isEmpty()) {
                logger.debug("DEBUG ## query pipeline by channelId:" + channelId + " return null.");
                return pipelines;
            }
            pipelines = doToModel(pipelineDos);
        } catch (Exception e) {
            logger.error("ERROR ## query pipelines by channelIds:" + channelId.toString() + " has an exception!");
            throw new ManagerException(e);
        }
        return pipelines;
    }
1273366
public static void showChannels(Object... channels){
    // TODO this could share more code with the other show/hide(Only)Channels methods
    for(LogRecordHandler handler : handlers){
      if(handler instanceof VisibilityHandler){
        VisibilityHandler visHandler = (VisibilityHandler) handler;
        for (Object channel : channels) {
          visHandler.alsoShow(channel);
        }
      }
    }
  }
940457
public void set(Collection<Builder> channels) throws ChannelFinderException {
		wrappedSubmit(new SetChannels(ChannelUtil.toCollectionXmlChannels(channels)));
	}
707947
public Set<String> getChannelNames() {
        Set<String> ret = Collections.EMPTY_SET;

        JsonObject channels = getJsonObject(jsonConfig, "channels");
        if (channels != null) {
            final Set<String> channelNames = channels.keySet();
            if (channelNames != null && !channelNames.isEmpty()) {
                ret = new HashSet<>(channelNames);
            }
        }
        return ret;
    }
110993
@Override
    public List<Channel> getChannels()
    {
        List<Channel> channels = new LinkedList<>();
        if (_acceptingParty != null)
            channels.add(_acceptingParty);
        if (_originatingParty != null)
            channels.add(_originatingParty);
        if (_transferTargetParty != null)
            channels.add(_transferTargetParty);
        return channels;
    }
1114964
public void setInputChannels(java.util.Collection<Integer> inputChannels) {
        if (inputChannels == null) {
            this.inputChannels = null;
            return;
        }

        this.inputChannels = new java.util.ArrayList<Integer>(inputChannels);
    }
156887
@Override
    public List<ChannelInformation> listChannels() {
        List<Channel> channels = channelDirectory.getChannels();

        List<ChannelInformation> channelInformationList = new LinkedList<ChannelInformation>();
        for (Channel channel : channels) {

            ChannelInformation channelInfo = new ChannelInformation(channel.getChannelId(), 0, 0);
            channelInformationList.add(channelInfo);
        }
        return channelInformationList;
    }
320049
protected static function parse_channels($channels)
    {
        if ($channels instanceof Channel) {
            $channels = array($channels);
        } elseif (is_string($channels)) {
            $channels = array(new Channel($channels));
        }
        if (count($channels) == 0) {
            throw new \RuntimeException('channels length is 0');
        }
        return $channels;
    }
329412
public void setChannelSummaries(java.util.Collection<ChannelSummary> channelSummaries) {
        if (channelSummaries == null) {
            this.channelSummaries = null;
            return;
        }

        this.channelSummaries = new java.util.ArrayList<ChannelSummary>(channelSummaries);
    }
668788
public RedwoodConfiguration hideChannels(final Object[] channels){
     tasks.add(new Runnable() { public void run() { Redwood.hideChannels(channels); } });
    return this;
  }
964909
public List<ChannelInfo> getChannels() {
    final URI uri = uriWithPath("./channels/");
    return Arrays.asList(this.rt.getForObject(uri, ChannelInfo[].class));
  }
195255
public List<Channel> listByIds(Long... identities) {

        List<Channel> channels = new ArrayList<Channel>();
        try {
            List<ChannelDO> channelDos = null;
            if (identities.length < 1) {
                channelDos = channelDao.listAll();
                if (channelDos.isEmpty()) {
                    logger.debug("DEBUG ## couldn't query any channel, maybe hasn't create any channel.");
                    return channels;
                }
            } else {
                channelDos = channelDao.listByMultiId(identities);
                if (channelDos.isEmpty()) {
                    String exceptionCause = "couldn't query any channel by channelIds:" + Arrays.toString(identities);
                    logger.error("ERROR ## " + exceptionCause);
                    throw new ManagerException(exceptionCause);
                }
            }
            channels = doToModel(channelDos);
        } catch (Exception e) {
            logger.error("ERROR ## query channels has an exception!");
            throw new ManagerException(e);
        }

        return channels;
    }
552757
def _bind_channels(self, events, channels):
        
        for channel_name in channels:
            if channel_name in self.channels:
                channel = self.pusher.subscribe(channel_name)
                if isinstance(events, list):
                    for event in events:
                        channel.bind(event, channels[channel_name])
                else:
                    channel.bind(events, channels[channel_name])
9599
def set_channels(channels, conf)
      if channels.nil?
        @channels = [] if @channels.nil?
        return
      end
      @channels = valid!(channels, Channel.deserialize_all(channels, conf),
                         :@channels,
                         invalid_error: 'invalid channel list %s') { [] }
    end
55666
@InterfaceAudience.Public
    public void setChannels(List<String> channels) {
        properties.put(ReplicationField.CHANNELS, channels);
        replicationInternal.setChannels(channels);
    }
1119245
public Channel deSerializeChannel(byte[] channelBytes)
            throws IOException, ClassNotFoundException, InvalidArgumentException {

        Channel channel;
        ObjectInputStream in = null;
        try {
            in = new ObjectInputStream(new ByteArrayInputStream(channelBytes));
            channel = (Channel) in.readObject();
            final String name = channel.getName();
            synchronized (channels) {
                if (null != getChannel(name)) {
                    channel.shutdown(true);
                    throw new InvalidArgumentException(format("Channel %s already exists in the client", name));
                }
                channels.put(name, channel);
                channel.client = this;
            }

        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (IOException e) {
                // Best effort here.
                logger.error(e);
            }
        }

        return channel;

    }