001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.pageStore;
018
019import java.util.List;
020import java.util.Set;
021
022import org.apache.wicket.util.lang.Bytes;
023
024/**
025 * A store that can provide information about stored pages.
026 * <p>
027 * This is an optional interface to a store that is not involved during normal page processing.
028 * Rather, it is used for analysis of application memory footprint.
029 */
030public interface IPersistentPageStore extends IPageStore
031{
032
033        /**
034         * Get the session identifier for pages stored for the given context.
035         * 
036         * @param context
037         *            a context of pages
038         * @return the identifier of the session.
039         * 
040         * @see #getPersistedPages(String)
041         */
042        String getSessionIdentifier(IPageContext context);
043
044        /**
045         * Get the identifiers for all stored sessions.
046         * 
047         * @return the identifiers of all session.
048         */
049        Set<String> getSessionIdentifiers();
050
051        /**
052         * Get information about all persisted pages with the given session identifier.
053         * 
054         * @param sessionIdentifier
055         *            identifier of the session.
056         * @return all persisted pages
057         */
058        List<IPersistedPage> getPersistedPages(String sessionIdentifier);
059
060        /**
061         * Get total size of all pages stored in all contexts.
062         * <p>
063         * Optional operation, may return <code>null</code>.
064         * 
065         * @return total size or <code>null</code>
066         */
067        Bytes getTotalSize();
068}