All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.camel.attachment.AttachmentMessage Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.attachment;

import java.util.Map;
import java.util.Set;

import javax.activation.DataHandler;

import org.apache.camel.Message;

/**
 * Extended {@link Message} for Java Attachment Support (with javax.activation).
 */
public interface AttachmentMessage extends Message {

    /**
     * Returns the attachment specified by the id
     *
     * @param  id the id under which the attachment is stored
     * @return    the data handler for this attachment or null
     */
    DataHandler getAttachment(String id);

    /**
     * Returns the attachment specified by the id
     *
     * @param  id the id under which the attachment is stored
     * @return    the attachment or null
     */
    Attachment getAttachmentObject(String id);

    /**
     * Returns a set of attachment names of the message
     *
     * @return a set of attachment names
     */
    Set getAttachmentNames();

    /**
     * Removes the attachment specified by the id
     *
     * @param id the id of the attachment to remove
     */
    void removeAttachment(String id);

    /**
     * Adds an attachment to the message using the id
     *
     * @param id      the id to store the attachment under
     * @param content the data handler for the attachment
     */
    void addAttachment(String id, DataHandler content);

    /**
     * Adds an attachment to the message using the id
     *
     * @param id      the id to store the attachment under
     * @param content the attachment
     */
    void addAttachmentObject(String id, Attachment content);

    /**
     * Returns all attachments of the message
     *
     * @return the attachments in a map or null
     */
    Map getAttachments();

    /**
     * Returns all attachments of the message
     *
     * @return the attachments in a map or null
     */
    Map getAttachmentObjects();

    /**
     * Set all the attachments associated with this message
     *
     * @param attachments the attachments
     */
    void setAttachments(Map attachments);

    /**
     * Set all the attachments associated with this message
     *
     * @param attachments the attachments
     */
    void setAttachmentObjects(Map attachments);

    /**
     * Returns whether this message has attachments.
     *
     * @return true if this message has any attachments.
     */
    boolean hasAttachments();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy