Package org.apache.directory.studio.ldapbrowser.core.model

Examples of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection


    /**
     * This implementation opens the browser connection when the connection was opened.
     */
    public void connectionOpened( Connection connection, StudioProgressMonitor monitor )
    {
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );
        if ( browserConnection != null )
        {
            try
            {
View Full Code Here


    /**
     * This implementation closes the browser connection when the connection was closed.
     */
    public void connectionClosed( Connection connection, StudioProgressMonitor monitor )
    {
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );
        if ( browserConnection != null )
        {
            try
            {
                EventRegistry.suspendEventFiringInCurrentThread();
                browserConnection.clearCaches();
            }
            finally
            {
                EventRegistry.resumeEventFiringInCurrentThread();
                BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent(
View Full Code Here

                }

                List<ISearch> searchList = new ArrayList<ISearch>();
                try
                {
                    IBrowserConnection connection = null;
                    ByteArrayInputStream in = new ByteArrayInputStream( buffer );
                    DataInputStream readIn = new DataInputStream( in );

                    do
                    {
                        if ( readIn.available() > 1 )
                        {
                            int size = readIn.readInt();
                            byte[] connectionId = new byte[size];
                            readIn.read( connectionId );
                            connection = BrowserCorePlugin.getDefault().getConnectionManager()
                                .getBrowserConnectionById( new String( connectionId, "UTF-8" ) ); //$NON-NLS-1$
                        }

                        ISearch search = null;
                        if ( readIn.available() > 1 && connection != null )
                        {
                            int size = readIn.readInt();
                            if ( size == 0 )
                            {
                                search = connection.getSearchManager().getQuickSearch();
                            }
                            else
                            {
                                byte[] searchName = new byte[size];
                                readIn.read( searchName );
                                search = connection.getSearchManager().getSearch( new String( searchName, "UTF-8" ) ); //$NON-NLS-1$
                            }
                        }
                        else
                        {
                            return null;
View Full Code Here

     */
    public IWizardPage getNextPage()
    {
        if ( templateButton.getSelection() )
        {
            final IBrowserConnection browserConnection = entryWidget.getBrowserConnection();
            final LdapDN dn = entryWidget.getDn();
            IEntry templateEntry = null;

            if ( browserConnection == null )
            {
View Full Code Here

        // ID
        Attribute idAttribute = element.attribute( ID_TAG );
        if ( idAttribute != null )
        {
            String id = idAttribute.getValue();
            IBrowserConnection browserConnection = browserConnectionMap.get( id );

            if ( browserConnection != null )
            {
                Element searchesElement = element.element( SEARCHES_TAG );
                if ( searchesElement != null )
                {
                    for ( Iterator<?> i = searchesElement.elementIterator( SEARCH_PARAMETER_TAG ); i.hasNext(); )
                    {
                        Element searchParameterElement = ( Element ) i.next();
                        SearchParameter searchParameter = readSearch( searchParameterElement, browserConnection );
                        ISearch search = new Search( browserConnection, searchParameter );
                        browserConnection.getSearchManager().addSearch( search );
                    }
                }

                Element bookmarksElement = element.element( BOOKMARKS_TAG );
                if ( bookmarksElement != null )
                {
                    for ( Iterator<?> i = bookmarksElement.elementIterator( BOOKMARK_PARAMETER_TAG ); i.hasNext(); )
                    {
                        Element bookmarkParameterElement = ( Element ) i.next();
                        BookmarkParameter bookmarkParameter = readBookmark( bookmarkParameterElement, browserConnection );
                        IBookmark bookmark = new Bookmark( browserConnection, bookmarkParameter );
                        browserConnection.getBookmarkManager().addBookmark( bookmark );
                    }
                }
            }
        }
    }
View Full Code Here

     */
    @Test
    public void testBookmark() throws Exception
    {
        // create a bookmark
        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
            .getBrowserConnection( connection );
        browserConnection.getBookmarkManager().addBookmark(
            new Bookmark( browserConnection, new LdapDN( "uid=user.1,ou=users,ou=system" ), "Existing Bookmark" ) );

        // select the bookmark
        browserViewBot.selectEntry( "Bookmarks", "Existing Bookmark" );

View Full Code Here

                        try
                        {
                            for ( int i = 0; i < object.length; i++ )
                            {
                                String connectionId = ( String ) object[i][0];
                                IBrowserConnection browserConnection = getBrowserConnectionById( connectionId );

                                if ( browserConnection != null )
                                {
                                    if ( object[i].length > 0 )
                                    {
                                        SearchParameter[] searchParameters = ( SearchParameter[] ) object[i][1];
                                        for ( int k = 0; k < searchParameters.length; k++ )
                                        {
                                            ISearch search = new Search( browserConnection, searchParameters[k] );
                                            browserConnection.getSearchManager().addSearch( search );
                                        }
                                    }

                                    if ( object[i].length > 1 )
                                    {
                                        BookmarkParameter[] bookmarkParameters = ( BookmarkParameter[] ) object[i][2];
                                        for ( int k = 0; k < bookmarkParameters.length; k++ )
                                        {
                                            IBookmark bookmark = new Bookmark( browserConnection, bookmarkParameters[k] );
                                            browserConnection.getBookmarkManager().addBookmark( bookmark );
                                        }
                                    }
                                }
                            }
                        }
View Full Code Here

        String[] values = HistoryUtils.load( VALUE_HISTORY_DIALOGSETTING_KEY );
        quickSearchValueCombo.setItems( values );
        quickSearchValueCombo.select( 0 );
        quickSearchValuePP.setProposals( Arrays.asList( values ) );

        IBrowserConnection conn = entry.getBrowserConnection();

        QuickSearch quickSearch = new QuickSearch( entry, conn );
        quickSearch.getSearchParameter().setName( Messages.getString( "BrowserQuickSearchWidget.QuickSearch" ) ); //$NON-NLS-1$
        quickSearch.getSearchParameter().setSearchBase( entry.getDn() );
        quickSearch.getSearchParameter().setReturningAttributes( ISearch.NO_ATTRIBUTES );
        quickSearch.getSearchParameter().setAliasesDereferencingMethod( conn.getAliasesDereferencingMethod() );
        quickSearch.getSearchParameter().setReferralsHandlingMethod( conn.getReferralsHandlingMethod() );
        quickSearch.getSearchParameter().setCountLimit( conn.getCountLimit() );
        quickSearch.getSearchParameter().setTimeLimit( conn.getTimeLimit() );
        quickSearch.getSearchParameter().setScope( quickSearchScopeButton.getSelection() ? SearchScope.SUBTREE : SearchScope.ONELEVEL );

        StringBuffer filter = new StringBuffer();
        filter.append( "(" );
        if ( "!=".equals( quickSearchOperatorCombo.getText() ) )
        {
            filter.append( "!(" );
        }
        filter.append( quickSearchAttributeCombo.getText() );
        filter.append( "!=".equals( quickSearchOperatorCombo.getText() ) ? "=" : quickSearchOperatorCombo.getText() );

        // only escape '\', '(', ')', and '\u0000'
        // don't escape '*' to allow substring search
        String value = quickSearchValueCombo.getText();
        value = value.replaceAll( "\\\\", "\\\\5c" );
        value = value.replaceAll( "\u0000", "\\\\00" );
        value = value.replaceAll( "\\(", "\\\\28" );
        value = value.replaceAll( "\\)", "\\\\29" );
        filter.append( value );
        if ( "!=".equals( quickSearchOperatorCombo.getText() ) )
        {
            filter.append( ")" );
        }
        filter.append( ")" );
        quickSearch.getSearchParameter().setFilter( filter.toString() );

        // set new quick search
        conn.getSearchManager().setQuickSearch( quickSearch );

        // execute quick search
        new StudioBrowserJob( new SearchRunnable( new ISearch[]
            { quickSearch } ) ).execute();
    }
View Full Code Here

    public IEntry cloneEntry( IEntry entry )
    {
        try
        {
            EventRegistry.suspendEventFiringInCurrentThread();
            IBrowserConnection browserConnection = entry.getBrowserConnection();
            LdifContentRecord record = ModelConverter.entryToLdifContentRecord( entry );
            IEntry clonedEntry = ModelConverter.ldifContentRecordToEntry( record, browserConnection );
            return clonedEntry;
        }
        catch ( InvalidNameException e )
View Full Code Here

     */
    public Object[] getElements( Object parent )
    {
        if ( parent instanceof IBrowserConnection )
        {
            IBrowserConnection connection = ( IBrowserConnection ) parent;
            if ( !connectionToCategoriesMap.containsKey( connection ) )
            {
                BrowserCategory[] categories = new BrowserCategory[3];
                categories[0] = new BrowserCategory( BrowserCategory.TYPE_DIT, connection );
                categories[1] = new BrowserCategory( BrowserCategory.TYPE_SEARCHES, connection );
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection

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.