Examples of ResourceState


Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

        // GENERAL unavailable presence
        XMPPCoreStanza generalUnavailable = XMPPCoreStanza.getWrapper(StanzaBuilder.createPresenceStanza(
                initiatingUser.getEntityFQ(), null, null, PresenceStanzaType.UNAVAILABLE, null, null).build());
        handler.executeCore(generalUnavailable, sessionContext.getServerRuntimeContext(), true, sessionContext);
        assertTrue(0 < receiverRelay.getCountDelivered());
        ResourceState resourceState = sessionContext.getServerRuntimeContext().getResourceRegistry().getResourceState(
                initiatingUser.getBoundResourceId());
        assertFalse(ResourceState.isAvailable(resourceState));

        // directed presence has been recorded internally
        map = (Set<Entity>) sessionContext.getAttribute("DIRECTED_PRESENCE_MAP_" + initiatingUser.getBoundResourceId());
View Full Code Here

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

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

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

                    user, registry, false);

        if (!user.isResourceSet())
            throw new RuntimeException("resource id not available");
        String resourceId = user.getResource();
        ResourceState resourceState = registry.getResourceState(resourceId);

        boolean isPresenceUpdate = resourceState != null && ResourceState.isAvailable(resourceState);

        // TODO in case of !isPresenceUpdate, should we check for resourceState != ResourceState.AVAILABLE_INTERESTED ?
        // RFC3921bis-04#4.2.2 Initial Presence
        // RFC3921bis-04#4.4.2 Initial Presence

        updateLatestPresence(sessionContext, user, presenceStanza);
        if (!isPresenceUpdate) {
            // things to be done for initial presence

            // set resource state
            ResourceState currentState = registry.getResourceState(resourceId);
            // set to AVAILABLE, but do not override AVAILABLE_INTERESTED
            registry.setResourceState(resourceId, ResourceState.makeAvailable(currentState));
        }

        // the presence priority is optional, but if contained, it might become relevant for
View Full Code Here

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

        assertTrue(0 < receiverRelay.getCountDelivered());

        // directed presence has been recorded internally
        map = (Set<Entity>)sessionContext.getAttribute("DIRECTED_PRESENCE_MAP_" + initiatingUser.getBoundResourceId());
        assertTrue(map.size() == 0);
        ResourceState resourceState = sessionContext.getServerRuntimeContext().getResourceRegistry().getResourceState(initiatingUser.getBoundResourceId());
        assertTrue(ResourceState.isAvailable(resourceState));

        Stanza directedUnavailPresence = unrelatedUser.getNextStanza();
        assertNotNull(directedUnavailPresence);
        assertTrue(PresenceStanza.isOfType(directedUnavailPresence)); // is presence
View Full Code Here

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

        // GENERAL unavailable presence
        XMPPCoreStanza generalUnavailable = XMPPCoreStanza.getWrapper(StanzaBuilder.createPresenceStanza(initiatingUser.getEntityFQ(), null, null, PresenceStanzaType.UNAVAILABLE, null, null).build());
        handler.executeCore(generalUnavailable, sessionContext.getServerRuntimeContext(), true, sessionContext);
        assertTrue(0 < receiverRelay.getCountDelivered());
        ResourceState resourceState = sessionContext.getServerRuntimeContext().getResourceRegistry().getResourceState(initiatingUser.getBoundResourceId());
        assertFalse(ResourceState.isAvailable(resourceState));

        // directed presence has been recorded internally
        map = (Set<Entity>)sessionContext.getAttribute("DIRECTED_PRESENCE_MAP_" + initiatingUser.getBoundResourceId());
        assertEquals(0, map.size());
View Full Code Here

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

        if (hasTo) return handleOutboundDirectedPresence(presenceStanza, serverRuntimeContext, sessionContext,
                rosterManager, user, registry, false);

        if (!user.isResourceSet()) throw new RuntimeException("resource id not available");
        String resourceId = user.getResource();
        ResourceState resourceState = registry.getResourceState(resourceId);

        boolean isPresenceUpdate = resourceState != null && ResourceState.isAvailable(resourceState);

        // TODO in case of !isPresenceUpdate, should we check for resourceState != ResourceState.AVAILABLE_INTERESTED ?
        // RFC3921bis-04#4.2.2 Initial Presence
        // RFC3921bis-04#4.4.2 Initial Presence

        updateLatestPresence(sessionContext, user, presenceStanza);
        if (!isPresenceUpdate) {
            // things to be done for initial presence

            // set resource state
            ResourceState currentState = registry.getResourceState(resourceId);
            // set to AVAILABLE, but do not override AVAILABLE_INTERESTED
            registry.setResourceState(resourceId, ResourceState.makeAvailable(currentState));
        }
       
        // the presence priority is optional, but if contained, it might become relevant for
View Full Code Here

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

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

Examples of org.apache.vysper.xmpp.state.resourcebinding.ResourceState

                    user, registry, false);

        if (!user.isResourceSet())
            throw new RuntimeException("resource id not available");
        String resourceId = user.getResource();
        ResourceState resourceState = registry.getResourceState(resourceId);

        boolean isPresenceUpdate = resourceState != null && ResourceState.isAvailable(resourceState);

        // TODO in case of !isPresenceUpdate, should we check for resourceState != ResourceState.AVAILABLE_INTERESTED ?
        // RFC3921bis-04#4.2.2 Initial Presence
        // RFC3921bis-04#4.4.2 Initial Presence

        updateLatestPresence(sessionContext, user, presenceStanza);
        if (!isPresenceUpdate) {
            // things to be done for initial presence

            // set resource state
            ResourceState currentState = registry.getResourceState(resourceId);
            // set to AVAILABLE, but do not override AVAILABLE_INTERESTED
            registry.setResourceState(resourceId, ResourceState.makeAvailable(currentState));
        }

        // the presence priority is optional, but if contained, it might become relevant for
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.state.ResourceStateHandler.ResourceState

    if (ret.getCacheInfo() != null && (ret.getCacheInfo().isCacheEnabled() || ret.isEtagGenerationEnabled())) // only GET can declare cache
    {
      long dateModified;
      long expires = 0;
      String etag;
      ResourceState resourceState = resourceStateHandler.get(key);
      if (!ret.getCacheInfo().isCacheEnabled())
      {
        expires = (GET.ONE_DAY*1000)+System.currentTimeMillis();
      }
      if (resourceState != null && !resourceState.isExpired())
      {
        etag = resourceState.getEtag();
        dateModified = resourceState.getDateModified();
        if (ret.getCacheInfo().isCacheEnabled())
        {
          expires = ret.getCacheInfo().defineExpires(System.currentTimeMillis());
        }
      }
View Full Code Here

Examples of org.cruxframework.crux.core.server.rest.state.ResourceStateHandler.ResourceState

   * @return
   */
  private MethodReturn handleCacheableOperation()
  {
    ResourceStateHandler resourceStateHandler = ResourceStateConfig.getResourceStateHandler();
    ResourceState resourceState = resourceStateHandler.get(key);
    if (resourceState == null)
    {
      return null;
    }
    else
    {
      if (resourceState.isExpired())
      {
        return null;
      }
      ConditionalResponse conditionalResponse = evaluatePreconditions(resourceState);
      if (conditionalResponse != null)
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.