/** * @param schemaManager the schemaManager to set */ public void setSchemaManager( SchemaManager schemaManager ) { this.schemaManager = schemaManager; if ( !dn.isSchemaAware() ) { try { dn = new Dn( schemaManager, dn ); } catch ( LdapInvalidDnException lide ) { // TODO: manage this exception } } }
/** * Creates a new LDAP/X500 principal without any group associations. Keep * this package friendly so only code in the package can create a * trusted principal. * * @param schemaManager The SchemaManager * @param dn the normalized distinguished name of the principal * @param authenticationLevel the authentication level for this principal */ public LdapPrincipal( SchemaManager schemaManager, Dn dn, AuthenticationLevel authenticationLevel ) { this.schemaManager = schemaManager; this.dn = dn; if ( !dn.isSchemaAware() ) { throw new IllegalStateException( I18n.err( I18n.ERR_436 ) ); } this.authenticationLevel = authenticationLevel; this.userPasswords = null; }
/** * {@inheritDoc} */ @Override public void setSuffixDn( Dn suffixDn ) throws LdapInvalidDnException { checkInitialized( "suffixDn" ); if ( suffixDn.isSchemaAware() ) { this.suffixDn = suffixDn; } else { this.suffixDn = new Dn( schemaManager, suffixDn ); } }
/** * Normalize a Dn * @param value The Dn to normalize * @return A normalized Dn * @throws LdapException If the DN is invalid */ public String normalize( Dn value ) throws LdapException { Dn dn = value; if ( !value.isSchemaAware() ) { dn = new Dn( schemaManager, value ); } return dn.getNormName(); }
/** * Normalize a Dn * @param value The Dn to normalize * @return A normalized Dn * @throws LdapException If the DN is invalid */ public String normalize( Dn value ) throws LdapException { Dn dn = value; if ( !value.isSchemaAware() ) { dn = new Dn( schemaManager, value ); } return dn.getNormName(); }
/** * Normalize a Dn * @param value The Dn to normalize * @return A normalized Dn * @throws LdapException If the DN is invalid */ public String normalize( Dn value ) throws LdapException { Dn dn = value; if ( !value.isSchemaAware() ) { dn = new Dn( schemaManager, value ); } return dn.getNormName(); }
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
private Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; }
/** * Get the DN from the given object * * @param obj The object containing a DN (either as an instance of Dn or as a String) * @return A Dn instance * @throws LdapInvalidDnException If the Dn is invalid */ public Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; } }
/** * Get the DN from the given object * * @param obj The object containing a DN (either as an instance of Dn or as a String) * @return A Dn instance * @throws LdapInvalidDnException If the Dn is invalid */ public Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; } }
/** * Get the DN from the given object * * @param obj The object containing a DN (either as an instance of Dn or as a String) * @return A Dn instance * @throws LdapInvalidDnException If the Dn is invalid */ public Dn getDn( Object obj ) throws LdapInvalidDnException { Dn dn; if ( obj instanceof Dn ) { dn = ( Dn ) obj; dn = dn.isSchemaAware() ? dn : new Dn( schemaManager, dn ); } else if ( obj instanceof String ) { dn = new Dn( schemaManager, ( String ) obj ); } else { throw new IllegalStateException( I18n.err( I18n.ERR_13720_CANNOT_HANDLE_DN_COMPARISONS, obj == null ? null : obj.getClass() ) ); } return dn; } }
/** * Creates a new instance of DefaultEntry, with a * Dn and a list of IDs. * * @param schemaManager The reference to the schemaManager * @param dn The Dn for this serverEntry. Can be null. * @param elements The list of attributes to create. * @throws LdapException If the provided Dn or Elements are invalid */ public DefaultEntry( SchemaManager schemaManager, Dn dn, Object... elements ) throws LdapException { DefaultEntry entry = ( DefaultEntry ) createEntry( schemaManager, elements ); this.dn = dn; this.attributes = entry.attributes; this.schemaManager = schemaManager; if ( schemaManager != null ) { if ( !dn.isSchemaAware() ) { this.dn = new Dn( schemaManager, dn ); } initObjectClassAT(); } }
/** * Creates a new instance of DefaultEntry, with a * Dn and a list of IDs. * * @param schemaManager The reference to the schemaManager * @param dn The Dn for this serverEntry. Can be null. * @param elements The list of attributes to create. * @throws LdapException If the provided Dn or Elements are invalid */ public DefaultEntry( SchemaManager schemaManager, Dn dn, Object... elements ) throws LdapException { DefaultEntry entry = ( DefaultEntry ) createEntry( schemaManager, elements ); this.dn = dn; this.attributes = entry.attributes; this.schemaManager = schemaManager; if ( schemaManager != null ) { if ( !dn.isSchemaAware() ) { this.dn = new Dn( schemaManager, dn ); } initObjectClassAT(); } }
/** * Creates a new instance of DefaultEntry, with a * Dn and a list of IDs. * * @param schemaManager The reference to the schemaManager * @param dn The Dn for this serverEntry. Can be null. * @param elements The list of attributes to create. * @throws LdapException If the provided Dn or Elements are invalid */ public DefaultEntry( SchemaManager schemaManager, Dn dn, Object... elements ) throws LdapException { DefaultEntry entry = ( DefaultEntry ) createEntry( schemaManager, elements ); this.dn = dn; this.attributes = entry.attributes; this.schemaManager = schemaManager; if ( schemaManager != null ) { if ( !dn.isSchemaAware() ) { this.dn = new Dn( schemaManager, dn ); } initObjectClassAT(); } }
/** * {@inheritDoc} */ @Override public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException { Dn baseDn = searchContext.getDn(); // TODO since we're handling the *, and + in the EntryFilteringCursor // we may not need this code: we need see if this is actually the // case and remove this code. if ( baseDn.size() == 0 ) { return searchFromRoot( searchContext ); } // Not sure we need this code... if ( !baseDn.isSchemaAware() ) { baseDn = new Dn( schemaManager, baseDn ); } // Normal case : do a search on the specific partition Partition backend = searchContext.getPartition(); return backend.search( searchContext ); }