001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    
021    package org.apache.geronimo.openejb;
022    
023    import java.net.URI;
024    
025    import org.apache.geronimo.security.SubjectId;
026    
027    /**
028     * @version $Rev: 554749 $ $Date: 2007-07-09 15:54:06 -0400 (Mon, 09 Jul 2007) $
029     */
030    public class ServerIdentityToken {
031        private final URI server;
032        private final SubjectId id;
033    
034    
035        public ServerIdentityToken(URI server, SubjectId id) {
036            this.server = server;
037            this.id = id;
038        }
039    
040    
041        public URI getServer() {
042            return server;
043        }
044    
045        public SubjectId getId() {
046            return id;
047        }
048    
049    
050        public boolean equals(Object o) {
051            if (this == o) return true;
052            if (o == null || getClass() != o.getClass()) return false;
053    
054            ServerIdentityToken that = (ServerIdentityToken) o;
055    
056            if (id != null ? !id.equals(that.id) : that.id != null) return false;
057            if (server != null ? !server.equals(that.server) : that.server != null) return false;
058    
059            return true;
060        }
061    
062        public int hashCode() {
063            int result;
064            result = (server != null ? server.hashCode() : 0);
065            result = 31 * result + (id != null ? id.hashCode() : 0);
066            return result;
067        }
068    }