/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Initial developer(s): ____________________________________.
 * Contributor(s): ______________________________________.
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */


package org.objectweb.jonas.ldap;

import javax.naming.directory.DirContext;
import javax.naming.NamingException;

/**
 * A DataSourceLDAP object is a factory for JNDI DirContext objects. 
 * This object mimics the DataSource object used for databases.
 */
public interface DataSourceLDAP {

    /**
     * Set the list of byte-array attributes for this bean.
     * Note that we have one datasource per lookup (i.e. per bean)!
     *
     * @param name of the attribute
     */
    public void setBinAttribs(String v) throws NamingException;

    /**
     * Get a new DirContext
     *
     * @return the DirContext
     */
    public DirContext getDirContext() throws NamingException;

    /**
     * Get a new DirContext for this user
     *
     * @param user - the user on whose behalf the DirContext will be used
     * @param password - the user's password
     *
     * @return the DirContext
     */
    public DirContext getDirContext(String user, String passwd) throws NamingException;
}
