org.apache.jetspeed.security.impl
Class BasePrincipalImpl

java.lang.Object
  extended byorg.apache.jetspeed.security.impl.BasePrincipalImpl
All Implemented Interfaces:
org.apache.jetspeed.security.BasePrincipal, Principal, Serializable
Direct Known Subclasses:
GroupPrincipalImpl, RolePrincipalImpl, UserPrincipalImpl

public class BasePrincipalImpl
extends Object
implements org.apache.jetspeed.security.BasePrincipal

BasePrincipal interface implementation.

Author:
David Le Strat
See Also:
Serialized Form

Field Summary
private  boolean enabled
           
private  String fullPath
          The full path.
private  String name
          The principal name.
private static long serialVersionUID
          The version uid.
 
Fields inherited from interface org.apache.jetspeed.security.BasePrincipal
PREFS_GROUP_ROOT, PREFS_ROLE_ROOT, PREFS_USER_ROOT
 
Constructor Summary
BasePrincipalImpl(String name, String prefsRoot)
           Principal constructor given a name and preferences root.
 
Method Summary
 String getFullPath()
           
static String getFullPathFromPrincipalName(String name, String prefsRoot)
           Gets the principal implementation full path from the principal name.
 String getName()
           
static String getPrincipalNameFromFullPath(String fullPath, String prefsRoot)
           Gets the principal name from the principal implementation full path.
 int hashCode()
           
 boolean isEnabled()
           
 void setEnabled(boolean enabled)
           
 String toString()
           Returns a string representation of this principal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals
 

Field Detail

serialVersionUID

private static final long serialVersionUID
The version uid.

See Also:
Constant Field Values

name

private final String name
The principal name.


fullPath

private final String fullPath
The full path.


enabled

private boolean enabled
Constructor Detail

BasePrincipalImpl

public BasePrincipalImpl(String name,
                         String prefsRoot)

Principal constructor given a name and preferences root.

Parameters:
name - The principal name.
prefsRoot - The preferences root node.
Method Detail

getFullPath

public String getFullPath()
Specified by:
getFullPath in interface org.apache.jetspeed.security.BasePrincipal
See Also:
BasePrincipal.getFullPath()

getName

public String getName()
Specified by:
getName in interface Principal
See Also:
Principal.getName()

hashCode

public int hashCode()
Specified by:
hashCode in interface Principal
See Also:
Object.hashCode()

toString

public String toString()

Returns a string representation of this principal.

Specified by:
toString in interface Principal
Returns:
A string representation of this principal.

getFullPathFromPrincipalName

public static String getFullPathFromPrincipalName(String name,
                                                  String prefsRoot)

Gets the principal implementation full path from the principal name.

Hierarchical principal names should follow: {principal}.{subprincipal}. "." is used as the separator for hierarchical elements.

The implementation path follow /PREFS_{PRINCIPAL}_ROOT/{principal}/{subprincipal}.

Parameters:
name - The principal name.
prefsRoot - The preferences root node.
Returns:
The preferences full path / principal name.

getPrincipalNameFromFullPath

public static String getPrincipalNameFromFullPath(String fullPath,
                                                  String prefsRoot)

Gets the principal name from the principal implementation full path.

Hierarchical principal names should follow: {principal}.{subprincipal}. "." is used as the separator for hierarchical elements.

The implementation path follow /PREFS_{PRINCIPAL}_ROOT/{principal}/{subprincipal}.

Parameters:
fullPath - The principal full path.
prefsRoot - The preferences root node.
Returns:
The principal name.

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface org.apache.jetspeed.security.BasePrincipal
See Also:
BasePrincipal.isEnabled()

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface org.apache.jetspeed.security.BasePrincipal
See Also:
BasePrincipal.setEnabled(boolean)


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.