nbi.xmlsec.xacml.profile.rbac
Class Identifier

java.lang.Object
  extended bynbi.xmlsec.xacml.profile.rbac.Identifier
Direct Known Subclasses:
AssignmentIdentifier, PermissionIdentifier, PermissionPolicyIdentifier, PermissionPolicySetIdentifier, RoleAssignmentPolicyIdentifier, RoleAssignmentPolicySetIdentifier, RolePolicySetIdentifier, RoleValueIdentifier

public class Identifier
extends Object

Implements the XACML-identifier for RBAC elements like Assignments, Permissions etc. The identifier is composed of the strings for domain, type and label, where the domain is optional. The identifier may be presented as URI or String as follows type:label (ex. "biocase:permission:scan-request"). In a similar way, the identifier is represented in the file system. The enableFile flag marks, if the identifier is allowed to be represented as a File. Otherwise, the toFile(String)method returns null.

Since:
Version:
$Revision: 1.13 $
Author:
Lutz Suhrbier

Field Summary
private  String domain
          Domain of the identifier
private  boolean enableFile
          Flag that marks, whether the identifier may be represented in the file system (toFile(String)).
private static int iDOMAIN
           
private static int iLABEL
           
private static int iTYPE
           
private  String label
          Label of the identifier
private static Logger logger
           
private  String type
          Type of the identifier
 
Constructor Summary
protected Identifier()
          Identifiers should be created using getInstance(URI)only.
  Identifier(String domain, String type, String label, boolean enableFile)
          Creates an Identifier instance.
 
Method Summary
private  void checkParameters()
           
 boolean equals(Object obj)
          Returns true, if the String representations are identical.
 String getDomain()
          Gets the domain.
static Identifier getInstance(String id)
          Creates an Identifier instance based on its string representation.
static Identifier getInstance(URI id)
          Creates an Identifier instance based on its URI representation.
 String getLabel()
          Gets the label.
 String getType()
          Gets the type.
 int hashCode()
          Returns hash value of the string representation.
 boolean isEnableFile()
          Checks wether the identifier is file enabled.
static String[] parse(String id)
          Parses domain, type and label from an Identifier string representation.
static String[] parse(URI id)
          Parses domain, type and label from an Identifier string representation.
 void setDomain(String domain)
          Sets the domain.
 void setLabel(String label)
          Sets the label.
protected  void setType(String type)
          Sets the type.
 File toFile(File parent)
          Creates a file system representation of this identifier.
 File toFile(String parent)
          Creates a file system representation of this identifier.
 String toString()
          Creates the representation of this identifier.
 URI toURI()
          Creates the representation of this identifier.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final Logger logger

iDOMAIN

private static int iDOMAIN

iTYPE

private static int iTYPE

iLABEL

private static int iLABEL

domain

private String domain
Domain of the identifier


type

private String type
Type of the identifier


label

private String label
Label of the identifier


enableFile

private boolean enableFile
Flag that marks, whether the identifier may be represented in the file system (toFile(String)).

Constructor Detail

Identifier

public Identifier(String domain,
                  String type,
                  String label,
                  boolean enableFile)
Creates an Identifier instance.

Parameters:
domain - Identifier's domain.
type - Identifier's type.
label - Identifier's label.
enableFile - true, if the identifier may be represented in the file system, false otherwise.

Identifier

protected Identifier()
Identifiers should be created using getInstance(URI)only.

Method Detail

checkParameters

private void checkParameters()
                      throws IllegalArgumentException
Throws:
IllegalArgumentException

getInstance

public static Identifier getInstance(URI id)
                              throws ParsingException
Creates an Identifier instance based on its URI representation.

Parameters:
id - Identifier's URI representation.
Throws:
ParsingException - Indicates a malformed identifier representation.

getInstance

public static Identifier getInstance(String id)
                              throws ParsingException
Creates an Identifier instance based on its string representation.

Parameters:
id - Identifier's URI representation.
Throws:
ParsingException - Indicates a malformed identifier representation.

parse

public static String[] parse(String id)
                      throws ParsingException
Parses domain, type and label from an Identifier string representation.

Parameters:
id - Identifier string representation to parse.
Returns:
Array with parsed domain(may be null), type and label.
Throws:
ParsingException - Indicates a malformed identifier representation.

parse

public static String[] parse(URI id)
                      throws ParsingException
Parses domain, type and label from an Identifier string representation.

Parameters:
id - Identifier string representation to parse.
Returns:
Array with parsed domain(may be null), type and label.
Throws:
ParsingException - Indicates a malformed identifier representation.

setDomain

public void setDomain(String domain)
Sets the domain.

Parameters:
domain - The domain to set.

getDomain

public String getDomain()
Gets the domain.

Returns:
The domain.

setType

protected void setType(String type)
Sets the type.

Parameters:
type - The type to set.

getType

public String getType()
Gets the type.

Returns:
The type.

isEnableFile

public boolean isEnableFile()
Checks wether the identifier is file enabled.

Returns:
true, identifier is file enabled, false otherwise.

setLabel

public void setLabel(String label)
Sets the label.

Parameters:
label - The label to set.

getLabel

public String getLabel()
Gets the label.

Returns:
The label.

toURI

public URI toURI()
Creates the representation of this identifier.

Returns:
The identifier's representation.

toString

public String toString()
Creates the representation of this identifier.

Returns:
The identifier's representation.

toFile

public File toFile(String parent)
Creates a file system representation of this identifier. The representation is only created, when the identifier is file enabled.

Parameters:
parent - Parent directory for the file representation.
Returns:
File representation if the identifier is file enabled, null otherwise.

toFile

public File toFile(File parent)
Creates a file system representation of this identifier. The representation is only created, when the identifier is file enabled.

Parameters:
parent - Parent directory for the file representation.
Returns:
File representation if the identifier is file enabled, null otherwise.

equals

public boolean equals(Object obj)
Returns true, if the String representations are identical.

See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns hash value of the string representation.

See Also:
Object.hashCode()


Copyright © 2006 Lutz Suhrbier, Freie Universität Berlin. All Rights Reserved.