public class DataLayer extends Object implements Serializable
Modifier and Type | Method and Description |
---|---|
void |
addAttributeValue(Principal principal,
Guid guid,
String name,
String value)
Adds value for an attribute and saves the change in the database.
|
void |
addEntry(Principal principal,
Guid guid,
AttrSet attrSet)
Adds entry to the server.
|
void |
changePassword(Guid guid,
String attrName,
String oldPassword,
String newPassword)
Changes user password.
|
void |
deleteEntry(Principal principal,
Guid guid)
Delete entry from the server
|
Attr |
getAttribute(Principal principal,
Guid guid,
String attrName)
Returns
Attr from the given attribute name. |
Collection<Attr> |
getAttributes(Principal principal,
Guid guid,
Collection<String> attrNames)
Returns attributes for the given attribute names.
|
String[] |
getAttributeString(Principal principal,
Guid guid,
String attrName)
Returns String values of the attribute.
|
org.forgerock.opendj.ldap.Connection |
getConnection(Principal principal)
Get connection from pool.
|
static int |
getConnNumRetry() |
static int |
getConnRetryInterval() |
static DataLayer |
getInstance()
Create the singleton DataLayer object if it doesn't exist already.
|
static DataLayer |
getInstance(ServerInstance serverCfg)
Create the singleton DataLayer object if it doesn't exist already.
|
static Set<org.forgerock.opendj.ldap.ResultCode> |
getRetryErrorCodes() |
org.forgerock.opendj.ldap.schema.Schema |
getSchema(Principal principal)
Fetches the schema from the LDAP directory server.
|
static void |
initConnectionParams() |
void |
modify(Principal principal,
Guid guid,
Collection<org.forgerock.opendj.ldap.Modification> modifications)
Modifies an ldap entry.
|
AttrSet |
read(Principal principal,
Guid guid)
Read an ldap entry
|
AttrSet |
read(Principal principal,
Guid guid,
String[] attrNames)
Reads an ldap entry.
|
org.forgerock.opendj.ldap.Entry |
readLDAPEntry(org.forgerock.opendj.ldap.Connection ld,
String dn,
String[] attrnames) |
org.forgerock.opendj.ldif.ConnectionEntryReader |
readLDAPEntry(Principal principal,
org.forgerock.opendj.ldap.requests.SearchRequest request) |
void |
removeAttributeValue(Principal principal,
Guid guid,
String name,
String value)
Removes value for an attribute and saves the change in the database.
|
void |
rename(Principal principal,
Guid guid,
String newName,
boolean deleteOldName) |
SearchResults |
search(Principal principal,
Guid guid,
int scope,
String searchFilter,
String[] attrNames,
boolean attrOnly,
SearchControl searchControl)
Performs synchronous search based on specified ldap filter.
|
SearchResults |
searchIDs(Principal principal,
Guid guid,
int scope,
String searchFilter,
SearchControl searchControl)
Perform synchronous search based on specified ldap filter.
|
public static void initConnectionParams()
public static DataLayer getInstance(ServerInstance serverCfg) throws UMSException
UMSException
public static DataLayer getInstance() throws UMSException
UMSException
public org.forgerock.opendj.ldap.Connection getConnection(Principal principal) throws org.forgerock.opendj.ldap.LdapException
org.forgerock.opendj.ldap.LdapException
public String[] getAttributeString(Principal principal, Guid guid, String attrName)
principal
- Authentication Principal.guid
- distinguished name.attrName
- attribute name.public Attr getAttribute(Principal principal, Guid guid, String attrName)
Attr
from the given attribute name.principal
- Authentication Principal.guid
- Distinguished name.attrName
- Attribute name.public Collection<Attr> getAttributes(Principal principal, Guid guid, Collection<String> attrNames)
principal
- Authentication Principal.guid
- Distinguished name.attrNames
- Attribute names.public void addEntry(Principal principal, Guid guid, AttrSet attrSet) throws UMSException
principal
- Authenticated Principal.guid
- Distinguished name.attrSet
- attribute set containing name/value pairs.AccessRightsException
- if insufficient access>EntryAlreadyExistsException
- if the entry already exists.UMSException
- if fail to add entry.public void deleteEntry(Principal principal, Guid guid) throws UMSException
guid
- globally unique identifier for the entryAccessRightsException
- insufficient accessEntryNotFoundException
- if the entry is not foundUMSException
- Fail to delete the entrypublic AttrSet read(Principal principal, Guid guid) throws UMSException
guid
- globally unique identifier for the entryEntryNotFoundException
- if the entry is not foundUMSException
- Fail to read the entrypublic AttrSet read(Principal principal, Guid guid, String[] attrNames) throws UMSException
principal
- Authentication Principal.guid
- Globally unique identifier for the entry.attrNames
- Attributes to read.EntryNotFoundException
- if the entry is not found.UMSException
- if fail to read the entry.public void rename(Principal principal, Guid guid, String newName, boolean deleteOldName) throws UMSException
UMSException
public void modify(Principal principal, Guid guid, Collection<org.forgerock.opendj.ldap.Modification> modifications) throws UMSException
principal
- Authentication Principal.guid
- globally unique identifier for the entry.modifications
- Set of modifications for the entry.AccessRightsException
- if insufficient accessEntryNotFoundException
- if the entry is not found.UMSException
- if failurepublic void changePassword(Guid guid, String attrName, String oldPassword, String newPassword) throws UMSException
guid
- globally unique identifier for the entry.attrName
- password attribute nameoldPassword
- old passwordnewPassword
- new passwordAccessRightsException
- if insufficient accessEntryNotFoundException
- if the entry is not found.UMSException
- if failurepublic void addAttributeValue(Principal principal, Guid guid, String name, String value) throws UMSException
principal
- Authenticated Principal.guid
- ID of the entry to which to add the attribute value.name
- name of the attribute to which value is being added.value
- Value to be added to the attribute.UMSException
- if there is any error while adding the value.public void removeAttributeValue(Principal principal, Guid guid, String name, String value) throws UMSException
principal
- Authenticated Principal.guid
- the id of the entry from which to remove the attribute value.name
- Name of the attribute from which value is being removedvalue
- Value to be removed from the attribute.UMSException
- if there is any error while removing the value.public SearchResults search(Principal principal, Guid guid, int scope, String searchFilter, String[] attrNames, boolean attrOnly, SearchControl searchControl) throws UMSException
principal
- Authenticated Principal.guid
- Unique identifier for the entry.scope
- Scope can be either SCOPE_ONE
,
SCOPE_SUB
or SCOPE_BASE
.searchFilter
- Search filter for this search.attrNames
- Attribute name for retrieving.attrOnly
- if true, returns the names but not the values of the
attributes found.searchControl
- Search Control.UMSException
- if failure.InvalidSearchFilterException
- if failurepublic SearchResults searchIDs(Principal principal, Guid guid, int scope, String searchFilter, SearchControl searchControl) throws InvalidSearchFilterException, UMSException
principal
- Authenticated Principal.guid
- Unique identifier for the entryscope
- Scope can be either SCOPE_ONE
,
SCOPE_SUB
, SCOBE_BASE
searchFilter
- Search filter for this search.searchControl
- Search Control.UMSException
- if failure.InvalidSearchFilterException
- if failure.public org.forgerock.opendj.ldap.schema.Schema getSchema(Principal principal) throws UMSException
AccessRightsException
- insufficient accessUMSException
- Fail to fetch the schema.org.forgerock.opendj.ldap.LdapException
- Error with LDAP connection.public org.forgerock.opendj.ldap.Entry readLDAPEntry(org.forgerock.opendj.ldap.Connection ld, String dn, String[] attrnames) throws org.forgerock.opendj.ldap.LdapException
org.forgerock.opendj.ldap.LdapException
public org.forgerock.opendj.ldif.ConnectionEntryReader readLDAPEntry(Principal principal, org.forgerock.opendj.ldap.requests.SearchRequest request) throws UMSException
UMSException
public static int getConnNumRetry()
public static int getConnRetryInterval()
public static Set<org.forgerock.opendj.ldap.ResultCode> getRetryErrorCodes()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.