Package org.italiangrid.voms.store.impl

# Class DefaultVOMSTrustStore

java.lang.Object
org.italiangrid.voms.store.impl.DefaultVOMSTrustStore

All Implemented Interfaces:
  `VOMSTrustStore`

Direct Known Subclasses:
  `DefaultUpdatingVOMSTrustStore`

public class DefaultVOMSTrustStore extends Object implements VOMSTrustStore
The default implementation for the VOMS trust store. This implementation does not refresh the trust information on a periodic basis. For an updating trust store see `DefaultUpdatingVOMSTrustStore`.

Author:
  Andrea Ceccanti

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CERTIFICATE_FILENAME_SUFFIX`
The filename suffix used to match certificates in the VOMS local trust directories
`static final String`
`DEFAULT_VOMS_DIR`
The default directory where local VOMS trust information is rooted: "/etc/grid-security/vomsdir"
`protected final Object`
`listenerLock`
A lock to guard the setting of the status listener
`static final String`
`LSC_FILENAME_SUFFIX`
The filename suffix used to match LSC files in the VOMS local trust directories
`protected final Lock`
`read`
A reference to the read lock
`protected final ReadWriteLock`
`rwLock`
The read/write lock that implements thread safety for this store
`protected final Lock`
`write`
A reference to the write lock

## Constructor Summary

Constructors
Constructor
Description
`DefaultVOMSTrustStore()`
Default constructor.
`DefaultVOMSTrustStore(List<String> localTrustDirs)`
`DefaultVOMSTrustStore(List<String> localTrustDirs, List<String> voNames, VOMSTrustStoreStatusListener listener)`
`DefaultVOMSTrustStore(List<String> localTrustDirs, VOMSTrustStoreStatusListener listener)`
`DefaultVOMSTrustStore(VOMSTrustStoreStatusListener listener)`

## Method Summary

Modifier and Type
Method
Description
`protected static List<String>`
`buildDefaultTrustedDirs()`
Builds a list of trusted directories containing only `DEFAULT_VOMS_DIR`.
`X509Certificate`
`getAACertificateBySubject(X500Principal aaCertSubject)`
Returns the VOMS Attribute Authority certificate held in this `VOMSTrustStore` whose subject matches the subject passed as argument.
`Map<String,Set<LSCInfo>>`
`getAllLSCInfo()`
Returns all the LSC information held in this `VOMSTrustStore`.
`List<X509Certificate>`
`getLocalAACertificates()`
Returns the list of VOMS Attribute Authority certificates held in this `VOMSTrustStore`.
`List<String>`
`getLocalTrustedDirectories()`
Returns the locally trusted directories where VOMS trust information (being VOMS server certificates or LSC files) are searched for.
`LSCInfo`
`getLSC(String voName, String hostname)`
Returns the LSC information held in this `VOMSTrustStore` for the vo and hostname passed as arguments.
`void`
`loadTrustInformation()`
Loads trust information from the sources configured for this trust store.
`void`
`setStatusListener(VOMSTrustStoreStatusListener statusListener)`
Sets a `VOMSTrustStoreStatusListener` that is notified of events related to this VOMS trust store

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_VOMS_DIR

public static final String DEFAULT_VOMS_DIR
The default directory where local VOMS trust information is rooted: "/etc/grid-security/vomsdir"

See Also:
  - Constant Field Values

### CERTIFICATE_FILENAME_SUFFIX

public static final String CERTIFICATE_FILENAME_SUFFIX
The filename suffix used to match certificates in the VOMS local trust directories

See Also:
  - Constant Field Values

### LSC_FILENAME_SUFFIX

public static final String LSC_FILENAME_SUFFIX
The filename suffix used to match LSC files in the VOMS local trust directories

See Also:
  - Constant Field Values

### rwLock

protected final ReadWriteLock rwLock
The read/write lock that implements thread safety for this store

### read

protected final Lock read
A reference to the read lock

### write

protected final Lock write
A reference to the write lock

### listenerLock

protected final Object listenerLock
A lock to guard the setting of the status listener

## Constructor Details

### DefaultVOMSTrustStore

public DefaultVOMSTrustStore(List<String> localTrustDirs, VOMSTrustStoreStatusListener listener)

Parameters:
  `localTrustDirs` - a non-null list of local trust directories
  `listener` - the `VOMSTrustStoreStatusListener` to use for this trust store
Throws:
  `IllegalArgumentException` - when the list passed as argument is null

### DefaultVOMSTrustStore

public DefaultVOMSTrustStore(List<String> localTrustDirs, List<String> voNames, VOMSTrustStoreStatusListener listener)

### DefaultVOMSTrustStore

public DefaultVOMSTrustStore(VOMSTrustStoreStatusListener listener)

### DefaultVOMSTrustStore

public DefaultVOMSTrustStore(List<String> localTrustDirs)

### DefaultVOMSTrustStore

public DefaultVOMSTrustStore()
Default constructor. Sets the local trusted directories to the default of "/etc/grid-security/vomsdir".

## Method Details

### buildDefaultTrustedDirs

protected static List<String> buildDefaultTrustedDirs()
Builds a list of trusted directories containing only `DEFAULT_VOMS_DIR`.

Returns:
  a list of default trusted directory containing the `DEFAULT_VOMS_DIR`

### getLocalTrustedDirectories

public List<String> getLocalTrustedDirectories()
Description copied from interface: `VOMSTrustStore`
Returns the locally trusted directories where VOMS trust information (being VOMS server certificates or LSC files) are searched for.

Specified by:
  `getLocalTrustedDirectories` in interface `VOMSTrustStore`
Returns:
  a `List` of local paths

### getLocalAACertificates

public List<X509Certificate> getLocalAACertificates()
Description copied from interface: `VOMSTrustStore`
Returns the list of VOMS Attribute Authority certificates held in this `VOMSTrustStore`.

Specified by:
  `getLocalAACertificates` in interface `VOMSTrustStore`
Returns:
  the collection of VOMS Attribute Authority certificates held in this `VOMSTrustStore`, an empty list if no certificate was found.

### getLSC

public LSCInfo getLSC(String voName, String hostname)
Description copied from interface: `VOMSTrustStore`
Returns the LSC information held in this `VOMSTrustStore` for the vo and hostname passed as arguments.

Specified by:
  `getLSC` in interface `VOMSTrustStore`
Parameters:
  `voName` - the name of the VO for which the LSC applies
  `hostname` - the name of the host for which the LSC applies
Returns:
  a `LSCInfo` object, or null if no LSC matching the arguments was found

### loadTrustInformation

public void loadTrustInformation()
Description copied from interface: `VOMSTrustStore`
Loads trust information from the sources configured for this trust store.

Specified by:
  `loadTrustInformation` in interface `VOMSTrustStore`

### getAACertificateBySubject

public X509Certificate getAACertificateBySubject(X500Principal aaCertSubject)
Description copied from interface: `VOMSTrustStore`
Returns the VOMS Attribute Authority certificate held in this `VOMSTrustStore` whose subject matches the subject passed as argument.

Specified by:
  `getAACertificateBySubject` in interface `VOMSTrustStore`
Parameters:
  `aaCertSubject` - a certificate subject
Returns:
  the VOMS AA `X509Certificate` that matches the subject passed as argument or null if no matching certificate is found in this store

### getAllLSCInfo

public Map<String,Set<LSCInfo>> getAllLSCInfo()
Description copied from interface: `VOMSTrustStore`
Returns all the LSC information held in this `VOMSTrustStore`. The returned `Map` is keyed by VO name.

Specified by:
  `getAllLSCInfo` in interface `VOMSTrustStore`
Returns:
  a possibly empty map `LSCInfo` objects

### setStatusListener

public void setStatusListener(VOMSTrustStoreStatusListener statusListener)
Description copied from interface: `VOMSTrustStore`
Sets a `VOMSTrustStoreStatusListener` that is notified of events related to this VOMS trust store

Specified by:
  `setStatusListener` in interface `VOMSTrustStore`
Parameters:
  `statusListener` - the status listener that will be notified