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.model.exception; 21 22 23 import org.apache.directory.api.ldap.model.schema.SchemaManager; 24 import org.apache.directory.api.ldap.model.schema.SchemaObject; 25 26 27 /** 28 * A subclass of {@link LdapException} which is used to report issues 29 * during the integrity check of the schema by the {@link SchemaManager}. 30 * 31 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 32 */ 33 public class LdapSchemaException extends LdapException 34 { 35 /** The serial version UUID */ 36 static final long serialVersionUID = 1L; 37 38 /** The code of the exception */ 39 private LdapSchemaExceptionCodes code; 40 41 /** The 'source' schema object */ 42 private SchemaObject sourceObject; 43 44 /** The 'other' schema object */ 45 private SchemaObject otherObject; 46 47 /** The related ID (name or OID) of the exception */ 48 private String relatedId; 49 50 51 /** 52 * Creates a new instance of LdapSchemaException. 53 */ 54 public LdapSchemaException() 55 { 56 super(); 57 } 58 59 60 /** 61 * Creates a new instance of LdapSchemaException. 62 * 63 * @param code 64 * The code of the exception 65 */ 66 public LdapSchemaException( LdapSchemaExceptionCodes code ) 67 { 68 super(); 69 this.code = code; 70 } 71 72 73 /** 74 * Creates a new instance of LdapSchemaException. 75 * 76 * @param explanation 77 * The message associated with the exception 78 */ 79 public LdapSchemaException( String explanation ) 80 { 81 super( explanation ); 82 } 83 84 85 /** 86 * Creates a new instance of LdapSchemaException. 87 * 88 * @param code The code of the exception 89 * @param explanation The message associated with the exception 90 */ 91 public LdapSchemaException( LdapSchemaExceptionCodes code, String explanation ) 92 { 93 super( explanation ); 94 this.code = code; 95 } 96 97 98 /** 99 * 100 * @param code The code of the exception 101 * @param cause The root cause for this exception 102 */ 103 public LdapSchemaException( LdapSchemaExceptionCodes code, Throwable cause ) 104 { 105 super( cause ); 106 this.code = code; 107 } 108 109 110 /** 111 * Creates a new instance of LdapSchemaException. 112 * 113 * @param code The code of the exception 114 * @param explanation The message associated with the exception 115 * @param cause The root cause for this exception 116 */ 117 public LdapSchemaException( LdapSchemaExceptionCodes code, String explanation, Throwable cause ) 118 { 119 super( explanation, cause ); 120 this.code = code; 121 } 122 123 124 /** 125 * Gets the code of the exception. 126 * 127 * @return 128 * the code of the exception 129 */ 130 public LdapSchemaExceptionCodes getCode() 131 { 132 return code; 133 } 134 135 136 /** 137 * Sets the code of the exception. 138 * 139 * @param code 140 * the code of the exception 141 */ 142 public void setCode( LdapSchemaExceptionCodes code ) 143 { 144 this.code = code; 145 } 146 147 148 /** 149 * Gets the 'source' schema object. 150 * 151 * @return 152 * the 'source' schema object 153 */ 154 public SchemaObject getSourceObject() 155 { 156 return sourceObject; 157 } 158 159 160 /** 161 * Sets the 'source' schema object. 162 * 163 * @param source 164 * the 'source' schema object 165 */ 166 public void setSourceObject( SchemaObject source ) 167 { 168 this.sourceObject = source; 169 } 170 171 172 /** 173 * Gets the 'other' schema object. 174 * 175 * @return 176 * the 'other' schema object 177 */ 178 public SchemaObject getOtherObject() 179 { 180 return otherObject; 181 } 182 183 184 /** 185 * Sets the 'other' schema object. 186 * 187 * @param other 188 * the 'other' schema object 189 */ 190 public void setOtherObject( SchemaObject other ) 191 { 192 this.otherObject = other; 193 } 194 195 196 /** 197 * Gets the related ID (name or OID) of the exception. 198 * 199 * @return 200 * the related ID (name or OID) 201 */ 202 public String getRelatedId() 203 { 204 return relatedId; 205 } 206 207 208 /** 209 * Sets the related ID (name or OID) of the exception. 210 * 211 * @param relatedId 212 * the related ID (name or OID) 213 */ 214 public void setRelatedId( String relatedId ) 215 { 216 this.relatedId = relatedId; 217 } 218 }