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;
018
019import java.io.Serializable;
020
021import org.apache.wicket.request.resource.IResource;
022import org.apache.wicket.util.resource.IResourceStream;
023
024/**
025 * static resource which does not change for the lifetime of the application and should be
026 * considered a candidate for long-term caching.
027 * 
028 * @author Peter Ertl
029 * @since 1.5
030 */
031public interface IStaticCacheableResource extends IResource
032{
033        /**
034         * controls whether caching of the resource is enabled or disabled
035         * 
036         * @return {@code true} if caching is enabled
037         */
038        boolean isCachingEnabled();
039        
040        /**
041         * get unique caching key for the resource stream produced by
042         * {@link #getResourceStream()}
043         * 
044         * @return serializable key which properly supports {@link Object#equals(Object)} and
045         *         {@link Object#hashCode()}
046         */
047        Serializable getCacheKey();
048
049        /**
050         * get static resource stream which will be unique to the related caching key
051         * {@link #getCacheKey()}
052         * 
053         * @return stream or <code>null</code> if no stream could be found
054         */
055        IResourceStream getResourceStream();
056}