Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/wilko/jaim/SignOnTocResponse.java


1   /* 
2    *   (C) 2002 Paul Wilkinson  wilko@users.sourceforge.net
3    *
4    *   This program is free software; you can redistribute it and/or modify
5    *   it under the terms of the GNU General Public License as published by
6    *   the Free Software Foundation; either version 2 of the License, or
7    *   (at your option) any later version.
8    *
9    *   This program is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   *   GNU General Public License for more details.
13   *
14   *   You should have received a copy of the GNU General Public License
15   *   along with this program; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   *
18   */
19  
20  /*
21   * SignOnTocResponse.java
22   *
23   * Created on 4 May 2002, 13:29
24   */
25  
26  package com.wilko.jaim;
27  
28  /**
29   * The SignOnTocResponse is used internally to manage the TOC signon process.  It is not delivered to clients of {@link JaimConnection}
30   * @author  paulw
31   * @version $Revision: 1.5 $
32   */
33  public class SignOnTocResponse extends TocResponse implements TocResponseHandler {
34  
35      String version;
36      
37      public static final String RESPONSE_TYPE="SIGN_ON";
38      
39      
40      /** Creates new SignOnTocResponse */
41      public SignOnTocResponse() {
42          version="";
43      }
44      
45      public String getResponseType() {
46          return(RESPONSE_TYPE);
47      }
48      
49      protected String getVersion()
50      {
51          return(version);
52      }
53      
54     
55      public TocResponse parseString(String str)
56      {
57          SignOnTocResponse tr=new SignOnTocResponse();
58          tr.doParse(str);
59          return(tr);
60      }
61      
62      private void doParse(String str)
63      {
64          cmd=str;
65          int colonpos=str.indexOf(':');
66          if (colonpos != -1)
67          {
68              version=str.substring(colonpos+1);
69          }
70      }
71      
72      /** Returns true if this response handler can handle the specified response.
73       * @param Response - the response string from TOC.  This is the part of the response before the first ':'
74       * @return true if the response can be handled
75       */
76      public boolean canHandle(String Response) {
77          return(Response.equalsIgnoreCase(RESPONSE_TYPE));
78      }
79      
80  }