本文整理了Java中org.apache.directory.shared.ldap.name.DN.<init>()
方法的一些代码示例,展示了DN.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DN.<init>()
方法的具体详情如下:
包路径:org.apache.directory.shared.ldap.name.DN
类名称:DN
方法名:<init>
[英]Construct an empty DN object
[中]
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* Parse a String and return a DN if the String is a valid DN
*
* @param dn The DN to parse
* @return A DN
* @throws LdapInvalidDnException If the String is not a valid DN
*/
public DN parse( String dn ) throws LdapInvalidDnException
{
return new DN( dn );
}
}
代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-base
/**
* {@inheritDoc}
*/
public void setSuffix( String suffix ) throws LdapInvalidDnException
{
this.suffix = new DN( suffix );
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* Creates a simple subtree whose administrative point is necessarily the
* base and all subordinates underneath (excluding those that are part of
* inner areas) are part of the the subtree.
*/
@SuppressWarnings("unchecked")
public BaseSubtreeSpecification()
{
this.base = new DN();
this.minBaseDistance = 0;
this.maxBaseDistance = UNBOUNDED_MAX;
this.chopAfter = Collections.EMPTY_SET;
this.chopBefore = Collections.EMPTY_SET;
this.refinement = null;
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* Creates a simple subtree refinement whose administrative point is
* necessarily the base and only those subordinates selected by the
* refinement filter are included.
*
* @param refinement
* the filter expression only composed of objectClass attribute
* value assertions
*/
@SuppressWarnings("unchecked")
public BaseSubtreeSpecification(ExprNode refinement)
{
this.base = new DN();
this.minBaseDistance = 0;
this.maxBaseDistance = UNBOUNDED_MAX;
this.chopAfter = Collections.EMPTY_SET;
this.chopBefore = Collections.EMPTY_SET;
this.refinement = refinement;
}
代码示例来源:origin: stackoverflow.com
private boolean isGroupContainUser(LDAPConnection ldapConnection, String groupDn, String userDn) throws LDAPException {
boolean ret = false;
Entry groupEntry = ldapConnection.getEntry(groupDn);
String[] memberValues = groupEntry.getAttributeValues("uniquemember");
if (memberValues != null) {
DN ldapUserDn = new DN(userDn);
for (String memberEntryDnString : memberValues) {
DN memberEntryDn = new DN(memberEntryDnString);
if (memberEntryDn.equals(ldapUserDn)) {
ret = true;
break;
}
}
}
return ret;
}
代码示例来源:origin: org.apache.directory.shared/shared-ldif
/**
* Set the Distinguished Name
*
* @param dn The Distinguished Name
*/
public void setDn( String dn ) throws LdapInvalidDnException
{
entry.setDn( new DN( dn ) );
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* Parses a DN from a String
*
* @param name The DN to parse
* @return A valid DN
* @throws LdapException If the DN was invalid
*/
public DN parse( String name ) throws LdapException
{
DN dn = new DN();
parseDn( name, dn );
return dn;
}
代码示例来源:origin: org.apache.directory.server/apacheds-avl-partition
/**
* {@inheritDoc}
*/
public void setSuffixDn( String suffixDn )
{
protect( "suffixDn" );
try
{
this.suffixDn = new DN( suffixDn );
}
catch ( LdapInvalidDnException e )
{
throw new IllegalArgumentException( e );
}
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* Validate a DN
*
* @param dn The DN to be parsed
*
* @return <code>true</code> if the DN is valid
*/
public static boolean validateInternal( String name )
{
DN dn = new DN();
try
{
parseInternal( name, dn.rdns );
return true;
}
catch ( LdapInvalidDnException e )
{
return false;
}
}
代码示例来源:origin: org.apache.directory.server/apacheds-avl-partition
/**
* {@inheritDoc}
*/
public DN getUpSuffix()
{
if ( suffixDn == null )
{
return null;
}
try
{
return new DN( suffixDn.getName() );
}
catch ( LdapInvalidDnException e )
{
// shouldn't happen
LOG.error( "", e );
}
return null;
}
代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools
public String toString()
{
StringBuffer buf = new StringBuffer();
try
{
DN dn = new DN( partition.getEntryDn( id ) );
buf.append( "(" ).append( id ).append( ") " );
buf.append( dn.getRdn() );
}
catch ( Exception e )
{
buf.append( "ERROR: " + e.getLocalizedMessage() );
}
if ( children.size() > 0 )
{
buf.append( " [" ).append( children.size() ).append( "]" );
}
return buf.toString();
}
代码示例来源:origin: org.apache.directory.server/apacheds-core-mock
public MockOperation( int count ) throws Exception
{
this.count = count;
this.session = new MockCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ),
new MockDirectoryService( count ) );
}
代码示例来源:origin: org.apache.directory.client.ldap/ldap-client-api
/**
* @see #move(DN, DN)
*/
public ModifyDnResponse move( String entryDn, String newSuperiorDn ) throws LdapException
{
try
{
return move( new DN( entryDn ), new DN( newSuperiorDn ) );
}
catch ( InvalidNameException e )
{
LOG.error( e.getMessage(), e );
throw new LdapException( e.getMessage(), e );
}
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* {@inheritDoc}
*/
public String normalize( String value ) throws LdapException
{
DN dn = null;
dn = new DN( value );
dn.normalize( schemaManager.getNormalizerMapping() );
return dn.getNormName();
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
public final void distinguishedName() throws RecognitionException, TokenStreamException {
Token token = null;
log.debug( "entered distinguishedName()" );
try { // for error handling
token = LT(1);
match(SAFEUTF8STRING);
new DN( token.getText() );
log.debug( "recognized a DistinguishedName: " + token.getText() );
}
catch (Exception e) {
throw new RecognitionException( "dnParser failed for " + token.getText() + " " + e.getMessage() );
}
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* Normalize a DN
* @param value The DN to normalize
* @return A normalized DN
* @throws LdapException
*/
public String normalize( DN value ) throws LdapException
{
DN dn = null;
dn = new DN( value );
dn.normalize( schemaManager.getNormalizerMapping() );
return dn.getNormName();
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
public final DN distinguishedName() throws RecognitionException, TokenStreamException {
DN name ;
Token nameToken = null;
log.debug( "entered distinguishedName()" );
name = null;
try { // for error handling
nameToken = LT(1);
match(UTF8String);
name = new DN( nameToken.getText() );
}
catch (Exception e) {
throw new RecognitionException( "name parse failed for " + nameToken.getText() + " " + e.getMessage() );
}
return name ;
}
代码示例来源:origin: org.apache.directory.client.ldap/ldap-client-api
/**
* @see #rename(DN, RDN, boolean)
*/
public ModifyDnResponse rename( String entryDn, String newRdn, boolean deleteOldRdn ) throws LdapException
{
try
{
return rename( new DN( entryDn ), new RDN( newRdn ), deleteOldRdn );
}
catch ( InvalidNameException e )
{
LOG.error( e.getMessage(), e );
throw new LdapException( e.getMessage(), e );
}
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
public DN getDn( Object obj ) throws LdapInvalidDnException
{
DN dn = null;
if ( obj instanceof DN )
{
dn = (DN)obj;
dn = ( dn.isNormalized() ? dn : DN.normalize( dn, schemaManager.getNormalizerMapping() ) );
}
else if ( obj instanceof String )
{
dn = new DN( ( String ) obj );
dn.normalize( schemaManager.getNormalizerMapping() );
}
else
{
throw new IllegalStateException( I18n.err( I18n.ERR_04218, (obj == null ? null : obj.getClass() ) ) );
}
return dn;
}
代码示例来源:origin: org.apache.directory.shared/shared-ldap
/**
* {@inheritDoc}
*/
public Value<?> normalize( Value<?> value ) throws LdapException
{
DN dn = null;
String dnStr = value.getString();
dn = new DN( dnStr );
dn.normalize( schemaManager.getNormalizerMapping() );
return new StringValue( dn.getNormName() );
}
内容来源于网络,如有侵权,请联系作者删除!