1.1 --- a/trunk/com/so/news/command/Command.java Tue Jan 20 10:21:03 2009 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,106 +0,0 @@
1.4 -/*
1.5 - * StarOffice News Server
1.6 - * see AUTHORS for the list of contributors
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify
1.9 - * it under the terms of the GNU General Public License as published by
1.10 - * the Free Software Foundation, either version 3 of the License, or
1.11 - * (at your option) any later version.
1.12 - *
1.13 - * This program is distributed in the hope that it will be useful,
1.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.16 - * GNU General Public License for more details.
1.17 - *
1.18 - * You should have received a copy of the GNU General Public License
1.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.20 - */
1.21 -
1.22 -package com.so.news.command;
1.23 -
1.24 -import java.io.IOException;
1.25 -import java.util.List;
1.26 -import com.so.news.NNTPConnection;
1.27 -import com.so.news.storage.Article;
1.28 -import com.so.news.storage.Group;
1.29 -
1.30 -/**
1.31 - * Base class for all command handling classes.
1.32 - * @author Christian Lins
1.33 - * @author Dennis Schwerdel
1.34 - */
1.35 -public abstract class Command
1.36 -{
1.37 - protected NNTPConnection connection;
1.38 -
1.39 - public Command(NNTPConnection connection)
1.40 - {
1.41 - this.connection = connection;
1.42 - }
1.43 -
1.44 - protected static String NEWLINE = NNTPConnection.NEWLINE;
1.45 -
1.46 - protected List<String> readText()
1.47 - throws IOException
1.48 - {
1.49 - return connection.readText();
1.50 - }
1.51 -
1.52 - protected String readTextLine() throws IOException
1.53 - {
1.54 - return connection.readTextLine();
1.55 - }
1.56 -
1.57 - protected void printStatus(int status, String text) throws IOException
1.58 - {
1.59 - connection.printStatus(status, text);
1.60 - }
1.61 -
1.62 - protected void printTextLine(CharSequence text) throws IOException
1.63 - {
1.64 - connection.printTextLine(text);
1.65 - }
1.66 -
1.67 - protected void printTextPart(CharSequence text) throws IOException
1.68 - {
1.69 - connection.printTextPart(text);
1.70 - }
1.71 -
1.72 - protected void printText(CharSequence text) throws IOException
1.73 - {
1.74 - connection.printText(text);
1.75 - }
1.76 -
1.77 - protected void println(CharSequence text) throws IOException
1.78 - {
1.79 - connection.println(text);
1.80 - }
1.81 -
1.82 - protected void flush() throws IOException
1.83 - {
1.84 - connection.flush();
1.85 - }
1.86 -
1.87 - protected Article getCurrentArticle()
1.88 - {
1.89 - return connection.getCurrentArticle();
1.90 - }
1.91 -
1.92 - protected Group getCurrentGroup()
1.93 - {
1.94 - return connection.getCurrentGroup();
1.95 - }
1.96 -
1.97 - protected void setCurrentArticle(Article current)
1.98 - {
1.99 - connection.setCurrentArticle(current);
1.100 - }
1.101 -
1.102 - protected void setCurrentGroup(Group current)
1.103 - {
1.104 - connection.setCurrentGroup(current);
1.105 - }
1.106 -
1.107 - public abstract boolean process(String[] command)
1.108 - throws Exception;
1.109 -}