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

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


                            return null;
                        }

                        public Normalizer getNormalizer() throws NamingException
                        {
                            return new Normalizer()
                            {
                                private static final long serialVersionUID = 1L;

                                public Value<?> normalize( Value<?> value ) throws NamingException
                                {
                                    return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
                                }
                               
                                public String normalize( String value ) throws NamingException
                                {
                                    return StringTools.deepTrimToLower( value );
                                }
                            };
                        }

                        public boolean isObsolete()
                        {
                            return false;
                        }

                        public String getOid()
                        {
                            return null;
                        }

                        public String[] getNamesRef()
                        {
                            return null;
                        }

                        public String getName()
                        {
                            return null;
                        }

                        public String getDescription()
                        {
                            return null;
                        }

                        public String getSchema()
                        {
                            return null;
                        }

                        public void setSchema( String schemaName )
                        {
                        }
                    };
                }


                public MatchingRule getOrdering() throws NamingException
                {
                    return null;
                }


                public MatchingRule getSubstr() throws NamingException
                {
                    return null;
                }


                public boolean isAncestorOf( AttributeType descendant ) throws NamingException
                {
                    return false;
                }


                public boolean isDescendantOf( AttributeType ancestor ) throws NamingException
                {
                    return false;
                }


                public boolean isObsolete()
                {
                    return false;
                }


                public String getOid()
                {
                    return String.valueOf( id.hashCode() );
                }


                public String[] getNamesRef()
                {
                    return new String[]
                        { id };
                }


                public String getName()
                {
                    return id;
                }


                public String getDescription()
                {
                    return id;
                }


                public String getSchema()
                {
                    return null;
                }


                public void setSchema( String schemaName )
                {
                }
            };
        }
        else
        {
            return new AttributeType()
            {
                private static final long serialVersionUID = 1L;

                public boolean isSingleValue()
                {
                    return false;
                }


                public boolean isCanUserModify()
                {
                    return true;
                }


                public boolean isCollective()
                {
                    return false;
                }


                public UsageEnum getUsage()
                {
                    return null;
                }


                public AttributeType getSuperior() throws NamingException
                {
                    return null;
                }


                public Syntax getSyntax() throws NamingException
                {
                    return new Syntax()
                    {

                        private static final long serialVersionUID = 1L;

                        public boolean isHumanReadable()
                        {
                            return true;
                        }

                        public SyntaxChecker getSyntaxChecker() throws NamingException
                        {
                            return null;
                        }

                        public boolean isObsolete()
                        {
                            return false;
                        }

                        public String getOid()
                        {
                            return null;
                        }

                        public String[] getNamesRef()
                        {
                            return null;
                        }

                        public String getName()
                        {
                            return null;
                        }

                        public String getDescription()
                        {
                            return null;
                        }

                        public String getSchema()
                        {
                            return null;
                        }

                        public void setSchema( String schemaName )
                        {
                        }
                    };
                }


                public int getLength()
                {
                    return 0;
                }


                public MatchingRule getEquality() throws NamingException
                {
                    return new MatchingRule()
                    {
                        private static final long serialVersionUID = 1L;

                        public Syntax getSyntax() throws NamingException
                        {
                            return new Syntax()
                            {
                                private static final long serialVersionUID = 1L;


                                public boolean isHumanReadable()
                                {
                                    return true;
                                }

                                public SyntaxChecker getSyntaxChecker() throws NamingException
                                {
                                    return null;
                                }

                                public boolean isObsolete()
                                {
                                    return false;
                                }

                                public String getOid()
                                {
                                    return null;
                                }

                                public String[] getNamesRef()
                                {
                                    return null;
                                }

                                public String getName()
                                {
                                    return null;
                                }

                                public String getDescription()
                                {
                                    return null;
                                }

                                public String getSchema()
                                {
                                    return null;
                                }

                                public void setSchema( String schemaName )
                                {
                                }
                            };
                        }

                        public Comparator getComparator() throws NamingException
                        {
                            return null;
                        }

                        public Normalizer getNormalizer() throws NamingException
                        {
                            return new Normalizer()
                            {
                                private static final long serialVersionUID = 1L;

                                public Value<?> normalize( Value<?> value ) throws NamingException
                                {
View Full Code Here


    {
        DN name = opContext.getDn();
        ServerEntry entry = opContext.getEntry();
        String schemaName = getSchemaName( name );
        String oldOid = getOid( entry );
        Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(),
            schemaName );

        if ( isSchemaEnabled( schemaName ) )
        {
            normalizer.setSchemaName( schemaName );

            schemaManager.unregisterNormalizer( oldOid );
            schemaManager.add( normalizer );

            return SCHEMA_MODIFIED;
View Full Code Here

        checkOidIsUniqueForNormalizer( entry );

        // Build the new Normalizer from the given entry
        String schemaName = getSchemaName( dn );

        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );

        // At this point, the constructed Normalizer has not been checked against the
        // existing Registries. It will be checked there, if the schema and the
        // Normalizer are both enabled.
        Schema schema = schemaManager.getLoadedSchema( schemaName );
        List<Throwable> errors = new ArrayList<Throwable>();

        if ( schema.isEnabled() && normalizer.isEnabled() )
        {
            if ( schemaManager.add( normalizer ) )
            {
                LOG.debug( "Added {} into the enabled schema {}", dn.getName(), schemaName );
            }
View Full Code Here

        // The parent DN must be ou=normalizers,cn=<schemaName>,ou=schema
        checkParent( parentDn, schemaManager, SchemaConstants.NORMALIZER );

        // Get the Normalizer from the given entry ( it has been grabbed from the server earlier)
        String schemaName = getSchemaName( entry.getDn() );
        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );

        String oid = normalizer.getOid();

        if ( isSchemaEnabled( schemaName ) )
        {
            if ( schemaManager.getRegistries().isReferenced( normalizer ) )
            {
View Full Code Here

            DN newDn = new DN( targetEntry.getDn() );
            newDn.remove( newDn.size() - 1 );
            newDn.add( newRdn );
            targetEntry.setDn( newDn );

            Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(),
                schemaName );
            schemaManager.unregisterNormalizer( oldOid );
            schemaManager.add( normalizer );
        }
    }
View Full Code Here

                I18n.err( I18n.ERR_367, oldOid ) );
        }

        String oid = ( String ) newRdn.getNormValue();
        checkOidIsUniqueForNormalizer( oid );
        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(),
            newSchemaName );

        if ( isSchemaEnabled( oldSchemaName ) )
        {
            schemaManager.unregisterNormalizer( oldOid );
View Full Code Here

        {
            throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
                I18n.err( I18n.ERR_368, oid ) );
        }

        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(),
            newSchemaName );

        if ( isSchemaEnabled( oldSchemaName ) )
        {
            schemaManager.unregisterNormalizer( oid );
View Full Code Here

        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mr = TestServerEntryUtils.matchingRuleFactory( "1.1.2.1" );
        mr.setSyntax( s );
       
        mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mr.setNormalizer( new Normalizer( "1.1.1" )
        {
            private static final long serialVersionUID = 1L;
           
            public Value<?> normalize( Value<?> value ) throws NamingException
            {
View Full Code Here

TOP

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

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.