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