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.schemaloader; 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 040public interface EntityFactory 041{ 042 /** 043 * Return an instance of the Schema associated to the entry 044 * 045 * @param entry The Schema entry 046 * @return An instance of a Schema 047 * @throws Exception If the instance can't be created 048 */ 049 Schema getSchema( Entry entry ) throws Exception; 050 051 052 /** 053 * Construct an AttributeType from an entry representing an AttributeType. 054 * 055 * @param schemaManager The Schema Manager 056 * @param entry The entry containing all the informations to build an AttributeType 057 * @param targetRegistries The registries containing all the enabled SchemaObjects 058 * @param schemaName The schema this SchemaObject will be part of 059 * @return An AttributeType SchemaObject 060 * @throws LdapException If the AttributeType is invalid 061 */ 062 AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries targetRegistries, 063 String schemaName ) throws LdapException; 064 065 066 /** 067 * Construct a LdapComparator from a description of a comparator. 068 * 069 * @param schemaManager The Schema Manager 070 * @param comparatorDescription The LdapComparator description object 071 * @param targetRegistries The registries containing all the enabled SchemaObjects 072 * @param schemaName The schema this SchemaObject will be part of 073 * @return A new instance of a LdapComparator 074 * @throws Exception If the creation has failed 075 */ 076 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, 077 LdapComparatorDescription comparatorDescription, 078 Registries targetRegistries, String schemaName ) throws Exception; 079 080 081 /** 082 * Retrieve and load a Comparator class from the DIT. 083 * 084 * @param schemaManager The Schema Manager 085 * @param entry The entry containing all the informations to build a LdapComparator 086 * @param targetRegistries The registries containing all the enabled SchemaObjects 087 * @param schemaName The schema this SchemaObject will be part of 088 * @return the loaded Comparator 089 * @throws LdapException if anything fails during loading 090 */ 091 LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, 092 Registries targetRegistries, String schemaName ) throws LdapException; 093 094 095 /** 096 * Construct an MatchingRule from an entry get from the Dit 097 * 098 * @param schemaManager The Schema Manager 099 * @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}