Package org.jnode.nntp.model

Examples of org.jnode.nntp.model.NntpCommand


     *
     * @param command command.
     * @return response.
     */
    private Collection<String> process(String command) {
        NntpCommand parsedCommand = findCommand(command);
        if (parsedCommand != null) {
            Processor processor = ProcessorResolver.processor(parsedCommand);
            if (processor == null) {
                logger.l4("Can't find processor for command '" + command + "'.");
                throw new ProcessorNotFoundException();
            }
            return processor.process(parsedCommand.getParams(), selectedGroupId, selectedArticleId, auth);
        }

        throw new UnknownCommandException();
    }
View Full Code Here


     * @param command command.
     * @return supported command.
     */
    private NntpCommand findCommand(String command) {
        String[] parts = StringUtils.split(command, DELIMITER);
        NntpCommand foundedCommand;

        if (parts == null) {
            throw new UnknownCommandException();
        }

        if (parts.length == 1) {
            foundedCommand = NntpCommand.find(command);
            if (foundedCommand == null) {
                throw new UnknownCommandException();
            }
            foundedCommand.setParams(EMPTY_LIST);
            return foundedCommand;
        }

        foundedCommand = NntpCommand.find(parts[0] + DELIMITER + parts[1]);
        if (foundedCommand == null) {
            foundedCommand = findCommand(parts[0]);
            if (foundedCommand == null) {
                throw new UnknownCommandException();
            } else {
                foundedCommand.setParams(prepareParams(parts, true));
            }
        } else {
            foundedCommand.setParams(prepareParams(parts, false));
        }
        return foundedCommand;
    }
View Full Code Here

TOP

Related Classes of org.jnode.nntp.model.NntpCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.