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 public interface EntityFactory 41 { 42 /** 43 * Return an instance of the Schema associated to the entry 44 * 45 * @param entry The Schema entry 46 * @return An instance of a Schema 47 * @throws Exception If the instance can't be created 48 */ 49 Schema getSchema( Entry entry ) throws Exception; 50 51 52 /** 53 * Construct an AttributeType from an entry representing an AttributeType. 54 * 55 * @param schemaManager The Schema Manager 56 * @param entry The entry containing all the informations to build an AttributeType 57 * @param targetRegistries The registries containing all the enabled SchemaObjects 58 * @param schemaName The schema this SchemaObject will be part of 59 * @return An AttributeType SchemaObject 60 * @throws LdapException If the AttributeType is invalid 61 */ 62 AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 63 String schemaName ) throws LdapException; 64 65 66 /** 67 * Construct a LdapComparator from a description of a comparator. 68 * 69 * @param schemaManager The Schema Manager 70 * @param comparatorDescription The LdapComparator description object 71 * @param targetRegistries The registries containing all the enabled SchemaObjects 72 * @param schemaName The schema this SchemaObject will be part of 73 * @return A new instance of a LdapComparator 74 * @throws Exception If the creation has failed 75 */ 76 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, 77 LdapComparatorDescription comparatorDescription, 78 Registries targetRegistries, String schemaName ) throws Exception; 79 80 81 /** 82 * Retrieve and load a Comparator class from the DIT. 83 * 84 * @param schemaManager The Schema Manager 85 * @param entry The entry containing all the informations to build a LdapComparator 86 * @param targetRegistries The registries containing all the enabled SchemaObjects 87 * @param schemaName The schema this SchemaObject will be part of 88 * @return the loaded Comparator 89 * @throws LdapException if anything fails during loading 90 */ 91 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, 92 Registries targetRegistries, String schemaName ) throws LdapException; 93 94 95 /** 96 * Construct an MatchingRule from an entry get from the Dit 97 * 98 * @param schemaManager The Schema Manager 99 * @param entry The entry containing all the informations to build a MatchingRule 100 * @param targetRegistries The registries containing all the enabled SchemaObjects 101 * @param schemaName The schema this SchemaObject will be part of 102 * @return A MatchingRule SchemaObject 103 * @throws LdapException If the MatchingRule is invalid 104 */ 105 MatchingRule getMatchingRule( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 106 String schemaName ) throws LdapException; 107 108 109 /** 110 * Create a new instance of a Normalizer 111 * 112 * @param schemaManager The Schema Manager 113 * @param normalizerDescription The Normalizer description object 114 * @param targetRegistries The registries containing all the enabled SchemaObjects 115 * @param schemaName The schema this SchemaObject will be part of 116 * @return A new instance of a normalizer 117 * @throws Exception If the creation has failed 118 */ 119 Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription, 120 Registries targetRegistries, String schemaName ) throws Exception; 121 122 123 /** 124 * Retrieve and load a Normalizer class from the DIT. 125 * 126 * @param schemaManager The Schema Manager 127 * @param entry The entry containing all the informations to build a Normalizer 128 * @param targetRegistries The registries containing all the enabled SchemaObjects 129 * @param schemaName The schema this SchemaObject will be part of 130 * @return the loaded Normalizer 131 * @throws LdapException if anything fails during loading 132 */ 133 Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 134 throws LdapException; 135 136 137 /** 138 * 139 * @param schemaManager The Schema Manager 140 * @param entry The entry containing all the informations to build an ObjectClass 141 * @param targetRegistries The registries containing all the enabled SchemaObjects 142 * @param schemaName The schema this SchemaObject will be part of 143 * @return 144 * @throws Exception 145 */ 146 ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 147 throws LdapException; 148 149 150 /** 151 * 152 * @param schemaManager The Schema Manager 153 * @param entry The entry containing all the informations to build a LdapSyntax 154 * @param targetRegistries The registries containing all the enabled SchemaObjects 155 * @param schemaName The schema this SchemaObject will be part of 156 * @return 157 * @throws LdapException 158 */ 159 LdapSyntax getSyntax( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) 160 throws LdapException; 161 162 163 /** 164 * Retrieve and load a syntaxChecker class from the DIT. 165 * 166 * @param schemaManager The Schema Manager 167 * @param entry The entry containing all the informations to build a SyntaxChecker 168 * @param targetRegistries The registries containing all the enabled SchemaObjects 169 * @param schemaName The schema this SchemaObject will be part of 170 * @return the loaded SyntaxChecker 171 * @throws LdapException if anything fails during loading 172 */ 173 SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 174 String schemaName ) throws LdapException; 175 176 177 /** 178 * Create a new instance of a SyntaxChecker 179 * 180 * @param schemaManager The Schema Manager 181 * @param syntaxCheckerDescription The SyntaxChecker description object 182 * @param targetRegistries The registries containing all the enabled SchemaObjects 183 * @param schemaName The schema this SchemaObject will be part of 184 * @return A new instance of a syntaxChecker 185 * @throws Exception If the creation has failed 186 */ 187 SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription syntaxCheckerDescription, 188 Registries targetRegistries, String schemaName ) throws Exception; 189 }