|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.edg.security.voms.service.PathNamingScheme
A singleton class implementing a simple UNIX path-style naming scheme.
Field Summary | |
private static java.util.regex.Pattern |
capabilitySyntax
|
private static java.util.regex.Pattern |
databaseCapabilitySyntax
|
private static java.util.regex.Pattern |
databaseRoleSyntax
|
private static java.util.regex.Pattern |
groupSyntax
|
private static org.apache.log4j.Logger |
log
Logger. |
private static PathNamingScheme |
pns
The single instance of this class. |
private static java.util.regex.Pattern |
roleSyntax
|
private static java.util.regex.Pattern |
syntax
The regular expression that describes well-formed container names. |
private static java.lang.String |
voName
The VO name with / prefix. |
Constructor Summary | |
private |
PathNamingScheme()
Private constructor. |
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 |
checkRoleName(java.lang.String name)
Check that name is a role name. |
void |
checkSyntax(java.lang.String name)
Check that the given name matches the following regexp: Examples of such names: datatag datatag/subgroup datatag/subgroup1/subgroup2 Role=foo Capability=bar |
private static int |
countCharsInString(java.lang.String s,
char c)
|
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. |
static ContainerNamingScheme |
getInstance()
Returns an instance of this naming scheme. |
java.lang.String |
getParentGroup(java.lang.String group)
Return the name of the parent group, if any. |
boolean |
isCapability(java.lang.String name)
Returns true if the given name matches the following regexp: Example: |
boolean |
isDirectSubgroup(java.lang.String parent,
java.lang.String child)
Returns true if parent is a well-formed prefix of child . |
boolean |
isGroup(java.lang.String name)
Returns true if the given name is well-formed, but it's not a role or capability. |
boolean |
isRole(java.lang.String name)
Returns true if the given name matches the following regexp: Example: |
boolean |
isSubgroup(java.lang.String parent,
java.lang.String child)
Returns true if parent is a well-formed real prefix of child .
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static PathNamingScheme pns
private static final java.lang.String voName
private static final org.apache.log4j.Logger log
private static final java.util.regex.Pattern syntax
private static final java.util.regex.Pattern groupSyntax
private static final java.util.regex.Pattern roleSyntax
private static final java.util.regex.Pattern capabilitySyntax
private static final java.util.regex.Pattern databaseRoleSyntax
private static final java.util.regex.Pattern databaseCapabilitySyntax
Constructor Detail |
private PathNamingScheme() throws ArgumentException
Method Detail |
public static ContainerNamingScheme getInstance() throws ArgumentException
ArgumentException
public void checkSyntax(java.lang.String name) throws ArgumentException
Examples of such names:
datatag datatag/subgroup datatag/subgroup1/subgroup2 Role=foo Capability=bar
checkSyntax
in interface ContainerNamingScheme
ArgumentException
- if name
is not well-formed.
Invariant: if this method returns normally, exactly one of
isGroup
, isRole
or
isCapability
must return true.public boolean isGroup(java.lang.String name) throws ArgumentException
Examples:
isGroup
in interface ContainerNamingScheme
ArgumentException
- if name
is not well-formed.public boolean isRole(java.lang.String name) throws ArgumentException
Example:
isRole
in interface ContainerNamingScheme
ArgumentException
- if name
is not well-formed.public boolean isCapability(java.lang.String name) throws ArgumentException
Example:
isCapability
in interface ContainerNamingScheme
ArgumentException
- if name
is not well-formed.public boolean isSubgroup(java.lang.String parent, java.lang.String child) throws ArgumentException
parent
is a well-formed real prefix of child
.
For example, /O=Sample/Group=Foo/Group=Bar
is a
subcontainer of /O=Sample/Group=Foo
.
isSubgroup
in interface ContainerNamingScheme
ArgumentException
- if either parent
or child
is not well-formed.public java.lang.String getParentGroup(java.lang.String group) throws ArgumentException
ContainerNamingScheme
getParentGroup
in interface ContainerNamingScheme
ArgumentException
- if group> is not well-formed, or if it is null.
private static int countCharsInString(java.lang.String s, char c)
public boolean isDirectSubgroup(java.lang.String parent, java.lang.String child) throws ArgumentException
parent
is a well-formed prefix of child
.
isDirectSubgroup
in interface ContainerNamingScheme
ArgumentException
- if either parent
or child
is not well-formed, or if parent
is null.public void checkGroupName(java.lang.String name) throws ArgumentException
ContainerNamingScheme
name
is a group name. Note that the null
string designates the VO group, so null
is a
well-formed group name.
checkGroupName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed group name.public void checkRoleName(java.lang.String name) throws ArgumentException
ContainerNamingScheme
name
is a role name.
checkRoleName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed role name.public void checkCapabilityName(java.lang.String name) throws ArgumentException
ContainerNamingScheme
name
is a capability name.
checkCapabilityName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed capability name.public void checkDirectSubgroup(java.lang.String parent, java.lang.String child) throws ArgumentException
ContainerNamingScheme
child
is a direct subcontainer of parent
.
checkDirectSubgroup
in interface ContainerNamingScheme
ArgumentException
- if child
is not a direct subgroup of parent
public java.lang.String toDatabaseGroupName(java.lang.String groupname) throws ArgumentException
ContainerNamingScheme
toDatabaseGroupName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed group name.public java.lang.String fromDatabaseGroupName(java.lang.String groupname) throws ArgumentException
ContainerNamingScheme
fromDatabaseGroupName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed group name.public java.lang.String toDatabaseRoleName(java.lang.String rolename) throws ArgumentException
ContainerNamingScheme
toDatabaseRoleName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed role name.public java.lang.String fromDatabaseRoleName(java.lang.String rolename) throws ArgumentException
ContainerNamingScheme
fromDatabaseRoleName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed role name.public java.lang.String toDatabaseCapabilityName(java.lang.String capability) throws ArgumentException
ContainerNamingScheme
toDatabaseCapabilityName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed capability name.public java.lang.String fromDatabaseCapabilityName(java.lang.String capability) throws ArgumentException
ContainerNamingScheme
fromDatabaseCapabilityName
in interface ContainerNamingScheme
ArgumentException
- if name
is not a well-formed capability name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |