001package votorola.a.response; // Copyright 2007, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import java.util.*;
004import votorola.a.*;
005import votorola.g.option.*;
006
007
008/** Responder for the command 'hello' - to say hello to the server.
009  *
010  *     @see <a href='../../../../../s/manual.xht#Mail-Response-hello'
011  *                           >../../s/manual.xht#Mail-Response-hello</a>
012  */
013public final class CR_Hello extends CommandResponder.Base
014{
015
016    /** Constructs a CR_Hello.
017      */
018    public CR_Hello( VoterService voterService )
019    {
020        super( voterService, "a.response.CR_Hello." );
021    }
022
023
024   // - C o m m a n d - R e s p o n d e r ------------------------------------------------
025
026
027    /** Returns true.
028      */
029    public @Override boolean acceptsAnonymousIssue() { return true; }
030
031
032
033    public @Override Exception respond( final String[] argv,
034      final CommandResponder.Session session )
035    {
036        final ReplyBuilder replyB = session.replyBuilder();
037        final Map<String,Option> optionMap = compileBaseOptions( session );
038        {
039            final int aFirstNonOption = parse( argv, optionMap, session ); // rearranges argv
040            if( aFirstNonOption == -1 ) return null; // parse error, message already appended
041
042            if( optionMap.get("a.voter.CommandResponder.option.help").hasOccured() )
043            {
044                help( session );
045                return null;
046            }
047        }
048
049        replyB.lappendlnn( "a.response.CR_Hello.reply" );
050        return null;
051    }
052
053
054
055}