001/*
002 *  jDTAUS Banking SPI
003 *  Copyright (C) 2005 Christian Schulte
004 *  <cs@schulte.it>
005 *
006 *  This library is free software; you can redistribute it and/or
007 *  modify it under the terms of the GNU Lesser General Public
008 *  License as published by the Free Software Foundation; either
009 *  version 2.1 of the License, or any later version.
010 *
011 *  This library is distributed in the hope that it will be useful,
012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *  Lesser General Public License for more details.
015 *
016 *  You should have received a copy of the GNU Lesser General Public
017 *  License along with this library; if not, write to the Free Software
018 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
019 *
020 */
021package org.jdtaus.banking.dtaus.spi;
022
023import java.io.IOException;
024import org.jdtaus.banking.dtaus.LogicalFile;
025import org.jdtaus.banking.dtaus.Transaction;
026
027/**
028 * Validates {@code Transaction} instances.
029 * <p>jDTAUS Banking SPI {@code TransactionValidator} specification to be used by implementations to validate
030 * {@code Transaction} instances to hold valid values.</p>
031 *
032 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
033 * @version $JDTAUS: TransactionValidator.java 8661 2012-09-27 11:29:58Z schulte $
034 */
035public interface TransactionValidator
036{
037
038    /**
039     * Checks a given {@code Transaction} instance to hold valid values for use with a given {@code LogicalFile}.
040     *
041     * @param lFile The logical file holding {@code transaction}.
042     * @param transaction The instance to check.
043     * @param result The validation result to be used or {@code null}.
044     *
045     * @return The validation result passed in as {@code result} (maybe {@code null} if the implementation did not
046     * detect illegal values).
047     *
048     * @throws NullPointerException if either {@code lFile} or {@code transaction} is {@code null}.
049     * @throws IOException if reading fails.
050     */
051    IllegalTransactionException assertValidTransaction( LogicalFile lFile, Transaction transaction,
052                                                        IllegalTransactionException result ) throws IOException;
053
054}