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

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


                    }
                    else if ( searchResponse.getType() == MessageTypeEnum.SEARCH_RESULT_REFERENCE )
                    {
                        SearchResultReference searchResultReference = ( SearchResultReference ) searchResponse;

                        SearchResultReferenceDsml searchResultReferenceDsml = new SearchResultReferenceDsml(
                            connection.getCodecService(), searchResultReference );
                        searchResponseDsml = new SearchResponseDsml( connection.getCodecService(),
                            searchResultReferenceDsml );

                        if ( respWriter != null )
View Full Code Here


            new Dn( searchResult.getNameInNamespace() ) );

        if ( isReferral( entry ) )
        {
            // The search result is a referral
            SearchResultReferenceDsml srr = new SearchResultReferenceDsml( codec );

            // Getting the 'ref' attribute
            Attribute refAttribute = entry.get( ExportDsmlRunnable.REF_ATTRIBUTETYPE_NAME );
            if ( refAttribute == null )
            {
                // If we did not get it by its name, let's get it by its OID
                refAttribute = entry.get( ExportDsmlRunnable.REF_ATTRIBUTETYPE_OID );
            }

            // Adding references
            if ( refAttribute != null )
            {
                for ( Iterator<Value<?>> iterator = refAttribute.iterator(); iterator.hasNext(); )
                {
                    Value<?> value = ( Value<?> ) iterator.next();

                    srr.addSearchResultReference( new LdapUrl( ( String ) value.getValue() ) );
                }
            }

            return srr;
        }
View Full Code Here

            {
                // 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[]
View Full Code Here

     * @throws LdapException
     */
    private AddRequestDsml convertToAddRequestDsml( SearchResult searchResult )
        throws LdapException
    {
        AddRequestDsml ar = new AddRequestDsml( codec );
        Entry entry = AttributeUtils.toEntry( searchResult.getAttributes(),
            new Dn( searchResult.getNameInNamespace() ) );
        ar.setEntry( entry );

        return ar;
    }
View Full Code Here

     * @return true if a request ID is needed (ie Processing=Parallel and ResponseOrder=Unordered)
     * @throws XmlPullParserException if the batch request has not been parsed yet
     */
    public static boolean isRequestIdNeeded( Dsmlv2Container container ) throws XmlPullParserException
    {
        BatchRequestDsml batchRequest = container.getBatchRequest();

        if ( batchRequest == null )
        {
            throw new XmlPullParserException( I18n.err( I18n.ERR_03040 ), container.getParser(), null );
        }

        return ( ( batchRequest.getProcessing() == Processing.PARALLEL ) && ( batchRequest.getResponseOrder() == ResponseOrder.UNORDERED ) );
    }
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

            Dsmlv2Parser parser = new Dsmlv2Parser( grammar );
            parser.setInput( new FileInputStream( dsmlFile ), "UTF-8" ); //$NON-NLS-1$
            parser.parseAllRequests();

            // Getting the batch request
            BatchRequestDsml batchRequest = parser.getBatchRequest();

            // Creating a DSML batch response (only if needed)
            BatchResponseDsml batchResponseDsml = null;
            if ( responseFile != null )
            {
                batchResponseDsml = new BatchResponseDsml();
            }

            // Setting the errors counter
            int errorsCount = 0;

            // Creating a dummy monitor that will be used to check if something
            // went wrong when executing the request
            StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );

            // Processing each request
            List<DsmlDecorator<? extends Request>> requests = batchRequest.getRequests();
            for ( DsmlDecorator<? extends Request> request : requests )
            {
                // Processing the request
                processRequest( request, batchResponseDsml, dummyMonitor );
View Full Code Here

     */
    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

     * @return true if a request ID is needed (ie Processing=Parallel and ResponseOrder=Unordered)
     * @throws XmlPullParserException if the batch request has not been parsed yet
     */
    public static boolean isRequestIdNeeded( Dsmlv2Container container ) throws XmlPullParserException
    {
        BatchRequestDsml batchRequest = container.getBatchRequest();

        if ( batchRequest == null )
        {
            throw new XmlPullParserException( I18n.err( I18n.ERR_03040 ), container.getParser(), null );
        }

        return ( ( batchRequest.getProcessing() == Processing.PARALLEL ) && ( batchRequest.getResponseOrder() == ResponseOrder.UNORDERED ) );
    }
View Full Code Here

TOP

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

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.