public class DataLayer extends Object
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 |
addSchema(Principal principal,
com.sun.identity.shared.ldap.LDAPSchemaElement schemaElement)
Adds schema element to the schema at the root DSE
|
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 |
getAttributes(Principal principal,
Guid guid,
Collection attrNames)
Returns attributes for the given attribute names.
|
String[] |
getAttributeString(Principal principal,
Guid guid,
String attrName)
Returns String values of the attribute.
|
com.sun.identity.shared.ldap.LDAPConnection |
getConnection(Principal principal)
Get connection from pool.
|
static DataLayer |
getInstance()
create the singelton DataLayer object if it doesn't exist already.
|
static DataLayer |
getInstance(ServerInstance serverCfg)
create the singelton DataLayer object if it doesn't exist already.
|
com.sun.identity.shared.ldap.LDAPSchema |
getSchema(Principal principal)
Fetches the schema from the LDAP directory server.
|
void |
modify(Principal principal,
Guid guid,
ModSet modSet)
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.
|
void |
releaseConnection(com.sun.identity.shared.ldap.LDAPConnection conn)
Just call the pool method to release the connection so that the given
connection is free for others to use
|
void |
releaseConnection(com.sun.identity.shared.ldap.LDAPConnection conn,
int ldapErrCode)
Just call the pool method to release the connection so that the given
connection is free for others to use
|
void |
removeAttributeValue(Principal principal,
Guid guid,
String name,
String value)
Removes value for an attribute and saves the change in the database.
|
void |
removeSchema(Principal principal,
com.sun.identity.shared.ldap.LDAPSchemaElement schemaElement)
Removes schema element from the schema
|
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 DataLayer getInstance(ServerInstance serverCfg) throws UMSException
UMSException
public static DataLayer getInstance() throws UMSException
UMSException
public com.sun.identity.shared.ldap.LDAPConnection getConnection(Principal principal)
public void releaseConnection(com.sun.identity.shared.ldap.LDAPConnection conn)
conn
- connection in the pool to be released for others to usepublic void releaseConnection(com.sun.identity.shared.ldap.LDAPConnection conn, int ldapErrCode)
conn
- connection in the pool to be released for others to useldapErrCode
- ldap exception error code used to determine failover.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 getAttributes(Principal principal, Guid guid, Collection attrNames)
principal
- Authentication Principal.guid
- Distinguished name.attrNames
- Attribute names.public void addEntry(Principal principal, Guid guid, AttrSet attrSet) throws AccessRightsException, EntryAlreadyExistsException, 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 AccessRightsException, EntryNotFoundException, 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 EntryNotFoundException, 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 EntryNotFoundException, 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 modify(Principal principal, Guid guid, ModSet modSet) throws AccessRightsException, EntryNotFoundException, UMSException
principal
- Authentication Principal.guid
- globally unique identifier for the entry.modSet
- 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 AccessRightsException, EntryNotFoundException, 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 valuepublic 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 InvalidSearchFilterException, 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 com.sun.identity.shared.ldap.LDAPSchema getSchema(Principal principal) throws AccessRightsException, UMSException
AccessRightsException
- insufficient accessUMSException
- Fail to fetch the schema.public void addSchema(Principal principal, com.sun.identity.shared.ldap.LDAPSchemaElement schemaElement) throws AccessRightsException, UMSException
schemaElement
- schema element to be addedAccessRightsException
- insufficient accessSchemaElementAlreadyExistsException
- if the element already existsUMSException
- Fail to add schema element.public void removeSchema(Principal principal, com.sun.identity.shared.ldap.LDAPSchemaElement schemaElement) throws AccessRightsException, UMSException
schemaElement
- schema element to be removedAccessRightsException
- insufficient accessUMSException
- Fail to remove schema element.Copyright © 2010-2013, ForgeRock All Rights Reserved.