org.ldaptive.provider.jndi
Class JndiProvider

java.lang.Object
  extended by org.ldaptive.provider.jndi.JndiProvider
All Implemented Interfaces:
Provider<JndiProviderConfig>

public class JndiProvider
extends Object
implements Provider<JndiProviderConfig>

Exposes a connection factory for creating connections with JNDI.

Version:
$Revision: 3242 $ $Date: 2017-09-11 17:26:30 -0400 (Mon, 11 Sep 2017) $
Author:
Middleware Services

Field Summary
static String CONNECT_TIMEOUT
          The value of this property is a string that specifies the time in milliseconds that a connection attempt will abort if the connection cannot be made.
static String CONTEXT_FACTORY
          The value of this property is a fully qualified class name of the factory class which creates the initial context for the LDAP service provider.
protected  org.slf4j.Logger logger
          Logger for this class.
static String PROTOCOL
          The value of this property is a string that specifies the security protocol for the provider to use.
static String PROVIDER_URL
          The value of this property is a URL string that specifies the hostname and port number of the LDAP server, and the root distinguished name of the naming context to use.
static String READ_TIMEOUT
          The value of this property is a string that specifies the time in milliseconds that an operation will abort if a response is not received.
static String SOCKET_FACTORY
          The value of this property is a string identifying the class name of a socket factory.
static String TRACE
          The value of this property is a java.io.OutputStream object into which a hexadecimal dump of the incoming and outgoing LDAP ASN.1 BER packets is written.
static String VERSION
          The value of this property is a string that specifies the protocol version for the provider.
 
Constructor Summary
JndiProvider()
           
 
Method Summary
 ProviderConnectionFactory<JndiProviderConfig> getConnectionFactory(ConnectionConfig cc)
          Returns the connection factory for this provider.
protected  Map<String,Object> getDefaultEnvironment(ConnectionConfig cc, String factory)
          Returns the configuration environment for a JNDI ldap context using the properties found in the supplied connection config.
protected  JndiConnectionFactory getJndiConnectionFactory(ConnectionConfig cc, Map<String,Object> env)
          Returns a jndi connection factory using the properties found in the supplied connection config.
protected  JndiStartTLSConnectionFactory getJndiStartTLSConnectionFactory(ConnectionConfig cc, Map<String,Object> env)
          Returns a jndi startTLS connection factory using the properties found in the supplied connection config.
 JndiProviderConfig getProviderConfig()
          Returns the provider configuration.
 JndiProvider newInstance()
          Creates a new instance of this provider.
 void setProviderConfig(JndiProviderConfig jpc)
          Sets the provider configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_FACTORY

public static final String CONTEXT_FACTORY
The value of this property is a fully qualified class name of the factory class which creates the initial context for the LDAP service provider. The value of this constant is "java.naming.factory.initial".

See Also:
Constant Field Values

VERSION

public static final String VERSION
The value of this property is a string that specifies the protocol version for the provider. The value of this constant is "java.naming.ldap.version".

See Also:
Constant Field Values

PROVIDER_URL

public static final String PROVIDER_URL
The value of this property is a URL string that specifies the hostname and port number of the LDAP server, and the root distinguished name of the naming context to use. The value of this constant is "java.naming.provider.url".

See Also:
Constant Field Values

PROTOCOL

public static final String PROTOCOL
The value of this property is a string that specifies the security protocol for the provider to use. The value of this constant is "java.naming.security.protocol".

See Also:
Constant Field Values

SOCKET_FACTORY

public static final String SOCKET_FACTORY
The value of this property is a string identifying the class name of a socket factory. The value of this constant is "java.naming.ldap.factory.socket".

See Also:
Constant Field Values

CONNECT_TIMEOUT

public static final String CONNECT_TIMEOUT
The value of this property is a string that specifies the time in milliseconds that a connection attempt will abort if the connection cannot be made. The value of this constant is "com.sun.jndi.ldap.connect.timeout".

See Also:
Constant Field Values

READ_TIMEOUT

public static final String READ_TIMEOUT
The value of this property is a string that specifies the time in milliseconds that an operation will abort if a response is not received. The value of this constant is "com.sun.jndi.ldap.read.timeout".

See Also:
Constant Field Values

TRACE

public static final String TRACE
The value of this property is a java.io.OutputStream object into which a hexadecimal dump of the incoming and outgoing LDAP ASN.1 BER packets is written. The value of this constant is "com.sun.jndi.ldap.trace.ber".

See Also:
Constant Field Values

logger

protected final org.slf4j.Logger logger
Logger for this class.

Constructor Detail

JndiProvider

public JndiProvider()
Method Detail

getConnectionFactory

public ProviderConnectionFactory<JndiProviderConfig> getConnectionFactory(ConnectionConfig cc)
Returns the connection factory for this provider.

Specified by:
getConnectionFactory in interface Provider<JndiProviderConfig>
Parameters:
cc - connection configuration
Returns:
connection factory

getProviderConfig

public JndiProviderConfig getProviderConfig()
Returns the provider configuration.

Specified by:
getProviderConfig in interface Provider<JndiProviderConfig>
Returns:
provider configuration

setProviderConfig

public void setProviderConfig(JndiProviderConfig jpc)
Sets the provider configuration.

Specified by:
setProviderConfig in interface Provider<JndiProviderConfig>
Parameters:
jpc - provider configuration

newInstance

public JndiProvider newInstance()
Creates a new instance of this provider.

Specified by:
newInstance in interface Provider<JndiProviderConfig>
Returns:
new instance of this provider

getJndiStartTLSConnectionFactory

protected JndiStartTLSConnectionFactory getJndiStartTLSConnectionFactory(ConnectionConfig cc,
                                                                         Map<String,Object> env)
Returns a jndi startTLS connection factory using the properties found in the supplied connection config. If the supplied env is null, the environment is retrieved from getDefaultEnvironment(ConnectionConfig, String).

Parameters:
cc - connection config
env - context environment or null to use the default
Returns:
jndi startTLS connection factory

getJndiConnectionFactory

protected JndiConnectionFactory getJndiConnectionFactory(ConnectionConfig cc,
                                                         Map<String,Object> env)
Returns a jndi connection factory using the properties found in the supplied connection config. If the supplied env is null, the environment is retrieved from getDefaultEnvironment(ConnectionConfig, String).

Parameters:
cc - connection config
env - context environment or null to use the default
Returns:
jndi connection factory

getDefaultEnvironment

protected Map<String,Object> getDefaultEnvironment(ConnectionConfig cc,
                                                   String factory)
Returns the configuration environment for a JNDI ldap context using the properties found in the supplied connection config.

Parameters:
cc - connection config
factory - class name of the socket factory to use for LDAPS
Returns:
JNDI ldap context environment


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.