1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.api.ldap.schema.loader; 21 22 23 import org.apache.directory.api.ldap.model.entry.Entry; 24 import org.apache.directory.api.ldap.model.exception.LdapException; 25 import org.apache.directory.api.ldap.model.schema.AttributeType; 26 import org.apache.directory.api.ldap.model.schema.LdapComparator; 27 import org.apache.directory.api.ldap.model.schema.LdapSyntax; 28 import org.apache.directory.api.ldap.model.schema.MatchingRule; 29 import org.apache.directory.api.ldap.model.schema.Normalizer; 30 import org.apache.directory.api.ldap.model.schema.ObjectClass; 31 import org.apache.directory.api.ldap.model.schema.SchemaManager; 32 import org.apache.directory.api.ldap.model.schema.SyntaxChecker; 33 import org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription; 34 import org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription; 35 import org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription; 36 import org.apache.directory.api.ldap.model.schema.registries.Registries; 37 import org.apache.directory.api.ldap.model.schema.registries.Schema; 38 39 40 /** 41 * An interface to be implemented by classes needed to create Schema elements. The factory 42 * will creates schema elements based on an Entry. 43 * 44 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 45 * 46 */ 47 public interface EntityFactory 48 { 49 /** 50 * Return an instance of the Schema associated to the entry 51 * 52 * @param entry The Schema entry 53 * @return An instance of a Schema 54 * @throws LdapException If the instance can't be created 55 */ 56 Schema getSchema( Entry entry ) throws LdapException; 57 58 59 /** 60 * Construct an AttributeType from an entry representing an AttributeType. 61 * 62 * @param schemaManager The Schema Manager 63 * @param entry The entry containing all the informations to build an AttributeType 64 * @param targetRegistries The registries containing all the enabled SchemaObjects 65 * @param schemaName The schema this SchemaObject will be part of 66 * @return An AttributeType SchemaObject 67 * @throws LdapException If the AttributeType is invalid 68 */ 69 AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 70 String schemaName ) throws LdapException; 71 72 73 /** 74 * Construct a LdapComparator from a description of a comparator. 75 * 76 * @param schemaManager The Schema Manager 77 * @param comparatorDescription The LdapComparator description object 78 * @param targetRegistries The registries containing all the enabled SchemaObjects 79 * @param schemaName The schema this SchemaObject will be part of 80 * @return A new instance of a LdapComparator 81 * @throws LdapException If the creation has failed 82 */ 83 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, 84 LdapComparatorDescription comparatorDescription, 85 Registries targetRegistries, String schemaName ) throws LdapException; 86 87 88 /** 89 * Retrieve and load a Comparator class from the DIT. 90 * 91 * @param schemaManager The Schema Manager 92 * @param entry The entry containing all the informations to build a LdapComparator 93 * @param targetRegistries The registries containing all the enabled SchemaObjects 94 * @param schemaName The schema this SchemaObject will be part of 95 * @return the loaded Comparator 96 * @throws LdapException if anything fails during loading 97 */ 98 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, 99 Registries targetRegistries, String schemaName ) throws LdapException; 100 101 102 /** 103 * Construct an MatchingRule from an entry get from the Dit 104 * 105 * @param schemaManager The Schema Manager 106 * @param entry The entry containing all the informations to build a MatchingRule 107 * @param targetRegistries The registries containing all the enabled SchemaObjects 108 * @param schemaName The schema this SchemaObject will be part of 109 * @return A MatchingRule SchemaObject 110 * @throws LdapException If the MatchingRule is invalid 111 */ 112 MatchingRule getMatchingRule( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 113 String schemaName ) throws LdapException; 114 115 116 /** 117 * Create a new instance of a Normalizer 118 * 119 * @param schemaManager The Schema Manager 120 * @param normalizerDescription The Normalizer description object 121 * @param targetRegistries The registries containing all the enabled SchemaObjects 122 * @param schemaName The schema this SchemaObject will be part of 123 * @return A new instance of a normalizer 124 * @throws LdapException If the creation has failed 125 */ 126 Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription, 127 Registries targetRegistries, String schemaName ) throws LdapException; 128 129 130 /** 131 * Retrieve and load a Normalizer class from the DIT. 132 * 133 * @param schemaManager The Schema Manager 134 * @param entry The entry containing all the informations to build a Normalizer 135 * @param targetRegistries The registries containing all the enabled SchemaObjects 136 * @param schemaName The schema this SchemaObject will be part of 137 * @return the loaded Normalizer 138 * @throws LdapException if anything fails during loading 139 */ 140 Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 141 throws LdapException; 142 143 144 /** 145 * 146 * @param schemaManager The Schema Manager 147 * @param entry The entry containing all the informations to build an ObjectClass 148 * @param targetRegistries The registries containing all the enabled SchemaObjects 149 * @param schemaName The schema this SchemaObject will be part of 150 * @return The loaded ObjectClass 151 * @throws LdapException if anything fails during loading 152 */ 153 ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 154 throws LdapException; 155 156 157 /** 158 * 159 * @param schemaManager The Schema Manager 160 * @param entry The entry containing all the informations to build a LdapSyntax 161 * @param targetRegistries The registries containing all the enabled SchemaObjects 162 * @param schemaName The schema this SchemaObject will be part of 163 * @return The loaded Syntax 164 * @throws LdapException if anything fails during loading 165 */ 166 LdapSyntax getSyntax( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 167 throws LdapException; 168 169 170 /** 171 * Retrieve and load a syntaxChecker class from the DIT. 172 * 173 * @param schemaManager The Schema Manager 174 * @param entry The entry containing all the informations to build a SyntaxChecker 175 * @param targetRegistries The registries containing all the enabled SchemaObjects 176 * @param schemaName The schema this SchemaObject will be part of 177 * @return the loaded SyntaxChecker 178 * @throws LdapException if anything fails during loading 179 */ 180 SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 181 String schemaName ) throws LdapException; 182 183 184 /** 185 * Create a new instance of a SyntaxChecker 186 * 187 * @param schemaManager The Schema Manager 188 * @param syntaxCheckerDescription The SyntaxChecker description object 189 * @param targetRegistries The registries containing all the enabled SchemaObjects 190 * @param schemaName The schema this SchemaObject will be part of 191 * @return A new instance of a syntaxChecker 192 * @throws LdapException If the creation has failed 193 */ 194 SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription syntaxCheckerDescription, 195 Registries targetRegistries, String schemaName ) throws LdapException; 196 }