org.glite.security.voms.database
Class DBCapability

java.lang.Object
  extended byorg.glite.security.voms.database.DBCapability
All Implemented Interfaces:
DBContainer

public final class DBCapability
extends java.lang.Object
implements DBContainer

A class representing capabilities in a VO. Essentially, a wrapper class for the capabilities table.

Author:
Karoly Lorentey, Akos Frohner

Method Summary
 void addMember(DBUser user)
          Include a user in this container.
 void checkPermission(Operation o)
          Convenience method: check that the client has the necessary privileges to perform the given operation on this capability.
static int countCapabilities()
          Return the number of capabilities in this VO.
 int countMembers()
          Returns the number of users that have this capability.
static DBCapability createCapability(java.lang.String name)
          Creates a new capability.
 void deleteCapability()
          Delete this capability.
 DBACL getACL()
          Return this capability's ACL.
static java.lang.String[] getCapabilityNames()
          Returns the names of all capabilities in this VO.
 DBAdmin getCreatedBy()
          Return the user who created this capability.
 long getCreatedByid()
          Return the id of the user who created this capability.
 long getCreatedSerial()
          Return the serial number of the transaction that committed this capability.
 java.lang.String getDN()
          Return the name of this capability.
static DBCapability getInstance(java.lang.String name)
          Returns a DBCapability object representing the name capability.
 java.lang.String[] getMemberNames()
          Return the names of all users that are in this container.
 DBUser[] getMembers()
          Return all users that are in this container.
 User[] getMembersAsUser()
          Return all users that are in this container.
 boolean isMember(DBUser user)
           
 void removeAllMembers()
           
 void removeMember(DBUser user)
          Remove a user from this container.
 java.lang.String toString()
          Convert to a human-readable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static DBCapability getInstance(java.lang.String name)
                                throws GeneralDatabaseException,
                                       NotInDatabase,
                                       ArgumentException
Returns a DBCapability object representing the name capability.

Parameters:
name - The name of the capability.
Returns:
The DBCapability instance representing the named capability.
Throws:
NotInDatabase - If there is no such group in the database.
GeneralDatabaseException
ArgumentException

getDN

public java.lang.String getDN()
Return the name of this capability.

Specified by:
getDN in interface DBContainer

toString

public java.lang.String toString()
Convert to a human-readable string.

Specified by:
toString in interface DBContainer

getCreatedByid

public long getCreatedByid()
Return the id of the user who created this capability. Please consider using getCreatedBy instead of this method.


getCreatedSerial

public long getCreatedSerial()
Return the serial number of the transaction that committed this capability.


getACL

public DBACL getACL()
             throws GeneralDatabaseException
Return this capability's ACL.

Specified by:
getACL in interface DBContainer
Throws:
GeneralDatabaseException

getCreatedBy

public DBAdmin getCreatedBy()
                     throws GeneralDatabaseException,
                            NotInDatabase,
                            ArgumentException
Return the user who created this capability.

Throws:
GeneralDatabaseException
NotInDatabase
ArgumentException

checkPermission

public void checkPermission(Operation o)
                     throws GeneralDatabaseException,
                            VOMSSecurityException
Convenience method: check that the client has the necessary privileges to perform the given operation on this capability.

Specified by:
checkPermission in interface DBContainer
Throws:
GeneralDatabaseException
VOMSSecurityException

countMembers

public int countMembers()
                 throws GeneralDatabaseException
Returns the number of users that have this capability.

Throws:
GeneralDatabaseException

isMember

public boolean isMember(DBUser user)
                 throws GeneralDatabaseException
Throws:
GeneralDatabaseException

getMembers

public DBUser[] getMembers()
                    throws GeneralDatabaseException
Description copied from interface: DBContainer
Return all users that are in this container.

Specified by:
getMembers in interface DBContainer
Throws:
GeneralDatabaseException

getMembersAsUser

public User[] getMembersAsUser()
                        throws GeneralDatabaseException
Description copied from interface: DBContainer
Return all users that are in this container.

Specified by:
getMembersAsUser in interface DBContainer
Throws:
GeneralDatabaseException

getMemberNames

public java.lang.String[] getMemberNames()
                                  throws GeneralDatabaseException
Description copied from interface: DBContainer
Return the names of all users that are in this container.

Specified by:
getMemberNames in interface DBContainer
Throws:
GeneralDatabaseException

addMember

public void addMember(DBUser user)
               throws GeneralDatabaseException
Description copied from interface: DBContainer
Include a user in this container.

Specified by:
addMember in interface DBContainer
Throws:
GeneralDatabaseException

removeMember

public void removeMember(DBUser user)
                  throws GeneralDatabaseException
Description copied from interface: DBContainer
Remove a user from this container.

Specified by:
removeMember in interface DBContainer
Throws:
GeneralDatabaseException

removeAllMembers

public void removeAllMembers()
                      throws GeneralDatabaseException
Throws:
GeneralDatabaseException

createCapability

public static DBCapability createCapability(java.lang.String name)
                                     throws GeneralDatabaseException,
                                            ArgumentException
Creates a new capability.

Parameters:
name - The name of the new capability.
Returns:
The DBRole object corresponding to the newly created capability.
Throws:
ArgumentException - if the capability is already in the database.
GeneralDatabaseException

deleteCapability

public void deleteCapability()
                      throws GeneralDatabaseException,
                             ArgumentException
Delete this capability.

Throws:
GeneralDatabaseException
ArgumentException

countCapabilities

public static int countCapabilities()
                             throws GeneralDatabaseException
Return the number of capabilities in this VO.

Returns:
The number of capabilities in this VO.
Throws:
GeneralDatabaseException

getCapabilityNames

public static java.lang.String[] getCapabilityNames()
                                             throws GeneralDatabaseException
Returns the names of all capabilities in this VO.

Throws:
GeneralDatabaseException