001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.connector.outbound.security;
019
020 import java.io.Serializable;
021 import java.security.Principal;
022
023 /**
024 *
025 *
026 * @version $Rev: 550546 $ $Date: 2007-06-25 12:52:11 -0400 (Mon, 25 Jun 2007) $
027 *
028 * */
029 public class ResourcePrincipal implements Principal, Serializable {
030
031 private final String resourcePrincipal;
032
033 public ResourcePrincipal(String resourcePrincipal) {
034 this.resourcePrincipal = resourcePrincipal;
035 if (resourcePrincipal == null) {
036 throw new NullPointerException("No resource principal name supplied");
037 }
038 }
039
040 public String getName() {
041 return resourcePrincipal;
042 }
043
044 public boolean equals(Object o) {
045 if (this == o) return true;
046 if (o == null || getClass() != o.getClass()) return false;
047
048 ResourcePrincipal that = (ResourcePrincipal) o;
049
050 return resourcePrincipal.equals(that.resourcePrincipal);
051
052 }
053
054 public int hashCode() {
055 return resourcePrincipal.hashCode();
056 }
057 }