Search in sources :

Example 1 with DebugDiskDataStore

use of org.apache.wicket.devutils.diskstore.DebugDiskDataStore in project wicket by apache.

the class DataStoreHelper method getDataStore.

/**
 * @return the configured {@link DebugDiskDataStore}
 */
public static DebugDiskDataStore getDataStore() {
    DebugPageManagerProvider pageManagerProvider = (DebugPageManagerProvider) Application.get().getPageManagerProvider();
    DebugDiskDataStore dataStore = pageManagerProvider.getDataStore();
    return dataStore;
}
Also used : DebugPageManagerProvider(org.apache.wicket.devutils.diskstore.DebugPageManagerProvider) DebugDiskDataStore(org.apache.wicket.devutils.diskstore.DebugDiskDataStore)

Example 2 with DebugDiskDataStore

use of org.apache.wicket.devutils.diskstore.DebugDiskDataStore in project wicket by apache.

the class PageWindowColumn method populateItem.

@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));
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) DebugPageManagerProvider(org.apache.wicket.devutils.diskstore.DebugPageManagerProvider) DebugDiskDataStore(org.apache.wicket.devutils.diskstore.DebugDiskDataStore) ISerializer(org.apache.wicket.serialize.ISerializer)

Example 3 with DebugDiskDataStore

use of org.apache.wicket.devutils.diskstore.DebugDiskDataStore in project wicket by apache.

the class PageWindowProvider method getPageWindows.

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;
}
Also used : ArrayList(java.util.ArrayList) PageWindow(org.apache.wicket.pageStore.PageWindowManager.PageWindow) DebugDiskDataStore(org.apache.wicket.devutils.diskstore.DebugDiskDataStore)

Example 4 with DebugDiskDataStore

use of org.apache.wicket.devutils.diskstore.DebugDiskDataStore in project wicket by apache.

the class SessionsProviderModel method load.

@Override
protected List<String> load() {
    List<String> sessionIds = new ArrayList<>();
    if (Application.exists()) {
        DebugDiskDataStore dataStore = DataStoreHelper.getDataStore();
        File appStoreFolder = dataStore.getStoreFolder();
        if (appStoreFolder.isDirectory()) {
            String[] sessionIdFileNames = appStoreFolder.list();
            if (sessionIdFileNames != null) {
                for (String sessionId : sessionIdFileNames) {
                    sessionIds.add(sessionId);
                }
            }
        }
    }
    return sessionIds;
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) DebugDiskDataStore(org.apache.wicket.devutils.diskstore.DebugDiskDataStore)

Aggregations

DebugDiskDataStore (org.apache.wicket.devutils.diskstore.DebugDiskDataStore)4 ArrayList (java.util.ArrayList)2 DebugPageManagerProvider (org.apache.wicket.devutils.diskstore.DebugPageManagerProvider)2 File (java.io.File)1 Label (org.apache.wicket.markup.html.basic.Label)1 PageWindow (org.apache.wicket.pageStore.PageWindowManager.PageWindow)1 ISerializer (org.apache.wicket.serialize.ISerializer)1