/** * Compute the real name based on the Dn, assuming that depending on the underlying * OS, some characters are not allowed. * * We don't allow filename which length is > 255 chars. */ private String getFileName( Dn dn ) throws LdapException { StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Rdn rdn : dn.getRdns() ) { // First, get the AT name, or OID String normAT = rdn.getNormType(); AttributeType at = schemaManager.lookupAttributeTypeRegistry( normAT ); String atName = at.getName(); // Now, get the normalized value String normValue = rdn.getAva().getValue().getValue(); if ( isFirst ) { isFirst = false; } else { sb.append( "," ); } sb.append( atName ).append( "=" ).append( normValue ); } return getOSFileName( sb.toString() ); }
/** * Checks that the parent Dn is a valid Dn * * @param newParent The parent DN to check * @param schemaManager The SchemaManager instance * @param objectType The ObjectType to check * @throws LdapException If the deletion failed */ protected void checkParent( Dn newParent, SchemaManager schemaManager, String objectType ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_337 ) ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ) .equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_338, objectType ) ); } if ( !rdn.getValue().equalsIgnoreCase( OBJECT_TYPE_TO_PATH.get( objectType ) ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_339, objectType, OBJECT_TYPE_TO_PATH.get( objectType ) ) ); } }
String name = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName(); String value = rdn.getValue(); newDn = newDn.add( new Rdn( name, value ) ); String type = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName(); buf.append( type ).append( '=' ).append( atav.getValue().getValue() );
private void checkNewParent( Dn newParent ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_402 ) ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_403 ) ); } if ( !rdn.getValue().equalsIgnoreCase( SchemaConstants.SYNTAXES ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_363 ) ); } } }
private void checkNewParent( Dn newParent ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_370 ) ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_371 ) ); } if ( !rdn.getValue().equalsIgnoreCase( SchemaConstants.NORMALIZERS_AT ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_372 ) ); } } }
private void checkNewParent( Dn newParent ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, "The parent dn of a objectClass should be at most 3 name components in length." ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_376 ) ); } if ( !rdn.getValue().equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_377 ) ); } } }
public void rename( Entry entry, Rdn newRdn, boolean cascade ) throws LdapException String rdnAttribute = newRdn.getNormType(); String rdnAttributeOid = schemaManager.getAttributeTypeRegistry().getOidByName( rdnAttribute );
private void checkNewParent( Dn newParent ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_357 ) ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_358 ) ); } if ( !rdn.getValue().equalsIgnoreCase( SchemaConstants.COMPARATORS_AT ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_359 ) ); } } }
private void checkNewParent( Dn newParent ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_361 ) ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_362 ) ); } if ( !rdn.getValue().equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_363 ) ); } } }
private void checkNewParent( Dn newParent ) throws LdapException { if ( newParent.size() != 3 ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_396 ) ); } Rdn rdn = newParent.getRdn(); if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_397 ) ); } if ( !rdn.getValue().equalsIgnoreCase( SchemaConstants.SYNTAX_CHECKERS_AT ) ) { throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_372 ) ); } } }
&& !( ava.getNormType().equals( oldRdn.getNormType() ) && ava.getValue().getValue().equals( oldRdn.getValue() ) ) )
&& !( ava.getNormType().equals( oldRdn.getNormType() ) && ava.getValue().getValue().equals( oldRdn.getValue() ) ) )
&& !( ava.getNormType().equals( oldRdn.getNormType() ) && ava.getValue().getValue().equals( oldRdn.getValue() ) ) )
boolean keepOldRdn = entry.contains( newRdn.getNormType(), newRdn.getValue() );
if ( SchemaConstants.CN_AT_OID.equals( rdn.getNormType() ) )
boolean keepOldRdn = entry.contains( newRdn.getNormType(), newRdn.getValue() );
boolean keepOldRdn = entry.contains( newRdn.getNormType(), newRdn.getValue() );
boolean deleteOldRdn = !remoteEntry.contains( localRdn.getNormType(), localRdn.getValue() );