org.edg.security.voms.database
Class DBCA

java.lang.Object
  |
  +--org.edg.security.voms.database.DBCA

public final class DBCA
extends java.lang.Object

A class representing known certificate authorities in a VO. Essentially, a wrapper class for the ca table.

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

Field Summary
(package private) static CAUpdater cup
          CAUpdater.
private  java.lang.String dsc
          The description of this CA.
private  int id
          The id of this CA.
private static int ID
           
private static org.apache.log4j.Logger log
          Logger.
private  java.lang.String name
          The fully qualified name of this CA.
private static int NAME
           
(package private) static Sequence seq
          Sequence.
 
Constructor Summary
private DBCA(int id)
          Initialize a new DBCA from the given id.
private DBCA(java.lang.String name)
          Initialize a new DBCA from the given name.
 
Method Summary
static int countCAs()
           
 long countUsers()
          Return the number of users that have certificates issued by this CA.
static DBCA create(java.lang.String name, java.lang.String dsc)
          Inserts a record into the database.
static java.lang.String[] getCAs()
          Get the names of all CAs.
 java.lang.String getDescription()
           
 java.lang.String getDN()
          Return the name of this CA.
(package private)  int getId()
          Return the id of this CA.
(package private) static DBCA getInstance(int id)
          Returns a DBCA object representing the CA with the given id.
static DBCA getInstance(java.lang.String name)
          Returns a DBCA object representing the named CA.
private  void initialize(int from)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

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


name

private java.lang.String name
The fully qualified name of this CA.


id

private int id
The id of this CA.


dsc

private java.lang.String dsc
The description of this CA.


seq

static final Sequence seq
Sequence.


cup

static final CAUpdater cup
CAUpdater. This is never used, but we want to start the update thread as soon as this class is loaded.


NAME

private static final int NAME
See Also:
Constant Field Values

ID

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

DBCA

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


DBCA

private DBCA(int id)
      throws GeneralDatabaseException,
             NotInDatabase
Initialize a new DBCA from the given id.

Method Detail

initialize

private void initialize(int from)
                 throws GeneralDatabaseException,
                        NotInDatabase
GeneralDatabaseException
NotInDatabase

getInstance

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

Parameters:
name - The fully qualified name of the CA.
Returns:
The DBCA instance representing the named CA.
Throws:
NotInDatabase - If the given CA is not accepted in this VO.
GeneralDatabaseException
ArgumentException

getInstance

static DBCA getInstance(int id)
                 throws GeneralDatabaseException,
                        NotInDatabase
Returns a DBCA object representing the CA with the given id.

Parameters:
id - The id of the CA.
Returns:
The DBCA instance representing the named CA.
Throws:
NotInDatabase - If the given CA is not accepted in this VO.
GeneralDatabaseException

getId

int getId()
Return the id of this CA.


getDN

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


getDescription

public java.lang.String getDescription()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

countUsers

public long countUsers()
                throws GeneralDatabaseException
Return the number of users that have certificates issued by this CA.

GeneralDatabaseException

create

public static DBCA create(java.lang.String name,
                          java.lang.String dsc)
                   throws ArgumentException,
                          GeneralDatabaseException
Inserts a record into the database.

Parameters:
name - The distinguished name of the new CA.
dsc - A textual description of the CA.
Returns:
the newly created CA object.
ArgumentException
GeneralDatabaseException

getCAs

public static java.lang.String[] getCAs()
                                 throws GeneralDatabaseException
Get the names of all CAs.

Returns:
The names of the CAs.
GeneralDatabaseException

countCAs

public static int countCAs()
                    throws GeneralDatabaseException
GeneralDatabaseException