http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/pageStore/disk/PageWindowManagerTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/disk/PageWindowManagerTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/disk/PageWindowManagerTest.java
new file mode 100644
index 0000000..714738c
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/disk/PageWindowManagerTest.java
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.pageStore.disk;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.security.SecureRandom;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.wicket.pageStore.disk.PageWindowManager.FileWindow;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test for {@link PageWindowManager}.
+ * 
+ * @author Matej Knopp
+ */
+public class PageWindowManagerTest
+{
+       /**
+        * https://issues.apache.org/jira/browse/WICKET-4572
+        */
+       @Test
+       void removeObsoleteIndices()
+       {
+               int page0id = 0,
+                       page1id = 1,
+                       page2id = 2;
+               int maxSize = 10;
+
+               PageWindowManager manager = new PageWindowManager(maxSize);
+
+               // 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, "foo", maxSize);
+               FileWindow page0Window = manager.getPageWindow(page0id);
+               assertWindow(page0Window, page0id, 
page0Window.getFilePartOffset(), page0Window.getFilePartSize());
+
+               manager.createPageWindow(page1id, "foo", maxSize);
+               FileWindow 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(manager.getPageWindow(page0id), "Page0 must be lost 
when Page1 has been added.");
+
+               manager.createPageWindow(page2id, "foo", maxSize);
+               FileWindow 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(manager.getPageWindow(page1id), "Page1 must be lost 
when Page2 has been added.");
+       }
+
+       /**
+        * 
+        */
+       @Test
+       void addRemove()
+       {
+               PageWindowManager manager = new PageWindowManager(300);
+               FileWindow window;
+
+               window = manager.createPageWindow(1, "foo", 50);
+               assertWindow(window, 1, 0, 50);
+
+               window = manager.createPageWindow(2, "foo", 40);
+               assertWindow(window, 2, 50, 40);
+
+               assertEquals(manager.getTotalSize(), 90);
+
+               window = manager.createPageWindow(2, "foo", 30);
+               assertWindow(window, 2, 50, 30);
+               assertEquals(manager.getTotalSize(), 80);
+
+               manager.removePage(2);
+               assertEquals(manager.getTotalSize(), 50);
+
+               window = manager.createPageWindow(3, "foo", 30);
+               assertWindow(window, 3, 50, 30);
+               assertEquals(manager.getTotalSize(), 80);
+       }
+
+       /**
+        * 
+        */
+       @Test
+       public void pageWindowCycle()
+       {
+               PageWindowManager manager = new PageWindowManager(100);
+               FileWindow window;
+
+               window = manager.createPageWindow(1, "foo", 30);
+
+               window = manager.createPageWindow(2, "foo", 30);
+
+               window = manager.createPageWindow(3, "foo", 30);
+
+               assertWindow(window, 3, 60, 30);
+
+               window = manager.createPageWindow(4, "foo", 30);
+
+               assertWindow(window, 4, 90, 30);
+
+               // should start at the beginging
+
+               window = manager.createPageWindow(5, "foo", 20);
+
+               assertWindow(window, 5, 0, 20);
+
+               assertNull(manager.getPageWindow(1));
+
+               window = manager.getPageWindow(2);
+               assertWindow(window, 2, 30, 30);
+
+               window = manager.createPageWindow(6, "foo", 10);
+
+               assertWindow(window, 6, 20, 10);
+
+               window = manager.getPageWindow(2);
+               assertWindow(window, 2, 30, 30);
+
+               window = manager.createPageWindow(6, "foo", 30);
+               assertWindow(window, 6, 20, 30);
+
+               assertNull(manager.getPageWindow(2));
+               assertNotNull(manager.getPageWindow(3));
+
+               window = manager.createPageWindow(6, "foo", 60);
+               assertWindow(window, 6, 20, 60);
+
+               assertNull(manager.getPageWindow(3));
+
+               window = manager.createPageWindow(7, "foo", 20);
+               assertWindow(window, 7, 80, 20);
+
+               assertNotNull(manager.getPageWindow(7));
+
+               // should start at the beginning again
+
+               window = manager.createPageWindow(8, "foo", 10);
+               assertWindow(window, 8, 0, 10);
+
+               assertNull(manager.getPageWindow(5));
+               assertNotNull(manager.getPageWindow(6));
+
+               window = manager.createPageWindow(9, "foo", 20);
+               assertWindow(window, 9, 10, 20);
+
+               assertNull(manager.getPageWindow(6));
+               assertNotNull(manager.getPageWindow(7));
+
+               window = manager.createPageWindow(10, "foo", 20);
+               assertWindow(window, 10, 30, 20);
+
+               assertNull(manager.getPageWindow(6));
+               assertNotNull(manager.getPageWindow(7));
+
+               // make sure when replacing a page that's not last the old 
"instance" is
+               // not valid anymore
+
+               manager.createPageWindow(8, "foo", 10);
+
+               window = manager.getPageWindow(8);
+               assertWindow(window, 8, 50, 10);
+       }
+
+
+       private void assertWindow(FileWindow window, int pageId, int 
filePartOffset, int filePartSize)
+       {
+               assertTrue(window.getPageId() == pageId && 
window.getFilePartOffset() == filePartOffset &&
+                       window.getFilePartSize() == filePartSize);
+       }
+
+       /** how many operations to execute */
+       private static final int EXECUTIONS = 10000;
+
+       /** used to wait the executions */
+       private static final CountDownLatch LATCH = new 
CountDownLatch(EXECUTIONS);
+
+       private final PageWindowManager pageWindowManager = new 
PageWindowManager(1000L);
+
+       /** the execution types */
+       private final Runnable[] TASKS = new Runnable[]
+       {
+               new CreatePageWindowTask(pageWindowManager),
+               new GetPageWindowTask(pageWindowManager),
+               new RemovePageInSessionTask(pageWindowManager)
+       };
+
+       private static final SecureRandom RND = new SecureRandom();
+
+       /**
+        * Executes random mutator and accessor operations on {@link 
org.apache.wicket.pageStore.AsynchronousPageStore} validating
+        * that the used data structures can be used simultaneously.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void randomOperations() throws Exception
+       {
+               ExecutorService executorService = 
Executors.newFixedThreadPool(50);
+
+               for (int i = 0; i < EXECUTIONS; i++)
+               {
+                       Runnable task = TASKS[RND.nextInt(TASKS.length)];
+                       executorService.submit(task);
+               }
+               LATCH.await();
+               executorService.shutdown();
+       }
+
+       private static abstract class AbstractTask implements Runnable
+       {
+               /** the ids for the stored/removed pages */
+               private static final int[] PAGE_IDS = new int[] { 1, 2, 3, 4, 
5, 6, 7, 8, 9, 10 };
+
+               protected final PageWindowManager pageWindowManager;
+
+               private AbstractTask(PageWindowManager pageWindowManager)
+               {
+                       this.pageWindowManager = pageWindowManager;
+               }
+
+               protected abstract void r();
+
+               @Override
+               public void run()
+               {
+                       try
+                       {
+                               r();
+                       }
+                       finally
+                       {
+                               LATCH.countDown();
+                       }
+               }
+
+               protected int getPageId()
+               {
+                       return PAGE_IDS[RND.nextInt(PAGE_IDS.length)];
+               }
+       }
+
+       private static class CreatePageWindowTask extends AbstractTask
+       {
+               private CreatePageWindowTask(PageWindowManager 
pageWindowManager)
+               {
+                       super(pageWindowManager);
+               }
+
+               @Override
+               public void r()
+               {
+                       pageWindowManager.createPageWindow(getPageId(), "foo", 
1000);
+               }
+       }
+
+       private static class GetPageWindowTask extends AbstractTask
+       {
+               private GetPageWindowTask(PageWindowManager pageWindowManager)
+               {
+                       super(pageWindowManager);
+               }
+
+               @Override
+               public void r()
+               {
+                       pageWindowManager.getPageWindow(getPageId());
+               }
+       }
+
+       private static class RemovePageInSessionTask extends AbstractTask
+       {
+               private RemovePageInSessionTask(PageWindowManager 
pageWindowManager)
+               {
+                       super(pageWindowManager);
+               }
+
+               @Override
+               public void r()
+               {
+                       pageWindowManager.removePage(getPageId());
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/DummyPageManagerContext.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/DummyPageManagerContext.java
 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/DummyPageManagerContext.java
deleted file mode 100644
index 6018ded..0000000
--- 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/DummyPageManagerContext.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.pageStore.memory;
-
-import java.io.Serializable;
-
-import org.apache.wicket.page.IPageManagerContext;
-
-/**
- */
-public class DummyPageManagerContext implements IPageManagerContext
-{
-
-       private Serializable attribute = null;
-       private Object requestData;
-
-       @Override
-       public void setRequestData(Object data)
-       {
-               requestData = data;
-       }
-
-       @Override
-       public Object getRequestData()
-       {
-               return requestData;
-       }
-
-       @Override
-       public void setSessionAttribute(String key, Serializable value)
-       {
-               attribute = value;
-       }
-
-       @Override
-       public Serializable getSessionAttribute(String key)
-       {
-               return attribute;
-       }
-
-       @Override
-       public void bind()
-       {
-       }
-
-       @Override
-       public String getSessionId()
-       {
-               return "dummy_id";
-       }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/HttpSessionDataStoreTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/HttpSessionDataStoreTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/HttpSessionDataStoreTest.java
deleted file mode 100644
index a1010c4..0000000
--- 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/HttpSessionDataStoreTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.pageStore.memory;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import org.apache.wicket.util.tester.WicketTestCase;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-/**
- */
-class HttpSessionDataStoreTest extends WicketTestCase
-{
-       private final String sessionId = "anything";
-
-       private final int pageId = 1;
-
-       private final byte[] PAGE1 = new byte[] { 1 };
-       final byte[] PAGE2 = new byte[] { 2 };
-
-       private HttpSessionDataStore store;
-
-       /**
-        * before()
-        */
-       @BeforeEach
-    void before()
-       {
-               store = new HttpSessionDataStore(new DummyPageManagerContext(), 
new NoopEvictionStrategy());
-       }
-
-       /**
-        * after()
-        */
-       @AfterEach
-    void after()
-       {
-               store.destroy();
-       }
-
-       /**
-        * storePage()
-        */
-       @Test
-    void storePage()
-       {
-               assertNull(store.getData(sessionId, pageId));
-
-               store.storeData(sessionId, pageId, PAGE1);
-               assertArrayEquals(PAGE1, store.getData(sessionId, pageId));
-       }
-
-       /**
-        * removePage1()
-        */
-       @Test
-    void removePage1()
-       {
-               assertNull(store.getData(sessionId, pageId));
-
-               store.storeData(sessionId, pageId, PAGE1);
-
-               assertNotNull(store.getData(sessionId, pageId));
-
-               store.removeData(sessionId, pageId);
-
-               assertNull(store.getData(sessionId, pageId));
-       }
-
-       /**
-        * removePage2()
-        */
-       @Test
-    void removePage2()
-       {
-               assertNull(store.getData(sessionId, pageId));
-
-               store.storeData(sessionId, pageId, PAGE1);
-
-               assertNotNull(store.getData(sessionId, pageId));
-
-               store.removeData(sessionId);
-
-               assertNull(store.getData(sessionId, pageId));
-       }
-
-
-       private static final class NoopEvictionStrategy implements 
IDataStoreEvictionStrategy
-       {
-
-               @Override
-               public void evict(PageTable pageTable)
-               {
-               }
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/MemorySizeEvictionStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/MemorySizeEvictionStrategyTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/MemorySizeEvictionStrategyTest.java
deleted file mode 100644
index daacc62..0000000
--- 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/MemorySizeEvictionStrategyTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.pageStore.memory;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.apache.wicket.core.util.lang.WicketObjects;
-import org.apache.wicket.util.lang.Bytes;
-import org.junit.jupiter.api.Test;
-
-/***/
-class MemorySizeEvictionStrategyTest
-{
-       private final byte[] PAGE1 = new byte[] { 1 };
-       private final byte[] PAGE2 = new byte[] { 2, 3 };
-
-       /***/
-       @Test
-       void evict()
-       {
-               PageTable pageTable = new PageTable();
-
-               long sizeOfEmptyPageTable = WicketObjects.sizeof(pageTable);
-
-               // evict to empty page table
-               MemorySizeEvictionStrategy strategy = new 
MemorySizeEvictionStrategy(
-                       Bytes.bytes(sizeOfEmptyPageTable));
-               pageTable.storePage(PAGE1.length, PAGE1);
-               assertEquals(1, pageTable.size());
-               strategy.evict(pageTable);
-               assertEquals(0, pageTable.size());
-               long currentSize = WicketObjects.sizeof(pageTable);
-               assertTrue(currentSize <= sizeOfEmptyPageTable, "Current size: 
|" + currentSize + "|, strategy size: |" + sizeOfEmptyPageTable +
-                               "|");
-
-               // evict to page table with size: empty + PAGE2
-               pageTable.storePage(PAGE2.length, PAGE2);
-               long sizeOfWithPage2 = WicketObjects.sizeof(pageTable);
-               strategy = new 
MemorySizeEvictionStrategy(Bytes.bytes(sizeOfWithPage2));
-               pageTable.storePage(PAGE1.length, PAGE1);
-               assertEquals(2, pageTable.size());
-               strategy.evict(pageTable);
-               // the following assertion depends on the fact that PAGE2 has
-               // bigger size than PAGE1
-               assertEquals(1, pageTable.size());
-               currentSize = WicketObjects.sizeof(pageTable);
-               assertTrue(currentSize <= sizeOfWithPage2, "Current size: |" + 
currentSize + "|, strategy size: |" + sizeOfWithPage2 + "|");
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageNumberEvictionStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageNumberEvictionStrategyTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageNumberEvictionStrategyTest.java
deleted file mode 100644
index f0ca167..0000000
--- 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageNumberEvictionStrategyTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.pageStore.memory;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import org.junit.jupiter.api.Test;
-
-/***/
-class PageNumberEvictionStrategyTest
-{
-
-       private final byte[] PAGE1 = new byte[] { 1 };
-       private final byte[] PAGE2 = new byte[] { 2, 3 };
-
-       /***/
-       @Test
-       void evict()
-       {
-               // evict to page table with one page only
-               PageNumberEvictionStrategy strategy = new 
PageNumberEvictionStrategy(1);
-
-               PageTable pageTable = new PageTable();
-
-               pageTable.storePage(PAGE1.length, PAGE1);
-               assertEquals(1, pageTable.size());
-               strategy.evict(pageTable);
-               assertEquals(1, pageTable.size());
-               assertNotNull(pageTable.getPage(PAGE1.length));
-
-               pageTable.storePage(PAGE2.length, PAGE2);
-               assertEquals(2, pageTable.size());
-               strategy.evict(pageTable);
-               assertEquals(1, pageTable.size());
-               assertNotNull(pageTable.getPage(PAGE2.length));
-               assertNull(pageTable.getPage(PAGE1.length));
-       }
-
-       /**
-        * The number of pages must be at least '1'
-        */
-       @Test
-       void greaterThanZero()
-       {
-               assertThrows(IllegalArgumentException.class, () -> {
-                       new PageNumberEvictionStrategy(0);
-               });
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageTableTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageTableTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageTableTest.java
deleted file mode 100644
index 9c03545..0000000
--- 
a/wicket-core/src/test/java/org/apache/wicket/pageStore/memory/PageTableTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.pageStore.memory;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import org.junit.jupiter.api.Test;
-
-/***/
-class PageTableTest
-{
-
-       private final byte[] data = new byte[] { 1 };
-
-       /***/
-       @Test
-       void getOldest()
-       {
-               PageTable pageTable = new PageTable();
-
-               assertNull(pageTable.getOldest());
-
-               pageTable.storePage(1, data);
-               // index: 1
-               assertEquals(Integer.valueOf(1), pageTable.getOldest());
-
-               pageTable.storePage(2, data);
-               // index: 2, 1
-               assertEquals(Integer.valueOf(1), pageTable.getOldest());
-
-               pageTable.storePage(3, data);
-               // index: 3, 2, 1
-               assertEquals(Integer.valueOf(1), pageTable.getOldest());
-
-               pageTable.getPage(1);
-               // index: 1, 3, 2
-               assertEquals(Integer.valueOf(2), pageTable.getOldest());
-
-               pageTable.removePage(2);
-               // index: 1, 3
-               assertEquals(Integer.valueOf(3), pageTable.getOldest());
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/request/handler/PageIdPoliticTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/request/handler/PageIdPoliticTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/request/handler/PageIdPoliticTest.java
index 71b0dc5..5b0aa10 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/request/handler/PageIdPoliticTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/request/handler/PageIdPoliticTest.java
@@ -29,17 +29,15 @@ import 
org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.html.WebComponent;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.page.IManageablePage;
 import org.apache.wicket.page.IPageManager;
-import org.apache.wicket.page.IPageManagerContext;
-import org.apache.wicket.page.PageStoreManager;
-import org.apache.wicket.pageStore.DefaultPageStore;
-import org.apache.wicket.pageStore.IPageStore;
+import org.apache.wicket.page.PageManager;
+import org.apache.wicket.pageStore.IPageContext;
+import org.apache.wicket.pageStore.InMemoryPageStore;
 import org.apache.wicket.request.Url;
-import org.apache.wicket.serialize.java.JavaSerializer;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
 import org.apache.wicket.util.tester.WicketTester;
-import org.apache.wicket.versioning.InMemoryPageStore;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -47,10 +45,10 @@ import org.junit.jupiter.api.Test;
 /**
  * @author Pedro Santos
  */
-class PageIdPoliticTest
+public class PageIdPoliticTest
 {
        private WicketTester tester;
-       private InMemoryPageStore dataStore;
+       private InMemoryPageStore pageStore;
        private MockApplication application;
        private int storeCount;
 
@@ -89,12 +87,12 @@ class PageIdPoliticTest
        void setUp() throws Exception
        {
                application = new MockApplication();
-               dataStore = new InMemoryPageStore()
+               pageStore = new InMemoryPageStore("test", Integer.MAX_VALUE)
                {
                        @Override
-                       public void storeData(String sessionId, int pageId, 
byte[] pageAsBytes)
+                       public void addPage(IPageContext context, 
IManageablePage page)
                        {
-                               super.storeData(sessionId, pageId, pageAsBytes);
+                               super.addPage(context, page);
                                storeCount++;
                        }
                };
@@ -106,12 +104,9 @@ class PageIdPoliticTest
                                return new IPageManagerProvider()
                                {
                                        @Override
-                                       public IPageManager 
apply(IPageManagerContext pageManagerContext)
+                                       public IPageManager get()
                                        {
-                                               IPageStore pageStore = new 
DefaultPageStore(new JavaSerializer(
-                                                       
application.getApplicationKey()), dataStore, 4);
-                                               return new 
PageStoreManager(application.getName(), pageStore,
-                                                       pageManagerContext);
+                                               return new 
PageManager(pageStore);
                                        }
                                };
                        }
@@ -135,7 +130,7 @@ class PageIdPoliticTest
                /**
                 * Construct.
                 */
-        public TestPage()
+               public TestPage()
                {
                        WebComponent component;
                        component = new WebComponent("component");
@@ -157,7 +152,7 @@ class PageIdPoliticTest
                 * @param encoding
                 * @return ajaxUrl
                 */
-               Url getAjaxUrl(String encoding)
+               public Url getAjaxUrl(String encoding)
                {
                        return 
Url.parse(eventBehavior.getCallbackUrl().toString(), Charset.forName(encoding));
                }

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/request/handler/PageProviderTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/request/handler/PageProviderTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/request/handler/PageProviderTest.java
index b7ad145..b5c2aef 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/request/handler/PageProviderTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/request/handler/PageProviderTest.java
@@ -65,8 +65,8 @@ class PageProviderTest extends WicketTestCase
 
                // storing test page
                TestMapperContext mapperContext = new TestMapperContext();
-               mapperContext.getPageManager().touchPage(testPage);
-               mapperContext.getPageManager().commitRequest();
+               mapperContext.getPageManager().addPage(testPage);
+               mapperContext.getPageManager().detach();
 
                // by cleaning session cache we make sure of not being testing 
the same in-memory instance
                mapperContext.cleanSessionCache();
@@ -80,8 +80,8 @@ class PageProviderTest extends WicketTestCase
                // changing some sate
                StatefullMockPage providedPage = 
(StatefullMockPage)pageProvider.getPageInstance();
                providedPage.state = newState;
-               mapperContext.getPageManager().touchPage(providedPage);
-               mapperContext.getPageManager().commitRequest();
+               mapperContext.getPageManager().addPage(providedPage);
+               mapperContext.getPageManager().detach();
 
 
                mapperContext.cleanSessionCache();
@@ -215,8 +215,8 @@ class PageProviderTest extends WicketTestCase
        {
                TestMapperContext mapperContext = new TestMapperContext();
                Page page = new TestPage();
-               mapperContext.getPageManager().touchPage(page);
-               mapperContext.getPageManager().commitRequest();
+               mapperContext.getPageManager().addPage(page);
+               mapperContext.getPageManager().detach();
 
                // by cleaning session cache we make sure of not being testing 
the same in-memory instance
                mapperContext.cleanSessionCache();
@@ -238,8 +238,8 @@ class PageProviderTest extends WicketTestCase
        {
                TestMapperContext mapperContext = new TestMapperContext();
                Page page = new TestPage();
-               mapperContext.getPageManager().touchPage(page);
-               mapperContext.getPageManager().commitRequest();
+               mapperContext.getPageManager().addPage(page);
+               mapperContext.getPageManager().detach();
 
                // by cleaning session cache we make sure of not being testing 
the same in-memory instance
                mapperContext.cleanSessionCache();
@@ -255,8 +255,8 @@ class PageProviderTest extends WicketTestCase
        {
                TestMapperContext mapperContext = new TestMapperContext();
                Page page = new TestPage();
-               mapperContext.getPageManager().touchPage(page);
-               mapperContext.getPageManager().commitRequest();
+               mapperContext.getPageManager().addPage(page);
+               mapperContext.getPageManager().detach();
 
                PageProvider pageProvider = new PageProvider(page.getPageId(), 
page.getRenderCount());
                JavaSerializer javaSerializer = new JavaSerializer("app");

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/versioning/InMemoryPageStore.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/versioning/InMemoryPageStore.java 
b/wicket-core/src/test/java/org/apache/wicket/versioning/InMemoryPageStore.java
deleted file mode 100644
index f69a918..0000000
--- 
a/wicket-core/src/test/java/org/apache/wicket/versioning/InMemoryPageStore.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.versioning;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.wicket.pageStore.IDataStore;
-
-/**
- * An implementation of {@link IDataStore} that stores the data in memory. 
Used only for testing
- * purposes.
- * 
- * @author martin-g
- */
-public class InMemoryPageStore implements IDataStore
-{
-
-       /**
-        * A map of : sessionId => pageId => pageAsBytes
-        */
-       private final ConcurrentHashMap<String, Map<Integer, byte[]>> store;
-
-       /**
-        * Construct.
-        */
-       public InMemoryPageStore()
-       {
-               store = new ConcurrentHashMap<> ();
-       }
-
-       @Override
-       public void destroy()
-       {
-               store.clear();
-       }
-
-       /**
-        * @see 
org.apache.wicket.pageStore.IDataStore#getData(java.lang.String, int)
-        */
-       @Override
-       public byte[] getData(String sessionId, int pageId)
-       {
-               byte[] pageAsBytes = null;
-
-               final Map<Integer, byte[]> sessionPages = store.get(sessionId);
-               if (sessionPages != null)
-               {
-                       pageAsBytes = sessionPages.get(pageId);
-               }
-
-               return pageAsBytes;
-       }
-
-       /**
-        * @see 
org.apache.wicket.pageStore.IDataStore#removeData(java.lang.String, int)
-        */
-       @Override
-       public void removeData(String sessionId, int pageId)
-       {
-               final Map<Integer, byte[]> sessionPages = store.get(sessionId);
-               if (sessionPages != null)
-               {
-                       sessionPages.remove(pageId);
-               }
-       }
-
-       /**
-        * @see 
org.apache.wicket.pageStore.IDataStore#removeData(java.lang.String)
-        */
-       @Override
-       public void removeData(String sessionId)
-       {
-               store.remove(sessionId);
-       }
-
-       /**
-        * @see 
org.apache.wicket.pageStore.IDataStore#storeData(java.lang.String, int, byte[])
-        */
-       @Override
-       public void storeData(String sessionId, int pageId, byte[] pageAsBytes)
-       {
-               Map<Integer, byte[]> sessionPages = store.get(sessionId);
-               if (sessionPages == null)
-               {
-                       sessionPages = new ConcurrentHashMap<>();
-                       Map<Integer, byte[]> tmpSessionPages = 
store.putIfAbsent(sessionId, sessionPages);
-                       if (tmpSessionPages != null)
-                       {
-                               sessionPages = tmpSessionPages;
-                       }
-               }
-
-               sessionPages.put(pageId, pageAsBytes);
-       }
-
-       /**
-        * @see org.apache.wicket.pageStore.IDataStore#isReplicated()
-        */
-       @Override
-       public boolean isReplicated()
-       {
-               return false;
-       }
-
-       @Override
-       public boolean canBeAsynchronous()
-       {
-               return false;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java
index 6f10ada..3842780 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/versioning/PageVersioningTest.java
@@ -22,11 +22,11 @@ import static 
org.junit.jupiter.api.Assertions.assertNotNull;
 import org.apache.wicket.IPageManagerProvider;
 import org.apache.wicket.Page;
 import org.apache.wicket.page.IPageManager;
-import org.apache.wicket.page.IPageManagerContext;
-import org.apache.wicket.page.PageStoreManager;
-import org.apache.wicket.pageStore.AsynchronousDataStore;
-import org.apache.wicket.pageStore.DefaultPageStore;
-import org.apache.wicket.pageStore.IDataStore;
+import org.apache.wicket.page.PageManager;
+import org.apache.wicket.pageStore.IPageStore;
+import org.apache.wicket.pageStore.InMemoryPageStore;
+import org.apache.wicket.pageStore.InSessionPageStore;
+import org.apache.wicket.pageStore.SerializingPageStore;
 import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.serialize.java.JavaSerializer;
 import org.apache.wicket.util.tester.WicketTester;
@@ -58,21 +58,12 @@ class PageVersioningTest
                        @Override
                        protected IPageManagerProvider 
newTestPageManagerProvider()
                        {
-                               return new IPageManagerProvider()
+                               return () ->
                                {
-
-                                       @Override
-                                       public IPageManager 
apply(IPageManagerContext pageManagerContext)
-                                       {
-
-                                               final IDataStore dataStore = 
new InMemoryPageStore();
-                                               final AsynchronousDataStore 
asyncDS = new AsynchronousDataStore(dataStore,
-                                                       100);
-                                               final DefaultPageStore 
pageStore = new DefaultPageStore(new JavaSerializer(
-                                                       
application.getApplicationKey()), asyncDS, 40);
-                                               return new 
PageStoreManager(application.getName(), pageStore,
-                                                       pageManagerContext);
-                                       }
+                                       InMemoryPageStore inMemory = new 
InMemoryPageStore("test", Integer.MAX_VALUE);
+                                       SerializingPageStore serializing = new 
SerializingPageStore(inMemory, new JavaSerializer("test"));
+                                       final IPageStore store = new 
InSessionPageStore(serializing, Integer.MAX_VALUE);
+                                       return new PageManager(store);
                                };
                        }
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBarInitializer.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBarInitializer.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBarInitializer.java
index ae17d8e..2fcdca3 100644
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBarInitializer.java
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBarInitializer.java
@@ -38,7 +38,7 @@ public class DebugBarInitializer implements IInitializer
                        
DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, 
application);
                        
DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, 
application);
                        
DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, 
application);
-                       
DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, application);
+                       
DebugBar.registerContributor(PageStoreDebugPanel.DEBUG_BAR_CONTRIB, 
application);
                }
        }
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/InspectorDebugPanel.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/InspectorDebugPanel.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/InspectorDebugPanel.java
index 33a0705..4de5cd4 100644
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/InspectorDebugPanel.java
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/InspectorDebugPanel.java
@@ -18,12 +18,13 @@ package org.apache.wicket.devutils.debugbar;
 
 import org.apache.wicket.Component;
 import org.apache.wicket.Page;
+import org.apache.wicket.core.util.lang.WicketObjects;
 import org.apache.wicket.devutils.inspector.InspectorPage;
 import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.PackageResourceReference;
 import org.apache.wicket.request.resource.ResourceReference;
+import org.apache.wicket.util.lang.Bytes;
 
 /**
  * A panel that adds a link to the inspector to the debug bar.
@@ -73,7 +74,22 @@ public class InspectorDebugPanel extends StandardDebugPanel
        @Override
        protected IModel<String> getDataModel()
        {
-               return new Model<>("Inspector");
+               return new IModel<String>()
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       public String getObject()
+                       {
+                               Page enclosingPage = getPage();
+                               long pageSize = 
WicketObjects.sizeof(enclosingPage);
+                               Bytes pageSizeInBytes = (pageSize > -1 ? 
Bytes.bytes(pageSize) : null);
+                               String pageSizeAsString = pageSizeInBytes != 
null ? pageSizeInBytes.toString()
+                                       : "unknown";
+
+                               return "Page: " + pageSizeAsString;
+                       }
+               };
        }
 
        @Override

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageSizeDebugPanel.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageSizeDebugPanel.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageSizeDebugPanel.java
deleted file mode 100644
index f386783..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageSizeDebugPanel.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.debugbar;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.core.util.lang.WicketObjects;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-import org.apache.wicket.util.lang.Bytes;
-
-/**
- * A panel for the debug bar that shows the size of the currently shown page.
- * <p>
- * <strong>Note</strong>: this size includes the size of the debug bar itself 
too!
- */
-public class PageSizeDebugPanel extends StandardDebugPanel
-{
-       private static final long serialVersionUID = 1L;
-
-       /** */
-       public static final IDebugBarContributor DEBUG_BAR_CONTRIB = new 
IDebugBarContributor()
-       {
-               private static final long serialVersionUID = 1L;
-
-               @Override
-               public Component createComponent(final String id, final 
DebugBar debugBar)
-               {
-                       return new PageSizeDebugPanel(id);
-               }
-
-       };
-
-       /**
-        * Construct.
-        * 
-        * @param id
-        */
-       public PageSizeDebugPanel(final String id)
-       {
-               super(id);
-       }
-
-       @Override
-       protected Class<? extends Page> getLinkPageClass()
-       {
-               // not used
-               return WebPage.class;
-       }
-
-       // Disable the link because there is no page with more detailed 
information
-       @Override
-       protected BookmarkablePageLink<Void> createLink(final String id)
-       {
-               BookmarkablePageLink<Void> bookmarkablePageLink = 
super.createLink(id);
-               bookmarkablePageLink.setEnabled(false);
-               return bookmarkablePageLink;
-       }
-
-       @Override
-       protected ResourceReference getImageResourceReference()
-       {
-               // TODO: need better image for this:
-               return new 
PackageResourceReference(SessionSizeDebugPanel.class, "harddrive.png");
-       }
-
-       @Override
-       protected IModel<String> getDataModel()
-       {
-               return new IModel<String>()
-               {
-                       private static final long serialVersionUID = 1L;
-
-                       @Override
-                       public String getObject()
-                       {
-                               Page enclosingPage = getPage();
-                               long pageSize = 
WicketObjects.sizeof(enclosingPage);
-                               Bytes pageSizeInBytes = (pageSize > -1 ? 
Bytes.bytes(pageSize) : null);
-                               String pageSizeAsString = pageSizeInBytes != 
null ? pageSizeInBytes.toString()
-                                       : "unknown";
-
-                               return "Page: " + pageSizeAsString;
-                       }
-               };
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageStoreDebugPanel.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageStoreDebugPanel.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageStoreDebugPanel.java
new file mode 100644
index 0000000..9cc5a06
--- /dev/null
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/PageStoreDebugPanel.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.devutils.debugbar;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.devutils.diskstore.PageStorePage;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.pageStore.IPersistentPageStore;
+import org.apache.wicket.request.resource.PackageResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+
+/**
+ * A panel that adds a link to persisted pages to the debug bar.
+ */
+public class PageStoreDebugPanel extends StandardDebugPanel
+{
+       private static final long serialVersionUID = 1L;
+
+       /** */
+       public static final IDebugBarContributor DEBUG_BAR_CONTRIB = new 
IDebugBarContributor()
+       {
+               private static final long serialVersionUID = 1L;
+
+               @Override
+               public Component createComponent(final String id, final 
DebugBar debugBar)
+               {
+                       return new PageStoreDebugPanel(id);
+               }
+       };
+
+       /**
+        * Construct.
+        * 
+        * @param id
+        *          The component id
+        */
+       public PageStoreDebugPanel(final String id)
+       {
+               super(id);
+       }
+
+       @Override
+       protected Class<? extends Page> getLinkPageClass()
+       {
+               return PageStorePage.class;
+       }
+
+       @Override
+       protected ResourceReference getImageResourceReference()
+       {
+               return new PackageResourceReference(PageStoreDebugPanel.class, 
"harddrive.png");
+       }
+
+       @Override
+       protected IModel<String> getDataModel()
+       {
+               return new IModel<String>()
+               {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       public String getObject()
+                       {
+                               IPersistentPageStore store = 
PageStorePage.getPersistentPageStore();
+                               return String.format("Persisted pages: %s", 
store == null ? "N/A" : store.getTotalSize());
+                       }
+               };
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/StandardDebugPanel.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/StandardDebugPanel.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/StandardDebugPanel.java
index c88499e..921b009 100644
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/StandardDebugPanel.java
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/StandardDebugPanel.java
@@ -50,7 +50,7 @@ public abstract class StandardDebugPanel extends DevUtilsPanel
        protected void onInitialize()
        {
                super.onInitialize();
-               BookmarkablePageLink<Void> link = createLink("link");
+               WebMarkupContainer link = createLink("link");
                add(link);
                ResourceReference img = getImageResourceReference();
                if (img == null)
@@ -64,7 +64,7 @@ public abstract class StandardDebugPanel extends DevUtilsPanel
                link.add(new Label("data", getDataModel()));
        }
 
-       protected BookmarkablePageLink<Void> createLink(final String id)
+       protected WebMarkupContainer createLink(final String id)
        {
                return new BookmarkablePageLink<>(id, getLinkPageClass(), 
getLinkPageParameters());
        }

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugDiskDataStore.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugDiskDataStore.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugDiskDataStore.java
deleted file mode 100644
index 9c3d882..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugDiskDataStore.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.pageStore.DiskDataStore;
-import org.apache.wicket.pageStore.PageWindowManager;
-import org.apache.wicket.pageStore.PageWindowManager.PageWindow;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.util.lang.Bytes;
-
-/**
- * An extension of {@link DiskDataStore} that is able to browse the content of 
the file storage.
- * <p>
- * To enable it add in YourApplication#init():
- * 
- * <pre>
- * <code>
- * DebugDiskDataStore.register(this);
- * </code>
- * </pre>
- * 
- * </p>
- * <p>
- * The data can be browsed at: <em>/wicket/internal/debug/diskDataStore</em>
- */
-public class DebugDiskDataStore extends DiskDataStore
-{
-
-       /**
-        * Construct.
-        * 
-        * @param applicationName
-        * @param fileStoreFolder
-        * @param maxSizePerSession
-        */
-       public DebugDiskDataStore(String applicationName, File fileStoreFolder, 
Bytes maxSizePerSession)
-       {
-               super(applicationName, fileStoreFolder, maxSizePerSession);
-
-       }
-
-       /**
-        * 
-        * @param sessionId
-        * @param count
-        * @return a list of the last N page windows
-        */
-       public List<PageWindow> getLastPageWindows(String sessionId, int count)
-       {
-               List<PageWindow> pageWindows = new ArrayList<>();
-
-               SessionEntry sessionEntry = getSessionEntry(sessionId, false);
-               if (sessionEntry != null)
-               {
-                       PageWindowManager windowManager = 
sessionEntry.getManager();
-                       
pageWindows.addAll(windowManager.getLastPageWindows(count));
-               }
-               return pageWindows;
-       }
-
-       @Override
-       public File getStoreFolder()
-       {
-               return super.getStoreFolder();
-       }
-
-       /**
-        * Configures the page manager provider and mounts the page at
-        * <em>wicket/internal/debug/diskDataStore</em>
-        * 
-        * @param application
-        */
-       public static void register(final Application application)
-       {
-               application.setPageManagerProvider(new 
DebugPageManagerProvider(application));
-
-               
((WebApplication)application).mountPage("wicket/internal/debug/diskDataStore",
-                       DiskStoreBrowserPage.class);
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
deleted file mode 100644
index 7893638..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore;
-
-import java.io.File;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.DefaultPageManagerProvider;
-import org.apache.wicket.pageStore.DiskDataStore;
-import org.apache.wicket.pageStore.IDataStore;
-import org.apache.wicket.settings.StoreSettings;
-import org.apache.wicket.util.lang.Bytes;
-
-/**
- */
-public class DebugPageManagerProvider extends DefaultPageManagerProvider
-{
-
-       private DebugDiskDataStore dataStore;
-
-       /**
-        * Construct.
-        * 
-        * @param application
-        */
-       public DebugPageManagerProvider(Application application)
-       {
-               super(application);
-       }
-
-       /**
-        * @return the extended with debug information {@link DiskDataStore}
-        */
-       public DebugDiskDataStore getDataStore()
-       {
-               return dataStore;
-       }
-
-       @Override
-       protected IDataStore newDataStore()
-       {
-               StoreSettings storeSettings = application.getStoreSettings();
-               File fileStoreFolder = storeSettings.getFileStoreFolder();
-               Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
-               dataStore = new DebugDiskDataStore(application.getName(), 
fileStoreFolder,
-                       maxSizePerSession);
-               return dataStore;
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.html
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.html
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.html
deleted file mode 100644
index 307884c..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
-       
-       <head>
-               <title>Debug DiskDataStore page</title>
-       </head>
-       
-       <body>
-
-        <div wicket:id="tree">default</div>    
- 
-       </body>
-       
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.java
deleted file mode 100644
index 066f9e6..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DiskStoreBrowserPage.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.devutils.diskstore.browser.BrowserPanel;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-/**
- * A page that shows the attributes (id, name, size) of the pages stored in 
the data stores.
- */
-public class DiskStoreBrowserPage extends WebPage
-{
-
-       /**
-        * Construct.
-        * 
-        * @param parameters
-        *            the request parameters
-        */
-       public DiskStoreBrowserPage(final PageParameters parameters)
-       {
-               super(parameters);
-
-               Component tree;
-// tree = new LabelTree("tree", new PageWindowModel(sessionId, dataStore));
-               tree = new BrowserPanel("tree");
-               add(tree);
-       }
-
-       @Override
-       public boolean isVersioned()
-       {
-               return false;
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.html
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.html
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.html
new file mode 100644
index 0000000..bf62ef7
--- /dev/null
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.html
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
+       
+       <head>
+               <title>Debug DiskDataStore page</title>
+       </head>
+       
+       <body>
+
+        <div wicket:id="persisted"></div>      
+ 
+       </body>
+       
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.java
new file mode 100644
index 0000000..6a0d6c7
--- /dev/null
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/PageStorePage.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.devutils.diskstore;
+
+import org.apache.wicket.Session;
+import org.apache.wicket.devutils.diskstore.browser.PersistedPanel;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.pageStore.DelegatingPageStore;
+import org.apache.wicket.pageStore.IPageStore;
+import org.apache.wicket.pageStore.IPersistentPageStore;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+/**
+ * A page that shows the attributes (id, name, size) of the pages stored in 
the data stores.
+ */
+public class PageStorePage extends WebPage
+{
+
+       /**
+        * Construct.
+        * 
+        * @param parameters
+        *            the request parameters
+        */
+       public PageStorePage(final PageParameters parameters)
+       {
+               super(parameters);
+
+               add(new PersistedPanel("persisted", 
PageStorePage::getPersistentPageStore));
+       }
+
+       @Override
+       public boolean isVersioned()
+       {
+               return false;
+       }
+       
+       public static IPersistentPageStore getPersistentPageStore() {
+               IPageStore store = 
Session.get().getPageManager().getPageStore();
+               while (true) {
+                       if (store instanceof IPersistentPageStore) {
+                               return (IPersistentPageStore)store;
+                       }
+                       
+                       if (store instanceof DelegatingPageStore) {
+                               store = 
((DelegatingPageStore)store).getDelegate();
+                       } else {
+                               break;
+                       }
+               }
+               
+               return null;
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.html
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.html
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.html
deleted file mode 100644
index aba3252..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
-<wicket:panel>
-
-    <h3>Active sessions</h3>
-    <select wicket:id="sessions"></select> <a wicket:id="currentSessionLink" 
title="Selects the current session">Current session</a>
-
-    <h3>Stored pages</h3> <a wicket:id="refresh" title="Refreshes the content 
of the table below">refresh</a>
-       <table wicket:id="table" border="1" cellpadding="3" 
cellspacing="1"></table>
-
-</wicket:panel>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.java
deleted file mode 100644
index 51cd5f7..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserPanel.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore.browser;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.util.time.Duration;
-
-/**
- * A panel that shows the data about pages in the data store
- */
-public class BrowserPanel extends Panel
-{
-
-       /**
-        * Construct.
-        * 
-        * @param id
-        *            the component id
-        */
-       public BrowserPanel(String id)
-       {
-               super(id);
-
-               final DropDownChoice<String> sessionsSelector = 
createSessionsSelector("sessions");
-               add(sessionsSelector);
-
-               final BrowserTable table = createTable("table", 
sessionsSelector.getModel());
-               add(table);
-
-               AjaxFallbackLink<Void> refreshLink = new 
AjaxFallbackLink<Void>("refresh")
-               {
-                       @Override
-                       public void onClick(Optional<AjaxRequestTarget> 
targetOptional)
-                       {
-                               targetOptional.ifPresent(target -> 
target.add(table));
-                       }
-               };
-               add(refreshLink);
-
-               AjaxFallbackLink<Void> currentSessionLink = new 
AjaxFallbackLink<Void>("currentSessionLink")
-               {
-                       @Override
-                       public void onClick(Optional<AjaxRequestTarget> 
targetOptional)
-                       {
-                               
sessionsSelector.setModelObject(getCurrentSession().getObject());
-                               targetOptional.ifPresent(target -> 
target.add(sessionsSelector, table));
-                       }
-
-                       @Override
-                       public boolean isVisible()
-                       {
-                               return 
BrowserPanel.this.getSession().isTemporary() == false;
-                       }
-               };
-               currentSessionLink.setOutputMarkupPlaceholderTag(true);
-               add(currentSessionLink);
-
-               sessionsSelector.add(new 
AjaxFormComponentUpdatingBehavior("change")
-               {
-                       @Override
-                       protected void onUpdate(AjaxRequestTarget target)
-                       {
-                               target.add(table);
-                       }
-               });
-       }
-
-       private DropDownChoice<String> createSessionsSelector(String id)
-       {
-               IModel<String> defaultSession = getCurrentSession();
-
-               DropDownChoice<String> sessionsSelector = new 
DropDownChoice<String>("sessions",
-                       defaultSession, new SessionsProviderModel());
-
-
-               return sessionsSelector;
-       }
-
-       private IModel<String> getCurrentSession()
-       {
-               return Model.of(getSession().getId());
-       }
-
-       private BrowserTable createTable(String id, IModel<String> sessionId)
-       {
-               PageWindowProvider provider = new PageWindowProvider(sessionId);
-
-               List<IColumn<PageWindowDescription, String>> columns = new 
ArrayList<>();
-
-               PageWindowColumn pageIdColumn = new 
PageWindowColumn(Model.of("Id"), "id");
-               columns.add(pageIdColumn);
-
-               PageWindowColumn pageNameColumn = new 
PageWindowColumn(Model.of("Name"), "name");
-               columns.add(pageNameColumn);
-
-               PageWindowColumn pageSizeColumn = new 
PageWindowColumn(Model.of("Size"), "size");
-               columns.add(pageSizeColumn);
-
-               BrowserTable browserTable = new BrowserTable(id, columns, 
provider);
-               browserTable.setOutputMarkupId(true);
-
-               browserTable.add(new 
AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
-
-               return browserTable;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserTable.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserTable.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserTable.java
deleted file mode 100644
index 264d88a..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/BrowserTable.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore.browser;
-
-import java.util.List;
-
-import 
org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-
-/**
- * A data table that shows the attributes of the recently stored pages in the 
data store. The last
- * used pages are rendered first.
- */
-class BrowserTable extends DefaultDataTable<PageWindowDescription, String>
-{
-
-       /**
-        * Construct.
-        * 
-        * @param id
-        *            the component id
-        * @param columns
-        *            the columns that show the page attributes
-        * @param provider
-        *            the provider of page descriptions
-        */
-       public BrowserTable(String id, List<IColumn<PageWindowDescription, 
String>> columns,
-               PageWindowProvider provider)
-       {
-               super(id, columns, provider, 20);
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/DataStoreHelper.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/DataStoreHelper.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/DataStoreHelper.java
deleted file mode 100644
index ff4bf67..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/DataStoreHelper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore.browser;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.devutils.diskstore.DebugDiskDataStore;
-import org.apache.wicket.devutils.diskstore.DebugPageManagerProvider;
-
-/**
- * A helper to work with {@link DebugDiskDataStore}
- */
-public final class DataStoreHelper
-{
-
-       private DataStoreHelper()
-       {
-       }
-
-       /**
-        * @return the configured {@link DebugDiskDataStore}
-        */
-       public static DebugDiskDataStore getDataStore()
-       {
-               DebugPageManagerProvider pageManagerProvider = 
(DebugPageManagerProvider)Application.get()
-                       .getPageManagerProvider();
-               DebugDiskDataStore dataStore = 
pageManagerProvider.getDataStore();
-               return dataStore;
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowColumn.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowColumn.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowColumn.java
deleted file mode 100644
index ea21877..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowColumn.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore.browser;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.devutils.diskstore.DebugDiskDataStore;
-import org.apache.wicket.devutils.diskstore.DebugPageManagerProvider;
-import 
org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import 
org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.serialize.ISerializer;
-
-/**
- * A column that shows the page attributes (id, name, size)
- */
-class PageWindowColumn extends PropertyColumn<PageWindowDescription, String>
-{
-       /**
-        * Construct.
-        * 
-        * @param displayModel
-        *            the header
-        * @param propertyExpression
-        *            the page attribute
-        */
-       public PageWindowColumn(IModel<String> displayModel, String 
propertyExpression)
-       {
-               super(displayModel, propertyExpression);
-       }
-
-       @Override
-       public void populateItem(Item<ICellPopulator<PageWindowDescription>> 
cellItem,
-               String componentId, IModel<PageWindowDescription> rowModel)
-       {
-               String label;
-               PageWindowDescription windowDescription = rowModel.getObject();
-               if ("name".equals(getPropertyExpression()))
-               {
-                       int pageId = windowDescription.getId();
-                       DebugPageManagerProvider pageManagerProvider = 
(DebugPageManagerProvider)Application.get()
-                               .getPageManagerProvider();
-                       DebugDiskDataStore dataStore = 
pageManagerProvider.getDataStore();
-                       String sessionId = windowDescription.getSessionId();
-                       byte[] data = dataStore.getData(sessionId, pageId);
-                       ISerializer serializer = 
Application.get().getFrameworkSettings().getSerializer();
-                       Object page = serializer.deserialize(data);
-                       label = page.getClass().getName();
-               }
-               else if ("id".equals(getPropertyExpression()))
-               {
-                       label = Integer.toString(windowDescription.getId());
-               }
-               else if ("size".equals(getPropertyExpression()))
-               {
-                       label = Integer.toString(windowDescription.getSize());
-               }
-               else
-               {
-                       label = "unknown: " + getPropertyExpression();
-               }
-
-               cellItem.add(new Label(componentId, label));
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowDescription.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowDescription.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowDescription.java
deleted file mode 100644
index b07c005..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowDescription.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore.browser;
-
-import org.apache.wicket.pageStore.PageWindowManager.PageWindow;
-import org.apache.wicket.util.io.IClusterable;
-
-/**
- * A serializable representation of the page information
- */
-class PageWindowDescription implements IClusterable
-{
-       /** the page id */
-       private final int id;
-
-       /** the page size */
-       private final int size;
-
-       /** the id of the session for which this page has been used */
-       private final String sessionId;
-
-       PageWindowDescription(PageWindow pageWindow, String sessionId)
-       {
-               id = pageWindow.getPageId();
-               size = pageWindow.getFilePartSize();
-               this.sessionId = sessionId;
-       }
-
-       public String getSessionId()
-       {
-               return sessionId;
-       }
-
-       public int getId()
-       {
-               return id;
-       }
-
-       public int getSize()
-       {
-               return size;
-       }
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowProvider.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowProvider.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowProvider.java
deleted file mode 100644
index dd8397c..0000000
--- 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PageWindowProvider.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.devutils.diskstore.browser;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.wicket.devutils.diskstore.DebugDiskDataStore;
-import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState;
-import 
org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
-import org.apache.wicket.markup.repeater.data.IDataProvider;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.pageStore.PageWindowManager.PageWindow;
-
-/**
- * An {@link IDataProvider} that extracts the information about the stored 
pages
- */
-class PageWindowProvider implements 
ISortableDataProvider<PageWindowDescription, String>
-{
-       private static final int MAX_PAGES_TO_READ = 1000;
-
-       /**
-        * The model that brings the currently selected session id
-        */
-       private final IModel<String> sessionId;
-
-       PageWindowProvider(final IModel<String> sessionId)
-       {
-               this.sessionId = sessionId;
-       }
-
-       @Override
-       public Iterator<? extends PageWindowDescription> iterator(long first, 
long count)
-       {
-               List<PageWindow> lastPageWindows = getPageWindows();
-               List<PageWindow> subList = lastPageWindows.subList((int)first, 
(int)(first + count));
-               List<PageWindowDescription> pageDescriptions = new 
ArrayList<>();
-               for (PageWindow pw : subList)
-               {
-                       pageDescriptions.add(new PageWindowDescription(pw, 
sessionId.getObject()));
-               }
-
-               return pageDescriptions.iterator();
-       }
-
-       private List<PageWindow> getPageWindows()
-       {
-               List<PageWindow> lastPageWindows = new ArrayList<>();
-               if (sessionId != null && sessionId.getObject() != null)
-               {
-                       String sessId = sessionId.getObject();
-                       DebugDiskDataStore dataStore = 
DataStoreHelper.getDataStore();
-                       List<PageWindow> pageWindows = 
dataStore.getLastPageWindows(sessId, MAX_PAGES_TO_READ);
-                       lastPageWindows.addAll(pageWindows);
-               }
-               return lastPageWindows;
-       }
-
-       @Override
-       public long size()
-       {
-               return getPageWindows().size();
-       }
-
-       /**
-        * @param description
-        * 
-        *            {@inheritDoc}
-        */
-       @Override
-       public IModel<PageWindowDescription> model(PageWindowDescription 
description)
-       {
-               return new Model<>(description);
-       }
-
-       @Override
-       public void detach()
-       {
-               sessionId.detach();
-       }
-
-       /*
-        * No sort state for now. The provider is ISortableDataProvider just 
because we use
-        * DefaultDataTable
-        */
-       @Override
-       public ISortState<String> getSortState()
-       {
-               return null;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPagesProvider.java
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPagesProvider.java
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPagesProvider.java
new file mode 100644
index 0000000..62abfaf
--- /dev/null
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPagesProvider.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.devutils.diskstore.browser;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.wicket.core.util.lang.PropertyResolver;
+import 
org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.markup.repeater.data.IDataProvider;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.pageStore.IPersistedPage;
+import org.apache.wicket.pageStore.IPersistentPageStore;
+import org.apache.wicket.util.lang.Objects;
+
+/**
+ * An {@link IDataProvider} that extracts the information about {@link 
IPersistedPage}s.
+ */
+class PersistedPagesProvider extends SortableDataProvider<IPersistedPage, 
String>
+{
+       /**
+        * The model that brings the currently selected session id
+        */
+       private final IModel<String> sessionId;
+
+       private final IModel<IPersistentPageStore> store;
+
+       private List<IPersistedPage> pages;
+
+       PersistedPagesProvider(final IModel<String> sessionId, 
IModel<IPersistentPageStore> store)
+       {
+               this.sessionId = sessionId;
+               this.store = store;
+       }
+
+       @Override
+       public Iterator<? extends IPersistedPage> iterator(long first, long 
count)
+       {
+               List<IPersistedPage> pages = getPages();
+
+               if (getSort() != null) {
+                       Collections.sort(pages, new SortComparator());
+               }
+
+               return pages.iterator();
+       }
+
+       private List<IPersistedPage> getPages()
+       {
+               if (pages == null)
+               {
+                       pages = new ArrayList<>();
+
+                       if (sessionId.getObject() != null)
+                       {
+                               String sessId = sessionId.getObject();
+
+                               IPersistentPageStore persistentPagesStore = 
store.getObject();
+
+                               if (persistentPagesStore != null)
+                               {
+                                       
pages.addAll(persistentPagesStore.getPersistentPages(sessId));
+                               }
+                       }
+               }
+
+               return pages;
+       }
+
+       @Override
+       public long size()
+       {
+               return getPages().size();
+       }
+
+       /**
+        * @param description
+        * 
+        *            {@inheritDoc}
+        */
+       @Override
+       public IModel<IPersistedPage> model(IPersistedPage description)
+       {
+               return new Model<>(description);
+       }
+
+       @Override
+       public void detach()
+       {
+               sessionId.detach();
+               store.detach();
+
+               pages = null;
+       }
+
+       private class SortComparator implements Comparator<IPersistedPage>
+       {
+
+               @Override
+               public int compare(IPersistedPage page0, IPersistedPage page1)
+               {
+                       Object value0 = 
PropertyResolver.getValue(getSort().getProperty(), page0);
+                       Object value1 = 
PropertyResolver.getValue(getSort().getProperty(), page1);
+
+                       int c = Objects.compareWithConversion(value0, value1);
+
+                       if (getSort().isAscending() == false)
+                       {
+                               c = c * -1;
+                       }
+
+                       return c;
+               }
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/c43d3a33/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPanel.html
----------------------------------------------------------------------
diff --git 
a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPanel.html
 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPanel.html
new file mode 100644
index 0000000..c4ac731
--- /dev/null
+++ 
b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/browser/PersistedPanel.html
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:wicket="http://wicket.apache.org";>
+<wicket:panel>
+
+    <h3>Persistent store</h3>
+    <span wicket:id="store"></span>
+    
+    <h3>Persisted sessions</h3>
+    <select wicket:id="sessions"></select> <a wicket:id="currentSessionLink" 
title="Selects the current session">Current session</a>
+
+    <h3>Persisted pages</h3> <a wicket:id="refresh" title="Refreshes the 
content of the table below">refresh</a>
+       <table wicket:id="table"></table>
+
+</wicket:panel>
+</html>
\ No newline at end of file

Reply via email to