Package org.apache.directory.shared.ldap.name

Examples of org.apache.directory.shared.ldap.name.LdapDN


    {
        ApacheDsUtils.enableSchema( ldapServer, "nis" );

        // create entry with multi-valued RDN containing an IP address value
        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries() );
        entry.setDn( new LdapDN( "cn=loopback+ipHostNumber=127.0.0.1,ou=users,ou=system" ) );
        entry.add( "objectClass", "top", "device", "ipHost" );
        entry.add( "cn", "loopback" );
        entry.add( "ipHostNumber", "127.0.0.1" );
        ldapServer.getDirectoryService().getAdminSession().add( entry );
View Full Code Here


        ApacheDsUtils.enableSchema( ldapServer, "krb5kdc" );
        ApacheDsUtils.enableSchema( ldapServer, "nis" );

        // create referral entry
        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries() );
        entry.setDn( new LdapDN( "cn=referral,ou=system" ) );
        entry.add( "objectClass", "top", "referral", "extensibleObject" );
        entry.add( "cn", "referralDialogTest" );
        entry.add( "ref", "ldap://localhost:" + ldapServer.getPort() + "/ou=users,ou=system" );
        ldapServer.getDirectoryService().getAdminSession().add( entry );
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 )
            {
                getShell().getDisplay().syncExec( new Runnable()
                {
                    public void run()
                    {
                        MessageDialog
                            .openError(
                                getShell(),
                                Messages.getString( "NewEntryTypeWizardPage.Error" ), Messages.getString( "NewEntryTypeWizardPage.NoConnection" ) ); //$NON-NLS-1$ //$NON-NLS-2$
                    }
                } );
                return null;
            }
            if ( dn == null )
            {
                getShell().getDisplay().syncExec( new Runnable()
                {
                    public void run()
                    {
                        MessageDialog
                            .openError(
                                getShell(),
                                Messages.getString( "NewEntryTypeWizardPage.Error" ), Messages.getString( "NewEntryTypeWizardPage.NoDN" ) ); //$NON-NLS-1$ //$NON-NLS-2$
                    }
                } );
                return null;
            }

            // check if selected DN exists
            ReadEntryRunnable readEntryRunnable = new ReadEntryRunnable( browserConnection, dn );
            RunnableContextRunner.execute( readEntryRunnable, getContainer(), false );
            templateEntry = readEntryRunnable.getReadEntry();
            if ( templateEntry == null )
            {
                getShell().getDisplay().syncExec( new Runnable()
                {
                    public void run()
                    {
                        MessageDialog
                            .openError(
                                getShell(),
                                Messages.getString( "NewEntryTypeWizardPage.Error" ), NLS.bind( Messages.getString( "NewEntryTypeWizardPage.EntryDoesNotExist" ), dn.toString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
                    }
                } );
                return null;
            }

            // init attributes
            if ( !templateEntry.isAttributesInitialized() )
            {
                InitializeAttributesRunnable runnable = new InitializeAttributesRunnable( templateEntry );
                RunnableContextRunner.execute( runnable, getContainer(), true );
            }

            // clone entry and remove non-modifiable attributes
            try
            {
                EventRegistry.suspendEventFiringInCurrentThread();

                LdifContentRecord record = ModelConverter.entryToLdifContentRecord( templateEntry );
                DummyEntry prototypeEntry = ModelConverter.ldifContentRecordToEntry( record, browserConnection );
                IAttribute[] attributes = prototypeEntry.getAttributes();
                for ( int i = 0; i < attributes.length; i++ )
                {
                    if ( !SchemaUtils.isModifiable( attributes[i].getAttributeTypeDescription() ) )
                    {
                        prototypeEntry.deleteAttribute( attributes[i] );
                    }
                }
                wizard.setPrototypeEntry( prototypeEntry );
            }
            catch ( Exception e )
            {
                e.printStackTrace();
            }
            finally
            {
                EventRegistry.resumeEventFiringInCurrentThread();
            }
        }
        else
        {
            wizard.setPrototypeEntry( new DummyEntry( new LdapDN(), wizard.getSelectedConnection() ) );
        }

        return super.getNextPage();
    }
View Full Code Here

            if ( selectedConnection.getConnection() != null )
            {
                originalReadOnlyFlag = selectedConnection.getConnection().isReadOnly();
                selectedConnection.getConnection().setReadOnly( true );
            }
            prototypeEntry = new DummyEntry( new LdapDN(), selectedConnection );
        }
    }
View Full Code Here

            {
                previewText.setText( s );
            }
            else
            {
                LdapDN dn;
                if ( showParent && showRDN )
                {
                    dn = DnUtils.composeDn( rdn, parentDn );
                }
                else if ( showParent )
                {
                    dn = parentDn;
                }
                else if ( showRDN )
                {
                    dn = new LdapDN();
                    dn.add( rdn );
                }
                else
                {
                    dn = new LdapDN();
                }
                previewText.setText( dn.getUpName() );
            }
        }

        notifyListeners();
    }
