Package org.apache.vysper.xmpp.state.resourcebinding

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry$SessionData


    protected final Map<String, Component> componentMap = new HashMap<String, Component>();

    public DefaultServerRuntimeContext(Entity serverEntity, StanzaRelay stanzaRelay) {
        this.serverEntity = serverEntity;
        this.stanzaRelay = stanzaRelay;
        this.resourceRegistry = new ResourceRegistry();
        this.stanzaHandlerLookup = new StanzaHandlerLookup();
    }
View Full Code Here


        tlsContextFactory.setTrustManagerFactory(bogusTrustManagerFactory);

        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);
View Full Code Here

        DefaultServerRuntimeContext serverContext = new DefaultServerRuntimeContext(
                new EntityImpl(null, "test", null),
                relay,
                new ServerFeatures(),
                dictionaries,
                new ResourceRegistry());

        relay.setServerRuntimeContext(serverContext);

        sessionFactory = new StanzaSessionFactory();
        sessionFactory.setServerRuntimeContext(serverContext);
View Full Code Here

        @SpecCompliant(spec="rfc3921bis-08", section = "2.2", status = FINISHED, coverage = COMPLETE)
    })
    @Override
    protected Stanza handleGet(IQStanza stanza, ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext) {

        ResourceRegistry registry = serverRuntimeContext.getResourceRegistry();
        RosterManager rosterManager = (RosterManager)serverRuntimeContext.getStorageProvider(RosterManager.class);

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

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

        ResourceState currentState = registry.getResourceState(resourceId);
        if (currentState != null) {
            registry.setResourceState(resourceId, ResourceState.makeInterested(currentState));
        }

        Roster roster = null;
        try {
            roster = rosterManager.retrieve(from.getBareJID());
View Full Code Here

        // return success
        return StanzaBuilder.createIQStanza(null, user, IQStanzaType.RESULT, stanza.getID()).build();
    }

    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

        dictionaries.add(new org.apache.vysper.xmpp.modules.core.session.SessionStanzaDictionary());
        dictionaries.add(new org.apache.vysper.xmpp.modules.core.compatibility.jabber_iq_auth.JabberIQAuthDictionary());
        dictionaries.add(new org.apache.vysper.xmpp.modules.roster.RosterDictionary());

        DefaultServerRuntimeContext serverContext = new DefaultServerRuntimeContext(new EntityImpl(null, "test", null),
                relay, new ServerFeatures(), dictionaries, new ResourceRegistry());

        relay.setServerRuntimeContext(serverContext);

        sessionFactory = new StanzaSessionFactory();
        sessionFactory.setServerRuntimeContext(serverContext);
View Full Code Here

        tlsContextFactory.setTrustManagerFactory(bogusTrustManagerFactory);

        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);
View Full Code Here

    protected final Map<String, Component> componentMap = new HashMap<String, Component>();

    public DefaultServerRuntimeContext(Entity serverEntity, StanzaRelay stanzaRelay) {
        this.serverEntity = serverEntity;
        this.stanzaRelay = stanzaRelay;
        this.resourceRegistry = new ResourceRegistry();
        this.stanzaHandlerLookup = new StanzaHandlerLookup(this);
    }
View Full Code Here

            @SpecCompliant(spec = "rfc3921bis-08", section = "2.1.5", status = FINISHED, coverage = PARTIAL),
            @SpecCompliant(spec = "rfc3921bis-08", section = "2.2", status = FINISHED, coverage = COMPLETE) })
    @Override
    protected Stanza handleGet(IQStanza stanza, ServerRuntimeContext serverRuntimeContext, SessionContext sessionContext) {

        ResourceRegistry registry = serverRuntimeContext.getResourceRegistry();
        RosterManager rosterManager = (RosterManager) serverRuntimeContext.getStorageProvider(RosterManager.class);

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

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

        ResourceState currentState = registry.getResourceState(resourceId);
        if (currentState != null) {
            registry.setResourceState(resourceId, ResourceState.makeInterested(currentState));
        }

        Roster roster = null;
        try {
            roster = rosterManager.retrieve(from.getBareJID());
View Full Code Here

        // return success
        return StanzaBuilder.createIQStanza(null, user, IQStanzaType.RESULT, stanza.getID()).build();
    }

    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

TOP

Related Classes of org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry$SessionData

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.