001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.cluster;
016    
017    import org.jgroups.Address;
018    
019    /**
020     * @author Shuyang Zhou
021     */
022    public class AddressImpl implements com.liferay.portal.kernel.cluster.Address {
023    
024            public AddressImpl(Address address) {
025                    _address = address;
026            }
027    
028            @Override
029            public boolean equals(Object obj) {
030                    if (obj == null) {
031                            return false;
032                    }
033    
034                    AddressImpl addressImpl = null;
035    
036                    try {
037                            addressImpl = (AddressImpl)obj;
038                    }
039                    catch (ClassCastException cce) {
040                            return false;
041                    }
042    
043                    if (_address.equals(addressImpl._address)) {
044                            return true;
045                    }
046                    else {
047                            return false;
048                    }
049            }
050    
051            public String getDescription() {
052                    return _address.toString();
053            }
054    
055            public Address getRealAddress() {
056                    return _address;
057            }
058    
059            @Override
060            public int hashCode() {
061                    return _address.hashCode();
062            }
063    
064            @Override
065            public String toString() {
066                    return _address.toString();
067            }
068    
069            private static final long serialVersionUID = 7969878022424426497L;
070    
071            private Address _address;
072    
073    }