@Override public BidibNode getNode(Node node) { return nodeRegistry.getNode(node); }
/** * Create a new {@code BiDiBNode} instance from the provided node data. * * @param node * the node data * @return the new {@code BiDiBNode} */ public BidibNode createNode(Node node) { LOGGER.info("Create the new bidibNode of node: {}", node); BidibNode bidibNode = null; // check if the node is already in the system bidibNode = findNode(node.getAddr()); if (bidibNode != null) { LOGGER.warn("The new node is already registered in the system: {}", bidibNode); messageReceiver.removeOrphanNode(node); LOGGER.warn("Removed orphan node: {}", node); } // removeNode(node); bidibNode = getNode(node); LOGGER.info("createNode returns new bidibNode: {}", bidibNode); return bidibNode; }
/** * Returns the provided node as CommandStationNode instance of null if the node is not an CommandStationNode. * * @param node * the node * @return the CommandStationNode instance */ public CommandStationNode getCommandStationNode(Node node) { BidibNode bidibNode = getNode(node); if (NodeUtils.hasCommandStationFunctions(node.getUniqueId())) { CommandStationNode commandStationNode = new CommandStationNode(bidibNode); LOGGER.debug("prepared command station node: {}", commandStationNode); return commandStationNode; } LOGGER.debug("The requested node is not a CommandStationNode."); throw new InvalidConfigurationException("The requested node is not a CommandStationNode."); }
/** * Returns the provided node as BoosterNode instance of null if the node is not an BoosterNode. * * @param node * the node * @return the BoosterNode instance */ public BoosterNode getBoosterNode(Node node) { BidibNode bidibNode = getNode(node); if (NodeUtils.hasBoosterFunctions(node.getUniqueId())) { BoosterNode boosterNode = new BoosterNode(bidibNode); LOGGER.debug("prepared booster node: {}", boosterNode); return boosterNode; } LOGGER.debug("The requested node is not a BoosterNode."); throw new InvalidConfigurationException("The requested node is not a BoosterNode."); }