Examples of LeafNode


Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        if(nodeName == null) { // all subscriptions for all nodes
            NodeSubscriberVisitor nodeSubscriptionVisitor = new NodeSubscriberVisitor(sender);
            root.acceptNodes(nodeSubscriptionVisitor);
            subscriptions = nodeSubscriptionVisitor.getSubscriptions();
        } else { // only the subscriptions for the requested node
            LeafNode node = root.find(nodeName);

            if(node == null) {
                // done - this is only a filter - no error conditions are defined
                subscriptions = Collections.emptyList();
            } else {
                SubscriberSubscriptionVisitor subscriptionVisitor = new SubscriberSubscriptionVisitor(sender);
                node.acceptSubscribers(subscriptionVisitor);
                subscriptions = subscriptionVisitor.getSubscriptions();
            }
        }
        return subscriptions;
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        List<InfoElement> infoElements = new ArrayList<InfoElement>();
        if(request.getNode() == null || request.getNode().length() == 0) {
            infoElements.add(new Identity("pubsub", "service"));
            infoElements.add(new Feature(NamespaceURIs.XEP0060_PUBSUB));
        } else {
            LeafNode node = root.find(request.getNode());
            infoElements.addAll(node.getNodeInfosFor(request));
        }
        return infoElements;
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        if(request.getNode() == null || request.getNode().length() == 0) {
            ServiceDiscoItemsVisitor nv = new ServiceDiscoItemsVisitor(serviceConfiguration);
            root.acceptNodes(nv);
            items = nv.getNodeItemList();
        } else {
            LeafNode node = root.find(request.getNode());
            NodeDiscoItemsVisitor iv = new NodeDiscoItemsVisitor(request.getTo());
            node.acceptItems(iv);
            items = iv.getItemList();
        }
       
        return items;
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        if(root.find(nodeName) != null) {
            return errorStanzaGenerator.generateDuplicateNodeErrorStanza(sender, serverJID, stanza);
        }

        LeafNode node = new LeafNode(serviceConfiguration, nodeName, sender);
        root.add(node);

        return new IQStanza(sb.build());
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

    public void setUp() throws Exception {
        super.setUp();
        client2 = new EntityImpl("user1", "vysper.org", null);
        client3 = new EntityImpl("user2", "vysper.org", null);

        n1 = new LeafNode(serviceConfiguration, "Node1", "Node 1 used for testing purposes", client);
        n1.setAffiliation(client2, PubSubAffiliation.MEMBER);
       
        root.add(n1);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        String nodeName = publish.getAttributeValue("node"); // MUST

        XMLElement item = publish.getFirstInnerElement();
        String strID = item.getAttributeValue("id"); // MAY

        LeafNode node = root.find(nodeName);

        if(node == null) {
            // node does not exist - error condition 3 (7.1.3)
            return errorStanzaGenerator.generateNoNodeErrorStanza(sender, serverJID, stanza);
        }

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

        if(strID == null) {
            strID = idGenerator.create();
            // wrap a new item element with the id attribute
            StanzaBuilder itemBuilder = new StanzaBuilder("item");
            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
        return new IQStanza(sb.build());
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

    protected String testNode = "news";

    @Override
    public void setUp() throws Exception {
        super.setUp();
        node = new LeafNode(serviceConfiguration, "news", "Node used for testing purposes", client);
        root.add(node);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        Entity sender = extractSenderJID(stanza, sessionContext);
       
        String iqStanzaID = stanza.getAttributeValue("id");
        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        String nodeName = extractNodeName(stanza);
        LeafNode node = root.find(nodeName);
       
        if(node == null) {
            return errorStanzaGenerator.generateNoNodeErrorStanza(sender, serverJID, stanza);
        }
       
        if(!node.isAuthorized(sender, PubSubPrivilege.DELETE)) {
            return errorStanzaGenerator.generateInsufficientPrivilegesErrorStanza(sender, serverJID, stanza);
        }
       
        sendDeleteNotifications(serverRuntimeContext, sender, nodeName, node);
        root.deleteNode(nodeName);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

            // insufficient privileges (error condition 3 (6.2.3))
            return errorStanzaGenerator.generateInsufficientPrivilegesErrorStanza(sender, serverJID, stanza);
        }

        String nodeName = extractNodeName(stanza);
        LeafNode node = root.find(nodeName);

        if(node == null) {
            // no such node (error condition 4 (6.2.3))
            return errorStanzaGenerator.generateNoNodeErrorStanza(sender, serverJID, stanza);
        }

        if(strSubID == null) {
            try {
                if(node.unsubscribe(subJID) == false) {
                    // has no subscription (6.2.3.2)
                    return errorStanzaGenerator.generateNoSuchSubscriberErrorStanza(sender, serverJID, stanza);
                }
            } catch(MultipleSubscriptionException e) {
                // error case 6.2.3.1
                return errorStanzaGenerator.generateSubIDRequiredErrorStanza(sender, serverJID, stanza);
            }
        } else {
            if(node.unsubscribe(strSubID, subJID) == false) {
                // subID not valid (6.2.3.5)
                return errorStanzaGenerator.generateSubIDNotValidErrorStanza(sender, serverJID, stanza);
            }
        }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        String iqStanzaID = stanza.getAttributeValue("id");
        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB_OWNER);
       
        String nodeName = extractNodeName(stanza);
        LeafNode node = root.find(nodeName);

        if(node == null) {
            return errorStanzaGenerator.generateNoNodeErrorStanza(sender, serverJID, stanza);
        }

        if(!node.isAuthorized(sender, PubSubPrivilege.MANAGE_AFFILIATIONS)) {
            return errorStanzaGenerator.generateInsufficientPrivilegesErrorStanza(sender, serverJID, stanza);
        }

        List<AffiliationItem> affiliations = collectAllAffiliations(node);
        buildSuccessStanza(sb, node, affiliations);
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.