org.openpermis.repository.basic
Class UrlSubjectRepository

java.lang.Object
  extended by org.openpermis.repository.basic.AbstractSubjectRepository
      extended by org.openpermis.repository.basic.StreamSubjectRepository
          extended by org.openpermis.repository.basic.UrlSubjectRepository
All Implemented Interfaces:
SubjectRepository

public class UrlSubjectRepository
extends StreamSubjectRepository

A subject repository containing certificates from a list of URLs.

Since:
0.3.0

Field Summary
private static org.slf4j.Logger LOGGER
          The logger object of this class.
 
Constructor Summary
UrlSubjectRepository(CertificateVerifier certificateVerifier, URL... urls)
          Creates a file directory subject repository from directory and the specified certificate verifier.
 
Method Summary
private  void addAttributeCertificate(URL url)
          Adds an attribute certificate for the specified file.
static UrlSubjectRepository createClasspathSubjectRepository(CertificateVerifier certificateVerifier, Class<?> clazz, String... resources)
          Creates a subject repository for a list of attribute certificates loaded as resources from a class loader.
static UrlSubjectRepository createClasspathSubjectRepository(CertificateVerifier certificateVerifier, ClassLoader classLoader, String... resources)
          Creates a subject repository for a list of attribute certificates loaded as resources from a class loader.
 
Methods inherited from class org.openpermis.repository.basic.StreamSubjectRepository
addAttributeCertificate, addAttributeCertificate, retrieveSubject
 
Methods inherited from class org.openpermis.repository.basic.AbstractSubjectRepository
updateSubjectMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
The logger object of this class.

Since:
0.3.0
Constructor Detail

UrlSubjectRepository

public UrlSubjectRepository(CertificateVerifier certificateVerifier,
                            URL... urls)
                     throws SubjectRepositoryException
Creates a file directory subject repository from directory and the specified certificate verifier.

Parameters:
certificateVerifier - the certificate verifier user to verify the the attribute certificates, must not be null.
urls - a list of URLs pointing to attribute certificates to be added, must not be null.
Throws:
SubjectRepositoryException - if the repository cannot be built.
Since:
0.3.0
Method Detail

createClasspathSubjectRepository

public static UrlSubjectRepository createClasspathSubjectRepository(CertificateVerifier certificateVerifier,
                                                                    ClassLoader classLoader,
                                                                    String... resources)
                                                             throws SubjectRepositoryException
Creates a subject repository for a list of attribute certificates loaded as resources from a class loader.

Uses the Thread.getContextClassLoader() as a fallback if a resource cannot be retrieved using the specified class loader.

Parameters:
certificateVerifier - the certificate verifier user to verify the the attribute certificates, must not be null.
classLoader - the class loader to use for retrieving the resource URLs.
resources - list of resource locations to process, must not be null or empty.
See Also:
ClassLoader.getResource(String)
Returns:
the subject repository created.
Throws:
SubjectRepositoryException - if the repository cannot be built or if there is a problem retrieving a resource.
Since:
0.3.0

createClasspathSubjectRepository

public static UrlSubjectRepository createClasspathSubjectRepository(CertificateVerifier certificateVerifier,
                                                                    Class<?> clazz,
                                                                    String... resources)
                                                             throws SubjectRepositoryException
Creates a subject repository for a list of attribute certificates loaded as resources from a class loader.

Parameters:
certificateVerifier - the certificate verifier user to verify the the attribute certificates, must not be null.
clazz - the class to use for retrieving the resource URLs.
resources - list of resource locations to process, must not be null or empty.
See Also:
Class.getResource(String)
Returns:
the subject repository created.
Throws:
SubjectRepositoryException - if the repository cannot be built or if there is a problem retrieving a resource.
Since:
0.3.0

addAttributeCertificate

private void addAttributeCertificate(URL url)
                              throws NoSuchAlgorithmException,
                                     NoSuchProviderException,
                                     IOException
Adds an attribute certificate for the specified file.

Parameters:
url - the URL that points to a resource that contains the DER encoded attribute certificate, must not be null.
See Also:
StreamSubjectRepository.addAttributeCertificate(InputStream)
Throws:
NoSuchAlgorithmException - passed on.
NoSuchProviderException - passed on.
IOException - if the URL stream cannot be opened or StreamSubjectRepository.addAttributeCertificate(InputStream) reports an error.
Since:
0.3.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:22
Copyright (c) 2002-2007 Ergon Informatik AG