001package org.apache.archiva.redback.integration.mail;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.redback.keys.AuthenticationKey;
023
024import java.util.Locale;
025import java.util.Map;
026
027/**
028 * Mail generator component.
029 *
030 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
031 *
032 */
033public interface MailGenerator
034{
035
036
037    /**
038     * Generates a mail string from a template. How the template will be located depends on the underlying
039     * implementation.
040     * It uses a default locale.
041     *
042     * @param templateName the template name without extension
043     * @param authkey the authentication key of the current user
044     * @param baseUrl  the base url
045     * @return A string for the mail body generated from the template
046     */
047    String generateMail( String templateName, AuthenticationKey authkey, String baseUrl );
048
049    /**
050     * Generates a mail string from a template. The given locale is used for retrieving the template.
051     * How the template will be located depends on the underlying implementation.
052     *
053     * @param templateName the template name without extension
054     * @param locale the locale used to find the template file
055     * @param authenticationKey the authentication key of the current user
056     * @param baseUrl the base url
057     * @return a string for the mail body generated from the template
058     */
059    String generateMail( String templateName, Locale locale, AuthenticationKey authenticationKey, String baseUrl );
060
061    /**
062     * Generates a mail string from a template. The given locale is used for retrieving the template.
063     * How the template will be located depends on the underlying implementation.
064     * The templateData is used as model data that is interpolated from the template.
065     *
066     * @param templateName the template name without extension
067     * @param locale the locale used to find the template file
068     * @param authenticationKey the authentication key of the current user
069     * @param baseUrl the base url
070     * @param templateData additional data used for interpolation in the template
071     * @return a string for the mail body generated from the template
072     */
073    String generateMail( String templateName, Locale locale, AuthenticationKey authenticationKey, String baseUrl,
074                         Map<String, Object> templateData );
075
076}