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;
}
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));
}
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;
}
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;
}
Aggregations