org.apache.directory.api.ldap.model.message.Response Java Examples
The following examples show how to use
org.apache.directory.api.ldap.model.message.Response.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Dsmlv2ResponseGrammar.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void action( Dsmlv2Container container ) throws XmlPullParserException { AbstractDsmlMessageDecorator<? extends Response> response = ( AbstractDsmlMessageDecorator<? extends Response> ) container.getBatchResponse().getCurrentResponse(); if ( response instanceof SearchResponseDsml ) { SearchResponse searchResponse = ( SearchResponse ) response.getDecorated(); createAndAddControlValue( container, searchResponse.getSearchResultDone() ); } else { createAndAddControlValue( container, response ); } }
Example #2
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Process the IntermediateResponse received from the server * * @param intermediateResponse The IntermediateResponse to process * @param responseFuture The ResponseFuture to feed * @throws InterruptedException If the Future is interrupted */ private void intermediateReceived( IntermediateResponse intermediateResponse, ResponseFuture<? extends Response> responseFuture ) throws InterruptedException { // Store the response into the future if ( responseFuture instanceof SearchFuture ) { ( ( SearchFuture ) responseFuture ).set( intermediateResponse ); } else if ( responseFuture instanceof ExtendedFuture ) { ( ( ExtendedFuture ) responseFuture ).set( intermediateResponse ); } else { // currently we only support IR for search and extended operations throw new UnsupportedOperationException( I18n.err( I18n.ERR_04111_UNKNOWN_RESPONSE_FUTURE_TYPE, responseFuture.getClass().getName() ) ); } // Do not remove the future from the map, that's done when receiving search result done }
Example #3
Source File: SearchResponseDsml.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * 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( I18n.err( I18n.ERR_03045_UNIDENTIFIED_RESPONSE_TYPE ) ); } return responses.add( response ); }
Example #4
Source File: SearchCursorImpl.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Response get() throws InvalidCursorPositionException { if ( !available() ) { throw new InvalidCursorPositionException(); } return response; }
Example #5
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 AddResponse */ @Test public void testResponseWith2AddResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_AddResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof AddResponse ) { assertTrue( true ); } else { fail(); } }
Example #6
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 AuthResponse */ @Test public void testResponseWith2AuthResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_AuthResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof BindResponse ) { assertTrue( true ); } else { fail(); } }
Example #7
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 CompareResponse */ @Test public void testResponseWith2CompareResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_CompareResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof CompareResponse ) { assertTrue( true ); } else { fail(); } }
Example #8
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 DelResponse */ @Test public void testResponseWith2DelResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_DelResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof DeleteResponse ) { assertTrue( true ); } else { fail(); } }
Example #9
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 ErrorResponse */ @Test public void testResponseWith2ErrorResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_ErrorResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ErrorResponse ) { assertTrue( true ); } else { fail(); } }
Example #10
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 ExtendedResponse */ @Test public void testResponseWith2ExtendedResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_ExtendedResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ExtendedResponse ) { assertTrue( true ); } else { fail(); } }
Example #11
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 ModDNResponse */ @Test public void testResponseWith2ModDNResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_ModDNResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ModifyDnResponse ) { assertTrue( true ); } else { fail(); } }
Example #12
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 ModifyResponse */ @Test public void testResponseWith2ModifyResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_ModifyResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ModifyResponse ) { assertTrue( true ); } else { fail(); } }
Example #13
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 SearchResponse */ @Test public void testResponseWith2SearchResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_SearchResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response.getDecorated() instanceof SearchResponse ) { assertTrue( true ); } else { fail(); } }
Example #14
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 SearchResponse */ @Test public void testResponseWith1SearchResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_SearchResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response.getDecorated() instanceof SearchResponse ) { assertTrue( true ); } else { fail(); } }
Example #15
Source File: SearchCursorImpl.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * This operation is not supported in SearchCursor. * {@inheritDoc} */ @Override public void after( Response element ) throws LdapException, CursorException { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13102_UNSUPPORTED_OPERATION, getClass().getName() .concat( "." ).concat( "after( Response element )" ) ) ); }
Example #16
Source File: SearchCursorImpl.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * This operation is not supported in SearchCursor. * {@inheritDoc} */ @Override public void before( Response element ) throws LdapException, CursorException { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13102_UNSUPPORTED_OPERATION, getClass().getName() .concat( "." ).concat( "before( Response element )" ) ) ); }
Example #17
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 5 votes |
private void addToFutureMap( int messageId, ResponseFuture<? extends Response> future ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04106_ADDING, messageId, future.getClass().getName() ) ); } futureMap.put( messageId, future ); }
Example #18
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 5 votes |
private ResponseFuture<? extends Response> getFromFutureMap( int messageId ) { ResponseFuture<? extends Response> future = futureMap.remove( messageId ); if ( LOG.isDebugEnabled() && ( future != null ) ) { LOG.debug( I18n.msg( I18n.MSG_04126_REMOVING, messageId, future.getClass().getName() ) ); } return future; }
Example #19
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 5 votes |
private ResponseFuture<? extends Response> peekFromFutureMap( int messageId ) { ResponseFuture<? extends Response> future = futureMap.get( messageId ); // future can be null if there was a abandon operation on that messageId if ( LOG.isDebugEnabled() && ( future != null ) ) { LOG.debug( I18n.msg( I18n.MSG_04119_GETTING, messageId, future.getClass().getName() ) ); } return future; }
Example #20
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Internal AbandonRequest handling * * @param abandonRequest The request to abandon */ private void abandonInternal( AbandonRequest abandonRequest ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04104_SENDING_REQUEST, abandonRequest ) ); } int newId = messageId.incrementAndGet(); abandonRequest.setMessageId( newId ); // Send the request to the server ioSession.write( abandonRequest ); // remove the associated listener if any int abandonId = abandonRequest.getAbandoned(); ResponseFuture<? extends Response> rf = getFromFutureMap( abandonId ); // if the listener is not null, this is a async operation and no need to // send cancel signal on future, sending so will leave a dangling poision object in the corresponding queue // this is a sync operation send cancel signal to the corresponding ResponseFuture if ( rf != null ) { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04141_SENDING_CANCEL ) ); } rf.cancel( true ); } else { // this shouldn't happen if ( LOG.isWarnEnabled() ) { LOG.warn( I18n.msg( I18n.MSG_04165_NO_FUTURE_ASSOCIATED_TO_MSG_ID_COMPLETED, abandonId ) ); } } }
Example #21
Source File: AbstractPasswordPolicyResponder.java From directory-ldap-api with Apache License 2.0 | 5 votes |
private PasswordPolicyResponse getPasswordPolicy( Response response ) { Control control = response.getControls().get( passwordPolicyResponseControl.getOid() ); return control == null ? null : ( PasswordPolicyResponse ) control; }
Example #22
Source File: LdapDataProvider.java From directory-fortress-core with Apache License 2.0 | 5 votes |
/** * Get Password Policy Response Control from LDAP client. * * @param resp contains reference to LDAP pw policy response. * @return PasswordPolicy response control. */ protected PasswordPolicy getPwdRespCtrl( Response resp ) { Control control = resp.getControls().get( PP_REQ_CTRL.getOid() ); if ( control == null ) { return null; } return ( ( PasswordPolicyDecorator ) control ).getDecorated(); }
Example #23
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 ModDNResponse */ @Test public void testResponseWith1ModDNResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_ModDNResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ModifyDnResponse ) { assertTrue( true ); } else { fail(); } }
Example #24
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 ExtendedResponse */ @Test public void testResponseWith1ExtendedResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_ExtendedResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ExtendedResponse ) { assertTrue( true ); } else { fail(); } }
Example #25
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 ErrorResponse */ @Test public void testResponseWith1ErrorResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_ErrorResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ErrorResponse ) { assertTrue( true ); } else { fail(); } }
Example #26
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 DelResponse */ @Test public void testResponseWith1DelResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_DelResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof DeleteResponse ) { assertTrue( true ); } else { fail(); } }
Example #27
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 CompareResponse */ @Test public void testResponseWith1CompareResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_CompareResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof CompareResponse ) { assertTrue( true ); } else { fail(); } }
Example #28
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 AuthResponse */ @Test public void testResponseWith1AuthResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_AuthResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof BindResponse ) { assertTrue( true ); } else { fail(); } }
Example #29
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 AddResponse */ @Test public void testResponseWith1AddResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_AddResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof AddResponse ) { assertTrue( true ); } else { fail(); } }
Example #30
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 ModifyResponse */ @Test public void testResponseWith1ModifyResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_ModifyResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ModifyResponse ) { assertTrue( true ); } else { fail(); } }