001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.ldap.schema.loader; 021 022 023import org.apache.directory.api.ldap.model.entry.Entry; 024import org.apache.directory.api.ldap.model.exception.LdapException; 025import org.apache.directory.api.ldap.model.schema.AttributeType; 026import org.apache.directory.api.ldap.model.schema.LdapComparator; 027import org.apache.directory.api.ldap.model.schema.LdapSyntax; 028import org.apache.directory.api.ldap.model.schema.MatchingRule; 029import org.apache.directory.api.ldap.model.schema.Normalizer; 030import org.apache.directory.api.ldap.model.schema.ObjectClass; 031import org.apache.directory.api.ldap.model.schema.SchemaManager; 032import org.apache.directory.api.ldap.model.schema.SyntaxChecker; 033import org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription; 034import org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription; 035import org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription; 036import org.apache.directory.api.ldap.model.schema.registries.Registries; 037import org.apache.directory.api.ldap.model.schema.registries.Schema; 038 039 040/** 041 * An interface to be implemented by classes needed to create Schema elements. The factory 042 * will creates schema elements based on an Entry. 043 * 044 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 045 * 046 */ 047public interface EntityFactory 048{ 049 /** 050 * Return an instance of the Schema associated to the entry 051 * 052 * @param entry The Schema entry 053 * @return An instance of a Schema 054 * @throws LdapException If the instance can't be created 055 */ 056 Schema getSchema( Entry entry ) throws LdapException; 057 058 059 /** 060 * Construct an AttributeType from an entry representing an AttributeType. 061 * 062 * @param schemaManager The Schema Manager 063 * @param entry The entry containing all the informations to build an AttributeType 064 * @param targetRegistries The registries containing all the enabled SchemaObjects 065 * @param schemaName The schema this SchemaObject will be part of 066 * @return An AttributeType SchemaObject 067 * @throws LdapException If the AttributeType is invalid 068 */ 069 AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 070 String schemaName ) throws LdapException; 071 072 073 /** 074 * Construct a LdapComparator from a description of a comparator. 075 * 076 * @param schemaManager The Schema Manager 077 * @param comparatorDescription The LdapComparator description object 078 * @param targetRegistries The registries containing all the enabled SchemaObjects 079 * @param schemaName The schema this SchemaObject will be part of 080 * @return A new instance of a LdapComparator 081 * @throws LdapException If the creation has failed 082 */ 083 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, 084 LdapComparatorDescription comparatorDescription, 085 Registries targetRegistries, String schemaName ) throws LdapException; 086 087 088 /** 089 * Retrieve and load a Comparator class from the DIT. 090 * 091 * @param schemaManager The Schema Manager 092 * @param entry The entry containing all the informations to build a LdapComparator 093 * @param targetRegistries The registries containing all the enabled SchemaObjects 094 * @param schemaName The schema this SchemaObject will be part of 095 * @return the loaded Comparator 096 * @throws LdapException if anything fails during loading 097 */ 098 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, 099 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}