001    
002    package org.apache.directory.shared.ldap.schema;
003    
004    import org.apache.directory.shared.ldap.entry.Entry;
005    import org.apache.directory.shared.ldap.exception.LdapException;
006    import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
007    import org.apache.directory.shared.ldap.schema.parsers.NormalizerDescription;
008    import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
009    import org.apache.directory.shared.ldap.schema.registries.Registries;
010    import org.apache.directory.shared.ldap.schema.registries.Schema;
011    
012    public interface EntityFactory
013    {
014        /**
015         * Return an instance of the Schema associated to the entry
016         *
017         * @param entry The Schema entry
018         * @return An instance of a Schema
019         * @throws Exception If the instance can't be created
020         */
021        Schema getSchema( Entry entry ) throws Exception;
022        
023        
024        /**
025         * Construct an AttributeType from an entry representing an AttributeType.
026         *
027         * @param schemaManager The Schema Manager
028         * @param entry The entry containing all the informations to build an AttributeType
029         * @param targetRegistries The registries containing all the enabled SchemaObjects
030         * @param schemaName The schema this SchemaObject will be part of
031         * @return An AttributeType SchemaObject
032         * @throws LdapException If the AttributeType is invalid
033         */
034        AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException;
035    
036        
037        /**
038         * Construct a LdapComparator from a description of a comparator.
039         *
040         * @param schemaManager The Schema Manager
041         * @param comparatorDescription The LdapComparator description object 
042         * @param targetRegistries The registries containing all the enabled SchemaObjects
043         * @param schemaName The schema this SchemaObject will be part of
044         * @return A new instance of a LdapComparator
045         * @throws Exception If the creation has failed
046         */
047        LdapComparator<?> getLdapComparator( SchemaManager schemaManager, 
048            LdapComparatorDescription comparatorDescription, 
049            Registries targetRegistries, String schemaName ) throws Exception;
050        
051        
052        /**
053         * Retrieve and load a Comparator class from the DIT.
054         * 
055         * @param schemaManager The Schema Manager
056         * @param entry The entry containing all the informations to build a LdapComparator
057         * @param targetRegistries The registries containing all the enabled SchemaObjects
058         * @param schemaName The schema this SchemaObject will be part of
059         * @return the loaded Comparator
060         * @throws LdapException if anything fails during loading
061         */
062        LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, 
063            Registries targetRegistries, String schemaName ) throws Exception;
064        
065    
066        /**
067         * Construct an MatchingRule from an entry get from the Dit
068         *
069         * @param schemaManager The Schema Manager
070         * @param entry The entry containing all the informations to build a MatchingRule
071         * @param targetRegistries The registries containing all the enabled SchemaObjects
072         * @param schemaName The schema this SchemaObject will be part of
073         * @return A MatchingRule SchemaObject
074         * @throws LdapException If the MatchingRule is invalid
075         */
076        MatchingRule getMatchingRule( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException;
077    
078    
079        /**
080         * Create a new instance of a Normalizer 
081         *
082         * @param schemaManager The Schema Manager
083         * @param normalizerDescription The Normalizer description object 
084         * @param targetRegistries The registries containing all the enabled SchemaObjects
085         * @param schemaName The schema this SchemaObject will be part of
086         * @return A new instance of a normalizer
087         * @throws Exception If the creation has failed
088         */
089        Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription, 
090            Registries targetRegistries, String schemaName ) throws Exception;
091        
092        
093        /**
094         * Retrieve and load a Normalizer class from the DIT.
095         * 
096         * @param schemaManager The Schema Manager
097         * @param entry The entry containing all the informations to build a Normalizer
098         * @param targetRegistries The registries containing all the enabled SchemaObjects
099         * @param schemaName The schema this SchemaObject will be part of
100         * @return the loaded Normalizer
101         * @throws LdapException if anything fails during loading
102         */
103        Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 
104            throws Exception;
105        
106        
107        /**
108         * 
109         * @param schemaManager The Schema Manager
110         * @param entry The entry containing all the informations to build an ObjectClass
111         * @param targetRegistries The registries containing all the enabled SchemaObjects
112         * @param schemaName The schema this SchemaObject will be part of
113         * @return
114         * @throws Exception
115         */
116        ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws Exception;
117        
118        
119        /**
120         * 
121         * @param schemaManager The Schema Manager
122         * @param entry The entry containing all the informations to build a LdapSyntax
123         * @param targetRegistries The registries containing all the enabled SchemaObjects
124         * @param schemaName The schema this SchemaObject will be part of
125         * @return
126         * @throws LdapException
127         */
128        LdapSyntax getSyntax( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException;
129        
130        
131        /**
132         * Retrieve and load a syntaxChecker class from the DIT.
133         * 
134         * @param schemaManager The Schema Manager
135         * @param entry The entry containing all the informations to build a SyntaxChecker
136         * @param targetRegistries The registries containing all the enabled SchemaObjects
137         * @param schemaName The schema this SchemaObject will be part of
138         * @return the loaded SyntaxChecker
139         * @throws LdapException if anything fails during loading
140         */
141        SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws Exception;
142        
143    
144        /**
145         * Create a new instance of a SyntaxChecker 
146         *
147         * @param schemaManager The Schema Manager
148         * @param syntaxCheckerDescription The SyntaxChecker description object 
149         * @param targetRegistries The registries containing all the enabled SchemaObjects
150         * @param schemaName The schema this SchemaObject will be part of
151         * @return A new instance of a syntaxChecker
152         * @throws Exception If the creation has failed
153         */
154        SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription syntaxCheckerDescription, 
155            Registries targetRegistries, String schemaName ) throws Exception;
156    }