001/* 
002 * Copyright (C) 2016 Hobrasoft s.r.o.
003 *
004 * This program is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU Affero General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU Affero General Public License for more details.
013 *
014 * You should have received a copy of the GNU Affero General Public License
015 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
016 */
017package cz.hobrasoft.pdfmu.operation;
018
019import cz.hobrasoft.pdfmu.TextOutput;
020import cz.hobrasoft.pdfmu.WritingMapper;
021import net.sourceforge.argparse4j.inf.Namespace;
022import net.sourceforge.argparse4j.inf.Subparser;
023
024/**
025 * Manipulates a PDF file
026 *
027 * @author <a href="mailto:filip.bartek@hobrasoft.cz">Filip Bartek</a>
028 */
029public interface Operation {
030
031    /**
032     * Configure this operation's subparser
033     *
034     * <p>
035     * The subparser handles the arguments accepted by this operation.
036     *
037     * @param subparser Subparser object to configure, especially adding
038     * arguments
039     * @return the subparser added to {@code subparsers}
040     */
041    public Subparser configureSubparser(Subparser subparser);
042
043    /**
044     * Executes the operation
045     *
046     * @param namespace parsed command line arguments
047     * @throws OperationException if some condition prevents the operation from
048     * finishing
049     */
050    public void execute(Namespace namespace) throws OperationException;
051
052    public void setWritingMapper(WritingMapper wm);
053
054    public void setTextOutput(TextOutput to);
055}