/** * {@inheritDoc} */ @Override public void add( Entry entry ) throws LdapException { if ( entry == null ) { String msg = I18n.err( I18n.ERR_04123_CANNOT_ADD_EMPTY_ENTRY ); if ( LOG.isDebugEnabled() ) { LOG.debug( msg ); } throw new IllegalArgumentException( msg ); } AddRequest addRequest = new AddRequestImpl(); addRequest.setEntry( entry ); AddResponse addResponse = add( addRequest ); processResponse( addResponse ); }
/** * {@inheritDoc} */ @Override public void add( Entry entry ) throws LdapException { if ( entry == null ) { String msg = I18n.err( I18n.ERR_04123_CANNOT_ADD_EMPTY_ENTRY ); if ( LOG.isDebugEnabled() ) { LOG.debug( msg ); } throw new IllegalArgumentException( msg ); } AddRequest addRequest = new AddRequestImpl(); addRequest.setEntry( entry ); AddResponse addResponse = add( addRequest ); processResponse( addResponse ); }
/** * {@inheritDoc} */ @Override public void add( Entry entry ) throws LdapException { if ( entry == null ) { String msg = I18n.err( I18n.ERR_04123_CANNOT_ADD_EMPTY_ENTRY ); if ( LOG.isDebugEnabled() ) { LOG.debug( msg ); } throw new IllegalArgumentException( msg ); } AddRequest addRequest = new AddRequestImpl(); addRequest.setEntry( entry ); AddResponse addResponse = add( addRequest ); processResponse( addResponse ); }
public void run() { try { // Preparing the add request AddRequest request = new AddRequestImpl(); request.setEntryDn( new Dn( dn ) ); request.setEntry( AttributeUtils.toEntry( attributes, new Dn( dn ) ) ); request.addAllControls( convertControls( controls ) ); // Performing the add operation AddResponse addResponse = ldapConnection.add( request ); // Checking the response checkResponse( addResponse ); } catch ( Exception e ) { exception = e; } NamingException ne = null; if ( exception != null ) { ne = new NamingException( exception.getMessage() ); } for ( IJndiLogger logger : getJndiLoggers() ) { logger.logChangetypeAdd( connection, dn, attributes, controls, ne ); } } };
@Override public Response<Void> add(final AddRequest request) throws LdapException { Response<Void> response = null; try { final ApacheLdapUtils bu = new ApacheLdapUtils(); final AddRequestImpl ari = new AddRequestImpl(); if (request.getControls() != null) { ari.addAllControls(config.getControlProcessor().processRequestControls(request.getControls())); } ari.setEntry(bu.fromLdapEntry(new LdapEntry(request.getDn(), request.getLdapAttributes()))); final AddResponse ar = connection.add(ari); throwOperationException(request, ar); response = createResponse(request, null, ar); } catch (LdapOperationException e) { processLdapOperationException(e); } catch (org.apache.directory.api.ldap.model.exception.LdapException e) { processLdapException(e); } return response; }