org.edg.security.voms.database
Class DBCapability

java.lang.Object
  |
  +--org.edg.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.

Version:
$Name: v0_7_0 $
Author:
Karoly Lorentey, Akos Frohner

Field Summary
private  long acl
          The id of this capability's ACL.
private static ContainerNamingScheme cns
          The container naming scheme for this instance of VOMS.
private  long createdBy
          The id of the client who created this capability.
private  long createdSerial
          The number of the transaction that committed this capability.
private  long id
          The id of this capability.
private static int ID
           
private static org.apache.log4j.Logger log
          Logger.
private  java.lang.String name
          The name of this capability, in display form.
private static int NAME
           
(package private) static Sequence seq
          Sequence.
 
Constructor Summary
private DBCapability(long id)
          Initialize a new DBCapability from the given id.
private DBCapability(java.lang.String name)
          Initialize a new DBCapability from the given name.
 
Method Summary
 void addMember(DBUser user)
           
 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.
(package private)  long getACLId()
          Return the ACL id of this capability.
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.
(package private)  long getId()
          Return the id of this capability.
(package private) static DBCapability getInstance(long id)
          Returns a DBCapability object representing the capability with the given id.
static DBCapability getInstance(java.lang.String name)
          Returns a DBCapability object representing the name capability.
 DBUser[] getMembers()
           
 User[] getMembersAsUser()
           
private  void initialize(int from)
          Retrieve the given capability from the database.
 boolean isMember(DBUser user)
           
 void removeAllMembers()
           
 void removeMember(DBUser user)
           
 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
 

Field Detail

log

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


name

private java.lang.String name
The name of this capability, in display form.


id

private long id
The id of this capability.


acl

private long acl
The id of this capability's ACL.


createdBy

private long createdBy
The id of the client who created this capability.


createdSerial

private long createdSerial
The number of the transaction that committed this capability.


seq

static final Sequence seq
Sequence.


cns

private static ContainerNamingScheme cns
The container naming scheme for this instance of VOMS.


NAME

private static final int NAME
See Also:
Constant Field Values

ID

private static final int ID
See Also:
Constant Field Values
Constructor Detail

DBCapability

private DBCapability(java.lang.String name)
              throws GeneralDatabaseException,
                     NotInDatabase,
                     ArgumentException
Initialize a new DBCapability from the given name.


DBCapability

private DBCapability(long id)
              throws GeneralDatabaseException,
                     NotInDatabase
Initialize a new DBCapability from the given id.

Method Detail

initialize

private void initialize(int from)
                 throws GeneralDatabaseException,
                        NotInDatabase,
                        ArgumentException
Retrieve the given capability from the database.

GeneralDatabaseException
NotInDatabase
ArgumentException

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

getInstance

static DBCapability getInstance(long id)
                         throws GeneralDatabaseException,
                                NotInDatabase
Returns a DBCapability object representing the capability with the given id.

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

getId

long getId()
Return the id of this capability.


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
Overrides:
toString in class java.lang.Object

getACLId

long getACLId()
Return the ACL id of this capability. Please consider using getACL instead of this method.


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 DatabaseError,
                    InconsistentDatabase
Return this capability's ACL.

Specified by:
getACL in interface DBContainer
DatabaseError
InconsistentDatabase

getCreatedBy

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

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
GeneralDatabaseException
VOMSSecurityException

countMembers

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

GeneralDatabaseException

isMember

public boolean isMember(DBUser user)
                 throws GeneralDatabaseException
GeneralDatabaseException

getMembers

public DBUser[] getMembers()
                    throws GeneralDatabaseException
GeneralDatabaseException

getMembersAsUser

public User[] getMembersAsUser()
                        throws GeneralDatabaseException
GeneralDatabaseException

addMember

public void addMember(DBUser user)
               throws GeneralDatabaseException
GeneralDatabaseException

removeMember

public void removeMember(DBUser user)
                  throws GeneralDatabaseException
GeneralDatabaseException

removeAllMembers

public void removeAllMembers()
                      throws GeneralDatabaseException
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.

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.
GeneralDatabaseException

getCapabilityNames

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

GeneralDatabaseException