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.request.resource.caching.version;
018
019import java.util.regex.Pattern;
020
021import org.apache.wicket.request.resource.caching.IStaticCacheableResource;
022
023/**
024 * Provides a version string for a cacheable resource specified by {@link org.apache.wicket.request.resource.caching.IStaticCacheableResource} 
025 * <p/>
026 * the version string will be used as a distinguishing mark when rendering resources
027 * 
028 * @see org.apache.wicket.request.resource.caching.QueryStringWithVersionResourceCachingStrategy
029 * @see org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy
030 * 
031 * @author Peter Ertl
032 * 
033 * @since 1.5
034 */
035public interface IResourceVersion
036{
037        /**
038         * get unique string identifying the version of the resource
039         * 
040         * @param resource
041         *             cacheable resource
042         * @return unique version string or <code>null</code> 
043         *         if version string could not be calculated
044         */
045        String getVersion(IStaticCacheableResource resource);
046
047        /**
048         * a pattern that matches returned versions
049         *
050         * @return a pattern or <code>null</code> if no pattern
051         *         is available
052         */
053        Pattern getVersionPattern();
054}