@Override public void deliver(Packet packet) throws UnauthorizedException, PacketException { if (packet instanceof Message) { messageStrategy.storeOffline((Message) packet); } else if (packet instanceof Presence) { // presence packets are dropped silently } else if (packet instanceof IQ) { // IQ packets are logged before being dropped Log.warn(LocaleUtils.getLocalizedString("admin.error.routing") + "\n" + packet.toString()); } }
@Override public void deliver(Packet packet) throws UnauthorizedException, PacketException { if (packet == null) { throw new PacketException("Packet was null"); } if (deliverHandler == null) { throw new PacketException("Could not send packet - no route" + packet.toString()); } // Let the SocketPacketWriteHandler process the packet. SocketPacketWriteHandler may send // it over the socket or store it when user is offline or drop it. deliverHandler.process(packet); }
packet.toString());
/** * Delivers the given packet based on packet recipient and sender. The * deliverer defers actual routing decisions to other classes. * <h2>Warning</h2> * Be careful to enforce concurrency DbC of concurrent by synchronizing * any accesses to class resources. * * @param packet The packet to route * @throws NullPointerException If the packet is null or the * packet could not be routed */ public void deliver(Packet packet) throws UnauthorizedException, PacketException { if (packet == null) { throw new NullPointerException(); } if (xmppServer != null && xmppServer.isLocal(packet.getTo())) { deliverer.deliver(packet); } else if (transportHandler != null) { transportHandler.process(packet); } else { Log.warn("Could not deliver message: no deliverer available " + packet.toString()); } }
@Override public void process(Packet packet) throws UnauthorizedException, PacketException { try { JID recipient = packet.getTo(); // Check if the target domain belongs to a remote server or a component if (server.matchesComponent(recipient) || server.isRemote(recipient)) { routingTable.routePacket(recipient, packet, false); } // The target domain belongs to the local server else if (recipient == null || (recipient.getNode() == null && recipient.getResource() == null)) { // no TO was found so send back the packet to the sender routingTable.routePacket(packet.getFrom(), packet, false); } else if (recipient.getResource() != null || !(packet instanceof Presence)) { // JID is of the form <user@domain/resource> routingTable.routePacket(recipient, packet, false); } else { // JID is of the form <user@domain> for (JID route : routingTable.getRoutes(recipient, null)) { routingTable.routePacket(route, packet, false); } } } catch (Exception e) { Log.error(LocaleUtils.getLocalizedString("admin.error.deliver") + "\n" + packet.toString(), e); } } }
@Override public void deliver(Packet packet) throws UnauthorizedException, PacketException { if (packet instanceof Message) { messageStrategy.storeOffline((Message) packet); } else if (packet instanceof Presence) { // presence packets are dropped silently } else if (packet instanceof IQ) { // IQ packets are logged before being dropped Log.warn(LocaleUtils.getLocalizedString("admin.error.routing") + "\n" + packet.toString()); } }
@Override public void deliver(Packet packet) throws UnauthorizedException, PacketException { if (packet == null) { throw new PacketException("Packet was null"); } if (deliverHandler == null) { throw new PacketException("Could not send packet - no route" + packet.toString()); } // Let the SocketPacketWriteHandler process the packet. SocketPacketWriteHandler may send // it over the socket or store it when user is offline or drop it. deliverHandler.process(packet); }
/** * Delivers the given packet based on packet recipient and sender. The * deliverer defers actual routing decisions to other classes. * <h2>Warning</h2> * Be careful to enforce concurrency DbC of concurrent by synchronizing * any accesses to class resources. * * @param packet The packet to route * @throws NullPointerException If the packet is null or the * packet could not be routed */ public void deliver(Packet packet) throws UnauthorizedException, PacketException { if (packet == null) { throw new NullPointerException(); } if (xmppServer != null && xmppServer.isLocal(packet.getTo())) { deliverer.deliver(packet); } else if (transportHandler != null) { transportHandler.process(packet); } else { Log.warn("Could not deliver message: no deliverer available " + packet.toString()); } }
@Override public void process(Packet packet) throws UnauthorizedException, PacketException { try { JID recipient = packet.getTo(); // Check if the target domain belongs to a remote server or a component if (server.matchesComponent(recipient) || server.isRemote(recipient)) { routingTable.routePacket(recipient, packet, false); } // The target domain belongs to the local server else if (recipient == null || (recipient.getNode() == null && recipient.getResource() == null)) { // no TO was found so send back the packet to the sender routingTable.routePacket(packet.getFrom(), packet, false); } else if (recipient.getResource() != null || !(packet instanceof Presence)) { // JID is of the form <user@domain/resource> routingTable.routePacket(recipient, packet, false); } else { // JID is of the form <user@domain> for (JID route : routingTable.getRoutes(recipient, null)) { routingTable.routePacket(route, packet, false); } } } catch (Exception e) { Log.error(LocaleUtils.getLocalizedString("admin.error.deliver") + "\n" + packet.toString(), e); } } }