Examples of PageWindow


Examples of org.apache.wicket.pageStore.PageWindowManager.PageWindow

    // Add few pages.
    // All of them fully occupy the max space in the pageWindowManager.
    // So adding N+1st page removes the Nth page.
    manager.createPageWindow(page0id, maxSize);
    PageWindow page0Window = manager.getPageWindow(page0id);
    assertWindow(page0Window, page0id, page0Window.getFilePartOffset(), page0Window.getFilePartSize());

    manager.createPageWindow(page1id, maxSize);
    PageWindow page1Window = manager.getPageWindow(page1id);
    assertWindow(page1Window, page1id, page1Window.getFilePartOffset(), page1Window.getFilePartSize());

    // Try to get a page which has been lost with the adding of page1
    assertNull("Page0 must be lost when Page1 has been added.", manager.getPageWindow(page0id));

    manager.createPageWindow(page2id, maxSize);
    PageWindow page2Window = manager.getPageWindow(page2id);
    assertWindow(page2Window, page2id, page2Window.getFilePartOffset(), page2Window.getFilePartSize());

    // Try to get a page which has been lost with the adding of page2
    assertNull("Page1 must be lost when Page2 has been added.", manager.getPageWindow(page1id));
  }
View Full Code Here

Examples of org.apache.wicket.pageStore.PageWindowManager.PageWindow

   */
  @Test
  public void addRemove()
  {
    PageWindowManager manager = new PageWindowManager(300);
    PageWindow window;

    window = manager.createPageWindow(1, 50);
    assertWindow(window, 1, 0, 50);

    window = manager.createPageWindow(2, 40);
View Full Code Here

Examples of org.apache.wicket.pageStore.PageWindowManager.PageWindow

   */
  @Test
  public void pageWindowCycle()
  {
    PageWindowManager manager = new PageWindowManager(100);
    PageWindow window;

    window = manager.createPageWindow(1, 30);

    window = manager.createPageWindow(2, 30);

View Full Code Here

Examples of org.apache.wicket.pageStore.PageWindowManager.PageWindow

      }
      // only save page that has some data
      if (data != null)
      {
        // allocate window for page
        PageWindow window = getManager().createPageWindow(pageId, data.length);

        FileChannel channel = getFileChannel(true);
        if (channel != null)
        {
          try
          {
            // write the content
            channel.write(ByteBuffer.wrap(data), window.getFilePartOffset());
          }
          catch (IOException e)
          {
            log.error("Error writing to a channel " + channel, e);
          }
View Full Code Here

Examples of org.apache.wicket.pageStore.PageWindowManager.PageWindow

      if (unbound)
      {
        return null;
      }
      byte[] result = null;
      PageWindow window = getManager().getPageWindow(id);
      if (window != null)
      {
        result = loadPage(window);
      }
      return result;
View Full Code Here

Examples of org.apache.wicket.protocol.http.pagestore.PageWindowManager.PageWindow

      if (page.getData() != null)
      {
        PageMapEntry entry = getPageMapEntry(page.getPageMapName(), true);

        // allocate window for page
        PageWindow window = entry.manager.createPageWindow(page.getPageId(),
          page.getVersionNumber(), page.getAjaxVersionNumber(), page.getData().length);

        // remove the entry and add it to the end of entry list (to mark
        // it as last accessed(
        pageMapEntryList.remove(entry);
        pageMapEntryList.add(entry);

        // if we exceeded maximum session size, try to remove as many
        // pagemap as necessary and possible
        while (getTotalSize() > diskPageStore.getMaxSizePerSession() &&
          pageMapEntryList.size() > 1)
        {
          removePageMapEntry((PageMapEntry)pageMapEntryList.get(0));
        }

        // take the filechannel from the pool
        FileChannel channel = diskPageStore.fileChannelPool.getFileChannel(entry.fileName,
          true);
        try
        {
          // write the content
          channel.write(ByteBuffer.wrap(page.getData()), window.getFilePartOffset());
        }
        catch (IOException e)
        {
          log.error("Error writing to a channel " + channel, e);
        }
View Full Code Here

Examples of org.apache.wicket.protocol.http.pagestore.PageWindowManager.PageWindow

    {
      byte[] result = null;
      PageMapEntry entry = getPageMapEntry(pageMapName, false);
      if (entry != null)
      {
        PageWindow window = entry.manager.getPageWindow(id, versionNumber,
          ajaxVersionNumber);
        if (window != null)
        {
          result = loadPage(window, entry.fileName);
        }
View Full Code Here

Examples of org.apache.wicket.protocol.http.pagestore.PageWindowManager.PageWindow

      if (page.getData() != null)
      {
        PageMapEntry entry = getPageMapEntry(page.getPageMapName(), true);

        // allocate window for page
        PageWindow window = entry.manager.createPageWindow(page.getPageId(),
          page.getVersionNumber(), page.getAjaxVersionNumber(), page.getData().length);

        // remove the entry and add it to the end of entry list (to mark
        // it as last accessed(
        pageMapEntryList.remove(entry);
        pageMapEntryList.add(entry);

        // if we exceeded maximum session size, try to remove as many
        // pagemap as necessary and possible
        while (getTotalSize() > diskPageStore.getMaxSizePerSession() &&
          pageMapEntryList.size() > 1)
        {
          removePageMapEntry(pageMapEntryList.get(0));
        }

        // take the filechannel from the pool
        FileChannel channel = diskPageStore.fileChannelPool.getFileChannel(entry.fileName,
          true);
        try
        {
          // write the content
          channel.write(ByteBuffer.wrap(page.getData()), window.getFilePartOffset());
        }
        catch (IOException e)
        {
          log.error("Error writing to a channel " + channel, e);
        }
View Full Code Here

Examples of org.apache.wicket.protocol.http.pagestore.PageWindowManager.PageWindow

    {
      byte[] result = null;
      PageMapEntry entry = getPageMapEntry(pageMapName, false);
      if (entry != null)
      {
        PageWindow window = entry.manager.getPageWindow(id, versionNumber,
          ajaxVersionNumber);
        if (window != null)
        {
          result = loadPage(window, entry.fileName);
        }
View Full Code Here

Examples of org.apache.wicket.protocol.http.pagestore.PageWindowManager.PageWindow

      if (page.getData() != null)
      {
        PageMapEntry entry = getPageMapEntry(page.getPageMapName(), true);

        // allocate window for page
        PageWindow window = entry.manager.createPageWindow(page.getPageId(),
          page.getVersionNumber(), page.getAjaxVersionNumber(), page.getData().length);

        // remove the entry and add it to the end of entry list (to mark
        // it as last accessed(
        pageMapEntryList.remove(entry);
        pageMapEntryList.add(entry);

        // if we exceeded maximum session size, try to remove as many
        // pagemap as necessary and possible
        while (getTotalSize() > diskPageStore.getMaxSizePerSession() &&
          pageMapEntryList.size() > 1)
        {
          removePageMapEntry(pageMapEntryList.get(0));
        }

        // take the filechannel from the pool
        FileChannel channel = diskPageStore.fileChannelPool.getFileChannel(entry.fileName,
          true);
        try
        {
          // write the content
          channel.write(ByteBuffer.wrap(page.getData()), window.getFilePartOffset());
        }
        catch (IOException e)
        {
          log.error("Error writing to a channel " + channel, e);
        }
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.