|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractSet com.novell.ldap.LDAPAttributeSet
A set of LDAPAttribute
objects.
An LDAPAttributeSet
is a collection of LDAPAttribute
classes as returned from an LDAPEntry
on a search or read
operation. LDAPAttributeSet
may be also used to contruct an entry
to be added to a directory. If the add()
or addAll()
methods are called and one or more of the objects to be added is not
an LDAPAttribute, ClassCastException
is thrown (as discussed in the
documentation for java.util.Collection
).
Sample Code: AddEntry.java
LDAPAttribute
,
LDAPEntry
,
Serialized FormConstructor Summary | |
LDAPAttributeSet()
Constructs an empty set of attributes. |
Method Summary | |
boolean |
add(java.lang.Object attr)
Adds the specified attribute to this set if it is not already present. |
boolean |
addAll(java.util.Collection c)
Adds all LDAPAttribute objects in the specified collection to
this collection. |
void |
clear()
Removes all of the elements from this set. |
java.lang.Object |
clone()
Returns a deep copy of this attribute set. |
boolean |
contains(java.lang.Object attr)
Returns true if this set contains an attribute of the same name
as the specified attribute. |
LDAPAttribute |
getAttribute(java.lang.String attrName)
Returns the attribute matching the specified attrName. |
LDAPAttribute |
getAttribute(java.lang.String attrName,
java.lang.String lang)
Returns a single best-match attribute, or null if no match is
available in the entry. |
LDAPAttributeSet |
getSubset(java.lang.String subtype)
Creates a new attribute set containing only the attributes that have the specified subtypes. |
boolean |
isEmpty()
Returns true if this set contains no elements |
java.util.Iterator |
iterator()
Returns an iterator over the attributes in this set. |
static java.lang.Object |
readDSML(java.io.InputStream input)
This method is used to deserialize the DSML encoded representation of this class. |
boolean |
remove(java.lang.Object object)
Removes the specified object from this set if it is present. |
int |
size()
Returns the number of attributes in this set. |
java.lang.String |
toString()
Returns a string representation of this LDAPAttributeSet |
void |
writeDSML(java.io.OutputStream oout)
This method does DSML serialization of the instance. |
Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
containsAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
public LDAPAttributeSet()
Method Detail |
public java.lang.Object clone()
public LDAPAttribute getAttribute(java.lang.String attrName)
For example:
getAttribute("cn")
returns only the "cn" attributegetAttribute("cn;lang-en")
returns only the "cn;lang-en"
attribute.In both cases, null
is returned if there is no exact match to
the specified attrName.
Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.
attrName
- The name of an attribute to retrieve, with or without
subtype specifications. For example, "cn", "cn;phonetic", and
"cn;binary" are valid attribute names.
null
if there is no exact match.public LDAPAttribute getAttribute(java.lang.String attrName, java.lang.String lang)
null
if no match is
available in the entry.
LDAP version 3 allows adding a subtype specification to an attribute name. For example, "cn;lang-ja" indicates a Japanese language subtype of the "cn" attribute and "cn;lang-ja-JP-kanji" may be a subtype of "cn;lang-ja". This feature may be used to provide multiple localizations in the same directory. For attributes which do not vary among localizations, only the base attribute may be stored, whereas for others there may be varying degrees of specialization.
For example, getAttribute(attrName,lang)
returns the
LDAPAttribute
that exactly matches attrName and that
best matches lang.
If there are subtypes other than "lang" subtypes included
in attrName, for example, "cn;binary", only attributes with all of
those subtypes are returned. If lang is null
or empty, the
method behaves as getAttribute(attrName). If there are no matching
attributes, null
is returned.
Assume the entry contains only the following attributes:
Examples:
getAttribute( "cn" )
returns null
.getAttribute( "sn" )
returns the "sn" attribute.getAttribute( "cn", "lang-en-us" )
returns the "cn;lang-en" attribute.getAttribute( "cn", "lang-en" )
returns the "cn;lang-en" attribute.getAttribute( "cn", "lang-ja" )
returns null
.getAttribute( "sn", "lang-en" )
returns the "sn" attribute.Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.
attrName
- The name of an attribute to retrieve, with or without
subtype specifications. For example, "cn", "cn;phonetic", and
cn;binary" are valid attribute names.
lang
- A language specification with optional subtypes
appended using "-" as separator. For example, "lang-en", "lang-en-us",
"lang-ja", and "lang-ja-JP-kanji" are valid language specification.
LDAPAttribute
, or null
if no match is found in the entry.public LDAPAttributeSet getSubset(java.lang.String subtype)
For example, suppose an attribute set contains the following attributes:
Calling the getSubset
method and passing lang-ja as the
argument, the method returns an attribute set containing the following
attributes:
subtype
- Semi-colon delimited list of subtypes to include. For
example:
Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.
public java.util.Iterator iterator()
iterator
in interface java.util.Set
public int size()
size
in interface java.util.Set
public boolean isEmpty()
true
if this set contains no elements
isEmpty
in interface java.util.Set
true
if this set contains no elementspublic boolean contains(java.lang.Object attr)
true
if this set contains an attribute of the same name
as the specified attribute.
contains
in interface java.util.Set
attr
- Object of type LDAPAttribute
java.lang.ClassCastException
- occurs the specified Object
is not of type LDAPAttribute.public boolean add(java.lang.Object attr)
If an attribute with the same name already exists in the set then the specified attribute will not be added.
add
in interface java.util.Set
attr
- Object of type LDAPAttribute
java.lang.ClassCastException
- occurs the specified Object
is not of type LDAPAttribute
.public boolean remove(java.lang.Object object)
If the specified object is of type LDAPAttribute
, the
specified attribute will be removed. If the specified object is of type
String
, the attribute with a name that matches the string will
be removed.
remove
in interface java.util.Set
object
- LDAPAttribute to be removed or String
naming
the attribute to be removed.
java.lang.ClassCastException
- occurs the specified Object
is not of type LDAPAttribute
or of type String
.public void clear()
clear
in interface java.util.Set
public boolean addAll(java.util.Collection c)
LDAPAttribute
objects in the specified collection to
this collection.
addAll
in interface java.util.Set
c
- Collection of LDAPAttribute
objects.
java.lang.ClassCastException
- occurs when an element in the
collection is not of type LDAPAttribute
.public java.lang.String toString()
public void writeDSML(java.io.OutputStream oout) throws java.io.IOException
oout
- Outputstream where the serialzed data has to be written
java.io.IOException
- if write fails on OutputStreampublic static java.lang.Object readDSML(java.io.InputStream input) throws java.io.IOException
input
- InputStream for the DSML formatted data.
java.io.IOException
- when serialization fails.
|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |