/** * get first channel of specified destination id * * @param destinationId * destination node id * @return the channel, if the channel related with specified destination id * is not exists then return null */ public synchronized Channel getChannel(String destinationId, String type) { for (Channel channel : localTopology.getChannel()) { if (channel.getDestination().getDestNode().getValue().equals(destinationId) && channel.getChannelType().equals(type)) { return channel; } } return null; }
return false; if (!Objects.equals(_channelType, other.getChannelType())) { return false;
/** * get session which has specified session id from the channel which has the * destination id * * @param destinationId * the target channel for getting * @param sessionId * specified session id * @return if find the session which has the session id, return the session * other wise return null */ public synchronized Session getSession(String destinationId, String sessionId, String type) { for (Channel channel : localTopology.getChannel()) { if (channel.getDestination().getDestNode().getValue().equals(destinationId) && channel.getChannelType().equals(type)) { for (Session session : channel.getSession()) { if (session.getSessionId().getValue().equals(sessionId)) { return session; } } } } return null; }
this._channelAlarm = base.getChannelAlarm(); this._channelAlarms = base.getChannelAlarms(); this._channelType = base.getChannelType(); this._destination = base.getDestination(); this._session = base.getSession();
/** * update channel information, and update the shard data of local topology * * @param channel * the new channel * @return old channel */ public synchronized Channel updateChannel(Channel channel) { if (channel != null) { Channel oldChannel = removeChannelWithoutUpdateShard(channel.getDestination().getDestNode().getValue(), channel.getChannelType()); addChannelWithoutUpdateShard(channel); updateShard(); return oldChannel; } return null; }
public synchronized void updateTransaction(Channel channel, Session session, long bytesIn, long bytesOut) { Session oldSession = getSession(channel, session.getSessionId().getValue()); if (oldSession != null) { channel.getSession().remove(oldSession); } channel.getSession().add(session); String destinationId = channel.getDestination().getDestNode().getValue(); Node deviceNode = UscTopologyFactory.createNode(destinationId, UscTopologyService.NODE_TYPE_NETWORK_DEVICE); channel = UscTopologyFactory.createChannel(getLocalController(), deviceNode, channel.getKey().getChannelId() .getValue(), channel.getChannelType(), UscTopologyFactory.isCallHome(channel.getCallHome()), channel.getBytesIn() + bytesIn, channel.getBytesOut() + bytesOut, channel.getChannelAlarm(), channel.getSession()); updateChannel(channel); }
public synchronized void updateChannel(Channel channel, Session session, boolean removeFlag) { Session oldSession = getSession(channel, session.getSessionId().getValue()); if (oldSession != null) { channel.getSession().remove(oldSession); } if (!removeFlag) { channel.getSession().add(session); } String destinationId = channel.getDestination().getDestNode().getValue(); Node deviceNode = UscTopologyFactory.createNode(destinationId, UscTopologyService.NODE_TYPE_NETWORK_DEVICE); channel = UscTopologyFactory.createChannel(getLocalController(), deviceNode, channel.getKey().getChannelId() .getValue(), channel.getChannelType(), UscTopologyFactory.isCallHome(channel.getCallHome()), channel.getBytesIn(), channel.getBytesOut(), channel.getChannelAlarm(), channel.getSession()); updateChannel(channel); }
addAlarm(alarmList, alarm); channel = UscTopologyFactory.createChannel(getLocalController(), deviceNode, channel.getChannelId().getValue(), channel.getChannelType(), UscTopologyFactory.isCallHome(channel.getCallHome()), channel.getBytesIn(), channel.getBytesOut(), alarmList, channel.getSession()); updateChannel(channel);