public final class Rest2Ldap extends Object
rest2Ldap(org.forgerock.util.Options, java.util.Collection<org.forgerock.opendj.rest2ldap.Resource>)
passing in a list of resources
which together define
the data model being exposed by the gateway. Call newRequestHandlerFor(String)
in order to obtain
a request handler for a specific resource. The methods in this class can be categorized as follows:
Creating Rest2Ldap gateways:
rest2Ldap(org.forgerock.util.Options, java.util.Collection<org.forgerock.opendj.rest2ldap.Resource>)
- creates a gateway for a given set of resourcesnewRequestHandlerFor(java.lang.String)
- obtains a request handler for the specified endpoint resource.resource(java.lang.String)
- creates a resource having a fluent API for defining additional characteristics
such as the resource's inheritance, sub-resources, and propertiescollectionOf(java.lang.String)
- creates a one-to-many relationship. Collections support creation, deletion,
and querying of child resourcessingletonOf(java.lang.String)
- creates a one-to-one relationship. Singletons cannot be created or destroyed,
although they may be modified if they have properties which are modifiable. Singletons are usually only used as
top-level entry points into REST APIs.
resourceType()
- defines a property whose JSON value will be the name of the resource, e.g. "user"simple(org.forgerock.opendj.ldap.AttributeDescription)
- defines a property which maps a JSON value to a single LDAP attributeobject()
- defines a property which is a JSON object having zero or more nested propertiesreference(org.forgerock.opendj.ldap.AttributeDescription, org.forgerock.opendj.ldap.DN, org.forgerock.opendj.ldap.AttributeDescription, org.forgerock.opendj.rest2ldap.PropertyMapper)
- defines a property whose JSON value is a reference to another resource. Use these for
mapping LDAP attributes which contain the DN of another LDAP entry exposed by Rest2Ldap. For example, a user's
"manager" attribute or the members of a group.Modifier and Type | Field and Description |
---|---|
static Option<DecodeOptions> |
DECODE_OPTIONS
Specifies the LDAP decoding options which should be used when decoding LDAP DNs, attribute types, and controls.
|
static Option<String> |
MVCC_ATTRIBUTE
Specifies the name of the LDAP attribute which should be used for multi-version concurrency control (MVCC) if
enabled . |
static Option<ReadOnUpdatePolicy> |
READ_ON_UPDATE_POLICY
Specifies the policy which should be used in order to read an entry before it is deleted, or after it is added or
modified.
|
static Option<Boolean> |
USE_MVCC
Specifies whether Rest2Ldap should support multi-version concurrency control (MVCC) through the use of an MVCC
LDAP
attribute such as "etag". |
static Option<Boolean> |
USE_PERMISSIVE_MODIFY
Specifies whether Rest2Ldap should perform LDAP modify operations using the LDAP permissive modify
control.
|
static Option<Boolean> |
USE_SUBTREE_DELETE
Specifies whether Rest2Ldap should perform LDAP delete operations using the LDAP subtree delete control.
|
Modifier and Type | Method and Description |
---|---|
static ResourceException |
asResourceException(Throwable t)
Adapts a
Throwable to a ResourceException . |
static SubResourceCollection |
collectionOf(String resourceId)
Creates a new
collection sub-resource definition whose members will be resources
having the provided resource ID or its sub-types. |
static PropertyMapper |
constant(Object value)
Returns a property mapper which maps a single JSON attribute to a JSON constant.
|
RequestHandler |
newRequestHandlerFor(String resourceId)
Returns a
RequestHandler which will handle requests to the named resource and any of its sub-resources. |
static ObjectPropertyMapper |
object()
Returns a property mapper which maps JSON objects to LDAP attributes.
|
static ReferencePropertyMapper |
reference(AttributeDescription attribute,
DN baseDN,
AttributeDescription primaryKey,
PropertyMapper mapper)
Returns a property mapper which provides a mapping from a JSON value to a single DN valued LDAP attribute.
|
static ReferencePropertyMapper |
reference(String attribute,
String baseDN,
String primaryKey,
PropertyMapper mapper)
Returns a property mapper which provides a mapping from a JSON value to a single DN valued LDAP attribute.
|
static Resource |
resource(String resourceId)
Creates a new
resource definition with the provided resource ID. |
static PropertyMapper |
resourceType()
Returns a property mapper which maps a JSON property containing the resource type to its associated LDAP
object classes.
|
static Rest2Ldap |
rest2Ldap(Options options,
Collection<Resource> resources)
|
static Rest2Ldap |
rest2Ldap(Options options,
Resource... resources)
|
static SimplePropertyMapper |
simple(AttributeDescription attribute)
Returns a property mapper which provides a simple mapping from a JSON value to a single LDAP attribute.
|
static SimplePropertyMapper |
simple(String attribute)
Returns a property mapper which provides a simple mapping from a JSON value to a single LDAP attribute.
|
static SubResourceSingleton |
singletonOf(String resourceId)
Creates a new
singleton sub-resource definition which will reference a single
resource having the specified resource ID. |
public static final Option<DecodeOptions> DECODE_OPTIONS
public static final Option<Boolean> USE_MVCC
attribute
such as "etag". By default Rest2Ldap will use MVCC.public static final Option<String> MVCC_ATTRIBUTE
enabled
. By default Rest2Ldap will use the "etag" operational attribute.public static final Option<ReadOnUpdatePolicy> READ_ON_UPDATE_POLICY
controls
read on update policy.public static final Option<Boolean> USE_PERMISSIVE_MODIFY
public static final Option<Boolean> USE_SUBTREE_DELETE
public static Rest2Ldap rest2Ldap(Options options, Collection<Resource> resources)
Rest2Ldap
instance using the provided options and resources
.
Applications should call newRequestHandlerFor(String)
to obtain a request handler for a specific
resource.
The supported options are defined in this class.
options
- The configuration options for interactions with the backend LDAP server. The set of available
options are provided in this class.resources
- The list of resources.public static Rest2Ldap rest2Ldap(Options options, Resource... resources)
Rest2Ldap
instance using the provided options and resources
.
Applications should call newRequestHandlerFor(String)
to obtain a request handler for a specific
resource.
The supported options are defined in this class.
options
- The configuration options for interactions with the backend LDAP server. The set of available
options are provided in this class.resources
- The list of resources.public static Resource resource(String resourceId)
resource
definition with the provided resource ID.resourceId
- The resource ID.public static SubResourceCollection collectionOf(String resourceId)
collection
sub-resource definition whose members will be resources
having the provided resource ID or its sub-types.resourceId
- The type of resource contained in the sub-resource collection.public static SubResourceSingleton singletonOf(String resourceId)
singleton
sub-resource definition which will reference a single
resource having the specified resource ID.resourceId
- The type of resource referenced by the sub-resource singleton.public static PropertyMapper resourceType()
public static PropertyMapper constant(Object value)
value
- The constant JSON value (a Boolean, Number, String, Map, or List).public static ObjectPropertyMapper object()
public static ReferencePropertyMapper reference(AttributeDescription attribute, DN baseDN, AttributeDescription primaryKey, PropertyMapper mapper)
attribute
- The DN valued LDAP attribute to be mapped.baseDN
- The search base DN for performing reverse lookups.primaryKey
- The search primary key LDAP attribute to use for performing reverse lookups.mapper
- An property mapper which will be used to map LDAP attributes in the referenced entry.public static ReferencePropertyMapper reference(String attribute, String baseDN, String primaryKey, PropertyMapper mapper)
attribute
- The DN valued LDAP attribute to be mapped.baseDN
- The search base DN for performing reverse lookups.primaryKey
- The search primary key LDAP attribute to use for performing reverse lookups.mapper
- An property mapper which will be used to map LDAP attributes in the referenced entry.public static SimplePropertyMapper simple(AttributeDescription attribute)
attribute
- The LDAP attribute to be mapped.public static SimplePropertyMapper simple(String attribute)
attribute
- The LDAP attribute to be mapped.public static ResourceException asResourceException(Throwable t)
Throwable
to a ResourceException
. If the Throwable
is an LDAP
LdapException
then an appropriate ResourceException
is returned, otherwise an InternalServerErrorException
is returned.t
- The Throwable
to be converted.public RequestHandler newRequestHandlerFor(String resourceId)
RequestHandler
which will handle requests to the named resource and any of its sub-resources.resourceId
- The resource ID.RequestHandler
which will handle requests to the named resource.Copyright 2010-2017 ForgeRock AS.