org.edg.security.voms.service
Class SimpleNamingScheme

java.lang.Object
  |
  +--org.edg.security.voms.service.SimpleNamingScheme
All Implemented Interfaces:
ContainerNamingScheme

class SimpleNamingScheme
extends java.lang.Object
implements ContainerNamingScheme

A singleton class implementing a simple DN-style naming scheme. Note that the core service and VOMS-enabled services don't understand this.

Version:
$Name: v0_7_0 $
Author:
Karoly Lorentey

Field Summary
private static java.util.regex.Pattern capabilitySyntax
          Deprecated.  
private static java.util.regex.Pattern groupSyntax
          Deprecated.  
private static org.apache.log4j.Logger log
          Deprecated. Logger.
private static java.util.regex.Pattern roleSyntax
          Deprecated.  
private static SimpleNamingScheme sns
          Deprecated. The single instance of this class.
private static java.util.regex.Pattern syntax
          Deprecated. The regular expression that describes well-formed container names.
private static java.lang.String voName
          Deprecated. The VO name.
 
Constructor Summary
private SimpleNamingScheme()
          Deprecated. Private constructor.
 
Method Summary
 void checkCapabilityName(java.lang.String name)
          Deprecated. Check that name is a capability name.
 void checkDirectSubgroup(java.lang.String parent, java.lang.String child)
          Deprecated. Check that child is a direct subcontainer of parent.
 void checkGroupName(java.lang.String name)
          Deprecated. Check that name is a group name.
 void checkRoleName(java.lang.String name)
          Deprecated. Check that name is a role name.
 void checkSyntax(java.lang.String name)
          Deprecated. Check that the given name matches the following regexp: "^(/[^/=]+=[^/=]+)+$" Examples of such names: /C=CH/O=CERN/OU=cern.ch/VO=CMS/Group=Foo (primary group) /C=CH/O=CERN/OU=cern.ch/VO=CMS/Group=Foo/Group=Bar (nested group) /Role=Fred (role) /Capability=Barney (capability) /C=CH/O=CERN/OU=cern.ch/VO=CMS (VO Group)
private static int countCharsInString(java.lang.String s, char c)
          Deprecated.  
 java.lang.String fromDatabaseCapabilityName(java.lang.String capability)
          Deprecated. Convert a capability name in database form to display form.
 java.lang.String fromDatabaseGroupName(java.lang.String groupname)
          Deprecated. Convert a group name in database form to display form.
 java.lang.String fromDatabaseRoleName(java.lang.String rolename)
          Deprecated. Convert a role name in database form to display form.
static ContainerNamingScheme getInstance()
          Deprecated. Returns an instance of this naming scheme.
 java.lang.String getParentGroup(java.lang.String group)
          Deprecated. Return the name of the parent group, if any.
 boolean isCapability(java.lang.String name)
          Deprecated. Returns true if the given name matches the following regexp: "^/Capability=[^/=]+$" Example: /C=CH/O=CERN/OU=cern.ch/Group=Foo/Capability=Bar ^^^^^^^^^^^^^^^
 boolean isDirectSubgroup(java.lang.String parent, java.lang.String child)
          Deprecated. Returns true if parent is a well-formed prefix of child.
 boolean isGroup(java.lang.String name)
          Deprecated. Returns true if the given name is well-formed, but it's not a role or capability.
 boolean isRole(java.lang.String name)
          Deprecated. Returns true if the given name matches the following regexp: "^/Role=[^/=]+$" Example: /C=CH/O=CERN/OU=cern.ch/Group=Foo/Role=Bar ^^^^^^^^^
 boolean isSubgroup(java.lang.String parent, java.lang.String child)
          Deprecated. Returns true if parent is a well-formed real prefix of child.
 java.lang.String toDatabaseCapabilityName(java.lang.String capability)
          Deprecated. Convert a capability name in display form to database form.
 java.lang.String toDatabaseGroupName(java.lang.String groupname)
          Deprecated. Convert a group name in display form to database form.
 java.lang.String toDatabaseRoleName(java.lang.String rolename)
          Deprecated. 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

sns

private static SimpleNamingScheme sns
Deprecated. 
The single instance of this class.


log

private static final org.apache.log4j.Logger log
Deprecated. 
Logger.


voName

private static final java.lang.String voName
Deprecated. 
The VO name.


syntax

private static final java.util.regex.Pattern syntax
Deprecated. 
The regular expression that describes well-formed container names.


groupSyntax

private static final java.util.regex.Pattern groupSyntax
Deprecated. 

roleSyntax

private static final java.util.regex.Pattern roleSyntax
Deprecated. 

capabilitySyntax

private static final java.util.regex.Pattern capabilitySyntax
Deprecated. 
Constructor Detail

SimpleNamingScheme

private SimpleNamingScheme()
                    throws ArgumentException
Deprecated. 
Private constructor.

Method Detail

getInstance

public static ContainerNamingScheme getInstance()
                                         throws ArgumentException
Deprecated. 
Returns an instance of this naming scheme.

ArgumentException

checkSyntax

public void checkSyntax(java.lang.String name)
                 throws ArgumentException
