Debian Codegraph @

java-sdk/ietfldap/org/ietf/ldap/util/LDIFBaseContent.java

raw symbols SCIP
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 *
44 * An object of this class represents the content of an LDIF record.
45 * This class implements the <CODE>LDIFContent</CODE> interface, but
46 * it is abstract and must be extended for the various record types.
47 * <P>
48 *
49 * @version 1.0
50 * @see org.ietf.ldap.util.LDIFRecord#getContent
51 */
52 public abstract class LDIFBaseContent
53 implements LDIFContent, java.io.Serializable {
54
55 static final long serialVersionUID = -8542611537447295949L;
56
57 /**
58 * Internal variables
59 */
60 private LDAPControl[] m_controls = null;
61
62 /**
63 * Blank constructor for deserialization
64 */
65 public LDIFBaseContent() {
66 }
67
68 /**
69 * Retrieves the list of controls specified in the content
70 * of the LDIF record, if any
71 * @return an array of <CODE>LDAPControl</CODE> objects that
72 * represent any controls specified in the the LDIF record,
73 * or <CODE>null</CODE> if none were specified.
74 */
75 public LDAPControl[] getControls() {
76 return m_controls;
77 }
78
79 /**
80 * Sets the list of controls
81 * @param controls an array of <CODE>LDAPControl</CODE> objects
82 * or <CODE>null</CODE> if none are to be specified
83 */
84 public void setControls( LDAPControl[] controls ) {
85 m_controls = controls;
86 }
87
88 /**
89 * Get the OIDs of all controls, if any, as a string
90 *
91 * @return the OIDs of all controls, if any, as a string,
92 * or an empty string if there are no controls.
93 */
94 protected String getControlString() {
95 String s = "";
96 if ( getControls() != null ) {
97 s += ' ';
98 LDAPControl[] controls = getControls();
99 int len = controls.length;
100 for( int i = 0; i < len; i++ ) {
101 s += controls[i].toString();
102 if ( i < (len-1) ) {
103 s += ' ';
104 }
105 }
106 }
107 return s;
108 }
109 }