org.apache.directory.ldap.client.api.LdapConnection.add()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.directory.ldap.client.api.LdapConnection.add()方法的一些代码示例,展示了LdapConnection.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LdapConnection.add()方法的具体详情如下:
包路径:org.apache.directory.ldap.client.api.LdapConnection
类名称:LdapConnection
方法名:add

LdapConnection.add介绍

[英]Add an entry to the server.
[中]向服务器添加一个条目。

代码示例

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@inheritDoc}
 */
@Override
public void add( Entry entry ) throws LdapException
{
  connection.add( entry );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@inheritDoc}
 */
@Override
public void add( Entry entry ) throws LdapException
{
  connection.add( entry );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@inheritDoc}
 */
@Override
public void add( Entry entry ) throws LdapException
{
  connection.add( entry );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@inheritDoc}
 */
@Override
public AddResponse add( AddRequest addRequest ) throws LdapException
{
  return connection.add( addRequest );
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@inheritDoc}
 */
@Override
public AddResponse add( AddRequest addRequest ) throws LdapException
{
  return connection.add( addRequest );
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@inheritDoc}
 */
@Override
public AddResponse add( AddRequest addRequest ) throws LdapException
{
  return connection.add( addRequest );
}

代码示例来源:origin: org.apache.directory.fortress/fortress-core

/**
 * Add a new ldap entry to the directory.  Do not add audit context.
 *
 * @param connection handle to ldap connection.
 * @param entry      contains data to add..
 * @throws LdapException in the event system error occurs.
 */
protected void add( LdapConnection connection, Entry entry ) throws LdapException
{
  COUNTERS.incrementAdd();
  connection.add( entry );
}

代码示例来源:origin: org.apache.directory.client.ldap/ldap-client-api

/**
 * Add an entry to the server. This is a blocking add : the user has 
 * to wait for the response until the AddResponse is returned.
 * 
 * @param entry The entry to add
 * @result the add operation's response 
 */
public AddResponse add( Entry entry ) throws LdapException
{
  if ( entry == null )
  {
    String msg = "Cannot add empty entry";
    LOG.debug( msg );
    throw new NullPointerException( msg );
  }
  return add( new AddRequest( entry ) );
}

代码示例来源:origin: com.qwazr/qwazr-library-ldap

public void add(final LdapConnection connection, final String dn, final Object... elements) throws LdapException {
  connection.bind();
  connection.add(new DefaultEntry(dn, elements));
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@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 );
  }
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@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 );
  }
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@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 );
  }
}

代码示例来源:origin: com.qwazr/qwazr-library-ldap

public void createUser(final LdapConnection connection, final String dn, final String passwordAttribute,
    final String clearPassword, final Map<String, Object> attrs) throws LdapException {
  connection.bind();
  final Entry entry = new DefaultEntry(dn + ", " + baseDn);
  if (clearPassword != null)
    entry.add(passwordAttribute, getShaPassword(clearPassword));
  if (attrs != null) {
    for (Map.Entry<String, Object> attr : attrs.entrySet()) {
      final String key = attr.getKey();
      final Object value = attr.getValue();
      if (value instanceof String) {
        entry.add(key, (String) value);
      } else if (value instanceof ScriptObjectMirror) {
        final ScriptObjectMirror som = (ScriptObjectMirror) value;
        if (som.isArray()) {
          for (Object obj : som.values())
            entry.add(key, obj.toString());
        } else
          throw new LdapException("Unsupported hash: " + som);
      } else
        throw new LdapException("Unsupported type: " + value.getClass());
    }
  }
  connection.add(entry);
}

代码示例来源:origin: org.apache.camel/camel-ldif

log.debug("attempting add of {}", ldifEntry);
  conn.add(ldifEntry.getEntry());
} else if (ldifEntry.isChangeModify()) {
  if (log.isDebugEnabled()) {

代码示例来源:origin: org.apache.directory.fortress/fortress-core

/**
 * Add a new ldap entry to the directory.  Add audit context.
 *
 * @param connection handle to ldap connection.
 * @param entry      contains data to add..
 * @param entity     contains audit context.
 * @throws LdapException in the event system error occurs.
 */
protected void add( LdapConnection connection, Entry entry, FortEntity entity ) throws LdapException
{
  COUNTERS.incrementAdd();
  if ( !Config.getInstance().isAuditDisabled() && ( entity != null ) && ( entity.getAdminSession() != null ) )
  {
    if ( StringUtils.isNotEmpty( entity.getAdminSession().getInternalUserId() ) )
    {
      entry.add( GlobalIds.FT_MODIFIER, entity.getAdminSession().getInternalUserId() );
    }
    if ( StringUtils.isNotEmpty( entity.getModCode() ) )
    {
      entry.add( GlobalIds.FT_MODIFIER_CODE, entity.getModCode() );
    }
    if ( StringUtils.isNotEmpty( entity.getModId() ) )
    {
      entry.add( GlobalIds.FT_MODIFIER_ID, entity.getModId() );
    }
  }
  connection.add( entry );
}

代码示例来源:origin: org.openengsb.infrastructure/org.openengsb.infrastructure.ldap

/**
 * Inserts an entry into the DIT. Throws {@link EntryAlreadyExistsException} if an entry with given Dn already
 * exists. Throws {@link MissingParentException} if an ancestor of the entry is missing.
 */
public void store(Entry entry) throws EntryAlreadyExistsException, MissingParentException {
  AddRequest addRequest = new AddRequestImpl().setEntry(entry);
  LdapResult result;
  try {
    result = connection.add(addRequest).getLdapResult();
  } catch (LdapException e) {
    throw new LdapDaoException(e);
  }
  if (result.getResultCode() == ResultCodeEnum.ENTRY_ALREADY_EXISTS) {
    throw new EntryAlreadyExistsException(entry);
  } else if (result.getResultCode() == ResultCodeEnum.NO_SUCH_OBJECT) {
    throw new MissingParentException(lastMatch(entry.getDn()));
  } else if (result.getResultCode() != ResultCodeEnum.SUCCESS) {
    throw new LdapDaoException(result.getDiagnosticMessage());
  }
}

代码示例来源:origin: org.apache.kerby/ldap-backend

entry.add(KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT,
      toGeneralizedTime(identity.getExpireTime()));
  connection.add(entry);
} catch (LdapInvalidDnException e) {
  LOG.error("Error occurred while adding identity", e);

代码示例来源:origin: apache/directory-kerby

entry.add(KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT,
      toGeneralizedTime(identity.getExpireTime()));
  connection.add(entry);
} catch (LdapInvalidDnException e) {
  LOG.error("Error occurred while adding identity", e);

代码示例来源:origin: org.apache.directory.api/api-all

AddResponse response = connection.add( ( AddRequest ) request );
resultCode = response.getLdapResult().getResultCode();
AddResponseDsml addResponseDsml = new AddResponseDsml( connection.getCodecService(), response );

相关文章