KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > jdbc > JDBCRole


1 package com.sslexplorer.jdbc;
2
3 import java.io.Serializable JavaDoc;
4
5 import com.sslexplorer.realms.Realm;
6 import com.sslexplorer.security.Role;
7
8 /**
9  * Implementation of a {@link com.sslexplorer.security.Role}
10  * for <i>JDBC built in Roles</i>.
11  *
12  * @author James D Robinson <a HREF="mailto:james@3sp.com">&lt;james@3sp.com&gt;</a>
13  *
14  */

15 public class JDBCRole implements Role<JDBCRole>, Serializable JavaDoc {
16
17     private final String JavaDoc rolename;
18     private final Realm realm;
19
20     JDBCRole(String JavaDoc roleName, Realm realm) {
21         this.rolename = roleName;
22         this.realm = realm;
23     }
24
25     /* (non-Javadoc)
26      * @see com.sslexplorer.policyframework.Principal#getPrincipalName()
27      */

28     public String JavaDoc getPrincipalName() {
29         return rolename;
30     }
31
32     /* (non-Javadoc)
33      * @see java.lang.Object#toString()
34      */

35     public String JavaDoc toString() {
36         return getPrincipalName();
37     }
38
39     /* (non-Javadoc)
40      * @see java.lang.Comparable#compareTo(T)
41      */

42     public int compareTo(JDBCRole o) {
43         return getPrincipalName().compareTo(o.getPrincipalName());
44     }
45
46     /* (non-Javadoc)
47      * @see com.sslexplorer.policyframework.Principal#getRealm()
48      */

49     public Realm getRealm() {
50         return realm;
51     }
52 }
Popular Tags