1 7 8 package com.sun.security.auth; 9 10 import java.security.Principal ; 11 12 31 @Deprecated 32 public class SolarisNumericGroupPrincipal implements 33 Principal , 34 java.io.Serializable { 35 36 private static final long serialVersionUID = 2345199581042573224L; 37 38 private static final java.util.ResourceBundle rb = 39 (java.util.ResourceBundle )java.security.AccessController.doPrivileged 40 (new java.security.PrivilegedAction () { 41 public Object run() { 42 return (java.util.ResourceBundle.getBundle 43 ("sun.security.util.AuthResources")); 44 } 45 }); 46 47 50 private String name; 51 52 55 private boolean primaryGroup; 56 57 73 public SolarisNumericGroupPrincipal(String name, boolean primaryGroup) { 74 if (name == null) 75 throw new NullPointerException (rb.getString("provided null name")); 76 77 this.name = name; 78 this.primaryGroup = primaryGroup; 79 } 80 81 94 public SolarisNumericGroupPrincipal(long name, boolean primaryGroup) { 95 this.name = (new Long (name)).toString(); 96 this.primaryGroup = primaryGroup; 97 } 98 99 108 public String getName() { 109 return name; 110 } 111 112 121 public long longValue() { 122 return ((new Long (name)).longValue()); 123 } 124 125 135 public boolean isPrimaryGroup() { 136 return primaryGroup; 137 } 138 139 148 public String toString() { 149 return((primaryGroup ? 150 rb.getString 151 ("SolarisNumericGroupPrincipal [Primary Group]: ") + name : 152 rb.getString 153 ("SolarisNumericGroupPrincipal [Supplementary Group]: ") + name)); 154 } 155 156 172 public boolean equals(Object o) { 173 if (o == null) 174 return false; 175 176 if (this == o) 177 return true; 178 179 if (!(o instanceof SolarisNumericGroupPrincipal)) 180 return false; 181 SolarisNumericGroupPrincipal that = (SolarisNumericGroupPrincipal)o; 182 183 if (this.getName().equals(that.getName()) && 184 this.isPrimaryGroup() == that.isPrimaryGroup()) 185 return true; 186 return false; 187 } 188 189 196 public int hashCode() { 197 return toString().hashCode(); 198 } 199 } 200 | Popular Tags |