Class DataStore


  • public class DataStore
    extends Object
    This class *talks* to SMS to get the configuration information.
    • Method Detail

      • getInstance

        public static DataStore getInstance()
      • getPrivilegeDistinguishedName

        public static String getPrivilegeDistinguishedName​(String name,
                                                           String realm,
                                                           String indexName)
        Returns distingished name of a privilege.
        Parameters:
        name - Privilege name.
        realm - Realm name.
        indexName - Index name.
        Returns:
        the distingished name of a privilege.
      • getSearchBaseDN

        public static String getSearchBaseDN​(String realm,
                                             String indexName)
        Returns the base search DN.
        Parameters:
        realm - Realm name.
        indexName - Index name.
        Returns:
        the base search DN.
      • getNumberOfPolicies

        public static int getNumberOfPolicies()
      • getNumberOfReferrals

        public static int getNumberOfReferrals()
      • getNumberOfPolicies

        public static int getNumberOfPolicies​(String realm)
      • getNumberOfReferrals

        public static int getNumberOfReferrals​(String realm)
      • add

        public String add​(Subject adminSubject,
                          String realm,
                          Privilege p)
                   throws EntitlementException
        Adds a privilege.
        Parameters:
        adminSubject - Admin Subject who has the rights to write to datastore.
        realm - Realm name.
        p - Privilege object.
        Returns:
        the DN of added privilege.
        Throws:
        EntitlementException - if privilege cannot be added.
      • addReferral

        public String addReferral​(Subject adminSubject,
                                  String realm,
                                  ReferralPrivilege referral)
                           throws EntitlementException
        Adds a referral.
        Parameters:
        adminSubject - Admin Subject who has the rights to write to datastore.
        realm - Realm name.
        referral - Referral Privilege object.
        Returns:
        the DN of added privilege.
        Throws:
        EntitlementException - if privilege cannot be added.
      • remove

        public void remove​(Subject adminSubject,
                           String realm,
                           String name)
                    throws EntitlementException
        Removes privilege.
        Parameters:
        adminSubject - Admin Subject who has the rights to write to datastore.
        realm - Realm name.
        name - Privilege name.
        Throws:
        EntitlementException - if privilege cannot be removed.
      • removeReferral

        public void removeReferral​(Subject adminSubject,
                                   String realm,
                                   String name)
                            throws EntitlementException
        Removes referral privilege.
        Parameters:
        adminSubject - Admin Subject who has the rights to write to datastore.
        realm - Realm name.
        name - Referral privilege name.
        Throws:
        EntitlementException - if privilege cannot be removed.
      • search

        public Set<String> search​(Subject adminSubject,
                                  String realm,
                                  String filter,
                                  int numOfEntries,
                                  boolean sortResults,
                                  boolean ascendingOrder)
                           throws EntitlementException
        Returns a set of privilege names that satifies a search filter.
        Parameters:
        adminSubject - Subject who has the rights to read datastore.
        realm - Realm name
        filter - Search filter.
        numOfEntries - Number of max entries.
        sortResults - true to have result sorted.
        ascendingOrder - true to have result sorted in ascending order.
        Returns:
        a set of privilege names that satifies a search filter.
        Throws:
        EntitlementException - if search failed.
      • searchReferral

        public Set<String> searchReferral​(Subject adminSubject,
                                          String realm,
                                          String filter,
                                          int numOfEntries,
                                          boolean sortResults,
                                          boolean ascendingOrder)
                                   throws EntitlementException
        Returns a set of referral privilege names that satifies a search filter.
        Parameters:
        adminSubject - Subject who has the rights to read datastore.
        realm - Realm name
        filter - Search filter.
        numOfEntries - Number of max entries.
        sortResults - true to have result sorted.
        ascendingOrder - true to have result sorted in ascending order.
        Returns:
        a set of privilege names that satifies a search filter.
        Throws:
        EntitlementException - if search failed.
      • search

        public Set<IPrivilege> search​(Subject adminSubject,
                                      String realm,
                                      BufferedIterator iterator,
                                      ResourceSearchIndexes indexes,
                                      Set<String> subjectIndexes,
                                      boolean bSubTree,
                                      Set<String> excludeDNs)
                               throws EntitlementException
        Returns a set of privilege that satifies the resource and subject indexes.
        Parameters:
        adminSubject - Subject who has the rights to read datastore.
        realm - Realm name
        iterator - Buffered iterator to have the result fed to it.
        indexes - Resource search indexes.
        subjectIndexes - Subject search indexes.
        bSubTree - true to do sub tree search
        excludeDNs - Set of DN to be excluded from the search results.
        Returns:
        a set of privilege that satifies the resource and subject indexes.
        Throws:
        EntitlementException
      • getPrivilege

        public IPrivilege getPrivilege​(String realm,
                                       String privilegeIdentifier)
                                throws EntitlementException
        Retrieves an individual privilege from the data store. The privilege is returned by the method and also added to the passed in iterator.
        Parameters:
        realm - Realm in which the privilege exists.
        privilegeIdentifier - The identifier of the privilege to retrieve.
        Returns:
        the privilege.
        Throws:
        EntitlementException - if there were issues retrieving the privilege from the data store.
      • searchReferral

        public Set<ReferralPrivilege> searchReferral​(SSOToken adminToken,
                                                     String realm,
                                                     BufferedIterator iterator,
                                                     ResourceSearchIndexes indexes,
                                                     boolean bSubTree,
                                                     Set<String> excludeDNs)
                                              throws EntitlementException
        Returns a set of referral privilege that satifies the resource and subject indexes.
        Parameters:
        adminToken - Subject who has the rights to read datastore.
        realm - Realm name
        iterator - Buffered iterator to have the result fed to it.
        indexes - Resource search indexes.
        bSubTree - true to do sub tree search
        excludeDNs - Set of DN to be excluded from the search results.
        Returns:
        a set of privilege that satifies the resource and subject indexes.
        Throws:
        EntitlementException