Sun Adapter for LDAP API

com.stc.connector.ldapadapter.appconn
Class LDAPSearchControlsImpl

java.lang.Object
  extended by com.stc.connector.ldapadapter.appconn.LDAPSearchControlsImpl
All Implemented Interfaces:
LDAPSearchControls

public class LDAPSearchControlsImpl
extends java.lang.Object
implements LDAPSearchControls

This class is used to set the controls to be used while executing a search operation. Currently only SortControl & PagedResultsControl are supported.

Version:
$Revision: 1.6 $
Author:

Constructor Summary
protected LDAPSearchControlsImpl(LDAPClientApplicationImpl app)
          Creates a new instance of LDAPSearchControls
 
Method Summary
 java.util.HashMap getControls()
          Method to retrieve the Controls set
 boolean getPageControlCriticality()
          Method to retrieve the criticality set for the PagedResultsControl
 int getPageSize()
          Method to retrieve the page size set for the search operation
 java.lang.String getSortAttributes()
          Method to retrieve the list of attributes based on which the result is to be sorted
 boolean getSortControlCriticality()
          Method to retrieve the criticality set for the SortControl
static byte[] parseControls(javax.naming.ldap.Control[] controls)
           
 void removePagedResultsControl()
          Method to remove the PagedResultsControl from the context
 void removeSortControl()
          Method to remove the SortControl from the context
 void reset()
          Method to reset the values
 void setPageControlCriticality(boolean pageControlCriticality)
          Method to set the criticality for the PagedResultsControl.
 void setPagedResultsControl()
          Method to set the PagedResultsControl to the context.
 void setPageSize(int pageSize)
          Method to set the page size for the search operation
 void setSortAttributes(java.lang.String sortAttributes)
          Method to set the list of attributes based on which the result is to be sorted
 void setSortControl()
          Method to set the SortControl to the context.
 void setSortControlCriticality(boolean sortControlCriticality)
          Method to set the criticality for the SortControl.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPSearchControlsImpl

protected LDAPSearchControlsImpl(LDAPClientApplicationImpl app)
Creates a new instance of LDAPSearchControls

Parameters:
app - The LDAP client application associated with this LDAPSearchControls instance.
Method Detail

reset

public void reset()
Description copied from interface: LDAPSearchControls
Method to reset the values

Specified by:
reset in interface LDAPSearchControls

getSortAttributes

public java.lang.String getSortAttributes()
                                   throws LDAPApplicationException
Method to retrieve the list of attributes based on which the result is to be sorted

Specified by:
getSortAttributes in interface LDAPSearchControls
Returns:
a String that contains the list of attributes delimited by '|' symbol.
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

setSortAttributes

public void setSortAttributes(java.lang.String sortAttributes)
                       throws LDAPApplicationException
Method to set the list of attributes based on which the result is to be sorted

Specified by:
setSortAttributes in interface LDAPSearchControls
Parameters:
a - String that contains the list of attributes delimited by '|' symbol.
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

getSortControlCriticality

public boolean getSortControlCriticality()
                                  throws LDAPApplicationException
Method to retrieve the criticality set for the SortControl

Specified by:
getSortControlCriticality in interface LDAPSearchControls
Returns:
true if the SortControl is set as CRITICAL
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

setSortControlCriticality

public void setSortControlCriticality(boolean sortControlCriticality)
                               throws LDAPApplicationException
Method to set the criticality for the SortControl. This method checks if SortControl is supported by the LDAP server and sets the criticality accordingly. If the LDAP server does not support SortControl, the criticality is set as NONCRITICAL even if the user specifies the criticality as CRITICAL.

Specified by:
setSortControlCriticality in interface LDAPSearchControls
Parameters:
true - for setting the SortControl as CRITICAL
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

getPageSize

public int getPageSize()
                throws LDAPApplicationException
Method to retrieve the page size set for the search operation

Specified by:
getPageSize in interface LDAPSearchControls
Returns:
an integer value representing the page size
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

setPageSize

public void setPageSize(int pageSize)
                 throws LDAPApplicationException
Method to set the page size for the search operation

Specified by:
setPageSize in interface LDAPSearchControls
Parameters:
an - integer value representing the page size
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

getPageControlCriticality

public boolean getPageControlCriticality()
                                  throws LDAPApplicationException
Method to retrieve the criticality set for the PagedResultsControl

Specified by:
getPageControlCriticality in interface LDAPSearchControls
Returns:
true if the PagedResultsControl is set as CRITICAL
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

setPageControlCriticality

public void setPageControlCriticality(boolean pageControlCriticality)
                               throws LDAPApplicationException
Method to set the criticality for the PagedResultsControl. This method checks if PagedResultsControl is supported by the LDAP server and sets the criticality accordingly. If the LDAP server does not support PagedResultsControl, the criticality is set as NONCRITICAL even if the user specifies the criticality as CRITICAL.

Specified by:
setPageControlCriticality in interface LDAPSearchControls
Parameters:
true - for setting the PagedResultsControl as CRITICAL
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

setSortControl

public void setSortControl()
                    throws LDAPApplicationException
Method to set the SortControl to the context. For internal use. Not exposed to the client.

Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

setPagedResultsControl

public void setPagedResultsControl()
                            throws LDAPApplicationException
Method to set the PagedResultsControl to the context. For internal use. Not exposed to the client.

Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

removeSortControl

public void removeSortControl()
                       throws LDAPApplicationException
Method to remove the SortControl from the context

Specified by:
removeSortControl in interface LDAPSearchControls
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

removePagedResultsControl

public void removePagedResultsControl()
                               throws LDAPApplicationException
Method to remove the PagedResultsControl from the context

Specified by:
removePagedResultsControl in interface LDAPSearchControls
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

getControls

public java.util.HashMap getControls()
                              throws LDAPApplicationException
Method to retrieve the Controls set

Specified by:
getControls in interface LDAPSearchControls
Throws:
LDAPApplicationException - if there is no connection is available to the LDAP server.

parseControls

public static byte[] parseControls(javax.naming.ldap.Control[] controls)
                            throws javax.naming.NamingException
Throws:
javax.naming.NamingException

Sun Adapter for LDAP API