Deprecated. 
Check that the given name matches the following regexp:
 "^(/[^/=]+=[^/=]+)+$"
 
Examples of such names:
 /C=CH/O=CERN/OU=cern.ch/VO=CMS/Group=Foo						(primary group)
 /C=CH/O=CERN/OU=cern.ch/VO=CMS/Group=Foo/Group=Bar			(nested group)
 /Role=Fred													(role)
 /Capability=Barney											(capability)
 /C=CH/O=CERN/OU=cern.ch/VO=CMS								(VO Group)
 

Specified by:
checkSyntax in interface ContainerNamingScheme
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
Deprecated. 
Returns true if the given name is well-formed, but it's not a role or capability.

Examples:

 null											(alias for VO group)
 /C=CH/O=CERN/OU=cern.ch						(VO group)
 /C=CH/O=CERN/OU=cern.ch/Group=Foo			(primary group)
 /C=CH/O=CERN/OU=cern.ch/Group=Foo/Group=Bar	(nested group)
 

Specified by:
isGroup in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not well-formed.

isRole

public boolean isRole(java.lang.String name)
               throws ArgumentException
Deprecated. 
Returns true if the given name matches the following regexp:
 "^/Role=[^/=]+$"
 
Example:
 /C=CH/O=CERN/OU=cern.ch/Group=Foo/Role=Bar
                                  ^^^^^^^^^
 

Specified by:
isRole in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not well-formed.

isCapability

public boolean isCapability(java.lang.String name)
                     throws ArgumentException
Deprecated. 
Returns true if the given name matches the following regexp:
 "^/Capability=[^/=]+$"
 
Example:
 /C=CH/O=CERN/OU=cern.ch/Group=Foo/Capability=Bar
                                  ^^^^^^^^^^^^^^^
 

Specified by:
isCapability in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not well-formed.

isSubgroup

public boolean isSubgroup(java.lang.String parent,
                          java.lang.String child)
                   throws ArgumentException
Deprecated. 
Returns true if 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.

Specified by:
isSubgroup in interface ContainerNamingScheme
Throws:
ArgumentException - if either parent or child is not well-formed.

countCharsInString

private static int countCharsInString(java.lang.String s,
                                      char c)
Deprecated. 

isDirectSubgroup

public boolean isDirectSubgroup(java.lang.String parent,
                                java.lang.String child)
                         throws ArgumentException
Deprecated. 
Returns true if parent is a well-formed prefix of child. For example, /O=Sample/VO=Foo/Capability=Bar is a subcontainer of /O=Sample/VO=Foo.

Specified by:
isDirectSubgroup in interface ContainerNamingScheme
Throws:
ArgumentException - if either parent or child is not well-formed, or if parent is null.

checkGroupName

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

Specified by:
checkGroupName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed group name.

checkRoleName

public void checkRoleName(java.lang.String name)
                   throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Check that name is a role name.

Specified by:
checkRoleName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed role name.

checkCapabilityName

public void checkCapabilityName(java.lang.String name)
                         throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Check that name is a capability name.

Specified by:
checkCapabilityName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed capability name.

checkDirectSubgroup

public void checkDirectSubgroup(java.lang.String parent,
                                java.lang.String child)
                         throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Check that child is a direct subcontainer of parent.

Specified by:
checkDirectSubgroup in interface ContainerNamingScheme
Throws:
ArgumentException - if child is not a direct subgroup of parent

toDatabaseGroupName

public java.lang.String toDatabaseGroupName(java.lang.String groupname)
                                     throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Convert a group name in display form to database form.

Specified by:
toDatabaseGroupName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed group name.

fromDatabaseGroupName

public java.lang.String fromDatabaseGroupName(java.lang.String groupname)
                                       throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Convert a group name in database form to display form.

Specified by:
fromDatabaseGroupName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed group name.

toDatabaseRoleName

public java.lang.String toDatabaseRoleName(java.lang.String rolename)
                                    throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Convert a role name in display form to database form.

Specified by:
toDatabaseRoleName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed role name.

fromDatabaseRoleName

public java.lang.String fromDatabaseRoleName(java.lang.String rolename)
                                      throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Convert a role name in database form to display form.

Specified by:
fromDatabaseRoleName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed role name.

toDatabaseCapabilityName

public java.lang.String toDatabaseCapabilityName(java.lang.String capability)
                                          throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Convert a capability name in display form to database form.

Specified by:
toDatabaseCapabilityName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed capability name.

fromDatabaseCapabilityName

public java.lang.String fromDatabaseCapabilityName(java.lang.String capability)
                                            throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Convert a capability name in database form to display form.

Specified by:
fromDatabaseCapabilityName in interface ContainerNamingScheme
Throws:
ArgumentException - if name is not a well-formed capability name.

getParentGroup

public java.lang.String getParentGroup(java.lang.String group)
                                throws ArgumentException
Deprecated. 
Description copied from interface: ContainerNamingScheme
Return the name of the parent group, if any.

Specified by:
getParentGroup in interface ContainerNamingScheme
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.