org.glite.security.voms.service
Interface ContainerNamingScheme


public interface ContainerNamingScheme

An interface for checking the syntax of container names and distinguishing between different container types by their names.

Note: The implementation must not access the VOMS database for these syntactical checks. A name may be well-formed even if the named container does not exist in the database.

Implementations of this interface must also define a static getInstance() method returning an instance of this interface.

Author:
Karoly Lorentey
See Also:
SimpleNamingScheme

Method Summary
 void checkCapabilityName(java.lang.String name)
          Check that name is a capability name.
 void checkDirectSubgroup(java.lang.String parent, java.lang.String child)
          Check that child is a direct subcontainer of parent.
 void checkGroupName(java.lang.String name)
          Check that name is a group name.
 void checkQualifiedRoleName(java.lang.String name)
          Check that name is a fully qualified role name.
 void checkRoleName(java.lang.String name)
          Check that name is a role name.
 void checkSyntax(java.lang.String name)
          Check if the given name has correct syntax for a container DN.
 java.lang.String fromDatabaseCapabilityName(java.lang.String capability)
          Convert a capability name in database form to display form.
 java.lang.String fromDatabaseGroupName(java.lang.String groupname)
          Convert a group name in database form to display form.
 java.lang.String fromDatabaseRoleName(java.lang.String rolename)
          Convert a role name in database form to display form.
 java.lang.String getGroupFromQualifiedRoleName(java.lang.String name)
          Return the base group part of a qualified role name.
 java.lang.String getParentGroup(java.lang.String group)
          Return the name of the parent group, if any.
 java.lang.String getRoleFromQualifiedRoleName(java.lang.String name)
          Return the role name part of a qualified role name.
 boolean isCapability(java.lang.String name)
          Returns true if name corresponds to a capability.
 boolean isDirectSubgroup(java.lang.String parent, java.lang.String child)
          Returns true if child is syntactically a direct or indirect subcontainer of parent.
 boolean isGroup(java.lang.String name)
          Returns true if name corresponds to a group.
 boolean isQualifiedRole(java.lang.String name)
          Returns true if name corresponds to a qualified role.
 boolean isRole(java.lang.String name)
          Returns true if name corresponds to a role.
 boolean isSubgroup(java.lang.String parent, java.lang.String child)
          Returns true if child is syntactically a direct or indirect subcontainer of parent.
 java.lang.String toDatabaseCapabilityName(java.lang.String capability)
          Convert a capability name in display form to database form.
 java.lang.String toDatabaseGroupName(java.lang.String groupname)
          Convert a group name in display form to database form.
 java.lang.String toDatabaseRoleName(java.lang.String rolename)
          Convert a role name in display form to database form.
 

Method Detail

checkSyntax

public void checkSyntax(java.lang.String name)
                 throws ArgumentException
Check if the given name has correct syntax for a container DN.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not well-formed. Invariant: if this method returns normally, exactly one of isGroup, isRole or isCapability must return true.

isGroup

public boolean isGroup(java.lang.String name)
                throws ArgumentException
Returns true if name corresponds to a group.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not well-formed.

isRole

public boolean isRole(java.lang.String name)
               throws ArgumentException
Returns true if name corresponds to a role.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not well-formed.

isQualifiedRole

public boolean isQualifiedRole(java.lang.String name)
                        throws ArgumentException
Returns true if name corresponds to a qualified role.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not well-formed.

isCapability

public boolean isCapability(java.lang.String name)
                     throws ArgumentException
Returns true if name corresponds to a capability.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not well-formed.

checkGroupName

public void checkGroupName(java.lang.String name)
                    throws ArgumentException
Check that name is a group name. Note that the null string designates the VO group, so null is a well-formed group name.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not a well-formed group name.

checkRoleName

public void checkRoleName(java.lang.String name)
                   throws ArgumentException
Check that name is a role name.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not a well-formed role name.

checkCapabilityName

public void checkCapabilityName(java.lang.String name)
                         throws ArgumentException
Check that name is a capability name.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not a well-formed capability name.

checkQualifiedRoleName

public void checkQualifiedRoleName(java.lang.String name)
                            throws ArgumentException
Check that name is a fully qualified role name.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not a well-formed role name.

getGroupFromQualifiedRoleName

public java.lang.String getGroupFromQualifiedRoleName(java.lang.String name)
                                               throws ArgumentException
Return the base group part of a qualified role name.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not a well-formed qualified role name.

getRoleFromQualifiedRoleName

public java.lang.String getRoleFromQualifiedRoleName(java.lang.String name)
                                              throws ArgumentException
Return the role name part of a qualified role name.

Parameters:
name - A string supplied by the client.
Throws:
ArgumentException - if name is not a well-formed qualified role name.

isSubgroup

public boolean isSubgroup(java.lang.String parent,
                          java.lang.String child)
                   throws ArgumentException
Returns true if child is syntactically a direct or indirect subcontainer of parent. In more detail, it must return true if (and only if)

Throws:
ArgumentException - if either parent or child is not well-formed.

getParentGroup

public java.lang.String getParentGroup(java.lang.String group)
                                throws ArgumentException
Return the name of the parent group, if any.

Returns:
the DN of the parent group (a purely syntactical check), if there is one.
Throws:
ArgumentException - if group> is not well-formed, or if it is null.

isDirectSubgroup

public boolean isDirectSubgroup(java.lang.String parent,
                                java.lang.String child)
                         throws ArgumentException
Returns true if child is syntactically a direct or indirect subcontainer of parent. In more detail, it must return true if (and only if)
  • parent is the VO group, and child is a primary group, a capability or a VO-level role, or
  • parent is a primary group or subgroup, and child is one of its direct subgroups, or
  • parent is a primary group or subgroup, and child is one of its associated roles.

Throws:
ArgumentException - if either parent or child is not well-formed, or if parent is null.

checkDirectSubgroup

public void checkDirectSubgroup(java.lang.String parent,
                                java.lang.String child)
                         throws ArgumentException
Check that child is a direct subcontainer of parent.

Throws:
ArgumentException - if child is not a direct subgroup of parent

toDatabaseGroupName

public java.lang.String toDatabaseGroupName(java.lang.String groupname)
                                     throws ArgumentException
Convert a group name in display form to database form.

Throws:
ArgumentException - if name is not a well-formed group name.

fromDatabaseGroupName

public java.lang.String fromDatabaseGroupName(java.lang.String groupname)
                                       throws ArgumentException
Convert a group name in database form to display form.

Throws:
ArgumentException - if name is not a well-formed group name.

toDatabaseRoleName

public java.lang.String toDatabaseRoleName(java.lang.String rolename)
                                    throws ArgumentException
Convert a role name in display form to database form.

Throws:
ArgumentException - if name is not a well-formed role name.

fromDatabaseRoleName

public java.lang.String fromDatabaseRoleName(java.lang.String rolename)
                                      throws ArgumentException
Convert a role name in database form to display form.

Throws:
ArgumentException - if name is not a well-formed role name.

toDatabaseCapabilityName

public java.lang.String toDatabaseCapabilityName(java.lang.String capability)
                                          throws ArgumentException
Convert a capability name in display form to database form.

Throws:
ArgumentException - if name is not a well-formed capability name.

fromDatabaseCapabilityName

public java.lang.String fromDatabaseCapabilityName(java.lang.String capability)
                                            throws ArgumentException
Convert a capability name in database form to display form.

Throws:
ArgumentException - if name is not a well-formed capability name.