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 org.apache.wicket.page.IManageablePage;
020import org.apache.wicket.util.lang.Args;
021
022/**
023 * An {@link IPageStore} that delegates to another storage.
024 */
025public abstract class DelegatingPageStore implements IPageStore
026{
027        private final IPageStore delegate;
028        
029        protected DelegatingPageStore(IPageStore delegate)
030        {
031                this.delegate = Args.notNull(delegate, "delegate");
032        }
033
034        public IPageStore getDelegate()
035        {
036                return delegate;
037        }
038        
039        /**
040         * Versioning is supported depending on the delegate.
041         */
042        @Override
043        public boolean supportsVersioning()
044        {
045                return delegate.supportsVersioning();
046        }
047        
048        @Override
049        public void addPage(IPageContext context, IManageablePage page)
050        {
051                delegate.addPage(context, page);
052        }
053
054        @Override
055        public void removePage(IPageContext context, IManageablePage page)
056        {
057                delegate.removePage(context, page);
058        }
059
060        @Override
061        public void removeAllPages(IPageContext context)
062        {
063                delegate.removeAllPages(context);
064        }
065        
066        @Override
067        public IManageablePage getPage(IPageContext context, int id)
068        {
069                return delegate.getPage(context, id);
070        }
071
072        @Override
073        public void revertPage(IPageContext context, IManageablePage page)
074        {
075                delegate.revertPage(context, page);
076        }
077        
078        @Override
079        public void end(IPageContext context)
080        {
081                delegate.end(context);
082        }
083        
084        @Override
085        public void detach(IPageContext context)
086        {
087                delegate.detach(context);
088        }
089
090        @Override
091        public void destroy()
092        {
093                delegate.destroy();
094        }
095}