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