• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LdapInvalidDnException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.directory.api.ldap.model.exception.LdapInvalidDnException的典型用法代码示例。如果您正苦于以下问题:Java LdapInvalidDnException类的具体用法?Java LdapInvalidDnException怎么用?Java LdapInvalidDnException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LdapInvalidDnException类属于org.apache.directory.api.ldap.model.exception包,在下文中一共展示了LdapInvalidDnException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCompareAvaOrder

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
@Test
public void testCompareAvaOrder() throws LdapInvalidDnException
{
    Ava atav1 = new Ava( schemaManager, "cn", "  B  " );
    Ava atav2 = new Ava( schemaManager, "sn", "  c" );
    
    // atav1 should be before atav2
    assertEquals( -1, atav1.compareTo( atav2 ) );
    assertEquals( 1, atav2.compareTo( atav1 ) );

    Ava atav3 = new Ava( schemaManager, "2.5.4.3", "A " );
    
    // Atav1 shoud be after atav3
    assertEquals( 1, atav1.compareTo( atav3 ) );
    assertEquals( -1, atav3.compareTo( atav1 ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:17,代码来源:AvaTest.java


示例2: testSortAva

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
@Test
public void testSortAva() throws LdapInvalidDnException
{
    Ava atav1 = new Ava( schemaManager, "cn", "  B  " );
    Ava atav2 = new Ava( schemaManager, "sn", "  c" );
    Ava atav3 = new Ava( schemaManager, "2.5.4.3", "A " );
    Ava atav4 = new Ava( schemaManager, "2.5.4.11", " C  " );
    Ava atav5 = new Ava( schemaManager, "ou", "B " );
    Ava atav6 = new Ava( schemaManager, "ou", "D " );
    Ava atav7 = new Ava( schemaManager, "CN", " " );

    Ava[] avas = new Ava[] { atav1, atav2, atav3, atav4, atav5, atav6, atav7 };
    
    Arrays.sort( avas );
    
    assertEquals( atav5, avas[0] );
    assertEquals( atav4, avas[1] );
    assertEquals( atav6, avas[2] );
    assertEquals( atav7, avas[3] );
    assertEquals( atav3, avas[4] );
    assertEquals( atav1, avas[5] );
    assertEquals( atav2, avas[6] );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:AvaTest.java


示例3: DefaultEntry

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * <p>
 * Creates a new instance of DefaultEntry, schema aware.
 * </p>
 * <p>
 * No attributes will be created.
 * </p>
 *
 * @param schemaManager The reference to the schemaManager
 * @param dn The String Dn for this serverEntry. Can be null.
 * @throws LdapInvalidDnException If the Dn is invalid
 */
public DefaultEntry( SchemaManager schemaManager, String dn ) throws LdapInvalidDnException
{
    this.schemaManager = schemaManager;

    if ( Strings.isEmpty( dn ) )
    {
        this.dn = Dn.EMPTY_DN;
    }
    else
    {
        this.dn = new Dn( schemaManager, dn );
    }

    // Initialize the ObjectClass object
    initObjectClassAT();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:DefaultEntry.java


示例4: parseDN

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Parse a string and check that it complies with RFC 2253. Here, we will
 * just call the Dn parser to do the job.
 *
 * @param chars The char array to be checked
 * @param pos the starting position
 * @return -1 if the char array does not contains a Dn
 */
private int parseDN( char[] chars, int pos )
{

    int end = pos;

    for ( int i = pos; ( i < chars.length ) && ( chars[i] != '?' ); i++ )
    {
        end++;
    }

    try
    {
        String dnStr = new String( chars, pos, end - pos );
        dn = new Dn( decode( dnStr ) );
    }
    catch ( LdapUriException | LdapInvalidDnException e )
    {
        return -1;
    }

    return end;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:31,代码来源:LdapUrl.java


示例5: createAva

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Construct a schema aware Ava. The AttributeType and value will be checked accordingly
 * to the SchemaManager.
 * <p>
 * Note that the upValue should <b>not</b> be null or empty, or resolve
 * to an empty string after having trimmed it.
 *
 * @param schemaManager The SchemaManager instance
 * @param upType The User Provided type
 * @param value The value
 * 
 * @throws LdapInvalidDnException If the given type or value are invalid
 */
private void createAva( SchemaManager schemaManager, String upType, Value value )
    throws LdapInvalidDnException
{
    StringBuilder sb = new StringBuilder();

    normType = attributeType.getOid();
    this.upType = upType;
    this.value = value;
    
    sb.append( upType );
    sb.append( '=' );
    
    if ( value != null )
    {
        sb.append( Rdn.escapeValue( value.getValue() ) );
    }
    
    upName = sb.toString();

    hashCode();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:Ava.java


示例6: Dn

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Construct an empty Schema aware Dn object
 * 
 *  @param schemaManager The SchemaManager to use
 *  @param dn The Dn to use
 *  @throws LdapInvalidDnException If the Dn is invalid
 */
public Dn( SchemaManager schemaManager, Dn dn ) throws LdapInvalidDnException
{
    this.schemaManager = schemaManager;

    if ( dn == null )
    {
        return;
    }

    for ( Rdn rdn : dn.rdns )
    {
        this.rdns.add( new Rdn( schemaManager, rdn ) );
    }

    toUpName();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:Dn.java


示例7: add

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Add a suffix to the Dn. For instance, if the current Dn is "ou=people",
 * and the suffix "dc=example,dc=com", then the resulting Dn will be 
 * "ou=people,dc=example,dc=com" 
 * 
 * @param comp the suffix to add
 * @return The resulting Dn with the additional suffix
 * @throws LdapInvalidDnException If the resulting Dn is not valid 
 */
public Dn add( String comp ) throws LdapInvalidDnException
{
    if ( comp.length() == 0 )
    {
        return this;
    }

    Dn clonedDn = copy();

    // We have to parse the nameComponent which is given as an argument
    Rdn newRdn = new Rdn( schemaManager, comp );

    clonedDn.rdns.add( 0, newRdn );

    clonedDn.toUpName();

    return clonedDn;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:Dn.java


示例8: Rdn

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 *  A constructor that parse a String representing a schema aware Rdn.
 *
 * @param schemaManager the schema manager
 * @param rdn the String containing the Rdn to parse
 * @throws LdapInvalidDnException if the Rdn is invalid
 */
public Rdn( SchemaManager schemaManager, String rdn ) throws LdapInvalidDnException
{
    if ( Strings.isNotEmpty( rdn ) )
    {
        // Parse the string. The Rdn will be updated.
        parse( schemaManager, rdn, this );

        if ( upName.length() < rdn.length() )
        {
            throw new LdapInvalidDnException( "Invalid RDN" );
        }

        upName = rdn;
    }
    else
    {
        upName = "";
        normName = "";
        normalized = true;
    }

    hashCode();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:31,代码来源:Rdn.java


示例9: isValid

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Validate a NameComponent : <br>
 * <p>
 * &lt;name-component&gt; ::= &lt;attributeType&gt; &lt;spaces&gt; '='
 * &lt;spaces&gt; &lt;attributeValue&gt; &lt;nameComponents&gt;
 * </p>
 *
 * @param dn The string to parse
 * @return <code>true</code> if the Rdn is valid
 */
public static boolean isValid( String dn )
{
    Rdn rdn = new Rdn();

    try
    {
        parse( null, dn, rdn );

        return true;
    }
    catch ( LdapInvalidDnException e )
    {
        return false;
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:Rdn.java


示例10: testDnSetDn

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * test the setDn() method
 */
@Test
public void testDnSetDn() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertNull( url.getDn() );

    Dn dn = new Dn( "dc=example,dc=com" );
    url.setDn( dn );
    assertEquals( dn, url.getDn() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );

    url.setDn( null );
    assertNull( url.getDn() );
    assertEquals( "ldap:///", url.toString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:19,代码来源:LdapUrlTest.java


示例11: testDnSetScope

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * test the setScope() method
 */
@Test
public void testDnSetScope() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertEquals( SearchScope.OBJECT, url.getScope() );

    url.setDn( new Dn( "dc=example,dc=com" ) );

    url.setScope( SearchScope.ONELEVEL );
    assertEquals( SearchScope.ONELEVEL, url.getScope() );
    assertEquals( "ldap:///dc=example,dc=com??one", url.toString() );

    url.setScope( SearchScope.SUBTREE );
    assertEquals( SearchScope.SUBTREE, url.getScope() );
    assertEquals( "ldap:///dc=example,dc=com??sub", url.toString() );

    url.setScope( -1 );
    assertEquals( SearchScope.OBJECT, url.getScope() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:LdapUrlTest.java


示例12: testDnSetFilter

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * test the setFilter() method
 */
@Test
public void testDnSetFilter() throws LdapURLEncodingException, LdapInvalidDnException
{
    LdapUrl url = new LdapUrl();
    assertNull( url.getFilter() );

    url.setDn( new Dn( "dc=example,dc=com" ) );

    url.setFilter( "(objectClass=person)" );
    assertEquals( "(objectClass=person)", url.getFilter() );
    assertEquals( "ldap:///dc=example,dc=com???(objectClass=person)", url.toString() );

    url.setFilter( "(cn=Babs Jensen)" );
    assertEquals( "(cn=Babs Jensen)", url.getFilter() );
    assertEquals( "ldap:///dc=example,dc=com???(cn=Babs%20Jensen)", url.toString() );

    url.setFilter( null );
    assertNull( url.getFilter() );
    assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:LdapUrlTest.java


示例13: initNames

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Initialize name instances
 */
@Before
public void initNames() throws LdapInvalidDnException
{
    Set<String> dnSetA = new HashSet<>();
    dnSetA.add( new Dn( "a=aa" ).getNormName() );
    dnSetA.add( new Dn( "b=bb" ).getNormName() );

    Set<String> dnSetB = new HashSet<>();
    dnSetB.add( new Dn( "b=bb" ).getNormName() );
    dnSetB.add( new Dn( "a=aa" ).getNormName() );

    Set<String> dnSetC = new HashSet<>();
    dnSetC.add( new Dn( "a=aa" ).getNormName() );
    dnSetC.add( new Dn( "b=bb" ).getNormName() );

    Set<String> dnSetD = new HashSet<>();
    dnSetD.add( new Dn( "b=bb" ).getNormName() );
    dnSetD.add( new Dn( "c=cc" ).getNormName() );

    nameA = new Name( dnSetA );
    nameACopy = new Name( dnSetB );
    nameB = new Name( dnSetC );
    nameC = new Name( dnSetD );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:UserClass_NameTest.java


示例14: DefaultEntry

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * <p>
 * Creates a new instance of DefaultEntry, schema aware.
 * </p>
 * <p>
 * No attributes will be created.
 * </p>
 *
 * @param schemaManager The reference to the schemaManager
 * @param dn The String Dn for this serverEntry. Can be null.
 * @throws LdapInvalidDnException If the Dn is invalid
 */
public DefaultEntry( SchemaManager schemaManager, String dn ) throws LdapInvalidDnException
{
    this.schemaManager = schemaManager;

    if ( Strings.isEmpty( dn ) )
    {
        this.dn = Dn.EMPTY_DN;
    }
    else
    {
        this.dn = new Dn( dn );
        normalizeDN( this.dn );
    }

    // Initialize the ObjectClass object
    initObjectClassAT();
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:30,代码来源:DefaultEntry.java


示例15: createDefaultDefinition

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
public static ServerDefinition createDefaultDefinition(AbstractLdapConfiguration configuration) {
	ServerDefinition def = new ServerDefinition();
	def.host = configuration.getHost();
	def.port = configuration.getPort();
	def.connectionSecurity = configuration.getConnectionSecurity();
	def.sslProtocol = configuration.getSslProtocol();
	def.enabledSecurityProtocols = configuration.getEnabledSecurityProtocols();
	def.enabledCipherSuites = configuration.getEnabledCipherSuites();
	def.authenticationType = configuration.getAuthenticationType();
	def.bindDn = configuration.getBindDn();
	def.bindPassword = configuration.getBindPassword();
	def.connectTimeout = configuration.getConnectTimeout();
	try {
		def.baseContext = new Dn(configuration.getBaseContext());
	} catch (LdapInvalidDnException e) {
		throw new ConfigurationException("Wrong DN format in baseContext: "+e.getMessage(), e);
	}
	def.origin = Origin.CONFIGURATION;
	return def;
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:21,代码来源:ServerDefinition.java


示例16: init

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
public void init() throws KerberosException {
    File workingDirectory = dataDir.resolve("work").toFile();
    workingDirectory.mkdirs();
    initDirectoryService(workingDirectory);
    initKdcServer();
    LOGGER.info("Starting kerberos server started on " + host + ":" + port);
    new Thread() {
        @Override
        public void run() {
            try {
                kdcServer.start();
            } catch (IOException | LdapInvalidDnException e) {
                LOGGER.error("Failed to start kdc server", e);
            }
        }
    }.start();
}
 
开发者ID:intropro,项目名称:prairie,代码行数:18,代码来源:KerberosServer.java


示例17: getUserId

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Method will retrieve the userId from a distinguished name variable.
 *
 * @param szDn contains ldap distinguished name.
 * @return userId as string.
 */
private String getUserId(String szDn)
{
    String szUserId = null;
    try
    {
        Dn dn = new Dn( szDn );
        Rdn rDn = dn.getRdn();
        String szRdn = rDn.getName();
        int indexEquals = szRdn.indexOf( '=' ) + 1;
        if (indexEquals != -1)
            szUserId = szRdn.substring( indexEquals );
    }
    catch ( LdapInvalidDnException e )
    {
        String error = "User DN: " + szDn + ", incorrect format: " + e;
        log.warn( error );
        display.setMessage( error );
    }
    return szUserId;
}
 
开发者ID:apache,项目名称:directory-fortress-commander,代码行数:27,代码来源:GroupDetailPanel.java


示例18: testDnGetPrefixPos4

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Get the prefix out of bound
 */
@Test(expected = LdapInvalidDnException.class)
public void testDnGetPrefixPos4() throws LdapException
{
    Dn dn = new Dn( "a=b, c=d,e = f" );

    dn.getAncestorOf( "a=z" );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:DnTest.java


示例19: testDnGetPrefixEmptyDN

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
/**
 * Get the prefix of an empty LdapName
 */
@Test
public void testDnGetPrefixEmptyDN() throws LdapInvalidDnException
{
    Dn dn = new Dn();
    Dn newDn = ( dn.getAncestorOf( "" ) );
    assertEquals( "", newDn.getName() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:DnTest.java


示例20: testDnParsingOneRdnPerf

import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; //导入依赖的package包/类
@Test
@Ignore
public void testDnParsingOneRdnPerf() throws LdapInvalidDnException
{
    long t0 = System.currentTimeMillis();
    
    for ( int i = 0; i < 1000000; i++ )
    {
        new Dn( "dc=example" + i );
    }
    
    long t1 = System.currentTimeMillis();
    System.out.println( "delta new 1 RDN : " + ( t1 - t0 ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:15,代码来源:DnTest.java



注:本文中的org.apache.directory.api.ldap.model.exception.LdapInvalidDnException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientService类代码示例发布时间:2022-05-22
下一篇:
Java State类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap