View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Protique Ltd
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   **/
    18
    19  package org.codehaus.activemq.message;
    20
    21  import java.util.Properties;
    22
    23  /***
    24   * Describes a Connection
    25   *
    26   * @version $Revision: 1.7 $
    27   */
    28
    29  public class ConnectionInfo extends AbstractPacket {
    30      String clientId;
    31      String userName;
    32      String password;
    33      String hostName;
    34      long startTime;
    35      boolean started;
    36      boolean closed;
    37      Properties properties;
    38
    39      /***
    40       * Return the type of Packet
    41       *
    42       * @return integer representation of the type of Packet
    43       */
    44
    45      public int getPacketType() {
    46          return ACTIVEMQ_CONNECTION_INFO;
    47      }
    48
    49      /***
    50       * Test for equality
    51       *
    52       * @param obj object to test
    53       * @return true if equivalent
    54       */
    55      public boolean equals(Object obj) {
    56          boolean result = false;
    57          if (obj != null && obj instanceof ConnectionInfo) {
    58              ConnectionInfo info = (ConnectionInfo) obj;
    59              result = this.clientId == info.clientId;
    60          }
    61          return result;
    62      }
    63
    64      /***
    65       * @return hash code for instance
    66       */
    67      public int hashCode() {
    68          return this.clientId != null ? this.clientId.hashCode() : super.hashCode();
    69      }
    70
    71
    72      /***
    73       * @return Returns the clientId.
    74       */
    75      public String getClientId() {
    76          return this.clientId;
    77      }
    78
    79      /***
    80       * @param newClientId The clientId to set.
    81       */
    82      public void setClientId(String newClientId) {
    83          this.clientId = newClientId;
    84      }
    85
    86      /***
    87       * @return Returns the hostName.
    88       */
    89      public String getHostName() {
    90          return this.hostName;
    91      }
    92
    93      /***
    94       * @param newHostName The hostName to set.
    95       */
    96      public void setHostName(String newHostName) {
    97          this.hostName = newHostName;
    98      }
    99
    100     /***
    101      * @return Returns the password.
    102      */
    103     public String getPassword() {
    104         return this.password;
    105     }
    106
    107     /***
    108      * @param newPassword The password to set.
    109      */
    110     public void setPassword(String newPassword) {
    111         this.password = newPassword;
    112     }
    113
    114     /***
    115      * @return Returns the properties.
    116      */
    117     public Properties getProperties() {
    118         return this.properties;
    119     }
    120
    121     /***
    122      * @param newProperties The properties to set.
    123      */
    124     public void setProperties(Properties newProperties) {
    125         this.properties = newProperties;
    126     }
    127
    128     /***
    129      * @return Returns the startTime.
    130      */
    131     public long getStartTime() {
    132         return this.startTime;
    133     }
    134
    135     /***
    136      * @param newStartTime The startTime to set.
    137      */
    138     public void setStartTime(long newStartTime) {
    139         this.startTime = newStartTime;
    140     }
    141
    142     /***
    143      * @return Returns the userName.
    144      */
    145     public String getUserName() {
    146         return this.userName;
    147     }
    148
    149     /***
    150      * @param newUserName The userName to set.
    151      */
    152     public void setUserName(String newUserName) {
    153         this.userName = newUserName;
    154     }
    155
    156     /***
    157      * @return Returns the started.
    158      */
    159     public boolean isStarted() {
    160         return started;
    161     }
    162
    163     /***
    164      * @param started The started to set.
    165      */
    166     public void setStarted(boolean started) {
    167         this.started = started;
    168     }
    169
    170     /***
    171      * @return Returns the closed.
    172      */
    173     public boolean isClosed() {
    174         return closed;
    175     }
    176
    177     /***
    178      * @param closed The closed to set.
    179      */
    180     public void setClosed(boolean closed) {
    181         this.closed = closed;
    182     }
    183 }