Class EdServiceTemplate

  • All Implemented Interfaces:
    EdOperation, EdService
    Direct Known Subclasses:
    EdId, EdLite

    public class EdServiceTemplate
    extends Object
    implements EdService
    Contains functions used by instances of ED which are intended for searching.
    Author:
    Middleware Services
    • Field Detail

      • MAPPER

        protected static final org.ldaptive.beans.reflect.DefaultLdapEntryMapper<Object> MAPPER
        Ldap entry MAPPER for object conversion.
    • Constructor Detail

      • EdServiceTemplate

        public EdServiceTemplate​(DirectoryType directoryType,
                                 DirectoryEnv env)
        This creates a new instance of an ED search client. initialize() must be called before this object can be used.
        Parameters:
        directoryType - directory type
        env - directory env
    • Method Detail

      • getType

        public DirectoryType getType()
        Description copied from interface: EdOperation
        Gets the class of directory this client operates on.
        Specified by:
        getType in interface EdOperation
        Returns:
        Directory type.
      • setType

        protected void setType​(DirectoryType dirType)
        Sets the directory type this ED client is configured to operate on.
        Parameters:
        dirType - Directory class type.
      • setEnvironment

        protected void setEnvironment​(DirectoryEnv dirEnv)
        Sets the directory environment this ED client is configured to operate on.
        Parameters:
        dirEnv - Directory environment.
      • initialize

        public void initialize()
        Initialize this search client for use.

        This method must be called after the directory type (setType(DirectoryType)) and environment (setEnvironment(DirectoryEnv)) are set and before any LDAP operations are performed. If the directory type and/or environment are changed, the search client must be re-initialized for the changes to take effect on the next LDAP operation.

      • close

        public void close()
        Close the connection pool used by the connection factory.
      • search

        public org.ldaptive.SearchResponse search​(String filter,
                                                  String... retAttrs)
                                           throws org.ldaptive.LdapException
        Description copied from interface: EdService
        Searches an ED with the supplied query and return attributes. See Operation.execute(org.ldaptive.Request).
        Specified by:
        search in interface EdService
        Parameters:
        filter - expression to use for the search
        retAttrs - attributes to return
        Returns:
        LDAP search results
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • getAttributes

        public Collection<org.ldaptive.LdapAttribute> getAttributes​(String dn,
                                                                    String... retAttrs)
                                                             throws org.ldaptive.LdapException
        Description copied from interface: EdService
        Gets the requested attributes of the object whose distinguished name is given. See LdapEntry.getAttributes().
        Specified by:
        getAttributes in interface EdService
        Parameters:
        dn - LDAP distinguished name of object whose attributes will be fetched.
        retAttrs - attributes to return
        Returns:
        ldap attributes
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • getDn

        public String getDn​(String authId)
                     throws org.ldaptive.LdapException
        Description copied from interface: EdService
        Gets the LDAP distinguished name for the supplied user.
        Specified by:
        getDn in interface EdService
        Parameters:
        authId - ED authId attribute value of user.
        Returns:
        value of user's distinguished name.
        Throws:
        org.ldaptive.LdapException - if the LDAP search fails
      • getGroupMembership

        public String[] getGroupMembership​(String uugidOrDn)
                                    throws org.ldaptive.LdapException
        Description copied from interface: EdService
        Gets the groups of which the given group is a member.
        Specified by:
        getGroupMembership in interface EdService
        Parameters:
        uugidOrDn - Group to search for parents; may be either UUGID or DN.
        Returns:
        Array of groups of which the given group is a member. Returns an empty array if the given group has member suppression enabled.
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • getMembers

        public String[] getMembers​(String uugidOrDn)
                            throws org.ldaptive.LdapException
        Description copied from interface: EdService
        Gets the members of the given group.
        Specified by:
        getMembers in interface EdService
        Parameters:
        uugidOrDn - UUGID or DN of group to search for members.
        Returns:
        Array of group member names. Returns an empty array if the given group has member suppression enabled.
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • getMemberOf

        public String[] getMemberOf​(String authId)
                             throws org.ldaptive.LdapException
        Description copied from interface: EdService
        Gets all the groups the supplied user is a member of.
        Specified by:
        getMemberOf in interface EdService
        Parameters:
        authId - ED authId attribute value of user.
        Returns:
        Array of group UUGID identifiers of which the given user is a member.
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • toGroupUugid

        protected static String toGroupUugid​(String uugidOrDn)
        Converts a group UUGID or DN to a group UUGID. Since the method makes the determination of the type of input, if given a UUGID it simply returns it.
        Parameters:
        uugidOrDn - Group UUGID or DN.
        Returns:
        Group UUGID.
      • toUusidDn

        protected static String toUusidDn​(String uusidOrDn)
        Converts a uusid to include the base DN.
        Parameters:
        uusidOrDn - Service UUSID or DN.
        Returns:
        uusid with the base DN, if uusidOrDn already includes the base DN then it simply returns it.
      • getVirginiaTechPerson

        public VirginiaTechPerson getVirginiaTechPerson​(String authId)
                                                 throws org.ldaptive.LdapException
        Description copied from interface: EdService
        This will query LDAP for the specified authId for a VirginiaTechPerson entry and return the LdapEntry mapped to a VirginiaTechPerson bean.
        Specified by:
        getVirginiaTechPerson in interface EdService
        Parameters:
        authId - ED authId attribute value of user.
        Returns:
        VirginiaTechPerson POJO representation of Ldap result.
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • getVirginiaTechGroup

        public VirginiaTechGroup getVirginiaTechGroup​(String uugidOrDn)
                                               throws org.ldaptive.LdapException
        Description copied from interface: EdService
        This will query LDAP for the specified uugidOrDn for a VirginiaTechGroup entry and return the LdapEntry mapped to a VirginiaTechGroup bean.
        Specified by:
        getVirginiaTechGroup in interface EdService
        Parameters:
        uugidOrDn - Group to search for; may be either UUGID or DN.
        Returns:
        VirginiaTechGroup POJO representation of Ldap result.
        Throws:
        org.ldaptive.LdapException - if the LDAP returns an error
      • getConnectionFactory

        public org.ldaptive.ConnectionFactory getConnectionFactory()
        Description copied from interface: EdOperation
        Gets the underlying connection factory.
        Specified by:
        getConnectionFactory in interface EdOperation
        Returns:
        Connection factory implementation.