Examples of StanzaRelay


Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

            itemBuilder.addAttribute("id", strID);
            itemBuilder.addPreparedElement(item.getFirstInnerElement());
            item = itemBuilder.build();
        }

        StanzaRelay relay = serverRuntimeContext.getStanzaRelay();
        node.publish(sender, relay, strID, item);

        buildSuccessStanza(sb, nodeName, strID);

        sb.endInnerElement(); // pubsub
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

     * @param nodeName
     * @param node
     */
    private void sendDeleteNotifications(ServerRuntimeContext serverRuntimeContext, Entity sender, String nodeName,
            LeafNode node) {
        StanzaRelay relay = serverRuntimeContext.getStanzaRelay();
        String strID = idGenerator.create();
        XMLElement delete = createDeleteElement(nodeName);
        node.publish(sender, relay, strID, delete);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

                    stanzaBuilder.addPreparedElement(preparedElement);
                }
                stanza = XMPPCoreStanza.getWrapper(stanzaBuilder.build());
            }

            StanzaRelay stanzaRelay = serverRuntimeContext.getStanzaRelay();
            try {
                stanzaRelay.relay(stanza.getTo(), stanza, new ReturnErrorToSenderFailureStrategy(stanzaRelay));
            } catch (Exception e) {
                // TODO return error stanza
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
        } else if (sessionContext != null) {
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

                    stanzaBuilder.addPreparedElement(preparedElement);
                }
                stanza = XMPPCoreStanza.getWrapper(stanzaBuilder.build());
            }

            StanzaRelay stanzaRelay = serverRuntimeContext.getStanzaRelay();
            try {
                stanzaRelay.relay(stanza.getTo(), stanza, new ReturnErrorToSenderFailureStrategy(stanzaRelay));
            } catch (Exception e) {
                // TODO return error stanza
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        } else if (sessionContext != null) {
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

    @SpecCompliance(compliant = {
            @SpecCompliant(spec = "RFC3921bis-05", section = "3.1.2", status = IN_PROGRESS, comment = "current impl based hereupon"),
            @SpecCompliant(spec = "RFC3921bis-08", section = "3.1.2", status = NOT_STARTED, comment = "major rephrasing from bis-05 not yet taken into account") })
    protected void handleOutboundSubscriptionRequest(PresenceStanza stanza, ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
        StanzaRelay stanzaRelay = serverRuntimeContext.getStanzaRelay();

        Entity user = stanza.getFrom();
        Entity contact = stanza.getTo().getBareJID();

        // TODO schedule a observer which can re-send the request

        RosterItem rosterItem = null;
        try {
            rosterItem = getExistingOrNewRosterItem(rosterManager, user.getBareJID(), contact);

            RosterSubscriptionMutator.Result result = RosterSubscriptionMutator.getInstance().add(rosterItem,
                    ASK_SUBSCRIBE);
            if (result != OK) {
                return;
            }

            rosterManager.addContact(user.getBareJID(), rosterItem);
        } catch (RosterException e) {
            throw new RuntimeException(e);
        }

        // relay the stanza to the contact (via the contact's server)
        try {
            stanzaRelay.relay(stanza.getTo(), stanza, new IgnoreFailureStrategy());
        } catch (DeliveryException e) {
            e.printStackTrace();
        }

        // send roster push to all of the user's interested resources
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

        if (!node.isAuthorized(sender, PubSubPrivilege.PUBLISH)) {
            // not enough privileges to publish - error condition 1 (7.1.3)
            return errorStanzaGenerator.generateInsufficientPrivilegesErrorStanza(sender, serverJID, stanza);
        }

        StanzaRelay relay = serverRuntimeContext.getStanzaRelay();

        XMLElementBuilder eventItemBuilder = new XMLElementBuilder("item", NamespaceURIs.XEP0060_PUBSUB_EVENT);
        if (strID == null) {
            strID = idGenerator.create();
        }
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

     * @param nodeName
     * @param node
     */
    private void sendDeleteNotifications(ServerRuntimeContext serverRuntimeContext, Entity sender, String nodeName,
            LeafNode node) {
        StanzaRelay relay = serverRuntimeContext.getStanzaRelay();
        String strID = idGenerator.create();
        XMLElement delete = createDeleteElement(nodeName);
        node.publish(sender, relay, strID, delete);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

        @SpecCompliant(spec = "RFC3921bis-05", section = "3.1.2", status = IN_PROGRESS, comment = "current impl based hereupon"),
        @SpecCompliant(spec = "RFC3921bis-08", section = "3.1.2", status = NOT_STARTED, comment = "major rephrasing from bis-05 not yet taken into account")
    })
  protected void handleOutboundSubscriptionRequest(PresenceStanza stanza,
                                                  ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
    StanzaRelay stanzaRelay = serverRuntimeContext.getStanzaRelay();

    Entity user = stanza.getFrom();
    Entity contact = stanza.getTo().getBareJID();

        // TODO schedule a observer which can re-send the request

        RosterItem rosterItem = null;
        try {
            rosterItem = getExistingOrNewRosterItem(rosterManager, user.getBareJID(), contact);

            RosterSubscriptionMutator.Result result = RosterSubscriptionMutator.getInstance().add(rosterItem, ASK_SUBSCRIBE);
            if (result != OK) {
                return;
            }

            rosterManager.addContact(user.getBareJID(), rosterItem);
        } catch (RosterException e) {
            throw new RuntimeException(e);
        }

        // relay the stanza to the contact (via the contact's server)
        try {
            stanzaRelay.relay(stanza.getTo(), stanza, new IgnoreFailureStrategy());
        } catch (DeliveryException e) {
            e.printStackTrace();
        }

        // send roster push to all of the user's interested resources
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

                    stanzaBuilder.addPreparedElement(preparedElement);
                }
                stanza = XMPPCoreStanza.getWrapper(stanzaBuilder.build());
            }

            StanzaRelay stanzaRelay = serverRuntimeContext.getStanzaRelay();
            try {
                stanzaRelay.relay(stanza.getTo(), stanza, new ReturnErrorToSenderFailureStrategy(stanzaRelay));
            } catch (Exception e) {
                // TODO return error stanza
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        } else if (sessionContext != null) {
View Full Code Here

Examples of org.apache.vysper.xmpp.delivery.StanzaRelay

        if (!node.isAuthorized(sender, PubSubPrivilege.PUBLISH)) {
            // not enough privileges to publish - error condition 1 (7.1.3)
            return errorStanzaGenerator.generateInsufficientPrivilegesErrorStanza(sender, serverJID, stanza);
        }

        StanzaRelay relay = serverRuntimeContext.getStanzaRelay();

        XMLElementBuilder eventItemBuilder = new XMLElementBuilder("item", NamespaceURIs.XEP0060_PUBSUB_EVENT);
        if (strID == null) {
            strID = idGenerator.create();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.