| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
| 2 | * |
| 3 | * ***** BEGIN LICENSE BLOCK ***** |
| 4 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 5 | * |
| 6 | * The contents of this file are subject to the Mozilla Public License Version |
| 7 | * 1.1 (the "License"); you may not use this file except in compliance with |
| 8 | * the License. You may obtain a copy of the License at |
| 9 | * http://www.mozilla.org/MPL/ |
| 10 | * |
| 11 | * Software distributed under the License is distributed on an "AS IS" basis, |
| 12 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 13 | * for the specific language governing rights and limitations under the |
| 14 | * License. |
| 15 | * |
| 16 | * The Original Code is mozilla.org code. |
| 17 | * |
| 18 | * The Initial Developer of the Original Code is |
| 19 | * Netscape Communications Corporation. |
| 20 | * Portions created by the Initial Developer are Copyright (C) 1999 |
| 21 | * the Initial Developer. All Rights Reserved. |
| 22 | * |
| 23 | * Contributor(s): |
| 24 | * |
| 25 | * Alternatively, the contents of this file may be used under the terms of |
| 26 | * either the GNU General Public License Version 2 or later (the "GPL"), or |
| 27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
| 28 | * in which case the provisions of the GPL or the LGPL are applicable instead |
| 29 | * of those above. If you wish to allow use of your version of this file only |
| 30 | * under the terms of either the GPL or the LGPL, and not to allow others to |
| 31 | * use your version of this file under the terms of the MPL, indicate your |
| 32 | * decision by deleting the provisions above and replace them with the notice |
| 33 | * and other provisions required by the GPL or the LGPL. If you do not delete |
| 34 | * the provisions above, a recipient may use your version of this file under |
| 35 | * the terms of any one of the MPL, the GPL or the LGPL. |
| 36 | * |
| 37 | * ***** END LICENSE BLOCK ***** */ |
| 38 | package org.ietf.ldap.util; |
| 39 | |
| 40 | import org.ietf.ldap.LDAPControl; |
| 41 | |
| 42 | /** |
| 43 | * This interface represents the content of an LDIF record. |
| 44 | * An LDIF record can specify an entry or modifications to be |
| 45 | * made to an entry. |
| 46 | * <P> |
| 47 | * |
| 48 | * The following classes implement this interface: |
| 49 | * <P> |
| 50 | * |
| 51 | * <UL> |
| 52 | * <LI><CODE>LDIFAttributeContent</CODE> (represents the content |
| 53 | * of an LDIF record that specifies an entry) |
| 54 | * <LI><CODE>LDIFAddContent</CODE> (represents the content |
| 55 | * of an LDIF record that adds a new entry) |
| 56 | * <LI><CODE>LDIFModifyContent</CODE> (represents the content |
| 57 | * of an LDIF record that modifies an entry) |
| 58 | * <LI><CODE>LDIFDeleteContent</CODE> (represents the content |
| 59 | * of an LDIF record that deletes an entry) |
| 60 | * <LI><CODE>LDIFModDNContent</CODE> (represents the content |
| 61 | * of an LDIF record that changes the RDN or DN of an entry) |
| 62 | * </UL> |
| 63 | * <P> |
| 64 | * |
| 65 | * @version 1.0 |
| 66 | * @see org.ietf.ldap.util.LDIFRecord |
| 67 | * @see org.ietf.ldap.util.LDIFAttributeContent |
| 68 | * @see org.ietf.ldap.util.LDIFAddContent |
| 69 | * @see org.ietf.ldap.util.LDIFModifyContent |
| 70 | * @see org.ietf.ldap.util.LDIFDeleteContent |
| 71 | * @see org.ietf.ldap.util.LDIFModDNContent |
| 72 | */ |
| 73 | public interface LDIFContent { |
| 74 | |
| 75 | /** |
| 76 | * The LDIF record specifies an entry and its attributes. |
| 77 | */ |
| 78 | public final static int ATTRIBUTE_CONTENT = 0; |
| 79 | |
| 80 | /** |
| 81 | * The LDIF record specifies a new entry to be added. |
| 82 | */ |
| 83 | public final static int ADD_CONTENT = 1; |
| 84 | |
| 85 | /** |
| 86 | * The LDIF record specifies an entry to be deleted. |
| 87 | */ |
| 88 | public final static int DELETE_CONTENT = 2; |
| 89 | |
| 90 | /** |
| 91 | * The LDIF record specifies modifications to an entry. |
| 92 | */ |
| 93 | public final static int MODIFICATION_CONTENT = 3; |
| 94 | |
| 95 | /** |
| 96 | * The LDIF record specifies changes to the DN or RDN of an entry. |
| 97 | */ |
| 98 | public final static int MODDN_CONTENT = 4; |
| 99 | |
| 100 | /** |
| 101 | * Determines the content type. |
| 102 | * @return the content type, identified by one of the following values: |
| 103 | * <UL> |
| 104 | * <LI>ATTRIBUTE_CONTENT (specifies an entry and its attributes) |
| 105 | * <LI>ADD_CONTENT (specifies a new entry to be added) |
| 106 | * <LI>DELETE_CONTENT (specifies an entry to be deleted) |
| 107 | * <LI>MODIFICATION_CONTENT (specifies an entry to be modified) |
| 108 | * <LI>MODDN_CONTENT (specifies a change to the RDN or DN of an entry) |
| 109 | * </UL> |
| 110 | */ |
| 111 | public int getType(); |
| 112 | |
| 113 | /** |
| 114 | * Retrieves the list of controls specified in the content |
| 115 | * of the LDIF record, if any |
| 116 | * @return an array of <CODE>LDAPControl</CODE> objects that |
| 117 | * represent any controls specified in the the LDIF record, |
| 118 | * or <CODE>null</CODE> if none were specified. |
| 119 | */ |
| 120 | public LDAPControl[] getControls(); |
| 121 | |
| 122 | /** |
| 123 | * Sets the list of controls |
| 124 | * @param controls an array of <CODE>LDAPControl</CODE> objects |
| 125 | * or <CODE>null</CODE> if none are to be specified |
| 126 | */ |
| 127 | public void setControls( LDAPControl[] controls ); |
| 128 | |
| 129 | /** |
| 130 | * Returns the string representation of the content of the LDIF record. |
| 131 | * @return string representation of the content of the LDIF record. |
| 132 | */ |
| 133 | public String toString(); |
| 134 | } |