001/*
002 * Copyright 2007 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.gl.batch.service;
017
018import java.io.File;
019import java.io.InputStream;
020import java.util.List;
021
022import org.kuali.ole.gl.batch.service.impl.EnterpriseFeederStatus;
023import org.kuali.ole.sys.Message;
024
025/**
026 * A service that is used to provide notification about the status of an enterprise feed. The implementation may use a variety of
027 * other services to perform notification, ranging from simply logging data to sending emails, etc.
028 */
029public interface EnterpriseFeederNotificationService {
030    /**
031     * Performs notification about the status of the upload (i.e. feeding) of a single file set (i.e. done file, data file, and
032     * recon file).
033     * 
034     * @param feederProcessName The name of the feeder process; this may correspond to the name of the Spring definition of the
035     *        feeder step, but each implementation may define how to use the value of this parameter and/or restrictions on its
036     *        value.
037     * @param event The event/status of the upload of the file set
038     * @param doneFile The done file
039     * @param dataFile The data file
040     * @param reconFile The recon file
041     * @param errorMessages Any error messages for which to provide notification
042     */
043    public void notifyFileFeedStatus(String feederProcessName, EnterpriseFeederStatus status, File doneFile, File dataFile, File reconFile, List<Message> errorMessages);
044
045
046    /**
047     * Performs notification about the status of the upload (i.e. feeding) of a single file set (i.e. done file, data file, and
048     * recon file). This method is useful when the file sets are not <b>NOTE:</b> the CALLER MUST CLOSE all of the input streams
049     * that are passed in. In addition, the input streams may be used by implementations of this method, and no assumption about the
050     * state of the input streams should be made after this method returns.
051     * 
052     * @param feederProcessName The name of the feeder process; this may correspond to the name of the Spring definition of the
053     *        feeder step, but each implementation may define how to use the value of this parameter and/or restrictions on its
054     *        value.
055     * @param event The event/status of the upload of the file set
056     * @param doneFileDescription The description of the done file to be output during notification
057     * @param doneFileContents An input stream for the contents of the done file. If the implementation does not require the
058     *        contents of the file, then <code>null</code> may be passed in.
059     * @param dataFileDescription The description of the done file to be output during notification
060     * @param dataFileContents An input stream for the contents of the data file. If the implementation does not require the
061     *        contents of the file, then <code>null</code> may be passed in.
062     * @param reconFileDescription The description of the done file to be output during notification
063     * @param reconFileContents An input stream for the contents of the recon file. If the implementation does not require the
064     *        contents of the file, then <code>null</code> may be passed in.
065     * @param errorMessages Any error messages for which to provide notification
066     */
067    public void notifyFileFeedStatus(String feederProcessName, EnterpriseFeederStatus status, String doneFileDescription, InputStream doneFileContents, String dataFileDescription, InputStream dataFileContents, String reconFileDescription, InputStream reconFileContents, List<Message> errorMessages);
068
069    /**
070     * Generates the status message that would be generated by a call to notifyFileFeedStatus with the same parameters.
071     * 
072     * @param feederProcessName The name of the feeder process; this may correspond to the name of the Spring definition of the
073     *        feeder step, but each implementation may define how to use the value of this parameter and/or restrictions on its
074     *        value.
075     * @param event The event/status of the upload of the file set
076     * @param doneFile The done file
077     * @param dataFile The data file
078     * @param reconFile The recon file
079     * @param errorMessages Any error messages for which to provide notification
080     */
081    public String getFileFeedStatusMessage(String feederProcessName, EnterpriseFeederStatus status, File doneFile, File dataFile, File reconFile, List<Message> errorMessages);
082
083    /**
084     * Generates the status message that would be generated by a call to notifyFileFeedStatus with the same parameters. <b>NOTE:</b>
085     * the CALLER MUST CLOSE all of the input streams that are passed in. In addition, the input streams may be used by
086     * implementations of this method, and no assumption about the state of the input streams should be made after this method
087     * returns.
088     * 
089     * @param feederProcessName The name of the feeder process; this may correspond to the name of the Spring definition of the
090     *        feeder step, but each implementation may define how to use the value of this parameter and/or restrictions on its
091     *        value.
092     * @param event The event/status of the upload of the file set
093     * @param doneFileDescription The description of the done file to be output during notification
094     * @param doneFileContents An input stream for the contents of the done file. If the implementation does not require the
095     *        contents of the file, then <code>null</code> may be passed in.
096     * @param dataFileDescription The description of the done file to be output during notification
097     * @param dataFileContents An input stream for the contents of the data file. If the implementation does not require the
098     *        contents of the file, then <code>null</code> may be passed in.
099     * @param reconFileDescription The description of the done file to be output during notification
100     * @param reconFileContents An input stream for the contents of the recon file. If the implementation does not require the
101     *        contents of the file, then <code>null</code> may be passed in.
102     * @param errorMessages Any error messages for which to provide notification
103     */
104    public String getFileFeedStatusMessage(String feederProcessName, EnterpriseFeederStatus status, String doneFileDescription, InputStream doneFileContents, String dataFileDescription, InputStream dataFileContents, String reconFileDescription, InputStream reconFileContents, List<Message> errorMessages);
105}