001/* 002 * Copyright 2015-2016 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2016 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk; 022 023 024 025import com.unboundid.asn1.ASN1OctetString; 026import com.unboundid.util.NotExtensible; 027import com.unboundid.util.NotMutable; 028import com.unboundid.util.ThreadSafety; 029import com.unboundid.util.ThreadSafetyLevel; 030 031 032 033/** 034 * This class defines an exception that can be thrown if the server returns an 035 * extended response that indicates that the operation did not complete 036 * successfully. This may be used to obtain access to any response OID and/or 037 * value that may have been included in the extended result. 038 */ 039@NotExtensible() 040@NotMutable() 041@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 042public class LDAPExtendedOperationException 043 extends LDAPException 044{ 045 /** 046 * The serial version UID for this serializable class. 047 */ 048 private static final long serialVersionUID = -5674215690199642408L; 049 050 051 052 // The extended result for this exception. 053 private final ExtendedResult extendedResult; 054 055 056 057 /** 058 * Creates a new LDAP extended operation exception from the provided extended 059 * result. 060 * 061 * @param extendedResult The extended result to use to create this 062 * exception. 063 */ 064 public LDAPExtendedOperationException(final ExtendedResult extendedResult) 065 { 066 super(extendedResult); 067 068 this.extendedResult = extendedResult; 069 } 070 071 072 073 /** 074 * Retrieves the extended result that was returned by the server. 075 * 076 * @return The extended result that was returned by the server. 077 */ 078 public ExtendedResult getExtendedResult() 079 { 080 return extendedResult; 081 } 082 083 084 085 /** 086 * Retrieves the response OID from the extended result, if any. 087 * 088 * @return The response OID from the extended result, or {@code null} if the 089 * result did not include an OID. 090 */ 091 public String getResponseOID() 092 { 093 return extendedResult.getOID(); 094 } 095 096 097 098 /** 099 * Retrieves the response value from the extended result, if any. 100 * 101 * @return The response value from the extended result, or {@code null} if 102 * the result did not include a value. 103 */ 104 public ASN1OctetString getResponseValue() 105 { 106 return extendedResult.getValue(); 107 } 108}