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

Quick Search    Search Deep

Source code: com/flexstor/common/io/xfile/ftp/FtpSessionId.java


1   /*
2    * FtpSessionId.java
3    *
4    * Copyright $Date: 2003/08/11 02:22:47 $ FLEXSTOR.net Inc.
5    *
6    * This work is licensed for use and distribution under license terms found at
7    * http://www.flexstor.org/license.html
8    *
9    */
10  
11  package com.flexstor.common.io.xfile.ftp;
12  
13  /**
14   * A Class class.
15   * <P>
16   * @author Praveen Jani
17   */
18  public class FtpSessionId extends java.lang.Object
19  {
20  
21    /**
22     * Session Id.  
23     */
24    protected int nSessionId    = -1;
25    /**
26     * Name of the server.
27     */
28    protected String strServerName = "";
29    /**
30     * Port of the server where the ftp connection is supposed to be done.
31     */
32    protected int nServerport   = 21; // Default for Ftp
33    /**
34     * Session id created using the server name and port
35     */
36    public FtpSessionId( String server, int port, int sessionId )
37    {
38      strServerName = server;
39      if ( port > 0 ) // otherwise DEFAULT PORT is 21
40        nServerport = port;
41      nSessionId    = sessionId;
42    }
43  
44    /**
45     * Returns the session id;
46     */
47    public int getSessionId ()
48    {
49       return nSessionId;
50    }
51    /**
52     * Returns the name of the server.
53     */
54    public String getServerName ()
55    {
56       return strServerName;
57    }
58    /**
59     * Returns the server port.
60     */
61    public int getServerPort ()
62    {
63       return nServerport;
64    }
65  
66    /**
67     * Checks the equality.
68     */
69    public  boolean equals ( Object object )
70    {
71  
72       if  ( ( object != null ) && ( object instanceof FtpSessionId ) )
73       {
74         FtpSessionId idObject = ( FtpSessionId ) object;
75  
76         return ( ( idObject.getServerPort() == nServerport ) &&
77                 ( idObject.getServerName().equals ( strServerName ) ) &&
78                 ( idObject.getSessionId() == nSessionId ) );
79  
80       }
81       return false;
82    }
83  }
84