Package org.apache.directory.shared.dsmlv2.engine

Examples of org.apache.directory.shared.dsmlv2.engine.Dsmlv2Engine


            return srr;
        }
        else
        {
            // The search result is NOT a referral
            SearchResultEntryDsml sre = new SearchResultEntryDsml();
            sre.setEntry( entry );

            return sre;
        }
    }
View Full Code Here


            .getNameInNamespace() ) );

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

            // Getting the 'ref' attribute
            EntryAttribute refAttribute = entry.get( ExportDsmlJob.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( ExportDsmlJob.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.get() ) );
                }
            }

            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 );
            }
        }

        // Returning the associated DSML
View Full Code Here

     * @throws InvalidNameException
     */
    private AddRequestDsml convertToAddRequestDsml( SearchResult searchResult )
        throws InvalidAttributeIdentifierException, InvalidNameException
    {
        AddRequestDsml ar = new AddRequestDsml();
        Entry entry = AttributeUtils.toClientEntry( searchResult.getAttributes(), new LdapDN( searchResult
            .getNameInNamespace() ) );
        ar.setEntry( entry );

        return ar;
    }
View Full Code Here

            Dsmlv2Parser parser = new Dsmlv2Parser();
            parser.setInput( new FileInputStream( dsmlFile ), "UTF-8" );
            parser.parseAllRequests();

            // Getting the batch request
            BatchRequest 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<?> requests = batchRequest.getRequests();
            for ( Object request : requests )
            {
                // Processing the request
                processRequest( request, batchResponseDsml, dummyMonitor );
View Full Code Here

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

        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 );
            }
        }

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

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

        BatchRequestDsml batchRequest = parser.getBatchRequest();

        assertEquals( 1234567890, batchRequest.getRequestID() );
    }
View Full Code Here

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

        BatchRequestDsml batchRequest = parser.getBatchRequest();

        assertEquals( 0, batchRequest.getRequests().size() );
    }
View Full Code Here

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

        BatchRequestDsml batchRequest = parser.getBatchRequest();

        assertEquals( 1, batchRequest.getRequests().size() );

        if ( batchRequest.getCurrentRequest() instanceof BindRequest )
        {
            assertTrue( true );
        }
        else
        {
View Full Code Here

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

        BatchRequestDsml batchRequest = parser.getBatchRequest();

        assertEquals( 1, batchRequest.getRequests().size() );

        if ( batchRequest.getCurrentRequest() instanceof AddRequest )
        {
            assertTrue( true );
        }
        else
        {
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.dsmlv2.engine.Dsmlv2Engine

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.