Examples of TokenCache


Examples of edu.harvard.wcfia.yoshikoder.document.tokenizer.TokenCache

       
        project = getLastProject();
        updateFrameTitle();
       
        highlightColor = Color.yellow;
        tokenizationCache = new TokenCache();
        makeGUI();
    }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

   * Return a PageFlowScopeMap stored with a token.
   */
  static public PageFlowScopeMap getPageFlowScopeMap(
    FacesContext context, String token, int lifetime)
  {
    TokenCache cache = _getRootTokenCache(context, lifetime);
    PageFlowScopeMap map = _getPageFlowScopeMap(context, cache, token);

    if (_LOG.isFine())
    {
      _LOG.fine("pageFlowScope: found map {0} at token {1}",
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

        (_sharedData._children == null) &&
        (_sharedData._parent == null))
      return null;

    String parentToken;
    TokenCache cache;
    if (_sharedData._parent != null)
    {
      parentToken = _sharedData._parent.getToken(context);
      cache = _sharedData._parent._getTokenCache();
    }
    else
    {
      parentToken = null;
      cache = _getRootTokenCache(context, _sharedData._lifetime);
    }

    Map<String, Object> store = _createMapToStore(context, parentToken);

    String token = cache.addNewEntry(this, store);

    if (parentToken != null)
      token = parentToken + TokenCache.SEPARATOR_CHAR + token;

    _token = token;
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

  }

  private TokenCache _getTokenCache()
  {
    if (_sharedData._children == null)
      _sharedData._children = new TokenCache(_sharedData._lifetime);

    return _sharedData._children;
  }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

    {
      String token;
      if (applicationViewCache == null)
      {
        assert(!dontSave);
        TokenCache cache = _getViewCache(context);
        assert(cache != null);

        // Store bits of the session as subkeys off of the session
        Map<String, Object> stateMap = new SubKeyMap(
                         context.getExternalContext().getSessionMap(),
                         _VIEW_CACHE_KEY + ".");
        // Sadly, we can't save just a SerializedView, because we should
        // save a serialized object, and SerializedView is a *non*-static
        // inner class of StateManager
        PageState pageState = new PageState(
            context,
            structure,
            state,
            // Save the view root into the page state as a transient
            // if this feature has not been disabled
            _useViewRootCache(context) ? root : null);

        token = cache.addNewEntry(pageState,
                                  stateMap);
      }
      // If we got the "applicationViewCache", we're using it.
      else
      {
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

    {
      String token;
      if (applicationViewCache == null)
      {
        assert(!dontSave);
        TokenCache cache = _getViewCache(context);
        assert(cache != null);

        // Store bits of the session as subkeys off of the session
        Map<String, PageState> stateMap = new SubKeyMap<PageState>(
                         context.getExternalContext().getSessionMap(),
                         _VIEW_CACHE_KEY + ".");
        // Sadly, we can't save just a SerializedView, because we should
        // save a serialized object, and SerializedView is a *non*-static
        // inner class of StateManager
        PageState pageState = new PageState(
            context,
            structure,
            state,
            // Save the view root into the page state as a transient
            // if this feature has not been disabled
            _useViewRootCache(context) ? root : null);

        // clear out all of the previous PageStates' UIViewRoots and add this page
        // state as an active page state.  This is necessary to avoid UIViewRoots
        // laying around if the user navigates off of a page using a GET
        synchronized(this)
        {
          if (_activePageState != null)
            _activePageState.clearViewRootState();
         
          _activePageState = pageState;
        }

        String requestToken = _getRequestTokenForResponse(context);
        // If we have a cached token that we want to reuse,
        // and that token hasn't disappeared from the cache already
        // (unlikely, but not impossible), use the stateMap directly
        // without asking the cache for a new token
        if ((requestToken != null) && cache.isAvailable(requestToken))
        {
          // NOTE: under *really* high pressure, the cache might
          // have been emptied between the isAvailable() call and
          // this put().  This seems sufficiently implausible to
          // be worth punting on
          stateMap.put(requestToken, pageState);
          token = requestToken;
          // NOTE 2: we have not pinned this reused state to any old state
          // This is OK for current uses of pinning and state reuse,
          // as pinning stays constant within a window, and we're not
          // erasing pinning at all.
        }
        else
        {
          // See if we should pin this new state to any old state
          String pinnedToken = (String)
            context.getExternalContext().getRequestMap().get(_PINNED_STATE_TOKEN_KEY);
          token = cache.addNewEntry(pageState,
                                    stateMap,
                                    pinnedToken);
        }
      }
      // If we got the "applicationViewCache", we're using it.
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

  private Object _saveStateToCache(FacesContext context, Object viewState, UIViewRoot root)
  {
    ExternalContext extContext = context.getExternalContext();
    RequestContext trinContext = RequestContext.getCurrentInstance();

    TokenCache cache = _getViewCache(trinContext, extContext);
    assert(cache != null);


    // get per window view cache key with "." separator suffix to separate the SubKeyMap keys
    String subkey = _getViewCacheKey(extContext, trinContext, _SUBKEY_SEPARATOR);

    Map<String, Object> sessionMap = extContext.getSessionMap();
    Map<String, PageState> stateMap = new SubKeyMap<PageState>(sessionMap, subkey);

    // Sadly, we can't save just a SerializedView, because we should
    // save a serialized object, and SerializedView is a *non*-static
    // inner class of StateManager
    PageState pageState = new PageState(
        context,
        viewState,
        // Save the view root into the page state as a transient
        // if this feature has not been disabled
        _useViewRootCache(context) ? root : null);

    String requestToken = _getRequestTokenForResponse(context);
    String token;

    // If we have a cached token that we want to reuse,
    // and that token hasn't disappeared from the cache already
    // (unlikely, but not impossible), use the stateMap directly
    // without asking the cache for a new token
    if ((requestToken != null) && cache.isAvailable(requestToken))
    {
      // NOTE: under *really* high pressure, the cache might
      // have been emptied between the isAvailable() call and
      // this put().  This seems sufficiently implausible to
      // be worth punting on
      stateMap.put(requestToken, pageState);
      token = requestToken;
      // NOTE 2: we have not pinned this reused state to any old state
      // This is OK for current uses of pinning and state reuse,
      // as pinning stays constant within a window, and we're not
      // erasing pinning at all.
    }
    else
    {
      // See if we should pin this new state to any old state
      String pinnedToken = (String)extContext.getRequestMap().get(_PINNED_STATE_TOKEN_KEY);
      token = cache.addNewEntry(pageState,
                                stateMap,
                                pinnedToken);
    }


View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache


      if (applicationViewCache == null)
      {
        assert(!dontSave);
        TokenCache cache = _getViewCache(context);
        assert(cache != null);

        Map<String, Object> sessionMap = extContext.getSessionMap();

        // Store bits of the session as subkeys off of the session
        Map<String, PageState> stateMap = new SubKeyMap<PageState>(sessionMap,
                                                                   _VIEW_CACHE_KEY + ".");

        // Sadly, we can't save just a SerializedView, because we should
        // save a serialized object, and SerializedView is a *non*-static
        // inner class of StateManager
        PageState pageState = new PageState(
            context,
            structure,
            state,
            // Save the view root into the page state as a transient
            // if this feature has not been disabled
            _useViewRootCache(context) ? root : null);

        // clear out all of the previous PageStates' UIViewRoots and add this page
        // state as an active page state.  This is necessary to avoid UIViewRoots
        // laying around if the user navigates off of a page using a GET
        synchronized(extContext.getSession(true))
        {
          PageState activePageState = (PageState)sessionMap.get(_ACTIVE_PAGE_STATE_SESSION_KEY);

          if (activePageState != null)
            activePageState.clearViewRootState();

          sessionMap.put(_ACTIVE_PAGE_STATE_SESSION_KEY, pageState);
        }
       
        String requestToken = _getRequestTokenForResponse(context);
        // If we have a cached token that we want to reuse,
        // and that token hasn't disappeared from the cache already
        // (unlikely, but not impossible), use the stateMap directly
        // without asking the cache for a new token
        if ((requestToken != null) && cache.isAvailable(requestToken))
        {
          // NOTE: under *really* high pressure, the cache might
          // have been emptied between the isAvailable() call and
          // this put().  This seems sufficiently implausible to
          // be worth punting on
          stateMap.put(requestToken, pageState);
          token = requestToken;
          // NOTE 2: we have not pinned this reused state to any old state
          // This is OK for current uses of pinning and state reuse,
          // as pinning stays constant within a window, and we're not
          // erasing pinning at all.
        }
        else
        {
          // See if we should pin this new state to any old state
          String pinnedToken = (String)extContext.getRequestMap().get(_PINNED_STATE_TOKEN_KEY);
          token = cache.addNewEntry(pageState,
                                    stateMap,
                                    pinnedToken);
        }
      }
      // If we got the "applicationViewCache", we're using it.
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

   * Return a PageFlowScopeMap stored with a token.
   */
  static public PageFlowScopeMap getPageFlowScopeMap(
    FacesContext context, String token, int lifetime)
  {
    TokenCache cache = _getRootTokenCache(context, lifetime);
    PageFlowScopeMap map = _getPageFlowScopeMap(context, cache, token);

    if (_LOG.isFine())
    {
      _LOG.fine("pageFlowScope: found map {0} at token {1}",
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.util.TokenCache

        (_sharedData._children == null) &&
        (_sharedData._parent == null))
      return null;

    String parentToken;
    TokenCache cache;
    if (_sharedData._parent != null)
    {
      parentToken = _sharedData._parent.getToken(context);
      cache = _sharedData._parent._getTokenCache();
    }
    else
    {
      parentToken = null;
      cache = _getRootTokenCache(context, _sharedData._lifetime);
    }

    Map<String, Object> store = _createMapToStore(context, parentToken);

    String token = cache.addNewEntry(this, store);

    if (parentToken != null)
      token = parentToken + TokenCache.SEPARATOR_CHAR + token;

    _token = token;
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.