org.apache.directory.api.ldap.model.message.AddRequest Java Examples
The following examples show how to use
org.apache.directory.api.ldap.model.message.AddRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultCoreSession.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ 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() ); }
Example #2
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * {@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 ); }
Example #3
Source File: DefaultCoreSession.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ 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() ); }
Example #4
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public AddFuture addAsync( Entry entry ) throws LdapException { if ( entry == null ) { String msg = I18n.err( I18n.ERR_04125_CANNOT_ADD_NULL_ENTRY ); if ( LOG.isDebugEnabled() ) { LOG.debug( msg ); } throw new IllegalArgumentException( msg ); } AddRequest addRequest = new AddRequestImpl(); addRequest.setEntry( entry ); return addAsync( addRequest ); }
Example #5
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a request with the dn attribute */ @Test public void testRequestWithDn() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_dn_attribute.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); assertTrue( addRequest.getEntryDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) ); }
Example #6
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a request with the (optional) requestID attribute */ @Test public void testRequestWithRequestId() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); assertEquals( 456, addRequest.getMessageId() ); }
Example #7
Source File: LdapConnectionTemplate.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public AddResponse add( AddRequest addRequest ) { LdapConnection connection = null; try { connection = connectionPool.getConnection(); return connection.add( addRequest ); } catch ( LdapException e ) { throw new LdapRuntimeException( e ); } finally { returnLdapConnection( connection ); } }
Example #8
Source File: InitAddRequest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void action( LdapMessageContainer<AddRequest> container ) throws DecoderException { // Now, we can allocate the AddRequest Object int messageId = container.getMessageId(); AddRequest addRequest = new AddRequestImpl(); addRequest.setMessageId( messageId ); 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 ); } }
Example #9
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test the decoding of a AddRequest with a null body */ @Test public void testDecodeAddRequestNullBody() throws DecoderException { ByteBuffer stream = ByteBuffer.allocate( 0x07 ); stream.put( new byte[] { 0x30, 0x05, // LDAPMessage ::= SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x68, 0x00 // CHOICE { ..., addRequest AddRequest, ... } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<AddRequest> container = new LdapMessageContainer<>( codec ); // Decode a AddRequest message assertThrows( DecoderException.class, ( ) -> { Asn1Decoder.decode( stream, container ); } ); }
Example #10
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with 2 (optional) Control elements */ @Test public void testRequestWith2Controls() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_2_controls.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Map<String, Control> controls = addRequest.getControls(); assertEquals( 2, addRequest.getControls().size() ); Control control = controls.get( "1.2.840.113556.1.4.789" ); assertNotNull( control ); assertFalse( control.isCritical() ); assertEquals( "1.2.840.113556.1.4.789", control.getOid() ); assertEquals( "Some other text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) ); }
Example #11
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with an Attr elements with empty value */ @Test public void testRequestWith1AttrEmptyValue() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_empty_value.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Entry entry = addRequest.getEntry(); assertEquals( 1, entry.size() ); // Getting the Attribute Iterator<Attribute> attributeIterator = entry.iterator(); Attribute attribute = attributeIterator.next(); assertEquals( "objectclass", attribute.getUpId() ); // Getting the Value Iterator<Value> valueIterator = attribute.iterator(); assertFalse( valueIterator.hasNext() ); }
Example #12
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with a (optional) Control element with Base64 value */ @Test public void testRequestWith1ControlBase64Value() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_1_control_base64_value.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Map<String, Control> controls = addRequest.getControls(); assertEquals( 1, addRequest.getControls().size() ); Control control = controls.get( "1.2.840.113556.1.4.643" ); assertNotNull( control ); assertTrue( control.isCritical() ); assertEquals( "1.2.840.113556.1.4.643", control.getOid() ); assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) ); }
Example #13
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with a (optional) Control element with empty value */ @Test public void testRequestWith1ControlEmptyValue() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_1_control_empty_value.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Map<String, Control> controls = addRequest.getControls(); assertEquals( 1, addRequest.getControls().size() ); Control control = controls.get( "1.2.840.113556.1.4.643" ); assertNotNull( control ); assertTrue( control.isCritical() ); assertEquals( "1.2.840.113556.1.4.643", control.getOid() ); assertFalse( ( ( DsmlControl<?> ) control ).hasValue() ); }
Example #14
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with a (optional) Control element */ @Test public void testRequestWith1Control() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_1_control.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Map<String, Control> controls = addRequest.getControls(); assertEquals( 1, addRequest.getControls().size() ); Control control = controls.get( "1.2.840.113556.1.4.643" ); assertNotNull( control ); assertTrue( control.isCritical() ); assertEquals( "1.2.840.113556.1.4.643", control.getOid() ); assertEquals( "Some text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) ); }
Example #15
Source File: LdapConnectionTemplate.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public AddResponse add( Dn dn, RequestBuilder<AddRequest> requestBuilder ) { AddRequest addRequest = newAddRequest( newEntry( dn ) ); try { requestBuilder.buildRequest( addRequest ); } catch ( LdapException e ) { throw new LdapRuntimeException( e ); } return add( addRequest ); }
Example #16
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with 3 (optional) Control elements without value */ @Test public void testRequestWith3ControlsWithoutValue() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_3_controls_without_value.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Map<String, Control> controls = addRequest.getControls(); assertEquals( 3, addRequest.getControls().size() ); Control control = controls.get( "1.2.840.113556.1.4.456" ); assertNotNull( control ); assertTrue( control.isCritical() ); assertEquals( "1.2.840.113556.1.4.456", control.getOid() ); assertFalse( ( ( DsmlControl<?> ) control ).hasValue() ); }
Example #17
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with an Attr elements with value */ @Test public void testRequestWith1AttrWithoutValue() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_without_value.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Entry entry = addRequest.getEntry(); assertEquals( 1, entry.size() ); // Getting the Attribute Iterator<Attribute> attributeIterator = entry.iterator(); Attribute attribute = attributeIterator.next(); assertEquals( "objectclass", attribute.getUpId() ); // Getting the Value Iterator<Value> valueIterator = attribute.iterator(); assertFalse( valueIterator.hasNext() ); }
Example #18
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with an Attr elements with value */ @Test public void testRequestWith1AttrWithValue() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_with_value.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Entry entry = addRequest.getEntry(); assertEquals( 1, entry.size() ); // Getting the Attribute Iterator<Attribute> attributeIterator = entry.iterator(); Attribute attribute = attributeIterator.next(); assertEquals( "objectclass", attribute.getUpId() ); // Getting the Value Iterator<Value> valueIterator = attribute.iterator(); assertTrue( valueIterator.hasNext() ); Value value = valueIterator.next(); assertEquals( "top", value.getString() ); }
Example #19
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a request with 2 Attr elements with value */ @Test public void testRequestWith2AttrWithValue() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( AddRequestTest.class.getResource( "request_with_2_attr_with_value.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest(); Entry entry = addRequest.getEntry(); assertEquals( 1, entry.size() ); // Getting the Attribute Iterator<Attribute> attributeIterator = entry.iterator(); Attribute attribute = attributeIterator.next(); assertEquals( "objectclass", attribute.getUpId() ); // Getting the Value Iterator<Value> valueIterator = attribute.iterator(); assertTrue( valueIterator.hasNext() ); Value value = valueIterator.next(); assertEquals( "top", value.getString() ); assertTrue( valueIterator.hasNext() ); value = valueIterator.next(); assertEquals( "person", value.getString() ); assertFalse( valueIterator.hasNext() ); }
Example #20
Source File: AddRequestDsml.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public AddRequest setMessageId( int messageId ) { super.setMessageId( messageId ); return this; }
Example #21
Source File: BatchRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Request with 2 AddRequest */ @Test public void testResponseWith2AddRequest() { Dsmlv2Parser parser = null; try { parser = newParser(); parser.setInput( BatchRequestTest.class.getResource( "request_with_2_AddRequest.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchRequestDsml batchRequest = parser.getBatchRequest(); assertEquals( 2, batchRequest.getRequests().size() ); if ( batchRequest.getCurrentRequest() instanceof AddRequest ) { assertTrue( true ); } else { fail(); } }
Example #22
Source File: LdapConnectionTemplate.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public AddResponse add( Dn dn, final Attribute... attributes ) { return add( dn, new RequestBuilder<AddRequest>() { @Override public void buildRequest( AddRequest request ) throws LdapException { request.getEntry().add( attributes ); } } ); }
Example #23
Source File: AddRequestDsml.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public AddRequest setEntryDn( Dn entryDn ) { getDecorated().setEntryDn( entryDn ); return this; }
Example #24
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test the decoding of a AddRequest with a null attributeList */ @Test public void testDecodeAddRequestNullAttributes() throws DecoderException { ByteBuffer stream = ByteBuffer.allocate( 0x2B ); stream.put( new byte[] { 0x30, 0x29, // LDAPMessage ::= SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x68, 0x24, // CHOICE { ..., addRequest AddRequest, ... // AddRequest ::= [APPLICATION 8] SEQUENCE { 0x04, 0x20, // entry LDAPDN, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', // attributes AttributeList } 0x30, 0x00 // AttributeList ::= SEQUENCE OF SEQUENCE { } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<AddRequest> container = new LdapMessageContainer<>( codec ); // Decode a AddRequest message assertThrows( DecoderException.class, ( ) -> { Asn1Decoder.decode( stream, container ); } ); }
Example #25
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test the decoding of a AddRequest with a empty attributeList */ @Test public void testDecodeAddRequestNullAttributeList() throws DecoderException { ByteBuffer stream = ByteBuffer.allocate( 0x2D ); stream.put( new byte[] { 0x30, 0x2B, // LDAPMessage ::= SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x68, 0x26, // CHOICE { ..., addRequest AddRequest, ... // AddRequest ::= [APPLICATION 8] SEQUENCE { 0x04, 0x20, // entry LDAPDN, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', // attributes AttributeList } 0x30, 0x02, // AttributeList ::= SEQUENCE OF SEQUENCE { 0x30, 0x00 } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<AddRequest> container = new LdapMessageContainer<>( codec ); // Decode a AddRequest message assertThrows( DecoderException.class, ( ) -> { Asn1Decoder.decode( stream, container ); } ); }
Example #26
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test the decoding of a AddRequest with a empty attributeList */ @Test public void testDecodeAddRequestNoVals() throws DecoderException { ByteBuffer stream = ByteBuffer.allocate( 0x30 ); stream.put( new byte[] { 0x30, 0x2E, // LDAPMessage ::= SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x68, 0x29, // CHOICE { ..., addRequest AddRequest, ... // AddRequest ::= [APPLICATION 8] SEQUENCE { 0x04, 0x20, // entry LDAPDN, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', // attributes AttributeList } 0x30, 0x05, // AttributeList ::= SEQUENCE OF SEQUENCE { 0x30, 0x03, // attribute 1 0x04, 0x01, // type AttributeDescription, 'A' } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<AddRequest> container = new LdapMessageContainer<>( codec ); // Decode a AddRequest message assertThrows( DecoderException.class, ( ) -> { Asn1Decoder.decode( stream, container ); } ); }
Example #27
Source File: AddRequestTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test the decoding of a AddRequest with a empty attributeList */ @Test public void testDecodeAddRequestNullVals() throws DecoderException { ByteBuffer stream = ByteBuffer.allocate( 0x32 ); stream.put( new byte[] { 0x30, 0x30, // LDAPMessage ::= SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x68, 0x2B, // CHOICE { ..., addRequest AddRequest, ... // AddRequest ::= [APPLICATION 8] SEQUENCE { 0x04, 0x20, // entry LDAPDN, 'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm', // attributes AttributeList } 0x30, 0x07, // AttributeList ::= SEQUENCE OF SEQUENCE { 0x30, 0x05, // attribute 1 0x04, 0x01, // type AttributeDescription, 'A', 0x31, 0x00 } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<AddRequest> container = new LdapMessageContainer<>( codec ); // Decode a AddRequest message assertThrows( DecoderException.class, ( ) -> { Asn1Decoder.decode( stream, container ); } ); }
Example #28
Source File: LdapServer.java From MyVirtualDirectory with Apache License 2.0 | 5 votes |
/** * Inject the MessageReceived and MessageSent handler into the IoHandler * * @param addRequestHandler The AddRequest message received handler * @param addResponseHandler The AddResponse message sent handler */ public void setAddHandlers( LdapRequestHandler<AddRequest> addRequestHandler, LdapResponseHandler<AddResponse> addResponseHandler ) { this.handler.removeReceivedMessageHandler( AddRequest.class ); this.addRequestHandler = addRequestHandler; this.addRequestHandler.setLdapServer( this ); this.handler.addReceivedMessageHandler( AddRequest.class, this.addRequestHandler ); this.handler.removeSentMessageHandler( AddResponse.class ); this.addResponseHandler = addResponseHandler; this.addResponseHandler.setLdapServer( this ); this.handler.addSentMessageHandler( AddResponse.class, this.addResponseHandler ); }
Example #29
Source File: LdapServer.java From MyVirtualDirectory with Apache License 2.0 | 5 votes |
/** * Inject the MessageReceived and MessageSent handler into the IoHandler * * @param addRequestHandler The AddRequest message received handler * @param addResponseHandler The AddResponse message sent handler */ public void setAddHandlers( LdapRequestHandler<AddRequest> addRequestHandler, LdapResponseHandler<AddResponse> addResponseHandler ) { this.handler.removeReceivedMessageHandler( AddRequest.class ); this.addRequestHandler = addRequestHandler; this.addRequestHandler.setLdapServer( this ); this.handler.addReceivedMessageHandler( AddRequest.class, this.addRequestHandler ); this.handler.removeSentMessageHandler( AddResponse.class ); this.addResponseHandler = addResponseHandler; this.addResponseHandler.setLdapServer( this ); this.handler.addSentMessageHandler( AddResponse.class, this.addResponseHandler ); }
Example #30
Source File: ApacheLdapProviderImpl.java From ldapchai with GNU Lesser General Public License v2.1 | 5 votes |
public void createEntry( final String entryDN, final Set<String> baseObjectClasses, final Map<String, String> stringAttributes ) throws ChaiOperationException, ChaiUnavailableException, IllegalStateException { activityPreCheck(); getInputValidator().createEntry( entryDN, baseObjectClasses, stringAttributes ); try { final AddRequest addRequest = new AddRequestImpl(); final Entry entry = new DefaultEntry(); entry.setDn( entryDN ); for ( final String baseObjectClass : baseObjectClasses ) { entry.add( ChaiConstant.ATTR_LDAP_OBJECTCLASS, baseObjectClass ); } for ( final Map.Entry<String, String> entryIter : stringAttributes.entrySet() ) { final String name = entryIter.getKey(); final String value = entryIter.getValue(); entry.add( name, value ); } final AddResponse response = connection.add( addRequest ); processResponse( response ); } catch ( LdapException e ) { throw ChaiOperationException.forErrorMessage( e.getMessage() ); } }