LdapAttribute.java revision 0
2362N/A * Copyright 1999-2002 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * This subclass is used by LDAP to implement the schema calls. 0N/A * Basically, it keeps track of which context it is an attribute of 0N/A * so it can get the schema for that cotnext. 0N/A // these two are used to reconstruct the baseCtx if this attribute has 0N/A // been serialized ( 0N/A * Adds a new value to this attribute. 0N/A * @param attrVal The value to be added. If null, a null value is added to 0N/A * @return true Always returns true. 0N/A // LDAP attributes don't contain duplicate values so there's no need 0N/A // to check if the value already exists before adding it. 0N/A * Constructs a new instance of an attribute. 0N/A * @param id The attribute's id. It cannot be null. * Constructs a new instance of an attribute. * @param id The attribute's id. It cannot be null. * @param baseCtx the baseCtx object of this attribute * @param rdn the RDN of the entry (relative to baseCtx) * Sets the baseCtx and rdn used to find the attribute's schema * Used by LdapCtx.setParents(). * returns the ctx this attribute came from. This call allows * LDAPAttribute to be serializable. 'baseCtx' is transient so if * it is null, the `baseCtxURL` is used to reconstruct the context * to which calls are made. "com.sun.jndi.ldap.LdapCtxFactory");
* This is called when the object is serialized. It is * overridden so that the appropriate class variables can be set * to re-construct the baseCtx when deserialized. Setting these * variables is costly, so it is only done if the object * is actually serialized. // let the ObjectOutpurStream do the real work of serialization * sets the information needed to reconstruct the baseCtx if * we are serialized. This must be called _before_ the object is // remove any security credentials - otherwise the serialized form // would store them in the clear //if we need to remove props, we must do it to a clone //of the environment. cloning is expensive, so we only do // set baseCtxEnv depending on whether we removed props or not * Retrieves the syntax definition associated with this attribute. * @return This attribute's syntax definition. // get the syntax id from the attribute def getID() +
"does not have a syntax associated with it");
// look in the schema tree for the syntax definition * Retrieves this attribute's schema definition. * @return This attribute's schema definition.