public final class JndiServices extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_FILTER
Default LDAP filter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
apply(JndiModifications jm)
Apply directory modifications.
|
String |
completeDn(String dn) |
Map<String,LscDatasets> |
doGetAttrsList(String base,
String filter,
int scope,
List<String> attrsNames) |
boolean |
exists(String dn)
Check if the entry with the specified distinguish name exists (or
not).
|
boolean |
exists(String dn,
String filter)
Check if the entry with the specified distinguish name exists (or
not).
|
Map<String,LscDatasets> |
getAttrsList(String base,
String filter,
int scope,
List<String> attrsNames)
Search for a list of attribute values
This method is a simple LDAP search operation which is attended to
return a list of the attribute values in all returned entries
|
static CallbackHandler |
getCallbackHandler(String user,
String pass) |
LdapContext |
getContext()
Get the JNDI context.
|
LdapContext |
getContext(boolean forUpdates)
Get the initial JNDI context or get a derived context to be able to use controls without
impacting or being impacted by other threads sharing a same context
|
String |
getContextDn() |
List<String> |
getDnList(String base,
String filter,
int scope)
Search for a list of DN.
|
static JndiServices |
getDstInstance()
Deprecated.
|
SearchResult |
getEntry(String base,
String filter)
Search for an entry.
|
SearchResult |
getEntry(String base,
String filter,
SearchControls sc)
Search for an entry.
|
SearchResult |
getEntry(String base,
String filter,
SearchControls sc,
int scope)
Search for an entry.
|
static JndiServices |
getInstance(LdapConnectionType connection) |
static JndiServices |
getInstance(Properties props) |
static JndiServices |
getInstance(Properties props,
boolean forceNewConnection)
Instance getter.
|
static Properties |
getLdapProperties(LdapConnectionType connection) |
Map<String,List<String>> |
getSchema(String[] attrsToReturn)
Return the LDAP schema.
|
static JndiServices |
getSrcInstance()
Deprecated.
|
SearchResult |
readEntry(String base,
boolean allowError)
Search for an entry.
|
SearchResult |
readEntry(String base,
String filter,
boolean allowError) |
SearchResult |
readEntry(String base,
String filter,
boolean allowError,
SearchControls sc) |
String |
rewriteBase(String base) |
List<String> |
sup(String dn,
int level) |
public static final String DEFAULT_FILTER
@Deprecated public static JndiServices getSrcInstance()
@Deprecated public static JndiServices getDstInstance()
public static JndiServices getInstance(Properties props) throws NamingException, IOException
NamingException
IOException
public static JndiServices getInstance(Properties props, boolean forceNewConnection) throws NamingException, IOException
props
- the connection propertiesIOException
NamingException
public static Properties getLdapProperties(LdapConnectionType connection) throws LscConfigurationException
LscConfigurationException
public static JndiServices getInstance(LdapConnectionType connection)
public SearchResult getEntry(String base, String filter) throws NamingException
base
- the base of the search operationfilter
- the filter of the search operationNamingException
- thrown if something goes wrongpublic SearchResult getEntry(String base, String filter, SearchControls sc) throws NamingException
base
- the base of the search operationfilter
- the filter of the search operationsc
- the search controlsNamingException
- thrown if something goes wrongpublic SearchResult getEntry(String base, String filter, SearchControls sc, int scope) throws NamingException
base
- the base of the search operationfilter
- the filter of the search operationsc
- the search controlsscope
- the search scope to useSizeLimitExceededException
- thrown if more than one entry is returned by the searchNamingException
- thrown if something goes wrongpublic boolean exists(String dn, String filter)
dn
- the entry's distinguish namefilter
- look at the dn according this filterpublic boolean exists(String dn)
dn
- the entry's distinguish namepublic SearchResult readEntry(String base, boolean allowError) throws NamingException
base
- the base of the search operationallowError
- log error if not found or notNamingException
- thrown if something goes wrongpublic SearchResult readEntry(String base, String filter, boolean allowError) throws NamingException
NamingException
public SearchResult readEntry(String base, String filter, boolean allowError, SearchControls sc) throws NamingException
NamingException
public List<String> getDnList(String base, String filter, int scope) throws NamingException
base
- the base of the search operationfilter
- the filter of the search operationscope
- the scope of the search operationNamingException
- thrown if something goes wrongpublic boolean apply(JndiModifications jm) throws CommunicationException
jm
- modifications to applyCommunicationException
- If the connection to the directory is lostpublic Map<String,List<String>> getSchema(String[] attrsToReturn) throws NamingException
attrsToReturn
- list of attribute names to return (or null for all
'standard' attributes)NamingException
- thrown if something goes wrong (badpublic List<String> sup(String dn, int level) throws NamingException
NamingException
public Map<String,LscDatasets> getAttrsList(String base, String filter, int scope, List<String> attrsNames) throws NamingException
base
- the base of the search operationfilter
- the filter of the search operationscope
- the scope of the search operationattrsNames
- table of attribute names to getNamingException
- thrown if something goes wrongpublic Map<String,LscDatasets> doGetAttrsList(String base, String filter, int scope, List<String> attrsNames) throws NamingException
NamingException
public String getContextDn()
public LdapContext getContext() throws NamingException
NamingException
public LdapContext getContext(boolean forUpdates) throws NamingException
forUpdates
- if this derived context is for updatesNamingException
public static CallbackHandler getCallbackHandler(String user, String pass)
Copyright © 2005-2024 LSC project. All Rights Reserved.