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