Search in sources :

Example 1 with IPageStore

use of org.apache.wicket.pageStore.IPageStore in project wicket by apache.

the class TestApp1 method init.

@Override
protected void init() {
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
    setPageManagerProvider(new DefaultPageManagerProvider(this) {

        @Override
        public IPageManager get(IPageManagerContext pageManagerContext) {
            IDataStore dataStore = new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(100));
            IPageStore pageStore = new DefaultPageStore(new JavaSerializer(getApplicationKey()), dataStore, getStoreSettings().getInmemoryCacheSize());
            return new PageStoreManager(getName(), pageStore, pageManagerContext);
        }
    });
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) PageStoreManager(org.apache.wicket.page.PageStoreManager) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) HttpSessionDataStore(org.apache.wicket.pageStore.memory.HttpSessionDataStore) PageNumberEvictionStrategy(org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) DefaultPageManagerProvider(org.apache.wicket.DefaultPageManagerProvider) IDataStore(org.apache.wicket.pageStore.IDataStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore)

Example 2 with IPageStore

use of org.apache.wicket.pageStore.IPageStore in project wicket by apache.

the class DefaultPageManagerProvider method apply.

@Override
public IPageManager apply(IPageManagerContext pageManagerContext) {
    IDataStore dataStore = newDataStore();
    StoreSettings storeSettings = getStoreSettings();
    IPageStore pageStore;
    if (dataStore.canBeAsynchronous() && storeSettings.isAsynchronous()) {
        int capacity = storeSettings.getAsynchronousQueueCapacity();
        dataStore = new AsynchronousDataStore(dataStore, capacity);
        pageStore = newPageStore(dataStore);
        if (pageStore.canBeAsynchronous()) {
            pageStore = new AsynchronousPageStore(pageStore, capacity);
        }
    } else {
        pageStore = newPageStore(dataStore);
    }
    return new PageStoreManager(application.getName(), pageStore, pageManagerContext);
}
Also used : StoreSettings(org.apache.wicket.settings.StoreSettings) IPageStore(org.apache.wicket.pageStore.IPageStore) PageStoreManager(org.apache.wicket.page.PageStoreManager) AsynchronousDataStore(org.apache.wicket.pageStore.AsynchronousDataStore) AsynchronousPageStore(org.apache.wicket.pageStore.AsynchronousPageStore) IDataStore(org.apache.wicket.pageStore.IDataStore)

Example 3 with IPageStore

use of org.apache.wicket.pageStore.IPageStore in project wicket by apache.

the class PersistentPageManagerTest method newPersistentPageManager.

private PageStoreManager newPersistentPageManager(String appName) {
    IDataStore dataStore = new InMemoryPageStore();
    IPageStore pageStore = new DefaultPageStore(new JavaSerializer(appName), dataStore, 4);
    IPageManagerContext pageManagerContext = new DummyPageManagerContext();
    return new PageStoreManager(appName, pageStore, pageManagerContext);
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) DummyPageManagerContext(org.apache.wicket.pageStore.memory.DummyPageManagerContext) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IDataStore(org.apache.wicket.pageStore.IDataStore) InMemoryPageStore(org.apache.wicket.versioning.InMemoryPageStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore)

Example 4 with IPageStore

use of org.apache.wicket.pageStore.IPageStore in project wicket by apache.

the class TestApp2 method init.

@Override
protected void init() {
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
    setPageManagerProvider(new DefaultPageManagerProvider(this) {

        @Override
        public IPageManager get(IPageManagerContext pageManagerContext) {
            IDataStore dataStore = new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(100));
            IPageStore pageStore = new DefaultPageStore(new JavaSerializer(getApplicationKey()), dataStore, getStoreSettings().getInmemoryCacheSize());
            return new PageStoreManager(getName(), pageStore, pageManagerContext);
        }
    });
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) PageStoreManager(org.apache.wicket.page.PageStoreManager) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) HttpSessionDataStore(org.apache.wicket.pageStore.memory.HttpSessionDataStore) PageNumberEvictionStrategy(org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) DefaultPageManagerProvider(org.apache.wicket.DefaultPageManagerProvider) IDataStore(org.apache.wicket.pageStore.IDataStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore)

Example 5 with IPageStore

use of org.apache.wicket.pageStore.IPageStore in project wicket by apache.

the class PageIdPoliticTest method setUp.

@Before
public void setUp() throws Exception {
    application = new MockApplication();
    dataStore = new InMemoryPageStore() {

        @Override
        public void storeData(String sessionId, int pageId, byte[] pageAsBytes) {
            super.storeData(sessionId, pageId, pageAsBytes);
            storeCount++;
        }
    };
    tester = new WicketTester(application) {

        @Override
        protected IPageManagerProvider newTestPageManagerProvider() {
            return new IPageManagerProvider() {

                @Override
                public IPageManager apply(IPageManagerContext pageManagerContext) {
                    IPageStore pageStore = new DefaultPageStore(new JavaSerializer(application.getApplicationKey()), dataStore, 4);
                    return new PageStoreManager(application.getName(), pageStore, pageManagerContext);
                }
            };
        }
    };
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) MockApplication(org.apache.wicket.mock.MockApplication) IPageManagerProvider(org.apache.wicket.IPageManagerProvider) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore) PageStoreManager(org.apache.wicket.page.PageStoreManager) WicketTester(org.apache.wicket.util.tester.WicketTester) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) InMemoryPageStore(org.apache.wicket.versioning.InMemoryPageStore) Before(org.junit.Before)

Aggregations

IPageStore (org.apache.wicket.pageStore.IPageStore)5 PageStoreManager (org.apache.wicket.page.PageStoreManager)4 DefaultPageStore (org.apache.wicket.pageStore.DefaultPageStore)4 IDataStore (org.apache.wicket.pageStore.IDataStore)4 JavaSerializer (org.apache.wicket.serialize.java.JavaSerializer)4 IPageManager (org.apache.wicket.page.IPageManager)3 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)3 DefaultPageManagerProvider (org.apache.wicket.DefaultPageManagerProvider)2 DefaultButtonImageResource (org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource)2 HttpSessionDataStore (org.apache.wicket.pageStore.memory.HttpSessionDataStore)2 PageNumberEvictionStrategy (org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy)2 InMemoryPageStore (org.apache.wicket.versioning.InMemoryPageStore)2 IPageManagerProvider (org.apache.wicket.IPageManagerProvider)1 MockApplication (org.apache.wicket.mock.MockApplication)1 AsynchronousDataStore (org.apache.wicket.pageStore.AsynchronousDataStore)1 AsynchronousPageStore (org.apache.wicket.pageStore.AsynchronousPageStore)1 DummyPageManagerContext (org.apache.wicket.pageStore.memory.DummyPageManagerContext)1 StoreSettings (org.apache.wicket.settings.StoreSettings)1 WicketTester (org.apache.wicket.util.tester.WicketTester)1 Before (org.junit.Before)1