kitaev@213: /* kitaev@213: * Copyright (c) 2011 TMate Software Ltd kitaev@213: * kitaev@213: * This program is free software; you can redistribute it and/or modify kitaev@213: * it under the terms of the GNU General Public License as published by kitaev@213: * the Free Software Foundation; version 2 of the License. kitaev@213: * kitaev@213: * This program is distributed in the hope that it will be useful, kitaev@213: * but WITHOUT ANY WARRANTY; without even the implied warranty of kitaev@213: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the kitaev@213: * GNU General Public License for more details. kitaev@213: * kitaev@213: * For information on how to redistribute this software under kitaev@213: * the terms of a license other than GNU General Public License kitaev@213: * contact TMate Software at support@hg4j.com kitaev@213: */ kitaev@213: package org.tmatesoft.hg.internal; kitaev@213: kitaev@213: import java.nio.ByteBuffer; kitaev@213: kitaev@213: import org.tmatesoft.hg.repo.HgRepository; kitaev@213: import org.tmatesoft.hg.util.Path; kitaev@213: kitaev@213: /** kitaev@213: * kitaev@213: * @author Artem Tikhomirov kitaev@213: * @author TMate Software Ltd. kitaev@213: */ kitaev@213: public interface Filter { kitaev@213: kitaev@213: // returns a buffer ready to be read. may return original buffer. kitaev@213: // original buffer may not be fully consumed, #compact() might be operation to perform kitaev@213: ByteBuffer filter(ByteBuffer src); kitaev@213: kitaev@213: interface Factory { kitaev@213: void initialize(HgRepository hgRepo, ConfigFile cfg); kitaev@213: // may return null if for a given path and/or options this filter doesn't make any sense kitaev@213: Filter create(Path path, Options opts); kitaev@213: } kitaev@213: kitaev@213: enum Direction { kitaev@213: FromRepo, ToRepo kitaev@213: } kitaev@213: kitaev@213: public class Options { kitaev@213: kitaev@213: private final Direction direction; kitaev@213: public Options(Direction dir) { kitaev@213: direction = dir; kitaev@213: } kitaev@213: kitaev@213: Direction getDirection() { kitaev@213: return direction; kitaev@213: } kitaev@213: kitaev@213: } kitaev@213: }