org.apache.jetspeed.security.impl
Class BasePrincipalImpl

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

public abstract 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
          is this principal enabled
private  String fullPath
          The full path.
private  boolean isMapping
          is this principal a mapping
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, boolean hiearchicalNames)
           Principal constructor given a name and preferences root.
BasePrincipalImpl(String name, String prefsRoot, boolean hiearchicalNames, boolean isEnabled, boolean isMapping)
           
 
Method Summary
 String getFullPath()
           
static String getFullPathFromPrincipalName(String name, String prefsRoot, boolean hiearchicalNames)
           Gets the principal implementation full path from the principal name.
 String getName()
           
static String getPrincipalNameFromFullPath(String fullPath, String prefsRoot, boolean hiearchicalNames)
           Gets the principal name from the principal implementation full path.
 int hashCode()
           
 boolean isEnabled()
           
 boolean isMapping()
           
 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
is this principal enabled


isMapping

private boolean isMapping
is this principal a mapping

Constructor Detail

BasePrincipalImpl

public BasePrincipalImpl(String name,
                         String prefsRoot,
                         boolean hiearchicalNames)

Principal constructor given a name and preferences root.

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

BasePrincipalImpl

public BasePrincipalImpl(String name,
                         String prefsRoot,
                         boolean hiearchicalNames,
                         boolean isEnabled,
                         boolean isMapping)
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
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()

Returns a string representation of this principal.

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

getFullPathFromPrincipalName

public static String getFullPathFromPrincipalName(String name,
                                                  String prefsRoot,
                                                  boolean hiearchicalNames)

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.
hiearchicalNames - indicator if hierarchy encoding (replacing '.' with '/') should be done
Returns:
The preferences full path / principal name.

getPrincipalNameFromFullPath

public static String getPrincipalNameFromFullPath(String fullPath,
                                                  String prefsRoot,
                                                  boolean hiearchicalNames)

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.
hiearchicalNames - indicator if hierarchical decoding (replacing '/' with '.') should be done
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)

isMapping

public boolean isMapping()
Specified by:
isMapping in interface org.apache.jetspeed.security.BasePrincipal


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