View Full Code Here

        {
            public void modifyText( ModifyEvent e )
            {
                try
                {
                    dn = new LdapDN( dnCombo.getText() );
                }
                catch ( InvalidNameException e1 )
                {
                    dn = null;
                }

                internalSetEnabled();
                notifyListeners();
            }
        } );

        // Up button
        upButton = new Button( textAndUpComposite, SWT.PUSH );
        upButton.setToolTipText( Messages.getString( "EntryWidget.Parent" ) ); //$NON-NLS-1$
        upButton.setImage( BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_PARENT ) );
        upButton.setEnabled( false );
        upButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                if ( dn != null && DnUtils.getParent( dn ) != null )
                {
                    dn = DnUtils.getParent( dn );
                    dnChanged();
                    internalSetEnabled();
                    notifyListeners();
                }
            }
        } );

        // Browse button
        entryBrowseButton = BaseWidgetUtils.createButton( parent, Messages.getString( "EntryWidget.BrowseButton" ), 1 ); //$NON-NLS-1$
        entryBrowseButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                if ( browserConnection != null )
                {
                    // get root entry
                    IEntry rootEntry = browserConnection.getRootDSE();
                    if ( suffix != null && suffix.size() > 0 )
                    {
                        rootEntry = browserConnection.getEntryFromCache( suffix );
                        if ( rootEntry == null )
                        {
                            ReadEntryRunnable runnable = new ReadEntryRunnable( browserConnection, suffix );
                            RunnableContextRunner.execute( runnable, null, true );
                            rootEntry = runnable.getReadEntry();
                        }
                    }

                    // calculate initial DN
                    LdapDN initialDN = dn;
                    if ( useLocalName && suffix != null && suffix.size() > 0 )
                    {
                        if ( initialDN != null && initialDN.size() > 0 )
                        {
                            initialDN = DnUtils.composeDn( initialDN, suffix );
                        }
                    }

                    // get initial entry
                    IEntry entry = rootEntry;
                    if ( initialDN != null && initialDN.size() > 0 )
                    {
                        entry = browserConnection.getEntryFromCache( initialDN );
                        if ( entry == null )
                        {
                            ReadEntryRunnable runnable = new ReadEntryRunnable( browserConnection, initialDN );
View Full Code Here

                        boolean isContinuedSearchResult = sr.isContinuedSearchResult();
                        LdapURL searchContinuationUrl = sr.getSearchContinuationUrl();

                        if ( searchContinuationUrl == null )
                        {
                            LdapDN dn = JNDIUtils.getDn( sr );
                            IEntry entry = null;

                            Connection resultConnection = sr.getConnection();
                            IBrowserConnection resultBrowserConnection = BrowserCorePlugin.getDefault()
                                .getConnectionManager().getBrowserConnection( resultConnection );
View Full Code Here

        StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
        IEntry entry = null;

        // build tree to parent
        LinkedList<LdapDN> parentDnList = new LinkedList<LdapDN>();
        LdapDN parentDN = dn;
        while ( parentDN != null && browserConnection.getEntryFromCache( parentDN ) == null )
        {
            parentDnList.addFirst( parentDN );
            parentDN = DnUtils.getParent( parentDN );
        }

        for ( LdapDN aDN : parentDnList )
        {
            parentDN = DnUtils.getParent( aDN );
            if ( parentDN == null )
            {
                // only the root DSE has a null parent
                entry = browserConnection.getRootDSE();
            }
            else if ( !parentDN.isEmpty() && browserConnection.getEntryFromCache( parentDN ) != null )
            {
                // a normal entry has a parent but the parent isn't the rootDSE
                IEntry parentEntry = browserConnection.getEntryFromCache( parentDN );
                entry = new Entry( parentEntry, aDN.getRdn() );
                entry.setDirectoryEntry( true );
View Full Code Here

            return;
        }

        try
        {
            LdapDN dn = new LdapDN( newDn );
            Rdn newrdn = dn.getRdn();
            LdapDN newsuperior = DnUtils.getParent( dn );

            LdifChangeModDnRecord record = new LdifChangeModDnRecord( LdifDnLine.create( oldDn ) );
            addControlLines( record, controls );
            record.setChangeType( LdifChangeTypeLine.createModDn() );
            record.setNewrdn( LdifNewrdnLine.create( newrdn.getUpName() ) );
            record.setDeloldrdn( deleteOldRdn ? LdifDeloldrdnLine.create1() : LdifDeloldrdnLine.create0() );
            record.setNewsuperior( LdifNewsuperiorLine.create( newsuperior.getUpName() ) );
            record.finish( LdifSepLine.create() );

            String formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT );
            log( formattedString, ex, connection );
        }
View Full Code Here

     *
     */
    private void updateCertificate( String issuerDN, String subjectDN, Date startDate, Date expiryDate )
        throws Exception
    {
        LdapDN dn = new LdapDN( PRINCIPAL );
        List<Modification> modifications = new ArrayList<Modification>();

        // Get old key algorithm
        ClonedServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup( dn );
        String keyAlgo = entry.get( KEY_ALGORITHM_AT ).getString();
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.name.LdapDN

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.