/** * 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 ); } }
/** * {@inheritDoc} */ public void setSuffix( String suffix ) throws LdapInvalidDnException { this.suffix = new DN( suffix ); }
/** * 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; }
/** * 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; }
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; }
/** * Set the Distinguished Name * * @param dn The Distinguished Name */ public void setDn( String dn ) throws LdapInvalidDnException { entry.setDn( new DN( dn ) ); }
/** * 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; }
/** * {@inheritDoc} */ public void setSuffixDn( String suffixDn ) { protect( "suffixDn" ); try { this.suffixDn = new DN( suffixDn ); } catch ( LdapInvalidDnException e ) { throw new IllegalArgumentException( e ); } }
/** * 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; } }
/** * {@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; }
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(); }
public MockOperation( int count ) throws Exception { this.count = count; this.session = new MockCoreSession( new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), new MockDirectoryService( count ) ); }
/** * @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 ); } }
/** * {@inheritDoc} */ public String normalize( String value ) throws LdapException { DN dn = null; dn = new DN( value ); dn.normalize( schemaManager.getNormalizerMapping() ); return dn.getNormName(); }
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() ); } }
/** * 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(); }
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 ; }
/** * @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 ); } }
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; }
/** * {@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() ); }