View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.mitosis.service.protocol.message;
21  
22  
23  import org.apache.directory.shared.ldap.util.EqualsBuilder;
24  import org.apache.directory.shared.ldap.util.HashCodeBuilder;
25  import org.apache.directory.mitosis.service.protocol.Constants;
26  
27  
28  public class LoginAckMessage extends ResponseMessage
29  {
30      private String replicaId;
31  
32  
33      public LoginAckMessage( int sequence, int responseCode, String replicaId )
34      {
35          super( sequence, responseCode );
36          this.replicaId = replicaId;
37      }
38  
39  
40      public int getType()
41      {
42          return Constants.LOGIN_ACK;
43      }
44  
45  
46      public String getReplicaId()
47      {
48          return replicaId;
49      }
50  
51  
52      /**
53       * @see java.lang.Object#equals(Object)
54       */
55      public boolean equals( Object object )
56      {
57          if ( object == this )
58          {
59              return true;
60          }
61  
62          if ( !( object instanceof LoginAckMessage ) )
63          {
64              return false;
65          }
66  
67          LoginAckMessage rhs = ( LoginAckMessage ) object;
68  
69          return new EqualsBuilder().appendSuper( super.equals( object ) ).append( this.replicaId, rhs.replicaId )
70              .isEquals();
71      }
72  
73  
74      /**
75       * @see java.lang.Object#hashCode()
76       * @return the instance's hashcode 
77       */
78      public int hashCode()
79      {
80          return new HashCodeBuilder( -280394717, -328404193 ).appendSuper( super.hashCode() ).append( this.replicaId )
81              .toHashCode();
82      }
83  
84  
85      public String toString()
86      {
87          return "[LoginAck] " + super.toString() + ", " + replicaId;
88      }
89  }