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.model.exception; 021 022 023import org.apache.directory.api.ldap.model.schema.SchemaObject; 024 025 026/** 027 * A subclass of {@link LdapException} which is used to report issues 028 * during the integrity check of the schema by the SchemaManager. 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public class LdapSchemaException extends LdapException 033{ 034 /** The serial version UUID */ 035 static final long serialVersionUID = 1L; 036 037 /** The code of the exception */ 038 private LdapSchemaExceptionCodes code; 039 040 /** The 'source' schema object */ 041 private SchemaObject sourceObject; 042 043 /** The 'other' schema object */ 044 private SchemaObject otherObject; 045 046 /** The related ID (name or OID) of the exception */ 047 private String relatedId; 048 049 050 /** 051 * Creates a new instance of LdapSchemaException. 052 */ 053 public LdapSchemaException() 054 { 055 super(); 056 } 057 058 059 /** 060 * Creates a new instance of LdapSchemaException. 061 * 062 * @param code 063 * The code of the exception 064 */ 065 public LdapSchemaException( LdapSchemaExceptionCodes code ) 066 { 067 super(); 068 this.code = code; 069 } 070 071 072 /** 073 * Creates a new instance of LdapSchemaException. 074 * 075 * @param explanation 076 * The message associated with the exception 077 */ 078 public LdapSchemaException( String explanation ) 079 { 080 super( explanation ); 081 } 082 083 084 /** 085 * Creates a new instance of LdapSchemaException. 086 * 087 * @param code The code of the exception 088 * @param explanation The message associated with the exception 089 */ 090 public LdapSchemaException( LdapSchemaExceptionCodes code, String explanation ) 091 { 092 super( explanation ); 093 this.code = code; 094 } 095 096 097 /** 098 * 099 * @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}