001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)MsgSenderPrincipal.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: /**
030: * MsgSenderPrincipal.java
031: *
032: * SUN PROPRIETARY/CONFIDENTIAL.
033: * This software is the proprietary information of Sun Microsystems, Inc.
034: * Use is subject to license terms.
035: *
036: * Created on February 14, 2005, 11:59 AM
037: */package com.sun.jbi.security;
038:
039: /**
040: *
041: * @author Sun Microsystems, Inc.
042: */
043: public class MsgSenderPrincipal implements java.security.Principal,
044: java.io.Serializable {
045:
046: /** The Priincipal name. */
047: private String mName;
048:
049: /**
050: * Creates a new instance of MsgSenderPrincipal.
051: *
052: * @param name is the Name of the principal.
053: */
054: public MsgSenderPrincipal(String name) {
055: mName = name;
056: }
057:
058: /**
059: * Returns the name of the Principal.
060: *
061: * @return the name of the principal.
062: */
063: public String getName() {
064: return mName;
065: }
066:
067: /**
068: * Return a hash code for this Principal.
069: *
070: * The hash code is calculated via: getName().hashCode()
071: *
072: * @return a hash code for this Principal.
073: */
074: public int hashCode() {
075: return getName().hashCode();
076: }
077:
078: /**
079: * Compares the specified Object with this X500Principal for equality.
080: * Specifically, this method returns true if the Object o is an X500Principal
081: * and if the respective canonical string representations (obtained via the
082: * getName(X500Principal.CANONICAL) method) of this object and o are equal.
083: *
084: * @param o object to compare with
085: * @return true if the specified Object is equal to this X500Principal,
086: * false otherwise
087: */
088: public boolean equals(Object o) {
089: if (o == null) {
090: return false;
091: }
092:
093: if (o instanceof MsgSenderPrincipal) {
094: return getName().equals(((MsgSenderPrincipal) o).getName());
095: }
096:
097: return false;
098: }
099:
100: }
|