Examples of SearchControls


Examples of javax.naming.directory.SearchControls

            dummyMonitor.reset();
            do
            {
                numberInBatch = 0;

                SearchControls searchControls = new SearchControls();
                searchControls.setCountLimit( 1000 );
                searchControls.setReturningAttributes( new String[0] );
                searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
                NamingEnumeration<SearchResult> result = browserConnection.getConnection().getJNDIConnectionWrapper()
                    .search( dn.getUpName(), ISearch.FILTER_TRUE, searchControls, aliasDereferencingMethod,
                        referralsHandlingMethod, null, dummyMonitor, null );

                try
View Full Code Here

Examples of javax.naming.directory.SearchControls

     * @return
     *      the associated {@link SearchControls} object
     */
    private SearchControls getSearchControls( SearchRequestCodec request )
    {
        SearchControls controls = new SearchControls();

        // Scope
        switch ( request.getScope() )
        {
            case OBJECT:
                controls.setSearchScope( SearchControls.OBJECT_SCOPE );
                break;
            case ONELEVEL:
                controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
                break;
            case SUBTREE:
                controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
                break;
            default:
                controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
        }

        // Returning attributes
        List<String> returningAttributes = new ArrayList<String>();
        for ( EntryAttribute entryAttribute : request.getAttributes() )
        {
            returningAttributes.add( entryAttribute.getId() );
        }
        // If the returning attributes are empty, we need to return the user attributes
        // [Cf. RFC 2251 - "There are two special values which may be used: an empty
        //  list with no attributes, and the attribute description string '*'.  Both of
        //  these signify that all user attributes are to be returned."]
        if ( returningAttributes.size() == 0 )
        {
            returningAttributes.add( "*" );
        }

        controls.setReturningAttributes( returningAttributes.toArray( new String[0] ) );

        // Size Limit
        controls.setCountLimit( request.getSizeLimit() );

        // Time Limit
        controls.setTimeLimit( request.getTimeLimit() );

        return controls;
    }
View Full Code Here

Examples of javax.naming.directory.SearchControls

        JNDIConnectionWrapper wrapper = connection.getJNDIConnectionWrapper();

        monitor.beginTask( Messages.getString( "GenericSchemaConnector.FetchingSchema" ), 1 ); //$NON-NLS-1$

        // Looking for all the defined schemas
        SearchControls constraintSearch = new SearchControls();
        constraintSearch.setSearchScope( SearchControls.ONELEVEL_SCOPE );

        NamingEnumeration<SearchResult> answer = wrapper
            .search( "ou=schema", "(objectclass=metaSchema)", constraintSearch, DEREF_ALIAS_METHOD,
                HANDLE_REFERALS_METHOD, null, ( StudioProgressMonitor ) monitor, null );
        if ( answer != null )
View Full Code Here

Examples of javax.naming.directory.SearchControls

     */
    public boolean isSuitableConnector( Connection connection, StudioProgressMonitor monitor )
    {
        JNDIConnectionWrapper wrapper = connection.getJNDIConnectionWrapper();

        SearchControls constraintSearch = new SearchControls();
        constraintSearch.setSearchScope( SearchControls.OBJECT_SCOPE );
        constraintSearch.setReturningAttributes( new String[]
            { "+" } );

        NamingEnumeration<SearchResult> answer = wrapper.search( "", "(objectclass=*)", constraintSearch,
            DEREF_ALIAS_METHOD, HANDLE_REFERALS_METHOD, null, monitor, null );

View Full Code Here

Examples of javax.naming.directory.SearchControls

        // Creating the schema
        Schema schema = new SchemaImpl( name );

        // Looking for the nodes of the schema
        SearchControls constraintSearch = new SearchControls();
        constraintSearch.setSearchScope( SearchControls.SUBTREE_SCOPE );

        NamingEnumeration<SearchResult> answer = wrapper.search( "cn=" + name + ", ou=schema", "(objectclass=*)",
            constraintSearch, DEREF_ALIAS_METHOD, HANDLE_REFERALS_METHOD, null, monitor, null );
        if ( answer != null )
        {
View Full Code Here

Examples of javax.naming.directory.SearchControls

        context = open();

        try {

            String filter = userSearchMatchingFormat.format(new String[]{username});
            SearchControls constraints = new SearchControls();
            if (userSearchSubtreeBool) {
                constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
            } else {
                constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
            }

            //setup attributes
            ArrayList list = new ArrayList();
            if (userRoleName != null) {
                list.add(userRoleName);
            }
            String[] attribs = new String[list.size()];
            list.toArray(attribs);
            constraints.setReturningAttributes(attribs);


            NamingEnumeration results = context.search(userBase, filter, constraints);

            if (results == null || !results.hasMore()) {
View Full Code Here

Examples of javax.naming.directory.SearchControls

        if (roleName == null || "".equals(roleName)) {
            return list;
        }
        String filter = roleSearchMatchingFormat.format(new String[]{doRFC2254Encoding(dn), username});

        SearchControls constraints = new SearchControls();
        if (roleSearchSubtreeBool) {
            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
        } else {
            constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
        }
        NamingEnumeration results =
                context.search(roleBase, filter, constraints);
        while (results.hasMore()) {
            SearchResult result = (SearchResult) results.next();
View Full Code Here

Examples of javax.naming.directory.SearchControls

       
        DirContext ctx = new InitialDirContext(props);
       

        // Search the named object and all of its descendants.
        SearchControls constraints = new SearchControls();
        constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);

        // Retrieve the specified attributes only..
        String[] al = new String[ attributeList.size() ];
        attributeList.toArray(al);
        constraints.setReturningAttributes(al);

        String filter = USER_FILTER +"="+userId;
       
        logger.info("LDAP search '" + filter + "' ");
View Full Code Here

Examples of javax.naming.directory.SearchControls

    * @param filter that will be concatenated with proper user search filter from the module
    * @return
    */
   public List searchUsers(String filter, Object[] filterArgs) throws NamingException, IdentityException
   {
      SearchControls controls = new SearchControls();
      controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
      controls.setReturningObjFlag(true);
      controls.setTimeLimit(getSearchTimeLimit());

      log.debug("Search filter: " + filter);

      LdapContext ldapContext = getConnectionContext().createInitialContext();
      NamingEnumeration results = null;
View Full Code Here

Examples of javax.naming.directory.SearchControls

        try
        {

            ctx = connectLDAP();

            SearchControls constraints = new SearchControls();
            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
            constraints.setCountLimit(0);
            constraints.setReturningAttributes(attrs);
            NamingEnumeration results = ctx.search(params.getBaseDN(), filter3,
                constraints);
            while (results.hasMoreElements())
            {
                SearchResult sr = (SearchResult)results.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.