Package org.apache.directory.api.dsmlv2.reponse

Examples of org.apache.directory.api.dsmlv2.reponse.ExtendedResponseDsml


     */
    private String processAsDsmlRequest( StudioNamingEnumeration ne, StudioProgressMonitor monitor )
        throws NamingException, LdapException
    {
        // Creating the batch request
        BatchRequestDsml batchRequest = new BatchRequestDsml();

        try
        {
            int count = 0;

            if ( !monitor.errorsReported() )
            {
                // Creating and adding an add request for each result
                while ( ne.hasMore() )
                {
                    SearchResult searchResult = ( SearchResult ) ne.next();
                    AddRequestDsml arDsml = convertToAddRequestDsml( searchResult );
                    batchRequest.addRequest( arDsml );

                    count++;
                    monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__export_progress,
                        new String[]
                            { Integer.toString( count ) } ) );
                }
            }
        }
        catch ( NamingException e )
        {
            int ldapStatusCode = JNDIUtils.getLdapStatusCode( e );
            if ( ldapStatusCode == 3 || ldapStatusCode == 4 || ldapStatusCode == 11 )
            {
                // ignore
            }
            else
            {
                monitor.reportError( e );
            }
        }

        // Returning the associated DSML
        return batchRequest.toDsml();
    }
View Full Code Here


                throw new XmlPullParserException( I18n.err( I18n.ERR_03037, e.getLocalizedMessage() ), xpp, null );
            }
        }
        while ( container.getState() != Dsmlv2StatesEnum.BATCHREQUEST_START_TAG );

        BatchRequestDsml br = container.getBatchRequest();

        if ( br != null )
        {
            br.setStoreReq( storeMsgInBatchReq );
        }
    }
View Full Code Here

     */
    public Dsmlv2Parser( boolean storeMsgInBatchReq ) throws XmlPullParserException
    {
        this.storeMsgInBatchReq = storeMsgInBatchReq;

        this.grammar = new Dsmlv2Grammar();
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );

        this.container.setGrammar( grammar );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
View Full Code Here

        monitor.worked( 1 );

        try
        {
            // Parsing the file
            Dsmlv2Grammar grammar = new Dsmlv2Grammar();
            Dsmlv2Parser parser = new Dsmlv2Parser( grammar );
            parser.setInput( new FileInputStream( dsmlFile ), "UTF-8" ); //$NON-NLS-1$
            parser.parseAllRequests();

            // Getting the batch request
View Full Code Here

     */
    public Dsmlv2Parser( boolean storeMsgInBatchReq ) throws XmlPullParserException
    {
        this.storeMsgInBatchReq = storeMsgInBatchReq;

        this.grammar = new Dsmlv2Grammar();
        this.container = new Dsmlv2Container( grammar.getLdapCodecService() );

        this.container.setGrammar( grammar );

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
View Full Code Here

        else if ( LdapConstants.EXTENDED_RESPONSE == response.getMessageType() )
        {
            ExtendedResponse extendedResponse = response.getExtendedResponse();
            copyMessageIdAndControls( response, extendedResponse );

            ExtendedResponseDsml extendedResponseDsml = new ExtendedResponseDsml( extendedResponse );
            batchResponse.addResponse( extendedResponseDsml );
        }
        else if ( ( LdapConstants.SEARCH_RESULT_ENTRY == response.getMessageType() )
            || ( LdapConstants.SEARCH_RESULT_REFERENCE == response.getMessageType() )
            || ( LdapConstants.SEARCH_RESULT_DONE == response.getMessageType() ) )
View Full Code Here

            ModDNResponseDsml modDNResponseDsml = new ModDNResponseDsml( response );
            modDNResponseDsml.toDsml( xmlResponse.getRootElement() );
        }
        else if ( LdapConstants.EXTENDED_RESPONSE == response.getMessageType() )
        {
            ExtendedResponseDsml extendedResponseDsml = new ExtendedResponseDsml( response );
            extendedResponseDsml.toDsml( xmlResponse.getRootElement() );
        }
        else if ( ( LdapConstants.SEARCH_RESULT_ENTRY == response.getMessageType() )
            || ( LdapConstants.SEARCH_RESULT_REFERENCE == response.getMessageType() )
            || ( LdapConstants.SEARCH_RESULT_DONE == response.getMessageType() ) )
        {
View Full Code Here

        // we need a more advanced connection wrapper.

        // Creating the response
        if ( batchResponseDsml != null )
        {
            ExtendedResponseDsml extendedResponseDsml = new ExtendedResponseDsml();
            LdapResultCodec ldapResult = new LdapResultCodec();
            ldapResult.setResultCode( ResultCodeEnum.UNWILLING_TO_PERFORM );
            ldapResult.setErrorMessage( "This kind of request is not yet supported." );
            extendedResponseDsml.setLdapResult( ldapResult );
            batchResponseDsml.addResponse( extendedResponseDsml );
        }
    }
View Full Code Here

                break;

            case EXTENDED_REQUEST:
                ExtendedResponse extendedResponse = connection.extended( ( ExtendedRequest<?> ) request );
                resultCode = extendedResponse.getLdapResult().getResultCode();
                ExtendedResponseDsml extendedResponseDsml = new ExtendedResponseDsml( connection.getCodecService(),
                    extendedResponse );
                writeResponse( respWriter, extendedResponseDsml );

                break;
View Full Code Here

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

        ExtendedResponseDsml extendedResponse = ( ExtendedResponseDsml ) parser.getBatchResponse().getCurrentResponse();

        assertEquals( "This is a response", Strings.utf8ToString( extendedResponse.getResponseValue() ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.dsmlv2.reponse.ExtendedResponseDsml

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.