Package org.apache.vysper.xmpp.addressing

Examples of org.apache.vysper.xmpp.addressing.Entity


        if (rosterManager == null) {
            return handleCannotRetrieveRoster(stanza, sessionContext);
        }

        Entity user = extractUniqueSenderJID(stanza, sessionContext);
        if (user == null || !user.isResourceSet()) {
            return ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.UNKNOWN_SENDER, stanza, StanzaErrorType.MODIFY, "sender info insufficient: " + ((user == null) ? "no from" : user.getFullQualifiedName()), null, null);
        }

        RosterItem setRosterItem;
        try {
            setRosterItem = RosterUtils.parseRosterItem(stanza);
        } catch (RosterBadRequestException e) {
            return ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.BAD_REQUEST, stanza, StanzaErrorType.MODIFY, e.getMessage(), null, null);
        } catch (RosterNotAcceptableException e) {
            return ServerErrorResponses.getInstance().getStanzaError(StanzaErrorCondition.NOT_ACCEPTABLE, stanza, StanzaErrorType.MODIFY, e.getMessage(), null, null);
        }

        Entity contactJid = setRosterItem.getJid().getBareJID();

        RosterItem existingItem;
        try {
            existingItem = rosterManager.getContact(user.getBareJID(), contactJid);
        } catch (RosterException e) {
View Full Code Here


    private void pushRosterItemToInterestedResources(SessionContext sessionContext, Entity user, RosterItem rosterItem) {
        ResourceRegistry registry = sessionContext.getServerRuntimeContext().getResourceRegistry();
        List<String> resources = registry.getInterestedResources(user.getBareJID());
        for (String resource : resources) {
            Entity userResource = new EntityImpl(user, resource);
            Stanza push = RosterStanzaUtils.createRosterItemPushIQ(userResource, sessionContext.nextSequenceValue(), rosterItem);
            LocalDeliveryUtils.relayToResourceDirectly(registry, resource, push);
        }
    }
View Full Code Here

     */
    @Override
    protected Stanza handleGet(IQStanza stanza,
            ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext) {
        Entity serverJID = serviceConfiguration.getServerJID();
        CollectionNode root = serviceConfiguration.getRootNode();
       
        Entity sender = extractSenderJID(stanza, sessionContext);
        String iqStanzaID = stanza.getAttributeValue("id");

        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB);
        String nodeName = extractNodeName(stanza);
View Full Code Here

    protected AbstractStanzaGenerator getDefaultStanzaGenerator() {
        return new DefaultModifyAffiliationsStanzaGenerator("Node1", client3, PubSubAffiliation.PUBLISHER);
    }

    public void testModifyAffiliationsNoAuth() {
        Entity client2 = new EntityImpl("yoda", "starwars.com", null);

        AbstractStanzaGenerator sg = new DefaultModifyAffiliationsStanzaGenerator("Node1", client, PubSubAffiliation.MEMBER);
        Stanza stanza = sg.getStanza(client2, pubsubService, "id123", null);
        ResponseStanzaContainer result = sendStanza(stanza, true);
View Full Code Here

            , @SpecCompliant(spec="xep-0060", section="8.1.3", status= SpecCompliant.ComplianceStatus.NOT_STARTED, coverage = SpecCompliant.ComplianceCoverage.UNSUPPORTED)
        })
    protected Stanza handleSet(IQStanza stanza,
            ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext) {
        Entity serverJID = serviceConfiguration.getServerJID();
        CollectionNode root = serviceConfiguration.getRootNode();
       
        Entity sender = extractSenderJID(stanza, sessionContext);

        String iqStanzaID = stanza.getAttributeValue("id");

        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
View Full Code Here

            , @SpecCompliant(spec="xep-0060", section="7.1.3.6", status= SpecCompliant.ComplianceStatus.NOT_STARTED, coverage = SpecCompliant.ComplianceCoverage.UNSUPPORTED)
        })
    protected Stanza handleSet(IQStanza stanza,
            ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext) {
        Entity serverJID = serviceConfiguration.getServerJID();
        CollectionNode root = serviceConfiguration.getRootNode();
       
        Entity sender = extractSenderJID(stanza, sessionContext);

        String iqStanzaID = stanza.getAttributeValue("id");

        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB);
View Full Code Here

        assertEquals(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS, errorContent.get(0).getNamespaceURI());
    }

    public void testSubscribeNoSuchNode() throws Exception {
        DefaultSubscribeStanzaGenerator sg = new DefaultSubscribeStanzaGenerator();
        Entity pubsubWrongNode = EntityImpl.parse("pubsub.vysper.org");

        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubWrongNode, "id123", "doesnotexist"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
View Full Code Here

            , @SpecCompliant(spec="xep-0060", section="8.4.3.2", status= SpecCompliant.ComplianceStatus.FINISHED, coverage = SpecCompliant.ComplianceCoverage.COMPLETE)
        })
    protected Stanza handleSet(IQStanza stanza,
            ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext) {
        Entity serverJID = serviceConfiguration.getServerJID();
        CollectionNode root = serviceConfiguration.getRootNode();
       
        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);
View Full Code Here

     */
    @Override
    protected Stanza handleGet(IQStanza stanza,
            ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext) {
        Entity serverJID = serviceConfiguration.getServerJID();
        CollectionNode root = serviceConfiguration.getRootNode();
       
        Entity sender = extractSenderJID(stanza, sessionContext);
        String iqStanzaID = stanza.getAttributeValue("id");

        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB);
       
View Full Code Here

            , @SpecCompliant(spec="xep-0060", section="8.9.2.3.4", status= SpecCompliant.ComplianceStatus.NOT_STARTED, coverage = SpecCompliant.ComplianceCoverage.UNSUPPORTED)
        })
    protected Stanza handleGet(IQStanza stanza,
            ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext) {
        Entity serverJID = serviceConfiguration.getServerJID();
        CollectionNode root = serviceConfiguration.getRootNode();

        Entity sender = extractSenderJID(stanza, sessionContext);

        String iqStanzaID = stanza.getAttributeValue("id");
        StanzaBuilder sb = StanzaBuilder.createIQStanza(serverJID, sender, IQStanzaType.RESULT, iqStanzaID);
        sb.startInnerElement("pubsub", NamespaceURIs.XEP0060_PUBSUB_OWNER);
       
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.addressing.Entity

Copyright © 2018 www.massapicom. 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.