当前位置: 首页>>代码示例>>Java>>正文


Java SearchResultDone类代码示例

本文整理汇总了Java中org.apache.directory.api.ldap.model.message.SearchResultDone的典型用法代码示例。如果您正苦于以下问题:Java SearchResultDone类的具体用法?Java SearchResultDone怎么用?Java SearchResultDone使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SearchResultDone类属于org.apache.directory.api.ldap.model.message包,在下文中一共展示了SearchResultDone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addResponse

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Adds a response.
 *
 * @param response
 *      the response to add
 * @return
 *      true (as per the general contract of the Collection.add method).
 */
public boolean addResponse( DsmlDecorator<? extends Response> response )
{
    if ( response instanceof SearchResultEntry )
    {
        ( ( SearchResponse ) getDecorated() ).addSearchResultEntry(
            ( SearchResultEntryDsml ) response );
    }
    else if ( response instanceof SearchResultReference )
    {
        ( ( SearchResponse ) getDecorated() ).addSearchResultReference(
            ( SearchResultReferenceDsml ) response );
    }
    else if ( response instanceof SearchResultDone )
    {
        ( ( SearchResponse ) getDecorated() ).setSearchResultDone(
            ( SearchResultDoneDsml ) response );
    }
    else
    {
        throw new IllegalArgumentException( "Unidentified search resp type" );
    }

    return responses.add( response );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:SearchResponseDsml.java

示例2: testResponseWithRequestId

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a Response with the (optional) requestID attribute
 */
@Test
public void testResponseWithRequestId()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_requestID_attribute.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();

    assertEquals( 456, searchResultDone.getMessageId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:SearchResultDoneTest.java

示例3: removeResponse

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Removes a response.
 *
 * @param response
 *      the response to remove
 * @return
 *      true if this list contained the specified element.
 */
public boolean removeResponse( DsmlDecorator<? extends Response> response )
{
    if ( response instanceof SearchResultEntry )
    {
        ( ( SearchResponse ) getDecorated() ).removeSearchResultEntry(
            ( SearchResultEntryDsml ) response );
    }
    else if ( response instanceof SearchResultReference )
    {
        ( ( SearchResponse ) getDecorated() ).removeSearchResultReference(
            ( SearchResultReferenceDsml ) response );
    }
    else if ( response instanceof SearchResultDone )
    {
        if ( response.equals( ( ( SearchResponse ) getDecorated() ).getSearchResultDone() ) )
        {
            ( ( SearchResponse ) getDecorated() ).setSearchResultDone( null );
        }
    }
    else
    {
        throw new IllegalArgumentException( "Unidentified search resp type" );
    }

    return responses.remove( response );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:SearchResponseDsml.java

示例4: testResponseWith1Control

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with a (optional) Control element
 */
@Test
public void testResponseWith1Control()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_1_control.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();
    Map<String, Control> controls = searchResultDone.getControls();

    assertEquals( 1, searchResultDone.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertEquals( "Some text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:SearchResultDoneTest.java

示例5: testResponseWith1ControlEmptyValue

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with a (optional) Control element with empty value
 */
@Test
public void testResponseWith1ControlEmptyValue()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_1_control_empty_value.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();
    Map<String, Control> controls = searchResultDone.getControls();

    assertEquals( 1, searchResultDone.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:SearchResultDoneTest.java

示例6: testResponseWith2Controls

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with 2 (optional) Control elements
 */
@Test
public void testResponseWith2Controls()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_2_controls.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();
    Map<String, Control> controls = searchResultDone.getControls();

    assertEquals( 2, searchResultDone.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.789" );

    assertNotNull( control );
    assertFalse( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
    assertEquals( "Some other text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:SearchResultDoneTest.java

示例7: testResponseWith3ControlsWithoutValue

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with 3 (optional) Control elements without value
 */
@Test
public void testResponseWith3ControlsWithoutValue()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_3_controls_without_value.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse )
        parser.getBatchResponse().getCurrentResponse().getDecorated() )
            .getSearchResultDone();
    Map<String, Control> controls = searchResultDone.getControls();

    assertEquals( 3, searchResultDone.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.456" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
    assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:SearchResultDoneTest.java

示例8: testResponseWithResultCode

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with Result Code
 */
@Test
public void testResponseWithResultCode()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_result_code.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse )
        parser.getBatchResponse().getCurrentResponse().getDecorated() )
            .getSearchResultDone();

    LdapResult ldapResult = searchResultDone.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:SearchResultDoneTest.java

示例9: testResponseWithErrorMessage

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with Error Message
 */
@Test
public void testResponseWithErrorMessage()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_error_message.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();

    LdapResult ldapResult = searchResultDone.getLdapResult();

    assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult
        .getDiagnosticMessage() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:31,代码来源:SearchResultDoneTest.java

示例10: testResponseWithEmptyErrorMessage

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with empty Error Message
 */
@Test
public void testResponseWithEmptyErrorMessage()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_empty_error_message.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();

    LdapResult ldapResult = searchResultDone.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:SearchResultDoneTest.java

示例11: testResponseWith1EmptyReferral

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with an empty Referral
 */
@Test
public void testResponseWith1EmptyReferral()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_1_empty_referral.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse )
        parser.getBatchResponse().getCurrentResponse().getDecorated() )
            .getSearchResultDone();

    LdapResult ldapResult = searchResultDone.getLdapResult();

    Collection<String> referrals = ldapResult.getReferral().getLdapUrls();

    assertEquals( 0, referrals.size() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:32,代码来源:SearchResultDoneTest.java

示例12: testResponseWithMatchedDNAttribute

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Test parsing of a response with MatchedDN attribute
 */
@Test
public void testResponseWithMatchedDNAttribute()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultDoneTest.class.getResource( "response_with_matchedDN_attribute.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchResultDone searchResultDone = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getSearchResultDone();

    LdapResult ldapResult = searchResultDone.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:SearchResultDoneTest.java

示例13: get

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Entry get() throws CursorException
{
    if ( !searchCursor.available() )
    {
        throw new InvalidCursorPositionException();
    }

    try
    {
        do
        {
            if ( response instanceof SearchResultEntry )
            {
                return ( ( SearchResultEntry ) response ).getEntry();
            }

            if ( response instanceof SearchResultReference )
            {
                throw new LdapReferralException( ( ( SearchResultReference ) response ).getReferral().getLdapUrls() );
            }
        }
        while ( next() && !( response instanceof SearchResultDone ) );
    }
    catch ( LdapReferralException lre )
    {
        throw new CursorLdapReferralException( lre );
    }
    catch ( Exception e )
    {
        throw new CursorException( e );
    }

    return null;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:39,代码来源:EntryCursorImpl.java

示例14: setSearchHandlers

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Inject the MessageReceived and MessageSent handler into the IoHandler
 * 
 * @param searchRequestHandler The SearchRequest message received handler
 * @param searchResultEntryHandler The SearchResultEntry message sent handler
 * @param searchResultReferenceHandler The SearchResultReference message sent handler
 * @param searchResultDoneHandler The SearchResultDone message sent handler
 */
public void setSearchHandlers( LdapRequestHandler<SearchRequest> searchRequestHandler,
    LdapResponseHandler<SearchResultEntry> searchResultEntryHandler,
    LdapResponseHandler<SearchResultReference> searchResultReferenceHandler,
    LdapResponseHandler<SearchResultDone> searchResultDoneHandler
    )
{
    this.handler.removeReceivedMessageHandler( SearchRequest.class );
    this.searchRequestHandler = searchRequestHandler;
    this.searchRequestHandler.setLdapServer( this );
    this.handler.addReceivedMessageHandler( SearchRequest.class, this.searchRequestHandler );

    this.handler.removeSentMessageHandler( SearchResultEntry.class );
    this.searchResultEntryHandler = searchResultEntryHandler;
    this.searchResultEntryHandler.setLdapServer( this );
    this.handler.addSentMessageHandler( SearchResultEntry.class, this.searchResultEntryHandler );

    this.handler.removeSentMessageHandler( SearchResultReference.class );
    this.searchResultReferenceHandler = searchResultReferenceHandler;
    this.searchResultReferenceHandler.setLdapServer( this );
    this.handler.addSentMessageHandler( SearchResultReference.class, this.searchResultReferenceHandler );

    this.handler.removeSentMessageHandler( SearchResultDone.class );
    this.searchResultDoneHandler = searchResultDoneHandler;
    this.searchResultDoneHandler.setLdapServer( this );
    this.handler.addSentMessageHandler( SearchResultDone.class, this.searchResultDoneHandler );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:35,代码来源:LdapServer.java

示例15: handlePersistentSearch

import org.apache.directory.api.ldap.model.message.SearchResultDone; //导入依赖的package包/类
/**
 * Handles search requests containing the persistent search decorator but
 * delegates to doSimpleSearch() if the changesOnly parameter of the
 * decorator is set to false.
 *
 * @param session the LdapSession for which this search is conducted
 * @param req the search request containing the persistent search decorator
 * @param psearchDecorator the persistent search decorator extracted
 * @throws Exception if failures are encountered while searching
 */
private void handlePersistentSearch( LdapSession session, SearchRequest req,
    PersistentSearch psearch ) throws Exception
{
    /*
     * We want the search to complete first before we start listening to
     * events when the decorator does NOT specify changes ONLY mode.
     */
    if ( !psearch.isChangesOnly() )
    {
        SearchResultDone done = doSimpleSearch( session, req );

        // ok if normal search beforehand failed somehow quickly abandon psearch
        if ( done.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
        {
            session.getIoSession().write( done );
            return;
        }
    }

    if ( req.isAbandoned() )
    {
        return;
    }

    // now we process entries forever as they change
    PersistentSearchListener persistentSearchListener = new PersistentSearchListener( session, req );

    // compose notification criteria and add the listener to the event
    // service using that notification criteria to determine which events
    // are to be delivered to the persistent search issuing client
    NotificationCriteria criteria = new NotificationCriteria();
    criteria.setAliasDerefMode( req.getDerefAliases() );
    criteria.setBase( req.getBase() );
    criteria.setFilter( req.getFilter() );
    criteria.setScope( req.getScope() );
    criteria.setEventMask( EventType.getEventTypes( psearch.getChangeTypes() ) );
    getLdapServer().getDirectoryService().getEventService().addListener( persistentSearchListener, criteria );
    req.addAbandonListener( new SearchAbandonListener( ldapServer, persistentSearchListener ) );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:50,代码来源:SearchRequestHandler.java


注:本文中的org.apache.directory.api.ldap.model.message.SearchResultDone类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。