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 */
019package org.apache.wiki.api.core;
020
021/**
022 *  Describes an attachment.  Attachments are actually derivatives of a WikiPage, since they do actually have a WikiName as well.
023 */
024public interface Attachment extends Page {
025
026    /**
027     *  Returns the file name of the attachment.
028     *  
029     *  @return A String with the file name.
030     */
031    String getFileName();
032
033    /**
034     *  Sets the file name of this attachment. 
035     *  
036     *  @param name The name of the attachment.  Must be a legal file name without the path.
037     */
038    void setFileName( String name );
039
040    /**
041     *  Returns the name of the parent of this Attachment, i.e. the page which contains this attachment.
042     *  
043     *  @return String depicting the parent of the attachment.
044     */
045    String getParentName();
046
047    /**
048     *  Returns true, if this attachment can be cached by the user agent.  By default attachments are cacheable.
049     *  
050     *  @return False, if the attachment should not be cached by the user agent.
051     *  @since 2.5.34
052     */
053    boolean isCacheable();
054
055    /**
056     *  Sets this attachment to be cacheable or not.  This mostly concerns things like DynamicAttachments, but it may be useful for
057     *  certain AttachmentProviders as well.
058     *  
059     *  @param value True or false, depending on whether you want this attachment to be cacheable or not.
060     *  @since 2.5.34
061     */
062    void setCacheable( boolean value );
063}