Package org.apache.directory.shared.ldap.schema

Examples of org.apache.directory.shared.ldap.schema.MatchingRule



    public void delete( LdapDN name, ServerEntry entry, boolean cascade ) throws Exception
    {
        String schemaName = getSchemaName( name );
        MatchingRule mr = factory.getMatchingRule( entry, targetRegistries, schemaName );
        Set<ServerEntry> dependees = dao.listMatchingRuleDependents( mr );
       
        if ( dependees != null && dependees.size() > 0 )
        {
            throw new LdapOperationNotSupportedException( "The matchingRule with OID " + mr.getOid()
                + " cannot be deleted until all entities"
                + " using this matchingRule have also been deleted.  The following dependees exist: "
                + getOids( dependees ),
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
View Full Code Here


   
    public void rename( LdapDN name, ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
    {
        Schema schema = getSchema( name );
        MatchingRule oldMr = factory.getMatchingRule( entry, targetRegistries, schema.getSchemaName() );
        Set<ServerEntry> dependees = dao.listMatchingRuleDependents( oldMr );
       
        if ( dependees != null && dependees.size() > 0 )
        {
            throw new LdapOperationNotSupportedException( "The matchingRule with OID " + oldMr.getOid()
                + " cannot be deleted until all entities"
                + " using this matchingRule have also been deleted.  The following dependees exist: "
                + getOids( dependees ),
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }

        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
        String newOid = ( String ) newRdn.getValue();
        checkOidIsUnique( newOid );
       
        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
        MatchingRule mr = factory.getMatchingRule( targetEntry, targetRegistries, schema.getSchemaName() );

        if ( ! schema.isDisabled() )
        {
            matchingRuleRegistry.unregister( oldMr.getOid() );
            matchingRuleRegistry.register( mr );
View Full Code Here

    public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRdn, boolean deleteOldRn,
        ServerEntry entry, boolean cascade ) throws Exception
    {
        checkNewParent( newParentName );
        Schema oldSchema = getSchema( oriChildName );
        MatchingRule oldMr = factory.getMatchingRule( entry, targetRegistries, oldSchema.getSchemaName() );
        Set<ServerEntry> dependees = dao.listMatchingRuleDependents( oldMr );
       
        if ( dependees != null && dependees.size() > 0 )
        {
            throw new LdapOperationNotSupportedException( "The matchingRule with OID " + oldMr.getOid()
                + " cannot be deleted until all entities"
                + " using this matchingRule have also been deleted.  The following dependees exist: "
                + getOids( dependees ),
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }

        Schema newSchema = getSchema( newParentName );
        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
        String newOid = ( String ) newRdn.getValue();
        checkOidIsUnique( newOid );
       
        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
        MatchingRule mr = factory.getMatchingRule( targetEntry, targetRegistries, newSchema.getSchemaName() );

        if ( ! oldSchema.isDisabled() )
        {
            matchingRuleRegistry.unregister( oldMr.getOid() );
        }
View Full Code Here

    public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade )
        throws Exception
    {
        checkNewParent( newParentName );
        Schema oldSchema = getSchema( oriChildName );
        MatchingRule oldMr = factory.getMatchingRule( entry, targetRegistries, oldSchema.getSchemaName() );
        Set<ServerEntry> dependees = dao.listMatchingRuleDependents( oldMr );
       
        if ( dependees != null && dependees.size() > 0 )
        {
            throw new LdapOperationNotSupportedException( "The matchingRule with OID " + oldMr.getOid()
                + " cannot be deleted until all entities"
                + " using this matchingRule have also been deleted.  The following dependees exist: "
                + getOids( dependees ),
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }

        Schema newSchema = getSchema( newParentName );
        MatchingRule mr = factory.getMatchingRule( entry, targetRegistries, newSchema.getSchemaName() );
       
        if ( ! oldSchema.isDisabled() )
        {
            matchingRuleRegistry.unregister( oldMr.getOid() );
        }
View Full Code Here

                    continue;
                }
                AttributeType attributeType = attributeTypeRegistry.lookup( oid );
               
                // Check that the attributeType has an EQUALITY matchingRule
                MatchingRule mr = attributeType.getEquality();
               
                if ( mr != null )
                {
                    ( ( JdbmIndex ) index ).init( attributeTypeRegistry.lookup( oid ), workingDirectory );
                    tmp.put( oid, index );
View Full Code Here

        Iterator<MatchingRule> list = registries.getMatchingRuleRegistry().iterator();

        while ( list.hasNext() )
        {
            MatchingRule mr = list.next();
            attr.add( SchemaUtils.render( mr ).toString() );
        }

        return attr;
    }
View Full Code Here

     * @return the comparator for equality matching
     * @throws javax.naming.NamingException if there is a failure
     */
    private Comparator<?> getComparator( String attrId ) throws NamingException
    {
        MatchingRule mrule = getMatchingRule( attrId, EQUALITY_MATCH );
        return mrule.getComparator();
    }
View Full Code Here

     * @return the normalizer for equality matching
     * @throws javax.naming.NamingException if there is a failure
     */
    private Normalizer getNormalizer( String attrId ) throws NamingException
    {
        MatchingRule mrule = getMatchingRule( attrId, EQUALITY_MATCH );
        return mrule.getNormalizer();
    }
View Full Code Here

     * @return the matching rule
     * @throws javax.naming.NamingException if there is a failure
     */
    private MatchingRule getMatchingRule( String attrId, int matchType ) throws NamingException
    {
        MatchingRule mrule = null;
        String oid = oidRegistry.getOid( attrId );
        AttributeType type = attributeTypeRegistry.lookup( oid );

        switch ( matchType )
        {
View Full Code Here

    {
        Pattern regex = null;
        SubstringNode snode = (SubstringNode)node;
        String oid = oidRegistry.getOid( snode.getAttribute() );
        AttributeType type = attributeTypeRegistry.lookup( oid );
        MatchingRule matchingRule = type.getSubstr();
       
        if ( matchingRule == null )
        {
            matchingRule = type.getEquality();
        }
       
        Normalizer normalizer = matchingRule.getNormalizer();
       

        // get the attribute
        EntryAttribute attr = entry.get( snode.getAttribute() );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.schema.MatchingRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.