本文整理汇总了Java中javax.naming.ldap.PagedResultsControl类的典型用法代码示例。如果您正苦于以下问题:Java PagedResultsControl类的具体用法?Java PagedResultsControl怎么用?Java PagedResultsControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PagedResultsControl类属于javax.naming.ldap包,在下文中一共展示了PagedResultsControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareNextPage
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
private boolean prepareNextPage(LdapContext ldapContext) throws Exception {
Control[] responseControls = ldapContext.getResponseControls();
byte[] cookie = null;
if (responseControls != null) {
for (Control responseControl : responseControls) {
if (responseControl instanceof PagedResultsResponseControl) {
PagedResultsResponseControl prrc = (PagedResultsResponseControl) responseControl;
cookie = prrc.getCookie();
}
}
}
if (cookie == null) {
return false;
} else {
ldapContext.setRequestControls(new Control[]{new PagedResultsControl(pageSize, cookie, Control.CRITICAL)});
return true;
}
}
示例2: pagedSearch
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
private List<SearchResult> pagedSearch(LdapContext ldapContext, String searchFilter) throws Exception {
List<SearchResult> data = new ArrayList<SearchResult>();
log.trace("Using paged ldap search, pageSize={}", pageSize);
Control[] requestControls = new Control[]{new PagedResultsControl(pageSize, Control.CRITICAL)};
ldapContext.setRequestControls(requestControls);
do {
List<SearchResult> pageResult = simpleSearch(ldapContext, searchFilter);
data.addAll(pageResult);
log.trace("Page returned {} entries", pageResult.size());
} while (prepareNextPage(ldapContext));
if (log.isDebugEnabled()) {
log.debug("Found a total of {} entries for ldap filter {}", data.size(), searchFilter);
}
return data;
}
示例3: supportsSearchResultPaging
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
private boolean supportsSearchResultPaging()
throws ChaiUnavailableException, ChaiOperationException
{
final String enableSettingStr = this.getChaiConfiguration().getSetting( ChaiSetting.LDAP_SEARCH_PAGING_ENABLE );
if ( "auto".equalsIgnoreCase( enableSettingStr ) )
{
if ( cachedPagingEnableSupport == null )
{
final ChaiEntry rootDse = ChaiUtility.getRootDSE( this );
final Set<String> supportedControls = rootDse.readMultiStringAttribute( "supportedControl" );
cachedPagingEnableSupport = supportedControls.contains( PagedResultsControl.OID );
}
return cachedPagingEnableSupport;
}
return Boolean.parseBoolean( enableSettingStr );
}
示例4: setRequestControls
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* Set the standard request controls
*/
private void setRequestControls(byte[] cookie) throws TranslatorException {
List<Control> ctrl = new ArrayList<Control>();
SortKey[] keys = searchDetails.getSortKeys();
try {
if (keys != null) {
ctrl.add(new SortControl(keys, Control.NONCRITICAL));
}
if (this.executionFactory.usePagination()) {
ctrl.add(new PagedResultsControl(this.executionContext.getBatchSize(), cookie, Control.CRITICAL));
}
if (!ctrl.isEmpty()) {
this.ldapCtx.setRequestControls(ctrl.toArray(new Control[ctrl.size()]));
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Sort/pagination controls were created successfully."); //$NON-NLS-1$
}
} catch (NamingException ne) {
final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.setControlsError") + //$NON-NLS-1$
" : "+ne.getExplanation(); //$NON-NLS-1$
throw new TranslatorException(ne, msg);
} catch(IOException e) {
throw new TranslatorException(e);
}
}
示例5: getCookie
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
private byte[] getCookie(final LdapContext ctx) throws NamingException, IOException {
byte[] cookie = null;
// Examine the paged results control response
final Control[] controls = ctx.getResponseControls();
if (controls != null) {
for (int i = 0; i < controls.length; i++) {
if (controls[i] instanceof PagedResultsResponseControl) {
final PagedResultsResponseControl prrc = (PagedResultsResponseControl) controls[i];
cookie = prrc.getCookie();
}
}
}
// Re-activate paged results
ctx.setRequestControls(new Control[] { new PagedResultsControl(PAGE_SIZE, cookie, Control.CRITICAL) });
return cookie;
}
示例6: testPagedResultsControlIntBoolean001
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntBoolean001() {
try {
PagedResultsControl prc=new PagedResultsControl(0,false);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例7: testPagedResultsControlIntBoolean002
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntBoolean002() {
try {
PagedResultsControl prc=new PagedResultsControl(0,true);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例8: testPagedResultsControlIntBoolean003
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntBoolean003() {
try {
PagedResultsControl prc=new PagedResultsControl(100,false);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例9: testPagedResultsControlIntBoolean004
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntBoolean004() {
try {
PagedResultsControl prc=new PagedResultsControl(100,true);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例10: testPagedResultsControlIntBoolean005
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntBoolean005() {
try {
PagedResultsControl prc=new PagedResultsControl(1000000,false);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例11: testPagedResultsControlIntBoolean006
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntBoolean006() {
try {
PagedResultsControl prc=new PagedResultsControl(1000000,true);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例12: testPagedResultsControlIntByteArrayBoolean001
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, byte[], boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntByteArrayBoolean001() {
try {
PagedResultsControl prc=new PagedResultsControl(0,null,true);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例13: testPagedResultsControlIntByteArrayBoolean002
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, byte[], boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntByteArrayBoolean002() {
try {
PagedResultsControl prc=new PagedResultsControl(0,null,false);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例14: testPagedResultsControlIntByteArrayBoolean003
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, byte[], boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntByteArrayBoolean003() {
try {
byte[] by={10,10};
PagedResultsControl prc=new PagedResultsControl(10,by,true);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}
示例15: testPagedResultsControlIntByteArrayBoolean004
import javax.naming.ldap.PagedResultsControl; //导入依赖的package包/类
/**
* <p>Test method for 'javax.naming.ldap.PagedResultsControl.PagedResultsControl(int, byte[], boolean)'</p>
* <p>Here we are testing if this method constructs a control to set the number of entries to be returned per page of results.</p>
* <p>The expected result is an instance of this class.</p>
*/
public void testPagedResultsControlIntByteArrayBoolean004() {
try {
byte[] by={10,10};
PagedResultsControl prc=new PagedResultsControl(10,by,false);
assertNotNull(prc);
} catch (IOException e) {
fail("Failed with:"+e);
}
}