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.camel;
018
019import java.util.Collection;
020import java.util.List;
021
022import javax.activation.DataHandler;
023
024/**
025 * Represents an attachment as part of a {@link Message}.
026 */
027public interface Attachment {
028    /**
029     * Return a DataHandler for the content within this attachment.
030     *
031     * @return DataHandler for the content
032     */
033    DataHandler getDataHandler();
034
035    /**
036     * Get all the headers for this header name. Returns null if no headers for
037     * this header name are available.
038     *
039     * @param headerName he name of this header
040     * @return a comma separated list of all header values
041     */
042    String getHeader(String headerName);
043
044    /**
045     * Get all the headers for this header name. Returns null if no headers for
046     * this header name are available.
047     *
048     * @param name The name of this header
049     * @return a list of all header values
050     */
051    List<String> getHeaderAsList(String name);
052
053    /**
054     * Get all header names for this attachment.
055     *
056     * @return a collection of all header names
057     */
058    Collection<String> getHeaderNames();
059
060    /**
061     * Set the value for this headerName. Replaces all existing header values
062     * with this new value.
063     * 
064     * @param headerName the name of this header
065     * @param headerValue the value for this header
066     */
067    void setHeader(String headerName, String headerValue);
068
069    /**
070     * Add this value to the existing values for this headerName.
071     * 
072     * @param headerName the name of this header
073     * @param headerValue the value for this header
074     */
075    void addHeader(String headerName, String headerValue);
076
077    /**
078     * Remove all headers with this name.
079     * 
080     * @param headerName the name of this header
081     */
082    void removeHeader(String headerName);
083}