Examples of EntityImpl


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

        relayStanza(receiver.getJid(), builder.build(), serverRuntimeContext);
    }
   

    private void sendChangeShowStatus(Occupant changer, Occupant receiver, Room room, String show, String status, ServerRuntimeContext serverRuntimeContext) {
        Entity roomAndNick = new EntityImpl(room.getJID(), changer.getName());
       
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(roomAndNick, receiver.getJid(), null,
                null, show, status);
       
        boolean includeJid = includeJidInItem(room, receiver);
View Full Code Here

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

     // room is non-anonymous or semi-anonmoys and the occupant a moderator, send full user JID
        return room.getRoomTypes().contains(RoomType.NonAnonymous) ||
            (room.getRoomTypes().contains(RoomType.SemiAnonymous) && receiver.getRole() == Role.Moderator);
    }
    private void sendChangeNickAvailable(Occupant changer, Occupant receiver, Room room, ServerRuntimeContext serverRuntimeContext) {
        Entity roomAndOldNick = new EntityImpl(room.getJID(), changer.getName());
       
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(roomAndOldNick, receiver.getJid(), null, null, null, null);
       
        List<XMLElement> inner = new ArrayList<XMLElement>();
        boolean includeJid = includeJidInItem(room, receiver)
View Full Code Here

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

    }

   
    private void sendExitRoomPresenceToExisting(Occupant exitingOccupant, Occupant existingOccupant, Room room,
            String statusMessage, ServerRuntimeContext serverRuntimeContext) {
        Entity roomAndNewUserNick = new EntityImpl(room.getJID(), exitingOccupant.getName());
       
        StanzaBuilder builder = StanzaBuilder.createPresenceStanza(roomAndNewUserNick, existingOccupant.getJid(), null,
                PresenceStanzaType.UNAVAILABLE, null, null);

        List<XMLElement> inner = new ArrayList<XMLElement>();
View Full Code Here

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

//             from='wiccarocks@shakespeare.lit/laptop'
//             stamp='2002-10-13T23:58:43Z'/>
//        </message>
       
        Entity roomJid = message.getTo();
        StanzaBuilder builder = StanzaBuilder.createForward(message, new EntityImpl(roomJid, fromNick), receiver.getJid());

        Entity delayFrom;
        if(includeJid) {
            delayFrom = message.getFrom();
        } else {
            delayFrom = new EntityImpl(roomJid, fromNick);
        }
        Delay delay = new Delay(delayFrom, timestamp);
        builder.addPreparedElement(delay);
       
        return builder.build();
View Full Code Here

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

        Entity to = TestUtil.parseUnchecked("user2@vysper.org/res");
        Occupant toOccupant = new Occupant(to, "nick 2", Affiliation.None, Role.Visitor);
        MessageStanza outStanza = (MessageStanza) MessageStanza.getWrapper(item.createStanza(toOccupant, true));
       
        assertEquals(to, outStanza.getTo());
        assertEquals(new EntityImpl(ROOM_JID, NICK), outStanza.getFrom());
        assertEquals("groupchat", outStanza.getType());
        assertEquals(BODY, outStanza.getBody(null));
       
        XMLElement delayElm = outStanza.getInnerElements().get(1);
        assertEquals(FROM.getFullQualifiedName(), delayElm.getAttributeValue("from"));
View Full Code Here

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

   
    private void assertStanza(Stanza stanza, String expectedBody, String expectedSubject) throws Exception {
        assertNotNull(stanza);
        MessageStanza msgStanza = (MessageStanza) MessageStanza.getWrapper(stanza);
       
        assertEquals(new EntityImpl(ROOM_JID, NICK), msgStanza.getFrom());
        assertEquals(RECEIVER, msgStanza.getTo());
        assertEquals("groupchat", msgStanza.getType());
        assertEquals(expectedBody, msgStanza.getBody(null));
        assertEquals(expectedSubject, msgStanza.getSubject(null));
        assertEquals(1, msgStanza.getInnerElementsNamed("delay").size());
View Full Code Here

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

        List<NamespaceHandlerDictionary> dictionaries = new ArrayList<NamespaceHandlerDictionary>();
        addCoreDictionaries(dictionaries);

        ResourceRegistry resourceRegistry = new ResourceRegistry();

        EntityImpl serverEntity = new EntityImpl(null, serverDomain, null);

        AccountManagement accountManagement = (AccountManagement) storageProviderRegistry.retrieve(AccountManagement.class);
        DeliveringInboundStanzaRelay internalStanzaRelay = new DeliveringInboundStanzaRelay(serverEntity, resourceRegistry, accountManagement);
        RecordingStanzaRelay externalStanzaRelay = new RecordingStanzaRelay();
View Full Code Here

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

                contactJidString = node.getName();
            } catch (RepositoryException e) {
                logger.warn("when loading roster for user {} cannot read node name for node id = " + node.toString());
            }
            logger.warn("try now loading contact " + contactJidString + " from node " + node.toString());
            EntityImpl contactJid = null;
            if (contactJidString != null) {
                try {
                    contactJid = EntityImpl.parse(contactJidString);
                } catch (EntityFormatException e) {
                    logger.warn("when loading roster for user {} parsing  contact jid {}", bareJid, contactJidString);
                }
            }
            if (contactJid == null) {
                logger.warn("when loading roster for user {}, skipping a contact due to missing or unparsable jid", bareJid);
                continue;
            }

            String name = readAttribute(node, "name");
            String typeString = readAttribute(node, "type");
            SubscriptionType subscriptionType = null;
            try {
                subscriptionType = SubscriptionType.valueOf(typeString == null ? "NONE" : typeString.toUpperCase());
            } catch (IllegalArgumentException e) {
                logger.warn("when loading roster for user " + bareJid + ", contact " + contactJid + " misses a subscription type", bareJid, contactJid);
            }
            String askTypeString = readAttribute(node, "askType");
            AskSubscriptionType askSubscriptionType = AskSubscriptionType.NOT_SET;
            try {
                if (askTypeString != null) askSubscriptionType = AskSubscriptionType.valueOf(askTypeString);
            } catch (IllegalArgumentException e) {
                logger.warn("when loading roster for user " + bareJid.getFullQualifiedName() + ", contact " + contactJid.getFullQualifiedName() + ", the ask subscription type is unparsable. skipping!");
                continue; // don't return it, don't set a default!
            }

            List<RosterGroup> groups = new ArrayList<RosterGroup>();
            // TODO read groups
View Full Code Here

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

    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

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

    protected Entity client3 = null;

    @Override
    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
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.