001    /* 
002        Licensed to the Apache Software Foundation (ASF) under one
003        or more contributor license agreements.  See the NOTICE file
004        distributed with this work for additional information
005        regarding copyright ownership.  The ASF licenses this file
006        to you under the Apache License, Version 2.0 (the
007        "License"); you may not use this file except in compliance
008        with the License.  You may obtain a copy of the License at
009    
010           http://www.apache.org/licenses/LICENSE-2.0
011    
012        Unless required by applicable law or agreed to in writing,
013        software distributed under the License is distributed on an
014        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015        KIND, either express or implied.  See the License for the
016        specific language governing permissions and limitations
017        under the License.  
018     */
019    package org.apache.wiki.api.filters;
020    
021    import java.util.Properties;
022    
023    import org.apache.wiki.WikiContext;
024    import org.apache.wiki.WikiEngine;
025    import org.apache.wiki.api.exceptions.FilterException;
026    
027    /**
028     *  Provides a base implementation of a PageFilter.  None of the callbacks
029     *  do anything, so it is a good idea for you to extend from this class
030     *  and implement only methods that you need.
031     *
032     */
033    public class BasicPageFilter
034        implements PageFilter
035    {
036        protected WikiEngine m_engine;
037      
038        /**
039         *  If you override this, you should call super.initialize() first.
040         *  
041         *  {@inheritDoc}
042         */
043        public void initialize( WikiEngine engine, Properties properties )
044            throws FilterException
045        {
046            m_engine = engine;
047        }
048    
049        /**
050         *  {@inheritDoc}
051         */
052        public String preTranslate( WikiContext wikiContext, String content )
053            throws FilterException
054        {
055            return content;
056        }
057    
058        /**
059         *  {@inheritDoc}
060         */
061        public String postTranslate( WikiContext wikiContext, String htmlContent )
062            throws FilterException
063        {
064            return htmlContent;
065        }
066    
067        /**
068         *  {@inheritDoc}
069         */
070        public String preSave( WikiContext wikiContext, String content )
071            throws FilterException
072        {
073            return content;
074        }
075    
076        /**
077         *  {@inheritDoc}
078         */
079        public void postSave( WikiContext wikiContext, String content )
080            throws FilterException
081        {
082        }
083        
084        /**
085         *  {@inheritDoc}
086         */
087        public void destroy( WikiEngine engine ) 
088        {
089        }
090    }