/** * {@inheritDoc} */ @Override public Entry getEntry() { return getDecorated().getEntry(); }
/** * {@inheritDoc} */ @Override public AddRequest setEntry( Entry entry ) { getDecorated().setEntry( entry ); return this; }
/** * {@inheritDoc} */ @Override public AddRequest setEntryDn( Dn entryDn ) { getDecorated().setEntryDn( entryDn ); return this; }
if ( addRequest.getEntry() == null ) addRequest.setMessageId( newId ); AddFuture addFuture = new AddFuture( this, newId ); addToFutureMap( newId, addFuture );
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 ); } } };
if ( addRequest.getEntry() == null ) abandon( addRequest.getMessageId() );
/** * {@inheritDoc} */ @Override public void add( Entry entry ) throws LdapException { if ( entry == null ) { String msg = "Cannot add an empty entry"; LOG.debug( msg ); throw new IllegalArgumentException( msg ); } AddRequest addRequest = new AddRequestImpl(); addRequest.setEntry( entry ); addRequest.setEntryDn( entry.getDn() ); AddResponse addResponse = add( addRequest ); processResponse( addResponse ); }
/** * {@inheritDoc} */ @Override public void action( LdapMessageContainer<AddRequestDecorator> container ) throws DecoderException { // Now, we can allocate the AddRequest Object int messageId = container.getMessageId(); AddRequest internalAddRequest = new AddRequestImpl(); internalAddRequest.setMessageId( messageId ); AddRequestDecorator addRequest = new AddRequestDecorator( container.getLdapCodecService(), internalAddRequest ); container.setMessage( addRequest ); // We will check that the request is not null TLV tlv = container.getCurrentTLV(); if ( tlv.getLength() == 0 ) { String msg = I18n.err( I18n.ERR_05145_NULL_ADD_REQUEST ); LOG.error( msg ); // Will generate a PROTOCOL_ERROR throw new DecoderException( msg ); } } }
Entry addEntry = addRequest.getEntry(); new DefaultEntry( session.getDirectoryService().getSchemaManager(), addRequest.getEntry() ) ); dn = addRequest.getEntry().getDn(); requestControls = addRequest.getControls();
/** * Get the added Dn * * @return Returns the entry Dn. */ @Override public Dn getEntryDn() { return getDecorated().getEntryDn(); }
/** * {@inheritDoc} */ public void handle( LdapSession session, AddRequest req ) { LOG.debug( "Handling request: {}", req ); LdapResult result = req.getResultResponse().getLdapResult(); try { // Call the underlying layer to inject the new entry CoreSession coreSession = session.getCoreSession(); coreSession.add( req ); // If success, here now, otherwise, we would have an exception. result.setResultCode( ResultCodeEnum.SUCCESS ); // Write the AddResponse message session.getIoSession().write( req.getResultResponse() ); } catch ( Exception e ) { handleException( session, req, e ); } } }
if ( addRequest.getEntry() == null ) addRequest.setMessageId( newId ); AddFuture addFuture = new AddFuture( this, newId ); addToFutureMap( newId, addFuture );
if ( addRequest.getEntry() == null ) abandon( addRequest.getMessageId() );
/** * {@inheritDoc} */ @Override public void action( LdapMessageContainer<AddRequestDecorator> container ) throws DecoderException { // Now, we can allocate the AddRequest Object int messageId = container.getMessageId(); AddRequest internalAddRequest = new AddRequestImpl(); internalAddRequest.setMessageId( messageId ); AddRequestDecorator addRequest = new AddRequestDecorator( container.getLdapCodecService(), internalAddRequest ); container.setMessage( addRequest ); // We will check that the request is not null TLV tlv = container.getCurrentTLV(); if ( tlv.getLength() == 0 ) { String msg = I18n.err( I18n.ERR_05145_NULL_ADD_REQUEST ); LOG.error( msg ); // Will generate a PROTOCOL_ERROR throw new DecoderException( msg ); } } }
/** * {@inheritDoc} */ @Override public Dn getEntryDn() { return getDecorated().getEntryDn(); }
/** * {@inheritDoc} */ @Override public void add( AddRequest addRequest, LogChange log ) throws LdapException { AddOperationContext addContext = new AddOperationContext( this, addRequest ); addContext.setLogChange( log ); OperationManager operationManager = directoryService.getOperationManager(); try { operationManager.add( addContext ); } catch ( LdapException e ) { addRequest.getResultResponse().addAllControls( addContext.getResponseControls() ); throw e; } addRequest.getResultResponse().addAllControls( addContext.getResponseControls() ); }
/** * Get the entry with its attributes. * * @return Returns the entry. */ @Override public Entry getEntry() { return getDecorated().getEntry(); }
if ( addRequest.getEntry() == null ) addRequest.setMessageId( newId ); AddFuture addFuture = new AddFuture( this, newId ); addToFutureMap( newId, addFuture );
/** * {@inheritDoc} */ @Override public AddRequest setEntry( Entry entry ) { getDecorated().setEntry( entry ); return this; }
if ( addRequest.getEntry() == null ) abandon( addRequest.getMessageId() );