public interface RepositoryService
Identity Repository Interface.
This service provides repository for objects that are commonly found in identity management deployments. It is used for storage and retrieval of objects. It also supports modifications (relative changes), searching and basic coordination.
Supported object types:
Identity repository may add some kind of basic logic in addition to a pure storage of data. E.g. it may check referential consistency, validate schema, etc.
The implementation may store the objects and properties in any suitable way and it is not required to check any schema beyond the basic common schema structures. However, the implementation MAY be able to check additional schema definitions, e.g. to check for mandatory and allowed properties and property types. This may be either explicit (e.g. implementation checking against provided XML schema) or implicit, conforming to the constraints of the underlying storage (e.g. LDAP schema enforced by underlying directory server). One way or another, the implementation may fail to store the objects that violate the schema. The method how the schemas are "loaded" to the implementation is not defined by this interface. This interface even cannot "reveal" the schema to its users (at least not now). Therefore clients of this interface must be prepared to handle schema violation errors.
The implementation is not required to index the data or provide any other optimizations. This depends on the specific implementation, its configuration and the underlying storage system. Qualitative constraints (such as performance) are NOT defined by this interface definition.
operations should be named as <operation><objectType> e.g. addUser, modifyAccount, searchObjects. The operations that returns single object instance or works on single object should be named in singular (e.g. addUser). The operation that return multiple instances should be named in plural (e.g. listObjects). Operations names should be unified as well:
The definition of this interface is somehow "fuzzy" at places. E.g. allowing schema-aware implementation but not mandating it, recommending to remove duplicates, but tolerating them, etc. The reason for this is to have better fit to the underlying storage mechanisms and therefore more efficient and simpler implementation. It may complicate the clients if the code needs to be generic and fit each and every implementation of this interface. However, such code will be quite rare. Most of the custom code will be developed to work on a specific storage (e.g. Oracle DB or LDAP) and therefore can be made slightly implementation-specific. Changing the storage in a running IDM system is extremely unlikely.
Modifier and Type | Field and Description |
---|---|
static String |
ADD_OBJECT |
static String |
ADVANCE_SEQUENCE |
static String |
CLAIM_TASK
Deprecated.
|
static String |
CLASS_NAME_WITH_DOT |
static String |
CLEANUP_TASKS |
static String |
COUNT_OBJECTS |
static String |
DELETE_OBJECT |
static String |
EXECUTE_QUERY_DIAGNOSTICS |
static String |
GET_OBJECT |
static String |
GET_VERSION |
static String |
LIST_ACCOUNT_SHADOW
Deprecated.
|
static String |
LIST_OBJECTS |
static String |
LIST_RESOURCE_OBJECT_SHADOWS |
static String |
MODIFY_OBJECT |
static String |
RELEASE_TASK
Deprecated.
|
static String |
RETURN_UNUSED_VALUES_TO_SEQUENCE |
static String |
SEARCH_CONTAINERS |
static String |
SEARCH_OBJECTS |
static String |
SEARCH_OBJECTS_ITERATIVE |
static String |
SEARCH_SHADOW_OWNER |
Modifier and Type | Method and Description |
---|---|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
addObject(PrismObject<T> object,
RepoAddOptions options,
OperationResult parentResult)
Add new object.
|
long |
advanceSequence(String oid,
OperationResult parentResult)
This operation is guaranteed to be atomic.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
countObjects(Class<T> type,
ObjectQuery query,
OperationResult parentResult)
Returns the number of objects that match specified criteria.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
deleteObject(Class<T> type,
String oid,
OperationResult parentResult)
Deletes object with specified OID.
|
RepositoryQueryDiagResponse |
executeQueryDiagnostics(RepositoryQueryDiagRequest request,
OperationResult result)
A bit of hack - execute arbitrary query, e.g.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
getObject(Class<T> type,
String oid,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult)
Returns object for provided OID.
|
RepositoryDiag |
getRepositoryDiag()
Provide repository run-time configuration and diagnostic information.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
getVersion(Class<T> type,
String oid,
OperationResult parentResult)
Returns object version for provided OID.
|
boolean |
isAnySubordinate(String upperOrgOid,
Collection<String> lowerObjectOids) |
PrismObject<com.evolveum.midpoint.xml.ns._public.common.common_3.UserType> |
listAccountShadowOwner(String accountOid,
OperationResult parentResult)
Deprecated.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType> |
listResourceObjectShadows(String resourceOid,
Class<T> resourceObjectShadowType,
OperationResult parentResult)
Search for resource object shadows of a specified type that belong to the
specified resource.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
modifyObject(Class<T> type,
String oid,
Collection<? extends ItemDelta> modifications,
OperationResult parentResult)
Modifies object using relative change description.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
modifyObject(Class<T> type,
String oid,
Collection<? extends ItemDelta> modifications,
RepoModifyOptions options,
OperationResult parentResult) |
void |
repositorySelfTest(OperationResult parentResult)
Runs a short, non-descructive repository self test.
|
void |
returnUnusedValuesToSequence(String oid,
Collection<Long> unusedValues,
OperationResult parentResult)
The sequence may ignore the values, e.g.
|
<T extends Containerable> |
searchContainers(Class<T> type,
ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult)
Search for "sub-object" structures, i.e.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
searchObjects(Class<T> type,
ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult)
Search for objects in the repository.
|
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> |
searchObjectsIterative(Class<T> type,
ObjectQuery query,
ResultHandler<T> handler,
Collection<SelectorOptions<GetOperationOptions>> options,
boolean strictlySequential,
OperationResult parentResult)
Search for objects in the repository in an iterative fashion.
|
<F extends com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType> |
searchShadowOwner(String shadowOid,
Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult)
Returns the object representing owner of specified shadow.
|
void |
testOrgClosureConsistency(boolean repairIfNecessary,
OperationResult testResult)
Checks a closure for consistency, repairing any problems found.
|
static final String CLASS_NAME_WITH_DOT
static final String GET_OBJECT
static final String LIST_OBJECTS
@Deprecated static final String LIST_ACCOUNT_SHADOW
static final String ADD_OBJECT
static final String DELETE_OBJECT
@Deprecated static final String CLAIM_TASK
@Deprecated static final String RELEASE_TASK
static final String SEARCH_OBJECTS
static final String SEARCH_CONTAINERS
static final String LIST_RESOURCE_OBJECT_SHADOWS
static final String MODIFY_OBJECT
static final String COUNT_OBJECTS
static final String GET_VERSION
static final String SEARCH_OBJECTS_ITERATIVE
static final String CLEANUP_TASKS
static final String SEARCH_SHADOW_OWNER
static final String ADVANCE_SEQUENCE
static final String RETURN_UNUSED_VALUES_TO_SEQUENCE
static final String EXECUTE_QUERY_DIAGNOSTICS
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> PrismObject<T> getObject(Class<T> type, String oid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
oid
- OID of the object to getparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- requested object does not existSchemaException
- error dealing with storage schemaIllegalArgumentException
- wrong OID format, etc.<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> String getVersion(Class<T> type, String oid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
oid
- OID of the object to getparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- requested object does not existSchemaException
- error dealing with storage schemaIllegalArgumentException
- wrong OID format, etc.<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> String addObject(PrismObject<T> object, RepoAddOptions options, OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException
Add new object.
The OID provided in the input message may be empty. In that case the OID will be assigned by the implementation of this method and it will be provided as return value.
This operation should fail if such object already exists (if object with the provided OID already exists).
The operation may fail if provided OID is in an unusable format for the storage. Generating own OIDs and providing them to this method is not recommended for normal operation.
Should be atomic. Should not allow creation of two objects with the same OID (even if created in parallel).
The operation may fail if the object to be created does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
Note: no need for explicit type parameter here. The object parameter contains the information.
object
- object to createparentResult
- parent OperationResult (in/out)ObjectAlreadyExistsException
- object with specified identifiers already exists, cannot addSchemaException
- error dealing with storage schema, e.g. schema violationIllegalArgumentException
- wrong OID format, etc.<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> SearchResultList<PrismObject<T>> searchObjects(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws SchemaException
Search for objects in the repository.
If no search criteria specified, list of all objects of specified type is returned.
Searches through all object types. Returns a list of objects that match search criteria.
Returns empty list if object type is correct but there are no objects of that type. The ordering of the results is not significant and may be arbitrary unless sorting in the paging is used.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
query
- search querypaging
- paging specification to limit operation result (optional)parentResult
- parent OperationResult (in/out)IllegalArgumentException
- wrong object typeSchemaException
- unknown property used in search query<T extends Containerable> SearchResultList<T> searchContainers(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult) throws SchemaException
T
- type
- query
- options
- parentResult
- SchemaException
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> SearchResultMetadata searchObjectsIterative(Class<T> type, ObjectQuery query, ResultHandler<T> handler, Collection<SelectorOptions<GetOperationOptions>> options, boolean strictlySequential, OperationResult parentResult) throws SchemaException
Search for objects in the repository in an iterative fashion.
Searches through all object types. Calls a specified handler for each object found. If no search criteria specified, list of all objects of specified type is returned.
Searches through all object types. Returns a list of objects that match search criteria.
Returns empty list if object type is correct but there are no objects of that type. The ordering of the results is not significant and may be arbitrary unless sorting in the paging is used.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
query
- search queryhandler
- result handlerstrictlySequential
- takes care not to skip any object nor to process objects more than once;
currently requires paging NOT to be used - uses its own pagingparentResult
- parent OperationResult (in/out)IllegalArgumentException
- wrong object typeSchemaException
- unknown property used in search query<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> int countObjects(Class<T> type, ObjectQuery query, OperationResult parentResult) throws SchemaException
Returns the number of objects that match specified criteria.
If no search criteria specified, count of all objects of specified type is returned.
Should fail if object type is wrong. Should fail if unknown property is specified in the query.
query
- search querypaging
- paging specification to limit operation result (optional)parentResult
- parent OperationResult (in/out)IllegalArgumentException
- wrong object typeSchemaException
- unknown property used in search queryboolean isAnySubordinate(String upperOrgOid, Collection<String> lowerObjectOids) throws SchemaException
SchemaException
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException
Modifies object using relative change description.
Must fail if user with provided OID does not exists. Must fail if any of the described changes cannot be applied. Should be atomic.If two or more modify operations are executed in parallel, the operations should be merged. In case that the operations are in conflict (e.g. one operation adding a value and the other removing the same value), the result is not deterministic.
The operation may fail if the modified object does not conform to the underlying schema of the storage system or the schema enforced by the implementation.
TODO: optimistic lockingparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existSchemaException
- resulting object would violate the schemaObjectAlreadyExistsException
- if resulting object would have name which already exists in another object of the same typeIllegalArgumentException
- wrong OID format, described change is not applicable<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, RepoModifyOptions options, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException
<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> void deleteObject(Class<T> type, String oid, OperationResult parentResult) throws ObjectNotFoundException
Deletes object with specified OID.
Must fail if object with specified OID does not exists. Should be atomic.
oid
- OID of object to deleteparentResult
- parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existIllegalArgumentException
- wrong OID format, described change is not applicable@Deprecated PrismObject<com.evolveum.midpoint.xml.ns._public.common.common_3.UserType> listAccountShadowOwner(String accountOid, OperationResult parentResult) throws ObjectNotFoundException
Returns the User object representing owner of specified account (account shadow).
May return null if there is no owner specified for the account.
May only be called with OID of AccountShadow object.
Implements the backward "owns" association between account shadow and user. Forward association is implemented by property "account" of user object.
This is a "list" operation even though it may return at most one owner. However the operation implies searching the repository for an owner, which may be less efficient that following a direct association. Hence it is called "list" to indicate that there may be non-negligible overhead.
accountOid
- OID of account shadowparentResult
- parentResult parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existIllegalArgumentException
- wrong OID format<F extends com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType> PrismObject<F> searchShadowOwner(String shadowOid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
Returns the object representing owner of specified shadow.
Implements the backward "owns" association between account shadow and user. Forward association is implemented by linkRef reference in subclasses of FocusType.
Returns null if there is no owner for the shadow.This is a "search" operation even though it may return at most one owner. However the operation implies searching the repository for an owner, which may be less efficient that following a direct association. Hence it is called "search" to indicate that there may be non-negligible overhead.
This method should not die even if the specified shadow does not exist. Even if the shadow is gone, it still may be used in some linkRefs. This method should be able to find objects with such linkeRefs otherwise we will not be able to do proper cleanup.
shadowOid
- OID of shadowparentResult
- parentResult parent OperationResult (in/out)IllegalArgumentException
- wrong OID format<T extends com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType> List<PrismObject<T>> listResourceObjectShadows(String resourceOid, Class<T> resourceObjectShadowType, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
Search for resource object shadows of a specified type that belong to the specified resource.
Returns a list of such object shadows or empty list if nothing was found.
Implements the backward "has" association between resource and resource object shadows. Forward association is implemented by property "resource" of resource object shadow.
May only be called with OID of Resource object.
resourceOid
- OID of resource definition (ResourceType)parentResult
- parentResult parent OperationResult (in/out)ObjectNotFoundException
- specified object does not existSchemaException
- found object is not type of ShadowType
IllegalArgumentException
- wrong OID formatlong advanceSequence(String oid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
oid
- sequence OIDparentResult
- ObjectNotFoundException
- the sequence does not existSchemaException
- the sequence cannot produce a value (e.g. maximum counter reached)void returnUnusedValuesToSequence(String oid, Collection<Long> unusedValues, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
oid
- unusedValues
- parentResult
- ObjectNotFoundException
SchemaException
RepositoryDiag getRepositoryDiag()
void repositorySelfTest(OperationResult parentResult)
void testOrgClosureConsistency(boolean repairIfNecessary, OperationResult testResult)
RepositoryQueryDiagResponse executeQueryDiagnostics(RepositoryQueryDiagRequest request, OperationResult result)
request
- result
- Copyright © 2016 evolveum. All rights reserved.